Changeset 4934 for trunk/wp-includes/feed-rss2-comments.php
- Timestamp:
- 02/24/2007 07:33:29 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/feed-rss2-comments.php
r4927 r4934 8 8 xmlns:content="http://purl.org/rss/1.0/modules/content/"> 9 9 <channel> 10 <?php11 $i = 0; 12 if (have_posts()) : 13 while (have_posts()) : the_post(); 14 if ($i < 1) {15 $i++;16 ?> 17 <title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); }?></title>10 <title><?php 11 if ( is_singular() ) 12 printf(__('Comments on: %s'), get_the_title_rss()); 13 elseif ( is_search() ) 14 printf(__('Comments for %s searching on %s'), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s'])); 15 else 16 printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 17 ?></title> 18 18 <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link> 19 19 <description><?php bloginfo_rss("description") ?></description> … … 22 22 23 23 <?php 24 if (is_single() || is_page()) { 25 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 26 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 27 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 28 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' 29 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' 30 AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' 31 ORDER BY comment_date_gmt ASC" ); 32 } else { // if no post id passed in, we'll just ue the last 10 comments. 33 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 34 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 35 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 36 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 37 AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 38 ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); 39 } 40 // this line is WordPress' motor, do not delete it. 41 if ($comments) { 42 foreach ($comments as $comment) { 43 $GLOBALS['comment'] =& $comment; 44 // Some plugins may need to know the metadata 45 // associated with this comment's post: 46 get_post_custom($comment->comment_post_ID); 24 if ( have_comments() ) : while ( have_comments() ) : the_comment(); 25 $comment_post = get_post($comment->comment_post_ID); 26 get_post_custom($comment_post->ID); 47 27 ?> 48 28 <item> 49 <title><?php if ( ! (is_single() || is_page()) ) { 50 $title = get_the_title($comment->comment_post_ID); 51 $title = apply_filters('the_title', $title); 52 $title = apply_filters('the_title_rss', $title); 53 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 54 } else { 55 printf(__('By: %s'), get_comment_author_rss()); 56 } ?></title> 29 <title><?php 30 if ( !is_singular() ) { 31 $title = get_the_title($comment_post->ID); 32 $title = apply_filters('the_title', $title); 33 $title = apply_filters('the_title_rss', $title); 34 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 35 } else { 36 printf(__('By: %s'), get_comment_author_rss()); 37 } 38 ?></title> 57 39 <link><?php comment_link() ?></link> 58 40 <author><?php echo get_comment_author_rss() ?></author> 59 41 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> 60 42 <guid><?php comment_link() ?></guid> 61 <?php 62 if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { 63 ?> 43 <?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?> 64 44 <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description> 65 45 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded> 66 <?php 67 } else { 68 ?> 46 <?php else : // post pass ?> 69 47 <description><?php comment_text_rss() ?></description> 70 48 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> 71 <?php 72 } // close check for password 73 do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID); 74 ?> 49 <?php endif; // post pass 50 do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID); 51 ?> 75 52 </item> 76 <?php 77 } 78 } 79 } 80 endwhile; endif; 81 ?> 53 <?php endwhile; endif; ?> 82 54 </channel> 83 55 </rss>
Note: See TracChangeset
for help on using the changeset viewer.