Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-thumbnail-template.php

    r41267 r42343  
    7373 */
    7474function update_post_thumbnail_cache( $wp_query = null ) {
    75     if ( ! $wp_query )
     75    if ( ! $wp_query ) {
    7676        $wp_query = $GLOBALS['wp_query'];
    77 
    78     if ( $wp_query->thumbnails_cached )
     77    }
     78
     79    if ( $wp_query->thumbnails_cached ) {
    7980        return;
     81    }
    8082
    8183    $thumb_ids = array();
    8284    foreach ( $wp_query->posts as $post ) {
    83         if ( $id = get_post_thumbnail_id( $post->ID ) )
     85        if ( $id = get_post_thumbnail_id( $post->ID ) ) {
    8486            $thumb_ids[] = $id;
    85     }
    86 
    87     if ( ! empty ( $thumb_ids ) ) {
     87        }
     88    }
     89
     90    if ( ! empty( $thumb_ids ) ) {
    8891        _prime_post_caches( $thumb_ids, false, true );
    8992    }
     
    146149         */
    147150        do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
    148         if ( in_the_loop() )
     151        if ( in_the_loop() ) {
    149152            update_post_thumbnail_cache();
     153        }
    150154        $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
    151155
Note: See TracChangeset for help on using the changeset viewer.