WordPress.org

Make WordPress Core

Changeset 48579


Ignore:
Timestamp:
07/23/2020 01:32:34 PM (14 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use a consistent naming pattern for variables in wp-includes/comment-template.php.

See #49542.

File:
1 edited

Legend:

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

    r48577 r48579  
    19201920    }
    19211921
    1922     $replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
    1923     $result    = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
    1924     $result   .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
     1922    $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
     1923    $result      = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
     1924    $result     .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$reply_to_id' />\n";
    19251925
    19261926    /**
     
    19291929     * @since 3.0.0
    19301930     *
    1931      * @param string $result    The HTML-formatted hidden ID field comment elements.
    1932      * @param int    $post_id   The post ID.
    1933      * @param int    $replytoid The ID of the comment being replied to.
    1934      */
    1935     return apply_filters( 'comment_id_fields', $result, $post_id, $replytoid );
     1931     * @param string $result      The HTML-formatted hidden ID field comment elements.
     1932     * @param int    $post_id     The post ID.
     1933     * @param int    $reply_to_id The ID of the comment being replied to.
     1934     */
     1935    return apply_filters( 'comment_id_fields', $result, $post_id, $reply_to_id );
    19361936}
    19371937
     
    19661966 * @global WP_Comment $comment Global comment object.
    19671967 *
    1968  * @param string $noreplytext  Optional. Text to display when not replying to a comment.
    1969  *                             Default false.
    1970  * @param string $replytext    Optional. Text to display when replying to a comment.
    1971  *                             Default false. Accepts "%s" for the author of the comment
    1972  *                             being replied to.
    1973  * @param string $linktoparent Optional. Boolean to control making the author's name a link
    1974  *                             to their comment. Default true.
    1975  */
    1976 function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
     1968 * @param string $no_reply_text  Optional. Text to display when not replying to a comment.
     1969 *                               Default false.
     1970 * @param string $reply_text     Optional. Text to display when replying to a comment.
     1971 *                               Default false. Accepts "%s" for the author of the comment
     1972 *                               being replied to.
     1973 * @param string $link_to_parent Optional. Boolean to control making the author's name a link
     1974 *                               to their comment. Default true.
     1975 */
     1976function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) {
    19771977    global $comment;
    19781978
    1979     if ( false === $noreplytext ) {
    1980         $noreplytext = __( 'Leave a Reply' );
    1981     }
    1982     if ( false === $replytext ) {
     1979    if ( false === $no_reply_text ) {
     1980        $no_reply_text = __( 'Leave a Reply' );
     1981    }
     1982
     1983    if ( false === $reply_text ) {
    19831984        /* translators: %s: Author of the comment being replied to. */
    1984         $replytext = __( 'Leave a Reply to %s' );
    1985     }
    1986 
    1987     $replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
    1988 
    1989     if ( 0 == $replytoid ) {
    1990         echo $noreplytext;
     1985        $reply_text = __( 'Leave a Reply to %s' );
     1986    }
     1987
     1988    $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
     1989
     1990    if ( 0 == $reply_to_id ) {
     1991        echo $no_reply_text;
    19911992    } else {
    19921993        // Sets the global so that template tags can be used in the comment form.
    1993         $comment = get_comment( $replytoid );
    1994         $author  = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
    1995         printf( $replytext, $author );
     1994        $comment = get_comment( $reply_to_id );
     1995
     1996        if ( $link_to_parent ) {
     1997            $author = '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>';
     1998        } else {
     1999            $author = get_comment_author( $comment );
     2000        }
     2001
     2002        printf( $reply_text, $author );
    19962003    }
    19972004}
Note: See TracChangeset for help on using the changeset viewer.