Make WordPress Core

Ticket #28251: 28251.4.diff

File 28251.4.diff, 2.5 KB (added by philiparthurmoore, 12 years ago)

More thorough attribute escaping in Twenty Ten's image attachment template part.

  • src/wp-content/themes/twentyten/loop-attachment.php

     
    1818<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    1919
    2020                                <?php if ( ! empty( $post->post_parent ) ) : ?>
    21                                         <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php echo esc_attr( sprintf( __( 'Return to %s', 'twentyten' ), strip_tags( get_the_title( $post->post_parent ) ) ) ); ?>" rel="gallery"><?php
     21                                        <p class="page-title"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'Return to %s', 'twentyten' ), strip_tags( get_the_title( $post->post_parent ) ) ) ); ?>" rel="gallery"><?php
    2222                                                /* translators: %s - title of parent post */
    2323                                                printf( __( '<span class="meta-nav">&larr;</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
    2424                                        ?></a></p>
     
    5252                                                                $metadata = wp_get_attachment_metadata();
    5353                                                                printf( __( 'Full size is %s pixels', 'twentyten' ),
    5454                                                                        sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
    55                                                                                 wp_get_attachment_url(),
     55                                                                                esc_url( wp_get_attachment_url() ),
    5656                                                                                esc_attr( __( 'Link to full-size image', 'twentyten' ) ),
    5757                                                                                $metadata['width'],
    5858                                                                                $metadata['height']
     
    8585                $next_attachment_url = wp_get_attachment_url();
    8686        }
    8787?>
    88                                                 <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
     88                                                <p class="attachment"><a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
    8989                                                        /**
    9090                                                         * Filter the Twenty Ten default attachment width.
    9191                                                         *
     
    110110                                                        <div class="nav-next"><?php next_image_link( false ); ?></div>
    111111                                                </div><!-- #nav-below -->
    112112<?php else : ?>
    113                                                 <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
     113                                                <a href="<?php echo esc_url( wp_get_attachment_url() ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
    114114<?php endif; ?>
    115115                                                </div><!-- .entry-attachment -->
    116116                                                <div class="entry-caption"><?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?></div>