From a48d598753259f195655f13498cf7d34369b94ca Mon Sep 17 00:00:00 2001 From: Chintesh Prajapati <39826478+Chintesh@users.noreply.github.com> Date: Thu, 11 Apr 2024 23:31:51 +0530 Subject: [PATCH 1/5] Update hooks.php --- plugins/auto-sizes/hooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/auto-sizes/hooks.php b/plugins/auto-sizes/hooks.php index 4bcb26114..721ecea84 100644 --- a/plugins/auto-sizes/hooks.php +++ b/plugins/auto-sizes/hooks.php @@ -30,7 +30,7 @@ function auto_sizes_update_image_attributes( $attr ) { } // Don't add 'auto' to the sizes attribute if it already exists. - if ( false !== strpos( $attr['sizes'], 'auto,' ) ) { + if ( str_contains( $attr['sizes'], 'auto,' ) ) { return $attr; } From 52c934920ba36355ee4629db9c3ffab1eeb7f772 Mon Sep 17 00:00:00 2001 From: Chintesh Prajapati <39826478+Chintesh@users.noreply.github.com> Date: Thu, 11 Apr 2024 23:32:38 +0530 Subject: [PATCH 2/5] Update optimization.php --- plugins/optimization-detective/optimization.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/optimization-detective/optimization.php b/plugins/optimization-detective/optimization.php index 51dec58ff..c951da12d 100644 --- a/plugins/optimization-detective/optimization.php +++ b/plugins/optimization-detective/optimization.php @@ -73,6 +73,10 @@ function od_maybe_add_template_output_buffer_filter() { * @return bool Whether response can be optimized. */ function od_can_optimize_response(): bool { + + // Retrieve the sanitized value of the 'REQUEST_METHOD' server variable. + $method = filter_input( INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_STRING ); + $able = ! ( // Since there is no predictability in whether posts in the loop will have featured images assigned or not. If a // theme template for search results doesn't even show featured images, then this wouldn't be an issue. @@ -80,7 +84,7 @@ function od_can_optimize_response(): bool { // Since injection of inline-editing controls interfere with breadcrumbs, while also just not necessary in this context. is_customize_preview() || // Since the images detected in the response body of a POST request cannot, by definition, be cached. - 'GET' !== $_SERVER['REQUEST_METHOD'] || + ( isset( $method ) && 'GET' !== $method ) || // The aim is to optimize pages for the majority of site visitors, not those who administer the site. For admin // users, additional elements will be present like the script from wp_customize_support_script() which will // interfere with the XPath indices. Note that od_get_normalized_query_vars() is varied by is_user_logged_in() From 13e7a4aacd5d340ae47057d398676f6c74ccc4b3 Mon Sep 17 00:00:00 2001 From: Chintesh Prajapati <39826478+Chintesh@users.noreply.github.com> Date: Thu, 11 Apr 2024 23:33:03 +0530 Subject: [PATCH 3/5] Update helper.php --- plugins/speculation-rules/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/speculation-rules/helper.php b/plugins/speculation-rules/helper.php index d210edb10..3630e8786 100644 --- a/plugins/speculation-rules/helper.php +++ b/plugins/speculation-rules/helper.php @@ -93,7 +93,7 @@ function plsr_get_speculation_rules() { ), ); - // Allow adding a class on any links to prevent prerendering. + // Allow adding a class on any links to prevent pre-rendering. if ( 'prerender' === $mode ) { $rules[0]['where']['and'][] = array( 'not' => array( From abec18c536e49fe8641c747e50172496076c972d Mon Sep 17 00:00:00 2001 From: Chintesh Prajapati <39826478+Chintesh@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:02:26 +0530 Subject: [PATCH 4/5] Update optimization.php --- plugins/optimization-detective/optimization.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/optimization-detective/optimization.php b/plugins/optimization-detective/optimization.php index c951da12d..9ee0b81c0 100644 --- a/plugins/optimization-detective/optimization.php +++ b/plugins/optimization-detective/optimization.php @@ -73,10 +73,6 @@ function od_maybe_add_template_output_buffer_filter() { * @return bool Whether response can be optimized. */ function od_can_optimize_response(): bool { - - // Retrieve the sanitized value of the 'REQUEST_METHOD' server variable. - $method = filter_input( INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_STRING ); - $able = ! ( // Since there is no predictability in whether posts in the loop will have featured images assigned or not. If a // theme template for search results doesn't even show featured images, then this wouldn't be an issue. @@ -84,7 +80,7 @@ function od_can_optimize_response(): bool { // Since injection of inline-editing controls interfere with breadcrumbs, while also just not necessary in this context. is_customize_preview() || // Since the images detected in the response body of a POST request cannot, by definition, be cached. - ( isset( $method ) && 'GET' !== $method ) || + ( isset( $_SERVER['REQUEST_METHOD'] ) && 'GET' !== $_SERVER['REQUEST_METHOD'] ) || // The aim is to optimize pages for the majority of site visitors, not those who administer the site. For admin // users, additional elements will be present like the script from wp_customize_support_script() which will // interfere with the XPath indices. Note that od_get_normalized_query_vars() is varied by is_user_logged_in() From 612165dcca9dc7eeeb721248a13ab2c95294916b Mon Sep 17 00:00:00 2001 From: Chintesh Prajapati <39826478+Chintesh@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:22:36 +0530 Subject: [PATCH 5/5] Update helper.php --- plugins/speculation-rules/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/speculation-rules/helper.php b/plugins/speculation-rules/helper.php index 3630e8786..d210edb10 100644 --- a/plugins/speculation-rules/helper.php +++ b/plugins/speculation-rules/helper.php @@ -93,7 +93,7 @@ function plsr_get_speculation_rules() { ), ); - // Allow adding a class on any links to prevent pre-rendering. + // Allow adding a class on any links to prevent prerendering. if ( 'prerender' === $mode ) { $rules[0]['where']['and'][] = array( 'not' => array(