Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 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/comment-template.php

    r47111 r47122  
    431431 */
    432432function comment_class( $class = '', $comment = null, $post_id = null, $echo = true ) {
    433     // Separates classes with a single space, collates classes for comment DIV
     433    // Separates classes with a single space, collates classes for comment DIV.
    434434    $class = 'class="' . join( ' ', get_comment_class( $class, $comment, $post_id ) ) . '"';
    435435
     
    466466    }
    467467
    468     // Get the comment type (comment, trackback),
     468    // Get the comment type (comment, trackback).
    469469    $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
    470470
     
    474474        $classes[] = 'byuser';
    475475        $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
    476         // For comment authors who are the author of the post
     476        // For comment authors who are the author of the post.
    477477        $post = get_post( $post_id );
    478478        if ( $post ) {
     
    502502    $comment_alt++;
    503503
    504     // Alt for top-level comments
     504    // Alt for top-level comments.
    505505    if ( 1 == $comment_depth ) {
    506506        if ( $comment_thread_alt % 2 ) {
     
    908908            if ( 'on' === _x( 'off', 'Comment number declension: on or off' ) ) {
    909909                $text = preg_replace( '#<span class="screen-reader-text">.+?</span>#', '', $more );
    910                 $text = preg_replace( '/&.+?;/', '', $text ); // Kill entities
     910                $text = preg_replace( '/&.+?;/', '', $text ); // Kill entities.
    911911                $text = trim( strip_tags( $text ), '% ' );
    912912
    913                 // Replace '% Comments' with a proper plural form
     913                // Replace '% Comments' with a proper plural form.
    914914                if ( $text && ! preg_match( '/[0-9]+/', $text ) && false !== strpos( $more, '%' ) ) {
    915915                    /* translators: %s: Number of comments. */
     
    928928    } elseif ( $number == 0 ) {
    929929        $output = ( false === $zero ) ? __( 'No Comments' ) : $zero;
    930     } else { // must be one
     930    } else { // Must be one.
    931931        $output = ( false === $one ) ? __( '1 Comment' ) : $one;
    932932    }
     
    15271527    } elseif ( file_exists( TEMPLATEPATH . $file ) ) {
    15281528        require( TEMPLATEPATH . $file );
    1529     } else { // Backward compat code will be removed in a future release
     1529    } else { // Backward compat code will be removed in a future release.
    15301530        require( ABSPATH . WPINC . '/theme-compat/comments.php' );
    15311531    }
     
    20532053    $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args );
    20542054
    2055     // Figure out what comments we'll be looping through ($_comments)
     2055    // Figure out what comments we'll be looping through ($_comments).
    20562056    if ( null !== $comments ) {
    20572057        $comments = (array) $comments;
     
    21772177        }
    21782178    }
    2179     // Validation check
     2179    // Validation check.
    21802180    $parsed_args['page'] = intval( $parsed_args['page'] );
    21812181    if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
     
    24532453    $args = array_merge( $defaults, $args );
    24542454
    2455     // Remove aria-describedby from the email field if there's no associated description.
     2455    // Remove `aria-describedby` from the email field if there's no associated description.
    24562456    if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) {
    24572457        $args['fields']['email'] = str_replace(
     
    25552555            $comment_fields = apply_filters( 'comment_form_fields', $comment_fields );
    25562556
    2557             // Get an array of field names, excluding the textarea
     2557            // Get an array of field names, excluding the textarea.
    25582558            $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
    25592559
    2560             // Get the first and the last field name, excluding the textarea
     2560            // Get the first and the last field name, excluding the textarea.
    25612561            $first_field = reset( $comment_field_keys );
    25622562            $last_field  = end( $comment_field_keys );
Note: See TracChangeset for help on using the changeset viewer.