]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/feed-rss2-comments.php
WordPress 4.0.1
[autoinstalls/wordpress.git] / wp-includes / feed-rss2-comments.php
1 <?php
2 /**
3  * RSS2 Feed Template for displaying RSS2 Comments feed.
4  *
5  * @package WordPress
6  */
7
8 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
9
10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
11
12 /** This action is documented in wp-includes/feed-rss2.php */
13 do_action( 'rss_tag_pre', 'rss2-comments' );
14 ?>
15 <rss version="2.0"
16         xmlns:content="http://purl.org/rss/1.0/modules/content/"
17         xmlns:dc="http://purl.org/dc/elements/1.1/"
18         xmlns:atom="http://www.w3.org/2005/Atom"
19         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
20         <?php
21         /** This action is documented in wp-includes/feed-rss2.php */
22         do_action( 'rss2_ns' );
23         ?>
24
25         <?php
26         /**
27          * Fires at the end of the RSS root to add namespaces.
28          *
29          * @since 2.8.0
30          */
31         do_action( 'rss2_comments_ns' );
32         ?>
33 >
34 <channel>
35         <title><?php
36                 if ( is_singular() )
37                         printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
38                 elseif ( is_search() )
39                         printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
40                 else
41                         printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
42         ?></title>
43         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
44         <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
45         <description><?php bloginfo_rss("description") ?></description>
46         <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
47         <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
48         <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
49         <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
50         <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
51         <?php
52         /**
53          * Fires at the end of the RSS2 comment feed header.
54          *
55          * @since 2.3.0
56          */
57         do_action( 'commentsrss2_head' );
58
59         if ( have_comments() ) : while ( have_comments() ) : the_comment();
60                 $comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
61         ?>
62         <item>
63                 <title><?php
64                         if ( !is_singular() ) {
65                                 $title = get_the_title($comment_post->ID);
66                                 /** This filter is documented in wp-includes/feed.php */
67                                 $title = apply_filters( 'the_title_rss', $title );
68                                 printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
69                         } else {
70                                 printf(ent2ncr(__('By: %s')), get_comment_author_rss());
71                         }
72                 ?></title>
73                 <link><?php comment_link() ?></link>
74                 <dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>
75                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>
76                 <guid isPermaLink="false"><?php comment_guid() ?></guid>
77 <?php if ( post_password_required($comment_post) ) : ?>
78                 <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
79                 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
80 <?php else : // post pass ?>
81                 <description><![CDATA[<?php comment_text_rss() ?>]]></description>
82                 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
83 <?php endif; // post pass
84         /**
85          * Fires at the end of each RSS2 comment feed item.
86          *
87          * @since 2.1.0
88          *
89          * @param int $comment->comment_ID The ID of the comment being displayed.
90          * @param int $comment_post->ID    The ID of the post the comment is connected to.
91          */
92         do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
93 ?>
94         </item>
95 <?php endwhile; endif; ?>
96 </channel>
97 </rss>