Make WordPress Core

Changeset 57847

Timestamp:
03/16/2024 01:16:16 PM (5 months ago)
Author:
SergeyBiryukov
Message:

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

Follow-up to [20029], [20119], [20144].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

File:
1 edited

Legend:

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

    r57608 r57847  
    353353            $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true );
    354354            if ( $default_theme_slug ) {
    355                 if ( basename( $this->stylesheet ) != $default_theme_slug ) {
     355                if ( basename( $this->stylesheet ) != $default_theme_slug ) {
    356356                    $this->headers['Name'] .= '/' . $this->stylesheet;
    357357                }
     
    418418
    419419        // If we got our data from cache, we can assume that 'template' is pointing to the right place.
    420         if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) {
     420        if ( ! is_array( $cache )
     421            && $this->template !== $this->stylesheet
     422            && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' )
     423        ) {
    421424            /*
    422425             * If we're in a directory of themes inside /themes, look for the parent nearby.
     
    426429            $directories = search_theme_directories();
    427430
    428             if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
     431            if ( '.' !== $parent_dir
     432                && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' )
     433            ) {
    429434                $this->template = $parent_dir . '/' . $this->template;
    430435            } elseif ( $directories && isset( $directories[ $this->template ] ) ) {
     
    461466
    462467        // Set the parent, if we're a child theme.
    463         if ( $this->template != $this->stylesheet ) {
     468        if ( $this->template != $this->stylesheet ) {
    464469            // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
    465             if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
     470            if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
    466471                $_child->parent = null;
    467472                $_child->errors = new WP_Error(
     
    485490                );
    486491                // The two themes actually reference each other with the Template header.
    487                 if ( $_child->stylesheet == $this->template ) {
     492                if ( $_child->stylesheet == $this->template ) {
    488493                    $this->errors = new WP_Error(
    489494                        'theme_parent_invalid',
     
    17151720        }
    17161721
    1717         $current = get_current_blog_id() == $blog_id;
     1722        $current = get_current_blog_id() == $blog_id;
    17181723
    17191724        if ( $current ) {
Note: See TracChangeset for help on using the changeset viewer.