X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.6.2:/wp-includes/widgets.php diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 9fa26306..73e1f6e8 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -57,7 +57,7 @@ function register_sidebar($args = array()) { 'after_title' => "\n", ); - $sidebar = array_merge($defaults, $args); + $sidebar = array_merge($defaults, (array) $args); $wp_registered_sidebars[$sidebar['id']] = $sidebar; @@ -95,6 +95,8 @@ function register_sidebar_widget($name, $output_callback, $classname = '') { function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) { global $wp_registered_widgets; + $id = strtolower($id); + if ( empty($output_callback) ) { unset($wp_registered_widgets[$id]); return; @@ -164,6 +166,8 @@ function register_widget_control($name, $control_callback, $width = '', $height */ function wp_register_widget_control($id, $name, $control_callback, $options = array()) { global $wp_registered_widget_controls; + + $id = strtolower($id); if ( empty($control_callback) ) { unset($wp_registered_widget_controls[$id]); @@ -306,9 +310,9 @@ function wp_get_sidebars_widgets($update = true) { $_sidebars_widgets[$index][$i] = $id; continue; } - + $found = false; - + foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( strtolower($widget['name']) == strtolower($name) ) { $_sidebars_widgets[$index][$i] = $widget['id']; @@ -320,10 +324,10 @@ function wp_get_sidebars_widgets($update = true) { break; } } - + if ( $found ) continue; - + unset($_sidebars_widgets[$index][$i]); } $_sidebars_widgets['array_version'] = 2; @@ -381,7 +385,7 @@ function wp_widget_pages( $args ) { extract( $args ); $options = get_option( 'widget_pages' ); - $title = empty( $options['title'] ) ? __( 'Pages' ) : $options['title']; + $title = empty( $options['title'] ) ? __( 'Pages' ) : apply_filters('widget_title', $options['title']); $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby']; $exclude = empty( $options['exclude'] ) ? '' : $options['exclude']; @@ -448,25 +452,31 @@ function wp_widget_links($args) { extract($args, EXTR_SKIP); $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); - wp_list_bookmarks(array( + 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, 'show_images' => true, 'class' => 'linkcat widget' - )); + ))); } function wp_widget_search($args) { extract($args); -?> - -
-
-
+ $searchform_template = get_template_directory() . '/searchform.php'; + + echo $before_widget; + + // Use current theme search form if it exists + if ( file_exists($searchform_template) ) { + include_once($searchform_template); + } else { ?> +
+ + -
- - - + @@ -556,7 +566,7 @@ function wp_widget_meta_control() { function wp_widget_calendar($args) { extract($args); $options = get_option('widget_calendar'); - $title = $options['title']; + $title = apply_filters('widget_title', $options['title']); if ( empty($title) ) $title = ' '; echo $before_widget . $before_title . $title . $after_title; @@ -593,7 +603,7 @@ function wp_widget_text($args, $widget_args = 1) { if ( !isset($options[$number]) ) return; - $title = $options[$number]['title']; + $title = apply_filters('widget_title', $options[$number]['title']); $text = apply_filters( 'widget_text', $options[$number]['text'] ); ?> @@ -705,15 +715,16 @@ function wp_widget_categories($args, $widget_args = 1) { $h = $options[$number]['hierarchical'] ? '1' : '0'; $d = $options[$number]['dropdown'] ? '1' : '0'; - $title = empty($options[$number]['title']) ? __('Categories') : $options[$number]['title']; + $title = empty($options[$number]['title']) ? __('Categories') : apply_filters('widget_title', $options[$number]['title']); echo $before_widget; echo $before_title . $title . $after_title; - $cat_args = "orderby=name&show_count={$c}&hierarchical={$h}"; + $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ( $d ) { - wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category')); + $cat_args['show_option_none'] = __('Select Category'); + wp_dropdown_categories($cat_args); ?>