diff --git a/includes/amp-helper-functions.php b/includes/amp-helper-functions.php index 1844bb0bf06..d07ba87f587 100644 --- a/includes/amp-helper-functions.php +++ b/includes/amp-helper-functions.php @@ -998,6 +998,12 @@ function amp_register_default_scripts( $wp_scripts ) { $version = $extension_spec['latest']; } + // Skip registering the amp-gfycat extension. + // @TODO: Remove this once the amp-gfycat extension is removed from spec. + if ( 'amp-gfycat' === $extension_name ) { + continue; + } + $src = sprintf( 'https://cdn.ampproject.org/v0/%s-%s.js', $extension_name, @@ -1408,7 +1414,6 @@ function amp_get_content_embed_handlers( $post = null ) { AMP_TikTok_Embed_Handler::class => [], AMP_Tumblr_Embed_Handler::class => [], AMP_Gallery_Embed_Handler::class => [], - AMP_Gfycat_Embed_Handler::class => [], AMP_Imgur_Embed_Handler::class => [], AMP_Scribd_Embed_Handler::class => [], AMP_WordPress_Embed_Handler::class => [], diff --git a/includes/embeds/class-amp-gfycat-embed-handler.php b/includes/embeds/class-amp-gfycat-embed-handler.php deleted file mode 100644 index d2982c3b357..00000000000 --- a/includes/embeds/class-amp-gfycat-embed-handler.php +++ /dev/null @@ -1,83 +0,0 @@ - 'v0/amp-fx-collection-0.1.js', 'amp-fx-flying-carpet' => 'v0/amp-fx-flying-carpet-0.1.js', 'amp-geo' => 'v0/amp-geo-0.1.js', - 'amp-gfycat' => 'v0/amp-gfycat-0.1.js', 'amp-gist' => 'v0/amp-gist-0.1.js', 'amp-google-document-embed' => 'v0/amp-google-document-embed-0.1.js', 'amp-google-read-aloud-player' => 'v0/amp-google-read-aloud-player-0.1.js', @@ -1714,7 +1713,6 @@ public function test_amp_register_default_scripts_and_styles_with_bento() { 'amp-fx-collection' => 'v0/amp-fx-collection-0.1.js', 'amp-fx-flying-carpet' => 'v0/amp-fx-flying-carpet-0.1.js', 'amp-geo' => 'v0/amp-geo-0.1.js', - 'amp-gfycat' => 'v0/amp-gfycat-0.1.js', 'amp-gist' => 'v0/amp-gist-0.1.js', 'amp-google-document-embed' => 'v0/amp-google-document-embed-0.1.js', 'amp-google-read-aloud-player' => 'v0/amp-google-read-aloud-player-0.1.js', diff --git a/tests/php/test-class-amp-gfycat-embed-handler.php b/tests/php/test-class-amp-gfycat-embed-handler.php deleted file mode 100644 index 8c80d54838d..00000000000 --- a/tests/php/test-class-amp-gfycat-embed-handler.php +++ /dev/null @@ -1,131 +0,0 @@ -prevent_block_pre_render(); - - // Mock the HTTP request. - add_filter( - 'pre_oembed_result', - static function( $pre, $url ) { - if ( in_array( 'external-http', $_SERVER['argv'], true ) ) { - return $pre; - } - - if ( false === strpos( $url, 'tautwhoppingcougar' ) ) { - return $pre; - } - return ''; - }, - 10, - 2 - ); - } - - /** - * Get conversion data. - * - * @return array - */ - public function get_conversion_data() { - return [ - 'no_embed' => [ - '
Hello world.
', - 'Hello world.
' . PHP_EOL, - ], - - 'url_simple' => [ - 'https://gfycat.com/tautwhoppingcougar' . PHP_EOL, - 'Hello World.
', - [], - ], - 'converted' => [ - 'https://www.gfycat.com/gifs/detail/tautwhoppingcougar' . PHP_EOL, - [ 'amp-gfycat' => true ], - ], - ]; - } - - /** - * Test scripts. - * - * @param string $source Source. - * @param string $expected Expected. - * @dataProvider get_scripts_data - */ - public function test__get_scripts( $source, $expected ) { - $embed = new AMP_Gfycat_Embed_Handler(); - $embed->register_embed(); - $source = apply_filters( 'the_content', $source ); - - $validating_sanitizer = new AMP_Tag_And_Attribute_Sanitizer( AMP_DOM_Utils::get_dom_from_content( $source ) ); - $validating_sanitizer->sanitize(); - - $scripts = array_merge( - $embed->get_scripts(), - $validating_sanitizer->get_scripts() - ); - - $this->assertEquals( $expected, $scripts ); - } -} diff --git a/tests/php/test-tag-and-attribute-sanitizer.php b/tests/php/test-tag-and-attribute-sanitizer.php index 52adaf8359f..4a077f2d9a3 100644 --- a/tests/php/test-tag-and-attribute-sanitizer.php +++ b/tests/php/test-tag-and-attribute-sanitizer.php @@ -965,12 +965,6 @@ static function () { [ 'amp-form' ], ], - 'gfycat' => [ - '