- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-archives.php
r41867 r42343 24 24 public function __construct() { 25 25 $widget_ops = array( 26 'classname' => 'widget_archive',27 'description' => __( 'A monthly archive of your site’s Posts.' ),26 'classname' => 'widget_archive', 27 'description' => __( 'A monthly archive of your site’s Posts.' ), 28 28 'customize_selective_refresh' => true, 29 29 ); 30 parent::__construct( 'archives', __('Archives'), $widget_ops);30 parent::__construct( 'archives', __( 'Archives' ), $widget_ops ); 31 31 } 32 32 … … 72 72 * @param array $instance Settings for the current Archives widget instance. 73 73 */ 74 $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array( 75 'type' => 'monthly', 76 'format' => 'option', 77 'show_post_count' => $c 78 ), $instance ); 74 $dropdown_args = apply_filters( 75 'widget_archives_dropdown_args', array( 76 'type' => 'monthly', 77 'format' => 'option', 78 'show_post_count' => $c, 79 ), $instance 80 ); 79 81 80 82 switch ( $dropdown_args['type'] ) { … … 115 117 * @param array $instance Array of settings for the current widget. 116 118 */ 117 wp_get_archives( apply_filters( 'widget_archives_args', array( 118 'type' => 'monthly', 119 'show_post_count' => $c 120 ), $instance ) ); 119 wp_get_archives( 120 apply_filters( 121 'widget_archives_args', array( 122 'type' => 'monthly', 123 'show_post_count' => $c, 124 ), $instance 125 ) 126 ); 121 127 ?> 122 128 </ul> 123 129 <?php 124 130 } 125 131 126 132 echo $args['after_widget']; … … 138 144 */ 139 145 public function update( $new_instance, $old_instance ) { 140 $instance = $old_instance; 141 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') ); 142 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 143 $instance['count'] = $new_instance['count'] ? 1 : 0; 146 $instance = $old_instance; 147 $new_instance = wp_parse_args( 148 (array) $new_instance, array( 149 'title' => '', 150 'count' => 0, 151 'dropdown' => '', 152 ) 153 ); 154 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 155 $instance['count'] = $new_instance['count'] ? 1 : 0; 144 156 $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; 145 157 … … 155 167 */ 156 168 public function form( $instance ) { 157 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') ); 158 $title = sanitize_text_field( $instance['title'] ); 169 $instance = wp_parse_args( 170 (array) $instance, array( 171 'title' => '', 172 'count' => 0, 173 'dropdown' => '', 174 ) 175 ); 176 $title = sanitize_text_field( $instance['title'] ); 159 177 ?> 160 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>178 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p> 161 179 <p> 162 <input class="checkbox" type="checkbox"<?php checked( $instance['dropdown'] ); ?> id="<?php echo $this->get_field_id( 'dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as dropdown'); ?></label>180 <input class="checkbox" type="checkbox"<?php checked( $instance['dropdown'] ); ?> id="<?php echo $this->get_field_id( 'dropdown' ); ?>" name="<?php echo $this->get_field_name( 'dropdown' ); ?>" /> <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label> 163 181 <br/> 164 <input class="checkbox" type="checkbox"<?php checked( $instance['count'] ); ?> id="<?php echo $this->get_field_id( 'count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>182 <input class="checkbox" type="checkbox"<?php checked( $instance['count'] ); ?> id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" /> <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label> 165 183 </p> 166 184 <?php
Note: See TracChangeset
for help on using the changeset viewer.