comments.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
  3. <div class="errorbox">
  4. <?php _e('Enter your password to view comments.', 'philna'); ?>
  5. </div>
  6. <?php return; endif; ?>
  7. <?php
  8. $options = get_option('philna_options');
  9. $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));
  10. $count = 0;
  11. ?>
  12. <script type="text/javascript">
  13. /* <![CDATA[ */
  14. ajaxCommentsURL = "<?php bloginfo('template_url'); ?>/comments-ajax.php";
  15. /* ]]> */
  16. </script>
  17. <?php if ($comments || comments_open()):?>
  18. <div id="comments">
  19. <div id="cmtswitcher">
  20. <a id="commenttab" class="curtab" href="javascript:void(0);">
  21. <?php _e('Comments', 'philna');echo ' (';?><span id="allcmnub"><?php echo count($comments)-count($trackbacks);?></span>)</a>
  22. <a id="trackbacktab" class="tab" href="javascript:void(0);">
  23. <?php _e('Trackbacks', 'philna'); echo (' (' . count($trackbacks) . ')'); ?>
  24. </a>
  25. <?php if(comments_open()) : ?>
  26. <span class="addcomment"><a href="#respond"><?php _e('Leave a comment', 'philna'); ?></a></span>
  27. <?php endif; ?>
  28. <?php if(pings_open()) : ?>
  29. <span class="addtrackback"><a href="<?php trackback_url(); ?>"><?php _e('Trackback', 'philna'); ?></a></span>
  30. <?php endif; ?>
  31. <div class="fixed"></div>
  32. </div>
  33. <div id="commentlist">
  34. <!-- comments START -->
  35. <ol id="thecomments" class="display">
  36. <?php
  37. if ($comments && count($comments) - count($trackbacks) > 0) {
  38. foreach ($comments as $comment) {
  39. if(!$comment->comment_type == 'pingback' && !$comment->comment_type == 'trackback') {
  40. ?>
  41. <li class="comment <?php if($comment->comment_author_email == get_the_author_email()) {echo 'admincomment';} else {echo 'regularcomment';} ?>" id="comment-<?php comment_ID() ?>">
  42. <div class="comment-meta">
  43. <? printf( __('%1$s at %2$s', 'philna'), get_comment_time(__('F jS, Y', 'philna')), get_comment_time(__('H:i', 'philna')) ); ?>
  44. | #<span class="cmnub"><?php printf('%1$s', ++$count); ?></span>
  45. <?php edit_comment_link(__('Edit', 'philna'), ' | ', ''); ?>
  46. </div>
  47. <div class="comment-author">
  48. <?php if (function_exists('get_avatar') && get_option('show_avatars')) { echo get_avatar($comment, 32); } ?>
  49. <?php if (get_comment_author_url()) : ?>
  50. <span class="fn"><a id="commentauthor-<?php comment_ID() ?>" href="<?php comment_author_url() ?>"><?php comment_author(); ?></a><?php if($options['xing_show']) get_xing(get_comment_author_email());?></span>
  51. <span class="reply" style="visibility:hidden;"><a href="#commentform" title="Notify this pumpkin." onclick="document.getElementById('comment').value += '&lt;a href=&quot;#comment-<?php comment_ID() ?>&quot;&gt;@<?php comment_author();?> &lt;/a&gt;\n'"><img src="<?php bloginfo('template_url'); ?>/img/reply.gif" alt="Notify"/></a></span>
  52. <?php else : ?>
  53. <span class="fn" id="commentauthor-<?php comment_ID() ?>"><?php comment_author(); ?><?php if($options['xing_show'])get_xing(get_comment_author_email());?></span>
  54. <span class="reply" style="display:none;"><a href="#commentform" title="Notify this pumpkin." onclick="document.getElementById('comment').value += '&lt;a href=&quot;#comment-<?php comment_ID() ?>&quot;&gt;@<?php comment_author();?> &lt;/a&gt;\n'"><img src="<?php bloginfo('template_url'); ?>/img/reply.gif" alt="Notify"/></a></span>
  55. <?php endif; ?>
  56. </div>
  57. <?php if ($comment->comment_approved == '0') : ?>
  58. <p><small class="waiting">Your comment is awaiting moderation.</small></p>
  59. <?php endif; ?>
  60. <?php comment_text(); ?>
  61. </li>
  62. <?php
  63. } // if pingback/trackback
  64. } // foreach
  65. } else {
  66. ?>
  67. <li class="messagebox">
  68. <?php _e('No comments yet.Be the first ?', 'philna'); ?>
  69. </li>
  70. <?php
  71. }
  72. ?>
  73. </ol>
  74. <!-- comments END -->
  75. <!-- trackbacks START -->
  76. <ol id="thetrackbacks" class="nodisplay">
  77. <?php if ($trackbacks) : $count = 0; ?>
  78. <?php foreach ($trackbacks as $comment) : ?>
  79. <li class="trackback">
  80. <div class="act">
  81. | <?php edit_comment_link(__('Edit', 'philna'), '', ''); ?>
  82. </div>
  83. <div class="date">
  84. <? printf( __('%1$s at %2$s', 'philna'), get_comment_time(__('F jS, Y', 'philna')), get_comment_time(__('H:i', 'philna')) ); ?>
  85. | <a href="#comment-<?php comment_ID() ?>"><?php printf('#%1$s', ++$count); ?></a>
  86. </div>
  87. <div class="fixed"></div>
  88. <div class="title">
  89. <a href="<?php comment_author_url() ?>">
  90. <?php comment_author(); ?>
  91. </a>
  92. </div>
  93. <span class="trackbacks-content"><?php comment_text(); ?></span>
  94. </li>
  95. <?php endforeach; ?>
  96. <?php else : ?>
  97. <li class="messagebox">
  98. <?php _e('No trackbacks yet.', 'philna'); ?>
  99. </li>
  100. <?php endif; ?>
  101. </ol>
  102. <!-- trackbacks END -->
  103. </div>
  104. </div><!-- #comments -->
  105. <?php endif; ?>
  106. <?php if (!comments_open()) : // If comments are closed. ?>
  107. <div class="messagebox">
  108. <?php _e('Comments are closed.', 'philna'); ?>
  109. </div>
  110. <?php elseif ( get_option('comment_registration') && !$user_ID ) : // If registration required and not logged in. ?>
  111. <div class="messagebox">
  112. <?php if (function_exists('wp_login_url')) {$login_link = wp_login_url();} else { $login_link = site_url('wp-login.php', 'login'); } ?>
  113. <?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'philna'), $login_link); ?>
  114. </div>
  115. <?php else : ?>
  116. <div id="respond">
  117. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  118. <?php if ($user_ID) : ?>
  119. <?php if (function_exists('wp_logout_url')) {$logout_link = wp_logout_url();} else { $logout_link = site_url('wp-login.php?action=logout', 'login'); } ?>
  120. <div class="row"><?php _e('Logged in as', 'philna'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><strong><?php echo $user_identity; ?></strong></a>. <a href="<?php echo $logout_link; ?>" title="<?php _e('Log out of this account', 'philna'); ?>"><?php _e('Logout &raquo;', 'philna'); ?></a></div>
  121. <?php else : ?>
  122. <?php if ( $comment_author != "" ) : ?>
  123. <script type="text/javascript" charset="utf-8">
  124. //<![CDATA[
  125. var changeMsg = "<?php _e('Change &raquo;','philna'); ?>";
  126. var closeMsg = "<?php _e('Close &raquo;','philna'); ?>";
  127. //]]>
  128. </script>
  129. <div class="row welcome">
  130. <?php echo get_avatar($comment_author_email, 32); printf(__('Welcome back <strong>%s</strong>.', 'philna'), $comment_author) ?>
  131. <span id="show_author_info"><a href="javascript:void(0);"><?php _e('Change &raquo;','philna'); ?></a></span>
  132. </div>
  133. <?php endif; ?>
  134. <div id="author_info"<?php if ( $comment_author != "" ) echo 'style="display:none"';?>>
  135. <span class="row">
  136. <input type="text" name="author" id="author" class="textfield" value="<?php echo $comment_author; ?>" size="24" tabindex="1" />
  137. <label for="author" class="small"><?php _e('Name', 'philna'); ?> <?php if ($req) _e('(required)', 'philna'); ?></label>
  138. </span>
  139. <span class="row">
  140. <input type="text" name="email" id="email" class="textfield" value="<?php echo $comment_author_email; ?>" size="24" tabindex="2" />
  141. <label for="email" class="small"><?php _e('E-Mail (will not be published)', 'philna');?> <?php if ($req) _e('(required)', 'philna'); ?></label>
  142. </span>
  143. <span class="row">
  144. <input type="text" name="url" id="url" class="textfield" value="<?php echo $comment_author_url; ?>" size="24" tabindex="3" />
  145. <label for="url" class="small"><?php _e('Website', 'philna'); ?></label>
  146. </span>
  147. </div>
  148. <?php endif; ?>
  149. <!-- comment input -->
  150. <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/edit_button.js"></script>
  151. <script type="text/javascript">edToolbar('comment');</script>
  152. <div class="row cmarea">
  153. <textarea name="comment" id="comment" tabindex="4" rows="8" cols="50"></textarea>
  154. <div id="commentload" class="center" style="display:none;">
  155. <img src="<?php bloginfo('template_url'); ?>/img/ajaxload.gif" alt="loading" /> <?php _e('Submitting Comment, Wait me a second...','philna')?>
  156. </div>
  157. </div>
  158. <div id="submitbox">
  159. <a class="feed" href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Comments feed', 'philna'); ?></a>
  160. <script type="text/javascript">
  161. /* <![CDATA[ */
  162. //ctrl+enter
  163. document.getElementById("comment").onkeydown = function (moz_ev){
  164. var ev = null;
  165. if (window.event){
  166. ev = window.event;
  167. }else{
  168. ev = moz_ev;
  169. }
  170. if (ev != null && ev.ctrlKey && ev.keyCode == 13)
  171. {
  172. document.getElementById("submit").click();
  173. }
  174. }
  175. /* ]]> */
  176. </script>
  177. <input name="submit" type="submit" id="submit" class="button" tabindex="5" value="<?php _e('Submit Comment', 'philna'); ?>" />
  178. <?php if (function_exists('highslide_emoticons')) : ?>
  179. <div id="emoticon"><?php highslide_emoticons(); ?></div>
  180. <?php endif; ?>
  181. <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
  182. <?php do_action('comment_form', $post->ID); ?>
  183. <div class="fixed"></div>
  184. </div>
  185. </form>
  186. </div>
  187. <?php endif; ?>