<?php
/**
 * The template for displaying Comments
 *
 * @package WordPress
 * @subpackage Javo_Directory
 * @since Javo Themes 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;
?>

<div id="comments" class="comments-area">

	<?php // You can start editing here -- including this comment! ?>

	<?php if ( have_comments() ) : ?>
	<h3 id="comments"><?php comments_number(__('No Comments','javo_fr'), __('One Comment', 'javo_fr'), __('% Comments', 'javo_fr') );?></h3>

	<div class="navigation">
		<div class="alignleft"><?php previous_comments_link() ?></div>
		<div class="alignright"><?php next_comments_link() ?></div>
	</div>

		<ul class="commentlist">
			<?php wp_list_comments( array( 'callback' => 'javo_drt_comment', 'avatar_size' => 60 ) ); ?>
		</ul><!-- .commentlist -->

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
		<nav id="comment-nav-below" class="navigation" role="navigation">
			<h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'javo_fr' ); ?></h1>
			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'javo_fr' ) ); ?></div>
			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'javo_fr' ) ); ?></div>
		</nav>
		<?php endif; // check for comment navigation ?>

		<?php
		/* If there are no comments and comments are closed, let's leave a note.
		 * But we only want the note on posts and pages that had comments in the first place.
		 */
		if ( ! comments_open() && get_comments_number() ) : ?>
		<p class="nocomments"><?php _e( 'Comments are closed.' , 'javo_fr' ); ?></p>
		<?php endif; ?>

	<?php endif; // have_comments() ?>

	<?php
	if ( comments_open() ) :


	$required_text = null;
	$commenter = wp_get_current_commenter();
	$req      = get_option( 'require_name_email' );
	$aria_req = ( $req ? " aria-required='true'" : '' );
	$html5    = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;


	$args = array(
	  'id_form'				=> __( 'commentform','javo_fr' )
	  , 'id_submit'			=> __( 'submit','javo_fr' )
	  , 'title_reply'		=> __( 'Leave a Reply', 'javo_fr' )
	  , 'title_reply_to'	=> __( 'Leave a Reply to %s', 'javo_fr' )
	  , 'cancel_reply_link'	=> __( 'Cancel Reply', 'javo_fr' )
	  , 'label_submit'		=> __( 'Submit Comment', 'javo_fr' )
	  , 'comment_field'		=> '<div class="form-group comment-form-comment"><textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="'. __('Comment (required)', 'javo_fr') .'"></textarea></div><button class="btn btn-primary" type="submit">' . __( 'Submit', 'javo_fr' ) . '</button>'
	  , 'must_log_in' => '<p class="must-log-in">' .
		sprintf(
		  __( 'You must be <a href="%s">logged in</a> to post a comment.', 'javo_fr' ),
		  wp_login_url( apply_filters( 'the_permalink', get_permalink() ) )
		) . '</p>',

	  'logged_in_as' => '<p class="logged-in-as">' .
		sprintf(
		__( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'javo_fr' ),
		  admin_url( 'profile.php' ),
		  $user_identity,
		  wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) )
		) . '</p>',

	  'comment_notes_before' => '<p class="comment-notes">' .
		__( 'Your email address will not be published.', 'javo_fr' ) . ( $req ? $required_text : '' ) .
		'</p>',

	  'comment_notes_after' => '',

	  'fields' => apply_filters( 'comment_form_default_fields', array(

		 'author' => '<div class="row"><div class="col-md-4"><div class="form-group comment-form-author">' .
						// '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
						'<input class="form-control" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="22"' . $aria_req . ' tabindex="1" placeholder="'. __('Name (required)', 'javo_fr') .'"/></div></div>',
			'email'  => '<div class="col-md-4"><div class="form-group comment-form-email">' .
						//<label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> '
						'<input class="form-control" id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '  tabindex="2" placeholder="'.__('Email (required)','javo_fr').'" /></div></div>',
			'url'    => '<div class="col-md-4"><div class="form-group comment-form-url">' .
						//<label for="url">' . __( 'Website' ) . '</label>
						'<input class="form-control" id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"  tabindex="3" placeholder="'.__('Site','javo_fr').'" /></div></div></div>',
		)
	  ),
	);

	comment_form($args);
	endif; ?>

</div><!-- #comments .comments-area -->