PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/comments.php

https://github.com/ShovanSargunam/reverie
PHP | 102 lines | 94 code | 7 blank | 1 comment | 20 complexity | fb45ae490a8c3c0e7bf1c942e9254ab4 MD5 | raw file
  1. <?php function reverie_comments($comment, $args, $depth) {
  2. $GLOBALS['comment'] = $comment; ?>
  3. <li <?php comment_class(); ?>>
  4. <article id="comment-<?php comment_ID(); ?>">
  5. <header class="comment-author vcard">
  6. <?php echo get_avatar($comment,$size='40'); ?>
  7. <?php printf(__('<cite class="fn">%s</cite>', 'reverie'), get_comment_author_link()) ?>
  8. <time datetime="<?php echo comment_date('c') ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s', 'reverie'), get_comment_date(), get_comment_time()) ?></a></time>
  9. <?php edit_comment_link(__('(Edit)', 'reverie'), '', '') ?>
  10. </header>
  11. <?php if ($comment->comment_approved == '0') : ?>
  12. <div class="notice">
  13. <p class="bottom"><?php _e('Your comment is awaiting moderation.', 'reverie') ?></p>
  14. </div>
  15. <?php endif; ?>
  16. <section class="comment">
  17. <?php comment_text() ?>
  18. </section>
  19. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  20. </article>
  21. <?php } ?>
  22. <?php
  23. // Do not delete these lines
  24. if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  25. die (__('Please do not load this page directly. Thanks!', 'reverie'));
  26. if ( post_password_required() ) { ?>
  27. <section id="comments">
  28. <div class="notice">
  29. <p class="bottom"><?php _e('This post is password protected. Enter the password to view comments.', 'reverie'); ?></p>
  30. </div>
  31. </section>
  32. <?php
  33. return;
  34. }
  35. ?>
  36. <?php // You can start editing here. Customize the respond form below ?>
  37. <?php if ( have_comments() ) : ?>
  38. <section id="comments">
  39. <h3><?php comments_number(__('No Responses to', 'reverie'), __('One Response to', 'reverie'), __('% Responses to', 'reverie') ); ?> &#8220;<?php the_title(); ?>&#8221;</h3>
  40. <ol class="commentlist">
  41. <?php wp_list_comments('type=comment&callback=reverie_comments'); ?>
  42. </ol>
  43. <footer>
  44. <nav id="comments-nav">
  45. <div class="comments-previous"><?php previous_comments_link( __( '&larr; Older comments', 'reverie' ) ); ?></div>
  46. <div class="comments-next"><?php next_comments_link( __( 'Newer comments &rarr;', 'reverie' ) ); ?></div>
  47. </nav>
  48. </footer>
  49. </section>
  50. <?php else : // this is displayed if there are no comments so far ?>
  51. <?php if ( comments_open() ) : ?>
  52. <?php else : // comments are closed ?>
  53. <section id="comments">
  54. <div class="notice">
  55. <p class="bottom"><?php _e('Comments are closed.', 'reverie') ?></p>
  56. </div>
  57. </section>
  58. <?php endif; ?>
  59. <?php endif; ?>
  60. <?php if ( comments_open() ) : ?>
  61. <section id="respond">
  62. <h3><?php comment_form_title( __('Leave a Reply', 'reverie'), __('Leave a Reply to %s', 'reverie') ); ?></h3>
  63. <p class="cancel-comment-reply"><?php cancel_comment_reply_link(); ?></p>
  64. <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
  65. <p><?php printf( __('You must be <a href="%s">logged in</a> to post a comment.', 'reverie'), wp_login_url( get_permalink() ) ); ?></p>
  66. <?php else : ?>
  67. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  68. <?php if ( is_user_logged_in() ) : ?>
  69. <p><?php printf(__('Logged in as <a href="%s/wp-admin/profile.php">%s</a>.', 'reverie'), get_option('siteurl'), $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php __('Log out of this account', 'reverie'); ?>"><?php _e('Log out &raquo;', 'reverie'); ?></a></p>
  70. <?php else : ?>
  71. <p>
  72. <label for="author"><?php _e('Name', 'reverie'); if ($req) _e(' (required)', 'reverie'); ?></label>
  73. <input type="text" class="five" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?>>
  74. </p>
  75. <p>
  76. <label for="email"><?php _e('Email (will not be published)', 'reverie'); if ($req) _e(' (required)', 'reverie'); ?></label>
  77. <input type="text" class="five" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?>>
  78. </p>
  79. <p>
  80. <label for="url"><?php _e('Website', 'reverie'); ?></label>
  81. <input type="text" class="five" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3">
  82. </p>
  83. <?php endif; ?>
  84. <p>
  85. <label for="comment"><?php _e('Comment', 'reverie'); ?></label>
  86. <textarea name="comment" id="comment" tabindex="4"></textarea>
  87. </p>
  88. <p id="allowed_tags" class="small"><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></p>
  89. <p><input name="submit" class="radius large button" type="submit" id="submit" tabindex="5" value="<?php _e('Submit Comment', 'reverie'); ?>"></p>
  90. <?php comment_id_fields(); ?>
  91. <?php do_action('comment_form', $post->ID); ?>
  92. </form>
  93. <?php endif; // If registration required and not logged in ?>
  94. </section>
  95. <?php endif; // if you delete this the sky will fall on your head ?>