PageRenderTime 53ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/wp-content/themes/k2/comments.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 140 lines | 114 code | 24 blank | 2 comment | 17 complexity | 2a98165641c8f9c086ebb27745f3e05d MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. // Do not access this file directly
  3. if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die (__('Please do not load this page directly. Thanks!','k2_domain')); }
  4. // Password Protection
  5. if (post_password_required()) {
  6. ?>
  7. <p class="nopassword"><?php _e('This post is password protected. Enter the password to view comments.','k2_domain'); ?></p>
  8. <?php return; }
  9. function k2_comment($comment, $args, $depth) {
  10. $GLOBALS['comment'] = $comment;
  11. global $comment_index;
  12. $comment_index++;
  13. extract($args, EXTR_SKIP);
  14. ?>
  15. <li <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
  16. <div id="div-comment-<?php comment_ID() ?>">
  17. <span class="comment-author vcard">
  18. <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
  19. <a href="#comment-<?php comment_ID(); ?>" class="counter" title="<?php _e('Permanent Link to this Comment','k2_domain'); ?>"><?php echo $comment_index; ?></a>
  20. <span class="commentauthor fn"><?php comment_author_link(); ?></span>
  21. </span>
  22. <small class="comment-meta">
  23. <?php
  24. printf('<a href="#comment-%1$s" title="%2$s">%3$s</a>',
  25. get_comment_ID(),
  26. (function_exists('time_since')?
  27. sprintf(__('%s ago.','k2_domain'),
  28. time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time())
  29. ):
  30. __('Permanent Link to this Comment','k2_domain')
  31. ),
  32. sprintf(__('%1$s at %2$s','k2_domain'),
  33. get_comment_date(),
  34. get_comment_time()
  35. )
  36. );
  37. ?>
  38. </small>
  39. <div class="comment-content">
  40. <?php comment_text(); ?>
  41. </div>
  42. <?php if ('0' == $comment->comment_approved) { ?><p class="alert"><strong><?php _e('Your comment is awaiting moderation.','k2_domain'); ?></strong></p><?php } ?>
  43. <div class="reply">
  44. <?php comment_reply_link(array_merge( $args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  45. </div>
  46. </div>
  47. <?php
  48. }
  49. function k2_ping($comment, $args, $depth) {
  50. $GLOBALS['comment'] = $comment;
  51. global $ping_index;
  52. $ping_index++;
  53. extract($args, EXTR_SKIP);
  54. ?>
  55. <li <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
  56. <?php if (function_exists('comment_favicon')) { ?><span class="favatar"><?php comment_favicon(); ?></span><?php } ?>
  57. <a href="#comment-<?php comment_ID() ?>" title="<?php _e('Permanent Link to this Comment','k2_domain'); ?>" class="counter"><?php echo $ping_index; ?></a>
  58. <span class="commentauthor"><?php comment_author_link(); ?></span>
  59. <small class="comment-meta">
  60. <?php
  61. printf(__('%1$s on %2$s','k2_domain'),
  62. '<span class="pingtype">' . __('Trackback','k2_domain') . '</span>',
  63. sprintf('<a href="#comment-%1$s" title="%2$s">%3$s</a>',
  64. get_comment_ID(),
  65. (function_exists('time_since')?
  66. sprintf(__('%s ago.','k2_domain'),
  67. time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time())
  68. ):
  69. __('Permanent Link to this Comment','k2_domain')
  70. ),
  71. sprintf(__('%1$s at %2$s','k2_domain'),
  72. get_comment_date(),
  73. get_comment_time()
  74. )
  75. )
  76. );
  77. ?>
  78. <?php if ($user_ID) { edit_comment_link(__('Edit','k2_domain'),'<span class="comment-edit">','</span>'); } ?>
  79. </small>
  80. <?php
  81. }
  82. if ((have_comments()) or (comments_open())) : $shownavigation = 'yes'; ?>
  83. <div class="comments">
  84. <h4><?php printf(__('%1$s %2$s to &#8220;%3$s&#8221;','k2_domain'), '<span id="comments">' . get_comments_number() . '</span>', (1 == $post->comment_count) ? __('Response','k2_domain'): __('Responses','k2_domain'), esc_html( get_the_title() ) ); ?></h4>
  85. <div class="metalinks">
  86. <span class="commentsrsslink"><?php post_comments_feed_link( __( 'Feed for this Entry', 'k2_domain' ) ); ?></span>
  87. <?php if ('open' == $post->ping_status) { ?><span class="trackbacklink"><a href="<?php trackback_url(); ?>" title="<?php _e('Copy this URI to trackback this entry.','k2_domain'); ?>"><?php _e('Trackback Address','k2_domain'); ?></a></span><?php } ?>
  88. </div>
  89. <hr />
  90. <ol id="commentlist">
  91. <?php wp_list_comments(array('callback'=>'k2_comment', 'avatar_size'=>48, 'type'=>'comment')); ?>
  92. </ol> <!-- END #commentlist -->
  93. <div class="navigation">
  94. <div class="alignleft"><?php previous_comments_link() ?></div>
  95. <div class="alignright"><?php next_comments_link() ?></div>
  96. </div>
  97. <br />
  98. <ol id="pinglist">
  99. <?php wp_list_comments(array('callback'=>'k2_ping', 'type'=>'pings')); ?>
  100. </ol> <!-- END #pinglist -->
  101. <?php /* Comments open, but empty */ if ( ($post->comment_count < 1) and (comments_open()) ) { ?>
  102. <ol id="commentlist">
  103. <li id="leavecomment">
  104. <?php _e('Leave a Comment','k2_domain'); ?>
  105. </li>
  106. </ol>
  107. <?php } ?>
  108. <?php /* Comments closed */ if ( !comments_open() ) { ?>
  109. <div><?php _e('Comments are currently closed.','k2_domain'); ?></div>
  110. <?php } ?>
  111. </div> <!-- END .comments 1 -->
  112. <?php endif; ?>
  113. <?php /* Reply Form */ if (comments_open()) { ?>
  114. <?php comment_form(); ?>
  115. <?php } // comment_status ?>
  116. <?php if ($shownavigation) { include (TEMPLATEPATH . '/navigation.php'); } ?>