wp/wp-includes/feed-atom-comments.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    26 		 */
    26 		 */
    27 		do_action( 'atom_comments_ns' );
    27 		do_action( 'atom_comments_ns' );
    28 	?>
    28 	?>
    29 >
    29 >
    30 	<title type="text"><?php
    30 	<title type="text"><?php
    31 		if ( is_singular() )
    31 		if ( is_singular() ) {
       
    32 			/* translators: Comments feed title. 1: Post title */
    32 			printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() );
    33 			printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() );
    33 		elseif ( is_search() )
    34 		} elseif ( is_search() ) {
       
    35 			/* translators: Comments feed title. 1: Site name, 2: Search query */
    34 			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    36 			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    35 		else
    37 		} else {
    36 			printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
    38 			/* translators: Comments feed title. 1: Site name */
       
    39 			printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
       
    40 		}
    37 	?></title>
    41 	?></title>
    38 	<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
    42 	<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
    39 
    43 
    40 	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
    44 	<updated><?php
       
    45 		$date = get_lastcommentmodified( 'GMT' );
       
    46 		echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date, false ) : date( 'Y-m-d\TH:i:s\Z' );
       
    47 	?></updated>
    41 
    48 
    42 <?php if ( is_singular() ) { ?>
    49 <?php if ( is_singular() ) { ?>
    43 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
    50 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
    44 	<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
    51 	<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
    45 	<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
    52 	<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
    46 <?php } elseif(is_search()) { ?>
    53 <?php } elseif (is_search()) { ?>
    47 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
    54 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
    48 	<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
    55 	<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
    49 	<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
    56 	<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
    50 <?php } else { ?>
    57 <?php } else { ?>
    51 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
    58 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
    68 		<title><?php
    75 		<title><?php
    69 			if ( !is_singular() ) {
    76 			if ( !is_singular() ) {
    70 				$title = get_the_title($comment_post->ID);
    77 				$title = get_the_title($comment_post->ID);
    71 				/** This filter is documented in wp-includes/feed.php */
    78 				/** This filter is documented in wp-includes/feed.php */
    72 				$title = apply_filters( 'the_title_rss', $title );
    79 				$title = apply_filters( 'the_title_rss', $title );
       
    80 				/* translators: Individual comment title. 1: Post title, 2: Comment author name */
    73 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
    81 				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
    74 			} else {
    82 			} else {
       
    83 				/* translators: Comment author title. 1: Comment author name */
    75 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
    84 				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
    76 			}
    85 			}
    77 		?></title>
    86 		?></title>
    78 		<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    87 		<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    79 
    88 
    89 <?php if ( post_password_required($comment_post) ) : ?>
    98 <?php if ( post_password_required($comment_post) ) : ?>
    90 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
    99 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
    91 <?php else : // post pass ?>
   100 <?php else : // post pass ?>
    92 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
   101 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
    93 <?php endif; // post pass
   102 <?php endif; // post pass
    94 	// Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)
   103 	// Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt)
    95 	if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
   104 	if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
    96 		<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
   105 		<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    97 <?php else : // This comment is in reply to another comment
   106 <?php else : // This comment is in reply to another comment
    98 	$parent_comment = get_comment($comment->comment_parent);
   107 	$parent_comment = get_comment($comment->comment_parent);
    99 	// The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, it's more important that they both use the same system
   108 	// The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, it's more important that they both use the same system