Make WordPress Core


Ignore:
Timestamp:
06/08/2024 04:21:49 PM (2 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r58328 r58366  
    9292        if ( null !== $args['errors'] ) {
    9393                foreach ( $themes as $theme => $wp_theme ) {
    94                         if ( $wp_theme->errors() != $args['errors'] ) {
     94                        if ( (bool) $wp_theme->errors() !== $args['errors'] ) {
    9595                                unset( $themes[ $theme ] );
    9696                        }
     
    578578        }
    579579
    580         if ( get_site_transient( 'theme_roots' ) != $theme_roots ) {
     580        if ( get_site_transient( 'theme_roots' ) !== $theme_roots ) {
    581581                set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
    582582        }
     
    706706        // If requesting the root for the active theme, consult options to avoid calling get_theme_roots().
    707707        if ( ! $skip_cache ) {
    708                 if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) {
     708                if ( get_option( 'stylesheet' ) === $stylesheet_or_template ) {
    709709                        $theme_root = get_option( 'stylesheet_root' );
    710                 } elseif ( get_option( 'template' ) == $stylesheet_or_template ) {
     710                } elseif ( get_option( 'template' ) === $stylesheet_or_template ) {
    711711                        $theme_root = get_option( 'template_root' );
    712712                }
     
    943943         */
    944944        $default = WP_Theme::get_core_default_theme();
    945         if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) {
     945        if ( false === $default || get_stylesheet() === $default->get_stylesheet() ) {
    946946                return true;
    947947        }
     
    15681568                                foreach ( (array) $_wp_default_headers as $default_header ) {
    15691569                                        $url = vsprintf( $default_header['url'], $directory_args );
    1570                                         if ( $data['url'] == $url ) {
     1570                                        if ( $data['url'] === $url ) {
    15711571                                                $data                  = $default_header;
    15721572                                                $data['url']           = $url;
     
    34453445        $header_image     = get_header_image();
    34463446        $background_image = get_background_image();
    3447         $custom_logo_id   = get_theme_mod( 'custom_logo' );
    3448         $site_logo_id     = get_option( 'site_logo' );
    3449 
    3450         if ( $custom_logo_id && $custom_logo_id == $id ) {
     3447        $custom_logo_id   = (int) get_theme_mod( 'custom_logo' );
     3448        $site_logo_id     = (int) get_option( 'site_logo' );
     3449
     3450        if ( $custom_logo_id && $custom_logo_id === $id ) {
    34513451                remove_theme_mod( 'custom_logo' );
    34523452                remove_theme_mod( 'header_text' );
    34533453        }
    34543454
    3455         if ( $site_logo_id && $site_logo_id == $id ) {
     3455        if ( $site_logo_id && $site_logo_id === $id ) {
    34563456                delete_option( 'site_logo' );
    34573457        }
    34583458
    3459         if ( $header_image && $header_image == $attachment_image ) {
     3459        if ( $header_image && $header_image === $attachment_image ) {
    34603460                remove_theme_mod( 'header_image' );
    34613461                remove_theme_mod( 'header_image_data' );
    34623462        }
    34633463
    3464         if ( $background_image && $background_image == $attachment_image ) {
     3464        if ( $background_image && $background_image === $attachment_image ) {
    34653465                remove_theme_mod( 'background_image' );
    34663466        }
Note: See TracChangeset for help on using the changeset viewer.