Changeset 47084 for trunk/src/wp-admin/includes/dashboard.php
- Timestamp:
- 01/18/2020 12:52:28 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/dashboard.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/dashboard.php
r47069 r47084 57 57 } 58 58 59 // Right Now 59 // Right Now. 60 60 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { 61 61 wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); … … 66 66 } 67 67 68 // Activity Widget 68 // Activity Widget. 69 69 if ( is_blog_admin() ) { 70 70 wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); 71 71 } 72 72 73 // QuickPress Widget 73 // QuickPress Widget. 74 74 if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { 75 75 $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' ) ); … … 77 77 } 78 78 79 // WordPress Events and News 79 // WordPress Events and News. 80 80 wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); 81 81 … … 140 140 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) { 141 141 check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); 142 ob_start(); // hack - but the same hack wp-admin/widgets.php uses142 ob_start(); // Hack - but the same hack wp-admin/widgets.php uses. 143 143 wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); 144 144 ob_end_clean(); … … 279 279 <ul> 280 280 <?php 281 // Posts and Pages 281 // Posts and Pages. 282 282 foreach ( array( 'post', 'page' ) as $post_type ) { 283 283 $num_posts = wp_count_posts( $post_type ); … … 299 299 } 300 300 } 301 // Comments 301 // Comments. 302 302 $num_comm = wp_count_comments(); 303 303 if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { … … 507 507 508 508 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ 509 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID 509 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID. 510 510 if ( $last_post_id ) { 511 511 $post = get_post( $last_post_id ); 512 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore 512 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore. 513 513 $post = get_default_post_to_edit( 'post', true ); 514 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 514 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID. 515 515 } else { 516 $post->post_title = ''; // Remove the auto draft title 516 $post->post_title = ''; // Remove the auto draft title. 517 517 } 518 518 } else { … … 521 521 // Don't create an option if this is a super admin who does not belong to this site. 522 522 if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) { 523 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 523 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID. 524 524 } 525 525 } … … 761 761 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; 762 762 763 // Reply and quickedit need a hide-if-no-js span 763 // Reply and quickedit need a hide-if-no-js span. 764 764 if ( 'reply' == $action || 'quickedit' == $action ) { 765 765 $action .= ' hide-if-no-js'; … … 1109 1109 ob_start(); 1110 1110 call_user_func_array( $callback, $args ); 1111 set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds) 1111 // Default lifetime in cache of 12 hours (same as the feeds). 1112 set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); 1112 1113 } 1113 1114 … … 1164 1165 } 1165 1166 1166 $number = 1; // Hack to use wp_widget_rss_form() 1167 $number = 1; // Hack to use wp_widget_rss_form(). 1168 1167 1169 $widget_options[ $widget_id ]['number'] = $number; 1168 1170 … … 1663 1665 $response = get_site_transient( 'browser_' . $key ); 1664 1666 if ( false === $response ) { 1665 // include an unmodified $wp_version1667 // Include an unmodified $wp_version. 1666 1668 include( ABSPATH . WPINC . '/version.php' ); 1667 1669
Note: See TracChangeset
for help on using the changeset viewer.