WordPress.org

Make WordPress Core

Ticket #22889: 22889.patch

File 22889.patch, 4.8 KB (added by joostdevalk, 5 years ago)

Patch v1

  • wp-includes/comment-template.php

     
    14381438                );
    14391439
    14401440                $link = sprintf( "<a class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
    1441                         esc_url( add_query_arg( 'replytocom', $comment->comment_ID, get_permalink( $post->ID ) ) ) . "#" . $args['respond_id'],
     1441                        esc_url( get_permalink( $post->ID ) ) . "#" . $args['respond_id'],
    14421442                        $onclick,
    14431443                        esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
    14441444                        $args['reply_text']
     
    15711571        if ( empty($text) )
    15721572                $text = __('Click here to cancel reply.');
    15731573
    1574         $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
    1575         $link = esc_html( remove_query_arg('replytocom') ) . '#respond';
     1574        $link = '#respond';
    15761575
    1577         $formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
     1576        $formatted_link = '<a id="cancel-comment-reply-link" href="' . $link . '">' . $text . '</a>';
    15781577        /**
    15791578         * Filter the cancel comment reply link HTML.
    15801579         *
     
    16101609        if ( empty( $id ) )
    16111610                $id = get_the_ID();
    16121611
    1613         $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
    16141612        $result  = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
    1615         $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
     1613        $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='0' />\n";
    16161614
    16171615        /**
    16181616         * Filter the returned comment id fields.
    16191617         *
    16201618         * @since 3.0.0
    16211619         *
    1622          * @param string $result    The HTML-formatted hidden id field comment elements.
    1623          * @param int    $id        The post ID.
    1624          * @param int    $replytoid The id of the comment being replied to.
     1620         * @param string $result     The HTML-formatted hidden id field comment elements.
     1621         * @param int    $id         The post ID.
     1622         * @param int    $deprecated No longer used
    16251623         */
    1626         return apply_filters( 'comment_id_fields', $result, $id, $replytoid );
     1624        return apply_filters( 'comment_id_fields', $result, $id, 0 );
    16271625}
    16281626
    16291627/**
     
    16481646 *
    16491647 * @param string $noreplytext  Optional. Text to display when not replying to a comment.
    16501648 *                             Default false.
    1651  * @param string $replytext    Optional. Text to display when replying to a comment.
    1652  *                             Default false. Accepts "%s" for the author of the comment
    1653  *                             being replied to.
    1654  * @param string $linktoparent Optional. Boolean to control making the author's name a link
    1655  *                             to their comment. Default true.
     1649 * @param string $deprecated   No longer used.
     1650 * @param string $deprecated_2 No longer used.
    16561651 */
    1657 function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
    1658         global $comment;
     1652function comment_form_title( $noreplytext, $deprecated, $deprecated_2 ) {
     1653        if ( !empty( $deprecated ) )
     1654                _deprecated_argument( __FUNCTION__, '4.3' );
     1655        if ( !empty( $deprecated_2 ) )
     1656                _deprecated_argument( __FUNCTION__, '4.3' );
    16591657
    16601658        if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
    1661         if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
    16621659
    1663         $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
    1664 
    1665         if ( 0 == $replytoid )
    1666                 echo $noreplytext;
    1667         else {
    1668                 $comment = get_comment($replytoid);
    1669                 $author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author() . '</a>' : get_comment_author();
    1670                 printf( $replytext, $author );
    1671         }
     1660        echo $noreplytext;
    16721661}
    16731662
    16741663/**
  • wp-includes/default-filters.php

     
    231231add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
    232232add_action( 'wp_print_styles',     'print_emoji_styles'                     );
    233233
    234 if ( isset( $_GET['replytocom'] ) )
    235     add_action( 'wp_head', 'wp_no_robots' );
    236 
    237234// Login actions
    238235add_action( 'login_head',          'wp_print_head_scripts',         9     );
    239236add_action( 'login_footer',        'wp_print_footer_scripts',       20    );
  • wp-includes/theme-compat/comments.php

     
    6565
    6666<div id="respond">
    6767
    68 <h3><?php comment_form_title( __('Leave a Reply'), __('Leave a Reply to %s' ) ); ?></h3>
     68<h3><?php _e('Leave a Reply'); ?></h3>
    6969
    7070<div id="cancel-comment-reply">
    7171        <small><?php cancel_comment_reply_link() ?></small>