Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r47104 r47122  
    704704function get_bloginfo( $show = '', $filter = 'raw' ) {
    705705        switch ( $show ) {
    706                 case 'home': // DEPRECATED
    707                 case 'siteurl': // DEPRECATED
     706                case 'home':    // Deprecated.
     707                case 'siteurl': // Deprecated.
    708708                        _deprecated_argument(
    709709                                __FUNCTION__,
    … …  
    10721072
    10731073                /*
    1074                 * If we're on the blog page that is not the homepage or
    1075                 * a single post of any post type, use the post title.
     1074                * If we're on the blog page that is not the homepage
     1075                * or a single post of any post type, use the post title.
    10761076                */
    10771077        } elseif ( is_home() || is_singular() ) {
    … …  
    11961196        $title    = '';
    11971197
    1198         $t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary
    1199 
    1200         // If there is a post
     1198        $t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary.
     1199
     1200        // If there is a post.
    12011201        if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
    12021202                $title = single_post_title( '', false );
    12031203        }
    12041204
    1205         // If there's a post type archive
     1205        // If there's a post type archive.
    12061206        if ( is_post_type_archive() ) {
    12071207                $post_type = get_query_var( 'post_type' );
    … …  
    12151215        }
    12161216
    1217         // If there's a category or tag
     1217        // If there's a category or tag.
    12181218        if ( is_category() || is_tag() ) {
    12191219                $title = single_term_title( '', false );
    12201220        }
    12211221
    1222         // If there's a taxonomy
     1222        // If there's a taxonomy.
    12231223        if ( is_tax() ) {
    12241224                $term = get_queried_object();
    … …  
    12291229        }
    12301230
    1231         // If there's an author
     1231        // If there's an author.
    12321232        if ( is_author() && ! is_post_type_archive() ) {
    12331233                $author = get_queried_object();
    … …  
    12421242        }
    12431243
    1244         // If there's a month
     1244        // If there's a month.
    12451245        if ( is_archive() && ! empty( $m ) ) {
    12461246                $my_year  = substr( $m, 0, 4 );
    … …  
    12501250        }
    12511251
    1252         // If there's a year
     1252        // If there's a year.
    12531253        if ( is_archive() && ! empty( $year ) ) {
    12541254                $title = $year;
    … …  
    12611261        }
    12621262
    1263         // If it's a search
     1263        // If it's a search.
    12641264        if ( is_search() ) {
    12651265                /* translators: 1: Separator, 2: Search query. */
    … …  
    12671267        }
    12681268
    1269         // If it's a 404 page
     1269        // If it's a 404 page.
    12701270        if ( is_404() ) {
    12711271                $title = __( 'Page not found' );
    … …  
    12861286        $title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
    12871287
    1288         // Determines position of the separator and direction of the breadcrumb
    1289         if ( 'right' == $seplocation ) { // sep on right, so reverse the order
     1288        // Determines position of the separator and direction of the breadcrumb.
     1289        if ( 'right' == $seplocation ) { // Separator on right, so reverse the order.
    12901290                $title_array = array_reverse( $title_array );
    12911291                $title       = implode( " $sep ", $title_array ) . $prefix;
    … …  
    13051305        $title = apply_filters( 'wp_title', $title, $sep, $seplocation );
    13061306
    1307         // Send it out
     1307        // Send it out.
    13081308        if ( $display ) {
    13091309                echo $title;
    … …  
    17481748        } elseif ( 'html' === $format ) {
    17491749                $link_html = "\t<li>$before<a href='$url'$aria_current>$text</a>$after</li>\n";
    1750         } else { // custom
     1750        } else { // Custom.
    17511751                $link_html = "\t$before<a href='$url'$aria_current>$text</a>$after\n";
    17521752        }
    … …  
    18511851        }
    18521852
    1853         // this is what will separate dates on weekly archive links
     1853        // This is what will separate dates on weekly archive links.
    18541854        $archive_week_separator = '&#8211;';
    18551855
    … …  
    20962096                $w = (int) $_GET['w'];
    20972097        }
    2098         // week_begins = 0 stands for Sunday
     2098        // week_begins = 0 stands for Sunday.
    20992099        $week_begins = (int) get_option( 'start_of_week' );
    21002100
    2101         // Let's figure out when we are
     2101        // Let's figure out when we are.
    21022102        if ( ! empty( $monthnum ) && ! empty( $year ) ) {
    21032103                $thismonth = zeroise( intval( $monthnum ), 2 );
    21042104                $thisyear  = (int) $year;
    21052105        } elseif ( ! empty( $w ) ) {
    2106                 // We need to get the month from MySQL
     2106                // We need to get the month from MySQL.
    21072107                $thisyear = (int) substr( $m, 0, 4 );
    2108                 //it seems MySQL's weeks disagree with PHP's
     2108                // It seems MySQL's weeks disagree with PHP's.
    21092109                $d         = ( ( $w - 1 ) * 7 ) + 6;
    21102110                $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" );
    … …  
    21242124        $last_day  = gmdate( 't', $unixmonth );
    21252125
    2126         // Get the next and previous month and year with at least one post
     2126        // Get the next and previous month and year with at least one post.
    21272127        $previous = $wpdb->get_row(
    21282128                "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
    … …  
    21992199        $daywithpost = array();
    22002200
    2201         // Get days with posts
     2201        // Get days with posts.
    22022202        $dayswithposts = $wpdb->get_results(
    22032203                "SELECT DISTINCT DAYOFMONTH(post_date)
    … …  
    22132213        }
    22142214
    2215         // See how much we should pad in the beginning
     2215        // See how much we should pad in the beginning.
    22162216        $pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins );
    22172217        if ( 0 != $pad ) {
    … …  
    22372237
    22382238                if ( in_array( $day, $daywithpost ) ) {
    2239                         // any posts today?
     2239                        // Any posts today?
    22402240                        $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
    22412241                        /* translators: Post calendar label. %s: Date. */
    … …  
    33403340                $wp_rich_edit = false;
    33413341
    3342                 if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users
     3342                if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // Default to 'true' for logged out users.
    33433343                        if ( $is_safari ) {
    33443344                                $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
    … …  
    33723372 */
    33733373function wp_default_editor() {
    3374         $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
    3375         if ( wp_get_current_user() ) { // look for cookie
     3374        $r = user_can_richedit() ? 'tinymce' : 'html'; // Defaults.
     3375        if ( wp_get_current_user() ) { // Look for cookie.
    33763376                $ed = get_user_setting( 'editor', 'tinymce' );
    33773377                $r  = ( in_array( $ed, array( 'tinymce', 'html', 'test' ) ) ) ? $ed : $r;
    … …  
    40954095
    40964096        $defaults = array(
    4097                 'base'               => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
    4098                 'format'             => $format, // ?page=%#% : %#% is replaced by the page number
     4097                'base'               => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below).
     4098                'format'             => $format, // ?page=%#% : %#% is replaced by the page number.
    40994099                'total'              => $total,
    41004100                'current'            => $current,
    … …  
    41074107                'mid_size'           => 2,
    41084108                'type'               => 'plain',
    4109                 'add_args'           => array(), // array of query args to add
     4109                'add_args'           => array(), // Array of query args to add.
    41104110                'add_fragment'       => '',
    41114111                'before_page_number' => '',
    … …  
    41374137        }
    41384138
    4139         // Who knows what else people pass in $args
     4139        // Who knows what else people pass in $args.
    41404140        $total = (int) $args['total'];
    41414141        if ( $total < 2 ) {
    … …  
    41434143        }
    41444144        $current  = (int) $args['current'];
    4145         $end_size = (int) $args['end_size']; // Out of bounds?  Make it the default.
     4145        $end_size = (int) $args['end_size']; // Out of bounds? Make it the default.
    41464146        if ( $end_size < 1 ) {
    41474147                $end_size = 1;
    … …  
    43144314        );
    43154315
    4316         // Other color schemes are not available when running out of src
     4316        // Other color schemes are not available when running out of src.
    43174317        if ( false !== strpos( get_bloginfo( 'version' ), '-src' ) ) {
    43184318                return;
Note: See TracChangeset for help on using the changeset viewer.