From 0d23be600e94fe7dcf53f338adc8c034c58b4ce6 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 1 Jul 2019 08:23:57 +0000 Subject: [PATCH] Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in the default themes. See #47632 Built from https://develop.svn.wordpress.org/trunk@45581 git-svn-id: http://core.svn.wordpress.org/trunk@45392 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyeleven/header.php | 17 ++++---- .../themes/twentyeleven/inc/theme-options.php | 6 ++- .../themes/twentyeleven/inc/widgets.php | 3 +- .../twentyfifteen/inc/template-tags.php | 13 +++--- .../twentyfourteen/inc/template-tags.php | 3 +- .../twentysixteen/inc/template-tags.php | 3 +- wp-content/themes/twentyten/header.php | 40 ++++++++++--------- wp-content/themes/twentyten/loop.php | 7 +++- wp-includes/version.php | 2 +- 9 files changed, 55 insertions(+), 39 deletions(-) diff --git a/wp-content/themes/twentyeleven/header.php b/wp-content/themes/twentyeleven/header.php index 39cbe89c11..1016b6be9f 100644 --- a/wp-content/themes/twentyeleven/header.php +++ b/wp-content/themes/twentyeleven/header.php @@ -102,12 +102,13 @@ if ( is_singular() && get_option( 'thread_comments' ) ) { * The header image. * Check if this is a post or page, if it has a thumbnail, and if it's a big one */ - if ( is_singular() && has_post_thumbnail( $post->ID ) && - ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) && - $image[1] >= $header_image_width ) : - // Houston, we have a new header image! - echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); - else : + if ( is_singular() && has_post_thumbnail( $post->ID ) ) { + $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); + if ( $image && $image[1] >= $header_image_width ) { + // Houston, we have a new header image! + echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); + } + } else { // Compatibility with versions of WordPress prior to 3.4. if ( function_exists( 'get_custom_header' ) ) { $header_image_width = get_custom_header()->width; @@ -118,7 +119,9 @@ if ( is_singular() && get_option( 'thread_comments' ) ) { } ?> <?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?> - + diff --git a/wp-content/themes/twentyeleven/inc/theme-options.php b/wp-content/themes/twentyeleven/inc/theme-options.php index fb2ff32ad0..1a30475442 100644 --- a/wp-content/themes/twentyeleven/inc/theme-options.php +++ b/wp-content/themes/twentyeleven/inc/theme-options.php @@ -365,7 +365,8 @@ function twentyeleven_theme_options_render_page() { * @param array $input An array of form input. */ function twentyeleven_theme_options_validate( $input ) { - $output = $defaults = twentyeleven_get_default_theme_options(); + $defaults = twentyeleven_get_default_theme_options(); + $output = $defaults; // Color scheme must be in our array of color scheme options if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) ) { @@ -373,7 +374,8 @@ function twentyeleven_theme_options_validate( $input ) { } // Our defaults for the link color may have changed, based on the color scheme. - $output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] ); + $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] ); + $output['link_color'] = $defaults['link_color']; // Link color must be 3 or 6 hexadecimal characters if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) ) { diff --git a/wp-content/themes/twentyeleven/inc/widgets.php b/wp-content/themes/twentyeleven/inc/widgets.php index 2a0cdb4f51..137d37c0bd 100644 --- a/wp-content/themes/twentyeleven/inc/widgets.php +++ b/wp-content/themes/twentyeleven/inc/widgets.php @@ -76,7 +76,8 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget { $instance['number'] = '10'; } - if ( ! $args['number'] = absint( $instance['number'] ) ) { + $args['number'] = absint( $instance['number'] ); + if ( ! $args['number'] ) { $args['number'] = 10; } diff --git a/wp-content/themes/twentyfifteen/inc/template-tags.php b/wp-content/themes/twentyfifteen/inc/template-tags.php index 6af6e750fd..4fdc8bff9e 100644 --- a/wp-content/themes/twentyfifteen/inc/template-tags.php +++ b/wp-content/themes/twentyfifteen/inc/template-tags.php @@ -23,13 +23,15 @@ if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :

', $prev_link ); - endif; + } - if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) : + $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ); + if ( $next_link ) { printf( '', $next_link ); - endif; + } ?> @@ -141,7 +143,8 @@ endif; * @return bool True of there is more than one category, false otherwise. */ function twentyfifteen_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) { + $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ); + if ( false === $all_the_cool_cats ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( diff --git a/wp-content/themes/twentyfourteen/inc/template-tags.php b/wp-content/themes/twentyfourteen/inc/template-tags.php index f1e952943b..35e35d77e9 100644 --- a/wp-content/themes/twentyfourteen/inc/template-tags.php +++ b/wp-content/themes/twentyfourteen/inc/template-tags.php @@ -131,7 +131,8 @@ endif; * @return boolean true if blog has more than 1 category */ function twentyfourteen_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) { + $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ); + if ( false === $all_the_cool_cats ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( diff --git a/wp-content/themes/twentysixteen/inc/template-tags.php b/wp-content/themes/twentysixteen/inc/template-tags.php index 55578bead0..6c500d432f 100644 --- a/wp-content/themes/twentysixteen/inc/template-tags.php +++ b/wp-content/themes/twentysixteen/inc/template-tags.php @@ -209,7 +209,8 @@ if ( ! function_exists( 'twentysixteen_categorized_blog' ) ) : * @return bool True if there is more than one category, false otherwise. */ function twentysixteen_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'twentysixteen_categories' ) ) ) { + $all_the_cool_cats = get_transient( 'twentysixteen_categories' ); + if ( false === $all_the_cool_cats ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php index 23a186340a..10d6f50fe7 100644 --- a/wp-content/themes/twentyten/header.php +++ b/wp-content/themes/twentyten/header.php @@ -85,25 +85,27 @@ if ( is_singular() && get_option( 'thread_comments' ) ) { $header_image_width = HEADER_IMAGE_WIDTH; } - // Check if this is a post or page, if it has a thumbnail, and if it's a big one - if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && - has_post_thumbnail( $post->ID ) && - ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && - $image[1] >= $header_image_width ) : - // Houston, we have a new header image! - echo get_the_post_thumbnail( $post->ID ); - elseif ( get_header_image() ) : - // Compatibility with versions of WordPress prior to 3.4. - if ( function_exists( 'get_custom_header' ) ) { - $header_image_width = get_custom_header()->width; - $header_image_height = get_custom_header()->height; - } else { - $header_image_width = HEADER_IMAGE_WIDTH; - $header_image_height = HEADER_IMAGE_HEIGHT; - } - ?> - - + // Check if this is a post or page, if it has a thumbnail, and if it's a big one + if ( is_singular() && has_post_thumbnail( $post->ID ) ) { + $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); + if ( $image && $image[1] >= $header_image_width ) { + // Houston, we have a new header image! + echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); + } + } else { + // Compatibility with versions of WordPress prior to 3.4. + if ( function_exists( 'get_custom_header' ) ) { + $header_image_width = get_custom_header()->width; + $header_image_height = get_custom_header()->height; + } else { + $header_image_width = HEADER_IMAGE_WIDTH; + $header_image_height = HEADER_IMAGE_HEIGHT; + } + ?> + +
- ID ) ) : ?> + ID ) ) : + ?> | - term_id ) ) : ?> + term_id ) ) : ?> | diff --git a/wp-includes/version.php b/wp-includes/version.php index 09053a503d..70905eadb4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45580'; +$wp_version = '5.3-alpha-45581'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.