ASong2U_Web/wp-content/themes/score/comments.php

161 lines
5.6 KiB
PHP

<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if(post_password_required()) { ?>
<?php
return;
}
?>
<?php
/*************************** Comment Template ***************************/
global $current_user, $gp_settings;
require(ghostpool_inc . 'options.php');
if($gp_settings['user_comments'] == "One Comment") {
$comment_number = "1";
} else {
$comment_number = "999999999";
}
$args = array('post_id' => $post->ID, 'user_id' => $current_user->ID);
$usercomment = get_comments($args);
function comment_template($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
global $post, $gp_settings;
require(ghostpool_inc . 'options.php');
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID() ?>" class="comment-box">
<div class="comment-avatar">
<?php echo get_avatar($comment, $size = '50'); ?>
</div>
<div class="comment-meta">
<span class="comment-author">
<?php printf(__('%s', 'gp_lang'), comment_author_link()) ?>
</span>
<div class="clear"></div>
<div class="comment-date">
<?php comment_time(get_option('date_format')); ?>, <?php comment_time(get_option('time_format')); ?>
</div>
<div class="clear"></div>
<div class="comment-text">
<?php comment_text(); ?>
<?php if ($comment->comment_approved == '0') { ?>
<div class="moderation">
<?php _e('Your comment is awaiting moderation.', 'gp_lang'); ?>
</div>
<?php } ?>
</div>
</div>
<div class="clear"></div>
</div>
</li>
<?php } ?>
<!--Begin Comments-->
<?php if('open' == $post->comment_status OR have_comments()) { ?>
<div id="comments">
<h3 class="comments"><?php comments_number(__('No Comments', 'gp_lang'), __('1 Comment', 'gp_lang'), __('% Comments', 'gp_lang')); ?></h3>
<?php } ?>
<?php if(have_comments()) { // If there are comments ?>
<ol id="commentlist" class="commentlist">
<?php wp_list_comments('callback=comment_template'); ?>
</ol>
<?php $total_pages = get_comment_pages_count(); if($total_pages > 1) { ?>
<div class="wp-pagenavi"><?php paginate_comments_links(); ?></div>
<?php } ?>
<?php if('open' == $post->comment_status) { // If comments are open, but there are no comments yet ?>
<?php } else { // If comments are closed ?>
<strong><?php _e('Comments are now closed on this post.', 'gp_lang'); ?></strong>
<?php } ?>
<?php } else { // If there are no comments yet ?>
<ol id="commentlist" class="commentlist">
</ol>
<?php } ?>
<?php if('open' == $post->comment_status) { ?>
<!--Begin Comment Form-->
<div <?php if(count($usercomment) >= $comment_number) { ?> class="hidden"<?php } ?>>
<!--Begin Respond-->
<div id="respond">
<h3><?php comment_form_title(__('Make a comment', 'gp_lang'), __('Respond to %s', 'gp_lang')); ?> <?php cancel_comment_reply_link(__('Cancel Reply', 'gp_lang')); ?></h3>
<?php if(get_option('comment_registration') && !$user_ID) { ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php } else { ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
<?php if ($user_ID) {} else { ?>
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="author"><?php _e('Name', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="email"><?php _e('Email', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><?php _e('Website', 'gp_lang'); ?></label></p>
<?php } ?>
<p><textarea name="comment" id="comment" cols="5" rows="7" tabindex="4"></textarea></p>
<input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php } ?>
<div class="clear"></div>
</div>
<!--End Respond-->
</div>
<!--End Comment Form-->
<?php } ?>
<?php if(count($usercomment) >= $comment_number) { ?>
<div class="clear"></div>
<strong><?php _e('You have already reviewed this item.', 'gp_lang'); ?></strong>
<?php } ?>
<?php if('open' == $post->comment_status OR have_comments()) { ?>
</div>
<?php } ?>
<!--End Comments-->