Ticket #49215: 49215.patch
| File 49215.patch, 4.4 KB (added by , 6 years ago) |
|---|
-
wp-admin/includes/dashboard.php
56 56 wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' ); 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' ); 62 62 } … … 65 65 wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_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' ) ); 76 76 wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); 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 82 82 if ( is_network_admin() ) { … … 278 278 <div class="main"> 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 ); 284 284 if ( $num_posts && $num_posts->publish ) { … … 298 298 } 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 ) ) { 304 304 /* translators: %s: Number of comments. */ … … 506 506 } 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 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 { 519 519 $post = get_default_post_to_edit( 'post', true ); … … 520 520 $user_id = get_current_user_id(); 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 } 526 526 … … 760 760 ++$i; 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'; 766 766 } … … 1108 1108 array_unshift( $args, $widget_id, $check_urls ); 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 set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds). 1112 1112 } 1113 1113 1114 1114 return true; … … 1163 1163 $widget_options[ $widget_id ] = array(); 1164 1164 } 1165 1165 1166 $number = 1; // Hack to use wp_widget_rss_form() 1166 $number = 1; // Hack to use wp_widget_rss_form(). 1167 1167 $widget_options[ $widget_id ]['number'] = $number; 1168 1168 1169 1169 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {