wp/wp-includes/feed-rss2-comments.php
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     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
       
    18 	/** This action is documented in wp-includes/feed-rss2.php */
       
    19 	do_action( 'rss2_ns' );
       
    20 	?>
       
    21 
       
    22 	<?php
       
    23 	/**
       
    24 	 * Fires at the end of the RSS root to add namespaces.
       
    25 	 *
       
    26 	 * @since 2.8.0
       
    27 	 */
       
    28 	do_action( 'rss2_comments_ns' );
       
    29 	?>
       
    30 >
       
    31 <channel>
       
    32 	<title><?php
       
    33 		if ( is_singular() )
       
    34 			printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
       
    35 		elseif ( is_search() )
       
    36 			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
       
    37 		else
       
    38 			printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
       
    39 	?></title>
       
    40 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
       
    41 	<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
       
    42 	<description><?php bloginfo_rss("description") ?></description>
       
    43 	<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
       
    44 	<?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
       
    45 	<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
       
    46 	<?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
       
    47 	<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
       
    48 	<?php
       
    49 	/**
       
    50 	 * Fires at the end of the RSS2 comment feed header.
       
    51 	 *
       
    52 	 * @since 2.3.0
       
    53 	 */
       
    54 	do_action( 'commentsrss2_head' );
       
    55 
       
    56 	if ( have_comments() ) : while ( have_comments() ) : the_comment();
       
    57 		$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
       
    58 	?>
       
    59 	<item>
       
    60 		<title><?php
       
    61 			if ( !is_singular() ) {
       
    62 				$title = get_the_title($comment_post->ID);
       
    63 				/** This filter is documented in wp-includes/feed.php */
       
    64 				$title = apply_filters( 'the_title_rss', $title );
       
    65 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
       
    66 			} else {
       
    67 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
       
    68 			}
       
    69 		?></title>
       
    70 		<link><?php comment_link() ?></link>
       
    71 		<dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>
       
    72 		<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>
       
    73 		<guid isPermaLink="false"><?php comment_guid() ?></guid>
       
    74 <?php if ( post_password_required($comment_post) ) : ?>
       
    75 		<description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
       
    76 		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
       
    77 <?php else : // post pass ?>
       
    78 		<description><![CDATA[<?php comment_text_rss() ?>]]></description>
       
    79 		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
       
    80 <?php endif; // post pass
       
    81 	/**
       
    82 	 * Fires at the end of each RSS2 comment feed item.
       
    83 	 *
       
    84 	 * @since 2.1.0
       
    85 	 *
       
    86 	 * @param int $comment->comment_ID The ID of the comment being displayed.
       
    87 	 * @param int $comment_post->ID    The ID of the post the comment is connected to.
       
    88 	 */
       
    89 	do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
       
    90 ?>
       
    91 	</item>
       
    92 <?php endwhile; endif; ?>
       
    93 </channel>
       
    94 </rss>