/wp-content/themes/eclipse/core/actions/comments-actions.php
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
- <?php
- /**
- * Comments actions used by response.
- *
- * Author: Tyler Cunningham
- * Copyright: Š 2012
- * {@link http://cyberchimps.com/ CyberChimps LLC}
- *
- * Released under the terms of the GNU General Public License.
- * You should have received a copy of the GNU General Public License,
- * along with this software. In the main directory, see: /licensing/
- * If not, see: {@link http://www.gnu.org/licenses/}.
- *
- * @package response
- * @since 1.0
- */
- /**
- * response comments actions
- */
- add_action( 'response_comments', 'response_comments_password_required' );
- add_action( 'response_comments', 'response_comments_loop' );
- /**
- * Checks if password is required to comment, sets a filter for text that displays.
- *
- * @since 1.0
- */
- function response_comments_password_required() {
-
- global $post;
-
- $password_text = apply_filters( 'response_password_required_text', 'This post is password protected. Enter the password to view comments.');
- if ( post_password_required() ) {
- printf( $password_text );
- return;
- }
- }
- /**
- * Runs through the comments "loop"
- *
- * @since 1.0
- */
- function response_comments_loop() {
- global $post;
-
- $comments_args = array(
- 'comment_notes_before' => '',
- 'comment_notes_after' => ''
- );?>
- <?php if ( have_comments() ) : ?>
- <div class="comments_container">
- <h2 class="commentsh2"><?php comments_number( __('No Responses', 'response' ), __( 'One Response', 'response' ), __('% Responses', 'response' ));?></h2>
- <div class="navigation">
- <div class="next-posts"><?php previous_comments_link() ?></div>
- <div class="prev-posts"><?php next_comments_link() ?></div>
- </div>
- <div class="clear"></div>
- <ol class="commentlist">
- <?php wp_list_comments('callback=response_comment'); ?>
- </ol>
- <div class="navigation">
- <div class="next-posts"><?php previous_comments_link() ?></div>
- <div class="prev-posts"><?php next_comments_link() ?></div>
- </div>
- <div class="clear"></div>
-
- </div><!--end comments_container-->
-
- <?php else : // this is displayed if there are no comments so far ?>
- <?php if ( comments_open() ) : ?>
- <!-- If comments are open, but there are no comments. -->
- <?php else : // comments are closed ?>
- <?php endif; ?>
-
- <?php endif; ?>
- <?php if ( comments_open() && ! post_password_required() ) : ?>
- <div class="comments_container">
- <div id="respond">
- <div class="cancel-comment-reply">
- <?php cancel_comment_reply_link(); ?>
- </div>
- <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
- <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>
- <?php else : ?>
-
- <?php comment_form($comments_args); ?>
-
- <?php endif; ?>
-
- <!--<p>You can use these tags: <code><?php echo allowed_tags(); ?></code></p>-->
-
- </form>
-
- </div>
- </div><!--end comments_container-->
- <?php endif; // If registration required and not logged in ?>
- <?php }
- /**
- * End
- */
- ?>