Edit File by line
/home/zeestwma/ceyloniy.../wp-inclu.../blocks
File: comment-content.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/comment-content` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/comment-content` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.0.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes Block attributes.
[12] Fix | Delete
* @param string $content Block default content.
[13] Fix | Delete
* @param WP_Block $block Block instance.
[14] Fix | Delete
* @return string Return the post comment's content.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_comment_content( $attributes, $content, $block ) {
[17] Fix | Delete
if ( ! isset( $block->context['commentId'] ) ) {
[18] Fix | Delete
return '';
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
$comment = get_comment( $block->context['commentId'] );
[22] Fix | Delete
$commenter = wp_get_current_commenter();
[23] Fix | Delete
$show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
[24] Fix | Delete
if ( empty( $comment ) ) {
[25] Fix | Delete
return '';
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
$args = array();
[29] Fix | Delete
$comment_text = get_comment_text( $comment, $args );
[30] Fix | Delete
if ( ! $comment_text ) {
[31] Fix | Delete
return '';
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
/** This filter is documented in wp-includes/comment-template.php */
[35] Fix | Delete
$comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args );
[36] Fix | Delete
[37] Fix | Delete
$moderation_note = '';
[38] Fix | Delete
if ( '0' === $comment->comment_approved ) {
[39] Fix | Delete
$commenter = wp_get_current_commenter();
[40] Fix | Delete
[41] Fix | Delete
if ( $commenter['comment_author_email'] ) {
[42] Fix | Delete
$moderation_note = __( 'Your comment is awaiting moderation.' );
[43] Fix | Delete
} else {
[44] Fix | Delete
$moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' );
[45] Fix | Delete
}
[46] Fix | Delete
$moderation_note = '<p><em class="comment-awaiting-moderation">' . $moderation_note . '</em></p>';
[47] Fix | Delete
if ( ! $show_pending_links ) {
[48] Fix | Delete
$comment_text = wp_kses( $comment_text, array() );
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
$classes = array();
[53] Fix | Delete
if ( isset( $attributes['textAlign'] ) ) {
[54] Fix | Delete
$classes[] = 'has-text-align-' . $attributes['textAlign'];
[55] Fix | Delete
}
[56] Fix | Delete
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
[57] Fix | Delete
$classes[] = 'has-link-color';
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
[61] Fix | Delete
[62] Fix | Delete
return sprintf(
[63] Fix | Delete
'<div %1$s>%2$s%3$s</div>',
[64] Fix | Delete
$wrapper_attributes,
[65] Fix | Delete
$moderation_note,
[66] Fix | Delete
$comment_text
[67] Fix | Delete
);
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Registers the `core/comment-content` block on the server.
[72] Fix | Delete
*
[73] Fix | Delete
* @since 6.0.0
[74] Fix | Delete
*/
[75] Fix | Delete
function register_block_core_comment_content() {
[76] Fix | Delete
register_block_type_from_metadata(
[77] Fix | Delete
__DIR__ . '/comment-content',
[78] Fix | Delete
array(
[79] Fix | Delete
'render_callback' => 'render_block_core_comment_content',
[80] Fix | Delete
)
[81] Fix | Delete
);
[82] Fix | Delete
}
[83] Fix | Delete
add_action( 'init', 'register_block_core_comment_content' );
[84] Fix | Delete
[85] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function