diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-24 11:45:39 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-24 11:45:39 +0000 |
commit | cf9f85dc8121a359d550ffa3b735fb48859eee88 (patch) | |
tree | 9f90be15fc46163f5656f019f2a2866414b7c9f2 /wp-includes/widgets.php | |
parent | f10f9f5b05e23ce4c07479b094bd3ff4bbfd86d0 (diff) | |
download | wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.gz wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.xz wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.zip |
Merged with WP 2.5, revision 7806
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/widgets.php')
-rw-r--r-- | wp-includes/widgets.php | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index a4acbae..9fa2630 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -306,6 +306,24 @@ 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']; + $found = true; + break; + } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) { + $_sidebars_widgets[$index][$i] = $widget['id']; + $found = true; + break; + } + } + + if ( $found ) + continue; + unset($_sidebars_widgets[$index][$i]); } $_sidebars_widgets['array_version'] = 2; @@ -428,6 +446,8 @@ function wp_widget_pages_control() { function wp_widget_links($args) { extract($args, EXTR_SKIP); + + $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); wp_list_bookmarks(array( 'title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, @@ -614,6 +634,8 @@ function wp_widget_text_control($widget_args) { } foreach ( (array) $_POST['widget-text'] as $widget_number => $widget_text ) { + if ( !isset($widget_text['text']) && isset($options[$widget_number]) ) // user clicked cancel + continue; $title = strip_tags(stripslashes($widget_text['title'])); if ( current_user_can('unfiltered_html') ) $text = stripslashes( $widget_text['text'] ); @@ -750,6 +772,8 @@ function wp_widget_categories_control( $widget_args ) { } foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) { + if ( !isset($widget_cat['title']) && isset($options[$widget_number]) ) // user clicked cancel + continue; $title = trim(strip_tags(stripslashes($widget_cat['title']))); $count = isset($widget_cat['count']); $hierarchical = isset($widget_cat['hierarchical']); @@ -858,10 +882,12 @@ function wp_widget_categories_upgrade() { } function wp_widget_recent_entries($args) { - if ( $output = wp_cache_get('widget_recent_entries', 'widget') ) - return print($output); + if ( '%BEG_OF_TITLE%' != $args['before_title'] ) { + if ( $output = wp_cache_get('widget_recent_entries', 'widget') ) + return print($output); + ob_start(); + } - ob_start(); extract($args); $options = get_option('widget_recent_entries'); $title = empty($options['title']) ? __('Recent Posts') : $options['title']; @@ -886,7 +912,9 @@ function wp_widget_recent_entries($args) { <?php wp_reset_query(); // Restore global post data stomped by the_post(). endif; - wp_cache_add('widget_recent_entries', ob_get_flush(), 'widget'); + + if ( '%BEG_OF_TITLE%' != $args['before_title'] ) + wp_cache_add('widget_recent_entries', ob_get_flush(), 'widget'); } function wp_flush_widget_recent_entries() { @@ -1170,6 +1198,8 @@ function wp_widget_rss_control($widget_args) { } foreach( (array) $_POST['widget-rss'] as $widget_number => $widget_rss ) { + if ( !isset($widget_rss['url']) && isset($options[$widget_number]) ) // user clicked cancel + continue; $widget_rss = stripslashes_deep( $widget_rss ); $url = sanitize_url(strip_tags($widget_rss['url'])); $options[$widget_number] = wp_widget_rss_process( $widget_rss, !isset($urls[$url]) ); @@ -1460,6 +1490,8 @@ function widget_many_control( $widget_args = 1 ) { foreach ( (array) $_POST['widget-many'] as $widget_number => $widget_many_instance ) { // compile data from $widget_many_instance + if ( !isset($widget_many_instance['something']) && isset($options[$widget_number]) ) // user clicked cancel + continue; $something = wp_specialchars( $widget_many_instance['something'] ); $options[$widget_number] = array( 'something' => $something ); // Even simple widgets should store stuff in array, rather than in scalar } |