Changeset 17723
- Timestamp:
- 04/27/2011 04:45:11 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/inc/widgets.php
r17720 r17723 20 20 add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); 21 21 add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); 22 23 22 } 24 23 … … 33 32 $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' ); 34 33 35 if ( !is_array( $cache) )34 if ( !is_array( $cache ) ) 36 35 $cache = array(); 37 36 … … 39 38 $args['widget_id'] = null; 40 39 41 if ( isset( $cache[$args['widget_id']]) ) {40 if ( isset( $cache[$args['widget_id']] ) ) { 42 41 echo $cache[$args['widget_id']]; 43 42 return; … … 47 46 extract( $args, EXTR_SKIP ); 48 47 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); 50 49 51 50 if ( ! isset( $instance['number'] ) ) … … 134 133 function update( $new_instance, $old_instance ) { 135 134 $instance = $old_instance; 136 $instance['title'] = strip_tags( $new_instance['title']);135 $instance['title'] = strip_tags( $new_instance['title'] ); 137 136 $instance['number'] = (int) $new_instance['number']; 138 137 $this->flush_widget_cache(); 139 138 140 139 $alloptions = wp_cache_get( 'alloptions', 'options' ); 141 if ( isset( $alloptions['widget_twentyeleven_ephemera']) )140 if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) ) 142 141 delete_option( 'widget_twentyeleven_ephemera' ); 143 142 … … 153 152 **/ 154 153 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> 160 159 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> 163 162 <?php 164 163 }
Note: See TracChangeset
for help on using the changeset viewer.