Make WordPress Core

Ticket #49215: 49215.patch

File 49215.patch, 4.4 KB (added by passoniate, 6 years ago)

Patch

  • wp-admin/includes/dashboard.php

     
    5656                wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
    5757        }
    5858
    59         // Right Now
     59        // Right Now.
    6060        if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    6161                wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
    6262        }
     
    6565                wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
    6666        }
    6767
    68         // Activity Widget
     68        // Activity Widget.
    6969        if ( is_blog_admin() ) {
    7070                wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
    7171        }
    7272
    73         // QuickPress Widget
     73        // QuickPress Widget.
    7474        if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    7575                $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' ) );
    7676                wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
    7777        }
    7878
    79         // WordPress Events and News
     79        // WordPress Events and News.
    8080        wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' );
    8181
    8282        if ( is_network_admin() ) {
     
    278278        <div class="main">
    279279        <ul>
    280280        <?php
    281         // Posts and Pages
     281        // Posts and Pages.
    282282        foreach ( array( 'post', 'page' ) as $post_type ) {
    283283                $num_posts = wp_count_posts( $post_type );
    284284                if ( $num_posts && $num_posts->publish ) {
     
    298298                        }
    299299                }
    300300        }
    301         // Comments
     301        // Comments.
    302302        $num_comm = wp_count_comments();
    303303        if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
    304304                /* translators: %s: Number of comments. */
     
    506506        }
    507507
    508508        /* 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.
    510510        if ( $last_post_id ) {
    511511                $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.
    513513                        $post = get_default_post_to_edit( 'post', true );
    514514                        update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
    515515                } else {
    516                         $post->post_title = ''; // Remove the auto draft title
     516                        $post->post_title = ''; // Remove the auto draft title.
    517517                }
    518518        } else {
    519519                $post    = get_default_post_to_edit( 'post', true );
     
    520520                $user_id = get_current_user_id();
    521521                // Don't create an option if this is a super admin who does not belong to this site.
    522522                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.
    524524                }
    525525        }
    526526
     
    760760                        ++$i;
    761761                        ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
    762762
    763                         // Reply and quickedit need a hide-if-no-js span
     763                        // Reply and quickedit need a hide-if-no-js span.
    764764                        if ( 'reply' == $action || 'quickedit' == $action ) {
    765765                                $action .= ' hide-if-no-js';
    766766                        }
     
    11081108                array_unshift( $args, $widget_id, $check_urls );
    11091109                ob_start();
    11101110                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).
    11121112        }
    11131113
    11141114        return true;
     
    11631163                $widget_options[ $widget_id ] = array();
    11641164        }
    11651165
    1166         $number                                 = 1; // Hack to use wp_widget_rss_form()
     1166        $number                                 = 1; // Hack to use wp_widget_rss_form().
    11671167        $widget_options[ $widget_id ]['number'] = $number;
    11681168
    11691169        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {