root/tags/1.5.1/wp-includes/feed-rss2-comments.php

Revision 1218, 2.4 kB (checked in by donncha, 9 months ago)

Merged with WordPress? 2.5, unstable, only for testing

  • Property svn:eol-style set to native
Line 
1 <?php
2 /**
3  * RSS2 Feed Template for displaying RSS2 Comments feed.
4  *
5  * @package WordPress
6  */
7
8 header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
9
10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
11 ?>
12 <rss version="2.0"
13     xmlns:content="http://purl.org/rss/1.0/modules/content/"
14     xmlns:dc="http://purl.org/dc/elements/1.1/"
15     xmlns:atom="http://www.w3.org/2005/Atom"
16     >
17 <channel>
18     <title><?php
19         if ( is_singular() )
20             printf(__('Comments on: %s'), get_the_title_rss());
21         elseif ( is_search() )
22             printf(__('Comments for %s searching on %s'), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s']));
23         else
24             printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
25     ?></title>
26     <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
27     <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
28     <description><?php bloginfo_rss("description") ?></description>
29     <pubDate><?php echo gmdate('r'); ?></pubDate>
30     <?php the_generator( 'rss2' ); ?>
31     <?php do_action('commentsrss2_head'); ?>
32 <?php
33 if ( have_comments() ) : while ( have_comments() ) : the_comment();
34     $comment_post = get_post($comment->comment_post_ID);
35     get_post_custom($comment_post->ID);
36 ?>
37     <item>
38         <title><?php
39             if ( !is_singular() ) {
40                 $title = get_the_title($comment_post->ID);
41                 $title = apply_filters('the_title_rss', $title);
42                 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
43             } else {
44                 printf(__('By: %s'), get_comment_author_rss());
45             }
46         ?></title>
47         <link><?php comment_link() ?></link>
48         <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
49         <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
50         <guid isPermaLink="false"><?php comment_guid() ?></guid>
51 <?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?>
52         <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
53         <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
54 <?php else : // post pass ?>
55         <description><?php comment_text_rss() ?></description>
56         <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
57 <?php endif; // post pass
58     do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID);
59 ?>
60     </item>
61 <?php endwhile; endif; ?>
62 </channel>
63 </rss>
64
Note: See TracBrowser for help on using the browser.