More comments and comment template improvements. TODO: popup comment template
git-svn-id: http://svn.automattic.com/wordpress/trunk@1400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e7cf38f1e4
commit
50e5276b0a
|
@ -1,95 +0,0 @@
|
||||||
<?php
|
|
||||||
/* Don't remove these lines. */
|
|
||||||
$single = 1;
|
|
||||||
$id = (int) $_GET['post_'];
|
|
||||||
require ('wp-blog-header.php');
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<title><?php echo get_settings('blogname'); ?> » Comments on "<?php the_title() ?>"</title>
|
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
|
|
||||||
<style type="text/css" media="screen">
|
|
||||||
@import url( wp-layout.css );
|
|
||||||
body { margin: 3px; padding: 10px}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body id="commentspopup">
|
|
||||||
|
|
||||||
<h1 id="header"><a href="<?php echo get_settings('home'); ?>" title="<?php echo get_settings('blogname'); ?>"><?php echo get_settings('blogname'); ?></a></h1>
|
|
||||||
|
|
||||||
<h2 id="comments">Replying to Comment:</h2>
|
|
||||||
<?php
|
|
||||||
if (($withcomments) or ($single)) {
|
|
||||||
|
|
||||||
if (!empty($post->post_password)) { // if there's a password
|
|
||||||
if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie
|
|
||||||
echo("<p>Enter your password to view comments.<p>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
|
|
||||||
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
|
|
||||||
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
|
|
||||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$id' AND comment_approved = '1' AND comment_ID = '$comment_reply_ID' ORDER BY comment_date");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- You can start editing here. -->
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ($comments) { ?>
|
|
||||||
<ol id="commentlist">
|
|
||||||
<?php foreach ($comments as $comment) { ?>
|
|
||||||
<li id="comment-<?php comment_ID() ?>">
|
|
||||||
<?php comment_text() ?>
|
|
||||||
<p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link('Edit This', ' |'); ?></p>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php } // end for each comment ?>
|
|
||||||
</ol>
|
|
||||||
<?php } else { // this is displayed if there are no comments so far ?>
|
|
||||||
<p>No comments yet.</p>
|
|
||||||
<?php } ?>
|
|
||||||
<h2 id="postcomment">Leave a Comment:</h2>
|
|
||||||
<?php if ('open' == $post->comment_status) { ?>
|
|
||||||
<p>Line and paragraph breaks automatic, email address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
|
|
||||||
|
|
||||||
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
|
||||||
<p>
|
|
||||||
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
|
||||||
<label for="author">Name</label>
|
|
||||||
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
|
|
||||||
<input type="hidden" name="redirect_to" value="<?php echo get_settings('siteurl')."/index.php?p=".$id ?>" />
|
|
||||||
<input type="hidden" name="comment_reply_ID" value="<?php echo $comment_reply_ID; ?>" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
|
|
||||||
<label for="email">Email</label>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
|
|
||||||
<label for="url"><acronym title="Uniform Resource Identifier">URI</acronym></label>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<label for="comment">Your Comment</label>
|
|
||||||
<br />
|
|
||||||
<textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<input name="submit" type="submit" tabindex="5" value="Say it!" />
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
<?php } else { // comments are closed ?>
|
|
||||||
<p>Sorry, the comment form is closed at this time.</p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php // if you delete this the sky will fall on your head
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,88 +1,81 @@
|
||||||
<?php // Do not delete these lines
|
|
||||||
if ('wp-comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
|
||||||
die ('Please do not load this page directly. Thanks!');
|
|
||||||
$req = get_settings('require_name_email');
|
|
||||||
if (($withcomments) or ($single)) {
|
|
||||||
|
|
||||||
if (!empty($post->post_password)) { // if there's a password
|
|
||||||
if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie
|
|
||||||
?>
|
|
||||||
<p><?php _e("Enter your password to view comments."); ?><p>
|
|
||||||
<?php
|
<?php
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
|
if ('wp-comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
||||||
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
|
die ('Please do not load this page directly. Thanks!');
|
||||||
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
|
|
||||||
|
|
||||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
|
if ( !empty($post->post_password) && $_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) :
|
||||||
|
?>
|
||||||
|
<p><?php _e('Enter your password to view comments.'); ?><p>
|
||||||
|
<?php
|
||||||
|
return;
|
||||||
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- You can start editing here. -->
|
<!-- You can start editing here. -->
|
||||||
|
|
||||||
<h2 id="comments"><?php comments_number(__("Comments"), __("1 Comment"), __("% Comments")); ?>
|
<h2 id="comments"><?php comments_number(__("Comments"), __("1 Comment"), __("% Comments")); ?>
|
||||||
<?php if ('open' == $post->comment_status) { ?>
|
<?php if ( comments_open() ) : ?>
|
||||||
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">»</a>
|
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">»</a>
|
||||||
<?php } ?>
|
<?php endif; ?>
|
||||||
</h2>
|
</h2>
|
||||||
<?php if ('open' == $post->ping_status) { ?>
|
|
||||||
<p><?php _e("The <acronym title=\"Uniform Resource Identifier\">URI</acronym> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ($comments) { ;?>
|
|
||||||
|
|
||||||
|
<?php if ( $comments ) : ?>
|
||||||
<ol id="commentlist">
|
<ol id="commentlist">
|
||||||
<?php foreach ($comments as $comment) { ?>
|
|
||||||
|
<?php foreach ($comments as $comment) : ?>
|
||||||
<li id="comment-<?php comment_ID() ?>">
|
<li id="comment-<?php comment_ID() ?>">
|
||||||
<?php comment_text() ?>
|
<?php comment_text() ?>
|
||||||
<p><cite><?php comment_type(); ?> <?php _e("by"); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
|
<p><cite><?php comment_type(); ?> <?php _e('by'); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php } // end for each comment ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
<?php } else { // this is displayed if there are no comments so far ?>
|
|
||||||
<p><?php _e("No comments yet."); ?></p>
|
<?php else : ?>
|
||||||
<?php } ?>
|
<p><?php _e('No comments yet.'); ?></p>
|
||||||
<p><?php comments_rss_link(__("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post.")); ?></p>
|
<?php endif; ?>
|
||||||
<h2 id="postcomment"><?php _e("Leave a comment"); ?></h2>
|
|
||||||
<?php if ('open' == $post->comment_status) { ?>
|
<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
|
||||||
<p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>
|
<?php if ( pings_open() ) : ?>
|
||||||
|
<a href="<?php trackback_url() ?>"><?php _e('TrackBack <abbr title="Uniform Resource Identifier">URI</abbr>'); ?></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php if ( comments_open() ) : ?>
|
||||||
|
<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
|
||||||
|
|
||||||
|
<p><?php _e('Line and paragraph breaks automatic. E-mail address never displayed. <abbr title="HyperText Markup Language">HTML</abbr> allowed:'); ?> <code><?php echo allowed_tags(); ?></code></p>
|
||||||
|
|
||||||
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
||||||
<label for="author"><?php _e("Name"); ?></label> <?php if ($req) _e('(required)'); ?>
|
<label for="author"><?php _e('Name'); ?></label> <?php if ($req) _e('(required)'); ?>
|
||||||
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
|
<input type="hidden" name="comment_post_ID" value="<?php echo $post->ID; ?>" />
|
||||||
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" />
|
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
|
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
|
||||||
<label for="email"><?php _e("E-mail"); ?></label> <?php if ($req) _e('(required)'); ?>
|
<label for="email"><?php _e('E-mail'); ?></label> <?php if ($req) _e('(required)'); ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
|
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
|
||||||
<label for="url"><?php _e("<acronym title=\"Uniform Resource Identifier\">URI</acronym>"); ?></label>
|
<label for="url"><?php _e('<acronym title="Uniform Resource Identifier">URI</acronym>'); ?></label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="comment"><?php _e("Your Comment"); ?></label>
|
<label for="comment"><?php _e('Your Comment'); ?></label>
|
||||||
<br />
|
<br />
|
||||||
<textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
|
<textarea name="comment" id="comment" cols="60" rows="4" tabindex="4"></textarea>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input name="submit" type="submit" tabindex="5" value="<?php _e("Say It!"); ?>" />
|
<input name="submit" id="submit" type="submit" tabindex="5" value="<?php _e('Say It!'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<?php } else { // comments are closed ?>
|
|
||||||
<p><?php _e("Sorry, the comment form is closed at this time."); ?></p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php // if you delete this the sky will fall on your head
|
<?php else : // Comments are closed ?>
|
||||||
}
|
<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
|
||||||
?>
|
<?php endif; ?>
|
|
@ -17,7 +17,15 @@ add_filter('comment_text', 'convert_smilies', 20);
|
||||||
add_filter('comment_excerpt', 'convert_chars');
|
add_filter('comment_excerpt', 'convert_chars');
|
||||||
|
|
||||||
function comments_template() {
|
function comments_template() {
|
||||||
global $withcomments, $single, $post, $wpdb, $id, $comment;
|
global $withcomments, $single, $post, $wpdb, $id, $comment, $cookiehash;
|
||||||
|
|
||||||
|
$req = get_settings('require_name_email');
|
||||||
|
$comment_author = isset($_COOKIE['comment_author_'.$cookiehash]) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
|
||||||
|
$comment_author_email = isset($_COOKIE['comment_author_email_'.$cookiehash]) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
|
||||||
|
$comment_author_url = isset($_COOKIE['comment_author_url_'.$cookiehash]) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
|
||||||
|
|
||||||
|
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
|
||||||
|
|
||||||
if ( $single || $withcomments )
|
if ( $single || $withcomments )
|
||||||
include(ABSPATH . 'wp-comments.php');
|
include(ABSPATH . 'wp-comments.php');
|
||||||
}
|
}
|
||||||
|
@ -301,4 +309,16 @@ function trackback_rdf($timezone = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function comments_open() {
|
||||||
|
global $post;
|
||||||
|
if ('open' == $post->comment_status) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pings_open() {
|
||||||
|
global $post;
|
||||||
|
if ('open' == $post->ping_status) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue