Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 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/twentythirteen/image.php

    r36136 r42343  
    1717            <?php
    1818                // Start the Loop.
    19                 while ( have_posts() ) : the_post();
     19            while ( have_posts() ) :
     20                the_post();
    2021            ?>
    2122
    2223            <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
    23                 <header class="entry-header">
    24                     <h1 class="entry-title"><?php the_title(); ?></h1>
     24            <header class="entry-header">
     25                <h1 class="entry-title"><?php the_title(); ?></h1>
    2526
    26                     <div class="entry-meta">
    27                         <?php
    28                             $published_text = __( '<span class="attachment-meta">Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Return to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );
    29                             $post_title = get_the_title( $post->post_parent );
    30                             if ( empty( $post_title ) || 0 == $post->post_parent )
    31                                 $published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
     27                <div class="entry-meta">
     28                    <?php
     29                        $published_text = __( '<span class="attachment-meta">Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Return to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );
     30                        $post_title     = get_the_title( $post->post_parent );
     31                    if ( empty( $post_title ) || 0 == $post->post_parent ) {
     32                        $published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
     33                    }
    3234
    33                             printf( $published_text,
    34                                 esc_attr( get_the_date( 'c' ) ),
    35                                 esc_html( get_the_date() ),
    36                                 esc_url( get_permalink( $post->post_parent ) ),
    37                                 esc_attr( strip_tags( $post_title ) ),
    38                                 $post_title
    39                             );
     35                        printf(
     36                            $published_text,
     37                            esc_attr( get_the_date( 'c' ) ),
     38                            esc_html( get_the_date() ),
     39                            esc_url( get_permalink( $post->post_parent ) ),
     40                            esc_attr( strip_tags( $post_title ) ),
     41                            $post_title
     42                        );
    4043
    41                             $metadata = wp_get_attachment_metadata();
    42                             printf( '<span class="attachment-meta full-size-link"><a href="%1$s" title="%2$s">%3$s (%4$s &times; %5$s)</a></span>',
    43                                 esc_url( wp_get_attachment_url() ),
    44                                 esc_attr__( 'Link to full-size image', 'twentythirteen' ),
    45                                 __( 'Full resolution', 'twentythirteen' ),
    46                                 $metadata['width'],
    47                                 $metadata['height']
    48                             );
     44                        $metadata = wp_get_attachment_metadata();
     45                        printf(
     46                            '<span class="attachment-meta full-size-link"><a href="%1$s" title="%2$s">%3$s (%4$s &times; %5$s)</a></span>',
     47                            esc_url( wp_get_attachment_url() ),
     48                            esc_attr__( 'Link to full-size image', 'twentythirteen' ),
     49                            __( 'Full resolution', 'twentythirteen' ),
     50                            $metadata['width'],
     51                            $metadata['height']
     52                        );
    4953
    50                             edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' );
    51                         ?>
     54                        edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' );
     55                    ?>
    5256                    </div><!-- .entry-meta -->
    5357                </header><!-- .entry-header -->
     
    5559                <div class="entry-content">
    5660                    <nav id="image-navigation" class="navigation image-navigation" role="navigation">
    57                         <span class="nav-previous"><?php previous_image_link( false, __( '<span class="meta-nav">&larr;</span> Previous', 'twentythirteen' ) ); ?></span>
     61                    <span class="nav-previous"><?php previous_image_link( false, __( '<span class="meta-nav">&larr;</span> Previous', 'twentythirteen' ) ); ?></span>
    5862                        <span class="nav-next"><?php next_image_link( false, __( 'Next <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></span>
    5963                    </nav><!-- #image-navigation -->
     
    6165                    <div class="entry-attachment">
    6266                        <div class="attachment">
    63                             <?php twentythirteen_the_attached_image(); ?>
     67                        <?php twentythirteen_the_attached_image(); ?>
    6468
    65                             <?php if ( has_excerpt() ) : ?>
     69                        <?php if ( has_excerpt() ) : ?>
    6670                            <div class="entry-caption">
    6771                                <?php the_excerpt(); ?>
     
    7478                    <div class="entry-description">
    7579                        <?php the_content(); ?>
    76                         <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentythirteen' ), 'after' => '</div>' ) ); ?>
     80                        <?php
     81                        wp_link_pages(
     82                            array(
     83                                'before' => '<div class="page-links">' . __( 'Pages:', 'twentythirteen' ),
     84                                'after'  => '</div>',
     85                            )
     86                        );
     87                        ?>
    7788                    </div><!-- .entry-description -->
    7889                    <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.