~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/includes/dashboard.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
                do_action( 'wp_network_dashboard_setup' );
66
66
 
67
67
                /**
68
 
                 * Filter the list of widgets to load for the Network Admin dashboard.
 
68
                 * Filters the list of widgets to load for the Network Admin dashboard.
69
69
                 *
70
70
                 * @since 3.1.0
71
71
                 *
82
82
                do_action( 'wp_user_dashboard_setup' );
83
83
 
84
84
                /**
85
 
                 * Filter the list of widgets to load for the User Admin dashboard.
 
85
                 * Filters the list of widgets to load for the User Admin dashboard.
86
86
                 *
87
87
                 * @since 3.1.0
88
88
                 *
99
99
                do_action( 'wp_dashboard_setup' );
100
100
 
101
101
                /**
102
 
                 * Filter the list of widgets to load for the admin dashboard.
 
102
                 * Filters the list of widgets to load for the admin dashboard.
103
103
                 *
104
104
                 * @since 2.5.0
105
105
                 *
148
148
        $screen = get_current_screen();
149
149
        global $wp_dashboard_control_callbacks;
150
150
 
 
151
        $private_callback_args = array( '__widget_basename' => $widget_name );
 
152
 
 
153
        if ( is_null( $callback_args ) ) {
 
154
                $callback_args = $private_callback_args;
 
155
        } else if ( is_array( $callback_args ) ) {
 
156
                $callback_args = array_merge( $callback_args, $private_callback_args );
 
157
        }
 
158
 
151
159
        if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
152
160
                $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
153
161
                if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
263
271
        }
264
272
        // Comments
265
273
        $num_comm = wp_count_comments();
266
 
        if ( $num_comm && $num_comm->approved ) {
 
274
        if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
267
275
                $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
268
276
                ?>
269
277
                <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
283
291
        }
284
292
 
285
293
        /**
286
 
         * Filter the array of extra elements to list in the 'At a Glance'
 
294
         * Filters the array of extra elements to list in the 'At a Glance'
287
295
         * dashboard widget.
288
296
         *
289
297
         * Prior to 3.8.0, the widget was named 'Right Now'. Each element
308
316
        if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) {
309
317
 
310
318
                /**
311
 
                 * Filter the link title attribute for the 'Search Engines Discouraged'
 
319
                 * Filters the link title attribute for the 'Search Engines Discouraged'
312
320
                 * message displayed in the 'At a Glance' dashboard widget.
313
321
                 *
314
322
                 * Prior to 3.8.0, the widget was named 'Right Now'.
321
329
                $title = apply_filters( 'privacy_on_link_title', '' );
322
330
 
323
331
                /**
324
 
                 * Filter the link label for the 'Search Engines Discouraged' message
 
332
                 * Filters the link label for the 'Search Engines Discouraged' message
325
333
                 * displayed in the 'At a Glance' dashboard widget.
326
334
                 *
327
335
                 * Prior to 3.8.0, the widget was named 'Right Now'.
538
546
                );
539
547
 
540
548
                /**
541
 
                 * Filter the post query arguments for the 'Recent Drafts' dashboard widget.
 
549
                 * Filters the post query arguments for the 'Recent Drafts' dashboard widget.
542
550
                 *
543
551
                 * @since 4.4.0
544
552
                 *
630
638
                        $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
631
639
                }
632
640
 
633
 
                if ( '1' === $comment->comment_approved ) {
634
 
                        $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
635
 
                }
 
641
                $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
636
642
 
637
643
                /**
638
 
                 * Filter the action links displayed for each comment in the 'Recent Comments'
 
644
                 * Filters the action links displayed for each comment in the 'Recent Comments'
639
645
                 * dashboard widget.
640
646
                 *
641
647
                 * @since 2.6.0
653
659
                        ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
654
660
 
655
661
                        // Reply and quickedit need a hide-if-no-js span
656
 
                        if ( 'reply' == $action || 'quickedit' == $action )
 
662
                        if ( 'reply' == $action || 'quickedit' == $action ) {
657
663
                                $action .= ' hide-if-no-js';
 
664
                        }
658
665
 
 
666
                        if ( 'view' === $action && '1' !== $comment->comment_approved ) {
 
667
                                $action .= ' hidden';
 
668
                        }
659
669
                        $actions_string .= "<span class='$action'>$sep$link</span>";
660
670
                }
661
671
        }
804
814
        );
805
815
 
806
816
        /**
807
 
         * Filter the query arguments used for the Recent Posts widget.
 
817
         * Filters the query arguments used for the Recent Posts widget.
808
818
         *
809
819
         * @since 4.2.0
810
820
         *
833
843
                        } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
834
844
                                $relative = __( 'Tomorrow' );
835
845
                        } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) {
836
 
                                /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see http://php.net/date */
 
846
                                /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */
837
847
                                $relative = date_i18n( __( 'M jS Y' ), $time );
838
848
                        } else {
839
 
                                /* translators: date and time format for recent posts on the dashboard, see http://php.net/date */
 
849
                                /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */
840
850
                                $relative = date_i18n( __( 'M jS' ), $time );
841
851
                        }
842
852
 
945
955
 * If $check_urls is empty, look for the rss feed url found in the dashboard
946
956
 * widget options of $widget_id. If cached, call $callback, a function that
947
957
 * echoes out output for this widget. If not cache, echo a "Loading..." stub
948
 
 * which is later replaced by AJAX call (see top of /wp-admin/index.php)
 
958
 * which is later replaced by Ajax call (see top of /wp-admin/index.php)
949
959
 *
950
960
 * @since 2.5.0
951
961
 *
1066
1076
                'news' => array(
1067
1077
 
1068
1078
                        /**
1069
 
                         * Filter the primary link URL for the 'WordPress News' dashboard widget.
 
1079
                         * Filters the primary link URL for the 'WordPress News' dashboard widget.
1070
1080
                         *
1071
1081
                         * @since 2.5.0
1072
1082
                         *
1075
1085
                        'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ),
1076
1086
 
1077
1087
                        /**
1078
 
                         * Filter the primary feed URL for the 'WordPress News' dashboard widget.
 
1088
                         * Filters the primary feed URL for the 'WordPress News' dashboard widget.
1079
1089
                         *
1080
1090
                         * @since 2.3.0
1081
1091
                         *
1084
1094
                        'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
1085
1095
 
1086
1096
                        /**
1087
 
                         * Filter the primary link title for the 'WordPress News' dashboard widget.
 
1097
                         * Filters the primary link title for the 'WordPress News' dashboard widget.
1088
1098
                         *
1089
1099
                         * @since 2.3.0
1090
1100
                         *
1099
1109
                'planet' => array(
1100
1110
 
1101
1111
                        /**
1102
 
                         * Filter the secondary link URL for the 'WordPress News' dashboard widget.
 
1112
                         * Filters the secondary link URL for the 'WordPress News' dashboard widget.
1103
1113
                         *
1104
1114
                         * @since 2.3.0
1105
1115
                         *
1108
1118
                        'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
1109
1119
 
1110
1120
                        /**
1111
 
                         * Filter the secondary feed URL for the 'WordPress News' dashboard widget.
 
1121
                         * Filters the secondary feed URL for the 'WordPress News' dashboard widget.
1112
1122
                         *
1113
1123
                         * @since 2.3.0
1114
1124
                         *
1117
1127
                        'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
1118
1128
 
1119
1129
                        /**
1120
 
                         * Filter the secondary link title for the 'WordPress News' dashboard widget.
 
1130
                         * Filters the secondary link title for the 'WordPress News' dashboard widget.
1121
1131
                         *
1122
1132
                         * @since 2.3.0
1123
1133
                         *
1126
1136
                        'title'        => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
1127
1137
 
1128
1138
                        /**
1129
 
                         * Filter the number of secondary link items for the 'WordPress News' dashboard widget.
 
1139
                         * Filters the number of secondary link items for the 'WordPress News' dashboard widget.
1130
1140
                         *
1131
1141
                         * @since 4.4.0
1132
1142
                         *
1259
1269
/**
1260
1270
 * Display file upload quota on dashboard.
1261
1271
 *
1262
 
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 
1272
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
1263
1273
 *
1264
1274
 * @since 3.0.0
1265
1275
 *
1353
1363
        }
1354
1364
 
1355
1365
        /**
1356
 
        * Filter the notice output for the 'Browse Happy' nag meta box.
 
1366
        * Filters the notice output for the 'Browse Happy' nag meta box.
1357
1367
        *
1358
1368
        * @since 3.2.0
1359
1369
        *