Make WordPress Core


Ignore:
Timestamp:
01/18/2020 12:52:28 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve comments in some wp-admin files per the documentation standards.

Props passoniate.
Fixes #49215, #49216.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r47069 r47084  
    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' );
     
    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' ) );
     
    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
     
    140140    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
    141141        check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
    142         ob_start(); // hack - but the same hack wp-admin/widgets.php uses
     142        ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
    143143        wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
    144144        ob_end_clean();
     
    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 );
     
    299299        }
    300300    }
    301     // Comments
     301    // Comments.
    302302    $num_comm = wp_count_comments();
    303303    if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
     
    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 );
    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.
    515515        } else {
    516             $post->post_title = ''; // Remove the auto draft title
     516            $post->post_title = ''; // Remove the auto draft title.
    517517        }
    518518    } else {
     
    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    }
     
    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';
     
    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        // Default lifetime in cache of 12 hours (same as the feeds).
     1112        set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
    11121113    }
    11131114
     
    11641165    }
    11651166
    1166     $number                                 = 1; // Hack to use wp_widget_rss_form()
     1167    $number = 1; // Hack to use wp_widget_rss_form().
     1168
    11671169    $widget_options[ $widget_id ]['number'] = $number;
    11681170
     
    16631665    $response = get_site_transient( 'browser_' . $key );
    16641666    if ( false === $response ) {
    1665         // include an unmodified $wp_version
     1667        // Include an unmodified $wp_version.
    16661668        include( ABSPATH . WPINC . '/version.php' );
    16671669
Note: See TracChangeset for help on using the changeset viewer.