Changeset 10784
- Timestamp:
- 03/14/2009 04:34:08 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r10782 r10784 74 74 * The newly calculated value of $instance should be returned. */ 75 75 function update($new_instance, $old_instance) { 76 die('function WP_Widget::update() must be over-ridden in a sub-class.');76 return $new_instance; 77 77 } 78 78 79 79 /** Echo a control form for the current instance. */ 80 80 function form($instance) { 81 die('function WP_Widget::form() must be over-ridden in a sub-class.');81 echo '<p>' . __('There are no options for this widget.') . '</p>'; 82 82 } 83 83 … … 252 252 253 253 if ( !is_array($settings) ) 254 returnarray();254 $settings = array(); 255 255 256 256 if ( !array_key_exists('_multiwidget', $settings) ) { … … 889 889 // This test may need expanding. 890 890 $single = false; 891 foreach ( array_keys($settings) as $number ) { 892 if ( !is_numeric($number) ) { 893 $single = true; 894 break; 891 if ( empty($settings) ) { 892 $single = true; 893 } else { 894 foreach ( array_keys($settings) as $number ) { 895 if ( !is_numeric($number) ) { 896 $single = true; 897 break; 898 } 895 899 } 896 900 } … … 1007 1011 */ 1008 1012 class WP_Widget_Links extends WP_Widget { 1009 1013 1014 function WP_Widget_Links() { 1015 $widget_ops = array('description' => __( "Your blogroll" ) ); 1016 $this->WP_Widget('links', __('Links'), $widget_ops); 1017 } 1018 1010 1019 function widget( $args, $instance ) { 1011 1020 extract($args, EXTR_SKIP); … … 1061 1070 1062 1071 /** 1063 * Display search widget. 1064 * 1065 * @since 2.2.0 1066 * 1067 * @param array $args Widget arguments. 1068 */ 1069 function wp_widget_search($args) { 1070 extract($args); 1071 echo $before_widget; 1072 1073 // Use current theme search form if it exists 1074 get_search_form(); 1075 1076 echo $after_widget; 1072 * Search widget class 1073 * 1074 * @since 2.8.0 1075 */ 1076 class WP_Widget_Search extends WP_Widget { 1077 1078 function WP_Widget_Search() { 1079 $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") ); 1080 $this->WP_Widget('search', __('Search'), $widget_ops); 1081 } 1082 1083 function widget( $args, $instance ) { 1084 extract($args); 1085 echo $before_widget; 1086 1087 // Use current theme search form if it exists 1088 get_search_form(); 1089 1090 echo $after_widget; 1091 } 1077 1092 } 1078 1093 … … 2229 2244 wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control' ); 2230 2245 2231 $widget_ops = array('description' => __( "Your blogroll" ) ); 2232 $wp_widget_links = new WP_Widget_Links('links', __('Links'), $widget_ops); 2233 //$wp_widget_links->register(); 2246 new WP_Widget_Links(); 2234 2247 2235 2248 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); … … 2237 2250 wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control' ); 2238 2251 2239 $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") ); 2240 wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $widget_ops); 2252 new WP_Widget_Search(); 2241 2253 2242 2254 $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") );
Note: See TracChangeset
for help on using the changeset viewer.