Make WordPress Core

Changeset 31265


Ignore:
Timestamp:
01/22/2015 12:41:36 AM (10 years ago)
Author:
lancewillett
Message:

Twenty Eleven: fix escaping and minor code style issues. See #29127.

Location:
trunk/src/wp-content/themes/twentyeleven
Files:
9 edited

Legend:

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

    r25625 r31265  
    3535                    /* translators: %1$s: smilie */
    3636                    $archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'twentyeleven' ), convert_smilies( ':)' ) ) . '</p>';
    37                     the_widget( 'WP_Widget_Archives', array('count' => 0 , 'dropdown' => 1 ), array( 'after_title' => '</h2>'.$archive_content ) );
     37                    the_widget( 'WP_Widget_Archives', array( 'count' => 0, 'dropdown' => 1 ), array( 'after_title' => '</h2>' . $archive_content ) );
    3838                    ?>
    3939
  • trunk/src/wp-content/themes/twentyeleven/author.php

    r25746 r31265  
    2727
    2828                <header class="page-header">
    29                     <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
     29                    <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
    3030                </header>
    3131
  • trunk/src/wp-content/themes/twentyeleven/content-image.php

    r25625 r31265  
    2121            <?php if ( comments_open() && ! post_password_required() ) : ?>
    2222            <div class="comments-link">
    23                 <?php comments_popup_link( '<span class="leave-reply">' . __( "Reply", 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
     23                <?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
    2424            </div>
    2525            <?php endif; ?>
  • trunk/src/wp-content/themes/twentyeleven/functions.php

    r30351 r31265  
    331331    <div id="headimg">
    332332        <?php
    333         $color = get_header_textcolor();
    334         $image = get_header_image();
    335         if ( $color && $color != 'blank' )
    336             $style = ' style="color:#' . $color . '"';
    337         else
    338             $style = ' style="display:none"';
    339         ?>
    340         <h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
    341         <div id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
    342         <?php if ( $image ) : ?>
     333        $color = get_header_textcolor();
     334        $image = get_header_image();
     335        $style = 'display: none;';
     336        if ( $color && $color != 'blank' ) {
     337            $style = 'color: #' . $color . ';';
     338        }
     339        ?>
     340        <h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
     341        <div id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></div>
     342        <?php if ( $image ) : ?>
    343343            <img src="<?php echo esc_url( $image ); ?>" alt="" />
    344344        <?php endif; ?>
     
    447447        'id' => 'sidebar-1',
    448448        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    449         'after_widget' => "</aside>",
     449        'after_widget' => '</aside>',
    450450        'before_title' => '<h3 class="widget-title">',
    451451        'after_title' => '</h3>',
     
    457457        'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ),
    458458        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    459         'after_widget' => "</aside>",
     459        'after_widget' => '</aside>',
    460460        'before_title' => '<h3 class="widget-title">',
    461461        'after_title' => '</h3>',
     
    467467        'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    468468        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    469         'after_widget' => "</aside>",
     469        'after_widget' => '</aside>',
    470470        'before_title' => '<h3 class="widget-title">',
    471471        'after_title' => '</h3>',
     
    477477        'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    478478        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    479         'after_widget' => "</aside>",
     479        'after_widget' => '</aside>',
    480480        'before_title' => '<h3 class="widget-title">',
    481481        'after_title' => '</h3>',
     
    487487        'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    488488        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    489         'after_widget' => "</aside>",
     489        'after_widget' => '</aside>',
    490490        'before_title' => '<h3 class="widget-title">',
    491491        'after_title' => '</h3>',
     
    582582
    583583    if ( $class )
    584         echo 'class="' . $class . '"';
     584        echo 'class="' . esc_attr( $class ) . '"';
    585585}
    586586
     
    718718        $galleries = get_post_galleries( get_the_ID(), false );
    719719        if ( isset( $galleries[0]['ids'] ) )
    720             $images = explode( ',', $galleries[0]['ids'] );
     720            $images = explode( ',', $galleries[0]['ids'] );
    721721    } else {
    722722        $pattern = get_shortcode_regex();
  • trunk/src/wp-content/themes/twentyeleven/header.php

    r29842 r31265  
    4141    // Add a page number if necessary:
    4242    if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
    43         echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
     43        echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ) );
    4444
    4545    ?></title>
     
    112112                        }
    113113                        ?>
    114                     <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
     114                    <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' ) ); ?>" />
    115115                <?php endif; // end check for featured image or standard header ?>
    116116            </a>
  • trunk/src/wp-content/themes/twentyeleven/image.php

    r28585 r31265  
    6767        else
    6868            // or get the URL of the first image attachment
    69             $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
     69            $next_attachment_url = get_attachment_link( $attachments[0]->ID );
    7070    } else {
    7171        // or, if there's only 1 image, get the URL of the image
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r29903 r31265  
    219219
    220220    if ( is_rtl() )
    221         $default_theme_options['theme_layout'] = 'sidebar-content';
     221        $default_theme_options['theme_layout'] = 'sidebar-content';
    222222
    223223    /**
     
    278278        <span>
    279279            <img src="<?php echo esc_url( $scheme['thumbnail'] ); ?>" width="136" height="122" alt="" />
    280             <?php echo $scheme['label']; ?>
     280            <?php echo esc_html( $scheme['label'] ); ?>
    281281        </span>
    282282    </label>
     
    317317            <span>
    318318                <img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" width="136" height="122" alt="" />
    319                 <?php echo $layout['label']; ?>
     319                <?php echo esc_html( $layout['label'] ); ?>
    320320            </span>
    321321        </label>
     
    563563    $choices = array();
    564564    foreach ( $layouts as $layout ) {
    565         $choices[$layout['value']] = $layout['label'];
     565        $choices[ $layout['value'] ] = $layout['label'];
    566566    }
    567567
  • trunk/src/wp-content/themes/twentyeleven/inc/widgets.php

    r27597 r31265  
    2323        $this->alt_option_name = 'widget_twentyeleven_ephemera';
    2424
    25         add_action( 'save_post', array(&$this, 'flush_widget_cache' ) );
    26         add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) );
    27         add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) );
     25        add_action( 'save_post', array( &$this, 'flush_widget_cache' ) );
     26        add_action( 'deleted_post', array( &$this, 'flush_widget_cache' ) );
     27        add_action( 'switch_theme', array( &$this, 'flush_widget_cache' ) );
    2828    }
    2929
     
    3939        $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
    4040
    41         if ( !is_array( $cache ) )
     41        if ( ! is_array( $cache ) )
    4242            $cache = array();
    4343
     
    4545            $args['widget_id'] = null;
    4646
    47         if ( isset( $cache[$args['widget_id']] ) ) {
    48             echo $cache[$args['widget_id']];
     47        if ( isset( $cache[ $args['widget_id'] ] ) ) {
     48            echo $cache[ $args['widget_id'] ];
    4949            return;
    5050        }
     
    5454
    5555        /** This filter is documented in wp-includes/default-widgets.php */
    56         $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base);
     56        $args['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base );
    5757
    5858        if ( ! isset( $instance['number'] ) )
    5959            $instance['number'] = '10';
    6060
    61         if ( ! $number = absint( $instance['number'] ) )
    62             $number = 10;
     61        if ( ! $args['number'] = absint( $instance['number'] ) )
     62            $args['number'] = 10;
    6363
    6464        $ephemera_args = array(
    65             'order' => 'DESC',
    66             'posts_per_page' => $number,
    67             'no_found_rows' => true,
    68             'post_status' => 'publish',
    69             'post__not_in' => get_option( 'sticky_posts' ),
    70             'tax_query' => array(
     65            'order'          => 'DESC',
     66            'posts_per_page' => $args['number'],
     67            'no_found_rows'  => true,
     68            'post_status'    => 'publish',
     69            'post__not_in'   => get_option( 'sticky_posts' ),
     70            'tax_query'      => array(
    7171                array(
    7272                    'taxonomy' => 'post_format',
    73                     'terms' => array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ),
    74                     'field' => 'slug',
     73                    'terms'    => array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ),
     74                    'field'    => 'slug',
    7575                    'operator' => 'IN',
    7676                ),
     
    8080
    8181        if ( $ephemera->have_posts() ) :
    82             echo $before_widget;
    83             echo $before_title;
    84             echo $title; // Can set this with a widget option, or omit altogether
    85             echo $after_title;
     82            echo $args['before_widget'];
     83            echo $args['before_title'];
     84            echo $args['title'];
     85            echo $args['after_title'];
    8686            ?>
    8787            <ol>
     
    112112            <?php
    113113
    114             echo $after_widget;
     114            echo $args['after_widget'];
    115115
    116116            // Reset the post globals as this query will have stomped on it
     
    120120        endif;
    121121
    122         $cache[$args['widget_id']] = ob_get_flush();
     122        $cache[ $args['widget_id'] ] = ob_get_flush();
    123123        wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' );
    124124    }
  • trunk/src/wp-content/themes/twentyeleven/showcase.php

    r25746 r31265  
    106106                    ?>
    107107
    108                     <section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>">
     108                    <section class="featured-post <?php echo esc_attr( $feature_class ); ?>" id="featured-post-<?php echo esc_attr( $counter_slider ); ?>">
    109109
    110110                        <?php
     
    136136
    137137                        // Reset the counter so that we end up with matching elements
    138                         $counter_slider = 0;
     138                        $counter_slider = 0;
    139139
    140140                        // Begin from zero
    141                         rewind_posts();
     141                        rewind_posts();
    142142
    143143                        // Let's roll again.
    144                         while ( $featured->have_posts() ) : $featured->the_post();
    145                             $counter_slider++;
     144                        while ( $featured->have_posts() ) : $featured->the_post();
     145                            $counter_slider++;
    146146                            if ( 1 == $counter_slider )
    147                                 $class = 'class="active"';
     147                                $class = ' class="active"';
    148148                            else
    149149                                $class = '';
    150                         ?>
    151                         <li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php echo esc_attr( sprintf( __( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" <?php echo $class; ?>></a></li>
     150                        ?>
     151                        <li><a href="#featured-post-<?php echo esc_attr( $counter_slider ); ?>" title="<?php echo esc_attr( sprintf( __( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>"<?php echo $class; ?>></a></li>
    152152                    <?php endwhile; ?>
    153153                    </ul>
Note: See TracChangeset for help on using the changeset viewer.