Make WordPress Core

Changeset 45581


Ignore:
Timestamp:
07/01/2019 08:22:31 AM (5 years ago)
Author:
pento
Message:

Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in the default themes.

See #47632

Location:
trunk/src/wp-content/themes
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/header.php

    r45218 r45581  
    103103                 * Check if this is a post or page, if it has a thumbnail, and if it's a big one
    104104                 */
    105                 if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    106                         ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    107                         $image[1] >= $header_image_width ) :
    108                     // Houston, we have a new header image!
    109                     echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    110                 else :
     105                if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
     106                    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );
     107                    if ( $image && $image[1] >= $header_image_width ) {
     108                        // Houston, we have a new header image!
     109                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
     110                    }
     111                } else {
    111112                    // Compatibility with versions of WordPress prior to 3.4.
    112113                    if ( function_exists( 'get_custom_header' ) ) {
     
    119120                    ?>
    120121                    <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' ) ); ?>" />
    121                 <?php endif; // end check for featured image or standard header ?>
     122                    <?php
     123                } // end check for featured image or standard header
     124                ?>
    122125            </a>
    123126            <?php endif; // end check for removed header image ?>
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r45218 r45581  
    366366 */
    367367function twentyeleven_theme_options_validate( $input ) {
    368     $output = $defaults = twentyeleven_get_default_theme_options();
     368    $defaults = twentyeleven_get_default_theme_options();
     369    $output   = $defaults;
    369370
    370371    // Color scheme must be in our array of color scheme options
     
    374375
    375376    // Our defaults for the link color may have changed, based on the color scheme.
    376     $output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] );
     377    $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] );
     378    $output['link_color']   = $defaults['link_color'];
    377379
    378380    // Link color must be 3 or 6 hexadecimal characters
  • trunk/src/wp-content/themes/twentyeleven/inc/widgets.php

    r44569 r45581  
    7777        }
    7878
    79         if ( ! $args['number'] = absint( $instance['number'] ) ) {
     79        $args['number'] = absint( $instance['number'] );
     80        if ( ! $args['number'] ) {
    8081            $args['number'] = 10;
    8182        }
  • trunk/src/wp-content/themes/twentyfifteen/inc/template-tags.php

    r45256 r45581  
    2424        <div class="nav-links">
    2525            <?php
    26             if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
     26            $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) );
     27            if ( $prev_link ) {
    2728                printf( '<div class="nav-previous">%s</div>', $prev_link );
    28                 endif;
    29 
    30             if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) :
     29            }
     30
     31            $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) );
     32            if ( $next_link ) {
    3133                printf( '<div class="nav-next">%s</div>', $next_link );
    32                 endif;
     34            }
    3335            ?>
    3436            </div><!-- .nav-links -->
     
    142144 */
    143145function twentyfifteen_categorized_blog() {
    144     if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) {
     146    $all_the_cool_cats = get_transient( 'twentyfifteen_categories' );
     147    if ( false === $all_the_cool_cats ) {
    145148        // Create an array of all the categories that are attached to posts.
    146149        $all_the_cool_cats = get_categories(
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r45256 r45581  
    132132 */
    133133function twentyfourteen_categorized_blog() {
    134     if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) {
     134    $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' );
     135    if ( false === $all_the_cool_cats ) {
    135136        // Create an array of all the categories that are attached to posts
    136137        $all_the_cool_cats = get_categories(
  • trunk/src/wp-content/themes/twentysixteen/inc/template-tags.php

    r45256 r45581  
    210210     */
    211211    function twentysixteen_categorized_blog() {
    212         if ( false === ( $all_the_cool_cats = get_transient( 'twentysixteen_categories' ) ) ) {
     212        $all_the_cool_cats = get_transient( 'twentysixteen_categories' );
     213        if ( false === $all_the_cool_cats ) {
    213214            // Create an array of all the categories that are attached to posts.
    214215            $all_the_cool_cats = get_categories(
  • trunk/src/wp-content/themes/twentyten/header.php

    r45218 r45581  
    8686                }
    8787
    88                     // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    89                 if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    90                             has_post_thumbnail( $post->ID ) &&
    91                             ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
    92                             $image[1] >= $header_image_width ) :
    93                     // Houston, we have a new header image!
    94                     echo get_the_post_thumbnail( $post->ID );
    95                     elseif ( get_header_image() ) :
    96                         // Compatibility with versions of WordPress prior to 3.4.
    97                         if ( function_exists( 'get_custom_header' ) ) {
    98                             $header_image_width  = get_custom_header()->width;
    99                             $header_image_height = get_custom_header()->height;
    100                         } else {
    101                             $header_image_width  = HEADER_IMAGE_WIDTH;
    102                             $header_image_height = HEADER_IMAGE_HEIGHT;
    103                         }
    104                         ?>
    105                         <img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" />
    106                     <?php endif; ?>
     88                // Check if this is a post or page, if it has a thumbnail, and if it's a big one
     89                if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
     90                    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );
     91                    if ( $image && $image[1] >= $header_image_width ) {
     92                        // Houston, we have a new header image!
     93                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
     94                    }
     95                } else {
     96                    // Compatibility with versions of WordPress prior to 3.4.
     97                    if ( function_exists( 'get_custom_header' ) ) {
     98                        $header_image_width  = get_custom_header()->width;
     99                        $header_image_height = get_custom_header()->height;
     100                    } else {
     101                        $header_image_width  = HEADER_IMAGE_WIDTH;
     102                        $header_image_height = HEADER_IMAGE_HEIGHT;
     103                    }
     104                    ?>
     105                    <img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" />
     106                    <?php
     107                } // end check for featured image or standard header
     108                ?>
    107109            </div><!-- #branding -->
    108110
  • trunk/src/wp-content/themes/twentyten/loop.php

    r45209 r45581  
    9999
    100100            <div class="entry-utility">
    101             <?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
     101            <?php
     102            $gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' );
     103            if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) :
     104                ?>
    102105                <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>
    103106                <span class="meta-sep">|</span>
    104             <?php elseif ( $gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' ) && in_category( $gallery->term_id ) ) : ?>
     107            <?php elseif ( $gallery && in_category( $gallery->term_id ) ) : ?>
    105108                <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>
    106109                <span class="meta-sep">|</span>
Note: See TracChangeset for help on using the changeset viewer.