wp/wp-includes/feed-rss2-comments.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     3  * RSS2 Feed Template for displaying RSS2 Comments feed.
     3  * RSS2 Feed Template for displaying RSS2 Comments feed.
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  */
     6  */
     7 
     7 
     8 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
     8 header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
     9 
     9 
    10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    11 
    11 
    12 /** This action is documented in wp-includes/feed-rss2.php */
    12 /** This action is documented in wp-includes/feed-rss2.php */
    13 do_action( 'rss_tag_pre', 'rss2-comments' );
    13 do_action( 'rss_tag_pre', 'rss2-comments' );
    31 	do_action( 'rss2_comments_ns' );
    31 	do_action( 'rss2_comments_ns' );
    32 	?>
    32 	?>
    33 >
    33 >
    34 <channel>
    34 <channel>
    35 	<title><?php
    35 	<title><?php
    36 		if ( is_singular() )
    36 		if ( is_singular() ) {
       
    37 			/* translators: Comments feed title. 1: Post title */
    37 			printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
    38 			printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
    38 		elseif ( is_search() )
    39 		} elseif ( is_search() ) {
       
    40 			/* translators: Comments feed title. 1: Site name, 2: Search query */
    39 			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    41 			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    40 		else
    42 		} else {
    41 			printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
    43 			/* translators: Comments feed title. 1: Site name */
       
    44 			printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
       
    45 		}
    42 	?></title>
    46 	?></title>
    43 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    47 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    44 	<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
    48 	<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
    45 	<description><?php bloginfo_rss("description") ?></description>
    49 	<description><?php bloginfo_rss("description") ?></description>
    46 	<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
    50 	<lastBuildDate><?php
       
    51 		$date = get_lastcommentmodified( 'GMT' );
       
    52 		echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
       
    53 	?></lastBuildDate>
    47 	<sy:updatePeriod><?php
    54 	<sy:updatePeriod><?php
    48 		/** This filter is documented in wp-includes/feed-rss2.php */
    55 		/** This filter is documented in wp-includes/feed-rss2.php */
    49 		echo apply_filters( 'rss_update_period', 'hourly' );
    56 		echo apply_filters( 'rss_update_period', 'hourly' );
    50 	?></sy:updatePeriod>
    57 	?></sy:updatePeriod>
    51 	<sy:updateFrequency><?php
    58 	<sy:updateFrequency><?php
    67 		<title><?php
    74 		<title><?php
    68 			if ( !is_singular() ) {
    75 			if ( !is_singular() ) {
    69 				$title = get_the_title($comment_post->ID);
    76 				$title = get_the_title($comment_post->ID);
    70 				/** This filter is documented in wp-includes/feed.php */
    77 				/** This filter is documented in wp-includes/feed.php */
    71 				$title = apply_filters( 'the_title_rss', $title );
    78 				$title = apply_filters( 'the_title_rss', $title );
       
    79 				/* translators: Individual comment title. 1: Post title, 2: Comment author name */
    72 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
    80 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
    73 			} else {
    81 			} else {
       
    82 				/* translators: Comment author title. 1: Comment author name */
    74 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
    83 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
    75 			}
    84 			}
    76 		?></title>
    85 		?></title>
    77 		<link><?php comment_link() ?></link>
    86 		<link><?php comment_link() ?></link>
    78 		<dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>
    87 		<dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>