X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/4713a14935b83517997f3c88f808eb41da55033d..849f15aeed7a5e39314057bdc0064d8edd60dd7d:/wp-includes/default-widgets.php?ds=sidebyside diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 8a803a47..1bdadd8e 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -13,13 +13,12 @@ */ class WP_Widget_Pages extends WP_Widget { - function __construct() { + public function __construct() { $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site’s Pages.') ); parent::__construct('pages', __('Pages'), $widget_ops); } - function widget( $args, $instance ) { - extract( $args ); + public function widget( $args, $instance ) { /** * Filter the widget title. @@ -54,20 +53,21 @@ class WP_Widget_Pages extends WP_Widget { 'exclude' => $exclude ) ) ); - if ( !empty( $out ) ) { - echo $before_widget; - if ( $title) - echo $before_title . $title . $after_title; + if ( ! empty( $out ) ) { + echo $args['before_widget']; + if ( $title ) { + echo $args['before_title'] . $title . $args['after_title']; + } ?> 'post_title', 'title' => '', 'exclude' => '') ); $title = esc_attr( $instance['title'] ); @@ -113,13 +113,12 @@ class WP_Widget_Pages extends WP_Widget { */ class WP_Widget_Links extends WP_Widget { - function __construct() { + public function __construct() { $widget_ops = array('description' => __( "Your blogroll" ) ); parent::__construct('links', __('Links'), $widget_ops); } - function widget( $args, $instance ) { - extract($args, EXTR_SKIP); + public function widget( $args, $instance ) { $show_description = isset($instance['description']) ? $instance['description'] : false; $show_name = isset($instance['name']) ? $instance['name'] : false; @@ -130,7 +129,7 @@ class WP_Widget_Links extends WP_Widget { $order = $orderby == 'rating' ? 'DESC' : 'ASC'; $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1; - $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); + $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] ); /** * Filter the arguments for the Links widget. @@ -142,8 +141,8 @@ class WP_Widget_Links extends WP_Widget { * @param array $args An array of arguments to retrieve the links list. */ wp_list_bookmarks( apply_filters( 'widget_links_args', array( - 'title_before' => $before_title, 'title_after' => $after_title, - 'category_before' => $before_widget, 'category_after' => $after_widget, + 'title_before' => $args['before_title'], 'title_after' => $args['after_title'], + 'category_before' => $before_widget, 'category_after' => $args['after_widget'], 'show_images' => $show_images, 'show_description' => $show_description, 'show_name' => $show_name, 'show_rating' => $show_rating, 'category' => $category, 'class' => 'linkcat widget', @@ -152,7 +151,7 @@ class WP_Widget_Links extends WP_Widget { ) ) ); } - function update( $new_instance, $old_instance ) { + public function update( $new_instance, $old_instance ) { $new_instance = (array) $new_instance; $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 ); foreach ( $instance as $field => $val ) { @@ -170,7 +169,7 @@ class WP_Widget_Links extends WP_Widget { return $instance; } - function form( $instance ) { + public function form( $instance ) { //Defaults $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1 ) ); @@ -223,28 +222,28 @@ class WP_Widget_Links extends WP_Widget { */ class WP_Widget_Search extends WP_Widget { - function __construct() { + public function __construct() { $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") ); parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); } - function widget( $args, $instance ) { - extract($args); + public function widget( $args, $instance ) { /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; + echo $args['before_widget']; + if ( $title ) { + echo $args['before_title'] . $title . $args['after_title']; + } // Use current theme search form if it exists get_search_form(); - echo $after_widget; + echo $args['after_widget']; } - function form( $instance ) { + public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); $title = $instance['title']; ?> @@ -252,7 +251,7 @@ class WP_Widget_Search extends WP_Widget { '')); $instance['title'] = strip_tags($new_instance['title']); @@ -268,27 +267,27 @@ class WP_Widget_Search extends WP_Widget { */ class WP_Widget_Archives extends WP_Widget { - function __construct() { + public function __construct() { $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s Posts.') ); parent::__construct('archives', __('Archives'), $widget_ops); } - function widget( $args, $instance ) { - extract($args); + public function widget( $args, $instance ) { $c = ! empty( $instance['count'] ) ? '1' : '0'; $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; /** This filter is documented in wp-includes/default-widgets.php */ - $title = apply_filters( 'widget_title', empty($instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; + echo $args['before_widget']; + if ( $title ) { + echo $args['before_title'] . $title . $args['after_title']; + } if ( $d ) { ?>

+

+

-

-

+

+

-

- $i"; + for ( $i = 1; $i <= 20; ++$i ) { + echo ""; + } ?>

-

/> -

+

/> +

-

/> -

+

/> +

-

/> -

+

/> +

- + __( "A cloud of your most used tags.") ); parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops); } - function widget( $args, $instance ) { - extract($args); + public function widget( $args, $instance ) { $current_taxonomy = $this->_get_current_taxonomy($instance); if ( !empty($instance['title']) ) { $title = $instance['title']; @@ -1236,9 +1241,10 @@ class WP_Widget_Tag_Cloud extends WP_Widget { /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; + echo $args['before_widget']; + if ( $title ) { + echo $args['before_title'] . $title . $args['after_title']; + } echo '
'; /** @@ -1256,16 +1262,16 @@ class WP_Widget_Tag_Cloud extends WP_Widget { ) ) ); echo "
\n"; - echo $after_widget; + echo $args['after_widget']; } - function update( $new_instance, $old_instance ) { + public function update( $new_instance, $old_instance ) { $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); return $instance; } - function form( $instance ) { + public function form( $instance ) { $current_taxonomy = $this->_get_current_taxonomy($instance); ?>

@@ -1282,7 +1288,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {

__('Add a custom menu to your sidebar.') ); parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops ); } - function widget($args, $instance) { + public function widget($args, $instance) { // Get menu $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; @@ -1322,18 +1328,23 @@ class WP_Widget_Tag_Cloud extends WP_Widget { echo $args['after_widget']; } - function update( $new_instance, $old_instance ) { - $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); - $instance['nav_menu'] = (int) $new_instance['nav_menu']; + public function update( $new_instance, $old_instance ) { + $instance = array(); + if ( ! empty( $new_instance['title'] ) ) { + $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); + } + if ( ! empty( $new_instance['nav_menu'] ) ) { + $instance['nav_menu'] = (int) $new_instance['nav_menu']; + } return $instance; } - function form( $instance ) { + public function form( $instance ) { $title = isset( $instance['title'] ) ? $instance['title'] : ''; $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; // Get menus - $menus = wp_get_nav_menus( array( 'orderby' => 'name' ) ); + $menus = wp_get_nav_menus(); // If no menus exists, direct the user to go and create some. if ( !$menus ) { @@ -1348,11 +1359,12 @@ class WP_Widget_Tag_Cloud extends WP_Widget {