PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/wp-content/themes/extinct/guruq/comments.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 138 lines | 118 code | 20 blank | 0 comment | 27 complexity | e0ca6cb81df052cf9922eeaf05ba7fe9 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. if ( 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']) )
  3. die ( 'Please do not load this page directly. Thanks.' );
  4. ?>
  5. <div id="comments">
  6. <?php
  7. if ( !empty($post->post_password) ) :
  8. if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) :
  9. ?>
  10. <div class="nopassword"><?php _e( 'This post is protected. Enter the password to view any comments.', 'sandbox' ) ?></div>
  11. </div><!-- .comments -->
  12. <?php
  13. return;
  14. endif;
  15. endif;
  16. ?>
  17. <?php // Number of pings and comments
  18. $ping_count = $comment_count = 0;
  19. foreach ( $comments as $comment )
  20. get_comment_type() == "comment" ? ++$comment_count : ++$ping_count;
  21. ?>
  22. <?php
  23. function sandbox_comments($comment, $args, $depth) {
  24. $GLOBALS['comment'] = $comment;
  25. extract($args, EXTR_SKIP);
  26. global $sandbox_comment_alt;
  27. ?>
  28. <?php if ( get_comment_type() == "comment" ) : ?>
  29. <li id="comment-<?php comment_ID() ?>" class="<?php sandbox_comment_class() ?>">
  30. <div class="comment-author vcard"><?php sandbox_commenter_link() ?></div>
  31. <div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'sandbox'),
  32. get_comment_date(),
  33. get_comment_time(),
  34. '#comment-' . get_comment_ID() );
  35. echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | '));
  36. edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
  37. <?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'sandbox') ?>
  38. <?php comment_text() ?>
  39. </li>
  40. <?php endif; // REFERENCE: if ( get_comment_type() == "comment" ) ?>
  41. <?php } ?>
  42. <?php
  43. function sandbox_trackbacks($comment, $args, $depth) {
  44. $GLOBALS['comment'] = $comment;
  45. extract($args, EXTR_SKIP);
  46. global $sandbox_comment_alt;
  47. ?>
  48. <?php if ( get_comment_type() != "comment" ) : ?>
  49. <li id="comment-<?php comment_ID() ?>" class="<?php sandbox_comment_class() ?>">
  50. <div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'sandbox'),
  51. get_comment_author_link(),
  52. get_comment_date(),
  53. get_comment_time() );
  54. edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
  55. <?php if ($comment->comment_approved == '0') _e('\t\t\t\t\t<span class="unapproved">Your trackback is awaiting moderation.</span>\n', 'sandbox') ?>
  56. <?php comment_text() ?>
  57. </li>
  58. <?php endif // REFERENCE: if ( get_comment_type() != "comment" ) ?>
  59. <?php } ?>
  60. <?php if ( $comment_count ) : ?>
  61. <?php $sandbox_comment_alt = 0 ?>
  62. <div id="comments-list" class="comments">
  63. <h3><?php printf($comment_count > 1 ? __('<span>%d</span> Comments', 'sandbox') : __('<span>One</span> Comment', 'sandbox'), $comment_count) ?></h3>
  64. <ol>
  65. <?php wp_list_comments( array( 'callback' => 'sandbox_comments' ) ); ?>
  66. </ol>
  67. </div><!-- #comments-list .comments -->
  68. <?php endif; // REFERENCE: if ( $comment_count ) ?>
  69. <?php if ( $ping_count ) : ?>
  70. <?php $sandbox_comment_alt = 0 ?>
  71. <div id="trackbacks-list" class="comments">
  72. <h3><?php printf($ping_count > 1 ? __('<span>%d</span> Trackbacks', 'sandbox') : __('<span>One</span> Trackback', 'sandbox'), $ping_count) ?></h3>
  73. <ol>
  74. <?php wp_list_comments( array( 'callback' => 'sandbox_trackbacks' ) ); ?>
  75. </ol>
  76. </div><!-- #trackbacks-list .comments -->
  77. <?php endif // REFERENCE: if ( $ping_count ) ?>
  78. <div class="navigation">
  79. <?php paginate_comments_links(); ?>
  80. </div>
  81. <?php if ( comments_open() ) : ?>
  82. <?php $req = get_option('require_name_email'); // Checks if fields are required. Thanks, Adam. ;-) ?>
  83. <div id="respond">
  84. <h3><?php _e( 'Post a Comment', 'sandbox' ) ?></h3>
  85. <div class="cancel-comment-reply">
  86. <small><?php cancel_comment_reply_link() ?></small>
  87. </div>
  88. <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  89. <p id="login-req"><?php printf(__('You must be <a href="%s" title="Log in">logged in</a> to post a comment.', 'sandbox'),
  90. get_bloginfo('wpurl') . '/wp-login.php?redirect_to=' . get_permalink() ) ?></p>
  91. <?php else : ?>
  92. <div class="formcontainer">
  93. <form id="commentform" action="<?php bloginfo('wpurl') ?>/wp-comments-post.php" method="post">
  94. <?php comment_id_fields(); ?>
  95. <?php if ( $user_ID ) : ?>
  96. <p id="login"><?php printf( __( '<span class="loggedin">Logged in as <a href="%1$s" title="Logged in as %2$s">%2$s</a>.</span> <span class="logout"><a href="%3$s" title="Log out of this account">Log out?</a></span>', 'sandbox' ),
  97. get_bloginfo('wpurl') . '/wp-admin/profile.php',
  98. esc_html( $user_identity ),
  99. get_bloginfo('wpurl') . '/wp-login.php?action=logout&amp;redirect_to=' . get_permalink() ) ?></p>
  100. <?php else : ?>
  101. <p id="comment-notes"><?php if ($req) _e( 'Required fields are marked <span class="required">*</span>', 'sandbox' ) ?></p>
  102. <div class="form-label"><label for="author"><?php _e( 'Name', 'sandbox' ) ?></label> <?php if ($req) _e( '<span class="required">*</span>', 'sandbox' ) ?></div>
  103. <div class="form-input"><input id="author" name="author" class="text<?php if ($req) echo ' required'; ?>" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="50" tabindex="3" /></div>
  104. <div class="form-label"><label for="email"><?php _e( 'Email', 'sandbox' ) ?></label> <?php if ($req) _e( '<span class="required">*</span>', 'sandbox' ) ?></div>
  105. <div class="form-input"><input id="email" name="email" class="text<?php if ($req) echo ' required'; ?>" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="4" /></div>
  106. <div class="form-label"><label for="url"><?php _e( 'Website', 'sandbox' ) ?></label></div>
  107. <div class="form-input"><input id="url" name="url" class="text" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" /></div>
  108. <?php endif // REFERENCE: * if ( $user_ID ) ?>
  109. <div class="form-label"><label for="comment"><?php _e( 'Comment', 'sandbox' ) ?></label></div>
  110. <div class="form-textarea"><textarea id="comment" name="comment" class="text required" cols="45" rows="8" tabindex="6"></textarea></div>
  111. <div class="form-submit"><input id="submit" name="submit" class="button" type="submit" value="<?php _e( 'Post Comment', 'sandbox' ) ?>" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php echo $id ?>" /></div>
  112. <div class="form-option"><?php do_action( 'comment_form', $post->ID ) ?></div>
  113. </form><!-- #commentform -->
  114. </div><!-- .formcontainer -->
  115. <?php endif // REFERENCE: if ( get_option('comment_registration') && !$user_ID ) ?>
  116. </div><!-- #respond -->
  117. <?php endif // REFERENCE: if ( comments_open() ) ?>
  118. </div><!-- #comments -->