Changeset 47890
- Timestamp:
- 06/02/2020 09:02:49 PM (5 years ago)
- Location:
- branches/5.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.4
-
branches/5.4/src/wp-includes/class-walker-comment.php
r47888 r47890 183 183 184 184 if ( 'comment' === $comment->comment_type ) { 185 add_filter( 'comment_text', array( $this, ' comment_text' ), 40, 2 );185 add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); 186 186 } 187 187 … … 201 201 202 202 if ( 'comment' === $comment->comment_type ) { 203 remove_filter( 'comment_text', array( $this, ' comment_text' ), 40, 2 );203 remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); 204 204 } 205 205 } … … 254 254 255 255 /** 256 * Remove links from the pending comment's text if the commenter has not consent to the comment cookie. 256 * Filters the comment text. 257 * 258 * Removes links from the pending comment's text if the commenter did not consent 259 * to the comment cookies. 257 260 * 258 261 * @since 5.4.2 259 262 * 260 263 * @param string $comment_text Text of the current comment. 261 * @param WP_Comment|null $comment The comment object. 262 * @return string Text of the current comment.263 */ 264 functioncomment_text( $comment_text, $comment ) {264 * @param WP_Comment|null $comment The comment object. Null if not found. 265 * @return string Filtered text of the current comment. 266 */ 267 public function filter_comment_text( $comment_text, $comment ) { 265 268 $commenter = wp_get_current_commenter(); 266 269 $show_pending_links = ! empty( $commenter['comment_author'] ); 267 270 268 if ( '0' == $comment->comment_approved && ! $show_pending_links ) {269 returnwp_kses( $comment_text, array() );271 if ( $comment && '0' == $comment->comment_approved && ! $show_pending_links ) { 272 $comment_text = wp_kses( $comment_text, array() ); 270 273 } 271 274 … … 295 298 $commenter = wp_get_current_commenter(); 296 299 $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; 300 297 301 if ( $commenter['comment_author_email'] ) { 298 302 $moderation_note = __( 'Your comment is awaiting moderation.' ); … … 300 304 $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' ); 301 305 } 302 303 306 ?> 304 307 <<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>"> … … 314 317 <?php 315 318 $comment_author = get_comment_author_link( $comment ); 319 316 320 if ( '0' == $comment->comment_approved && ! $show_pending_links ) { 317 321 $comment_author = get_comment_author( $comment ); 318 322 } 323 319 324 printf( 320 325 /* translators: %s: Comment author link. */ … … 391 396 $commenter = wp_get_current_commenter(); 392 397 $show_pending_links = ! empty( $commenter['comment_author'] ); 398 393 399 if ( $commenter['comment_author_email'] ) { 394 400 $moderation_note = __( 'Your comment is awaiting moderation.' ); … … 396 402 $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' ); 397 403 } 398 399 404 ?> 400 405 <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>> … … 409 414 <?php 410 415 $comment_author = get_comment_author_link( $comment ); 416 411 417 if ( '0' == $comment->comment_approved && ! $show_pending_links ) { 412 418 $comment_author = get_comment_author( $comment ); 413 419 } 420 414 421 printf( 415 422 /* translators: %s: Comment author link. */ -
branches/5.4/src/wp-includes/comment-template.php
r47366 r47890 1017 1017 * 1018 1018 * @param string $comment_text Text of the current comment. 1019 * @param WP_Comment|null $comment The comment object. 1019 * @param WP_Comment|null $comment The comment object. Null if not found. 1020 1020 * @param array $args An array of arguments. 1021 1021 */
Note: See TracChangeset
for help on using the changeset viewer.