web/wp-content/themes/elegant-box/comments.php
changeset 1 0d28b7c10758
equal deleted inserted replaced
0:0d9a58d2c515 1:0d28b7c10758
       
     1 <?php
       
     2 	// Do not delete these lines
       
     3 	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
       
     4 		die ('Please do not load this page directly. Thanks!');
       
     5 ?>
       
     6 
       
     7 <?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
       
     8 	<div class="messagebox">
       
     9 		<div class="content small">
       
    10 			<?php _e('Enter your password to view comments.', 'elegantbox'); ?>
       
    11 		</div>
       
    12 	</div>
       
    13 <?php return; endif; ?>
       
    14 <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/comment.js"></script>
       
    15 <?php
       
    16 	$options = get_option('elegantbox_options');
       
    17 	$trackbacks = array(); 
       
    18 ?>
       
    19 
       
    20 <?php if ($comments) : ?>
       
    21 	<!-- comments START -->
       
    22 	<ol class="commentlist">
       
    23 		<?php
       
    24 			// WordPress 2.7 or higher
       
    25 			if (function_exists('wp_list_comments')) {
       
    26 				wp_list_comments('type=comment&callback=custom_comments');
       
    27 				$trackbacks = $comments_by_type['pings'];
       
    28 			// WordPress 2.6.3 or lower
       
    29 			} else {
       
    30 				foreach ($comments as $comment) {
       
    31 					if($comment->comment_type == 'pingback' || $comment->comment_type == 'trackback') {
       
    32 						array_push($trackbacks, $comment);
       
    33 					} else {
       
    34 						custom_comments($comment, null, null);
       
    35 						echo '</li>';
       
    36 					}
       
    37 				}
       
    38 			}
       
    39 		?>
       
    40 	</ol>
       
    41 	<!-- comments END -->
       
    42 
       
    43 	<!-- comments navi START -->
       
    44 	<?php
       
    45 		if(get_option('page_comments')) {
       
    46 			$comment_pages = paginate_comments_links('echo=0');
       
    47 			if ($comment_pages) {
       
    48 	?>
       
    49 			<div id="commentnavi" class="messagebox">
       
    50 				<div class="content">
       
    51 					<span class="pages"><?php _e('Comment pages', 'elegantbox'); ?></span>
       
    52 					<div id="commentpager">
       
    53 						<?php echo $comment_pages; ?>
       
    54 
       
    55 					</div>
       
    56 				</div>
       
    57 			</div>
       
    58 	<?php
       
    59 			}
       
    60 		}
       
    61 	?>
       
    62 	<!-- comments navi END -->
       
    63 
       
    64 	<!-- trackback START -->
       
    65 	<?php if($trackbacks) : ?>
       
    66 		<div id="trackbacks">
       
    67 			<div class="caption">
       
    68 				<h3><?php echo count($trackbacks); _e(' trackbacks', 'elegantbox'); ?></h3>
       
    69 				<div class="actions">
       
    70 					<a id="trackbacks_show" href="javascript:void(0);" onclick="MGJS.setStyleDisplay('trackbacks_hide','');MGJS.setStyleDisplay('trackbacks_box','');MGJS.setStyleDisplay('trackbacks_show','none');"><?php _e('Show', 'elegantbox'); ?></a>
       
    71 					<a id="trackbacks_hide" href="javascript:void(0);" onclick="MGJS.setStyleDisplay('trackbacks_show','');MGJS.setStyleDisplay('trackbacks_box','none');MGJS.setStyleDisplay('trackbacks_hide','none');"><?php _e('Hide', 'elegantbox'); ?></a>
       
    72 				</div>
       
    73 				<div class="fixed"></div>
       
    74 			</div>
       
    75 			<div id="trackbacks_box" class="content">
       
    76 				<ol>
       
    77 					<?php foreach ($trackbacks as $comment) : ?>
       
    78 						<li>
       
    79 							<?php comment_author_link(); ?>
       
    80 							<small>
       
    81 								<strong><?php comment_type(); ?></strong>
       
    82 								 | <?php comment_date('Y/m/d'); edit_comment_link(__('Edit', 'elegantbox'), ' | ', ''); ?>
       
    83 							</small>
       
    84 						</li>
       
    85 					<?php endforeach; ?>
       
    86 				</ol>
       
    87 			</div>
       
    88 		</div>
       
    89 		<script type="text/javascript">MGJS.setStyleDisplay('trackbacks_hide','none');MGJS.setStyleDisplay('trackbacks_box','none');</script>
       
    90 	<?php endif; ?>
       
    91 	<!-- trackback END -->
       
    92 
       
    93 <?php elseif (comments_open()) : // If there are no comments yet. ?>
       
    94 	<div class="messagebox">
       
    95 		<div class="content small">
       
    96 			<?php _e('No comments yet.', 'elegantbox'); ?>
       
    97 		</div>
       
    98 	</div>
       
    99 
       
   100 <?php endif; ?>
       
   101 
       
   102 <?php if (!comments_open()) : // If comments are closed. ?>
       
   103 	<div class="messagebox">
       
   104 		<div class="content small">
       
   105 			<?php _e('Comments are closed.', 'elegantbox'); ?>
       
   106 		</div>
       
   107 	</div>
       
   108 
       
   109 <?php elseif ( get_option('comment_registration') && !$user_ID ) : // If registration required and not logged in. ?>
       
   110 	<div class="messagebox">
       
   111 		<div class="content small">
       
   112 			<?php
       
   113 				if (function_exists('wp_login_url')) {
       
   114 					$login_link = wp_login_url();
       
   115 				} else {
       
   116 					$login_link = get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode(get_permalink());
       
   117 				}
       
   118 			?>
       
   119 			<?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'elegantbox'), $login_link); ?>
       
   120 		</div>
       
   121 	</div>
       
   122 
       
   123 <?php else : ?>
       
   124 	<div id="respond">
       
   125 	<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
       
   126 
       
   127 	<!-- comment info -->
       
   128 	<div id="comment_header">
       
   129 		<div id="comment_info">
       
   130 			<?php if ( $user_ID ) : ?>
       
   131 				<?php
       
   132 					if (function_exists('wp_logout_url')) {
       
   133 						$logout_link = wp_logout_url();
       
   134 					} else {
       
   135 						$logout_link = get_option('siteurl') . '/wp-login.php?action=logout';
       
   136 					}
       
   137 				?>
       
   138 				<div class="row">
       
   139 					<?php _e('Logged in as', 'elegantbox'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><strong><?php echo $user_identity; ?></strong></a>.
       
   140 					 <a href="<?php echo $logout_link; ?>" title="<?php _e('Log out of this account', 'elegantbox'); ?>"><?php _e('Logout &raquo;', 'elegantbox'); ?></a>
       
   141 				</div>
       
   142 
       
   143 			<?php else : ?>
       
   144 				<?php if ( $comment_author != "" ) : ?>
       
   145 					<script type="text/javascript">function setStyleDisplay(id, status){document.getElementById(id).style.display = status;}</script>
       
   146 					<div class="row">
       
   147 						<?php printf(__('Welcome back <strong>%s</strong>.', 'elegantbox'), $comment_author) ?>
       
   148 						<span id="show_author_info"><a href="javascript:void(0);" onclick="MGJS.setStyleDisplay('author_info','');MGJS.setStyleDisplay('show_author_info','none');MGJS.setStyleDisplay('hide_author_info','');"><?php _e('Change &raquo;', 'elegantbox'); ?></a></span>
       
   149 						<span id="hide_author_info"><a href="javascript:void(0);" onclick="MGJS.setStyleDisplay('author_info','none');MGJS.setStyleDisplay('show_author_info','');MGJS.setStyleDisplay('hide_author_info','none');"><?php _e('Close &raquo;', 'elegantbox'); ?></a></span>
       
   150 					</div>
       
   151 				<?php endif; ?>
       
   152 
       
   153 				<div id="author_info">
       
   154 					<div class="row">
       
   155 						<input type="text" name="author" id="author" class="textfield" value="<?php echo $comment_author; ?>" size="24" tabindex="1" />
       
   156 						<label for="author" class="small"><?php _e('Name', 'elegantbox'); ?> <?php if ($req) _e('(required)', 'elegantbox'); ?></label>
       
   157 					</div>
       
   158 					<div class="row">
       
   159 						<input type="text" name="email" id="email" class="textfield" value="<?php echo $comment_author_email; ?>" size="24" tabindex="2" />
       
   160 						<label for="email" class="small"><?php _e('E-Mail (will not be published)', 'elegantbox');?> <?php if ($req) _e('(required)', 'elegantbox'); ?></label>
       
   161 					</div>
       
   162 					<div class="row">
       
   163 						<input type="text" name="url" id="url" class="textfield" value="<?php echo $comment_author_url; ?>" size="24" tabindex="3" />
       
   164 						<label for="url" class="small"><?php _e('Website', 'elegantbox'); ?></label>
       
   165 					</div>
       
   166 				</div>
       
   167 
       
   168 				<?php if ( $comment_author != "" ) : ?>
       
   169 					<script type="text/javascript">setStyleDisplay('hide_author_info','none');setStyleDisplay('author_info','none');</script>
       
   170 				<?php endif; ?>
       
   171 
       
   172 			<?php endif; ?>
       
   173 		</div>
       
   174 	</div>
       
   175 
       
   176 	<!-- comment input -->
       
   177 	<textarea name="comment" id="comment" tabindex="4" rows="8" cols="50"></textarea>
       
   178 
       
   179 	<!-- comment submit and rss -->
       
   180 	<div id="submitbox">
       
   181 		<div id="comments_rss">
       
   182 			<a href="<?php bloginfo('comments_rss2_url'); ?>">
       
   183 				<span class="feed"><?php _e('Subscribe to comments feed', 'elegantbox'); ?></span>
       
   184 			</a>
       
   185 		</div>
       
   186 
       
   187 		<div class="act">
       
   188 			<?php if (function_exists('wp_list_comments')) : ?>
       
   189 				<?php cancel_comment_reply_link(__('Cancel', 'elegantbox')) ?>
       
   190 			<?php endif; ?>
       
   191 			<input name="submit" type="submit" id="submit" class="button" tabindex="5" value="<?php _e('Submit Comment', 'elegantbox'); ?>" />
       
   192 		</div>
       
   193 		<?php if (function_exists('highslide_emoticons')) : ?>
       
   194 			<div id="emoticon"><?php highslide_emoticons(); ?></div>
       
   195 		<?php endif; ?>
       
   196 
       
   197 		<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
       
   198 		<?php if (function_exists('wp_list_comments')) : ?>
       
   199 			<?php comment_id_fields(); ?>
       
   200 		<?php endif; ?>
       
   201 		<div class="fixed"></div>
       
   202 	</div>
       
   203 
       
   204 	<?php do_action('comment_form', $post->ID); ?>
       
   205 	</form>
       
   206 	</div>
       
   207 
       
   208 	<?php if ($options['ctrlentry']) : ?>
       
   209 		<script type="text/javascript">CMT.loadCommentShortcut('commentform', 'submit', ' (Ctrl+Enter)');</script>
       
   210 	<?php endif; ?>
       
   211 
       
   212 <?php endif; ?>