From 5c773867fc74ff1601b1ceb665b58de0f476ee15 Mon Sep 17 00:00:00 2001 From: Shyamsundar Gadde Date: Wed, 11 Dec 2024 23:14:28 +0530 Subject: [PATCH 1/6] Add guidance for managing Performance feature plugins Signed-off-by: Shyamsundar Gadde --- plugins/performance-lab/includes/admin/plugins.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index 2458792c1a..a687f69865 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -291,6 +291,16 @@ static function ( string $error_message ): string {
+

+ ', + '' + ); + ?> +

Date: Wed, 11 Dec 2024 23:45:50 +0530 Subject: [PATCH 2/6] Replace hardcoded URL with `add_query_arg()` Signed-off-by: Shyamsundar Gadde --- plugins/performance-lab/includes/admin/plugins.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index a687f69865..377f984ba3 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -296,7 +296,15 @@ static function ( string $error_message ): string { printf( /* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */ esc_html__( 'Performance features are installed as plugins. To update features or remove them, %1$s manage them on the plugins screen. %2$s', 'performance-lab' ), - '', + '', '' ); ?> From 7b8312790f9b7fe44e570370bfb96b37c3e84b6c Mon Sep 17 00:00:00 2001 From: Shyamsundar Gadde Date: Thu, 12 Dec 2024 21:14:22 +0530 Subject: [PATCH 3/6] Refactor plugins screen message to use `wp_kses` Co-authored-by: Weston Ruter --- .../includes/admin/plugins.php | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index 377f984ba3..bbfc41a32a 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -293,20 +293,23 @@ static function ( string $error_message ): string {

'WordPress Performance Team', - 'plugin_status' => 'all', - ), - admin_url( 'plugins.php' ) + $plugins_url = add_query_arg( + array( + 's' => 'WordPress Performance Team', + 'plugin_status' => 'all', + ), + admin_url( 'plugins.php' ) + ); + echo wp_kses( + sprintf( + /* translators: %s is the URL to the plugins screen */ + __( 'Performance features are installed as plugins. To update features or remove them, manage them on the plugins screen.', 'performance-lab' ), + esc_url( $plugins_url ) + ), + array( + 'a' => array( 'href' => true ), ) - ) . '">', - '' - ); + ); ?>

Date: Mon, 16 Dec 2024 10:10:11 +0530 Subject: [PATCH 4/6] Remove auto_sizes_get_layout_settings() --- .../auto-sizes/includes/improve-calculate-sizes.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/plugins/auto-sizes/includes/improve-calculate-sizes.php b/plugins/auto-sizes/includes/improve-calculate-sizes.php index 1e0c5113fd..ba2ba49d19 100644 --- a/plugins/auto-sizes/includes/improve-calculate-sizes.php +++ b/plugins/auto-sizes/includes/improve-calculate-sizes.php @@ -229,7 +229,7 @@ function auto_sizes_calculate_better_sizes( int $id, $size, string $align, int $ * @return string The alignment width based. */ function auto_sizes_get_layout_width( string $alignment ): string { - $layout = auto_sizes_get_layout_settings(); + $layout = wp_get_global_settings( array( 'layout' ) ); $layout_widths = array( 'full' => '100vw', // Todo: incorporate useRootPaddingAwareAlignments. @@ -295,14 +295,3 @@ function auto_sizes_filter_render_block_context( array $context, array $block ): return $context; } - -/** - * Retrieves the layout settings defined in theme.json. - * - * @since n.e.x.t - * - * @return array Associative array of layout settings. - */ -function auto_sizes_get_layout_settings(): array { - return wp_get_global_settings( array( 'layout' ) ); -} From 70b51ba60794e963b22935c28e3e83620b57031b Mon Sep 17 00:00:00 2001 From: Shyamsundar Gadde Date: Mon, 16 Dec 2024 13:34:09 +0530 Subject: [PATCH 5/6] Only show plugin management link to authorized users Co-authored-by: Felix Arntz --- plugins/performance-lab/includes/admin/plugins.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index bbfc41a32a..aabbd6c240 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -291,8 +291,11 @@ static function ( string $error_message ): string {
-

- +

+ 'WordPress Performance Team', @@ -310,8 +313,10 @@ static function ( string $error_message ): string { 'a' => array( 'href' => true ), ) ); - ?> -

+ ?> +

+ Date: Mon, 16 Dec 2024 13:41:31 +0530 Subject: [PATCH 6/6] Resolve PHP opening tag and whitespace violations Signed-off-by: Shyamsundar Gadde --- plugins/performance-lab/includes/admin/plugins.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/performance-lab/includes/admin/plugins.php b/plugins/performance-lab/includes/admin/plugins.php index aabbd6c240..003138e52e 100644 --- a/plugins/performance-lab/includes/admin/plugins.php +++ b/plugins/performance-lab/includes/admin/plugins.php @@ -317,7 +317,6 @@ static function ( string $error_message ): string {