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