<?php
/**
 * The template for displaying Comments
 *
 * The area of the page that contains comments and the comment form.
 *
 * @package Krown
 * @subpackage Krown
 * @since Krown 1.0
 */

/*
 * 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;
}
?>
<?php
if ( ! function_exists( 'shape_comment' ) ) :
/**
 * Template for comments and pingbacks.
 *
 * Used as a callback by wp_list_comments() for displaying the comments.
 *
 * @since Shape 1.0
 */
function shape_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment;
    switch ( $comment->comment_type ) :
        case 'pingback' :
        case 'trackback' :
    ?>
    <li class="post pingback">
        <p><?php _e( 'Pingback:', 'shape' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'shape' ), ' ' ); ?></p>
    <?php
            break;
        default :
    ?>
    <li class="comment-box" id="li-comment-<?php comment_ID(); ?>">
		<div class="avatar"><?php echo get_avatar( $comment, 80 ); ?></div>
		<?php if ( $comment->comment_approved == '0' ) : ?>
			<em><?php _e( 'Your comment is awaiting moderation.', 'shape' ); ?></em>
			<br />
		<?php endif; ?>
		<div class="comment">
				<h5><?php printf( __( '%s <span class="says">says:</span>', 'shape' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?></h5>
				<div class="date-replay">
				<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
					<time pubdate datetime="<?php comment_time( 'c' ); ?>">
                    <?php
                        /* translators: 1: date, 2: time */
                        printf( __( '%1$s at %2$s', 'shape' ), get_comment_date(), get_comment_time() ); ?>
                    </time>
				</a>
				/ <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
				</div><p><?php comment_text(); ?></p>
		</div>
	</li>
    <?php
            break;
    endswitch;
}
endif;
?>
<div id="comments" class="comment comments-area">

	<?php if ( have_comments() ) : ?>

	<h2>
		<?php
			printf( _n( 'Comments:', 'Comments: ', get_comments_number(), '8w' ),
				number_format_i18n( get_comments_number() ), get_the_title() );
		?>
	</h2>

	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
	<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php _e( 'Comment navigation', '8w' ); ?></h1>
		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', '8w' ) ); ?></div>
		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', '8w' ) ); ?></div>
	</nav><!-- #comment-nav-above -->
	<?php endif; // Check for comment navigation. ?>

	<ol class="comments" style="display:block;">
		<?php
			wp_list_comments( array( 'callback' => 'shape_comment' ) );
		?>
	</ol><!-- .comment-list -->

	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
	<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'evential' ); ?></h1>
		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'evential' ) ); ?></div>
		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'evential' ) ); ?></div>
	</nav><!-- #comment-nav-below -->
	<?php endif; // Check for comment navigation. ?>

	<?php if ( ! comments_open() ) : ?>
	<p class="no-comments"><?php _e( 'Comments are closed.', 'evential' ); ?></p>
	<?php endif; ?>

	<?php endif; // have_comments() ?>
	<?php // Comment Form // ?>
	<div id="footer-wrap" class="post_a_comment">
		<?php
			$comment_args = array( 'title_reply'=>'LEAVE A COMMENT:',
			'fields' => apply_filters( 'comment_form_default_fields', array(
			'author' => '<div class="input_type"><p class="comment-form-author">' . '' . ( $req ? '' : '' ) .
					'<input id="author" name="author" class="form-control name" placeholder="Full Name*" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" /></p>',   
				'email'  => '<p class="comment-form-email">' .
							'' .
							( $req ? '' : '' ) .
							'<input id="email" class="form-control email" placeholder="Email*" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" />'.'</p></div>',
				'url'    => '' ) ),
				'comment_field' => '<div class="text_area">' .
							'' .
							'<textarea id="comment" class="form-control message" name="comment" cols="45" rows="8" placeholder="Message" aria-required="true"></textarea>' .
							'</div>',
				'comment_notes_after' => '',
			);
			comment_form($comment_args); 
		?>
	<div class="clear"></div>
	</div>
</div><!-- #comments -->
