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-content/themes/twentyten/loop.php

    r32116 r42343  
    5656     */
    5757?>
    58 <?php while ( have_posts() ) : the_post(); ?>
     58<?php
     59while ( have_posts() ) :
     60    the_post();
     61?>
    5962
    6063<?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>
     
    7477                <?php
    7578                    $images = twentyten_get_gallery_images();
    76                     if ( $images ) :
    77                         $total_images = count( $images );
    78                         $image = reset( $images );
     79                if ( $images ) :
     80                    $total_images = count( $images );
     81                    $image        = reset( $images );
    7982                ?>
    80                         <div class="gallery-thumb">
    81                             <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
    82                         </div><!-- .gallery-thumb -->
    83                         <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyten' ),
    84                                 'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
    85                                 number_format_i18n( $total_images )
    86                             ); ?></em></p>
     83                    <div class="gallery-thumb">
     84                        <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
     85                    </div><!-- .gallery-thumb -->
     86                    <p><em>
     87                    <?php
     88                        printf(
     89                            _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyten' ),
     90                            'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
     91                            number_format_i18n( $total_images )
     92                        );
     93                            ?>
     94                            </em></p>
    8795                <?php endif; // end twentyten_get_gallery_images() check ?>
    8896                        <?php the_excerpt(); ?>
     
    105113<?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>
    106114
    107     <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) )  ) : ?>
     115    <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
    108116        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    109117
     
    143151            <div class="entry-content">
    144152                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    145                 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
     153                <?php
     154                wp_link_pages(
     155                    array(
     156                        'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ),
     157                        'after'  => '</div>',
     158                    )
     159                );
     160?>
    146161            </div><!-- .entry-content -->
    147162    <?php endif; ?>
     
    156171                <?php
    157172                    $tags_list = get_the_tag_list( '', ', ' );
    158                     if ( $tags_list ):
     173                if ( $tags_list ) :
    159174                ?>
    160                     <span class="tag-links">
    161                         <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    162                     </span>
    163                     <span class="meta-sep">|</span>
     175                <span class="tag-links">
     176                    <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
     177                </span>
     178                <span class="meta-sep">|</span>
    164179                <?php endif; ?>
    165180                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
     
    175190
    176191<?php /* Display navigation to next/previous pages when applicable */ ?>
    177 <?php if (  $wp_query->max_num_pages > 1 ) : ?>
     192<?php if ( $wp_query->max_num_pages > 1 ) : ?>
    178193                <div id="nav-below" class="navigation">
    179194                    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
Note: See TracChangeset for help on using the changeset viewer.