web/wp-includes/feed-rss2-comments.php
changeset 136 bde1974c263b
child 194 32102edaa81b
equal deleted inserted replaced
135:53cff4b4a802 136:bde1974c263b
       
     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 <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 	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
       
    17 	<?php do_action('rss2_ns'); do_action('rss2_comments_ns'); ?>
       
    18 	>
       
    19 <channel>
       
    20 	<title><?php
       
    21 		if ( is_singular() )
       
    22 			printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
       
    23 		elseif ( is_search() )
       
    24 			printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s']));
       
    25 		else
       
    26 			printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
       
    27 	?></title>
       
    28 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
       
    29 	<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
       
    30 	<description><?php bloginfo_rss("description") ?></description>
       
    31 	<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
       
    32 	<?php the_generator( 'rss2' ); ?>
       
    33 	<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
       
    34 	<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
       
    35 	<?php do_action('commentsrss2_head'); ?>
       
    36 <?php
       
    37 if ( have_comments() ) : while ( have_comments() ) : the_comment();
       
    38 	$comment_post = get_post($comment->comment_post_ID);
       
    39 	get_post_custom($comment_post->ID);
       
    40 ?>
       
    41 	<item>
       
    42 		<title><?php
       
    43 			if ( !is_singular() ) {
       
    44 				$title = get_the_title($comment_post->ID);
       
    45 				$title = apply_filters('the_title_rss', $title);
       
    46 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
       
    47 			} else {
       
    48 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
       
    49 			}
       
    50 		?></title>
       
    51 		<link><?php comment_link() ?></link>
       
    52 		<dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
       
    53 		<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>
       
    54 		<guid isPermaLink="false"><?php comment_guid() ?></guid>
       
    55 <?php if ( post_password_required($comment_post) ) : ?>
       
    56 		<description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
       
    57 		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
       
    58 <?php else : // post pass ?>
       
    59 		<description><?php comment_text_rss() ?></description>
       
    60 		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
       
    61 <?php endif; // post pass
       
    62 	do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID);
       
    63 ?>
       
    64 	</item>
       
    65 <?php endwhile; endif; ?>
       
    66 </channel>
       
    67 </rss>