Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPCS Improvement #1123

Merged
merged 6 commits into from Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/auto-sizes/hooks.php
Expand Up @@ -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,' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_contains() is only available as of PHP8. However, since WP 5.9 and later implement a polyfill for this, then this is fine.

return $attr;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/optimization-detective/optimization.php
Expand Up @@ -80,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.
'GET' !== $_SERVER['REQUEST_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()
Expand Down