wp/wp-includes/feed-rss2-comments.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 21 48c4eec2b7e6
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    33 >
    33 >
    34 <channel>
    34 <channel>
    35 	<title>
    35 	<title>
    36 	<?php
    36 	<?php
    37 	if ( is_singular() ) {
    37 	if ( is_singular() ) {
    38 		/* translators: Comments feed title. %s: Post title */
    38 		/* translators: Comments feed title. %s: Post title. */
    39 		printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
    39 		printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
    40 	} elseif ( is_search() ) {
    40 	} elseif ( is_search() ) {
    41 		/* translators: Comments feed title. 1: Site name, 2: Search query */
    41 		/* translators: Comments feed title. 1: Site title, 2: Search query. */
    42 		printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    42 		printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    43 	} else {
    43 	} else {
    44 		/* translators: Comments feed title. %s: Site name */
    44 		/* translators: Comments feed title. %s: Site title. */
    45 		printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
    45 		printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
    46 	}
    46 	}
    47 	?>
    47 	?>
    48 	</title>
    48 	</title>
    49 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    49 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    68 	 *
    68 	 *
    69 	 * @since 2.3.0
    69 	 * @since 2.3.0
    70 	 */
    70 	 */
    71 	do_action( 'commentsrss2_head' );
    71 	do_action( 'commentsrss2_head' );
    72 
    72 
    73 	if ( have_comments() ) :
    73 	while ( have_comments() ) :
    74 		while ( have_comments() ) :
    74 		the_comment();
    75 			the_comment();
    75 		$comment_post    = get_post( $comment->comment_post_ID );
    76 			$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
    76 		$GLOBALS['post'] = $comment_post;
    77 			?>
    77 		?>
    78 			<item>
    78 	<item>
    79 				<title>
    79 		<title>
    80 				<?php
    80 		<?php
    81 				if ( ! is_singular() ) {
    81 		if ( ! is_singular() ) {
    82 					$title = get_the_title( $comment_post->ID );
    82 			$title = get_the_title( $comment_post->ID );
    83 					/** This filter is documented in wp-includes/feed.php */
    83 			/** This filter is documented in wp-includes/feed.php */
    84 					$title = apply_filters( 'the_title_rss', $title );
    84 			$title = apply_filters( 'the_title_rss', $title );
    85 					/* translators: Individual comment title. 1: Post title, 2: Comment author name */
    85 			/* translators: Individual comment title. 1: Post title, 2: Comment author name. */
    86 					printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
    86 			printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
    87 				} else {
    87 		} else {
    88 					/* translators: Comment author title. %s: Comment author name */
    88 			/* translators: Comment author title. %s: Comment author name. */
    89 					printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
    89 			printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
    90 				}
    90 		}
    91 				?>
    91 		?>
    92 				</title>
    92 		</title>
    93 				<link><?php comment_link(); ?></link>
    93 		<link><?php comment_link(); ?></link>
       
    94 
    94 		<dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator>
    95 		<dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator>
    95 		<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>
    96 		<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>
    96 		<guid isPermaLink="false"><?php comment_guid(); ?></guid>
    97 		<guid isPermaLink="false"><?php comment_guid(); ?></guid>
    97 			<?php if ( post_password_required( $comment_post ) ) : ?>
    98 
    98 		<description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description>
    99 		<?php if ( post_password_required( $comment_post ) ) : ?>
    99 		<content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded>
   100 			<description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description>
   100 		<?php else : // post pass ?>
   101 			<content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded>
   101 		<description><![CDATA[<?php comment_text_rss(); ?>]]></description>
   102 		<?php else : ?>
   102 		<content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded>
   103 			<description><![CDATA[<?php comment_text_rss(); ?>]]></description>
   103 			<?php
   104 			<content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded>
   104 		endif; // post pass
   105 		<?php endif; // End if post_password_required(). ?>
   105 			/**
   106 
   106 			 * Fires at the end of each RSS2 comment feed item.
   107 		<?php
   107 			 *
   108 		/**
   108 			 * @since 2.1.0
   109 		 * Fires at the end of each RSS2 comment feed item.
   109 			 *
   110 		 *
   110 			 * @param int $comment->comment_ID The ID of the comment being displayed.
   111 		 * @since 2.1.0
   111 			 * @param int $comment_post->ID    The ID of the post the comment is connected to.
   112 		 *
   112 			 */
   113 		 * @param int $comment_ID The ID of the comment being displayed.
   113 			do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
   114 		 * @param int $ID         The ID of the post the comment is connected to.
       
   115 		 */
       
   116 		do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
   114 		?>
   117 		?>
   115 			</item>
   118 	</item>
   116 			<?php
   119 	<?php endwhile; ?>
   117 		endwhile;
       
   118 endif;
       
   119 	?>
       
   120 </channel>
   120 </channel>
   121 </rss>
   121 </rss>