Make WordPress Core


Ignore:
Timestamp:
07/02/2019 11:41:16 PM (6 years ago)
Author:
pento
Message:

Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.

See #47632.

File:
1 edited

Legend:

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

    r45423 r45590  
    8080            $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
    8181        } else {
    82             $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
     82            $themes[ $theme ]                                    = new WP_Theme( $theme, $theme_root['theme_root'] );
     83            $_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ];
    8384        }
    8485    }
     
    464465     * @param string $cache_directory  Directory to be searched for the cache.
    465466     */
    466     if ( $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ) ) {
     467    $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' );
     468    if ( $cache_expiration ) {
    467469        $cached_roots = get_site_transient( 'theme_roots' );
    468470        if ( is_array( $cached_roots ) ) {
     
    571573    global $wp_theme_directories;
    572574
    573     if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
    574         // Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
    575         // This gives relative theme roots the benefit of the doubt when things go haywire.
    576         if ( ! in_array( $theme_root, (array) $wp_theme_directories ) ) {
    577             $theme_root = WP_CONTENT_DIR . $theme_root;
    578         }
    579     } else {
     575    $theme_root = '';
     576
     577    if ( $stylesheet_or_template ) {
     578        $theme_root = get_raw_theme_root( $stylesheet_or_template );
     579        if ( $theme_root ) {
     580            // Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
     581            // This gives relative theme roots the benefit of the doubt when things go haywire.
     582            if ( ! in_array( $theme_root, (array) $wp_theme_directories ) ) {
     583                $theme_root = WP_CONTENT_DIR . $theme_root;
     584            }
     585        }
     586    }
     587
     588    if ( ! $theme_root ) {
    580589        $theme_root = WP_CONTENT_DIR . '/themes';
    581590    }
     
    13131322        $data = get_theme_mod( 'header_image_data' );
    13141323        if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
    1315             $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
    1316             $data           = array();
    1317             $data['url']    = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
     1324            $directory_args        = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
     1325            $data                  = array();
     1326            $data['url']           = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
     1327            $data['thumbnail_url'] = $data['url'];
    13181328            if ( ! empty( $_wp_default_headers ) ) {
    13191329                foreach ( (array) $_wp_default_headers as $default_header ) {
     
    29012911 */
    29022912function check_theme_switched() {
    2903     if ( $stylesheet = get_option( 'theme_switched' ) ) {
     2913    $stylesheet = get_option( 'theme_switched' );
     2914    if ( $stylesheet ) {
    29042915        $old_theme = wp_get_theme( $stylesheet );
    29052916
Note: See TracChangeset for help on using the changeset viewer.