Coding Standards: Use strict comparison in `wp-includes/theme.php`.

Follow-up to [12025], [14850], [15641], [20029], [22436], [35738], [36915], [58213].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.
Built from https://develop.svn.wordpress.org/trunk@58366


git-svn-id: http://core.svn.wordpress.org/trunk@57815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-06-08 16:23:12 +00:00
parent 8683a502a0
commit f614aaef48
2 changed files with 13 additions and 13 deletions

View File

@ -91,7 +91,7 @@ function wp_get_themes( $args = array() ) {
if ( null !== $args['errors'] ) { if ( null !== $args['errors'] ) {
foreach ( $themes as $theme => $wp_theme ) { foreach ( $themes as $theme => $wp_theme ) {
if ( $wp_theme->errors() != $args['errors'] ) { if ( (bool) $wp_theme->errors() !== $args['errors'] ) {
unset( $themes[ $theme ] ); unset( $themes[ $theme ] );
} }
} }
@ -577,7 +577,7 @@ function search_theme_directories( $force = false ) {
$theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative. $theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative.
} }
if ( get_site_transient( 'theme_roots' ) != $theme_roots ) { if ( get_site_transient( 'theme_roots' ) !== $theme_roots ) {
set_site_transient( 'theme_roots', $theme_roots, $cache_expiration ); set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
} }
@ -705,9 +705,9 @@ function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
// If requesting the root for the active theme, consult options to avoid calling get_theme_roots(). // If requesting the root for the active theme, consult options to avoid calling get_theme_roots().
if ( ! $skip_cache ) { if ( ! $skip_cache ) {
if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) { if ( get_option( 'stylesheet' ) === $stylesheet_or_template ) {
$theme_root = get_option( 'stylesheet_root' ); $theme_root = get_option( 'stylesheet_root' );
} elseif ( get_option( 'template' ) == $stylesheet_or_template ) { } elseif ( get_option( 'template' ) === $stylesheet_or_template ) {
$theme_root = get_option( 'template_root' ); $theme_root = get_option( 'template_root' );
} }
} }
@ -942,7 +942,7 @@ function validate_current_theme() {
* if it turns out there is no default theme installed. (That's `false`.) * if it turns out there is no default theme installed. (That's `false`.)
*/ */
$default = WP_Theme::get_core_default_theme(); $default = WP_Theme::get_core_default_theme();
if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) { if ( false === $default || get_stylesheet() === $default->get_stylesheet() ) {
return true; return true;
} }
@ -1567,7 +1567,7 @@ function get_custom_header() {
if ( ! empty( $_wp_default_headers ) ) { if ( ! empty( $_wp_default_headers ) ) {
foreach ( (array) $_wp_default_headers as $default_header ) { foreach ( (array) $_wp_default_headers as $default_header ) {
$url = vsprintf( $default_header['url'], $directory_args ); $url = vsprintf( $default_header['url'], $directory_args );
if ( $data['url'] == $url ) { if ( $data['url'] === $url ) {
$data = $default_header; $data = $default_header;
$data['url'] = $url; $data['url'] = $url;
$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
@ -3444,24 +3444,24 @@ function _delete_attachment_theme_mod( $id ) {
$attachment_image = wp_get_attachment_url( $id ); $attachment_image = wp_get_attachment_url( $id );
$header_image = get_header_image(); $header_image = get_header_image();
$background_image = get_background_image(); $background_image = get_background_image();
$custom_logo_id = get_theme_mod( 'custom_logo' ); $custom_logo_id = (int) get_theme_mod( 'custom_logo' );
$site_logo_id = get_option( 'site_logo' ); $site_logo_id = (int) get_option( 'site_logo' );
if ( $custom_logo_id && $custom_logo_id == $id ) { if ( $custom_logo_id && $custom_logo_id === $id ) {
remove_theme_mod( 'custom_logo' ); remove_theme_mod( 'custom_logo' );
remove_theme_mod( 'header_text' ); remove_theme_mod( 'header_text' );
} }
if ( $site_logo_id && $site_logo_id == $id ) { if ( $site_logo_id && $site_logo_id === $id ) {
delete_option( 'site_logo' ); delete_option( 'site_logo' );
} }
if ( $header_image && $header_image == $attachment_image ) { if ( $header_image && $header_image === $attachment_image ) {
remove_theme_mod( 'header_image' ); remove_theme_mod( 'header_image' );
remove_theme_mod( 'header_image_data' ); remove_theme_mod( 'header_image_data' );
} }
if ( $background_image && $background_image == $attachment_image ) { if ( $background_image && $background_image === $attachment_image ) {
remove_theme_mod( 'background_image' ); remove_theme_mod( 'background_image' );
} }
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-beta1-58365'; $wp_version = '6.6-beta1-58366';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.