PluginProbe
Gutenberg / 14.5.2
Gutenberg v14.5.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/block-library/blocks/comment-content.php +25 -3 12.6.0 → 14.5.2 View file →
@@ -17,18 +17,39 @@
17 17 if ( ! isset( $block->context['commentId'] ) ) {
18 18 return '';
19 19 }
20 20
21 - $comment = get_comment( $block->context['commentId'] );
21 + $comment = get_comment( $block->context['commentId'] );
22 + $commenter = wp_get_current_commenter();
23 + $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
22 24 if ( empty( $comment ) ) {
23 25 return '';
24 26 }
25 27
26 - $comment_text = get_comment_text( $comment );
28 + $args = array();
29 + $comment_text = get_comment_text( $comment, $args );
27 30 if ( ! $comment_text ) {
28 31 return '';
29 32 }
30 33
34 + /** This filter is documented in wp-includes/comment-template.php */
35 + $comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args );
36 +
37 + $moderation_note = '';
38 + if ( '0' === $comment->comment_approved ) {
39 + $commenter = wp_get_current_commenter();
40 +
41 + if ( $commenter['comment_author_email'] ) {
42 + $moderation_note = __( 'Your comment is awaiting moderation.' );
43 + } else {
44 + $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' );
45 + }
46 + $moderation_note = '<p><em class="comment-awaiting-moderation">' . $moderation_note . '</em></p>';
47 + if ( ! $show_pending_links ) {
48 + $comment_text = wp_kses( $comment_text, array() );
49 + }
50 + }
51 +
31 52 $classes = '';
32 53 if ( isset( $attributes['textAlign'] ) ) {
33 54 $classes .= 'has-text-align-' . $attributes['textAlign'];
34 55 }
@@ -35,10 +56,11 @@
35 56
36 57 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
37 58
38 59 return sprintf(
39 - '<div %1$s>%2$s</div>',
60 + '<div %1$s>%2$s%3$s</div>',
40 61 $wrapper_attributes,
62 + $moderation_note,
41 63 $comment_text
42 64 );
43 65 }
44 66