File manager - Edit - /home/premiey/www/wp-includes/images/media/comments.php.tar
Back
home/premiey/www/wp-includes/blocks/comments.php 0000666 00000015072 15165341054 0016054 0 ustar 00 <?php /** * Server-side rendering of the `core/comments` block. * * @package WordPress */ /** * Renders the `core/comments` block on the server. * * This render callback is mainly for rendering a dynamic, legacy version of * this block (the old `core/post-comments`). It uses the `comments_template()` * function to generate the output, in the same way as classic PHP themes. * * As this callback will always run during SSR, first we need to check whether * the block is in legacy mode. If not, the HTML generated in the editor is * returned instead. * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * @return string Returns the filtered post comments for the current post wrapped inside "p" tags. */ function render_block_core_comments( $attributes, $content, $block ) { global $post; $post_id = $block->context['postId']; if ( ! isset( $post_id ) ) { return ''; } $comment_args = array( 'post_id' => $post_id, 'count' => true, 'status' => 'approve', ); // Return early if there are no comments and comments are closed. if ( ! comments_open( $post_id ) && get_comments( $comment_args ) === 0 ) { return ''; } // If this isn't the legacy block, we need to render the static version of this block. $is_legacy = 'core/post-comments' === $block->name || ! empty( $attributes['legacy'] ); if ( ! $is_legacy ) { return $block->render( array( 'dynamic' => false ) ); } $post_before = $post; $post = get_post( $post_id ); setup_postdata( $post ); ob_start(); /* * There's a deprecation warning generated by WP Core. * Ideally this deprecation is removed from Core. * In the meantime, this removes it from the output. */ add_filter( 'deprecated_file_trigger_error', '__return_false' ); comments_template(); remove_filter( 'deprecated_file_trigger_error', '__return_false' ); $output = ob_get_clean(); $post = $post_before; $classnames = array(); // Adds the old class name for styles' backwards compatibility. if ( isset( $attributes['legacy'] ) ) { $classnames[] = 'wp-block-post-comments'; } if ( isset( $attributes['textAlign'] ) ) { $classnames[] = 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); /* * Enqueues scripts and styles required only for the legacy version. That is * why they are not defined in `block.json`. */ wp_enqueue_script( 'comment-reply' ); enqueue_legacy_post_comments_block_styles( $block->name ); return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $output ); } /** * Registers the `core/comments` block on the server. */ function register_block_core_comments() { register_block_type_from_metadata( __DIR__ . '/comments', array( 'render_callback' => 'render_block_core_comments', 'skip_inner_blocks' => true, ) ); } add_action( 'init', 'register_block_core_comments' ); /** * Use the button block classes for the form-submit button. * * @param array $fields The default comment form arguments. * * @return array Returns the modified fields. */ function comments_block_form_defaults( $fields ) { if ( wp_is_block_theme() ) { $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . wp_theme_get_element_class_name( 'button' ) . '" value="%4$s" />'; $fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>'; } return $fields; } add_filter( 'comment_form_defaults', 'comments_block_form_defaults' ); /** * Enqueues styles from the legacy `core/post-comments` block. These styles are * required only by the block's fallback. * * @param string $block_name Name of the new block type. */ function enqueue_legacy_post_comments_block_styles( $block_name ) { static $are_styles_enqueued = false; if ( ! $are_styles_enqueued ) { $handles = array( 'wp-block-post-comments', 'wp-block-buttons', 'wp-block-button', ); foreach ( $handles as $handle ) { wp_enqueue_block_style( $block_name, array( 'handle' => $handle ) ); } $are_styles_enqueued = true; } } /** * Ensures backwards compatibility for any users running the Gutenberg plugin * who have used Post Comments before it was merged into Comments Query Loop. * * The same approach was followed when core/query-loop was renamed to * core/post-template. * * @see https://github.com/WordPress/gutenberg/pull/41807 * @see https://github.com/WordPress/gutenberg/pull/32514 */ function register_legacy_post_comments_block() { $registry = WP_Block_Type_Registry::get_instance(); /* * Remove the old `post-comments` block if it was already registered, as it * is about to be replaced by the type defined below. */ if ( $registry->is_registered( 'core/post-comments' ) ) { unregister_block_type( 'core/post-comments' ); } // Recreate the legacy block metadata. $metadata = array( 'name' => 'core/post-comments', 'category' => 'theme', 'attributes' => array( 'textAlign' => array( 'type' => 'string', ), ), 'uses_context' => array( 'postId', 'postType', ), 'supports' => array( 'html' => false, 'align' => array( 'wide', 'full' ), 'typography' => array( 'fontSize' => true, 'lineHeight' => true, '__experimentalFontStyle' => true, '__experimentalFontWeight' => true, '__experimentalLetterSpacing' => true, '__experimentalTextTransform' => true, '__experimentalDefaultControls' => array( 'fontSize' => true, ), ), 'color' => array( 'gradients' => true, 'link' => true, '__experimentalDefaultControls' => array( 'background' => true, 'text' => true, ), ), 'inserter' => false, ), 'style' => array( 'wp-block-post-comments', 'wp-block-buttons', 'wp-block-button', ), 'editorStyle' => 'wp-block-post-comments-editor', 'render_callback' => 'render_block_core_comments', 'skip_inner_blocks' => true, ); /* * Filters the metadata object, the same way it's done inside * `register_block_type_from_metadata()`. This applies some default filters, * like `_wp_multiple_block_styles`, which is required in this case because * the block has multiple styles. */ $metadata = apply_filters( 'block_type_metadata', $metadata ); register_block_type( 'core/post-comments', $metadata ); } add_action( 'init', 'register_legacy_post_comments_block', 21 ); home/premiey/www/wp-content/themes/astra/comments.php 0000666 00000006632 15165343070 0017044 0 ustar 00 <?php /** * The template for displaying comments. * * This is the template that displays the area of the page that contains both the current comments * and the comment form. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package Astra * @since 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /* * If the current post is protected by a password and * the visitor has not yet entered the password we will * return early without loading the comments. */ if ( post_password_required() ) { return; } ?> <div id="comments" class="comments-area"> <?php astra_comments_before(); ?> <?php if ( have_comments() ) : astra_markup_open( 'comment-count-wrapper' ); ?> <h3 class="comments-title"> <?php $astra_comments_title = apply_filters( 'astra_comment_form_title', sprintf( // WPCS: XSS OK. /* translators: 1: number of comments */ esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'astra' ) ), number_format_i18n( get_comments_number() ), get_the_title() ) ); echo esc_html( $astra_comments_title ); ?> </h3> <?php astra_markup_close( 'comment-count-wrapper' ); if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> <nav id="comment-nav-above" class="navigation comment-navigation" aria-label="<?php esc_attr_e( 'Comments Navigation', 'astra' ); ?>"> <h3 class="screen-reader-text"><?php echo esc_html( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></h3> <div class="nav-links"> <div class="nav-previous"><?php previous_comments_link( astra_default_strings( 'string-comment-navigation-previous', false ) ); ?></div> <div class="nav-next"><?php next_comments_link( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></div> </div><!-- .nav-links --> </nav><!-- #comment-nav-above --> <?php endif; ?> <ol class="ast-comment-list"> <?php wp_list_comments( array( 'callback' => 'astra_theme_comment', 'style' => 'ol', ) ); ?> </ol><!-- .ast-comment-list --> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> <nav id="comment-nav-below" class="navigation comment-navigation" aria-label="<?php esc_attr_e( 'Comments Navigation', 'astra' ); ?>"> <h3 class="screen-reader-text"><?php echo esc_html( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></h3> <div class="nav-links"> <div class="nav-previous"><?php previous_comments_link( astra_default_strings( 'string-comment-navigation-previous', false ) ); ?></div> <div class="nav-next"><?php next_comments_link( astra_default_strings( 'string-comment-navigation-next', false ) ); ?></div> </div><!-- .nav-links --> </nav><!-- #comment-nav-below --> <?php endif; ?> <?php endif; ?> <?php // If comments are closed and there are comments, let's leave a little note, shall we? if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> <p class="no-comments"><?php echo esc_html( astra_default_strings( 'string-comment-closed', false ) ); ?></p> <?php endif; ?> <?php comment_form(); ?> <?php astra_comments_after(); ?> </div><!-- #comments --> home/premiey/www/wp-content/themes/astra/inc/dynamic-css/comments.php 0000666 00000031356 15165407667 0022045 0 ustar 00 <?php /** * Comments - Dynamic CSS * * @package astra-builder * @since 3.2.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } add_filter( 'astra_dynamic_theme_css', 'astra_comments_css', 11 ); /** * Comments - Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @return String Generated dynamic CSS for Pagination. * * @since 3.2.0 */ function astra_comments_css( $dynamic_css ) { if ( astra_check_current_post_comment_enabled() || 0 < get_comments_number() ) { $body_font_size = astra_get_option( 'font-size-body' ); $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $is_site_rtl = is_rtl(); if ( is_array( $body_font_size ) ) { $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15; } else { $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15; } $desktop_comment_global = array( '.comment-reply-title' => array( 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 1.66666 ), ), // Single Post Meta. '.ast-comment-meta' => array( 'line-height' => '1.666666667', 'color' => esc_attr( $link_color ), 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 0.8571428571 ), ), '.ast-comment-list #cancel-comment-reply-link' => array( 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ), ), ); $dynamic_css .= astra_parse_css( $desktop_comment_global ); $update_customizer_defaults = ( true === astra_check_is_structural_setup() ); $padding_comment_title = $update_customizer_defaults ? '1em 0 0' : '2em 0'; $padding_ast_comment = $update_customizer_defaults ? '2em 0' : '1em 0'; $padding_ast_comment_list = $update_customizer_defaults ? '0' : '0.5em'; $single_post_comment_css = '.comments-count-wrapper { padding: ' . esc_attr( $padding_comment_title ) . '; } .comments-count-wrapper .comments-title { font-weight: normal; word-wrap: break-word; } .ast-comment-list { margin: 0; word-wrap: break-word; padding-bottom: ' . esc_attr( $padding_ast_comment_list ) . '; list-style: none; } .ast-comment-list li { list-style: none; } .ast-comment-list li.depth-1 .ast-comment, .ast-comment-list li.depth-2 .ast-comment { border-bottom: 1px solid #eeeeee; } .ast-comment-list .comment-respond { padding: 1em 0; border-bottom: 1px solid #eeeeee; } .ast-comment-list .comment-respond .comment-reply-title { margin-top: 0; padding-top: 0; } .ast-comment-list .comment-respond p { margin-bottom: .5em; } .ast-comment-list .ast-comment-edit-reply-wrap { -js-display: flex; display: flex; justify-content: flex-end; } .ast-comment-list .ast-edit-link { flex: 1; } .ast-comment-list .comment-awaiting-moderation { margin-bottom: 0; } .ast-comment { padding: ' . esc_attr( $padding_ast_comment ) . ' ; } .ast-comment-avatar-wrap img { border-radius: 50%; } .ast-comment-content { clear: both; } .ast-comment-cite-wrap { text-align: left; } .ast-comment-cite-wrap cite { font-style: normal; } .comment-reply-title { padding-top: 1em; font-weight: normal; line-height: 1.65; } .ast-comment-meta { margin-bottom: 0.5em; } .comments-area { border-top: 1px solid #eeeeee; margin-top: 2em; } .comments-area .comment-form-comment { width: 100%; border: none; margin: 0; padding: 0; } .comments-area .comment-notes, .comments-area .comment-textarea, .comments-area .form-allowed-tags { margin-bottom: 1.5em; } .comments-area .form-submit { margin-bottom: 0; } .comments-area textarea#comment, .comments-area .ast-comment-formwrap input[type="text"] { width: 100%; border-radius: 0; vertical-align: middle; margin-bottom: 10px; } .comments-area .no-comments { margin-top: 0.5em; margin-bottom: 0.5em; } .comments-area p.logged-in-as { margin-bottom: 1em; } .ast-separate-container .comments-count-wrapper { background-color: #fff; padding: 2em 6.67em 0; } @media (max-width: 1200px) { .ast-separate-container .comments-count-wrapper { padding: 2em 3.34em; } } .ast-separate-container .comments-area { border-top: 0; } .ast-separate-container .ast-comment-list { padding-bottom: 0; } .ast-separate-container .ast-comment-list li { background-color: #fff; } .ast-separate-container .ast-comment-list li.depth-1 .children li { padding-bottom: 0; padding-top: 0; margin-bottom: 0; } .ast-separate-container .ast-comment-list li.depth-1 .ast-comment, .ast-separate-container .ast-comment-list li.depth-2 .ast-comment { border-bottom: 0; } .ast-separate-container .ast-comment-list .comment-respond { padding-top: 0; padding-bottom: 1em; background-color: transparent; } .ast-separate-container .ast-comment-list .pingback p { margin-bottom: 0; } .ast-separate-container .ast-comment-list .bypostauthor { padding: 2em; margin-bottom: 1em; } .ast-separate-container .ast-comment-list .bypostauthor li { background: transparent; margin-bottom: 0; padding: 0 0 0 2em; } .ast-separate-container .comment-reply-title { padding-top: 0; } .comment-content a { word-wrap: break-word; } .comment-form-legend { margin-bottom: unset; padding: 0 0.5em; }'; if ( false === $update_customizer_defaults ) { $single_post_comment_css .= '.ast-separate-container .ast-comment-list li.depth-1 { padding: 4em 6.67em; margin-bottom: 2em; } @media (max-width: 1200px) { .ast-separate-container .ast-comment-list li.depth-1 { padding: 3em 3.34em; } } .ast-separate-container .comment-respond { background-color: #fff; padding: 4em 6.67em; border-bottom: 0; } @media (max-width: 1200px) { .ast-separate-container .comment-respond { padding: 3em 2.34em; } } '; } else { $single_post_comment_css .= ' .page.ast-page-builder-template .comments-area { margin-top: 2em; } '; } if ( $is_site_rtl ) { $single_post_comment_css .= ' .ast-comment-list .children { margin-right: 2em; } @media (max-width: 992px) { .ast-comment-list .children { margin-right: 1em; } } .ast-comment-list #cancel-comment-reply-link { white-space: nowrap; font-size: 15px; font-size: 1rem; margin-right: 1em; } .ast-comment-avatar-wrap { float: right; clear: left; margin-left: 1.33333em; } .ast-comment-meta-wrap { float: right; clear: left; padding: 0 0 1.33333em; } .ast-comment-time .timendate, .ast-comment-time .reply { margin-left: 0.5em; } .comments-area #wp-comment-cookies-consent { margin-left: 10px; } .ast-page-builder-template .comments-area { padding-right: 20px; padding-left: 20px; margin-top: 0; margin-bottom: 2em; } .ast-separate-container .ast-comment-list .bypostauthor .bypostauthor { background: transparent; margin-bottom: 0; padding-left: 0; padding-bottom: 0; padding-top: 0; }'; } else { $single_post_comment_css .= ' .ast-comment-list .children { margin-left: 2em; } @media (max-width: 992px) { .ast-comment-list .children { margin-left: 1em; } } .ast-comment-list #cancel-comment-reply-link { white-space: nowrap; font-size: 15px; font-size: 1rem; margin-left: 1em; } .ast-comment-avatar-wrap { float: left; clear: right; margin-right: 1.33333em; } .ast-comment-meta-wrap { float: left; clear: right; padding: 0 0 1.33333em; } .ast-comment-time .timendate, .ast-comment-time .reply { margin-right: 0.5em; } .comments-area #wp-comment-cookies-consent { margin-right: 10px; } .ast-page-builder-template .comments-area { padding-left: 20px; padding-right: 20px; margin-top: 0; margin-bottom: 2em; } .ast-separate-container .ast-comment-list .bypostauthor .bypostauthor { background: transparent; margin-bottom: 0; padding-right: 0; padding-bottom: 0; padding-top: 0; }'; } $dynamic_css .= Astra_Enqueue_Scripts::trim_css( $single_post_comment_css ); $static_layout_css_min_comment = array( '.ast-separate-container .ast-comment-list li .comment-respond' => array( 'padding-left' => '2.66666em', 'padding-right' => '2.66666em', ), ); $dynamic_css .= astra_parse_css( $static_layout_css_min_comment, astra_get_tablet_breakpoint( '', '1' ) ); $global_button_comment_mobile = array( '.ast-separate-container .comments-count-wrapper' => array( 'padding' => '1.5em 1em', ), '.ast-separate-container .ast-comment-list li.depth-1' => array( 'padding' => '1.5em 1em', 'margin-bottom' => '1.5em', ), '.ast-separate-container .ast-comment-list .bypostauthor' => array( 'padding' => '.5em', ), '.ast-separate-container .comment-respond' => array( 'padding' => '1.5em 1em', ), // Single Post Meta. '.ast-comment-meta' => array( 'font-size' => ! empty( $body_font_size['mobile'] ) ? astra_get_font_css_value( (int) $body_font_size['mobile'] * 0.8571428571, 'px', 'mobile' ) : '', ), '.comment-reply-title' => array( 'font-size' => ! empty( $body_font_size['mobile'] ) ? astra_get_font_css_value( (int) $body_font_size['mobile'] * 1.66666, 'px', 'mobile' ) : '', ), '.ast-comment-list #cancel-comment-reply-link' => array( 'font-size' => astra_responsive_font( $body_font_size, 'mobile' ), ), '.ast-separate-container .ast-comment-list .bypostauthor li' => array( 'padding' => '0 0 0 .5em', ), ); if ( $is_site_rtl ) { $global_button_comment_mobile['.ast-comment-list .children'] = array( 'margin-right' => '0.66666em', ); } else { $global_button_comment_mobile['.ast-comment-list .children'] = array( 'margin-left' => '0.66666em', ); } $dynamic_css .= astra_parse_css( $global_button_comment_mobile, '', astra_get_mobile_breakpoint() ); $global_button_comment_tablet = array( '.ast-comment-avatar-wrap img' => array( 'max-width' => '2.5em', ), '.comments-area' => array( 'margin-top' => '1.5em', ), '.ast-separate-container .comments-count-wrapper' => array( 'padding' => '2em 2.14em', ), '.ast-separate-container .ast-comment-list li.depth-1' => array( 'padding' => '1.5em 2.14em', ), '.ast-separate-container .comment-respond' => array( 'padding' => '2em 2.14em', ), // Single Post Meta. '.ast-comment-meta' => array( 'font-size' => ! empty( $body_font_size['tablet'] ) ? astra_get_font_css_value( (int) $body_font_size['tablet'] * 0.8571428571, 'px', 'tablet' ) : '', ), '.comment-reply-title' => array( 'font-size' => ! empty( $body_font_size['tablet'] ) ? astra_get_font_css_value( (int) $body_font_size['tablet'] * 1.66666, 'px', 'tablet' ) : '', ), '.ast-comment-list #cancel-comment-reply-link' => array( 'font-size' => astra_responsive_font( $body_font_size, 'tablet' ), ), ); $dynamic_css .= astra_parse_css( $global_button_comment_tablet, '', astra_get_tablet_breakpoint() ); if ( $is_site_rtl ) { $global_button_tablet_lang_direction_css = array( '.ast-comment-avatar-wrap' => array( 'margin-left' => '0.5em', ), ); } else { $global_button_tablet_lang_direction_css = array( '.ast-comment-avatar-wrap' => array( 'margin-right' => '0.5em', ), ); } return $dynamic_css .= astra_parse_css( $global_button_tablet_lang_direction_css, '', astra_get_tablet_breakpoint() ); } return $dynamic_css; }
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings