From 9d11efe23c325e0e98c0b8306c259d29bbcb1d70 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 1 Jul 2015 21:42:25 +0000 Subject: [PATCH] Say goodbye to ?replytocom=123 links and their URL pollution. * Comment reply links continue to use JS as before. * ?replytocom=123 links are deprecated. props joostdevalk fixes #22889 Built from https://develop.svn.wordpress.org/trunk@33038 git-svn-id: http://core.svn.wordpress.org/trunk@33009 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 45 ++++++++++----------------- wp-includes/default-filters.php | 3 -- wp-includes/theme-compat/comments.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 26e2818b1d..8f34b3e643 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1438,7 +1438,7 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null ); $link = sprintf( "%s", - esc_url( add_query_arg( 'replytocom', $comment->comment_ID, get_permalink( $post->ID ) ) ) . "#" . $args['respond_id'], + esc_url( get_permalink( $post->ID ) ) . "#" . $args['respond_id'], $onclick, esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ), $args['reply_text'] @@ -1571,10 +1571,9 @@ function get_cancel_comment_reply_link( $text = '' ) { if ( empty($text) ) $text = __('Click here to cancel reply.'); - $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"'; - $link = esc_html( remove_query_arg('replytocom') ) . '#respond'; + $link = '#respond'; - $formatted_link = '' . $text . ''; + $formatted_link = '' . $text . ''; /** * Filter the cancel comment reply link HTML. * @@ -1610,20 +1609,19 @@ function get_comment_id_fields( $id = 0 ) { if ( empty( $id ) ) $id = get_the_ID(); - $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; $result = "\n"; - $result .= "\n"; + $result .= "\n"; /** * Filter the returned comment id fields. * * @since 3.0.0 * - * @param string $result The HTML-formatted hidden id field comment elements. - * @param int $id The post ID. - * @param int $replytoid The id of the comment being replied to. + * @param string $result The HTML-formatted hidden id field comment elements. + * @param int $id The post ID. + * @param int $deprecated No longer used. */ - return apply_filters( 'comment_id_fields', $result, $id, $replytoid ); + return apply_filters( 'comment_id_fields', $result, $id, 0 ); } /** @@ -1648,27 +1646,18 @@ function comment_id_fields( $id = 0 ) { * * @param string $noreplytext Optional. Text to display when not replying to a comment. * Default false. - * @param string $replytext Optional. Text to display when replying to a comment. - * Default false. Accepts "%s" for the author of the comment - * being replied to. - * @param string $linktoparent Optional. Boolean to control making the author's name a link - * to their comment. Default true. + * @param string $deprecated No longer used. + * @param string $deprecated_2 No longer used. */ -function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) { - global $comment; +function comment_form_title( $noreplytext, $deprecated = null, $deprecated_2 = null ) { + if ( ! is_null( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '4.3' ); + if ( ! is_null( $deprecated_2 ) ) + _deprecated_argument( __FUNCTION__, '4.3' ); if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' ); - if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' ); - $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; - - if ( 0 == $replytoid ) - echo $noreplytext; - else { - $comment = get_comment($replytoid); - $author = ( $linktoparent ) ? '' . get_comment_author() . '' : get_comment_author(); - printf( $replytext, $author ); - } + echo $noreplytext; } /** @@ -2294,7 +2283,7 @@ function comment_form( $args = array(), $post_id = null ) { do_action( 'comment_form_before' ); ?>
-

+

-

+

diff --git a/wp-includes/version.php b/wp-includes/version.php index 8ada82d056..0508db1451 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-33037'; +$wp_version = '4.3-alpha-33038'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.