X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.6.2:/wp-admin/includes/dashboard.php diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 9ce9db91..27839fcf 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -23,7 +23,9 @@ function wp_dashboard_setup() { /* Register Widgets and Controls */ // Recent Comments Widget - if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) { + $mod_comments = wp_count_comments(); + $mod_comments = $mod_comments->moderated; + if ( current_user_can( 'moderate_comments' ) && $mod_comments ) { $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments ); $notice = "$notice"; } else { @@ -34,9 +36,10 @@ function wp_dashboard_setup() { ); // Incoming Links Widget - if ( !isset( $widget_options['dashboard_incoming_links'] ) ) { + if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) { $update = true; $widget_options['dashboard_incoming_links'] = array( + 'home' => get_option('home'), 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 'items' => 5, @@ -214,16 +217,16 @@ function wp_dashboard_dynamic_sidebar_params( $params ) { $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty'; $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name']; $params[1] = 'wp_dashboard_trigger_widget_control'; - $sidebar_before_widget .= '
'; + $sidebar_before_widget .= ''; $sidebar_after_widget = "
$sidebar_after_widget"; - $links[] = '' . __( 'Cancel' ) . ''; + $links[] = '' . __( 'Cancel' ) . ''; } else { - $links[] = '' . __( 'Edit' ) . ''; + $links[] = '' . __( 'Edit' ) . ''; } } if ( $widget_feed_link ) - $links[] = '' . __( 'rss icon' ) . ' ' . __( 'RSS' ) . ''; + $links[] = '' . __( 'rss icon' ) . ' ' . __( 'RSS' ) . ''; $links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links ); @@ -267,7 +270,7 @@ function wp_dashboard_recent_comments( $sidebar_args ) { $lambda = create_function( '', 'return 5;' ); add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter - $comments_query = new WP_Query('feed=rss2&withcomments=1'); + $comments_query = new WP_Query(array('feed' => 'rss2', 'withcomments' => 1)); remove_filter( 'option_posts_per_rss', $lambda ); $is_first = true; @@ -313,7 +316,7 @@ function wp_dashboard_incoming_links_output() { $widgets = get_option( 'dashboard_widget_options' ); @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); $rss = @fetch_rss( $url ); - if ( isset($rss->items) && 1 < count($rss->items) ) {// Technorati returns a 1-item feed when it has no results + if ( isset($rss->items) && 0 < count($rss->items) ) { echo "