X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/4feeb71a9d812a9ae371c28a3d8b442a4394ded7..607b7e02d77e7326161e8ec15639052d2040f745:/wp-admin/includes/dashboard.php diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 5a234857..e517f956 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -65,7 +65,7 @@ function wp_dashboard_setup() { do_action( 'wp_network_dashboard_setup' ); /** - * Filter the list of widgets to load for the Network Admin dashboard. + * Filters the list of widgets to load for the Network Admin dashboard. * * @since 3.1.0 * @@ -82,7 +82,7 @@ function wp_dashboard_setup() { do_action( 'wp_user_dashboard_setup' ); /** - * Filter the list of widgets to load for the User Admin dashboard. + * Filters the list of widgets to load for the User Admin dashboard. * * @since 3.1.0 * @@ -99,7 +99,7 @@ function wp_dashboard_setup() { do_action( 'wp_dashboard_setup' ); /** - * Filter the list of widgets to load for the admin dashboard. + * Filters the list of widgets to load for the admin dashboard. * * @since 2.5.0 * @@ -148,6 +148,14 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ $screen = get_current_screen(); global $wp_dashboard_control_callbacks; + $private_callback_args = array( '__widget_basename' => $widget_name ); + + if ( is_null( $callback_args ) ) { + $callback_args = $private_callback_args; + } else if ( is_array( $callback_args ) ) { + $callback_args = array_merge( $callback_args, $private_callback_args ); + } + if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { $wp_dashboard_control_callbacks[$widget_id] = $control_callback; if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { @@ -263,7 +271,7 @@ function wp_dashboard_right_now() { } // Comments $num_comm = wp_count_comments(); - if ( $num_comm && $num_comm->approved ) { + if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); ?>
  • @@ -283,7 +291,7 @@ function wp_dashboard_right_now() { } /** - * Filter the array of extra elements to list in the 'At a Glance' + * Filters the array of extra elements to list in the 'At a Glance' * dashboard widget. * * Prior to 3.8.0, the widget was named 'Right Now'. Each element @@ -308,7 +316,7 @@ function wp_dashboard_right_now() { if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) { /** - * Filter the link title attribute for the 'Search Engines Discouraged' + * Filters the link title attribute for the 'Search Engines Discouraged' * message displayed in the 'At a Glance' dashboard widget. * * Prior to 3.8.0, the widget was named 'Right Now'. @@ -321,7 +329,7 @@ function wp_dashboard_right_now() { $title = apply_filters( 'privacy_on_link_title', '' ); /** - * Filter the link label for the 'Search Engines Discouraged' message + * Filters the link label for the 'Search Engines Discouraged' message * displayed in the 'At a Glance' dashboard widget. * * Prior to 3.8.0, the widget was named 'Right Now'. @@ -538,7 +546,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) { ); /** - * Filter the post query arguments for the 'Recent Drafts' dashboard widget. + * Filters the post query arguments for the 'Recent Drafts' dashboard widget. * * @since 4.4.0 * @@ -630,12 +638,10 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $actions['trash'] = "" . _x( 'Trash', 'verb' ) . ''; } - if ( '1' === $comment->comment_approved ) { - $actions['view'] = '' . __( 'View' ) . ''; - } + $actions['view'] = '' . __( 'View' ) . ''; /** - * Filter the action links displayed for each comment in the 'Recent Comments' + * Filters the action links displayed for each comment in the 'Recent Comments' * dashboard widget. * * @since 2.6.0 @@ -653,9 +659,13 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; // Reply and quickedit need a hide-if-no-js span - if ( 'reply' == $action || 'quickedit' == $action ) + if ( 'reply' == $action || 'quickedit' == $action ) { $action .= ' hide-if-no-js'; + } + if ( 'view' === $action && '1' !== $comment->comment_approved ) { + $action .= ' hidden'; + } $actions_string .= "$sep$link"; } } @@ -804,7 +814,7 @@ function wp_dashboard_recent_posts( $args ) { ); /** - * Filter the query arguments used for the Recent Posts widget. + * Filters the query arguments used for the Recent Posts widget. * * @since 4.2.0 * @@ -833,10 +843,10 @@ function wp_dashboard_recent_posts( $args ) { } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { $relative = __( 'Tomorrow' ); } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) { - /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see http://php.net/date */ + /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ $relative = date_i18n( __( 'M jS Y' ), $time ); } else { - /* translators: date and time format for recent posts on the dashboard, see http://php.net/date */ + /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ $relative = date_i18n( __( 'M jS' ), $time ); } @@ -945,7 +955,7 @@ function wp_dashboard_rss_output( $widget_id ) { * If $check_urls is empty, look for the rss feed url found in the dashboard * widget options of $widget_id. If cached, call $callback, a function that * echoes out output for this widget. If not cache, echo a "Loading..." stub - * which is later replaced by AJAX call (see top of /wp-admin/index.php) + * which is later replaced by Ajax call (see top of /wp-admin/index.php) * * @since 2.5.0 * @@ -1066,7 +1076,7 @@ function wp_dashboard_primary() { 'news' => array( /** - * Filter the primary link URL for the 'WordPress News' dashboard widget. + * Filters the primary link URL for the 'WordPress News' dashboard widget. * * @since 2.5.0 * @@ -1075,7 +1085,7 @@ function wp_dashboard_primary() { 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), /** - * Filter the primary feed URL for the 'WordPress News' dashboard widget. + * Filters the primary feed URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -1084,7 +1094,7 @@ function wp_dashboard_primary() { 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), /** - * Filter the primary link title for the 'WordPress News' dashboard widget. + * Filters the primary link title for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -1099,7 +1109,7 @@ function wp_dashboard_primary() { 'planet' => array( /** - * Filter the secondary link URL for the 'WordPress News' dashboard widget. + * Filters the secondary link URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -1108,7 +1118,7 @@ function wp_dashboard_primary() { 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), /** - * Filter the secondary feed URL for the 'WordPress News' dashboard widget. + * Filters the secondary feed URL for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -1117,7 +1127,7 @@ function wp_dashboard_primary() { 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), /** - * Filter the secondary link title for the 'WordPress News' dashboard widget. + * Filters the secondary link title for the 'WordPress News' dashboard widget. * * @since 2.3.0 * @@ -1126,7 +1136,7 @@ function wp_dashboard_primary() { 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), /** - * Filter the number of secondary link items for the 'WordPress News' dashboard widget. + * Filters the number of secondary link items for the 'WordPress News' dashboard widget. * * @since 4.4.0 * @@ -1259,7 +1269,7 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) { /** * Display file upload quota on dashboard. * - * Runs on the activity_box_end hook in wp_dashboard_right_now(). + * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now(). * * @since 3.0.0 * @@ -1353,7 +1363,7 @@ function wp_dashboard_browser_nag() { } /** - * Filter the notice output for the 'Browse Happy' nag meta box. + * Filters the notice output for the 'Browse Happy' nag meta box. * * @since 3.2.0 *