X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..1132430022383fdf47fa6cb9377300fd885297aa:/wp-admin/includes/dashboard.php diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index fb50197e..75a5b1cb 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -18,11 +18,6 @@ function wp_dashboard_setup() { $wp_dashboard_control_callbacks = array(); $screen = get_current_screen(); - $update = false; - $widget_options = get_option( 'dashboard_widget_options' ); - if ( !$widget_options || !is_array($widget_options) ) - $widget_options = array(); - /* Register Widgets and Controls */ $response = wp_check_browser_version(); @@ -123,9 +118,6 @@ function wp_dashboard_setup() { exit; } - if ( $update ) - update_option( 'dashboard_widget_options', $widget_options ); - /** This action is documented in wp-admin/edit-form-advanced.php */ do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); @@ -186,16 +178,16 @@ function wp_dashboard() { ?>
-
+
id, 'normal', '' ); ?>
-
+
id, 'side', '' ); ?>
-
+
id, 'column3', '' ); ?>
-
+
id, 'column4', '' ); ?>
@@ -218,11 +210,6 @@ function wp_dashboard() { * @since 2.7.0 */ function wp_dashboard_right_now() { - $theme = wp_get_theme(); - if ( current_user_can( 'switch_themes' ) ) - $theme_name = sprintf( '%1$s', $theme->display('Name') ); - else - $theme_name = $theme->display('Name'); ?>
    @@ -248,8 +235,8 @@ function wp_dashboard_right_now() { } // Comments $num_comm = wp_count_comments(); - if ( $num_comm && $num_comm->total_comments ) { - $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->total_comments ), number_format_i18n( $num_comm->total_comments ) ); + if ( $num_comm && $num_comm->approved ) { + $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); ?>
  • - +

@@ -531,7 +518,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) { function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $GLOBALS['comment'] =& $comment; - $comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID )); + $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); if ( current_user_can( 'edit_post', $comment->comment_post_ID ) ) { $comment_post_url = get_edit_post_link( $comment->comment_post_ID ); @@ -544,7 +531,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { - // preorder it: Approve | Reply | Edit | Spam | Trash + // Pre-order it: Approve | Reply | Edit | Spam | Trash. $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', @@ -614,16 +601,16 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { comment_type ) : - case 'pingback' : - $type = __( 'Pingback' ); - break; - case 'trackback' : - $type = __( 'Trackback' ); - break; - default : - $type = ucwords( $comment->comment_type ); - endswitch; + switch ( $comment->comment_type ) { + case 'pingback' : + $type = __( 'Pingback' ); + break; + case 'trackback' : + $type = __( 'Trackback' ); + break; + default : + $type = ucwords( $comment->comment_type ); + } $type = esc_html( $type ); ?>

@@ -712,7 +699,6 @@ function wp_dashboard_recent_posts( $args ) { echo '
    '; - $i = 0; $today = date( 'Y-m-d', current_time( 'timestamp' ) ); $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); @@ -761,11 +747,8 @@ function wp_dashboard_recent_posts( $args ) { * @return bool False if no comments were found. True otherwise. */ function wp_dashboard_recent_comments( $total_items = 5 ) { - global $wpdb; - // Select all comment types and filter out spam later for better query performance. $comments = array(); - $start = 0; $comments_query = array( 'number' => $total_items * 5, @@ -786,8 +769,6 @@ function wp_dashboard_recent_comments( $total_items = 5 ) { $comments_query['number'] = $total_items * 10; } - - if ( $comments ) { echo '
    '; echo '

    ' . __( 'Comments' ) . '

    '; @@ -864,8 +845,8 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar } if ( $callback && is_callable( $callback ) ) { - $args = array_slice( func_get_args(), 2 ); - array_unshift( $args, $widget_id ); + $args = array_slice( func_get_args(), 3 ); + array_unshift( $args, $widget_id, $check_urls ); ob_start(); call_user_func_array( $callback, $args ); set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds) @@ -917,7 +898,8 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] ); $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); $widget_options[$widget_id]['number'] = $number; - // title is optional. If black, fill it if possible + + // Title is optional. If black, fill it if possible. if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { $rss = fetch_feed($widget_options[$widget_id]['url']); if ( is_wp_error($rss) ) { @@ -985,7 +967,7 @@ function wp_dashboard_primary() { * * @param string $link The widget's secondary link URL. */ - 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ), + 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), /** * Filter the secondary feed URL for the 'WordPress News' dashboard widget. @@ -994,7 +976,7 @@ function wp_dashboard_primary() { * * @param string $url The widget's secondary feed URL. */ - 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ), + 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), /** * Filter the secondary link title for the 'WordPress News' dashboard widget. @@ -1065,13 +1047,11 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) { echo '
      '; - foreach ( array( - 'popular' => __( 'Popular Plugin' ) - ) as $feed => $label ) { - if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) + foreach ( array( $popular ) as $feed ) { + if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) continue; - $items = $$feed->get_items(0, 5); + $items = $feed->get_items(0, 5); // Pick a random, non-installed plugin while ( true ) { @@ -1114,14 +1094,11 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) { $title = esc_html( $item->get_title() ); - $description = esc_html( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); - $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; + echo "
    • " . __( 'Popular Plugin' ) . ": $title (" . __( 'Install' ) . ")
    • "; - echo "
    • $label: $title (" . __( 'Install' ) . ")
    • "; - - $$feed->__destruct(); - unset( $$feed ); + $feed->__destruct(); + unset( $feed ); } echo '
    '; @@ -1134,7 +1111,7 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) { * * @since 3.0.0 * - * @return bool True if not multisite, user can't upload files, or the space check option is disabled. + * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. */ function wp_dashboard_quota() { if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) @@ -1303,8 +1280,10 @@ function wp_welcome_panel() {

    -

    - + +

    + + true ) ) ) > 1 ) ) : ?>

    change your theme completely' ), admin_url( 'themes.php' ) ); ?>