WordPress.org

Make WordPress Core

Changeset 1400


Ignore:
Timestamp:
06/10/2004 08:40:58 AM (14 years ago)
Author:
saxmatt
Message:

More comments and comment template improvements. TODO: popup comment template

Location:
trunk
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-comments.php

    r1398 r1400  
    1 <?php // Do not delete these lines
    2     if ('wp-comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    3         die ('Please do not load this page directly. Thanks!');
    4     $req = get_settings('require_name_email');
    5     if (($withcomments) or ($single)) {
     1<?php
    62
    7         if (!empty($post->post_password)) { // if there's a password
    8             if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) {  // and it doesn't match the cookie
     3if ('wp-comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
     4    die ('Please do not load this page directly. Thanks!');
     5
     6if ( !empty($post->post_password) && $_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) :
    97?>
    10 <p><?php _e("Enter your password to view comments."); ?><p>
     8<p><?php _e('Enter your password to view comments.'); ?><p>
    119<?php
    12                 return;
    13             }
    14         }
    15 
    16         $comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
    17         $comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
    18         $comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
    19 
    20         $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
     10    return;
     11endif;
    2112?>
    2213
     
    2415
    2516<h2 id="comments"><?php comments_number(__("Comments"), __("1 Comment"), __("% Comments")); ?>
    26 <?php if ('open' == $post->comment_status) { ?>
    27 <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
    28 <?php } ?>
     17<?php if ( comments_open() ) : ?>
     18    <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
     19<?php endif; ?>
    2920</h2>
    30 <?php if ('open' == $post->ping_status) { ?>
    31 <p><?php _e("The <acronym title=\"Uniform Resource Identifier\">URI</acronym> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
    32 <?php } ?>
    3321
     22<?php if ( $comments ) : ?>
     23<ol id="commentlist">
    3424
    35 <?php if ($comments) { ;?>
    36 
    37 <ol id="commentlist">
    38 <?php foreach ($comments as $comment) { ?>
     25<?php foreach ($comments as $comment) : ?>
    3926    <li id="comment-<?php comment_ID() ?>">
    4027    <?php comment_text() ?>
    41     <p><cite><?php comment_type(); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
     28    <p><cite><?php comment_type(); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
    4229    </li>
    4330
    44 <?php } // end for each comment ?>
     31<?php endforeach; ?>
     32
    4533</ol>
    46 <?php } else { // this is displayed if there are no comments so far ?>
    47     <p><?php _e("No comments yet."); ?></p>
    48 <?php } ?>
    49 <p><?php comments_rss_link(__("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post.")); ?></p>
    50 <h2 id="postcomment"><?php _e("Leave a comment"); ?></h2>
    51 <?php if ('open' == $post->comment_status) { ?>
    52 <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>
     34
     35<?php else : ?>
     36    <p><?php _e('No comments yet.'); ?></p>
     37<?php endif; ?>
     38
     39<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
     40<?php if ( pings_open() ) : ?>
     41    <a href="<?php trackback_url() ?>"><?php _e('TrackBack <abbr title="Uniform Resource Identifier">URI</abbr>'); ?></a>
     42<?php endif; ?>
     43</p>
     44
     45<?php if ( comments_open() ) : ?>
     46<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
     47
     48<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>
    5349
    5450<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    5551    <p>
    5652      <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
    57        <label for="author"><?php _e("Name"); ?></label> <?php if ($req) _e('(required)'); ?>
    58     <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    59     <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" />
     53       <label for="author"><?php _e('Name'); ?></label> <?php if ($req) _e('(required)'); ?>
     54    <input type="hidden" name="comment_post_ID" value="<?php echo $post->ID; ?>" />
     55    <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" />
    6056    </p>
    6157
    6258    <p>
    6359      <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
    64        <label for="email"><?php _e("E-mail"); ?></label> <?php if ($req) _e('(required)'); ?>
     60       <label for="email"><?php _e('E-mail'); ?></label> <?php if ($req) _e('(required)'); ?>
    6561    </p>
    6662
    6763    <p>
    6864      <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
    69        <label for="url"><?php _e("<acronym title=\"Uniform Resource Identifier\">URI</acronym>"); ?></label>
     65       <label for="url"><?php _e('<acronym title="Uniform Resource Identifier">URI</acronym>'); ?></label>
    7066    </p>
    7167
    7268    <p>
    73       <label for="comment"><?php _e("Your Comment"); ?></label>
     69      <label for="comment"><?php _e('Your Comment'); ?></label>
    7470    <br />
    75       <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
     71      <textarea name="comment" id="comment" cols="60" rows="4" tabindex="4"></textarea>
    7672    </p>
    7773
    7874    <p>
    79       <input name="submit" type="submit" tabindex="5" value="<?php _e("Say It!"); ?>" />
     75      <input name="submit" id="submit" type="submit" tabindex="5" value="<?php _e('Say It!'); ?>" />
    8076    </p>
    8177</form>
    82 <?php } else { // comments are closed ?>
    83 <p><?php _e("Sorry, the comment form is closed at this time."); ?></p>
    84 <?php } ?>
    8578
    86 <?php // if you delete this the sky will fall on your head
    87 }
    88 ?>
     79<?php else : // Comments are closed ?>
     80<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
     81<?php endif; ?>
  • trunk/wp-includes/template-functions-comment.php

    r1398 r1400  
    1818
    1919function comments_template() {
    20     global $withcomments, $single, $post, $wpdb, $id, $comment;
     20    global $withcomments, $single, $post, $wpdb, $id, $comment, $cookiehash;
     21
     22    $req = get_settings('require_name_email');
     23    $comment_author = isset($_COOKIE['comment_author_'.$cookiehash]) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
     24    $comment_author_email = isset($_COOKIE['comment_author_email_'.$cookiehash]) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
     25    $comment_author_url = isset($_COOKIE['comment_author_url_'.$cookiehash]) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
     26
     27    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
     28
    2129    if ( $single || $withcomments )
    2230        include(ABSPATH . 'wp-comments.php');
     
    302310}
    303311
     312function comments_open() {
     313    global $post;
     314    if ('open' == $post->comment_status) return true;
     315    else return false;
     316}
     317
     318function pings_open() {
     319    global $post;
     320    if ('open' == $post->ping_status) return true;
     321    else return false;
     322}
     323
    304324?>
Note: See TracChangeset for help on using the changeset viewer.