diff --git a/wp-includes/class-walker-comment.php b/wp-includes/class-walker-comment.php index ffe503d0fa..eac430112e 100644 --- a/wp-includes/class-walker-comment.php +++ b/wp-includes/class-walker-comment.php @@ -182,7 +182,7 @@ class Walker_Comment extends Walker { } if ( 'comment' === $comment->comment_type ) { - add_filter( 'comment_text', array( $this, 'comment_text' ), 40, 2 ); + add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); } if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) { @@ -200,7 +200,7 @@ class Walker_Comment extends Walker { } if ( 'comment' === $comment->comment_type ) { - remove_filter( 'comment_text', array( $this, 'comment_text' ), 40, 2 ); + remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); } } @@ -253,20 +253,23 @@ class Walker_Comment extends Walker { } /** - * Remove links from the pending comment's text if the commenter has not consent to the comment cookie. + * Filters the comment text. + * + * Removes links from the pending comment's text if the commenter did not consent + * to the comment cookies. * * @since 5.4.2 * * @param string $comment_text Text of the current comment. - * @param WP_Comment|null $comment The comment object. - * @return string Text of the current comment. + * @param WP_Comment|null $comment The comment object. Null if not found. + * @return string Filtered text of the current comment. */ - function comment_text( $comment_text, $comment ) { + public function filter_comment_text( $comment_text, $comment ) { $commenter = wp_get_current_commenter(); $show_pending_links = ! empty( $commenter['comment_author'] ); - if ( '0' == $comment->comment_approved && ! $show_pending_links ) { - return wp_kses( $comment_text, array() ); + if ( $comment && '0' == $comment->comment_approved && ! $show_pending_links ) { + $comment_text = wp_kses( $comment_text, array() ); } return $comment_text; @@ -294,12 +297,12 @@ class Walker_Comment extends Walker { $commenter = wp_get_current_commenter(); $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; + if ( $commenter['comment_author_email'] ) { $moderation_note = __( 'Your comment is awaiting moderation.' ); } else { $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' ); } - ?> < has_children ? 'parent' : '', $comment ); ?> id="comment-"> @@ -313,9 +316,11 @@ class Walker_Comment extends Walker { ?> comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } + printf( /* translators: %s: Comment author link. */ __( '%s says:' ), @@ -390,12 +395,12 @@ class Walker_Comment extends Walker { $commenter = wp_get_current_commenter(); $show_pending_links = ! empty( $commenter['comment_author'] ); + if ( $commenter['comment_author_email'] ) { $moderation_note = __( 'Your comment is awaiting moderation.' ); } else { $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' ); } - ?> < id="comment-" has_children ? 'parent' : '', $comment ); ?>>
@@ -408,9 +413,11 @@ class Walker_Comment extends Walker { ?> comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } + printf( /* translators: %s: Comment author link. */ __( '%s says:' ), diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index d792bffd9c..104293b1bc 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1018,7 +1018,7 @@ function comment_text( $comment_ID = 0, $args = array() ) { * @see Walker_Comment::comment() * * @param string $comment_text Text of the current comment. - * @param WP_Comment|null $comment The comment object. + * @param WP_Comment|null $comment The comment object. Null if not found. * @param array $args An array of arguments. */ echo apply_filters( 'comment_text', $comment_text, $comment, $args ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 943e6e5625..261a212db4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47887'; +$wp_version = '5.5-alpha-47889'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.