diff --git a/README.md b/README.md index 6bd6dc44c1..b99f70ce77 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,49 @@ Monorepo for the [WordPress Performance Team](https://make.wordpress.org/perform Details about the Performance Lab plugin, including instructions for getting started and contributing, are available in the [Performance Team Handbook here](https://make.wordpress.org/performance/handbook/performance-lab/). For WordPress and PHP version requirements, please see the [CONTRIBUTING.md file here](https://github.com/WordPress/performance/blob/trunk/CONTRIBUTING.md). + +The feature plugins which are currently featured by this plugin are: + +Plugin | Slug | Experimental | Links +--------------------------------|---------------------------|--------------|------------- +[Image Placeholders][1] | `dominant-color-images` | No | [Source][8], [Issues][15], [PRs][22] +[Modern Image Formats][2] | `webp-uploads` | No | [Source][9], [Issues][16], [PRs][23] +[Performant Translations][3] | `performant-translations` | No | [Source][10], [Issues][17], [PRs][24] +[Speculative Loading][4] | `speculation-rules` | No | [Source][11], [Issues][18], [PRs][25] +[Embed Optimizer][5] | `embed-optimizer` | Yes | [Source][12], [Issues][19], [PRs][26] +[Enhanced Responsive Images][6] | `auto-sizes` | Yes | [Source][13], [Issues][20], [PRs][27] +[Image Prioritizer][7] | `image-prioritizer` | Yes | [Source][14], [Issues][21], [PRs][28] + +[1]: https://wordpress.org/plugins/dominant-color-images/ +[2]: https://wordpress.org/plugins/webp-uploads/ +[3]: https://wordpress.org/plugins/performant-translations/ +[4]: https://wordpress.org/plugins/speculation-rules/ +[5]: https://wordpress.org/plugins/embed-optimizer/ +[6]: https://wordpress.org/plugins/auto-sizes/ +[7]: https://wordpress.org/plugins/image-prioritizer/ + +[8]: https://github.com/WordPress/performance/tree/trunk/plugins/dominant-color-images +[9]: https://github.com/WordPress/performance/tree/trunk/plugins/webp-uploads +[10]: https://github.com/swissspidy/performant-translations +[11]: https://github.com/WordPress/performance/tree/trunk/plugins/speculation-rules +[12]: https://github.com/WordPress/performance/tree/trunk/plugins/embed-optimizer +[13]: https://github.com/WordPress/performance/tree/trunk/plugins/auto-sizes +[14]: https://github.com/WordPress/performance/tree/trunk/plugins/image-prioritizer + +[15]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Placeholders%22 +[16]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Modern+Image+Formats%22 +[17]: https://github.com/swissspidy/performant-translations/issues +[18]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Speculative+Loading%22 +[19]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Embed+Optimizer%22 +[20]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Enhanced+Responsive+Images%22 +[21]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Prioritizer%22 + +[22]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Placeholders%22 +[23]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Modern+Image+Formats%22 +[24]: https://github.com/swissspidy/performant-translations/pulls +[25]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Speculative+Loading%22 +[26]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Embed+Optimizer%22 +[27]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Enhanced+Responsive+Images%22 +[28]: https://github.com/WordPress/performance/pulls?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Prioritizer%22 + +Note that the plugin names sometimes diverge from the plugin slugs due to scope changes. For example, a plugin's purpose may change as some of its features are merged into WordPress core. diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index 6ff043241a..a94c4d10bf 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -95,8 +95,7 @@ function perflab_render_plugins_ui(): void { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; - $plugins = array(); - $experimental_plugins = array(); + $plugins = array(); foreach ( perflab_get_standalone_plugin_data() as $plugin_slug => $plugin_data ) { $api_data = perflab_query_plugin_info( $plugin_slug ); // Data from wordpress.org. @@ -114,26 +113,30 @@ function perflab_render_plugins_ui(): void { ), array( 'type' => 'error' ) ); - continue; - } - - $plugin_data = array_merge( - array( - 'experimental' => false, - ), - $plugin_data, // Data defined within Performance Lab. - $api_data - ); - - // Separate experimental plugins so that they're displayed after non-experimental plugins. - if ( $plugin_data['experimental'] ) { - $experimental_plugins[ $plugin_slug ] = $plugin_data; } else { - $plugins[ $plugin_slug ] = $plugin_data; + $plugins[ $plugin_slug ] = array_merge( + array( + 'experimental' => false, + ), + $plugin_data, // Data defined within Performance Lab. + $api_data + ); } } - if ( count( $plugins ) === 0 && count( $experimental_plugins ) === 0 ) { + /* + * Sort plugins alphabetically, with experimental ones coming last. + * Even though `experimental` is a boolean flag, the underlying + * algorithm (`usort` with `strcmp`) makes it possible to sort by it. + */ + $plugins = wp_list_sort( + $plugins, + array( + 'experimental' => 'ASC', + 'name' => 'ASC', + ) + ); + if ( count( $plugins ) === 0 ) { return; } ?> @@ -148,9 +151,6 @@ function perflab_render_plugins_ui(): void { foreach ( $plugins as $plugin_data ) { perflab_render_plugin_card( $plugin_data ); } - foreach ( $experimental_plugins as $plugin_data ) { - perflab_render_plugin_card( $plugin_data ); - } ?> diff --git a/plugins/performance-lab/readme.txt b/plugins/performance-lab/readme.txt index 2cc4c5be1a..372c39b83e 100644 --- a/plugins/performance-lab/readme.txt +++ b/plugins/performance-lab/readme.txt @@ -11,7 +11,19 @@ Performance plugin from the WordPress Performance Team, which is a collection of == Description == -The Performance Lab plugin is a collection of features focused on enhancing performance of your site, most of which should eventually be merged into WordPress core. The plugin allows to individually enable and test the features to get their benefits before they become available in WordPress core, and to provide feedback to further improve the solutions. +The Performance Lab plugin is a collection of features focused on enhancing performance of your site, most of which should eventually be merged into WordPress core. The plugin facilitates the discovery and activation of the individual performance feature plugins which the performance team is developing. In this way you can test the features to get their benefits before they become available in WordPress core. You can also play an important role by providing feedback to further improve the solutions. + +The feature plugins which are currently featured by this plugin are: + +* [Image Placeholders](https://wordpress.org/plugins/dominant-color-images/) +* [Modern Image Formats](https://wordpress.org/plugins/webp-uploads/) +* [Performant Translations](https://wordpress.org/plugins/performant-translations/) +* [Speculative Loading](https://wordpress.org/plugins/speculation-rules/) +* [Embed Optimizer](https://wordpress.org/plugins/embed-optimizer/) _(experimental)_ +* [Enhanced Responsive Images](https://wordpress.org/plugins/auto-sizes/) _(experimental)_ +* [Image Prioritizer](https://wordpress.org/plugins/image-prioritizer/) _(experimental)_ + +These plugins can also be installed separately from installing Performance Lab, but having the Performance Lab plugin also active will ensure you find out about new performance features as they are developed. == Installation ==