PageRenderTime 34ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/eclipse/core/actions/comments-actions.php

https://github.com/Bochet/festival_lgbt
PHP | 119 lines | 58 code | 30 blank | 31 comment | 10 complexity | e01947101a47b3861b81d56428525e97 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Comments actions used by response.
  4. *
  5. * Author: Tyler Cunningham
  6. * Copyright: Š 2012
  7. * {@link http://cyberchimps.com/ CyberChimps LLC}
  8. *
  9. * Released under the terms of the GNU General Public License.
  10. * You should have received a copy of the GNU General Public License,
  11. * along with this software. In the main directory, see: /licensing/
  12. * If not, see: {@link http://www.gnu.org/licenses/}.
  13. *
  14. * @package response
  15. * @since 1.0
  16. */
  17. /**
  18. * response comments actions
  19. */
  20. add_action( 'response_comments', 'response_comments_password_required' );
  21. add_action( 'response_comments', 'response_comments_loop' );
  22. /**
  23. * Checks if password is required to comment, sets a filter for text that displays.
  24. *
  25. * @since 1.0
  26. */
  27. function response_comments_password_required() {
  28. global $post;
  29. $password_text = apply_filters( 'response_password_required_text', 'This post is password protected. Enter the password to view comments.');
  30. if ( post_password_required() ) {
  31. printf( $password_text );
  32. return;
  33. }
  34. }
  35. /**
  36. * Runs through the comments "loop"
  37. *
  38. * @since 1.0
  39. */
  40. function response_comments_loop() {
  41. global $post;
  42. $comments_args = array(
  43. 'comment_notes_before' => '',
  44. 'comment_notes_after' => ''
  45. );?>
  46. <?php if ( have_comments() ) : ?>
  47. <div class="comments_container">
  48. <h2 class="commentsh2"><?php comments_number( __('No Responses', 'response' ), __( 'One Response', 'response' ), __('% Responses', 'response' ));?></h2>
  49. <div class="navigation">
  50. <div class="next-posts"><?php previous_comments_link() ?></div>
  51. <div class="prev-posts"><?php next_comments_link() ?></div>
  52. </div>
  53. <div class="clear"></div>
  54. <ol class="commentlist">
  55. <?php wp_list_comments('callback=response_comment'); ?>
  56. </ol>
  57. <div class="navigation">
  58. <div class="next-posts"><?php previous_comments_link() ?></div>
  59. <div class="prev-posts"><?php next_comments_link() ?></div>
  60. </div>
  61. <div class="clear"></div>
  62. </div><!--end comments_container-->
  63. <?php else : // this is displayed if there are no comments so far ?>
  64. <?php if ( comments_open() ) : ?>
  65. <!-- If comments are open, but there are no comments. -->
  66. <?php else : // comments are closed ?>
  67. <?php endif; ?>
  68. <?php endif; ?>
  69. <?php if ( comments_open() && ! post_password_required() ) : ?>
  70. <div class="comments_container">
  71. <div id="respond">
  72. <div class="cancel-comment-reply">
  73. <?php cancel_comment_reply_link(); ?>
  74. </div>
  75. <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
  76. <p><?php _e( 'You must be ', 'response' ); ?><a href="<?php echo wp_login_url( get_permalink() ); ?>"> <?php _e( 'logged in ', 'response' ); ?></a>, <?php _e('to post a comment.', 'response' ); ?></p>
  77. <?php else : ?>
  78. <?php comment_form($comments_args); ?>
  79. <?php endif; ?>
  80. <!--<p>You can use these tags: <code><?php echo allowed_tags(); ?></code></p>-->
  81. </form>
  82. </div>
  83. </div><!--end comments_container-->
  84. <?php endif; // If registration required and not logged in ?>
  85. <?php }
  86. /**
  87. * End
  88. */
  89. ?>