X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/98a4d31e52bd56c908617df281730bd4ba58d110..refs/tags/wordpress-2.9:/wp-includes/default-widgets.php diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 54d1d401..6dcf8225 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -376,8 +376,8 @@ class WP_Widget_Text extends WP_Widget { function widget( $args, $instance ) { extract($args); - $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); - $text = apply_filters( 'widget_text', $instance['text'] ); + $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance ); + $text = apply_filters( 'widget_text', $instance['text'], $instance ); echo $before_widget; if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
@@ -391,7 +391,7 @@ class WP_Widget_Text extends WP_Widget { if ( current_user_can('unfiltered_html') ) $instance['text'] = $new_instance['text']; else - $instance['text'] = wp_filter_post_kses( $new_instance['text'] ); + $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed $instance['filter'] = isset($new_instance['filter']); return $instance; } @@ -406,7 +406,7 @@ class WP_Widget_Text extends WP_Widget { -

/> 

+

/> 

'') ); $title = esc_attr( $instance['title'] ); - $count = (bool) $instance['count']; - $hierarchical = (bool) $instance['hierarchical']; - $dropdown = (bool) $instance['dropdown']; + $count = isset($instance['count']) ? (bool) $instance['count'] :false; + $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; + $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false; ?>

@@ -579,8 +579,8 @@ class WP_Widget_Recent_Posts extends WP_Widget { } function form( $instance ) { - $title = esc_attr($instance['title']); - if ( !$number = (int) $instance['number'] ) + $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; + if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) $number = 5; ?>

@@ -609,7 +609,7 @@ class WP_Widget_Recent_Comments extends WP_Widget { add_action( 'wp_head', array(&$this, 'recent_comments_style') ); add_action( 'comment_post', array(&$this, 'flush_widget_cache') ); - add_action( 'wp_set_comment_status', array(&$this, 'flush_widget_cache') ); + add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); } function recent_comments_style() { ?> @@ -634,7 +634,7 @@ class WP_Widget_Recent_Comments extends WP_Widget { $number = 15; if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) { - $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 15"); + $comments = $wpdb->get_results("SELECT $wpdb->comments.* FROM $wpdb->comments JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_status = 'publish' ORDER BY comment_date_gmt DESC LIMIT 15"); wp_cache_add( 'recent_comments', $comments, 'widget' ); } @@ -732,6 +732,8 @@ class WP_Widget_RSS extends WP_Widget { echo $before_title . $title . $after_title; wp_widget_rss_output( $rss, $instance ); echo $after_widget; + $rss->__destruct(); + unset($rss); } function update($new_instance, $old_instance) { @@ -770,7 +772,6 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( is_wp_error($rss) ) { if ( is_admin() || current_user_can('manage_options') ) echo '

' . sprintf( __('RSS Error: %s'), $rss->get_error_message() ) . '

'; - return; } @@ -787,6 +788,8 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( !$rss->get_item_quantity() ) { echo ''; + $rss->__destruct(); + unset($rss); return; } @@ -838,6 +841,8 @@ function wp_widget_rss_output( $rss, $args = array() ) { } } echo ''; + $rss->__destruct(); + unset($rss); } @@ -946,6 +951,9 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) { $link = esc_url(strip_tags($rss->get_permalink())); while ( stristr($link, 'http') != $link ) $link = substr($link, 1); + + $rss->__destruct(); + unset($rss); } } @@ -985,7 +993,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget { function form( $instance ) { ?>

-

+