diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 69c6dc1a1..f82ed3017 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -1095,65 +1095,68 @@ class WP_Widget_Search extends WP_Widget { } /** - * Display archives widget. + * Archives widget class * - * @since 2.2.0 - * - * @param array $args Widget arguments. + * @since 2.8.0 */ -function wp_widget_archives($args) { - extract($args); - $options = get_option('widget_archives'); - $c = $options['count'] ? '1' : '0'; - $d = $options['dropdown'] ? '1' : '0'; - $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']); +class WP_Widget_Archives extends WP_Widget { - echo $before_widget; - echo $before_title . $title . $after_title; + function WP_Widget_Archives() { + $widget_ops = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") ); + $this->WP_Widget('archives', __('Archives'), $widget_ops); + } - if($d) { + function widget( $args, $instance ) { + extract($args); + $c = $instance['count'] ? '1' : '0'; + $d = $instance['dropdown'] ? '1' : '0'; + $title = empty($instance['title']) ? __('Archives') : apply_filters('widget_title', $instance['title']); + + echo $before_widget; + echo $before_title . $title . $after_title; + + if ( $d ) { ?> '', 'count' => 0, 'dropdown' => '') ); + $title = strip_tags($instance['title']); + $count = $instance['count'] ? 'checked="checked"' : ''; + $dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; ?> -

-

- -
- -

- +

+

+ +
+ +

+ 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") ); - wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $widget_ops); - wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control' ); + new WP_Widget_Archives(); new WP_Widget_Links();