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
This commit is contained in:
Gary Pendergast 2019-07-01 08:23:57 +00:00
parent 55af0f0d0a
commit 0d23be600e
9 changed files with 55 additions and 39 deletions

View File

@ -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' ) ) {
}
?>
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php endif; // end check for featured image or standard header ?>
<?php
} // end check for featured image or standard header
?>
</a>
<?php endif; // end check for removed header image ?>

View File

@ -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'] ) ) {

View File

@ -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;
}

View File

@ -23,13 +23,15 @@ if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
<h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2>
<div class="nav-links">
<?php
if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
$prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) );
if ( $prev_link ) {
printf( '<div class="nav-previous">%s</div>', $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( '<div class="nav-next">%s</div>', $next_link );
endif;
}
?>
</div><!-- .nav-links -->
</nav><!-- .comment-navigation -->
@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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;
}
?>
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" />
<?php endif; ?>
// 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;
}
?>
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" />
<?php
} // end check for featured image or standard header
?>
</div><!-- #branding -->
<div id="access" role="navigation">

View File

@ -98,10 +98,13 @@ while ( have_posts() ) :
</div><!-- .entry-content -->
<div class="entry-utility">
<?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
<?php
$gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' );
if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) :
?>
<a href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>" title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
<span class="meta-sep">|</span>
<?php elseif ( $gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' ) && in_category( $gallery->term_id ) ) : ?>
<?php elseif ( $gallery && in_category( $gallery->term_id ) ) : ?>
<a href="<?php echo esc_url( get_category_link( $gallery ) ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
<span class="meta-sep">|</span>
<?php endif; ?>

View File

@ -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.