diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/widgets/class-wp-widget-archives.php --- a/wp/wp-includes/widgets/class-wp-widget-archives.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/widgets/class-wp-widget-archives.php Mon Oct 14 18:28:13 2019 +0200 @@ -23,11 +23,11 @@ */ public function __construct() { $widget_ops = array( - 'classname' => 'widget_archive', - 'description' => __( 'A monthly archive of your site’s Posts.' ), + 'classname' => 'widget_archive', + 'description' => __( 'A monthly archive of your site’s Posts.' ), 'customize_selective_refresh' => true, ); - parent::__construct('archives', __('Archives'), $widget_ops); + parent::__construct( 'archives', __( 'Archives' ), $widget_ops ); } /** @@ -58,7 +58,7 @@ $dropdown_id = "{$this->id_base}-dropdown-{$this->number}"; ?> - + 'monthly', - 'format' => 'option', - 'show_post_count' => $c - ), $instance ); + $dropdown_args = apply_filters( + 'widget_archives_dropdown_args', + array( + 'type' => 'monthly', + 'format' => 'option', + 'show_post_count' => $c, + ), + $instance + ); switch ( $dropdown_args['type'] ) { case 'yearly': @@ -100,27 +104,48 @@ + + + - 'monthly', - 'show_post_count' => $c - ), $instance ) ); - ?> + 'monthly', + 'show_post_count' => $c, + ), + $instance + ) + ); + ?> - '', 'count' => 0, 'dropdown' => '') ); - $instance['title'] = sanitize_text_field( $new_instance['title'] ); - $instance['count'] = $new_instance['count'] ? 1 : 0; + $instance = $old_instance; + $new_instance = wp_parse_args( + (array) $new_instance, + array( + 'title' => '', + 'count' => 0, + 'dropdown' => '', + ) + ); + $instance['title'] = sanitize_text_field( $new_instance['title'] ); + $instance['count'] = $new_instance['count'] ? 1 : 0; $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; return $instance; @@ -154,14 +186,20 @@ * @param array $instance Current settings. */ public function form( $instance ) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') ); - $title = sanitize_text_field( $instance['title'] ); + $instance = wp_parse_args( + (array) $instance, + array( + 'title' => '', + 'count' => 0, + 'dropdown' => '', + ) + ); ?> - + - id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" /> + id="get_field_id( 'dropdown' ); ?>" name="get_field_name( 'dropdown' ); ?>" /> - id="get_field_id('count'); ?>" name="get_field_name('count'); ?>" /> + id="get_field_id( 'count' ); ?>" name="get_field_name( 'count' ); ?>" />
- id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" /> + id="get_field_id( 'dropdown' ); ?>" name="get_field_name( 'dropdown' ); ?>" /> - id="get_field_id('count'); ?>" name="get_field_name('count'); ?>" /> + id="get_field_id( 'count' ); ?>" name="get_field_name( 'count' ); ?>" />