diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3e56242bf9..d2939e8d47 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -53,9 +53,3 @@ /modules/images/dominant-color-images @pbearne @spacedmonkey /tests/modules/images/dominant-color-images @pbearne @spacedmonkey /tests/testdata/modules/images/dominant-color-images @pbearne @spacedmonkey - -# Module: Fetchpriority -/modules/images/fetchpriority @pbearne @adamsilverstein -/tests/modules/images/fetchpriority @pbearne @adamsilverstein -/tests/testdata/modules/images/fetchpriority @pbearne @adamsilverstein - diff --git a/load.php b/load.php index 6b1d7bd153..eda321c0d5 100644 --- a/load.php +++ b/load.php @@ -289,7 +289,6 @@ function perflab_is_standalone_plugin_loaded( $module ) { function perflab_get_standalone_plugins_constants() { return array( 'images/dominant-color-images' => 'DOMINANT_COLOR_IMAGES_VERSION', - 'images/fetchpriority' => 'FETCHPRIORITY_VERSION', 'images/webp-uploads' => 'WEBP_UPLOADS_VERSION', ); } diff --git a/modules/images/fetchpriority/.wordpress-org/banner-1544x500.png b/modules/images/fetchpriority/.wordpress-org/banner-1544x500.png deleted file mode 100644 index b20f137e22..0000000000 Binary files a/modules/images/fetchpriority/.wordpress-org/banner-1544x500.png and /dev/null differ diff --git a/modules/images/fetchpriority/.wordpress-org/banner-772x250.png b/modules/images/fetchpriority/.wordpress-org/banner-772x250.png deleted file mode 100644 index 2b9b5afda9..0000000000 Binary files a/modules/images/fetchpriority/.wordpress-org/banner-772x250.png and /dev/null differ diff --git a/modules/images/fetchpriority/.wordpress-org/icon-128x128.png b/modules/images/fetchpriority/.wordpress-org/icon-128x128.png deleted file mode 100644 index 2fc00d1dab..0000000000 Binary files a/modules/images/fetchpriority/.wordpress-org/icon-128x128.png and /dev/null differ diff --git a/modules/images/fetchpriority/.wordpress-org/icon-256x256.png b/modules/images/fetchpriority/.wordpress-org/icon-256x256.png deleted file mode 100644 index 73cf0f79b5..0000000000 Binary files a/modules/images/fetchpriority/.wordpress-org/icon-256x256.png and /dev/null differ diff --git a/modules/images/fetchpriority/.wordpress-org/icon.svg b/modules/images/fetchpriority/.wordpress-org/icon.svg deleted file mode 100644 index 7a6233934a..0000000000 --- a/modules/images/fetchpriority/.wordpress-org/icon.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/modules/images/fetchpriority/can-load.php b/modules/images/fetchpriority/can-load.php deleted file mode 100644 index c08b655694..0000000000 --- a/modules/images/fetchpriority/can-load.php +++ /dev/null @@ -1,15 +0,0 @@ -' . "\n"; - } -} -add_action( 'wp_head', 'fetchpriority_render_generator' ); - -// Show an admin notice if fetchpriority is already available in WordPress core (only relevant for the standalone plugin). -if ( function_exists( 'wp_get_loading_optimization_attributes' ) && ! str_starts_with( FETCHPRIORITY_VERSION, 'Performance Lab ' ) ) { - add_action( - 'admin_notices', - static function () { - ?> -
-

- -

-
- Add New**. -2. Search for **Fetchpriority**. -3. Install and activate the **Fetchpriority** plugin. - -= Manual installation = - -1. Upload the entire `fetchpriority` folder to the `/wp-content/plugins/` directory. -2. Visit **Plugins**. -3. Activate the **Fetchpriority** plugin. - -== Frequently Asked Questions == - -= Where can I submit my plugin feedback? = - -Feedback is encouraged and much appreciated, especially since this plugin may contain future WordPress core features. If you have suggestions or requests for new features, you can [submit them as an issue in the WordPress Performance Team's GitHub repository](https://github.com/WordPress/performance/issues/new/choose). If you need help with troubleshooting or have a question about the plugin, please [create a new topic on our support forum](https://wordpress.org/support/plugin/fetchpriority/#new-topic-0). - -= Where can I report security bugs? = - -The Performance team and WordPress community take security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. - -To report a security issue, please visit the [WordPress HackerOne](https://hackerone.com/wordpress) program. - -= How can I contribute to the plugin? = - -Contributions are always welcome! Learn more about how to get involved in the [Core Performance Team Handbook](https://make.wordpress.org/performance/handbook/get-involved/). - -== Changelog == - -= 1.1.1 = - -* Add standalone plugin assets. ([815](https://github.com/WordPress/performance/pull/815)) - -= 1.1.0 = - -* Display admin notice to deactivate the plugin if feature already available in WordPress core. ([769](https://github.com/WordPress/performance/pull/769)) - -= 1.0.0 = - -* Initial release of the Fetchpriority plugin as a standalone plugin. ([704](https://github.com/WordPress/performance/pull/704)) diff --git a/plugins.json b/plugins.json index c2ae384eec..4551744f77 100644 --- a/plugins.json +++ b/plugins.json @@ -3,10 +3,6 @@ "slug": "dominant-color-images", "version": "1.0.0" }, - "images/fetchpriority": { - "slug": "fetchpriority", - "version": "1.1.1" - }, "images/webp-uploads": { "slug": "webp-uploads", "version": "1.0.3" diff --git a/tests/modules/images/fetchpriority/fetchpriority-tests.php b/tests/modules/images/fetchpriority/fetchpriority-tests.php deleted file mode 100644 index 62e4732300..0000000000 --- a/tests/modules/images/fetchpriority/fetchpriority-tests.php +++ /dev/null @@ -1,90 +0,0 @@ -post->create_and_get(); - $file = DIR_TESTDATA . '/images/canola.jpg'; - self::$attachment_id = $factory->attachment->create_upload_object( - $file, - self::$post->ID, - array( - 'post_mime_type' => 'image/jpeg', - ) - ); - self::$attachment_id_2 = $factory->attachment->create_upload_object( - $file, - self::$post->ID, - array( - 'post_mime_type' => 'image/jpeg', - ) - ); - } - - public static function tear_down_after_class() { - wp_delete_attachment( self::$attachment_id, true ); - wp_delete_attachment( self::$attachment_id_2, true ); - parent::tear_down_after_class(); - } - - public function set_up() { - parent::set_up(); - - if ( ! perflab_can_load_module( 'images/fetchpriority' ) ) { - $this->markTestSkipped( 'Fetchpriority module tests irrelevant since available in WordPress core' ); - } - } - - public function test_fetchpriority_img_tag_add_attr_based_on_context_and_loading_lazy() { - $img = get_image_tag( self::$attachment_id, '', '', '', 'large' ); - - $this->assertStringContainsString( 'fetchpriority="high"', fetchpriority_img_tag_add_attr( $img, 'the_content' ) ); - $this->assertStringNotContainsString( 'fetchpriority="high"', fetchpriority_img_tag_add_attr( $img, 'not_content' ) ); - - $img = str_replace( 'assertStringNotContainsString( 'fetchpriority="high"', fetchpriority_img_tag_add_attr( $img, 'the_content' ) ); - } - - public function test_fetchpriority_img_tag_add_in_wp_filter_content_tags() { - global $wp_query; - global $wp_the_query; - $img = get_image_tag( self::$attachment_id, '', '', '', 'large' ); - $img_2 = get_image_tag( self::$attachment_id_2, '', '', '', 'large' ); - - $img = ' -
' . $img . '
- - -

This is an example page.

- - -
' . $img_2 . '
- -'; - // Ensure image filtering occurs 'in_the_loop', is_main_query. - $wp_the_query = $wp_query; - $wp_query->in_the_loop = true; - $content = wp_filter_content_tags( $img, 'the_content' ); - $this->assertStringContainsString( 'fetchpriority="high"', $content ); - $this->assertStringContainsString( 'loading="lazy"', $content ); - $this->assertTrue( strpos( $content, 'fetchpriority="high"' ) < strpos( $content, 'loading="lazy"' ) ); - - $this->assertEquals( 1, substr_count( $content, 'fetchpriority' ) ); - - // Disable lazy loading and verify fetchpriority isn't added. - add_filter( 'wp_lazy_loading_enabled', '__return_false' ); - $content = wp_filter_content_tags( $img, 'the_content' ); - $this->assertStringNotContainsString( 'fetchpriority="high"', $content ); - - } -}