ï»¿ï»¿PK      ƒ¹ò\¬VyA*:  *:    post_meta.phpnu W+A„¶        <?php
/**
 * Should handle post meta display.
 *
 * Author:          Andrei Baicus <andrei@themeisle.com>
 * Created on:      28/08/2018
 *
 * @package Neve\Views
 */

namespace Neve\Views\Partials;

use Neve\Core\Settings\Config;
use Neve\Core\Settings\Mods;
use Neve\Views\Base_View;

/**
 * Class Post_Meta
 *
 * @package Neve\Views
 */
class Post_Meta extends Base_View {
	/**
	 * Function that is run after instantiation.
	 *
	 * @return void
	 */
	public function init() {
		add_filter( 'neve_display_author_avatar', array( $this, 'should_display_author_avatar' ), 15 );
		add_action( 'neve_post_meta_archive', array( $this, 'render_meta_list' ), 10, 3 );
		add_action( 'neve_post_meta_single', array( $this, 'render_meta_list' ), 10, 3 );
		add_action( 'neve_do_tags', array( $this, 'render_tags_list' ) );
		add_action( 'wp_enqueue_scripts', array( $this, 'meta_custom_separator' ) );
		add_filter( 'neve_gravatar_args', [ $this, 'add_dynamic_gravatar' ] );
	}

	/**
	 * Show/hide author avatar based on customizer option
	 *
	 * @param bool $value option value.
	 *
	 * @return bool
	 */
	public function should_display_author_avatar( $value ) {

		$show_avatar = get_theme_mod( 'neve_author_avatar', false );
		if ( is_singular() ) {
			$show_avatar = get_theme_mod( 'neve_single_post_author_avatar', $show_avatar );
		}

		return $show_avatar;
	}

	/**
	 * Add dynamic gravatar values.
	 *
	 * @param array $args_array Avatar args.
	 *
	 * @return mixed
	 */
	public function add_dynamic_gravatar( $args_array ) {

		$meta_key    = Config::MODS_ARCHIVE_POST_META_AUTHOR_AVATAR_SIZE;
		$default     = '{ "mobile": 20, "tablet": 20, "desktop": 20 }';
		$avatar_size = Mods::to_json( $meta_key, $default );
		if ( is_singular( 'post' ) ) {
			$single_avatar_size = Mods::to_json( Config::MODS_SINGLE_POST_META_AUTHOR_AVATAR_SIZE );
			$avatar_size        = ! empty( $single_avatar_size ) ? $single_avatar_size : $avatar_size;
		}
		$avatar_size = apply_filters( 'neve_author_avatar_size_filter', $avatar_size );

		if ( ! isset( $args_array['size'] ) ) {
			return $args_array;
		}

		if ( ! is_array( $avatar_size ) ) {
			return $args_array;
		}

		$args_array['size'] = max( $avatar_size );

		return $args_array;
	}

	/**
	 * Get the index of the last item on mobile to be able to hide the separator
	 *
	 * @param array $order Meta elements order.
	 *
	 * @return int
	 */
	private function get_mobile_last_item( $order ) {
		$order_length    = count( $order );
		$last_item_index = -1;
		for ( $i = 0; $i < $order_length; $i++ ) {
			for ( $j = $i + 1; $j < $order_length; $j++ ) {
				if ( ! isset( $order[ $j ]->hide_on_mobile ) || (bool) $order[ $j ]->hide_on_mobile === false ) {
					$last_item_index = $j;
					break;
				}
			}
		}
		return $last_item_index;
	}

	/**
	 * Render meta list.
	 *
	 * @param array      $order   the order array. Passed through the action parameter.
	 * @param bool       $as_list Flag to display meta as list or as text.
	 * @param int | null $post_id Post id.
	 */
	public function render_meta_list( $order, $as_list = true, $post_id = null ) {
		if ( ! is_array( $order ) || empty( $order ) ) {
			return;
		}

		// Filter the array to contain only visible elements
		$order = array_filter(
			$order,
			function ( $el ) {
				return isset( $el->visibility ) && $el->visibility === 'yes';
			}
		);

		$order = $this->sanitize_order_array( $order );
		$order = array_values( $order );

		$pid                 = $post_id ? $post_id : get_the_ID();
		$post_type           = get_post_type( $pid );
		$markup              = $as_list === true ? '<ul class="nv-meta-list">' : '<span class="nv-meta-list nv-dynamic-meta">';
		$tag                 = $as_list === true ? 'li' : 'span';
		$last_item_on_mobile = $this->get_mobile_last_item( $order );
		$order_length        = count( $order );

		for ( $i = 0; $i < $order_length; $i++ ) {
			$meta           = $order[ $i ];
			$element_class  = $last_item_on_mobile === $i ? 'last' : '';
			$slug           = $meta->slug ?? 'custom';
			$format         = ! empty( $meta->format ) ? $meta->format : '{meta}';
			$element_class .= isset( $meta->hide_on_mobile ) && (bool) $meta->hide_on_mobile === true ? ' no-mobile' : '';
			switch ( $slug ) {
				case 'author':
					$show_before  = $format === '{meta}';
					$meta_content = str_replace( '{meta}', self::neve_get_author_meta( $pid, $show_before ), $format );
					$markup      .= '<' . $tag . '  class="meta author vcard ' . esc_attr( $element_class ) . '">';
					$markup      .= wp_kses_post( $meta_content );
					$markup      .= '</' . $tag . '>';
					break;
				case 'date':
					$date_meta_classes = array(
						'meta',
						'date',
						'posted-on',
					);

					$created           = get_the_time( 'U' );
					$modified          = get_the_modified_time( 'U' );
					$has_updated_time  = $created !== $modified;
					$show_updated_time = get_theme_mod( 'neve_show_last_updated_date', false );
					if ( is_singular( 'post' ) ) {
						$show_updated_time = get_theme_mod( 'neve_single_post_show_last_updated_date', $show_updated_time );
					}
					if ( $show_updated_time && $has_updated_time ) {
						$date_meta_classes[] = 'nv-show-updated';
					}
					$meta_content = str_replace( '{meta}', self::get_time_tags( $pid ), $format );
					$markup      .= '<' . $tag . ' class="' . esc_attr( implode( ' ', $date_meta_classes ) ) . ' ' . esc_attr( $element_class ) . '">';
					$markup      .= $meta_content;
					$markup      .= '</' . $tag . '>';
					break;
				case 'category':
					if ( ! in_array( 'category', get_object_taxonomies( $post_type ) ) ) {
						break;
					}
					$meta_content = str_replace( '{meta}', get_the_category_list( ', ', '', $pid ), $format );
					$markup      .= '<' . $tag . ' class="meta category ' . esc_attr( $element_class ) . '">';
					$markup      .= wp_kses_post( $meta_content );
					$markup      .= '</' . $tag . '>';
					break;
				case 'comments':
					$comments = self::get_comments( $pid );
					if ( empty( $comments ) ) {
						break;
					}
					$meta_content = str_replace( '{meta}', $comments, $format );
					$markup      .= '<' . $tag . ' class="meta comments ' . esc_attr( $element_class ) . '">';
					$markup      .= wp_kses_post( $meta_content );
					$markup      .= '</' . $tag . '>';
					break;
				case 'reading':
					$allowed_context = apply_filters( 'neve_post_type_supported_list', [ 'post' ], 'block_editor' );
					if ( ! in_array( $post_type, $allowed_context ) ) {
						break;
					}
					$reading_time = apply_filters( 'neve_do_read_time', $pid );
					if ( empty( $reading_time ) ) {
						break;
					}
					$meta_content = str_replace( '{meta}', $reading_time, $format );
					$markup      .= '<' . $tag . ' class="meta reading-time ' . esc_attr( $element_class ) . '">';
					$markup      .= wp_kses_post( $meta_content );
					$markup      .= '</' . $tag . '>';
					break;
				case 'custom':
					$custom_meta = apply_filters( 'neve_do_custom_meta', '', $meta, $tag, $pid );
					if ( empty( $custom_meta ) ) {
						break;
					}
					$markup .= '<' . $tag . ' class="meta custom ' . esc_attr( $element_class ) . '">';
					$markup .= wp_kses_post( $custom_meta );
					$markup .= '</' . $tag . '>';
					break;
				case 'default':
				default:
					break;
			}
		}
		$markup .= $as_list === true ? '</ul>' : '</span>';
		echo ( $markup ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}

	/**
	 * Makes sure there's a valid meta order array.
	 *
	 * @param array $order meta order array.
	 *
	 * @return mixed
	 */
	private function sanitize_order_array( $order ) {
		$allowed_order_values = apply_filters(
			'neve_meta_filter',
			array(
				'author'   => __( 'Author', 'neve' ),
				'category' => __( 'Category', 'neve' ),
				'date'     => __( 'Date', 'neve' ),
				'comments' => __( 'Comments', 'neve' ),
			)
		);
		foreach ( $order as $index => $meta_item ) {
			if ( isset( $meta_item->blocked ) && isset( $meta_item->slug ) && ! array_key_exists( $meta_item->slug, $allowed_order_values ) ) {
				unset( $order[ $index ] );
			}
		}

		return $order;
	}

	/**
	 * Get the author meta.
	 *
	 * @param int | null $post_id Post id.
	 * @param bool       $show_before Show the 'by' string before the author name.
	 *
	 * @return string | false
	 */
	public static function neve_get_author_meta( $post_id = null, $show_before = true ) {

		global $post;

		$current_post = $post_id !== null ? get_post( $post_id ) : $post;

		if ( ! isset( $current_post ) ) {
			return false;
		}
		// we need to set the global post to the current post in order to allow other filters that hook into get_the_author_meta hooks access to the current post.
		// we reset this at the end of the function.
		$original_global_post = $post;
		$post                 = $current_post; //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
		setup_postdata( $current_post );

		$author_id      = $current_post->post_author;
		$user_nicename  = get_the_author_meta( 'user_nicename', $author_id );
		$display_name   = get_the_author_meta( 'display_name', $author_id );
		$author_email   = get_the_author_meta( 'user_email', $author_id );
		$gravatar_args  = apply_filters(
			'neve_gravatar_args',
			array(
				'size' => 20,
			)
		);
		$display_avatar = apply_filters( 'neve_display_author_avatar', false );
		$avatar_url     = get_avatar_url( $author_email, $gravatar_args );
		$avatar_markup  = '<img class="photo" alt="' . esc_attr( $display_name ) . '" src="' . esc_url( $avatar_url ) . '" />&nbsp;';

		$markup = '';
		if ( $display_avatar ) {
			$markup .= $avatar_markup;
		}
		$markup .= '<span class="author-name fn">';
		if ( ! $display_avatar && $show_before ) {
			$markup .= __( 'by', 'neve' ) . ' ';
		}

		$link = sprintf(
			'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
			esc_url( get_author_posts_url( $author_id, $user_nicename ) ),
			/* translators: %s: Author's display name. */
			esc_attr( sprintf( __( 'Posts by %s', 'neve' ), $display_name ) ),
			$display_name
		);

		$link = apply_filters( 'the_author_posts_link', $link );

		$markup .= wp_kses_post( $link ) . '</span>';

		/**
		 * Filters the author post meta markup.
		 *
		 * @since 3.5.2
		 *
		 * @param string $markup The HTML markup used to display the post meta author.
		 * @param int | null $post_id Post id.
		 * @param bool $show_before Show the 'by' sting before the author name.
		 *
		 * @return string
		 */
		$markup = apply_filters( 'neve_filter_author_meta_markup', $markup, $post_id, $show_before );

		$post = $original_global_post; //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
		return wp_kses_post( $markup );
	}

	/**
	 * Get <time> tags.
	 *
	 * @param int | null $post_id Post id.
	 * @return string
	 */
	public static function get_time_tags( $post_id = null ) {
		$created           = get_the_time( 'U', $post_id );
		$modified          = get_the_modified_time( 'U', $post_id );
		$has_updated_time  = $created !== $modified;
		$show_updated_time = get_theme_mod( 'neve_show_last_updated_date', false );
		if ( is_singular( 'post' ) ) {
			$show_updated_time = get_theme_mod( 'neve_single_post_show_last_updated_date', $show_updated_time );
		}
		$format = get_option( 'date_format' );

		$prefixes = array(
			'published' => '',
			'updated'   => '',
		);

		/**
		 * Filters the prefix of the published date and the updated date of a post.
		 *
		 * @param array $prefixes {
		 *     Prefix location and value.
		 *
		 *     @type string $published The prefix for the published date.
		 *     @type string $updated The prefix for the updated date.
		 * }
		 *
		 * @since 2.11
		 */
		$prefixes = apply_filters( 'neve_meta_date_prefix', $prefixes );

		$updated_time_markup = '<time class="updated" datetime="' . esc_attr( date_i18n( 'c', $modified ) ) . '">';
		if ( array_key_exists( 'updated', $prefixes ) && ! empty( $prefixes['updated'] ) ) {
			$updated_time_markup .= wp_kses_post( $prefixes['updated'] );
		}
		$updated_time_markup .= esc_html( date_i18n( $format, $modified ) ) . '</time>';

		if ( $show_updated_time && $has_updated_time ) {
			return $updated_time_markup;
		}

		$time = '<time class="entry-date published" datetime="' . esc_attr( date_i18n( 'c', $created ) ) . '" content="' . esc_attr( date_i18n( 'Y-m-d', $created ) ) . '">';
		if ( array_key_exists( 'published', $prefixes ) && ! empty( $prefixes['published'] ) ) {
			$time .= wp_kses_post( $prefixes['published'] );
		}
		$time .= esc_html( date_i18n( $format, $created ) ) . '</time>';

		if ( ! $has_updated_time ) {
			return $time;
		}
		$time .= $updated_time_markup;

		return $time;
	}

	/**
	 * Get the comments with a link.
	 *
	 * @param int | null $post_id Post id.
	 *
	 * @return string|false
	 */
	public static function get_comments( $post_id = null ) {
		if ( ! get_post( $post_id ) ) {
			return false;
		}
		if ( ! comments_open( $post_id ) ) {
			return false;
		}
		$comments_number = get_comments_number( $post_id );
		if ( $comments_number < 1 ) {
			return false;
		}
		/* translators: %s: number of comments */
		$comments = sprintf( _n( '%s Comment', '%s Comments', $comments_number, 'neve' ), $comments_number );

		return '<a href="' . esc_url( get_comments_link( $post_id ) ) . '">' . esc_html( $comments ) . '</a>';
	}

	/**
	 * Render the tags list.
	 */
	public function render_tags_list() {
		$tags = get_the_tags();
		if ( ! is_array( $tags ) ) {
			return;
		}
		$html  = '<div class="nv-tags-list">';
		$html .= '<span>' . __( 'Tags', 'neve' ) . ':</span>';
		foreach ( $tags as $tag ) {
			$tag_link = get_tag_link( $tag->term_id );
			$html    .= '<a href=' . esc_url( $tag_link ) . ' title="' . esc_attr( $tag->name ) . '" class=' . esc_attr( $tag->slug ) . ' rel="tag">';
			$html    .= esc_html( $tag->name ) . '</a>';
		}
		$html .= ' </div> ';
		echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}

	/**
	 * Change metadata separator according to the customizer setting
	 */
	public function meta_custom_separator() {

		$separator = get_theme_mod( 'neve_metadata_separator', esc_html( '/' ) );
		if ( is_singular() ) {
			$separator = get_theme_mod( 'neve_single_post_metadata_separator', $separator );
		}
		$separator = apply_filters( 'neve_metadata_separator_filter', $separator );

		$custom_css  = '';
		$custom_css .= '.nv-meta-list li.meta:not(:last-child):after { content:"' . esc_html( $separator ) . '" }';

		$custom_css .= '.nv-meta-list .no-mobile{
			display:none;
		}';
		$custom_css .= '.nv-meta-list li.last::after{
			content: ""!important;
		}';
		$custom_css .= '@media (min-width: 769px) {
			.nv-meta-list .no-mobile {
				display: inline-block;
			}
			.nv-meta-list li.last:not(:last-child)::after {
		 		content: "' . esc_html( $separator ) . '" !important;
			}
		}';
		wp_add_inline_style( 'neve-style', $custom_css );
	}

}
PK      ƒ¹ò\Øù/¸µ	  µ	    excerpt.phpnu W+A„¶        <?php
/**
 * Author:          Andrei Baicus <andrei@themeisle.com>
 * Created on:      28/08/2018
 *
 * @package Neve\Views\Partials
 */

namespace Neve\Views\Partials;

use Neve\Views\Base_View;

/**
 * Class Excerpt
 *
 * @package Neve\Views\Partials
 */
class Excerpt extends Base_View {
	/**
	 * Function that is run after instantiation.
	 *
	 * @return void
	 */
	public function init() {
		add_action( 'neve_excerpt_archive', array( $this, 'render_post_excerpt' ), 10, 2 );
	}

	/**
	 * Echo the post excerpt.
	 *
	 * @param string     $context the provided context in do_action.
	 * @param int | null $post_id Post id.
	 */
	public function render_post_excerpt( $context, $post_id = null ) {
		echo $this->get_post_excerpt( $context, $post_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}

	/**
	 * Get the post excerpt.
	 *
	 * @param string     $context NOT YET USED. Might come in handily at some later point.
	 * @param int | null $post_id Post id.
	 * @return string
	 */
	private function get_post_excerpt( $context, $post_id = null ) {
		$length = $this->get_excerpt_length();

		$output  = '';
		$output .= '<div class="excerpt-wrap entry-summary">';
		$output .= $this->get_excerpt( $length, $post_id );
		$output .= '</div>';

		return $output;
	}

	/**
	 * Get the excerpt length.
	 *
	 * @param int $length Post excerpt length.
	 * @param int $post_id Post id.
	 *
	 * @return string
	 */
	private function get_excerpt( $length = 25, $post_id = null ) {

		global $post;

		if ( $length === 300 ) {
			return apply_filters( 'the_content', get_the_content( null, false, $post_id ) );
		}

		if ( strpos( $post->post_content, '<!--more-->' ) ) {
			return apply_filters( 'the_content', get_the_content( null, false, $post_id ) );
		}

		if ( has_excerpt() ) {
			return apply_filters( 'the_excerpt', get_the_excerpt( $post_id ) );
		}

		add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ), 10 );
		$content = get_the_excerpt( $post_id );
		remove_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ), 10 );

		return apply_filters( 'the_excerpt', $content );
	}

	/**
	 * Get the excerpt length option casted as `int`.
	 *
	 * @return int
	 */
	private function get_excerpt_length() {
		return absint( round( get_theme_mod( 'neve_post_excerpt_length', '25' ) ) );
	}

	/**
	 * Change excerpt length.
	 *
	 * @return int
	 */
	public function change_excerpt_length() {
		return $this->get_excerpt_length();
	}
}
PK      ƒ¹ò\ê5Ñ#  Ñ#    comments.phpnu W+A„¶        <?php
/**
 * Author:          Andrei Baicus <andrei@themeisle.com>
 * Created on:      02/11/2018
 *
 * @package neve
 */

namespace Neve\Views\Partials;

use Neve\Views\Base_View;

/**
 * Class Comments
 *
 * @package Neve\Views\Partials
 */
class Comments extends Base_View {

	/**
	 * Holds comment IDs that have an opened children tag.
	 *
	 * @var array
	 */
	private $comments_with_children = [];

	/**
	 * Add in functionality.
	 */
	public function init() {
		add_action( 'neve_do_comment_area', array( $this, 'render_comment_form' ) );
		add_filter( 'comment_form_defaults', array( $this, 'leave_reply_title_tag' ) );
		add_filter( 'comment_form_fields', array( $this, 'move_textarea' ) );
	}

	/**
	 * Render the comments form.
	 */
	public function render_comment_form() {
		$display_form_first    = apply_filters( 'neve_show_comment_form_first', false );
		$comment_form_settings = $this->get_sumbit_form_settings();

		if ( $display_form_first ) {
			comment_form( $comment_form_settings );
		}

		if ( have_comments() ) {
			$comments_wrap_classes = [ 'nv-comments-wrap' ];
			$is_boxed              = get_theme_mod( 'neve_comments_boxed_layout', false );
			if ( $is_boxed ) {
				$comments_wrap_classes[] = 'nv-is-boxed';
			}

			?>
			<div class="<?php echo esc_attr( implode( ' ', $comments_wrap_classes ) ); ?>">

				<div class="nv-comments-title-wrap">
					<?php
					echo '<h2 class="comments-title">';
					echo wp_kses_post( $this->get_comments_title() );
					echo '</h2>'
					?>
				</div>

				<ol class="nv-comments-list">
					<?php
					wp_list_comments(
						array(
							'callback'     => array( $this, 'comment_list_callback' ),
							'end-callback' => array( $this, 'end_comment_list_callback' ),
							'style'        => 'div',
						)
					);
					?>
				</ol>

			</div>

			<?php
			$this->maybe_render_comments_navigation();
		}

		if ( ! comments_open() &&
			get_comments_number() &&
			post_type_supports( get_post_type(), 'comments' ) ) {
			?>
			<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'neve' ); ?></p>
			<?php
		}
		if ( ! $display_form_first ) {
			comment_form( $comment_form_settings );
		}
	}

	/**
	 * Get forms settings.
	 *
	 * @return array
	 */
	private function get_sumbit_form_settings() {
		$form_settings = [];

		$form_title = get_theme_mod( 'neve_post_comment_form_title' );
		if ( ! empty( $form_title ) ) {
			$form_settings['title_reply'] = $form_title;
		}

		$submit_button_style           = get_theme_mod( 'neve_post_comment_form_button_style', 'primary' );
		$form_settings['class_submit'] = 'button button-' . esc_attr( $submit_button_style );

		$button_text = get_theme_mod( 'neve_post_comment_form_button_text' );
		if ( ! empty( $button_text ) ) {
			$form_settings['label_submit'] = $button_text;
		}

		$boxed_layout = get_theme_mod( 'neve_comments_form_boxed_layout', true );
		if ( $boxed_layout ) {
			$form_settings['class_container'] = 'comment-respond nv-is-boxed';
		}

		return $form_settings;
	}

	/**
	 * Render comment navigation if needed
	 *
	 * @return void
	 */
	private function maybe_render_comments_navigation() {
		if ( get_comment_pages_count() <= 1 || ! get_option( 'page_comments' ) ) {
			return;
		}

		$aria_label = __( 'Comments Navigation', 'neve' );
		?>
		<nav class="nv-comment-navigation" role="navigation" aria-label="<?php echo esc_attr( $aria_label ); ?>">
			<div class="nav-links">
				<div class="nav-previous">
					<?php previous_comments_link( __( 'Previous', 'neve' ) ); ?>
				</div>
				<div class="nav-next">
					<?php next_comments_link( __( 'Next', 'neve' ) ); ?>
				</div>
			</div>
		</nav>
		<?php
	}

	/**
	 * Comment list end callback.
	 *
	 * @param \WP_Comment $comment comment.
	 * @param array       $args    arguments.
	 * @param int         $depth   the comments depth.
	 */
	public function end_comment_list_callback( $comment, $args, $depth ) {
		if ( in_array( $comment->comment_ID, $this->comments_with_children ) ) {
			unset( $this->comments_with_children[ $comment->comment_ID ] );
			echo '</ol></li><!-- close children li -->';
		}
	}

	/**
	 * Comment list callback.
	 *
	 * @param \WP_Comment $comment comment.
	 * @param array       $args    arguments.
	 * @param int         $depth   the comments depth.
	 */
	public function comment_list_callback( $comment, $args, $depth ) {
		switch ( $comment->comment_type ) {

			case 'pingback':
			case 'trackback':
				?>
				<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
					<p>
						<?php
						echo esc_html__( 'Pingback:', 'neve' ) . '&nbsp;';
						comment_author_link();
						edit_comment_link( '(' . esc_html__( 'Edit', 'neve' ) . ')', '&nbsp;<span class="edit-link">', '</span>' );
						?>
					</p>
				</li>
				<?php
				break;
			default:
				?>
				<li <?php comment_class(); ?> id="comment-item-<?php comment_ID(); ?>">
					<article id="comment-<?php comment_ID(); ?>" class="nv-comment-article">
						<?php
						echo '<div class="nv-comment-avatar">';
						echo get_avatar( $comment, 50 );
						echo '</div>';
						echo '<div class="comment-content">';
						?>
						<div class="nv-comment-header">
							<div class="comment-author vcard">
								<span class="fn author"><?php echo get_comment_author_link(); ?></span>
								<a href="<?php echo esc_url( get_comment_link() ); ?>">
									<time class="entry-date published"
											datetime="<?php echo esc_attr( get_comment_time( 'c' ) ); ?>"
											content="<?php echo esc_attr( get_comment_time( 'Y-m-d' ) ); ?>">
										<?php
										/* translators: 1: date, 2: time */
										echo sprintf( esc_html__( '%1$s at %2$s', 'neve' ), esc_html( get_comment_date() ), esc_html( get_comment_time() ) );
										?>
									</time>
								</a>
							</div>
							<?php
							$this->render_edit_reply_link( $args, $depth );
							?>
						</div>
						<div class="nv-comment-content comment nv-content-wrap">
							<?php comment_text(); ?>
							<?php if ( '0' === $comment->comment_approved ) { ?>
								<p class="comment-awaiting-moderation">
									<?php echo esc_html__( 'Comment awaiting moderation.', 'neve' ); ?>
								</p>
							<?php } ?>
						</div>
						<?php
						echo '</div>';
						?>
					</article>
				</li>
				<?php
				break;
		}
		if ( $args['has_children'] === true ) {
			array_push( $this->comments_with_children, $comment->comment_ID );
			echo '<li class="children" role="listitem"><ol>';
		}
	}

	/**
	 *  Render edit/reply link.
	 *
	 * @param array $args comment args.
	 * @param int   $depth the depth of comment.
	 */
	private function render_edit_reply_link( $args, $depth ) {
		?>
		<div class="edit-reply">
			<?php edit_comment_link( '(' . esc_html__( 'Edit', 'neve' ) . ')' ); ?>
			<?php
			comment_reply_link(
				array_merge(
					$args,
					array(
						'reply_text' => esc_html__( 'Reply', 'neve' ),
						'add_below'  => 'comment',
						'depth'      => $depth,
						'max_depth'  => $args['max_depth'],
						'before'     => '<span class="nv-reply-link">',
						'after'      => '</span>',
					)
				)
			);
			?>
		</div>
		<?php
	}

	/**
	 * Get the comments title.
	 *
	 * @return string
	 */
	private function get_comments_title() {

		$comments_number = number_format_i18n( get_comments_number() );
		$title           = get_the_title();

		$empty_comments_title =
			sprintf(
				esc_html(
					/* translators: number of comments */
					_nx(
						'%1$s thought on &ldquo;%2$s&rdquo;',
						'%1$s thoughts on &ldquo;%2$s&rdquo;',
						get_comments_number(),
						'comments title',
						'neve'
					)
				),
				$comments_number,
				$title
			);

		$comments_title = get_theme_mod( 'neve_post_comment_section_title' );
		if ( empty( $comments_title ) ) {
			return apply_filters( 'neve_filter_comments_title', $empty_comments_title );
		}

		$comments_title = str_replace( '{comments_number}', $comments_number, $comments_title );
		$comments_title = str_replace( '{title}', $title, $comments_title );

		return apply_filters( 'neve_filter_comments_title', $comments_title );
	}

	/**
	 * Change reply title tag to h2.
	 *
	 * @param array $args comment form args.
	 *
	 * @return array
	 */
	public function leave_reply_title_tag( $args ) {
		$tag = 'h2';

		$args['title_reply_before'] = '<' . $tag . ' id="reply-title" class="comment-reply-title">';
		$args['title_reply_after']  = '</' . $tag . '>';

		return $args;
	}


	/**
	 * Move textarea field in comment form after the website field.
	 *
	 * @param array $fields array of fields.
	 *
	 * @return array
	 */
	public function move_textarea( $fields ) {
		if ( ! isset( $fields['url'] ) ) {
			return $fields;
		}
		$keys = array_keys( $fields );

		$textarea_index = array_search( 'comment', $keys );
		// Remove textarea
		unset( $keys[ $textarea_index ] );
		// Reset indexes.
		$keys = array_values( $keys );

		// Get website url field index.
		$index = array_search( 'url', $keys );
		// Insert textarea after url field.
		array_splice( $keys, $index + 1, 0, 'comment' );

		$new_fields = [];
		foreach ( $keys as $key ) {
			$new_fields[ $key ] = $fields[ $key ];
		}

		return $new_fields;
	}
}
PK        ƒ¹ò\¬VyA*:  *:                  post_meta.phpnu W+A„¶        PK        ƒ¹ò\Øù/¸µ	  µ	              g:  excerpt.phpnu W+A„¶        PK        ƒ¹ò\ê5Ñ#  Ñ#              WD  comments.phpnu W+A„¶        PK      ä   