run:R W Run
7.85 KB
2026-03-11 16:18:51
R W Run
3.54 KB
2026-03-11 16:18:51
R W Run
148.33 KB
2026-03-11 16:18:51
R W Run
11.45 KB
2026-03-11 16:18:51
R W Run
3.58 KB
2026-03-11 16:18:51
R W Run
2.53 KB
2026-03-11 16:18:51
R W Run
2.6 KB
2026-03-11 16:18:51
R W Run
6.59 KB
2026-03-11 16:18:51
R W Run
14.83 KB
2026-03-11 16:18:51
R W Run
21.18 KB
2026-03-11 16:18:51
R W Run
48.13 KB
2026-03-11 16:18:51
R W Run
4.07 KB
2026-03-11 16:18:51
R W Run
5.3 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
26.73 KB
2026-03-11 16:18:51
R W Run
2.8 KB
2026-03-11 16:18:51
R W Run
15.2 KB
2026-03-11 16:18:51
R W Run
192.08 KB
2026-03-11 16:18:51
R W Run
11.77 KB
2026-03-11 16:18:51
R W Run
3.2 KB
2026-03-11 16:18:51
R W Run
22.89 KB
2026-03-11 16:18:51
R W Run
12.77 KB
2026-03-11 16:18:51
R W Run
4.08 KB
2026-03-11 16:18:51
R W Run
26.27 KB
2026-03-11 16:18:51
R W Run
4.97 KB
2026-03-11 16:18:51
R W Run
5.57 KB
2026-03-11 16:18:51
R W Run
13.93 KB
2026-03-11 16:18:51
R W Run
4.09 KB
2026-03-11 16:18:51
R W Run
6.79 KB
2026-03-11 16:18:51
R W Run
60.45 KB
2026-03-11 16:18:51
R W Run
32.4 KB
2026-03-11 16:18:51
R W Run
18.24 KB
2026-03-11 16:18:51
R W Run
66.01 KB
2026-03-11 16:18:51
R W Run
23.84 KB
2026-03-11 16:18:51
R W Run
17.72 KB
2026-03-11 16:18:51
R W Run
22.71 KB
2026-03-11 16:18:51
R W Run
18.05 KB
2026-03-11 16:18:51
R W Run
22.76 KB
2026-03-11 16:18:51
R W Run
7.34 KB
2026-03-11 16:18:51
R W Run
4.51 KB
2026-03-11 16:18:51
R W Run
9.02 KB
2026-03-11 16:18:51
R W Run
1.46 KB
2026-03-11 16:18:51
R W Run
51.76 KB
2026-03-11 16:18:51
R W Run
25.29 KB
2026-03-11 16:18:51
R W Run
21.61 KB
2026-03-11 16:18:51
R W Run
27.77 KB
2026-03-11 16:18:51
R W Run
15.35 KB
2026-03-11 16:18:51
R W Run
24.54 KB
2026-03-11 16:18:51
R W Run
56.44 KB
2026-03-11 16:18:51
R W Run
1.42 KB
2026-03-11 16:18:51
R W Run
63.66 KB
2026-03-11 16:18:51
R W Run
31.9 KB
2026-03-11 16:18:51
R W Run
14.44 KB
2026-03-11 16:18:51
R W Run
36.47 KB
2026-03-11 16:18:51
R W Run
14 KB
2026-03-11 16:18:51
R W Run
121.89 KB
2026-03-11 16:18:51
R W Run
6.26 KB
2026-03-11 16:18:51
R W Run
20.73 KB
2026-03-11 16:18:51
R W Run
15.23 KB
2026-03-11 16:18:51
R W Run
10.14 KB
2026-03-11 16:18:51
R W Run
6.94 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
46.85 KB
2026-03-11 16:18:51
R W Run
18.61 KB
2026-03-11 16:18:51
R W Run
6.08 KB
2026-03-11 16:18:51
R W Run
20.06 KB
2026-03-11 16:18:51
R W Run
5.73 KB
2026-03-11 16:18:51
R W Run
68.18 KB
2026-03-11 16:18:51
R W Run
40.8 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
25.26 KB
2026-03-11 16:18:51
R W Run
95.94 KB
2026-03-11 16:18:51
R W Run
43.12 KB
2026-03-11 16:18:51
R W Run
41.73 KB
2026-03-11 16:18:51
R W Run
6.46 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
116.31 KB
2026-03-11 16:18:51
R W Run
9.39 KB
2026-03-11 16:18:51
R W Run
64.34 KB
2026-03-11 16:18:51
R W Run
44.73 KB
2026-03-11 16:18:51
R W Run
1.27 KB
2026-03-11 16:18:51
R W Run
3.68 KB
2026-03-11 16:18:51
R W Run
33.53 KB
2026-03-11 16:18:51
R W Run
48.84 KB
2026-03-11 16:18:51
R W Run
26.35 KB
2026-03-11 16:18:51
R W Run
1.12 KB
2026-03-11 16:18:51
R W Run
4.19 KB
2026-03-11 16:18:51
R W Run
38.19 KB
2026-03-11 16:18:51
R W Run
91.33 KB
2026-03-11 16:18:51
R W Run
80.39 KB
2026-03-11 16:18:51
R W Run
32.67 KB
2026-03-11 16:18:51
R W Run
16.18 KB
2026-03-11 16:18:51
R W Run
44.46 KB
2026-03-11 16:18:51
R W Run
6.23 KB
2026-03-11 16:18:51
R W Run
8.23 KB
2026-03-11 16:18:51
R W Run
96.96 KB
2026-03-11 16:18:51
R W Run
6.83 KB
2026-03-11 16:18:51
R W Run
46.62 KB
2026-03-11 16:18:51
R W Run
10.82 KB
2026-03-11 16:18:51
R W Run
68.86 KB
2026-03-11 16:18:51
R W Run
33.63 KB
2026-03-11 16:18:51
R W Run
113.3 KB
2026-03-11 16:18:51
R W Run
22.98 KB
2026-03-11 16:18:51
R W Run
10.66 KB
2026-03-11 16:18:51
R W Run
error_log
📄dashboard.php
1<?php
2/**
3 * WordPress Dashboard Widget Administration Screen API
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/**
10 * Registers dashboard widgets.
11 *
12 * Handles POST data, sets up filters.
13 *
14 * @since 2.5.0
15 *
16 * @global array $wp_registered_widgets
17 * @global array $wp_registered_widget_controls
18 * @global callable[] $wp_dashboard_control_callbacks
19 */
20function wp_dashboard_setup() {
21 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
22
23 $screen = get_current_screen();
24
25 /* Register Widgets and Controls */
26 $wp_dashboard_control_callbacks = array();
27
28 // Browser version
29 $check_browser = wp_check_browser_version();
30
31 if ( $check_browser && $check_browser['upgrade'] ) {
32 add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
33
34 if ( $check_browser['insecure'] ) {
35 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
36 } else {
37 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
38 }
39 }
40
41 // PHP Version.
42 $check_php = wp_check_php_version();
43
44 if ( $check_php && current_user_can( 'update_php' ) ) {
45 // If "not acceptable" the widget will be shown.
46 if ( isset( $check_php['is_acceptable'] ) && ! $check_php['is_acceptable'] ) {
47 add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
48
49 if ( $check_php['is_lower_than_future_minimum'] ) {
50 wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' );
51 } else {
52 wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
53 }
54 }
55 }
56
57 // Site Health.
58 if ( current_user_can( 'view_site_health_checks' ) && ! is_network_admin() ) {
59 if ( ! class_exists( 'WP_Site_Health' ) ) {
60 require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
61 }
62
63 WP_Site_Health::get_instance();
64
65 wp_enqueue_style( 'site-health' );
66 wp_enqueue_script( 'site-health' );
67
68 wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
69 }
70
71 // Right Now.
72 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
73 wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
74 }
75
76 if ( is_network_admin() ) {
77 wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
78 }
79
80 // Activity Widget.
81 if ( is_blog_admin() ) {
82 wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
83 }
84
85 // QuickPress Widget.
86 if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
87 $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) );
88 wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
89 }
90
91 // WordPress Events and News.
92 wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' );
93
94 if ( is_network_admin() ) {
95
96 /**
97 * Fires after core widgets for the Network Admin dashboard have been registered.
98 *
99 * @since 3.1.0
100 */
101 do_action( 'wp_network_dashboard_setup' );
102
103 /**
104 * Filters the list of widgets to load for the Network Admin dashboard.
105 *
106 * @since 3.1.0
107 *
108 * @param string[] $dashboard_widgets An array of dashboard widget IDs.
109 */
110 $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
111 } elseif ( is_user_admin() ) {
112
113 /**
114 * Fires after core widgets for the User Admin dashboard have been registered.
115 *
116 * @since 3.1.0
117 */
118 do_action( 'wp_user_dashboard_setup' );
119
120 /**
121 * Filters the list of widgets to load for the User Admin dashboard.
122 *
123 * @since 3.1.0
124 *
125 * @param string[] $dashboard_widgets An array of dashboard widget IDs.
126 */
127 $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
128 } else {
129
130 /**
131 * Fires after core widgets for the admin dashboard have been registered.
132 *
133 * @since 2.5.0
134 */
135 do_action( 'wp_dashboard_setup' );
136
137 /**
138 * Filters the list of widgets to load for the admin dashboard.
139 *
140 * @since 2.5.0
141 *
142 * @param string[] $dashboard_widgets An array of dashboard widget IDs.
143 */
144 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
145 }
146
147 foreach ( $dashboard_widgets as $widget_id ) {
148 $name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __( 'View all' ) . '</a>';
149 wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] );
150 }
151
152 if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
153 check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
154 ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
155 wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
156 ob_end_clean();
157 wp_redirect( remove_query_arg( 'edit' ) );
158 exit;
159 }
160
161 /** This action is documented in wp-admin/includes/meta-boxes.php */
162 do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
163
164 /** This action is documented in wp-admin/includes/meta-boxes.php */
165 do_action( 'do_meta_boxes', $screen->id, 'side', '' );
166}
167
168/**
169 * Adds a new dashboard widget.
170 *
171 * @since 2.7.0
172 * @since 5.6.0 The `$context` and `$priority` parameters were added.
173 *
174 * @global callable[] $wp_dashboard_control_callbacks
175 *
176 * @param string $widget_id Widget ID (used in the 'id' attribute for the widget).
177 * @param string $widget_name Title of the widget.
178 * @param callable $callback Function that fills the widget with the desired content.
179 * The function should echo its output.
180 * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null.
181 * @param array $callback_args Optional. Data that should be set as the $args property of the widget array
182 * (which is the second parameter passed to your callback). Default null.
183 * @param string $context Optional. The context within the screen where the box should display.
184 * Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'.
185 * @param string $priority Optional. The priority within the context where the box should show.
186 * Accepts 'high', 'core', 'default', or 'low'. Default 'core'.
187 */
188function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) {
189 global $wp_dashboard_control_callbacks;
190
191 $screen = get_current_screen();
192
193 $private_callback_args = array( '__widget_basename' => $widget_name );
194
195 if ( is_null( $callback_args ) ) {
196 $callback_args = $private_callback_args;
197 } elseif ( is_array( $callback_args ) ) {
198 $callback_args = array_merge( $callback_args, $private_callback_args );
199 }
200
201 if ( $control_callback && is_callable( $control_callback ) && current_user_can( 'edit_dashboard' ) ) {
202 $wp_dashboard_control_callbacks[ $widget_id ] = $control_callback;
203
204 if ( isset( $_GET['edit'] ) && $widget_id === $_GET['edit'] ) {
205 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
206 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
207 $callback = '_wp_dashboard_control_callback';
208 } else {
209 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
210 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
211 }
212 }
213
214 $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
215
216 if ( in_array( $widget_id, $side_widgets, true ) ) {
217 $context = 'side';
218 }
219
220 $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' );
221
222 if ( in_array( $widget_id, $high_priority_widgets, true ) ) {
223 $priority = 'high';
224 }
225
226 if ( empty( $context ) ) {
227 $context = 'normal';
228 }
229
230 if ( empty( $priority ) ) {
231 $priority = 'core';
232 }
233
234 add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args );
235}
236
237/**
238 * Outputs controls for the current dashboard widget.
239 *
240 * @access private
241 * @since 2.7.0
242 *
243 * @param mixed $dashboard
244 * @param array $meta_box
245 */
246function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
247 echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">';
248 wp_dashboard_trigger_widget_control( $meta_box['id'] );
249 wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
250 echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />';
251 submit_button( __( 'Save Changes' ) );
252 echo '</form>';
253}
254
255/**
256 * Displays the dashboard.
257 *
258 * @since 2.5.0
259 */
260function wp_dashboard() {
261 $screen = get_current_screen();
262 $columns = absint( $screen->get_columns() );
263 $columns_css = '';
264
265 if ( $columns ) {
266 $columns_css = " columns-$columns";
267 }
268 ?>
269<div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
270 <div id="postbox-container-1" class="postbox-container">
271 <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
272 </div>
273 <div id="postbox-container-2" class="postbox-container">
274 <?php do_meta_boxes( $screen->id, 'side', '' ); ?>
275 </div>
276 <div id="postbox-container-3" class="postbox-container">
277 <?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
278 </div>
279 <div id="postbox-container-4" class="postbox-container">
280 <?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
281 </div>
282</div>
283
284 <?php
285 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
286 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
287}
288
289//
290// Dashboard Widgets.
291//
292
293/**
294 * Dashboard widget that displays some basic stats about the site.
295 *
296 * Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
297 *
298 * @since 2.7.0
299 */
300function wp_dashboard_right_now() {
301 ?>
302 <div class="main">
303 <ul>
304 <?php
305 // Posts and Pages.
306 foreach ( array( 'post', 'page' ) as $post_type ) {
307 $num_posts = wp_count_posts( $post_type );
308
309 if ( $num_posts && $num_posts->publish ) {
310 if ( 'post' === $post_type ) {
311 /* translators: %s: Number of posts. */
312 $text = _n( '%s Post', '%s Posts', $num_posts->publish );
313 } else {
314 /* translators: %s: Number of pages. */
315 $text = _n( '%s Page', '%s Pages', $num_posts->publish );
316 }
317
318 $text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
319 $post_type_object = get_post_type_object( $post_type );
320
321 if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
322 printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
323 } else {
324 printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
325 }
326 }
327 }
328
329 // Comments.
330 $num_comm = wp_count_comments();
331
332 if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
333 /* translators: %s: Number of comments. */
334 $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
335 ?>
336 <li class="comment-count">
337 <a href="edit-comments.php"><?php echo $text; ?></a>
338 </li>
339 <?php
340 $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
341 /* translators: %s: Number of comments. */
342 $text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
343 ?>
344 <li class="comment-mod-count<?php echo ! $num_comm->moderated ? ' hidden' : ''; ?>">
345 <a href="edit-comments.php?comment_status=moderated" class="comments-in-moderation-text"><?php echo $text; ?></a>
346 </li>
347 <?php
348 }
349
350 /**
351 * Filters the array of extra elements to list in the 'At a Glance'
352 * dashboard widget.
353 *
354 * Prior to 3.8.0, the widget was named 'Right Now'. Each element
355 * is wrapped in list-item tags on output.
356 *
357 * @since 3.8.0
358 *
359 * @param string[] $items Array of extra 'At a Glance' widget items.
360 */
361 $elements = apply_filters( 'dashboard_glance_items', array() );
362
363 if ( $elements ) {
364 echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
365 }
366
367 ?>
368 </ul>
369 <?php
370 update_right_now_message();
371
372 // Check if search engines are asked not to index this site.
373 if ( ! is_network_admin() && ! is_user_admin()
374 && current_user_can( 'manage_options' ) && ! get_option( 'blog_public' )
375 ) {
376
377 /**
378 * Filters the link title attribute for the 'Search engines discouraged'
379 * message displayed in the 'At a Glance' dashboard widget.
380 *
381 * Prior to 3.8.0, the widget was named 'Right Now'.
382 *
383 * @since 3.0.0
384 * @since 4.5.0 The default for `$title` was updated to an empty string.
385 *
386 * @param string $title Default attribute text.
387 */
388 $title = apply_filters( 'privacy_on_link_title', '' );
389
390 /**
391 * Filters the link label for the 'Search engines discouraged' message
392 * displayed in the 'At a Glance' dashboard widget.
393 *
394 * Prior to 3.8.0, the widget was named 'Right Now'.
395 *
396 * @since 3.0.0
397 *
398 * @param string $content Default text.
399 */
400 $content = apply_filters( 'privacy_on_link_text', __( 'Search engines discouraged' ) );
401
402 $title_attr = '' === $title ? '' : " title='$title'";
403
404 echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$content</a></p>";
405 }
406 ?>
407 </div>
408 <?php
409 /*
410 * activity_box_end has a core action, but only prints content when multisite.
411 * Using an output buffer is the only way to really check if anything's displayed here.
412 */
413 ob_start();
414
415 /**
416 * Fires at the end of the 'At a Glance' dashboard widget.
417 *
418 * Prior to 3.8.0, the widget was named 'Right Now'.
419 *
420 * @since 2.5.0
421 */
422 do_action( 'rightnow_end' );
423
424 /**
425 * Fires at the end of the 'At a Glance' dashboard widget.
426 *
427 * Prior to 3.8.0, the widget was named 'Right Now'.
428 *
429 * @since 2.0.0
430 */
431 do_action( 'activity_box_end' );
432
433 $actions = ob_get_clean();
434
435 if ( ! empty( $actions ) ) :
436 ?>
437 <div class="sub">
438 <?php echo $actions; ?>
439 </div>
440 <?php
441 endif;
442}
443
444/**
445 * @since 3.1.0
446 */
447function wp_network_dashboard_right_now() {
448 $actions = array();
449
450 if ( current_user_can( 'create_sites' ) ) {
451 $actions['create-site'] = '<a href="' . network_admin_url( 'site-new.php' ) . '">' . __( 'Create a New Site' ) . '</a>';
452 }
453 if ( current_user_can( 'create_users' ) ) {
454 $actions['create-user'] = '<a href="' . network_admin_url( 'user-new.php' ) . '">' . __( 'Create a New User' ) . '</a>';
455 }
456
457 $c_users = get_user_count();
458 $c_blogs = get_blog_count();
459
460 /* translators: %s: Number of users on the network. */
461 $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
462 /* translators: %s: Number of sites on the network. */
463 $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
464
465 /* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network. */
466 $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
467
468 if ( $actions ) {
469 echo '<ul class="subsubsub">';
470 foreach ( $actions as $class => $action ) {
471 $actions[ $class ] = "\t<li class='$class'>$action";
472 }
473 echo implode( " |</li>\n", $actions ) . "</li>\n";
474 echo '</ul>';
475 }
476 ?>
477 <br class="clear" />
478
479 <p class="youhave"><?php echo $sentence; ?></p>
480
481
482 <?php
483 /**
484 * Fires in the Network Admin 'Right Now' dashboard widget
485 * just before the user and site search form fields.
486 *
487 * @since MU (3.0.0)
488 */
489 do_action( 'wpmuadminresult' );
490 ?>
491
492 <form action="<?php echo esc_url( network_admin_url( 'users.php' ) ); ?>" method="get">
493 <p>
494 <label class="screen-reader-text" for="search-users">
495 <?php
496 /* translators: Hidden accessibility text. */
497 _e( 'Search Users' );
498 ?>
499 </label>
500 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users" />
501 <?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?>
502 </p>
503 </form>
504
505 <form action="<?php echo esc_url( network_admin_url( 'sites.php' ) ); ?>" method="get">
506 <p>
507 <label class="screen-reader-text" for="search-sites">
508 <?php
509 /* translators: Hidden accessibility text. */
510 _e( 'Search Sites' );
511 ?>
512 </label>
513 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites" />
514 <?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?>
515 </p>
516 </form>
517 <?php
518 /**
519 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
520 *
521 * @since MU (3.0.0)
522 */
523 do_action( 'mu_rightnow_end' );
524
525 /**
526 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
527 *
528 * @since MU (3.0.0)
529 */
530 do_action( 'mu_activity_box_end' );
531}
532
533/**
534 * Displays the Quick Draft widget.
535 *
536 * @since 3.8.0
537 *
538 * @global int $post_ID
539 *
540 * @param string|false $error_msg Optional. Error message. Default false.
541 */
542function wp_dashboard_quick_press( $error_msg = false ) {
543 global $post_ID;
544
545 if ( ! current_user_can( 'edit_posts' ) ) {
546 return;
547 }
548
549 // Check if a new auto-draft (= no new post_ID) is needed or if the old can be used.
550 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID.
551
552 if ( $last_post_id ) {
553 $post = get_post( $last_post_id );
554
555 if ( empty( $post ) || 'auto-draft' !== $post->post_status ) { // auto-draft doesn't exist anymore.
556 $post = get_default_post_to_edit( 'post', true );
557 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
558 } else {
559 $post->post_title = ''; // Remove the auto draft title.
560 }
561 } else {
562 $post = get_default_post_to_edit( 'post', true );
563 $user_id = get_current_user_id();
564
565 // Don't create an option if this is a super admin who does not belong to this site.
566 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) {
567 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
568 }
569 }
570
571 $post_ID = (int) $post->ID;
572 ?>
573
574 <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
575
576 <?php
577 if ( $error_msg ) {
578 wp_admin_notice(
579 $error_msg,
580 array(
581 'additional_classes' => array( 'error' ),
582 )
583 );
584 }
585 ?>
586
587 <div class="input-text-wrap" id="title-wrap">
588 <label for="title">
589 <?php
590 /** This filter is documented in wp-admin/edit-form-advanced.php */
591 echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
592 ?>
593 </label>
594 <input type="text" name="post_title" id="title" autocomplete="off" />
595 </div>
596
597 <div class="textarea-wrap" id="description-wrap">
598 <label for="content"><?php _e( 'Content' ); ?></label>
599 <textarea name="content" id="content" placeholder="<?php esc_attr_e( 'What&#8217;s on your mind?' ); ?>" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>
600 </div>
601
602 <p class="submit">
603 <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" />
604 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
605 <input type="hidden" name="post_type" value="post" />
606 <?php wp_nonce_field( 'add-post' ); ?>
607 <?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?>
608 <br class="clear" />
609 </p>
610
611 </form>
612 <?php
613 wp_dashboard_recent_drafts();
614}
615
616/**
617 * Show recent drafts of the user on the dashboard.
618 *
619 * @since 2.7.0
620 *
621 * @param WP_Post[]|false $drafts Optional. Array of posts to display. Default false.
622 */
623function wp_dashboard_recent_drafts( $drafts = false ) {
624 if ( ! $drafts ) {
625 $query_args = array(
626 'post_type' => 'post',
627 'post_status' => 'draft',
628 'author' => get_current_user_id(),
629 'posts_per_page' => 4,
630 'orderby' => 'modified',
631 'order' => 'DESC',
632 );
633
634 /**
635 * Filters the post query arguments for the 'Recent Drafts' dashboard widget.
636 *
637 * @since 4.4.0
638 *
639 * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget.
640 */
641 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args );
642
643 $drafts = get_posts( $query_args );
644 if ( ! $drafts ) {
645 return;
646 }
647 }
648
649 echo '<div class="drafts">';
650
651 if ( count( $drafts ) > 3 ) {
652 printf(
653 '<p class="view-all"><a href="%s">%s</a></p>' . "\n",
654 esc_url( admin_url( 'edit.php?post_status=draft' ) ),
655 __( 'View all drafts' )
656 );
657 }
658
659 echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n";
660 echo '<ul>';
661
662 /* translators: Maximum number of words used in a preview of a draft on the dashboard. */
663 $draft_length = (int) _x( '10', 'draft_length' );
664
665 $drafts = array_slice( $drafts, 0, 3 );
666 foreach ( $drafts as $draft ) {
667 $url = get_edit_post_link( $draft->ID );
668 $title = _draft_or_post_title( $draft->ID );
669
670 echo "<li>\n";
671 printf(
672 '<div class="draft-title"><a href="%s" aria-label="%s">%s</a><time datetime="%s">%s</time></div>',
673 esc_url( $url ),
674 /* translators: %s: Post title. */
675 esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
676 esc_html( $title ),
677 get_the_time( 'c', $draft ),
678 get_the_time( __( 'F j, Y' ), $draft )
679 );
680
681 $the_content = wp_trim_words( $draft->post_content, $draft_length );
682
683 if ( $the_content ) {
684 echo '<p>' . $the_content . '</p>';
685 }
686 echo "</li>\n";
687 }
688
689 echo "</ul>\n";
690 echo '</div>';
691}
692
693/**
694 * Outputs a row for the Recent Comments widget.
695 *
696 * @access private
697 * @since 2.7.0
698 *
699 * @global WP_Comment $comment Global comment object.
700 *
701 * @param WP_Comment $comment The current comment.
702 * @param bool $show_date Optional. Whether to display the date.
703 */
704function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
705 $GLOBALS['comment'] = clone $comment;
706
707 if ( $comment->comment_post_ID > 0 ) {
708 $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
709 $comment_post_url = get_the_permalink( $comment->comment_post_ID );
710 $comment_post_link = '<a href="' . esc_url( $comment_post_url ) . '">' . $comment_post_title . '</a>';
711 } else {
712 $comment_post_link = '';
713 }
714
715 $actions_string = '';
716 if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
717 // Pre-order it: Approve | Reply | Edit | Spam | Trash.
718 $actions = array(
719 'approve' => '',
720 'unapprove' => '',
721 'reply' => '',
722 'edit' => '',
723 'spam' => '',
724 'trash' => '',
725 'delete' => '',
726 'view' => '',
727 );
728
729 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) );
730 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) );
731
732 $action_string = 'comment.php?action=%s&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . '&%s';
733
734 $approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce );
735 $unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce );
736 $spam_url = sprintf( $action_string, 'spamcomment', $del_nonce );
737 $trash_url = sprintf( $action_string, 'trashcomment', $del_nonce );
738 $delete_url = sprintf( $action_string, 'deletecomment', $del_nonce );
739
740 $actions['approve'] = sprintf(
741 '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>',
742 esc_url( $approve_url ),
743 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved",
744 esc_attr__( 'Approve this comment' ),
745 __( 'Approve' )
746 );
747
748 $actions['unapprove'] = sprintf(
749 '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>',
750 esc_url( $unapprove_url ),
751 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved",
752 esc_attr__( 'Unapprove this comment' ),
753 __( 'Unapprove' )
754 );
755
756 $actions['edit'] = sprintf(
757 '<a href="%s" aria-label="%s">%s</a>',
758 "comment.php?action=editcomment&amp;c={$comment->comment_ID}",
759 esc_attr__( 'Edit this comment' ),
760 __( 'Edit' )
761 );
762
763 $actions['reply'] = sprintf(
764 '<button type="button" onclick="window.commentReply && commentReply.open(\'%s\',\'%s\');" class="vim-r button-link hide-if-no-js" aria-label="%s">%s</button>',
765 $comment->comment_ID,
766 $comment->comment_post_ID,
767 esc_attr__( 'Reply to this comment' ),
768 __( 'Reply' )
769 );
770
771 $actions['spam'] = sprintf(
772 '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
773 esc_url( $spam_url ),
774 "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1",
775 esc_attr__( 'Mark this comment as spam' ),
776 /* translators: "Mark as spam" link. */
777 _x( 'Spam', 'verb' )
778 );
779
780 if ( ! EMPTY_TRASH_DAYS ) {
781 $actions['delete'] = sprintf(
782 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
783 esc_url( $delete_url ),
784 "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
785 esc_attr__( 'Delete this comment permanently' ),
786 __( 'Delete Permanently' )
787 );
788 } else {
789 $actions['trash'] = sprintf(
790 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
791 esc_url( $trash_url ),
792 "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
793 esc_attr__( 'Move this comment to the Trash' ),
794 _x( 'Trash', 'verb' )
795 );
796 }
797
798 $actions['view'] = sprintf(
799 '<a class="comment-link" href="%s" aria-label="%s">%s</a>',
800 esc_url( get_comment_link( $comment ) ),
801 esc_attr__( 'View this comment' ),
802 __( 'View' )
803 );
804
805 /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
806 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
807
808 $i = 0;
809
810 foreach ( $actions as $action => $link ) {
811 ++$i;
812
813 if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i )
814 || 1 === $i
815 ) {
816 $separator = '';
817 } else {
818 $separator = ' | ';
819 }
820
821 // Reply and quickedit need a hide-if-no-js span.
822 if ( 'reply' === $action || 'quickedit' === $action ) {
823 $action .= ' hide-if-no-js';
824 }
825
826 if ( 'view' === $action && '1' !== $comment->comment_approved ) {
827 $action .= ' hidden';
828 }
829
830 $actions_string .= "<span class='$action'>{$separator}{$link}</span>";
831 }
832 }
833 ?>
834
835 <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>>
836
837 <?php
838 $comment_row_class = '';
839
840 if ( get_option( 'show_avatars' ) ) {
841 echo get_avatar( $comment, 50, 'mystery' );
842 $comment_row_class .= ' has-avatar';
843 }
844 ?>
845
846 <?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?>
847
848 <div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>">
849 <p class="comment-meta">
850 <?php
851 // Comments might not have a post they relate to, e.g. programmatically created ones.
852 if ( $comment_post_link ) {
853 printf(
854 /* translators: 1: Comment author, 2: Post link, 3: Notification if the comment is pending. */
855 __( 'From %1$s on %2$s %3$s' ),
856 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
857 $comment_post_link,
858 '<span class="approve">' . __( '[Pending]' ) . '</span>'
859 );
860 } else {
861 printf(
862 /* translators: 1: Comment author, 2: Notification if the comment is pending. */
863 __( 'From %1$s %2$s' ),
864 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
865 '<span class="approve">' . __( '[Pending]' ) . '</span>'
866 );
867 }
868 ?>
869 </p>
870
871 <?php
872 else :
873 switch ( $comment->comment_type ) {
874 case 'pingback':
875 $type = __( 'Pingback' );
876 break;
877 case 'trackback':
878 $type = __( 'Trackback' );
879 break;
880 default:
881 $type = ucwords( $comment->comment_type );
882 }
883 $type = esc_html( $type );
884 ?>
885 <div class="dashboard-comment-wrap has-row-actions">
886 <p class="comment-meta">
887 <?php
888 // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones.
889 if ( $comment_post_link ) {
890 printf(
891 /* translators: 1: Type of comment, 2: Post link, 3: Notification if the comment is pending. */
892 _x( '%1$s on %2$s %3$s', 'dashboard' ),
893 "<strong>$type</strong>",
894 $comment_post_link,
895 '<span class="approve">' . __( '[Pending]' ) . '</span>'
896 );
897 } else {
898 printf(
899 /* translators: 1: Type of comment, 2: Notification if the comment is pending. */
900 _x( '%1$s %2$s', 'dashboard' ),
901 "<strong>$type</strong>",
902 '<span class="approve">' . __( '[Pending]' ) . '</span>'
903 );
904 }
905 ?>
906 </p>
907 <p class="comment-author"><?php comment_author_link( $comment ); ?></p>
908
909 <?php endif; // comment_type ?>
910 <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote>
911 <?php if ( $actions_string ) : ?>
912 <p class="row-actions"><?php echo $actions_string; ?></p>
913 <?php endif; ?>
914 </div>
915 </li>
916 <?php
917 $GLOBALS['comment'] = null;
918}
919
920/**
921 * Outputs the Activity widget.
922 *
923 * Callback function for {@see 'dashboard_activity'}.
924 *
925 * @since 3.8.0
926 */
927function wp_dashboard_site_activity() {
928
929 echo '<div id="activity-widget">';
930
931 $future_posts = wp_dashboard_recent_posts(
932 array(
933 'max' => 5,
934 'status' => 'future',
935 'order' => 'ASC',
936 'title' => __( 'Publishing Soon' ),
937 'id' => 'future-posts',
938 )
939 );
940 $recent_posts = wp_dashboard_recent_posts(
941 array(
942 'max' => 5,
943 'status' => 'publish',
944 'order' => 'DESC',
945 'title' => __( 'Recently Published' ),
946 'id' => 'published-posts',
947 )
948 );
949
950 $recent_comments = wp_dashboard_recent_comments();
951
952 if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) {
953 echo '<div class="no-activity">';
954 echo '<p>' . __( 'No activity yet!' ) . '</p>';
955 echo '</div>';
956 }
957
958 echo '</div>';
959}
960
961/**
962 * Generates Publishing Soon and Recently Published sections.
963 *
964 * @since 3.8.0
965 *
966 * @param array $args {
967 * An array of query and display arguments.
968 *
969 * @type int $max Number of posts to display.
970 * @type string $status Post status.
971 * @type string $order Designates ascending ('ASC') or descending ('DESC') order.
972 * @type string $title Section title.
973 * @type string $id The container id.
974 * }
975 * @return bool False if no posts were found. True otherwise.
976 */
977function wp_dashboard_recent_posts( $args ) {
978 $query_args = array(
979 'post_type' => 'post',
980 'post_status' => $args['status'],
981 'orderby' => 'date',
982 'order' => $args['order'],
983 'posts_per_page' => (int) $args['max'],
984 'no_found_rows' => true,
985 'cache_results' => true,
986 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
987 );
988
989 /**
990 * Filters the query arguments used for the Recent Posts widget.
991 *
992 * @since 4.2.0
993 *
994 * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
995 */
996 $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args );
997
998 $posts = new WP_Query( $query_args );
999
1000 if ( $posts->have_posts() ) {
1001
1002 echo '<div id="' . $args['id'] . '" class="activity-block">';
1003
1004 echo '<h3>' . $args['title'] . '</h3>';
1005
1006 echo '<ul>';
1007
1008 $today = current_time( 'Y-m-d' );
1009 $tomorrow = current_datetime()->modify( '+1 day' )->format( 'Y-m-d' );
1010 $year = current_time( 'Y' );
1011
1012 while ( $posts->have_posts() ) {
1013 $posts->the_post();
1014
1015 $time = get_the_time( 'U' );
1016
1017 if ( gmdate( 'Y-m-d', $time ) === $today ) {
1018 $relative = __( 'Today' );
1019 } elseif ( gmdate( 'Y-m-d', $time ) === $tomorrow ) {
1020 $relative = __( 'Tomorrow' );
1021 } elseif ( gmdate( 'Y', $time ) !== $year ) {
1022 /* translators: Date and time format for recent posts on the dashboard, from a different calendar year, see https://www.php.net/manual/datetime.format.php */
1023 $relative = date_i18n( __( 'M jS Y' ), $time );
1024 } else {
1025 /* translators: Date and time format for recent posts on the dashboard, see https://www.php.net/manual/datetime.format.php */
1026 $relative = date_i18n( __( 'M jS' ), $time );
1027 }
1028
1029 // Use the post edit link for those who can edit, the permalink otherwise.
1030 $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
1031
1032 $draft_or_post_title = _draft_or_post_title();
1033 printf(
1034 '<li><span>%1$s</span> <a href="%2$s" aria-label="%3$s">%4$s</a></li>',
1035 /* translators: 1: Relative date, 2: Time. */
1036 sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ),
1037 $recent_post_link,
1038 /* translators: %s: Post title. */
1039 esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $draft_or_post_title ) ),
1040 $draft_or_post_title
1041 );
1042 }
1043
1044 echo '</ul>';
1045 echo '</div>';
1046
1047 } else {
1048 return false;
1049 }
1050
1051 wp_reset_postdata();
1052
1053 return true;
1054}
1055
1056/**
1057 * Show Comments section.
1058 *
1059 * @since 3.8.0
1060 *
1061 * @param int $total_items Optional. Number of comments to query. Default 5.
1062 * @return bool False if no comments were found. True otherwise.
1063 */
1064function wp_dashboard_recent_comments( $total_items = 5 ) {
1065 // Select all comment types and filter out spam later for better query performance.
1066 $comments = array();
1067
1068 $comments_query = array(
1069 'number' => $total_items * 5,
1070 'offset' => 0,
1071 );
1072
1073 if ( ! current_user_can( 'edit_posts' ) ) {
1074 $comments_query['status'] = 'approve';
1075 }
1076
1077 $comments_count = 0;
1078 do {
1079 $possible = get_comments( $comments_query );
1080
1081 if ( empty( $possible ) || ! is_array( $possible ) ) {
1082 break;
1083 }
1084
1085 foreach ( $possible as $comment ) {
1086 if ( ! current_user_can( 'edit_post', $comment->comment_post_ID )
1087 && ( post_password_required( $comment->comment_post_ID )
1088 || ! current_user_can( 'read_post', $comment->comment_post_ID ) )
1089 ) {
1090 // The user has no access to the post and thus cannot see the comments.
1091 continue;
1092 }
1093
1094 $comments[] = $comment;
1095 $comments_count = count( $comments );
1096
1097 if ( $comments_count === $total_items ) {
1098 break 2;
1099 }
1100 }
1101
1102 $comments_query['offset'] += $comments_query['number'];
1103 $comments_query['number'] = $total_items * 10;
1104 } while ( $comments_count < $total_items );
1105
1106 if ( $comments ) {
1107 echo '<div id="latest-comments" class="activity-block table-view-list">';
1108 echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
1109
1110 echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
1111 foreach ( $comments as $comment ) {
1112 _wp_dashboard_recent_comments_row( $comment );
1113 }
1114 echo '</ul>';
1115
1116 if ( current_user_can( 'edit_posts' ) ) {
1117 echo '<h3 class="screen-reader-text">' .
1118 /* translators: Hidden accessibility text. */
1119 __( 'View more comments' ) .
1120 '</h3>';
1121 _get_list_table( 'WP_Comments_List_Table' )->views();
1122 }
1123
1124 wp_comment_reply( -1, false, 'dashboard', false );
1125 wp_comment_trashnotice();
1126
1127 echo '</div>';
1128 } else {
1129 return false;
1130 }
1131 return true;
1132}
1133
1134/**
1135 * Display generic dashboard RSS widget feed.
1136 *
1137 * @since 2.5.0
1138 *
1139 * @param string $widget_id
1140 */
1141function wp_dashboard_rss_output( $widget_id ) {
1142 $widgets = get_option( 'dashboard_widget_options' );
1143 echo '<div class="rss-widget">';
1144 wp_widget_rss_output( $widgets[ $widget_id ] );
1145 echo '</div>';
1146}
1147
1148/**
1149 * Checks to see if all of the feed url in $check_urls are cached.
1150 *
1151 * If $check_urls is empty, look for the rss feed url found in the dashboard
1152 * widget options of $widget_id. If cached, call $callback, a function that
1153 * echoes out output for this widget. If not cache, echo a "Loading..." stub
1154 * which is later replaced by Ajax call (see top of /wp-admin/index.php)
1155 *
1156 * @since 2.5.0
1157 * @since 5.3.0 Formalized the existing and already documented `...$args` parameter
1158 * by adding it to the function signature.
1159 *
1160 * @param string $widget_id The widget ID.
1161 * @param callable $callback The callback function used to display each feed.
1162 * @param array $check_urls RSS feeds.
1163 * @param mixed ...$args Optional additional parameters to pass to the callback function.
1164 * @return bool True on success, false on failure.
1165 */
1166function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
1167 $doing_ajax = wp_doing_ajax();
1168 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p>';
1169 $loading .= wp_get_admin_notice(
1170 __( 'This widget requires JavaScript.' ),
1171 array(
1172 'type' => 'error',
1173 'additional_classes' => array( 'inline', 'hide-if-js' ),
1174 )
1175 );
1176
1177 if ( empty( $check_urls ) ) {
1178 $widgets = get_option( 'dashboard_widget_options' );
1179
1180 if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) {
1181 echo $loading;
1182 return false;
1183 }
1184
1185 $check_urls = array( $widgets[ $widget_id ]['url'] );
1186 }
1187
1188 $locale = get_user_locale();
1189 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
1190 $output = get_transient( $cache_key );
1191
1192 if ( false !== $output ) {
1193 echo $output;
1194 return true;
1195 }
1196
1197 if ( ! $doing_ajax ) {
1198 echo $loading;
1199 return false;
1200 }
1201
1202 if ( $callback && is_callable( $callback ) ) {
1203 array_unshift( $args, $widget_id, $check_urls );
1204 ob_start();
1205 call_user_func_array( $callback, $args );
1206 // Default lifetime in cache of 12 hours (same as the feeds).
1207 set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
1208 }
1209
1210 return true;
1211}
1212
1213//
1214// Dashboard Widgets Controls.
1215//
1216
1217/**
1218 * Calls widget control callback.
1219 *
1220 * @since 2.5.0
1221 *
1222 * @global callable[] $wp_dashboard_control_callbacks
1223 *
1224 * @param int|false $widget_control_id Optional. Registered widget ID. Default false.
1225 */
1226function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
1227 global $wp_dashboard_control_callbacks;
1228
1229 if ( is_scalar( $widget_control_id ) && $widget_control_id
1230 && isset( $wp_dashboard_control_callbacks[ $widget_control_id ] )
1231 && is_callable( $wp_dashboard_control_callbacks[ $widget_control_id ] )
1232 ) {
1233 call_user_func(
1234 $wp_dashboard_control_callbacks[ $widget_control_id ],
1235 '',
1236 array(
1237 'id' => $widget_control_id,
1238 'callback' => $wp_dashboard_control_callbacks[ $widget_control_id ],
1239 )
1240 );
1241 }
1242}
1243
1244/**
1245 * Sets up the RSS dashboard widget control and $args to be used as input to wp_widget_rss_form().
1246 *
1247 * Handles POST data from RSS-type widgets.
1248 *
1249 * @since 2.5.0
1250 *
1251 * @param string $widget_id
1252 * @param array $form_inputs
1253 */
1254function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
1255 $widget_options = get_option( 'dashboard_widget_options' );
1256
1257 if ( ! $widget_options ) {
1258 $widget_options = array();
1259 }
1260
1261 if ( ! isset( $widget_options[ $widget_id ] ) ) {
1262 $widget_options[ $widget_id ] = array();
1263 }
1264
1265 $number = 1; // Hack to use wp_widget_rss_form().
1266
1267 $widget_options[ $widget_id ]['number'] = $number;
1268
1269 if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
1270 $_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] );
1271 $widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );
1272 $widget_options[ $widget_id ]['number'] = $number;
1273
1274 // Title is optional. If black, fill it if possible.
1275 if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) {
1276 $rss = fetch_feed( $widget_options[ $widget_id ]['url'] );
1277 if ( is_wp_error( $rss ) ) {
1278 $widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) );
1279 } else {
1280 $widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) );
1281 $rss->__destruct();
1282 unset( $rss );
1283 }
1284 }
1285
1286 update_option( 'dashboard_widget_options', $widget_options, false );
1287
1288 $locale = get_user_locale();
1289 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
1290 delete_transient( $cache_key );
1291 }
1292
1293 wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs );
1294}
1295
1296
1297/**
1298 * Renders the Events and News dashboard widget.
1299 *
1300 * @since 4.8.0
1301 */
1302function wp_dashboard_events_news() {
1303 wp_print_community_events_markup();
1304
1305 ?>
1306
1307 <div class="wordpress-news hide-if-no-js">
1308 <?php wp_dashboard_primary(); ?>
1309 </div>
1310
1311 <p class="community-events-footer">
1312 <?php
1313 printf(
1314 '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1315 'https://make.wordpress.org/community/meetups-landing-page',
1316 __( 'Meetups' ),
1317 /* translators: Hidden accessibility text. */
1318 __( '(opens in a new tab)' )
1319 );
1320 ?>
1321
1322 |
1323
1324 <?php
1325 printf(
1326 '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1327 'https://central.wordcamp.org/schedule/',
1328 __( 'WordCamps' ),
1329 /* translators: Hidden accessibility text. */
1330 __( '(opens in a new tab)' )
1331 );
1332 ?>
1333
1334 |
1335
1336 <?php
1337 printf(
1338 '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1339 /* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
1340 esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ),
1341 __( 'News' ),
1342 /* translators: Hidden accessibility text. */
1343 __( '(opens in a new tab)' )
1344 );
1345 ?>
1346 </p>
1347
1348 <?php
1349}
1350
1351/**
1352 * Prints the markup for the Community Events section of the Events and News Dashboard widget.
1353 *
1354 * @since 4.8.0
1355 */
1356function wp_print_community_events_markup() {
1357 $community_events_notice = '<p class="hide-if-js">' . ( 'This widget requires JavaScript.' ) . '</p>';
1358 $community_events_notice .= '<p class="community-events-error-occurred" aria-hidden="true">' . __( 'An error occurred. Please try again.' ) . '</p>';
1359 $community_events_notice .= '<p class="community-events-could-not-locate" aria-hidden="true"></p>';
1360
1361 wp_admin_notice(
1362 $community_events_notice,
1363 array(
1364 'type' => 'error',
1365 'additional_classes' => array( 'community-events-errors', 'inline', 'hide-if-js' ),
1366 'paragraph_wrap' => false,
1367 )
1368 );
1369
1370 /*
1371 * Hide the main element when the page first loads, because the content
1372 * won't be ready until wp.communityEvents.renderEventsTemplate() has run.
1373 */
1374 ?>
1375 <div id="community-events" class="community-events" aria-hidden="true">
1376 <div class="activity-block">
1377 <p>
1378 <span id="community-events-location-message"></span>
1379
1380 <button class="button-link community-events-toggle-location" aria-expanded="false">
1381 <span class="dashicons dashicons-location" aria-hidden="true"></span>
1382 <span class="community-events-location-edit"><?php _e( 'Select location' ); ?></span>
1383 </button>
1384 </p>
1385
1386 <form class="community-events-form" aria-hidden="true" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
1387 <label for="community-events-location">
1388 <?php _e( 'City:' ); ?>
1389 </label>
1390 <?php
1391 /* translators: Replace with a city related to your locale.
1392 * Test that it matches the expected location and has upcoming
1393 * events before including it. If no cities related to your
1394 * locale have events, then use a city related to your locale
1395 * that would be recognizable to most users. Use only the city
1396 * name itself, without any region or country. Use the endonym
1397 * (native locale name) instead of the English name if possible.
1398 */
1399 ?>
1400 <input id="community-events-location" class="regular-text" type="text" name="community-events-location" placeholder="<?php esc_attr_e( 'Cincinnati' ); ?>" />
1401
1402 <?php submit_button( __( 'Submit' ), 'secondary', 'community-events-submit', false ); ?>
1403
1404 <button class="community-events-cancel button-link" type="button" aria-expanded="false">
1405 <?php _e( 'Cancel' ); ?>
1406 </button>
1407
1408 <span class="spinner"></span>
1409 </form>
1410 </div>
1411
1412 <ul class="community-events-results activity-block last"></ul>
1413 </div>
1414
1415 <?php
1416}
1417
1418/**
1419 * Renders the events templates for the Event and News widget.
1420 *
1421 * @since 4.8.0
1422 */
1423function wp_print_community_events_templates() {
1424 ?>
1425
1426 <script id="tmpl-community-events-attend-event-near" type="text/template">
1427 <?php
1428 printf(
1429 /* translators: %s: The name of a city. */
1430 __( 'Attend an upcoming event near %s.' ),
1431 '<strong>{{ data.location.description }}</strong>'
1432 );
1433 ?>
1434 </script>
1435
1436 <script id="tmpl-community-events-could-not-locate" type="text/template">
1437 <?php
1438 printf(
1439 /* translators: %s is the name of the city we couldn't locate.
1440 * Replace the examples with cities in your locale, but test
1441 * that they match the expected location before including them.
1442 * Use endonyms (native locale names) whenever possible.
1443 */
1444 __( '%s could not be located. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
1445 '<em>{{data.unknownCity}}</em>'
1446 );
1447 ?>
1448 </script>
1449
1450 <script id="tmpl-community-events-event-list" type="text/template">
1451 <# _.each( data.events, function( event ) { #>
1452 <li class="event event-{{ event.type }} wp-clearfix">
1453 <div class="event-info">
1454 <div class="dashicons event-icon" aria-hidden="true"></div>
1455 <div class="event-info-inner">
1456 <a class="event-title" href="{{ event.url }}">{{ event.title }}</a>
1457 <# if ( event.type ) {
1458 const titleCaseEventType = event.type.replace(
1459 /\w\S*/g,
1460 function ( type ) { return type.charAt(0).toUpperCase() + type.substr(1).toLowerCase(); }
1461 );
1462 #>
1463 {{ 'wordcamp' === event.type ? 'WordCamp' : titleCaseEventType }}
1464 <span class="ce-separator" aria-hidden="true"></span>
1465 <# } #>
1466 <span class="event-city">{{ event.location.location }}</span>
1467 </div>
1468 </div>
1469
1470 <div class="event-date-time">
1471 <span class="event-date">{{ event.user_formatted_date }}</span>
1472 <# if ( 'meetup' === event.type ) { #>
1473 <span class="event-time">
1474 {{ event.user_formatted_time }} {{ event.timeZoneAbbreviation }}
1475 </span>
1476 <# } #>
1477 </div>
1478 </li>
1479 <# } ) #>
1480
1481 <# if ( data.events.length <= 2 ) { #>
1482 <li class="event-none">
1483 <?php
1484 printf(
1485 /* translators: %s: Localized meetup organization documentation URL. */
1486 __( 'Want more events? <a href="%s">Help organize the next one</a>!' ),
1487 __( 'https://make.wordpress.org/community/organize-event-landing-page/' )
1488 );
1489 ?>
1490 </li>
1491 <# } #>
1492
1493 </script>
1494
1495 <script id="tmpl-community-events-no-upcoming-events" type="text/template">
1496 <li class="event-none">
1497 <# if ( data.location.description ) { #>
1498 <?php
1499 printf(
1500 /* translators: 1: The city the user searched for, 2: Meetup organization documentation URL. */
1501 __( 'There are no events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize a WordPress event</a>?' ),
1502 '{{ data.location.description }}',
1503 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
1504 );
1505 ?>
1506
1507 <# } else { #>
1508 <?php
1509 printf(
1510 /* translators: %s: Meetup organization documentation URL. */
1511 __( 'There are no events scheduled near you at the moment. Would you like to <a href="%s">organize a WordPress event</a>?' ),
1512 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
1513 );
1514 ?>
1515 <# } #>
1516 </li>
1517 </script>
1518 <?php
1519}
1520
1521/**
1522 * 'WordPress Events and News' dashboard widget.
1523 *
1524 * @since 2.7.0
1525 * @since 4.8.0 Removed popular plugins feed.
1526 */
1527function wp_dashboard_primary() {
1528 $feeds = array(
1529 'news' => array(
1530
1531 /**
1532 * Filters the primary link URL for the 'WordPress Events and News' dashboard widget.
1533 *
1534 * @since 2.5.0
1535 *
1536 * @param string $link The widget's primary link URL.
1537 */
1538 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ),
1539
1540 /**
1541 * Filters the primary feed URL for the 'WordPress Events and News' dashboard widget.
1542 *
1543 * @since 2.3.0
1544 *
1545 * @param string $url The widget's primary feed URL.
1546 */
1547 'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ),
1548
1549 /**
1550 * Filters the primary link title for the 'WordPress Events and News' dashboard widget.
1551 *
1552 * @since 2.3.0
1553 *
1554 * @param string $title Title attribute for the widget's primary link.
1555 */
1556 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
1557 'items' => 2,
1558 'show_summary' => 0,
1559 'show_author' => 0,
1560 'show_date' => 0,
1561 ),
1562 'planet' => array(
1563
1564 /**
1565 * Filters the secondary link URL for the 'WordPress Events and News' dashboard widget.
1566 *
1567 * @since 2.3.0
1568 *
1569 * @param string $link The widget's secondary link URL.
1570 */
1571 'link' => apply_filters(
1572 'dashboard_secondary_link',
1573 /* translators: Link to the Planet website of the locale. */
1574 __( 'https://planet.wordpress.org/' )
1575 ),
1576
1577 /**
1578 * Filters the secondary feed URL for the 'WordPress Events and News' dashboard widget.
1579 *
1580 * @since 2.3.0
1581 *
1582 * @param string $url The widget's secondary feed URL.
1583 */
1584 'url' => apply_filters(
1585 'dashboard_secondary_feed',
1586 /* translators: Link to the Planet feed of the locale. */
1587 __( 'https://planet.wordpress.org/feed/' )
1588 ),
1589
1590 /**
1591 * Filters the secondary link title for the 'WordPress Events and News' dashboard widget.
1592 *
1593 * @since 2.3.0
1594 *
1595 * @param string $title Title attribute for the widget's secondary link.
1596 */
1597 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
1598
1599 /**
1600 * Filters the number of secondary link items for the 'WordPress Events and News' dashboard widget.
1601 *
1602 * @since 4.4.0
1603 *
1604 * @param string $items How many items to show in the secondary feed.
1605 */
1606 'items' => apply_filters( 'dashboard_secondary_items', 3 ),
1607 'show_summary' => 0,
1608 'show_author' => 0,
1609 'show_date' => 0,
1610 ),
1611 );
1612
1613 wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
1614}
1615
1616/**
1617 * Displays the WordPress events and news feeds.
1618 *
1619 * @since 3.8.0
1620 * @since 4.8.0 Removed popular plugins feed.
1621 *
1622 * @param string $widget_id Widget ID.
1623 * @param array $feeds Array of RSS feeds.
1624 */
1625function wp_dashboard_primary_output( $widget_id, $feeds ) {
1626 foreach ( $feeds as $type => $args ) {
1627 $args['type'] = $type;
1628 echo '<div class="rss-widget">';
1629 wp_widget_rss_output( $args['url'], $args );
1630 echo '</div>';
1631 }
1632}
1633
1634/**
1635 * Displays file upload quota on dashboard.
1636 *
1637 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
1638 *
1639 * @since 3.0.0
1640 *
1641 * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
1642 */
1643function wp_dashboard_quota() {
1644 if ( ! is_multisite() || ! current_user_can( 'upload_files' )
1645 || get_site_option( 'upload_space_check_disabled' )
1646 ) {
1647 return true;
1648 }
1649
1650 $quota = get_space_allowed();
1651 $used = get_space_used();
1652
1653 if ( $used > $quota ) {
1654 $percentused = '100';
1655 } else {
1656 $percentused = ( $used / $quota ) * 100;
1657 }
1658
1659 $used_class = ( $percentused >= 70 ) ? ' warning' : '';
1660 $used = round( $used, 2 );
1661 $percentused = number_format( $percentused );
1662
1663 ?>
1664 <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3>
1665 <div class="mu-storage">
1666 <ul>
1667 <li class="storage-count">
1668 <?php
1669 $text = sprintf(
1670 /* translators: %s: Number of megabytes. */
1671 __( '%s MB Space Allowed' ),
1672 number_format_i18n( $quota )
1673 );
1674 printf(
1675 '<a href="%1$s">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
1676 esc_url( admin_url( 'upload.php' ) ),
1677 $text,
1678 /* translators: Hidden accessibility text. */
1679 __( 'Manage Uploads' )
1680 );
1681 ?>
1682 </li><li class="storage-count <?php echo $used_class; ?>">
1683 <?php
1684 $text = sprintf(
1685 /* translators: 1: Number of megabytes, 2: Percentage. */
1686 __( '%1$s MB (%2$s%%) Space Used' ),
1687 number_format_i18n( $used, 2 ),
1688 $percentused
1689 );
1690 printf(
1691 '<a href="%1$s" class="musublink">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
1692 esc_url( admin_url( 'upload.php' ) ),
1693 $text,
1694 /* translators: Hidden accessibility text. */
1695 __( 'Manage Uploads' )
1696 );
1697 ?>
1698 </li>
1699 </ul>
1700 </div>
1701 <?php
1702}
1703
1704/**
1705 * Displays the browser update nag.
1706 *
1707 * @since 3.2.0
1708 * @since 5.8.0 Added a special message for Internet Explorer users.
1709 *
1710 * @global bool $is_IE
1711 */
1712function wp_dashboard_browser_nag() {
1713 global $is_IE;
1714
1715 $notice = '';
1716 $response = wp_check_browser_version();
1717
1718 if ( $response ) {
1719 if ( $is_IE ) {
1720 $msg = __( 'Internet Explorer does not give you the best WordPress experience. Switch to Microsoft Edge, or another more modern browser to get the most from your site.' );
1721 } elseif ( $response['insecure'] ) {
1722 $msg = sprintf(
1723 /* translators: %s: Browser name and link. */
1724 __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ),
1725 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1726 );
1727 } else {
1728 $msg = sprintf(
1729 /* translators: %s: Browser name and link. */
1730 __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ),
1731 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1732 );
1733 }
1734
1735 $browser_nag_class = '';
1736 if ( ! empty( $response['img_src'] ) ) {
1737 $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src'];
1738
1739 $notice .= '<div class="alignright browser-icon"><img src="' . esc_url( $img_src ) . '" alt="" /></div>';
1740 $browser_nag_class = ' has-browser-icon';
1741 }
1742 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
1743
1744 $browsehappy = 'https://browsehappy.com/';
1745 $locale = get_user_locale();
1746 if ( 'en_US' !== $locale ) {
1747 $browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1748 }
1749
1750 if ( $is_IE ) {
1751 $msg_browsehappy = sprintf(
1752 /* translators: %s: Browse Happy URL. */
1753 __( 'Learn how to <a href="%s" class="update-browser-link">browse happy</a>' ),
1754 esc_url( $browsehappy )
1755 );
1756 } else {
1757 $msg_browsehappy = sprintf(
1758 /* translators: 1: Browser update URL, 2: Browser name, 3: Browse Happy URL. */
1759 __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ),
1760 esc_attr( $response['update_url'] ),
1761 esc_html( $response['name'] ),
1762 esc_url( $browsehappy )
1763 );
1764 }
1765
1766 $notice .= '<p>' . $msg_browsehappy . '</p>';
1767 $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
1768 $notice .= '<div class="clear"></div>';
1769 }
1770
1771 /**
1772 * Filters the notice output for the 'Browse Happy' nag meta box.
1773 *
1774 * @since 3.2.0
1775 *
1776 * @param string $notice The notice content.
1777 * @param array|false $response An array containing web browser information, or
1778 * false on failure. See wp_check_browser_version().
1779 */
1780 echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1781}
1782
1783/**
1784 * Adds an additional class to the browser nag if the current version is insecure.
1785 *
1786 * @since 3.2.0
1787 *
1788 * @param string[] $classes Array of meta box classes.
1789 * @return string[] Modified array of meta box classes.
1790 */
1791function dashboard_browser_nag_class( $classes ) {
1792 $response = wp_check_browser_version();
1793
1794 if ( $response && $response['insecure'] ) {
1795 $classes[] = 'browser-insecure';
1796 }
1797
1798 return $classes;
1799}
1800
1801/**
1802 * Checks if the user needs a browser update.
1803 *
1804 * @since 3.2.0
1805 *
1806 * @return array|false Array of browser data on success, false on failure.
1807 */
1808function wp_check_browser_version() {
1809 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1810 return false;
1811 }
1812
1813 $key = md5( $_SERVER['HTTP_USER_AGENT'] );
1814
1815 $response = get_site_transient( 'browser_' . $key );
1816
1817 if ( false === $response ) {
1818 $url = 'http://api.wordpress.org/core/browse-happy/1.1/';
1819 $options = array(
1820 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
1821 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
1822 );
1823
1824 if ( wp_http_supports( array( 'ssl' ) ) ) {
1825 $url = set_url_scheme( $url, 'https' );
1826 }
1827
1828 $response = wp_remote_post( $url, $options );
1829
1830 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
1831 return false;
1832 }
1833
1834 /**
1835 * Response should be an array with:
1836 * 'platform' - string - A user-friendly platform name, if it can be determined
1837 * 'name' - string - A user-friendly browser name
1838 * 'version' - string - The version of the browser the user is using
1839 * 'current_version' - string - The most recent version of the browser
1840 * 'upgrade' - boolean - Whether the browser needs an upgrade
1841 * 'insecure' - boolean - Whether the browser is deemed insecure
1842 * 'update_url' - string - The url to visit to upgrade
1843 * 'img_src' - string - An image representing the browser
1844 * 'img_src_ssl' - string - An image (over SSL) representing the browser
1845 */
1846 $response = json_decode( wp_remote_retrieve_body( $response ), true );
1847
1848 if ( ! is_array( $response ) ) {
1849 return false;
1850 }
1851
1852 set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
1853 }
1854
1855 return $response;
1856}
1857
1858/**
1859 * Displays the PHP update nag.
1860 *
1861 * @since 5.1.0
1862 */
1863function wp_dashboard_php_nag() {
1864 $response = wp_check_php_version();
1865
1866 if ( ! $response ) {
1867 return;
1868 }
1869
1870 if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
1871 // The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates.
1872
1873 if ( $response['is_lower_than_future_minimum'] ) {
1874 $message = sprintf(
1875 /* translators: %s: The server PHP version. */
1876 __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
1877 PHP_VERSION
1878 );
1879 } else {
1880 $message = sprintf(
1881 /* translators: %s: The server PHP version. */
1882 __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
1883 PHP_VERSION
1884 );
1885 }
1886 } elseif ( $response['is_lower_than_future_minimum'] ) {
1887 $message = sprintf(
1888 /* translators: %s: The server PHP version. */
1889 __( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
1890 PHP_VERSION
1891 );
1892 } else {
1893 $message = sprintf(
1894 /* translators: %s: The server PHP version. */
1895 __( 'Your site is running on an outdated version of PHP (%s), which should be updated.' ),
1896 PHP_VERSION
1897 );
1898 }
1899 ?>
1900 <p class="bigger-bolder-text"><?php echo $message; ?></p>
1901
1902 <p><?php _e( 'What is PHP and how does it affect my site?' ); ?></p>
1903 <p>
1904 <?php _e( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance.' ); ?>
1905 <?php
1906 if ( ! empty( $response['recommended_version'] ) ) {
1907 printf(
1908 /* translators: %s: The minimum recommended PHP version. */
1909 __( 'The minimum recommended version of PHP is %s.' ),
1910 $response['recommended_version']
1911 );
1912 }
1913 ?>
1914 </p>
1915
1916 <p class="button-container">
1917 <?php
1918 printf(
1919 '<a class="button button-primary" href="%1$s" target="_blank">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
1920 esc_url( wp_get_update_php_url() ),
1921 __( 'Learn more about updating PHP' ),
1922 /* translators: Hidden accessibility text. */
1923 __( '(opens in a new tab)' )
1924 );
1925 ?>
1926 </p>
1927 <?php
1928
1929 wp_update_php_annotation();
1930 wp_direct_php_update_button();
1931}
1932
1933/**
1934 * Adds an additional class to the PHP nag if the current version is insecure.
1935 *
1936 * @since 5.1.0
1937 *
1938 * @param string[] $classes Array of meta box classes.
1939 * @return string[] Modified array of meta box classes.
1940 */
1941function dashboard_php_nag_class( $classes ) {
1942 $response = wp_check_php_version();
1943
1944 if ( ! $response ) {
1945 return $classes;
1946 }
1947
1948 if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
1949 $classes[] = 'php-no-security-updates';
1950 } elseif ( $response['is_lower_than_future_minimum'] ) {
1951 $classes[] = 'php-version-lower-than-future-minimum';
1952 }
1953
1954 return $classes;
1955}
1956
1957/**
1958 * Displays the Site Health Status widget.
1959 *
1960 * @since 5.4.0
1961 */
1962function wp_dashboard_site_health() {
1963 $get_issues = get_transient( 'health-check-site-status-result' );
1964
1965 $issue_counts = array();
1966
1967 if ( false !== $get_issues ) {
1968 $issue_counts = json_decode( $get_issues, true );
1969 }
1970
1971 if ( ! is_array( $issue_counts ) || ! $issue_counts ) {
1972 $issue_counts = array(
1973 'good' => 0,
1974 'recommended' => 0,
1975 'critical' => 0,
1976 );
1977 }
1978
1979 $issues_total = $issue_counts['recommended'] + $issue_counts['critical'];
1980 ?>
1981 <div class="health-check-widget">
1982 <div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
1983 <div class="site-health-progress">
1984 <svg aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
1985 <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
1986 <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
1987 </svg>
1988 </div>
1989 <div class="site-health-progress-label">
1990 <?php if ( false === $get_issues ) : ?>
1991 <?php _e( 'No information yet&hellip;' ); ?>
1992 <?php else : ?>
1993 <?php _e( 'Results are still loading&hellip;' ); ?>
1994 <?php endif; ?>
1995 </div>
1996 </div>
1997
1998 <div class="site-health-details">
1999 <?php if ( false === $get_issues ) : ?>
2000 <p>
2001 <?php
2002 printf(
2003 /* translators: %s: URL to Site Health screen. */
2004 __( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
2005 esc_url( admin_url( 'site-health.php' ) )
2006 );
2007 ?>
2008 </p>
2009 <?php else : ?>
2010 <p>
2011 <?php if ( $issues_total <= 0 ) : ?>
2012 <?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
2013 <?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
2014 <?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
2015 <?php elseif ( $issue_counts['critical'] > 1 ) : ?>
2016 <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
2017 <?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
2018 <?php _e( 'Your site&#8217;s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
2019 <?php else : ?>
2020 <?php _e( 'Your site&#8217;s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
2021 <?php endif; ?>
2022 </p>
2023 <?php endif; ?>
2024
2025 <?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
2026 <p>
2027 <?php
2028 printf(
2029 /* translators: 1: Number of issues. 2: URL to Site Health screen. */
2030 _n(
2031 'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
2032 'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
2033 $issues_total
2034 ),
2035 $issues_total,
2036 esc_url( admin_url( 'site-health.php' ) )
2037 );
2038 ?>
2039 </p>
2040 <?php endif; ?>
2041 </div>
2042 </div>
2043
2044 <?php
2045}
2046
2047/**
2048 * Outputs empty dashboard widget to be populated by JS later.
2049 *
2050 * Usable by plugins.
2051 *
2052 * @since 2.5.0
2053 */
2054function wp_dashboard_empty() {}
2055
2056/**
2057 * Displays a welcome panel to introduce users to WordPress.
2058 *
2059 * @since 3.3.0
2060 * @since 5.9.0 Send users to the Site Editor if the active theme is block-based.
2061 */
2062function wp_welcome_panel() {
2063 list( $display_version ) = explode( '-', wp_get_wp_version() );
2064 $can_customize = current_user_can( 'customize' );
2065 $is_block_theme = wp_is_block_theme();
2066 ?>
2067 <div class="welcome-panel-content">
2068 <div class="welcome-panel-header">
2069 <div class="welcome-panel-header-image">
2070 <?php echo file_get_contents( dirname( __DIR__ ) . '/images/dashboard-background.svg' ); ?>
2071 </div>
2072 <h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
2073 <p>
2074 <a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">
2075 <?php
2076 /* translators: %s: Current WordPress version. */
2077 printf( __( 'Learn more about the %s version.' ), esc_html( $display_version ) );
2078 ?>
2079 </a>
2080 </p>
2081 </div>
2082 <div class="welcome-panel-column-container">
2083 <div class="welcome-panel-column">
2084 <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
2085 <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
2086 <path fill-rule="evenodd" clip-rule="evenodd" d="M32.0668 17.0854L28.8221 13.9454L18.2008 24.671L16.8983 29.0827L21.4257 27.8309L32.0668 17.0854ZM16 32.75H24V31.25H16V32.75Z" fill="white"/>
2087 </svg>
2088 <div class="welcome-panel-column-content">
2089 <h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>
2090 <p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>
2091 <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>"><?php _e( 'Add a new page' ); ?></a>
2092 </div>
2093 </div>
2094 <div class="welcome-panel-column">
2095 <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
2096 <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
2097 <path fill-rule="evenodd" clip-rule="evenodd" d="M18 16h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H18a2 2 0 0 1-2-2V18a2 2 0 0 1 2-2zm12 1.5H18a.5.5 0 0 0-.5.5v3h13v-3a.5.5 0 0 0-.5-.5zm.5 5H22v8h8a.5.5 0 0 0 .5-.5v-7.5zm-10 0h-3V30a.5.5 0 0 0 .5.5h2.5v-8z" fill="#fff"/>
2098 </svg>
2099 <div class="welcome-panel-column-content">
2100 <?php if ( $is_block_theme ) : ?>
2101 <h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>
2102 <p><?php _e( 'Design everything on your site &#8212; from the header down to the footer, all using blocks and patterns.' ); ?></p>
2103 <a href="<?php echo esc_url( admin_url( 'site-editor.php' ) ); ?>"><?php _e( 'Open site editor' ); ?></a>
2104 <?php else : ?>
2105 <h3><?php _e( 'Start Customizing' ); ?></h3>
2106 <p><?php _e( 'Configure your site&#8217;s logo, header, menus, and more in the Customizer.' ); ?></p>
2107 <?php if ( $can_customize ) : ?>
2108 <a class="load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Open the Customizer' ); ?></a>
2109 <?php endif; ?>
2110 <?php endif; ?>
2111 </div>
2112 </div>
2113 <div class="welcome-panel-column">
2114 <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
2115 <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
2116 <path fill-rule="evenodd" clip-rule="evenodd" d="M31 24a7 7 0 0 1-7 7V17a7 7 0 0 1 7 7zm-7-8a8 8 0 1 1 0 16 8 8 0 0 1 0-16z" fill="#fff"/>
2117 </svg>
2118 <div class="welcome-panel-column-content">
2119 <?php if ( $is_block_theme ) : ?>
2120 <h3><?php _e( 'Switch up your site&#8217;s look & feel with Styles' ); ?></h3>
2121 <p><?php _e( 'Tweak your site, or give it a whole new look! Get creative &#8212; how about a new color palette or font?' ); ?></p>
2122 <a href="<?php echo esc_url( admin_url( '/site-editor.php?path=%2Fwp_global_styles' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
2123 <?php else : ?>
2124 <h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>
2125 <p><?php _e( 'There is a new kind of WordPress theme, called a block theme, that lets you build the site you&#8217;ve always wanted &#8212; with blocks and styles.' ); ?></p>
2126 <a href="<?php echo esc_url( __( 'https://wordpress.org/documentation/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
2127 <?php endif; ?>
2128 </div>
2129 </div>
2130 </div>
2131 </div>
2132 <?php
2133}
2134
Ui Ux Design – Teachers Night Out https://cardgames4educators.com Wed, 16 Oct 2024 22:24:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://cardgames4educators.com/wp-content/uploads/2024/06/cropped-Card-4-Educators-logo-32x32.png Ui Ux Design – Teachers Night Out https://cardgames4educators.com 32 32 Masters In English How English Speaker https://cardgames4educators.com/masters-in-english-how-english-speaker/ https://cardgames4educators.com/masters-in-english-how-english-speaker/#comments Mon, 27 May 2024 08:54:45 +0000 https://themexriver.com/wp/kadu/?p=1

Erat himenaeos neque id sagittis massa. Hac suscipit pulvinar dignissim platea magnis eu. Don tellus a pharetra inceptos efficitur dui pulvinar. Feugiat facilisis penatibus pulvinar nunc dictumst donec odio platea habitasse. Lacus porta dolor purus elit ante bibendum tortor netus taciti nullam cubilia. Erat per suspendisse placerat morbi egestas pulvinar bibendum sollicitudin nec. Euismod cubilia eleifend velit himenaeos sodales lectus. Leo maximus cras ac porttitor aliquam torquent pulvinar odio volutpat parturient. Quisque risus finibus suspendisse mus purus magnis facilisi condimentum consectetur dui. Curae elit suspendisse cursus vehicula.

Turpis taciti class non vel pretium quis pulvinar tempor lobortis nunc. Libero phasellus parturient sapien volutpat malesuada ornare. Cubilia dignissim sollicitudin rhoncus lacinia maximus. Cras lorem fermentum bibendum pellentesque nisl etiam ligula enim cubilia. Vulputate pede sapien torquent montes tempus malesuada in mattis dis turpis vitae. Porta est tempor ex eget feugiat vulputate ipsum. Justo nec iaculis habitant diam arcu fermentum.

We offer comprehen sive emplo ment services such as assistance wit employer compliance.Our company is your strategic HR partner as instead of HR. john smithson

Cubilia dignissim sollicitudin rhoncus lacinia maximus. Cras lorem fermentum bibendum pellentesque nisl etiam ligula enim cubilia. Vulputate pede sapien torquent montes tempus malesuada in mattis dis turpis vitae.

Exploring Learning Landscapes in Academic

Feugiat facilisis penatibus pulvinar nunc dictumst donec odio platea habitasse. Lacus porta dolor purus elit ante bibendum tortor netus taciti nullam cubilia. Erat per suspendisse placerat morbi egestas pulvinar bibendum sollicitudin nec. Euismod cubilia eleifend velit himenaeos sodales lectus. Leo maximus cras ac porttitor aliquam torquent.

]]>
https://cardgames4educators.com/masters-in-english-how-english-speaker/feed/ 1