18 * @global array $wp_dashboard_control_callbacks |
18 * @global array $wp_dashboard_control_callbacks |
19 */ |
19 */ |
20 function wp_dashboard_setup() { |
20 function wp_dashboard_setup() { |
21 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks; |
21 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks; |
22 $wp_dashboard_control_callbacks = array(); |
22 $wp_dashboard_control_callbacks = array(); |
23 $screen = get_current_screen(); |
23 $screen = get_current_screen(); |
24 |
24 |
25 /* Register Widgets and Controls */ |
25 /* Register Widgets and Controls */ |
26 |
|
27 // Try Gutenberg |
|
28 |
|
29 // If Gutenberg isn't activated, only show the panel to users who can install and activate it. |
|
30 $plugins = get_plugins(); |
|
31 if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'install_plugins' ) ) { |
|
32 remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); |
|
33 } |
|
34 // If Gutenberg is activated, only show it to users who can use it. |
|
35 if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'edit_posts' ) ) { |
|
36 remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); |
|
37 } |
|
38 |
26 |
39 $response = wp_check_browser_version(); |
27 $response = wp_check_browser_version(); |
40 |
28 |
41 if ( $response && $response['upgrade'] ) { |
29 if ( $response && $response['upgrade'] ) { |
42 add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' ); |
30 add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' ); |
43 if ( $response['insecure'] ) |
31 if ( $response['insecure'] ) { |
44 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); |
32 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); |
45 else |
33 } else { |
46 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); |
34 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); |
|
35 } |
|
36 } |
|
37 |
|
38 // PHP Version. |
|
39 $response = wp_check_php_version(); |
|
40 if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable'] && current_user_can( 'update_php' ) ) { |
|
41 add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' ); |
|
42 wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' ); |
47 } |
43 } |
48 |
44 |
49 // Right Now |
45 // Right Now |
50 if ( is_blog_admin() && current_user_can('edit_posts') ) |
46 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { |
51 wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); |
47 wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); |
52 |
48 } |
53 if ( is_network_admin() ) |
49 |
|
50 if ( is_network_admin() ) { |
54 wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); |
51 wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); |
|
52 } |
55 |
53 |
56 // Activity Widget |
54 // Activity Widget |
57 if ( is_blog_admin() ) { |
55 if ( is_blog_admin() ) { |
58 wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); |
56 wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); |
59 } |
57 } |
113 /** |
111 /** |
114 * Filters the list of widgets to load for the admin dashboard. |
112 * Filters the list of widgets to load for the admin dashboard. |
115 * |
113 * |
116 * @since 2.5.0 |
114 * @since 2.5.0 |
117 * |
115 * |
118 * @param array $dashboard_widgets An array of dashboard widgets. |
116 * @param string[] $dashboard_widgets An array of dashboard widget IDs. |
119 */ |
117 */ |
120 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); |
118 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); |
121 } |
119 } |
122 |
120 |
123 foreach ( $dashboard_widgets as $widget_id ) { |
121 foreach ( $dashboard_widgets as $widget_id ) { |
124 $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>'; |
122 $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>'; |
125 wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] ); |
123 wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] ); |
126 } |
124 } |
127 |
125 |
128 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) { |
126 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) { |
129 check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); |
127 check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); |
130 ob_start(); // hack - but the same hack wp-admin/widgets.php uses |
128 ob_start(); // hack - but the same hack wp-admin/widgets.php uses |
131 wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); |
129 wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); |
132 ob_end_clean(); |
130 ob_end_clean(); |
133 wp_redirect( remove_query_arg( 'edit' ) ); |
131 wp_redirect( remove_query_arg( 'edit' ) ); |
134 exit; |
132 exit; |
135 } |
133 } |
136 |
134 |
137 /** This action is documented in wp-admin/edit-form-advanced.php */ |
135 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
138 do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); |
136 do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); |
139 |
137 |
140 /** This action is documented in wp-admin/edit-form-advanced.php */ |
138 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
141 do_action( 'do_meta_boxes', $screen->id, 'side', '' ); |
139 do_action( 'do_meta_boxes', $screen->id, 'side', '' ); |
142 } |
140 } |
143 |
141 |
144 /** |
142 /** |
145 * Adds a new dashboard widget. |
143 * Adds a new dashboard widget. |
162 |
160 |
163 $private_callback_args = array( '__widget_basename' => $widget_name ); |
161 $private_callback_args = array( '__widget_basename' => $widget_name ); |
164 |
162 |
165 if ( is_null( $callback_args ) ) { |
163 if ( is_null( $callback_args ) ) { |
166 $callback_args = $private_callback_args; |
164 $callback_args = $private_callback_args; |
167 } else if ( is_array( $callback_args ) ) { |
165 } elseif ( is_array( $callback_args ) ) { |
168 $callback_args = array_merge( $callback_args, $private_callback_args ); |
166 $callback_args = array_merge( $callback_args, $private_callback_args ); |
169 } |
167 } |
170 |
168 |
171 if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { |
169 if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { |
172 $wp_dashboard_control_callbacks[$widget_id] = $control_callback; |
170 $wp_dashboard_control_callbacks[ $widget_id ] = $control_callback; |
173 if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { |
171 if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { |
174 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); |
172 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); |
175 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>'; |
173 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>'; |
176 $callback = '_wp_dashboard_control_callback'; |
174 $callback = '_wp_dashboard_control_callback'; |
177 } else { |
175 } else { |
178 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); |
176 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); |
179 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>'; |
177 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>'; |
180 } |
178 } |
181 } |
179 } |
182 |
180 |
183 $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); |
181 $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); |
184 |
182 |
185 $location = 'normal'; |
183 $location = 'normal'; |
186 if ( in_array($widget_id, $side_widgets) ) |
184 if ( in_array( $widget_id, $side_widgets ) ) { |
187 $location = 'side'; |
185 $location = 'side'; |
|
186 } |
|
187 |
|
188 $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' ); |
188 |
189 |
189 $priority = 'core'; |
190 $priority = 'core'; |
190 if ( 'dashboard_browser_nag' === $widget_id ) |
191 if ( in_array( $widget_id, $high_priority_widgets, true ) ) { |
191 $priority = 'high'; |
192 $priority = 'high'; |
|
193 } |
192 |
194 |
193 add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); |
195 add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); |
194 } |
196 } |
195 |
197 |
196 /** |
198 /** |
204 */ |
206 */ |
205 function _wp_dashboard_control_callback( $dashboard, $meta_box ) { |
207 function _wp_dashboard_control_callback( $dashboard, $meta_box ) { |
206 echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">'; |
208 echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">'; |
207 wp_dashboard_trigger_widget_control( $meta_box['id'] ); |
209 wp_dashboard_trigger_widget_control( $meta_box['id'] ); |
208 wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); |
210 wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); |
209 echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />'; |
211 echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />'; |
210 submit_button( __('Submit') ); |
212 submit_button( __( 'Submit' ) ); |
211 echo '</form>'; |
213 echo '</form>'; |
212 } |
214 } |
213 |
215 |
214 /** |
216 /** |
215 * Displays the dashboard. |
217 * Displays the dashboard. |
216 * |
218 * |
217 * @since 2.5.0 |
219 * @since 2.5.0 |
218 */ |
220 */ |
219 function wp_dashboard() { |
221 function wp_dashboard() { |
220 $screen = get_current_screen(); |
222 $screen = get_current_screen(); |
221 $columns = absint( $screen->get_columns() ); |
223 $columns = absint( $screen->get_columns() ); |
222 $columns_css = ''; |
224 $columns_css = ''; |
223 if ( $columns ) { |
225 if ( $columns ) { |
224 $columns_css = " columns-$columns"; |
226 $columns_css = " columns-$columns"; |
225 } |
227 } |
226 |
228 |
227 ?> |
229 ?> |
228 <div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>"> |
230 <div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>"> |
229 <div id="postbox-container-1" class="postbox-container"> |
231 <div id="postbox-container-1" class="postbox-container"> |
230 <?php do_meta_boxes( $screen->id, 'normal', '' ); ?> |
232 <?php do_meta_boxes( $screen->id, 'normal', '' ); ?> |
231 </div> |
233 </div> |
232 <div id="postbox-container-2" class="postbox-container"> |
234 <div id="postbox-container-2" class="postbox-container"> |
269 if ( 'post' == $post_type ) { |
271 if ( 'post' == $post_type ) { |
270 $text = _n( '%s Post', '%s Posts', $num_posts->publish ); |
272 $text = _n( '%s Post', '%s Posts', $num_posts->publish ); |
271 } else { |
273 } else { |
272 $text = _n( '%s Page', '%s Pages', $num_posts->publish ); |
274 $text = _n( '%s Page', '%s Pages', $num_posts->publish ); |
273 } |
275 } |
274 $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
276 $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
275 $post_type_object = get_post_type_object( $post_type ); |
277 $post_type_object = get_post_type_object( $post_type ); |
276 if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
278 if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
277 printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text ); |
279 printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text ); |
278 } else { |
280 } else { |
279 printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text ); |
281 printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text ); |
280 } |
282 } |
281 |
|
282 } |
283 } |
283 } |
284 } |
284 // Comments |
285 // Comments |
285 $num_comm = wp_count_comments(); |
286 $num_comm = wp_count_comments(); |
286 if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { |
287 if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { |
430 /** |
435 /** |
431 * Fires in the Network Admin 'Right Now' dashboard widget |
436 * Fires in the Network Admin 'Right Now' dashboard widget |
432 * just before the user and site search form fields. |
437 * just before the user and site search form fields. |
433 * |
438 * |
434 * @since MU (3.0.0) |
439 * @since MU (3.0.0) |
435 * |
|
436 * @param null $unused |
|
437 */ |
440 */ |
438 do_action( 'wpmuadminresult', '' ); |
441 do_action( 'wpmuadminresult' ); |
439 ?> |
442 ?> |
440 |
443 |
441 <form action="<?php echo network_admin_url('users.php'); ?>" method="get"> |
444 <form action="<?php echo network_admin_url( 'users.php' ); ?>" method="get"> |
442 <p> |
445 <p> |
443 <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label> |
446 <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label> |
444 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/> |
447 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/> |
445 <?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?> |
448 <?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?> |
446 </p> |
449 </p> |
447 </form> |
450 </form> |
448 |
451 |
449 <form action="<?php echo network_admin_url('sites.php'); ?>" method="get"> |
452 <form action="<?php echo network_admin_url( 'sites.php' ); ?>" method="get"> |
450 <p> |
453 <p> |
451 <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label> |
454 <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label> |
452 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/> |
455 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/> |
453 <?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?> |
456 <?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?> |
454 </p> |
457 </p> |
455 </form> |
458 </form> |
456 <?php |
459 <?php |
457 /** |
460 /** |
458 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard. |
461 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard. |
459 * |
462 * |
460 * @since MU (3.0.0) |
463 * @since MU (3.0.0) |
461 */ |
464 */ |
494 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
497 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
495 } else { |
498 } else { |
496 $post->post_title = ''; // Remove the auto draft title |
499 $post->post_title = ''; // Remove the auto draft title |
497 } |
500 } |
498 } else { |
501 } else { |
499 $post = get_default_post_to_edit( 'post' , true); |
502 $post = get_default_post_to_edit( 'post', true ); |
500 $user_id = get_current_user_id(); |
503 $user_id = get_current_user_id(); |
501 // Don't create an option if this is a super admin who does not belong to this site. |
504 // Don't create an option if this is a super admin who does not belong to this site. |
502 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) |
505 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) { |
503 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
506 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
|
507 } |
504 } |
508 } |
505 |
509 |
506 $post_ID = (int) $post->ID; |
510 $post_ID = (int) $post->ID; |
507 ?> |
511 ?> |
508 |
512 |
509 <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js"> |
513 <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js"> |
510 |
514 |
511 <?php if ( $error_msg ) : ?> |
515 <?php if ( $error_msg ) : ?> |
512 <div class="error"><?php echo $error_msg; ?></div> |
516 <div class="error"><?php echo $error_msg; ?></div> |
513 <?php endif; ?> |
517 <?php endif; ?> |
514 |
518 |
515 <div class="input-text-wrap" id="title-wrap"> |
519 <div class="input-text-wrap" id="title-wrap"> |
516 <label class="screen-reader-text prompt" for="title" id="title-prompt-text"> |
520 <label for="title"> |
517 |
|
518 <?php |
521 <?php |
519 /** This filter is documented in wp-admin/edit-form-advanced.php */ |
522 /** This filter is documented in wp-admin/edit-form-advanced.php */ |
520 echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); |
523 echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); |
521 ?> |
524 ?> |
522 </label> |
525 </label> |
523 <input type="text" name="post_title" id="title" autocomplete="off" /> |
526 <input type="text" name="post_title" id="title" autocomplete="off" /> |
524 </div> |
527 </div> |
525 |
528 |
526 <div class="textarea-wrap" id="description-wrap"> |
529 <div class="textarea-wrap" id="description-wrap"> |
527 <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label> |
530 <label for="content"><?php _e( 'Content' ); ?></label> |
528 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea> |
531 <textarea name="content" id="content" placeholder="<?php esc_attr_e( 'What’s on your mind?' ); ?>" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea> |
529 </div> |
532 </div> |
530 |
533 |
531 <p class="submit"> |
534 <p class="submit"> |
532 <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" /> |
535 <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" /> |
533 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" /> |
536 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" /> |
570 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); |
573 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); |
571 |
574 |
572 $drafts = get_posts( $query_args ); |
575 $drafts = get_posts( $query_args ); |
573 if ( ! $drafts ) { |
576 if ( ! $drafts ) { |
574 return; |
577 return; |
575 } |
578 } |
576 } |
579 } |
577 |
580 |
578 echo '<div class="drafts">'; |
581 echo '<div class="drafts">'; |
579 if ( count( $drafts ) > 3 ) { |
582 if ( count( $drafts ) > 3 ) { |
580 echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . __( 'View all drafts' ) . "</a></p>\n"; |
583 echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . __( 'View all drafts' ) . "</a></p>\n"; |
581 } |
584 } |
582 echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>"; |
585 echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>"; |
583 |
586 |
584 $drafts = array_slice( $drafts, 0, 3 ); |
587 $drafts = array_slice( $drafts, 0, 3 ); |
585 foreach ( $drafts as $draft ) { |
588 foreach ( $drafts as $draft ) { |
586 $url = get_edit_post_link( $draft->ID ); |
589 $url = get_edit_post_link( $draft->ID ); |
587 $title = _draft_or_post_title( $draft->ID ); |
590 $title = _draft_or_post_title( $draft->ID ); |
588 echo "<li>\n"; |
591 echo "<li>\n"; |
589 /* translators: %s: post title */ |
592 /* translators: %s: post title */ |
590 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>'; |
593 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>'; |
591 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>'; |
594 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>'; |
592 if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) { |
595 if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) { |
593 echo '<p>' . $the_content . '</p>'; |
596 echo '<p>' . $the_content . '</p>'; |
594 } |
597 } |
595 echo "</li>\n"; |
598 echo "</li>\n"; |
596 } |
599 } |
597 echo "</ul>\n</div>"; |
600 echo "</ul>\n</div>"; |
598 } |
601 } |
599 |
602 |
600 /** |
603 /** |
601 * Outputs a row for the Recent Comments widget. |
604 * Outputs a row for the Recent Comments widget. |
612 $GLOBALS['comment'] = clone $comment; |
615 $GLOBALS['comment'] = clone $comment; |
613 |
616 |
614 if ( $comment->comment_post_ID > 0 ) { |
617 if ( $comment->comment_post_ID > 0 ) { |
615 |
618 |
616 $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); |
619 $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); |
617 $comment_post_url = get_the_permalink( $comment->comment_post_ID ); |
620 $comment_post_url = get_the_permalink( $comment->comment_post_ID ); |
618 $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>"; |
621 $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>"; |
619 } else { |
622 } else { |
620 $comment_post_link = ''; |
623 $comment_post_link = ''; |
621 } |
624 } |
622 |
625 |
623 $actions_string = ''; |
626 $actions_string = ''; |
624 if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
627 if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
625 // Pre-order it: Approve | Reply | Edit | Spam | Trash. |
628 // Pre-order it: Approve | Reply | Edit | Spam | Trash. |
626 $actions = array( |
629 $actions = array( |
627 'approve' => '', 'unapprove' => '', |
630 'approve' => '', |
628 'reply' => '', |
631 'unapprove' => '', |
629 'edit' => '', |
632 'reply' => '', |
630 'spam' => '', |
633 'edit' => '', |
631 'trash' => '', 'delete' => '', |
634 'spam' => '', |
632 'view' => '', |
635 'trash' => '', |
|
636 'delete' => '', |
|
637 'view' => '', |
633 ); |
638 ); |
634 |
639 |
635 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
640 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
636 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
641 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
637 |
642 |
638 $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
643 $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
639 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
644 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
640 $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
645 $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
641 $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
646 $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
642 $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
647 $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
643 |
648 |
644 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
649 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a aria-button-if-js' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
645 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
650 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u aria-button-if-js' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
646 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>'; |
651 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>" . __( 'Edit' ) . '</a>'; |
647 $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '" href="#">' . __( 'Reply' ) . '</a>'; |
652 $actions['reply'] = '<button type="button" onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\'' . $comment->comment_post_ID . '\');" class="vim-r button-link hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '">' . __( 'Reply' ) . '</button>'; |
648 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
653 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive aria-button-if-js' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
649 |
654 |
650 if ( ! EMPTY_TRASH_DAYS ) { |
655 if ( ! EMPTY_TRASH_DAYS ) { |
651 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
656 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive aria-button-if-js' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
652 } else { |
657 } else { |
653 $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>'; |
658 $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-button-if-js' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; |
654 } |
659 } |
655 |
660 |
656 $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>'; |
661 $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>'; |
657 |
662 |
658 /** |
663 /** |
659 * Filters the action links displayed for each comment in the 'Recent Comments' |
664 * Filters the action links displayed for each comment in the 'Recent Comments' |
660 * dashboard widget. |
665 * dashboard widget. |
661 * |
666 * |
662 * @since 2.6.0 |
667 * @since 2.6.0 |
663 * |
668 * |
664 * @param array $actions An array of comment actions. Default actions include: |
669 * @param string[] $actions An array of comment actions. Default actions include: |
665 * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', |
670 * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', |
666 * 'Delete', and 'Trash'. |
671 * 'Delete', and 'Trash'. |
667 * @param WP_Comment $comment The comment object. |
672 * @param WP_Comment $comment The comment object. |
668 */ |
673 */ |
669 $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); |
674 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
670 |
675 |
671 $i = 0; |
676 $i = 0; |
672 foreach ( $actions as $action => $link ) { |
677 foreach ( $actions as $action => $link ) { |
673 ++$i; |
678 ++$i; |
674 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
679 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
675 |
680 |
676 // Reply and quickedit need a hide-if-no-js span |
681 // Reply and quickedit need a hide-if-no-js span |
677 if ( 'reply' == $action || 'quickedit' == $action ) { |
682 if ( 'reply' == $action || 'quickedit' == $action ) { |
678 $action .= ' hide-if-no-js'; |
683 $action .= ' hide-if-no-js'; |
679 } |
684 } |
682 $action .= ' hidden'; |
687 $action .= ' hidden'; |
683 } |
688 } |
684 $actions_string .= "<span class='$action'>$sep$link</span>"; |
689 $actions_string .= "<span class='$action'>$sep$link</span>"; |
685 } |
690 } |
686 } |
691 } |
687 ?> |
692 ?> |
688 |
693 |
689 <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>> |
694 <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>> |
690 |
695 |
691 <?php echo get_avatar( $comment, 50, 'mystery' ); ?> |
696 <?php echo get_avatar( $comment, 50, 'mystery' ); ?> |
692 |
697 |
693 <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?> |
698 <?php if ( ! $comment->comment_type || 'comment' == $comment->comment_type ) : ?> |
694 |
699 |
695 <div class="dashboard-comment-wrap has-row-actions"> |
700 <div class="dashboard-comment-wrap has-row-actions"> |
696 <p class="comment-meta"> |
701 <p class="comment-meta"> |
697 <?php |
702 <?php |
698 // Comments might not have a post they relate to, e.g. programmatically created ones. |
703 // Comments might not have a post they relate to, e.g. programmatically created ones. |
699 if ( $comment_post_link ) { |
704 if ( $comment_post_link ) { |
700 printf( |
705 printf( |
701 /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */ |
706 /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */ |
702 __( 'From %1$s on %2$s %3$s' ), |
707 __( 'From %1$s on %2$s %3$s' ), |
710 __( 'From %1$s %2$s' ), |
715 __( 'From %1$s %2$s' ), |
711 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', |
716 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', |
712 '<span class="approve">' . __( '[Pending]' ) . '</span>' |
717 '<span class="approve">' . __( '[Pending]' ) . '</span>' |
713 ); |
718 ); |
714 } |
719 } |
715 ?> |
720 ?> |
716 </p> |
721 </p> |
717 |
722 |
718 <?php |
723 <?php |
719 else : |
724 else : |
720 switch ( $comment->comment_type ) { |
725 switch ( $comment->comment_type ) { |
721 case 'pingback' : |
726 case 'pingback': |
722 $type = __( 'Pingback' ); |
727 $type = __( 'Pingback' ); |
723 break; |
728 break; |
724 case 'trackback' : |
729 case 'trackback': |
725 $type = __( 'Trackback' ); |
730 $type = __( 'Trackback' ); |
726 break; |
731 break; |
727 default : |
732 default: |
728 $type = ucwords( $comment->comment_type ); |
733 $type = ucwords( $comment->comment_type ); |
729 } |
734 } |
730 $type = esc_html( $type ); |
735 $type = esc_html( $type ); |
731 ?> |
736 ?> |
732 <div class="dashboard-comment-wrap has-row-actions"> |
737 <div class="dashboard-comment-wrap has-row-actions"> |
733 <p class="comment-meta"> |
738 <p class="comment-meta"> |
734 <?php |
739 <?php |
735 // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones. |
740 // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones. |
736 if ( $comment_post_link ) { |
741 if ( $comment_post_link ) { |
737 printf( |
742 printf( |
738 /* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */ |
743 /* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */ |
739 _x( '%1$s on %2$s %3$s', 'dashboard' ), |
744 _x( '%1$s on %2$s %3$s', 'dashboard' ), |
771 */ |
776 */ |
772 function wp_dashboard_site_activity() { |
777 function wp_dashboard_site_activity() { |
773 |
778 |
774 echo '<div id="activity-widget">'; |
779 echo '<div id="activity-widget">'; |
775 |
780 |
776 $future_posts = wp_dashboard_recent_posts( array( |
781 $future_posts = wp_dashboard_recent_posts( |
777 'max' => 5, |
782 array( |
778 'status' => 'future', |
783 'max' => 5, |
779 'order' => 'ASC', |
784 'status' => 'future', |
780 'title' => __( 'Publishing Soon' ), |
785 'order' => 'ASC', |
781 'id' => 'future-posts', |
786 'title' => __( 'Publishing Soon' ), |
782 ) ); |
787 'id' => 'future-posts', |
783 $recent_posts = wp_dashboard_recent_posts( array( |
788 ) |
784 'max' => 5, |
789 ); |
785 'status' => 'publish', |
790 $recent_posts = wp_dashboard_recent_posts( |
786 'order' => 'DESC', |
791 array( |
787 'title' => __( 'Recently Published' ), |
792 'max' => 5, |
788 'id' => 'published-posts', |
793 'status' => 'publish', |
789 ) ); |
794 'order' => 'DESC', |
|
795 'title' => __( 'Recently Published' ), |
|
796 'id' => 'published-posts', |
|
797 ) |
|
798 ); |
790 |
799 |
791 $recent_comments = wp_dashboard_recent_comments(); |
800 $recent_comments = wp_dashboard_recent_comments(); |
792 |
801 |
793 if ( !$future_posts && !$recent_posts && !$recent_comments ) { |
802 if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) { |
794 echo '<div class="no-activity">'; |
803 echo '<div class="no-activity">'; |
795 echo '<p class="smiley" aria-hidden="true"></p>'; |
804 echo '<p class="smiley" aria-hidden="true"></p>'; |
796 echo '<p>' . __( 'No activity yet!' ) . '</p>'; |
805 echo '<p>' . __( 'No activity yet!' ) . '</p>'; |
797 echo '</div>'; |
806 echo '</div>'; |
798 } |
807 } |
834 * @since 4.2.0 |
843 * @since 4.2.0 |
835 * |
844 * |
836 * @param array $query_args The arguments passed to WP_Query to produce the list of posts. |
845 * @param array $query_args The arguments passed to WP_Query to produce the list of posts. |
837 */ |
846 */ |
838 $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args ); |
847 $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args ); |
839 $posts = new WP_Query( $query_args ); |
848 $posts = new WP_Query( $query_args ); |
840 |
849 |
841 if ( $posts->have_posts() ) { |
850 if ( $posts->have_posts() ) { |
842 |
851 |
843 echo '<div id="' . $args['id'] . '" class="activity-block">'; |
852 echo '<div id="' . $args['id'] . '" class="activity-block">'; |
844 |
853 |
845 echo '<h3>' . $args['title'] . '</h3>'; |
854 echo '<h3>' . $args['title'] . '</h3>'; |
846 |
855 |
847 echo '<ul>'; |
856 echo '<ul>'; |
848 |
857 |
849 $today = date( 'Y-m-d', current_time( 'timestamp' ) ); |
858 $today = current_time( 'Y-m-d' ); |
850 $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); |
859 $tomorrow = gmdate( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); |
|
860 $year = current_time( 'Y' ); |
851 |
861 |
852 while ( $posts->have_posts() ) { |
862 while ( $posts->have_posts() ) { |
853 $posts->the_post(); |
863 $posts->the_post(); |
854 |
864 |
855 $time = get_the_time( 'U' ); |
865 $time = get_the_time( 'U' ); |
856 if ( date( 'Y-m-d', $time ) == $today ) { |
866 if ( date( 'Y-m-d', $time ) == $today ) { |
857 $relative = __( 'Today' ); |
867 $relative = __( 'Today' ); |
858 } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { |
868 } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { |
859 $relative = __( 'Tomorrow' ); |
869 $relative = __( 'Tomorrow' ); |
860 } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) { |
870 } elseif ( date( 'Y', $time ) !== $year ) { |
861 /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ |
871 /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ |
862 $relative = date_i18n( __( 'M jS Y' ), $time ); |
872 $relative = date_i18n( __( 'M jS Y' ), $time ); |
863 } else { |
873 } else { |
864 /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ |
874 /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ |
865 $relative = date_i18n( __( 'M jS' ), $time ); |
875 $relative = date_i18n( __( 'M jS' ), $time ); |
904 // Select all comment types and filter out spam later for better query performance. |
914 // Select all comment types and filter out spam later for better query performance. |
905 $comments = array(); |
915 $comments = array(); |
906 |
916 |
907 $comments_query = array( |
917 $comments_query = array( |
908 'number' => $total_items * 5, |
918 'number' => $total_items * 5, |
909 'offset' => 0 |
919 'offset' => 0, |
910 ); |
920 ); |
911 if ( ! current_user_can( 'edit_posts' ) ) |
921 if ( ! current_user_can( 'edit_posts' ) ) { |
912 $comments_query['status'] = 'approve'; |
922 $comments_query['status'] = 'approve'; |
|
923 } |
913 |
924 |
914 while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { |
925 while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { |
915 if ( ! is_array( $possible ) ) { |
926 if ( ! is_array( $possible ) ) { |
916 break; |
927 break; |
917 } |
928 } |
918 foreach ( $possible as $comment ) { |
929 foreach ( $possible as $comment ) { |
919 if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) |
930 if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) { |
920 continue; |
931 continue; |
|
932 } |
921 $comments[] = $comment; |
933 $comments[] = $comment; |
922 if ( count( $comments ) == $total_items ) |
934 if ( count( $comments ) == $total_items ) { |
923 break 2; |
935 break 2; |
|
936 } |
924 } |
937 } |
925 $comments_query['offset'] += $comments_query['number']; |
938 $comments_query['offset'] += $comments_query['number']; |
926 $comments_query['number'] = $total_items * 10; |
939 $comments_query['number'] = $total_items * 10; |
927 } |
940 } |
928 |
941 |
929 if ( $comments ) { |
942 if ( $comments ) { |
930 echo '<div id="latest-comments" class="activity-block">'; |
943 echo '<div id="latest-comments" class="activity-block">'; |
931 echo '<h3>' . __( 'Recent Comments' ) . '</h3>'; |
944 echo '<h3>' . __( 'Recent Comments' ) . '</h3>'; |
932 |
945 |
933 echo '<ul id="the-comment-list" data-wp-lists="list:comment">'; |
946 echo '<ul id="the-comment-list" data-wp-lists="list:comment">'; |
934 foreach ( $comments as $comment ) |
947 foreach ( $comments as $comment ) { |
935 _wp_dashboard_recent_comments_row( $comment ); |
948 _wp_dashboard_recent_comments_row( $comment ); |
|
949 } |
936 echo '</ul>'; |
950 echo '</ul>'; |
937 |
951 |
938 if ( current_user_can( 'edit_posts' ) ) { |
952 if ( current_user_can( 'edit_posts' ) ) { |
939 echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>'; |
953 echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>'; |
940 _get_list_table( 'WP_Comments_List_Table' )->views(); |
954 _get_list_table( 'WP_Comments_List_Table' )->views(); |
978 * @param callable $callback |
992 * @param callable $callback |
979 * @param array $check_urls RSS feeds |
993 * @param array $check_urls RSS feeds |
980 * @return bool False on failure. True on success. |
994 * @return bool False on failure. True on success. |
981 */ |
995 */ |
982 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { |
996 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { |
983 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>'; |
997 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>'; |
984 $doing_ajax = wp_doing_ajax(); |
998 $doing_ajax = wp_doing_ajax(); |
985 |
999 |
986 if ( empty($check_urls) ) { |
1000 if ( empty( $check_urls ) ) { |
987 $widgets = get_option( 'dashboard_widget_options' ); |
1001 $widgets = get_option( 'dashboard_widget_options' ); |
988 if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) { |
1002 if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) { |
989 echo $loading; |
1003 echo $loading; |
990 return false; |
1004 return false; |
991 } |
1005 } |
992 $check_urls = array( $widgets[$widget_id]['url'] ); |
1006 $check_urls = array( $widgets[ $widget_id ]['url'] ); |
993 } |
1007 } |
994 |
1008 |
995 $locale = get_user_locale(); |
1009 $locale = get_user_locale(); |
996 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
1010 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
997 if ( false !== ( $output = get_transient( $cache_key ) ) ) { |
1011 if ( false !== ( $output = get_transient( $cache_key ) ) ) { |
998 echo $output; |
1012 echo $output; |
999 return true; |
1013 return true; |
1000 } |
1014 } |
1046 * |
1067 * |
1047 * @param string $widget_id |
1068 * @param string $widget_id |
1048 * @param array $form_inputs |
1069 * @param array $form_inputs |
1049 */ |
1070 */ |
1050 function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { |
1071 function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { |
1051 if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) |
1072 if ( ! $widget_options = get_option( 'dashboard_widget_options' ) ) { |
1052 $widget_options = array(); |
1073 $widget_options = array(); |
1053 |
1074 } |
1054 if ( !isset($widget_options[$widget_id]) ) |
1075 |
1055 $widget_options[$widget_id] = array(); |
1076 if ( ! isset( $widget_options[ $widget_id ] ) ) { |
1056 |
1077 $widget_options[ $widget_id ] = array(); |
1057 $number = 1; // Hack to use wp_widget_rss_form() |
1078 } |
1058 $widget_options[$widget_id]['number'] = $number; |
1079 |
1059 |
1080 $number = 1; // Hack to use wp_widget_rss_form() |
1060 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) { |
1081 $widget_options[ $widget_id ]['number'] = $number; |
1061 $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] ); |
1082 |
1062 $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); |
1083 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) { |
1063 $widget_options[$widget_id]['number'] = $number; |
1084 $_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] ); |
|
1085 $widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] ); |
|
1086 $widget_options[ $widget_id ]['number'] = $number; |
1064 |
1087 |
1065 // Title is optional. If black, fill it if possible. |
1088 // Title is optional. If black, fill it if possible. |
1066 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { |
1089 if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) { |
1067 $rss = fetch_feed($widget_options[$widget_id]['url']); |
1090 $rss = fetch_feed( $widget_options[ $widget_id ]['url'] ); |
1068 if ( is_wp_error($rss) ) { |
1091 if ( is_wp_error( $rss ) ) { |
1069 $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); |
1092 $widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) ); |
1070 } else { |
1093 } else { |
1071 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); |
1094 $widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) ); |
1072 $rss->__destruct(); |
1095 $rss->__destruct(); |
1073 unset($rss); |
1096 unset( $rss ); |
1074 } |
1097 } |
1075 } |
1098 } |
1076 update_option( 'dashboard_widget_options', $widget_options ); |
1099 update_option( 'dashboard_widget_options', $widget_options ); |
1077 $locale = get_user_locale(); |
1100 $locale = get_user_locale(); |
1078 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
1101 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
1079 delete_transient( $cache_key ); |
1102 delete_transient( $cache_key ); |
1080 } |
1103 } |
1081 |
1104 |
1082 wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); |
1105 wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs ); |
1083 } |
1106 } |
1084 |
1107 |
1085 |
1108 |
1086 /** |
1109 /** |
1087 * Renders the Events and News dashboard widget. |
1110 * Renders the Events and News dashboard widget. |
1216 */ |
1239 */ |
1217 function wp_print_community_events_templates() { |
1240 function wp_print_community_events_templates() { |
1218 ?> |
1241 ?> |
1219 |
1242 |
1220 <script id="tmpl-community-events-attend-event-near" type="text/template"> |
1243 <script id="tmpl-community-events-attend-event-near" type="text/template"> |
1221 <?php printf( |
1244 <?php |
|
1245 printf( |
1222 /* translators: %s: the name of a city */ |
1246 /* translators: %s: the name of a city */ |
1223 __( 'Attend an upcoming event near %s.' ), |
1247 __( 'Attend an upcoming event near %s.' ), |
1224 '<strong>{{ data.location.description }}</strong>' |
1248 '<strong>{{ data.location.description }}</strong>' |
1225 ); ?> |
1249 ); |
|
1250 ?> |
1226 </script> |
1251 </script> |
1227 |
1252 |
1228 <script id="tmpl-community-events-could-not-locate" type="text/template"> |
1253 <script id="tmpl-community-events-could-not-locate" type="text/template"> |
1229 <?php printf( |
1254 <?php |
|
1255 printf( |
1230 /* translators: %s is the name of the city we couldn't locate. |
1256 /* translators: %s is the name of the city we couldn't locate. |
1231 * Replace the examples with cities in your locale, but test |
1257 * Replace the examples with cities in your locale, but test |
1232 * that they match the expected location before including them. |
1258 * that they match the expected location before including them. |
1233 * Use endonyms (native locale names) whenever possible. |
1259 * Use endonyms (native locale names) whenever possible. |
1234 */ |
1260 */ |
1235 __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), |
1261 __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), |
1236 '<em>{{data.unknownCity}}</em>' |
1262 '<em>{{data.unknownCity}}</em>' |
1237 ); ?> |
1263 ); |
|
1264 ?> |
1238 </script> |
1265 </script> |
1239 |
1266 |
1240 <script id="tmpl-community-events-event-list" type="text/template"> |
1267 <script id="tmpl-community-events-event-list" type="text/template"> |
1241 <# _.each( data.events, function( event ) { #> |
1268 <# _.each( data.events, function( event ) { #> |
1242 <li class="event event-{{ event.type }} wp-clearfix"> |
1269 <li class="event event-{{ event.type }} wp-clearfix"> |
1259 </script> |
1286 </script> |
1260 |
1287 |
1261 <script id="tmpl-community-events-no-upcoming-events" type="text/template"> |
1288 <script id="tmpl-community-events-no-upcoming-events" type="text/template"> |
1262 <li class="event-none"> |
1289 <li class="event-none"> |
1263 <# if ( data.location.description ) { #> |
1290 <# if ( data.location.description ) { #> |
1264 <?php printf( |
1291 <?php |
|
1292 printf( |
1265 /* translators: 1: the city the user searched for, 2: meetup organization documentation URL */ |
1293 /* translators: 1: the city the user searched for, 2: meetup organization documentation URL */ |
1266 __( 'There aren’t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize one</a>?' ), |
1294 __( 'There aren’t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize one</a>?' ), |
1267 '{{ data.location.description }}', |
1295 '{{ data.location.description }}', |
1268 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
1296 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
1269 ); ?> |
1297 ); |
|
1298 ?> |
1270 |
1299 |
1271 <# } else { #> |
1300 <# } else { #> |
1272 <?php printf( |
1301 <?php |
|
1302 printf( |
1273 /* translators: %s: meetup organization documentation URL */ |
1303 /* translators: %s: meetup organization documentation URL */ |
1274 __( 'There aren’t any events scheduled near you at the moment. Would you like to <a href="%s">organize one</a>?' ), |
1304 __( 'There aren’t any events scheduled near you at the moment. Would you like to <a href="%s">organize one</a>?' ), |
1275 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
1305 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
1276 ); ?> |
1306 ); |
|
1307 ?> |
1277 <# } #> |
1308 <# } #> |
1278 </li> |
1309 </li> |
1279 </script> |
1310 </script> |
1280 <?php |
1311 <?php |
1281 } |
1312 } |
1282 |
1313 |
1283 /** |
1314 /** |
1284 * WordPress News dashboard widget. |
1315 * 'WordPress Events and News' dashboard widget. |
1285 * |
1316 * |
1286 * @since 2.7.0 |
1317 * @since 2.7.0 |
1287 * @since 4.8.0 Removed popular plugins feed. |
1318 * @since 4.8.0 Removed popular plugins feed. |
1288 */ |
1319 */ |
1289 function wp_dashboard_primary() { |
1320 function wp_dashboard_primary() { |
1290 $feeds = array( |
1321 $feeds = array( |
1291 'news' => array( |
1322 'news' => array( |
1292 |
1323 |
1293 /** |
1324 /** |
1294 * Filters the primary link URL for the 'WordPress News' dashboard widget. |
1325 * Filters the primary link URL for the 'WordPress Events and News' dashboard widget. |
1295 * |
1326 * |
1296 * @since 2.5.0 |
1327 * @since 2.5.0 |
1297 * |
1328 * |
1298 * @param string $link The widget's primary link URL. |
1329 * @param string $link The widget's primary link URL. |
1299 */ |
1330 */ |
1300 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), |
1331 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), |
1301 |
1332 |
1302 /** |
1333 /** |
1303 * Filters the primary feed URL for the 'WordPress News' dashboard widget. |
1334 * Filters the primary feed URL for the 'WordPress Events and News' dashboard widget. |
1304 * |
1335 * |
1305 * @since 2.3.0 |
1336 * @since 2.3.0 |
1306 * |
1337 * |
1307 * @param string $url The widget's primary feed URL. |
1338 * @param string $url The widget's primary feed URL. |
1308 */ |
1339 */ |
1309 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), |
1340 'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ), |
1310 |
1341 |
1311 /** |
1342 /** |
1312 * Filters the primary link title for the 'WordPress News' dashboard widget. |
1343 * Filters the primary link title for the 'WordPress Events and News' dashboard widget. |
1313 * |
1344 * |
1314 * @since 2.3.0 |
1345 * @since 2.3.0 |
1315 * |
1346 * |
1316 * @param string $title Title attribute for the widget's primary link. |
1347 * @param string $title Title attribute for the widget's primary link. |
1317 */ |
1348 */ |
1322 'show_date' => 0, |
1353 'show_date' => 0, |
1323 ), |
1354 ), |
1324 'planet' => array( |
1355 'planet' => array( |
1325 |
1356 |
1326 /** |
1357 /** |
1327 * Filters the secondary link URL for the 'WordPress News' dashboard widget. |
1358 * Filters the secondary link URL for the 'WordPress Events and News' dashboard widget. |
1328 * |
1359 * |
1329 * @since 2.3.0 |
1360 * @since 2.3.0 |
1330 * |
1361 * |
1331 * @param string $link The widget's secondary link URL. |
1362 * @param string $link The widget's secondary link URL. |
1332 */ |
1363 */ |
1333 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), |
1364 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), |
1334 |
1365 |
1335 /** |
1366 /** |
1336 * Filters the secondary feed URL for the 'WordPress News' dashboard widget. |
1367 * Filters the secondary feed URL for the 'WordPress Events and News' dashboard widget. |
1337 * |
1368 * |
1338 * @since 2.3.0 |
1369 * @since 2.3.0 |
1339 * |
1370 * |
1340 * @param string $url The widget's secondary feed URL. |
1371 * @param string $url The widget's secondary feed URL. |
1341 */ |
1372 */ |
1342 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), |
1373 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), |
1343 |
1374 |
1344 /** |
1375 /** |
1345 * Filters the secondary link title for the 'WordPress News' dashboard widget. |
1376 * Filters the secondary link title for the 'WordPress Events and News' dashboard widget. |
1346 * |
1377 * |
1347 * @since 2.3.0 |
1378 * @since 2.3.0 |
1348 * |
1379 * |
1349 * @param string $title Title attribute for the widget's secondary link. |
1380 * @param string $title Title attribute for the widget's secondary link. |
1350 */ |
1381 */ |
1351 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), |
1382 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), |
1352 |
1383 |
1353 /** |
1384 /** |
1354 * Filters the number of secondary link items for the 'WordPress News' dashboard widget. |
1385 * Filters the number of secondary link items for the 'WordPress Events and News' dashboard widget. |
1355 * |
1386 * |
1356 * @since 4.4.0 |
1387 * @since 4.4.0 |
1357 * |
1388 * |
1358 * @param string $items How many items to show in the secondary feed. |
1389 * @param string $items How many items to show in the secondary feed. |
1359 */ |
1390 */ |
1360 'items' => apply_filters( 'dashboard_secondary_items', 3 ), |
1391 'items' => apply_filters( 'dashboard_secondary_items', 3 ), |
1361 'show_summary' => 0, |
1392 'show_summary' => 0, |
1362 'show_author' => 0, |
1393 'show_author' => 0, |
1363 'show_date' => 0, |
1394 'show_date' => 0, |
1364 ) |
1395 ), |
1365 ); |
1396 ); |
1366 |
1397 |
1367 wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); |
1398 wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); |
1368 } |
1399 } |
1369 |
1400 |
1370 /** |
1401 /** |
1371 * Display the WordPress news feeds. |
1402 * Display the WordPress events and news feeds. |
1372 * |
1403 * |
1373 * @since 3.8.0 |
1404 * @since 3.8.0 |
1374 * @since 4.8.0 Removed popular plugins feed. |
1405 * @since 4.8.0 Removed popular plugins feed. |
1375 * |
1406 * |
1376 * @param string $widget_id Widget ID. |
1407 * @param string $widget_id Widget ID. |
1393 * @since 3.0.0 |
1424 * @since 3.0.0 |
1394 * |
1425 * |
1395 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. |
1426 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. |
1396 */ |
1427 */ |
1397 function wp_dashboard_quota() { |
1428 function wp_dashboard_quota() { |
1398 if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) |
1429 if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { |
1399 return true; |
1430 return true; |
|
1431 } |
1400 |
1432 |
1401 $quota = get_space_allowed(); |
1433 $quota = get_space_allowed(); |
1402 $used = get_space_used(); |
1434 $used = get_space_used(); |
1403 |
1435 |
1404 if ( $used > $quota ) |
1436 if ( $used > $quota ) { |
1405 $percentused = '100'; |
1437 $percentused = '100'; |
1406 else |
1438 } else { |
1407 $percentused = ( $used / $quota ) * 100; |
1439 $percentused = ( $used / $quota ) * 100; |
1408 $used_class = ( $percentused >= 70 ) ? ' warning' : ''; |
1440 } |
1409 $used = round( $used, 2 ); |
1441 $used_class = ( $percentused >= 70 ) ? ' warning' : ''; |
|
1442 $used = round( $used, 2 ); |
1410 $percentused = number_format( $percentused ); |
1443 $percentused = number_format( $percentused ); |
1411 |
1444 |
1412 ?> |
1445 ?> |
1413 <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3> |
1446 <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3> |
1414 <div class="mu-storage"> |
1447 <div class="mu-storage"> |
1415 <ul> |
1448 <ul> |
1416 <li class="storage-count"> |
1449 <li class="storage-count"> |
1417 <?php $text = sprintf( |
1450 <?php |
|
1451 $text = sprintf( |
1418 /* translators: %s: number of megabytes */ |
1452 /* translators: %s: number of megabytes */ |
1419 __( '%s MB Space Allowed' ), |
1453 __( '%s MB Space Allowed' ), |
1420 number_format_i18n( $quota ) |
1454 number_format_i18n( $quota ) |
1421 ); |
1455 ); |
1422 printf( |
1456 printf( |
1423 '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1457 '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1424 esc_url( admin_url( 'upload.php' ) ), |
1458 esc_url( admin_url( 'upload.php' ) ), |
1425 $text, |
1459 $text, |
1426 __( 'Manage Uploads' ) |
1460 __( 'Manage Uploads' ) |
1427 ); ?> |
1461 ); |
|
1462 ?> |
1428 </li><li class="storage-count <?php echo $used_class; ?>"> |
1463 </li><li class="storage-count <?php echo $used_class; ?>"> |
1429 <?php $text = sprintf( |
1464 <?php |
|
1465 $text = sprintf( |
1430 /* translators: 1: number of megabytes, 2: percentage */ |
1466 /* translators: 1: number of megabytes, 2: percentage */ |
1431 __( '%1$s MB (%2$s%%) Space Used' ), |
1467 __( '%1$s MB (%2$s%%) Space Used' ), |
1432 number_format_i18n( $used, 2 ), |
1468 number_format_i18n( $used, 2 ), |
1433 $percentused |
1469 $percentused |
1434 ); |
1470 ); |
1435 printf( |
1471 printf( |
1436 '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1472 '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1437 esc_url( admin_url( 'upload.php' ) ), |
1473 esc_url( admin_url( 'upload.php' ) ), |
1438 $text, |
1474 $text, |
1439 __( 'Manage Uploads' ) |
1475 __( 'Manage Uploads' ) |
1440 ); ?> |
1476 ); |
|
1477 ?> |
1441 </li> |
1478 </li> |
1442 </ul> |
1479 </ul> |
1443 </div> |
1480 </div> |
1444 <?php |
1481 <?php |
1445 } |
1482 } |
1446 |
1483 |
1447 // Display Browser Nag Meta Box |
1484 // Display Browser Nag Meta Box |
1448 function wp_dashboard_browser_nag() { |
1485 function wp_dashboard_browser_nag() { |
1449 $notice = ''; |
1486 $notice = ''; |
1450 $response = wp_check_browser_version(); |
1487 $response = wp_check_browser_version(); |
1451 |
1488 |
1452 if ( $response ) { |
1489 if ( $response ) { |
1453 if ( $response['insecure'] ) { |
1490 if ( $response['insecure'] ) { |
1454 /* translators: %s: browser name and link */ |
1491 /* translators: %s: browser name and link */ |
1455 $msg = sprintf( __( "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." ), |
1492 $msg = sprintf( |
|
1493 __( "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." ), |
1456 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
1494 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
1457 ); |
1495 ); |
1458 } else { |
1496 } else { |
1459 /* translators: %s: browser name and link */ |
1497 /* translators: %s: browser name and link */ |
1460 $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), |
1498 $msg = sprintf( |
|
1499 __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), |
1461 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
1500 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
1462 ); |
1501 ); |
1463 } |
1502 } |
1464 |
1503 |
1465 $browser_nag_class = ''; |
1504 $browser_nag_class = ''; |
1466 if ( !empty( $response['img_src'] ) ) { |
1505 if ( ! empty( $response['img_src'] ) ) { |
1467 $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src']; |
1506 $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src']; |
1468 |
1507 |
1469 $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>'; |
1508 $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr( $response['update_url'] ) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>'; |
1470 $browser_nag_class = ' has-browser-icon'; |
1509 $browser_nag_class = ' has-browser-icon'; |
1471 } |
1510 } |
1472 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; |
1511 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; |
1473 |
1512 |
1474 $browsehappy = 'https://browsehappy.com/'; |
1513 $browsehappy = 'https://browsehappy.com/'; |
1475 $locale = get_user_locale(); |
1514 $locale = get_user_locale(); |
1476 if ( 'en_US' !== $locale ) |
1515 if ( 'en_US' !== $locale ) { |
1477 $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
1516 $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
|
1517 } |
1478 |
1518 |
1479 $notice .= '<p>' . sprintf( __( '<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>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>'; |
1519 $notice .= '<p>' . sprintf( __( '<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>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>'; |
1480 $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>'; |
1520 $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>'; |
1481 $notice .= '<div class="clear"></div>'; |
1521 $notice .= '<div class="clear"></div>'; |
1482 } |
1522 } |
1483 |
1523 |
1484 /** |
1524 /** |
1485 * Filters the notice output for the 'Browse Happy' nag meta box. |
1525 * Filters the notice output for the 'Browse Happy' nag meta box. |
1486 * |
1526 * |
1487 * @since 3.2.0 |
1527 * @since 3.2.0 |
1488 * |
1528 * |
1489 * @param string $notice The notice content. |
1529 * @param string $notice The notice content. |
1490 * @param array $response An array containing web browser information. |
1530 * @param array $response An array containing web browser information. See `wp_check_browser_version()`. |
1491 */ |
1531 */ |
1492 echo apply_filters( 'browse-happy-notice', $notice, $response ); |
1532 echo apply_filters( 'browse-happy-notice', $notice, $response ); |
1493 } |
1533 } |
1494 |
1534 |
1495 /** |
1535 /** |
1496 * @since 3.2.0 |
1536 * @since 3.2.0 |
1513 * @since 3.2.0 |
1554 * @since 3.2.0 |
1514 * |
1555 * |
1515 * @return array|bool False on failure, array of browser data on success. |
1556 * @return array|bool False on failure, array of browser data on success. |
1516 */ |
1557 */ |
1517 function wp_check_browser_version() { |
1558 function wp_check_browser_version() { |
1518 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) |
1559 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
1519 return false; |
1560 return false; |
|
1561 } |
1520 |
1562 |
1521 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); |
1563 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); |
1522 |
1564 |
1523 if ( false === ($response = get_site_transient('browser_' . $key) ) ) { |
1565 if ( false === ( $response = get_site_transient( 'browser_' . $key ) ) ) { |
1524 // include an unmodified $wp_version |
1566 // include an unmodified $wp_version |
1525 include( ABSPATH . WPINC . '/version.php' ); |
1567 include( ABSPATH . WPINC . '/version.php' ); |
1526 |
1568 |
1527 $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; |
1569 $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; |
1528 $options = array( |
1570 $options = array( |
1529 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), |
1571 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), |
1530 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) |
1572 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), |
1531 ); |
1573 ); |
1532 |
1574 |
1533 if ( wp_http_supports( array( 'ssl' ) ) ) { |
1575 if ( wp_http_supports( array( 'ssl' ) ) ) { |
1534 $url = set_url_scheme( $url, 'https' ); |
1576 $url = set_url_scheme( $url, 'https' ); |
1535 } |
1577 } |
1536 |
1578 |
1537 $response = wp_remote_post( $url, $options ); |
1579 $response = wp_remote_post( $url, $options ); |
1538 |
1580 |
1539 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
1581 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
1540 return false; |
1582 return false; |
|
1583 } |
1541 |
1584 |
1542 /** |
1585 /** |
1543 * Response should be an array with: |
1586 * Response should be an array with: |
1544 * 'platform' - string - A user-friendly platform name, if it can be determined |
1587 * 'platform' - string - A user-friendly platform name, if it can be determined |
1545 * 'name' - string - A user-friendly browser name |
1588 * 'name' - string - A user-friendly browser name |
1551 * 'img_src' - string - An image representing the browser |
1594 * 'img_src' - string - An image representing the browser |
1552 * 'img_src_ssl' - string - An image (over SSL) representing the browser |
1595 * 'img_src_ssl' - string - An image (over SSL) representing the browser |
1553 */ |
1596 */ |
1554 $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
1597 $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
1555 |
1598 |
1556 if ( ! is_array( $response ) ) |
1599 if ( ! is_array( $response ) ) { |
1557 return false; |
1600 return false; |
|
1601 } |
1558 |
1602 |
1559 set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); |
1603 set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); |
1560 } |
1604 } |
1561 |
1605 |
1562 return $response; |
1606 return $response; |
|
1607 } |
|
1608 |
|
1609 /** |
|
1610 * Displays the PHP update nag. |
|
1611 * |
|
1612 * @since 5.1.0 |
|
1613 */ |
|
1614 function wp_dashboard_php_nag() { |
|
1615 $response = wp_check_php_version(); |
|
1616 |
|
1617 if ( ! $response ) { |
|
1618 return; |
|
1619 } |
|
1620 |
|
1621 if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) { |
|
1622 $msg = __( 'WordPress has detected that your site is running on an insecure version of PHP.' ); |
|
1623 } else { |
|
1624 $msg = __( 'WordPress has detected that your site is running on an outdated version of PHP.' ); |
|
1625 } |
|
1626 |
|
1627 ?> |
|
1628 <p><?php echo $msg; ?></p> |
|
1629 |
|
1630 <h3><?php _e( 'What is PHP and how does it affect my site?' ); ?></h3> |
|
1631 <p><?php _e( 'PHP is the programming language we use to build and maintain WordPress. Newer versions of PHP are both faster and more secure, so updating will have a positive effect on your site’s performance.' ); ?></p> |
|
1632 |
|
1633 <p class="button-container"> |
|
1634 <?php |
|
1635 printf( |
|
1636 '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', |
|
1637 esc_url( wp_get_update_php_url() ), |
|
1638 __( 'Learn more about updating PHP' ), |
|
1639 /* translators: accessibility text */ |
|
1640 __( '(opens in a new tab)' ) |
|
1641 ); |
|
1642 ?> |
|
1643 </p> |
|
1644 <?php |
|
1645 |
|
1646 wp_update_php_annotation(); |
|
1647 wp_direct_php_update_button(); |
|
1648 } |
|
1649 |
|
1650 /** |
|
1651 * Adds an additional class to the PHP nag if the current version is insecure. |
|
1652 * |
|
1653 * @since 5.1.0 |
|
1654 * |
|
1655 * @param array $classes Metabox classes. |
|
1656 * @return array Modified metabox classes. |
|
1657 */ |
|
1658 function dashboard_php_nag_class( $classes ) { |
|
1659 $response = wp_check_php_version(); |
|
1660 |
|
1661 if ( $response && isset( $response['is_secure'] ) && ! $response['is_secure'] ) { |
|
1662 $classes[] = 'php-insecure'; |
|
1663 } |
|
1664 |
|
1665 return $classes; |
1563 } |
1666 } |
1564 |
1667 |
1565 /** |
1668 /** |
1566 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). |
1669 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). |
1567 */ |
1670 */ |
1600 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
1703 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
1601 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
1704 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
1602 <?php else : ?> |
1705 <?php else : ?> |
1603 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
1706 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
1604 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
1707 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
|
1708 <li><?php printf( '<a href="%s" class="welcome-icon welcome-setup-home">' . __( 'Set up your homepage' ) . '</a>', current_user_can( 'customize' ) ? add_query_arg( 'autofocus[section]', 'static_front_page', admin_url( 'customize.php' ) ) : admin_url( 'options-reading.php' ) ); ?></li> |
1605 <?php endif; ?> |
1709 <?php endif; ?> |
1606 <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li> |
1710 <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li> |
1607 </ul> |
1711 </ul> |
1608 </div> |
1712 </div> |
1609 <div class="welcome-panel-column welcome-panel-last"> |
1713 <div class="welcome-panel-column welcome-panel-last"> |
1610 <h3><?php _e( 'More Actions' ); ?></h3> |
1714 <h3><?php _e( 'More Actions' ); ?></h3> |
1611 <ul> |
1715 <ul> |
1612 <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?> |
1716 <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?> |
1613 <li><div class="welcome-icon welcome-widgets-menus"><?php |
1717 <li><div class="welcome-icon welcome-widgets-menus"> |
1614 if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) { |
1718 <?php |
1615 printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ), |
1719 if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) { |
1616 admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) ); |
1720 printf( |
1617 } elseif ( current_theme_supports( 'widgets' ) ) { |
1721 __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ), |
1618 echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>'; |
1722 admin_url( 'widgets.php' ), |
1619 } else { |
1723 admin_url( 'nav-menus.php' ) |
1620 echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>'; |
1724 ); |
1621 } |
1725 } elseif ( current_theme_supports( 'widgets' ) ) { |
1622 ?></div></li> |
1726 echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>'; |
|
1727 } else { |
|
1728 echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>'; |
|
1729 } |
|
1730 ?> |
|
1731 </div></li> |
1623 <?php endif; ?> |
1732 <?php endif; ?> |
1624 <?php if ( current_user_can( 'manage_options' ) ) : ?> |
1733 <?php if ( current_user_can( 'manage_options' ) ) : ?> |
1625 <li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li> |
1734 <li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li> |
1626 <?php endif; ?> |
1735 <?php endif; ?> |
1627 <li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li> |
1736 <li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li> |
1629 </div> |
1738 </div> |
1630 </div> |
1739 </div> |
1631 </div> |
1740 </div> |
1632 <?php |
1741 <?php |
1633 } |
1742 } |
1634 |
|
1635 /** |
|
1636 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg |
|
1637 * |
|
1638 * @since 4.9.8 |
|
1639 */ |
|
1640 function wp_try_gutenberg_panel() { |
|
1641 $plugins = get_plugins(); |
|
1642 $action = $url = $classes = ''; |
|
1643 $classic_action = $classic_url = $classic_classes = ''; |
|
1644 |
|
1645 if ( current_user_can( 'install_plugins' ) ) { |
|
1646 if ( empty( $plugins['gutenberg/gutenberg.php'] ) ) { |
|
1647 if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) { |
|
1648 $action = __( 'Install Gutenberg' ); |
|
1649 $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' ); |
|
1650 $classes = ' install-now'; |
|
1651 } |
|
1652 } else if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) { |
|
1653 $action = __( 'Activate Gutenberg' ); |
|
1654 $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' ); |
|
1655 $classes = ' activate-now'; |
|
1656 } |
|
1657 |
|
1658 if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { |
|
1659 if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) { |
|
1660 $classic_action = __( 'Install the Classic Editor' ); |
|
1661 $classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' ); |
|
1662 $classic_classes = ' install-now'; |
|
1663 } |
|
1664 } else if ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { |
|
1665 $classic_action = __( 'Activate the Classic Editor' ); |
|
1666 $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' ); |
|
1667 $classic_classes = ' activate-now'; |
|
1668 } else { |
|
1669 $classic_action = __( 'The Classic Editor is activated' ); |
|
1670 $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' );; |
|
1671 $classic_classes = ' button-disabled install-now updated-message'; |
|
1672 } |
|
1673 } |
|
1674 |
|
1675 if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) { |
|
1676 $action = __( 'Try Gutenberg' ); |
|
1677 $url = admin_url( 'admin.php?page=gutenberg' ); |
|
1678 } |
|
1679 |
|
1680 ?> |
|
1681 <div class="try-gutenberg-panel-content"> |
|
1682 <h2><?php _e( 'A new, modern publishing experience is coming soon.' ); ?></h2> |
|
1683 |
|
1684 <p class="about-description"><?php _e( "Take your words, media, and layout in new directions with Gutenberg, the WordPress editor we're currently building." ); ?></p> |
|
1685 |
|
1686 <hr /> |
|
1687 |
|
1688 <div class="try-gutenberg-panel-column-container"> |
|
1689 <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column"> |
|
1690 <picture> |
|
1691 <source srcset="about:blank" media="(max-width: 1024px)"> |
|
1692 <img src="https://s.w.org/images/core/gutenberg-screenshot.png?<?php echo date( 'Ymd' ); ?>" alt="<?php esc_attr_e( 'Screenshot from the Gutenberg interface' ); ?>" /> |
|
1693 </picture> |
|
1694 </div> |
|
1695 <div class="try-gutenberg-panel-column plugin-card-gutenberg"> |
|
1696 |
|
1697 <div> |
|
1698 <h3><?php _e( 'Test the new editor today.' ); ?></h3> |
|
1699 |
|
1700 <p> |
|
1701 <?php _e( "You can take Gutenberg for a spin (and share your feedback, if you’d like) before we officially release it, by installing it as a plugin." ); ?> |
|
1702 <?php |
|
1703 printf( |
|
1704 /* translators: 1: Gutenberg call for testing handbook link, 2: Gutenberg GitHub repository issues link, 3: Gutenberg GitHub repository CONTRIBUTING.md link */ |
|
1705 __( 'You can help by <a href="%1$s">testing</a>, <a href="%2$s">filing bugs</a>, or contributing on the <a href="%3$s">GitHub repository</a>.' ), |
|
1706 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/', |
|
1707 'https://github.com/WordPress/gutenberg/issues', |
|
1708 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md' |
|
1709 ); |
|
1710 ?> |
|
1711 </p> |
|
1712 </div> |
|
1713 |
|
1714 <div class="try-gutenberg-action"> |
|
1715 <?php if ( $action ) { ?> |
|
1716 <p><a class="button button-primary button-hero<?php echo $classes; ?>" href="<?php echo esc_url( $url ); ?>" data-name="<?php esc_attr_e( 'Gutenberg' ); ?>" data-slug="gutenberg"><?php echo $action; ?></a></p> |
|
1717 <?php } ?> |
|
1718 |
|
1719 <p> |
|
1720 <?php |
|
1721 $learnmore = sprintf( |
|
1722 /* translators: Link to https://wordpress.org/gutenberg/ */ |
|
1723 __( '<a href="%s">Learn more about Gutenberg</a>' ), |
|
1724 __( 'https://wordpress.org/gutenberg/' ) |
|
1725 ); |
|
1726 |
|
1727 /** |
|
1728 * Filters the "Learn more" link in the Try Gutenberg panel. |
|
1729 * |
|
1730 * It allows hosts or site owners to change the link, to provide extra |
|
1731 * information about Gutenberg, specific to their service. |
|
1732 * |
|
1733 * WARNING: This filter will only exist in the 4.9.x series, it will not be |
|
1734 * added to WordPress 5.0 and later. |
|
1735 * |
|
1736 * @since 4.9.8 |
|
1737 */ |
|
1738 echo apply_filters( 'try_gutenberg_learn_more_link', $learnmore ); |
|
1739 ?> |
|
1740 </p> |
|
1741 </div> |
|
1742 </div> |
|
1743 |
|
1744 <div class="try-gutenberg-panel-column plugin-card-classic-editor"> |
|
1745 |
|
1746 <div> |
|
1747 <h3><?php _e( 'Not quite ready?' ); ?></h3> |
|
1748 |
|
1749 <p> |
|
1750 <?php _e( 'The new editor will be enabled by default in the next major release of WordPress. If you’re not sure how compatible your current themes and plugins are, we’ve got you covered.' ); ?> |
|
1751 <?php |
|
1752 printf( |
|
1753 /* translators: Link to the Classic Editor plugin page */ |
|
1754 __( 'Install the <a href="%s">Classic Editor plugin</a> to keep using the current editor until you’re ready to make the switch.' ), |
|
1755 __( 'https://wordpress.org/plugins/classic-editor' ) |
|
1756 ); |
|
1757 ?> |
|
1758 </p> |
|
1759 </div> |
|
1760 |
|
1761 <?php if ( $classic_action ) { ?> |
|
1762 <div class="try-gutenberg-action"> |
|
1763 <p><a class="button button-secondary button-hero<?php echo $classic_classes; ?>" href="<?php echo esc_url( $classic_url ); ?>" data-name="<?php esc_attr_e( 'Classic Editor' ); ?>" data-slug="classic-editor"><?php echo $classic_action; ?></a></p> |
|
1764 </div> |
|
1765 <?php } ?> |
|
1766 </div> |
|
1767 </div> |
|
1768 </div> |
|
1769 <?php |
|
1770 } |
|