WordPress.org

Make WordPress Core

Changeset 17723


Ignore:
Timestamp:
04/27/2011 04:45:11 AM (9 years ago)
Author:
lancewillett
Message:

Twenty Eleven: fix spacing and add a few missing esc_attr() calls in widgets.php - see #17198

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/inc/widgets.php

    r17720 r17723  
    2020        add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) );
    2121        add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) );
    22 
    2322    }
    2423
     
    3332        $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
    3433
    35         if ( !is_array($cache) )
     34        if ( !is_array( $cache ) )
    3635            $cache = array();
    3736
     
    3938            $args['widget_id'] = null;
    4039
    41         if ( isset($cache[$args['widget_id']]) ) {
     40        if ( isset( $cache[$args['widget_id']] ) ) {
    4241            echo $cache[$args['widget_id']];
    4342            return;
     
    4746        extract( $args, EXTR_SKIP );
    4847
    49         $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base);
     48        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base);
    5049
    5150        if ( ! isset( $instance['number'] ) )
     
    134133    function update( $new_instance, $old_instance ) {
    135134        $instance = $old_instance;
    136         $instance['title'] = strip_tags($new_instance['title']);
     135        $instance['title'] = strip_tags( $new_instance['title'] );
    137136        $instance['number'] = (int) $new_instance['number'];
    138137        $this->flush_widget_cache();
    139138
    140139        $alloptions = wp_cache_get( 'alloptions', 'options' );
    141         if ( isset($alloptions['widget_twentyeleven_ephemera']) )
     140        if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) )
    142141            delete_option( 'widget_twentyeleven_ephemera' );
    143142
     
    153152     **/
    154153    function form( $instance ) {
    155                 $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
    156                 $number = isset($instance['number']) ? absint($instance['number']) : 10;
    157         ?>
    158                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label>
    159                 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
     154        $title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';
     155        $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
     156?>
     157            <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label>
     158            <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
    160159
    161                 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label>
    162                 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
     160            <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label>
     161            <input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3" /></p>
    163162        <?php
    164163    }
Note: See TracChangeset for help on using the changeset viewer.