web/wp-includes/feed-atom-comments.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     8 header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
     8 header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
     9 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
     9 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
    10 ?>
    10 ?>
    11 <feed
    11 <feed
    12 	xmlns="http://www.w3.org/2005/Atom"
    12 	xmlns="http://www.w3.org/2005/Atom"
    13 	xml:lang="<?php echo get_option('rss_language'); ?>"
    13 	xml:lang="<?php bloginfo_rss( 'language' ); ?>"
    14 	xmlns:thr="http://purl.org/syndication/thread/1.0"
    14 	xmlns:thr="http://purl.org/syndication/thread/1.0"
    15 	<?php do_action('atom_ns'); do_action('atom_comments_ns'); ?>
    15 	<?php do_action('atom_ns'); do_action('atom_comments_ns'); ?>
    16 >
    16 >
    17 	<title type="text"><?php
    17 	<title type="text"><?php
    18 		if ( is_singular() )
    18 		if ( is_singular() )
    19 			printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
    19 			printf(ent2ncr(__('Comments on %s')), get_the_title_rss());
    20 		elseif ( is_search() )
    20 		elseif ( is_search() )
    21 			printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), esc_attr(get_search_query()));
    21 			printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), get_search_query() );
    22 		else
    22 		else
    23 			printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
    23 			printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
    24 	?></title>
    24 	?></title>
    25 	<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
    25 	<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
    26 
    26 
    27 	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
    27 	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
    28 	<?php the_generator( 'atom' ); ?>
       
    29 
    28 
    30 <?php if ( is_singular() ) { ?>
    29 <?php if ( is_singular() ) { ?>
    31 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link(); ?>" />
    30 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
    32 	<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
    31 	<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
    33 	<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
    32 	<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
    34 <?php } elseif(is_search()) { ?>
    33 <?php } elseif(is_search()) { ?>
    35 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . esc_attr(get_search_query()); ?>" />
    34 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
    36 	<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
    35 	<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
    37 	<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
    36 	<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
    38 <?php } else { ?>
    37 <?php } else { ?>
    39 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" />
    38 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
    40 	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
    39 	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
    41 	<id><?php bloginfo_rss('comments_atom_url'); ?></id>
    40 	<id><?php bloginfo_rss('comments_atom_url'); ?></id>
    42 <?php } ?>
    41 <?php } ?>
    43 <?php do_action('comments_atom_head'); ?>
    42 <?php do_action('comments_atom_head'); ?>
    44 <?php
    43 <?php
    45 if ( have_comments() ) : while ( have_comments() ) : the_comment();
    44 if ( have_comments() ) : while ( have_comments() ) : the_comment();
    46 	$comment_post = get_post($comment->comment_post_ID);
    45 	$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
    47 	get_post_custom($comment_post->ID);
       
    48 ?>
    46 ?>
    49 	<entry>
    47 	<entry>
    50 		<title><?php
    48 		<title><?php
    51 			if ( !is_singular() ) {
    49 			if ( !is_singular() ) {
    52 				$title = get_the_title($comment_post->ID);
    50 				$title = get_the_title($comment_post->ID);
    72 <?php else : // post pass ?>
    70 <?php else : // post pass ?>
    73 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
    71 		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
    74 <?php endif; // post pass
    72 <?php endif; // post pass
    75 	// Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)
    73 	// Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)
    76 	if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
    74 	if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
    77 		<thr:in-reply-to ref="<?php the_guid() ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    75 		<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    78 <?php else : // This comment is in reply to another comment
    76 <?php else : // This comment is in reply to another comment
    79 	$parent_comment = get_comment($comment->comment_parent);
    77 	$parent_comment = get_comment($comment->comment_parent);
    80 	// The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system
    78 	// The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system
    81 ?>
    79 ?>
    82 		<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    80 		<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />