web/wp-content/themes/themes/kelontong/comments.php
author ymh
Fri, 12 Mar 2010 13:29:04 +0000
changeset 1 0d28b7c10758
permissions -rw-r--r--
First commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
0d28b7c10758 First commit
ymh
parents:
diff changeset
     1
<?php /* Do not delete these lines */
0d28b7c10758 First commit
ymh
parents:
diff changeset
     2
	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
     3
		die ('Please do not load this page directly. Thanks!');
0d28b7c10758 First commit
ymh
parents:
diff changeset
     4
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
     5
	if (!empty($post->post_password)) { // if there's a password
0d28b7c10758 First commit
ymh
parents:
diff changeset
     6
		if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
0d28b7c10758 First commit
ymh
parents:
diff changeset
     7
			?><p class="nocomments">This post is password protected. Enter the password to view comments.<p><?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
     8
			return;
0d28b7c10758 First commit
ymh
parents:
diff changeset
     9
		}
0d28b7c10758 First commit
ymh
parents:
diff changeset
    10
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
    11
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    12
0d28b7c10758 First commit
ymh
parents:
diff changeset
    13
<?php /* COMMENTS */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    14
<?php if ('open' == $post->comment_status || $comments) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    15
<div id="comments">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    16
<?php if ($comments) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    17
	<h2><a href="#respond"><?php comments_number('No Comments', '1 Comment', '% Comments' );?></a></h2>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    18
	<?php $oddcomment = ''; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    19
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    20
	<?php foreach ($comments as $comment) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    21
		
0d28b7c10758 First commit
ymh
parents:
diff changeset
    22
	<?php /* Check if author of blog */
0d28b7c10758 First commit
ymh
parents:
diff changeset
    23
	if (get_comment_author_email() == get_the_author_email()) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
    24
	$oddcomment .= ' author';
0d28b7c10758 First commit
ymh
parents:
diff changeset
    25
	} ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    26
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    27
	<div class="comment-wrap<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    28
		<div class="comment-left">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    29
			<a href="<?php comment_author_url(); ?>" title="Visit <?php comment_author(); ?>'s website" rel="external nofollow">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    30
			<?php $size = "56"; $email = get_comment_author_email(); $default = get_bloginfo('template_url').'/images/gravatar.jpg'; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    31
			<?php if (function_exists('get_avatar')) { echo get_avatar( $email, $size, $default ); } else { ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    32
				<img src="http://www.gravatar.com/avatar.php?gravatar_id=<?=md5($email)?>&amp;default=<?=$default?>&amp;size=<?=$size?>" height="<?=$size?>" width="<?=$size?>" class="avatar" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
    33
			<?php } ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    34
			</a>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    35
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    36
		<div class="comment-right">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    37
			<cite><b><?php comment_author_link() ?></b>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    38
			<small><a href="#comment-<?php comment_ID() ?>" title="Permanent link to this comment"><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    39
			<?php edit_comment_link('Edit',' &middot; ',''); ?></small></cite>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    40
			<?php if ($comment->comment_approved == '0') : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    41
			<p style="color:#C64021;"><b><?php _e('This comment is awaiting moderation.'); ?></b></p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    42
			<?php else : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    43
			<?php comment_text() ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    44
			<?php endif; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    45
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    46
	</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    47
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    48
	<?php /* Changes every other comment to a different class */	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    49
	if ($oddcomment != '') $oddcomment = '';
0d28b7c10758 First commit
ymh
parents:
diff changeset
    50
	else $oddcomment = ' alt'; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    51
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    52
	<?php endforeach; /* end for each comment */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    53
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    54
<?php else : /* this is displayed if there are no comments so far */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    55
	<?php if ('open' == $post->comment_status) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    56
	<!-- If no comments on this post
0d28b7c10758 First commit
ymh
parents:
diff changeset
    57
	<h3>There are no comments on this post</h3> -->
0d28b7c10758 First commit
ymh
parents:
diff changeset
    58
	<?php else : // comments are closed ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    59
	<!-- If comments are closed
0d28b7c10758 First commit
ymh
parents:
diff changeset
    60
	<h3>Comments are closed.</h3> -->
0d28b7c10758 First commit
ymh
parents:
diff changeset
    61
	<?php endif; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    62
<?php endif; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    63
0d28b7c10758 First commit
ymh
parents:
diff changeset
    64
<?php /* PINGBACKS AND TRACKBACKS */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    65
<?php global $trackbacks; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    66
<?php if ($trackbacks) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    67
	<?php $comments = $trackbacks; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    68
	<h3 id="trackbacks"><?php echo sizeof($trackbacks); ?> <?php _e('Trackbacks and Pingbacks'); ?></h3>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    69
	<ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    70
		<?php foreach ($comments as $comment) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    71
		<li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    72
			<cite><b><?php comment_author_link() ?></b> &middot; 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    73
			<small><a href="#comment-<?php comment_ID() ?>" title="Permanent link to this comment">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    74
			<?php comment_date('F jS, Y') ?></a>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    75
			<?php edit_comment_link('Edit',' &middot; ',''); ?></small></cite>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    76
			<?php comment_text() ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    77
		</li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    78
		<?php endforeach; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    79
	</ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    80
<?php endif; /* end if there are trackbacks */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    81
0d28b7c10758 First commit
ymh
parents:
diff changeset
    82
<?php /* COMMENT FORM */ ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    83
<?php if ('open' == $post->comment_status) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    84
	<h3 id="respond"><?php _e('Write a Comment'); ?></h3>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    85
	<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    86
	<p><?php _e('You must be'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>"><?php _e('logged in'); ?></a> <?php _e('to post a comment.'); ?></p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    87
<?php else : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    88
	<form id="comment_form" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
0d28b7c10758 First commit
ymh
parents:
diff changeset
    89
		<fieldset>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    90
			<?php if ( $user_ID ) : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    91
			<p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    92
				<?php _e('Logged in as'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a> &middot; 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    93
				<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account"><?php _e('Logout'); ?></a>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    94
			</p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    95
			<div class="clear"></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    96
			<?php else : ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    97
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
    98
			<label for="author"><?php if ($req) echo "* "; ?><?php _e('Your Name'); ?>:</label>
0d28b7c10758 First commit
ymh
parents:
diff changeset
    99
			<input class="text" type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   100
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   101
			<label for="email"><?php if ($req) echo "* "; ?><?php _e('Email'); ?>:</label>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   102
			<input class="text" type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   103
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   104
			<label for="url"><?php _e('Website'); ?>:</label>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   105
			<input class="text" type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   106
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   107
			<?php endif; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   108
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   109
			<!--<p>You can use these tags: <?php echo allowed_tags(); ?></p>-->
0d28b7c10758 First commit
ymh
parents:
diff changeset
   110
			<label for="comment"><?php _e('Message'); ?>:</label>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   111
			<textarea class="text" name="comment" id="comment" cols="50" rows="5" tabindex="4"></textarea>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   112
			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   113
			<p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   114
				<input class="button" name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   115
			</p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   116
			<div class="clear"></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   117
			<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   118
			<?php do_action('comment_form', $post->ID); ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   119
		</fieldset>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   120
	</form>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   121
<?php endif; // end if registration required and not logged in ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   122
0d28b7c10758 First commit
ymh
parents:
diff changeset
   123
<?php endif; // end if there are comments ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   124
</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   125
<?php endif; // end if comments are open for this post ?>