PHP Cross Reference of WordPress Latest 1.5 Branch |
| [ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] |
[Summary view] [Print] [Text view]
1 <?php 2 if ( empty($feed) ) { 3 $feed = 'rss2'; 4 $withcomments = 1; 5 $doing_rss = 1; 6 require ('wp-blog-header.php'); 7 } 8 9 header('Content-type: text/xml;charset=' . get_settings('blog_charset'), true); 10 11 echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; 12 ?> 13 <!-- generator="wordpress/<?php echo $wp_version ?>" --> 14 <rss version="2.0" 15 xmlns:content="http://purl.org/rss/1.0/modules/content/"> 16 <channel> 17 <?php 18 $i = 0; 19 if (have_posts()) : 20 while (have_posts()) : the_post(); 21 if ($i < 1) { 22 $i++; 23 ?> 24 <title><?php if (is_single() || is_page()) { echo "Comments on: "; the_title_rss(); } else { bloginfo_rss("name"); echo " Comments"; } ?></title> 25 <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link> 26 <description><?php bloginfo_rss("description") ?></description> 27 <pubDate><?php echo gmdate('r'); ?></pubDate> 28 <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator> 29 30 <?php 31 if (is_single() || is_page()) { 32 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 33 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 34 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 35 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id' 36 AND $wpdb->comments.comment_approved = '1' AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static') 37 AND post_date < '".date("Y-m-d H:i:59")."' 38 ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); 39 } else { // if no post id passed in, we'll just ue the last 10 comments. 40 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 41 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 42 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 43 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static') 44 AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."' 45 ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); 46 } 47 // this line is WordPress' motor, do not delete it. 48 if ($comments) { 49 foreach ($comments as $comment) { 50 ?> 51 <item> 52 <title><?php if ( (! is_single()) || (! is_page()) ) { 53 $title = get_the_title($comment->comment_post_ID); 54 $title = apply_filters('the_title', $title); 55 $title = apply_filters('the_title_rss', $title); 56 echo "Comment on $title"; 57 } ?> by: <?php comment_author_rss() ?></title> 58 <link><?php comment_link() ?></link> 59 <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 <guid><?php comment_link() ?></guid> 61 <?php 62 if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { 63 ?> 64 <description>Protected Comments: Please enter your password to view comments.</description> 65 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded> 66 <?php 67 } else { 68 ?> 69 <description><?php comment_text_rss() ?></description> 70 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> 71 <?php 72 } // close check for password 73 ?> 74 </item> 75 <?php 76 } 77 } 78 } 79 endwhile; endif; 80 ?> 81 </channel> 82 </rss>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated Sat Dec 1 06:52:09 2007 for RedAlt XRefs | Cross-referenced by PHPXref 0.6 and RedAlt |