wp/wp-includes/feed-atom-comments.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     5  * @package WordPress
     5  * @package WordPress
     6  */
     6  */
     7 
     7 
     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 
       
    11 /** This action is documented in wp-includes/feed-rss2.php */
       
    12 do_action( 'rss_tag_pre', 'atom-comments' );
    10 ?>
    13 ?>
    11 <feed
    14 <feed
    12 	xmlns="http://www.w3.org/2005/Atom"
    15 	xmlns="http://www.w3.org/2005/Atom"
    13 	xml:lang="<?php bloginfo_rss( 'language' ); ?>"
    16 	xml:lang="<?php bloginfo_rss( 'language' ); ?>"
    14 	xmlns:thr="http://purl.org/syndication/thread/1.0"
    17 	xmlns:thr="http://purl.org/syndication/thread/1.0"
    15 	<?php do_action('atom_ns'); do_action('atom_comments_ns'); ?>
    18 	<?php
       
    19 		/** This action is documented in wp-includes/feed-atom.php */
       
    20 		do_action( 'atom_ns' );
       
    21 
       
    22 		/**
       
    23 		 * Fires inside the feed tag in the Atom comment feed.
       
    24 		 *
       
    25 		 * @since 2.8.0
       
    26 		 */
       
    27 		do_action( 'atom_comments_ns' );
       
    28 	?>
    16 >
    29 >
    17 	<title type="text"><?php
    30 	<title type="text"><?php
    18 		if ( is_singular() )
    31 		if ( is_singular() )
    19 			printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() );
    32 			printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() );
    20 		elseif ( is_search() )
    33 		elseif ( is_search() )
    37 <?php } else { ?>
    50 <?php } else { ?>
    38 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
    51 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
    39 	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
    52 	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
    40 	<id><?php bloginfo_rss('comments_atom_url'); ?></id>
    53 	<id><?php bloginfo_rss('comments_atom_url'); ?></id>
    41 <?php } ?>
    54 <?php } ?>
    42 <?php do_action('comments_atom_head'); ?>
    55 <?php
       
    56 	/**
       
    57 	 * Fires at the end of the Atom comment feed header.
       
    58 	 *
       
    59 	 * @since 2.8.0
       
    60 	 */
       
    61 	do_action( 'comments_atom_head' );
       
    62 ?>
    43 <?php
    63 <?php
    44 if ( have_comments() ) : while ( have_comments() ) : the_comment();
    64 if ( have_comments() ) : while ( have_comments() ) : the_comment();
    45 	$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
    65 	$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
    46 ?>
    66 ?>
    47 	<entry>
    67 	<entry>
    78 	$parent_comment = get_comment($comment->comment_parent);
    98 	$parent_comment = get_comment($comment->comment_parent);
    79 	// 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
    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
    80 ?>
   100 ?>
    81 		<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />
   101 		<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />
    82 <?php endif;
   102 <?php endif;
    83 	do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);
   103 	/**
       
   104 	 * Fires at the end of each Atom comment feed item.
       
   105 	 *
       
   106 	 * @since 2.2.0
       
   107 	 *
       
   108 	 * @param int $comment_id      ID of the current comment.
       
   109 	 * @param int $comment_post_id ID of the post the current comment is connected to.
       
   110 	 */
       
   111 	do_action( 'comment_atom_entry', $comment->comment_ID, $comment_post->ID );
    84 ?>
   112 ?>
    85 	</entry>
   113 	</entry>
    86 <?php endwhile; endif; ?>
   114 <?php endwhile; endif; ?>
    87 </feed>
   115 </feed>