Wordpress 2.3.2-scripts
[autoinstalls/wordpress.git] / wp-includes / feed-atom-comments.php
1 <?php
2 header('Content-Type: application/atom+xml; charset=' . get_option('blog_charset'), true);
3 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
4 ?>
5 <feed
6         xmlns="http://www.w3.org/2005/Atom"
7         xml:lang="<?php echo get_option('rss_language'); ?>"
8         <?php do_action('atom_ns'); ?>
9 >
10         <title type="text"><?php
11                 if ( is_singular() )
12                         printf(__('Comments on: %s'), get_the_title_rss());
13                 elseif ( is_search() )
14                         printf(__('Comments for %s searching on %s'), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s']));
15                 else
16                         printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
17         ?></title>
18         <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
19
20         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
21         <generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator>
22
23         <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" />
24         <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
25         <id><?php bloginfo_rss('comments_atom_url'); ?></id>
26
27 <?php
28 if ( have_comments() ) : while ( have_comments() ) : the_comment();
29         $comment_post = get_post($comment->comment_post_ID);
30         get_post_custom($comment_post->ID);
31 ?>
32         <entry>
33                 <title><?php
34                         if ( !is_singular() ) {
35                                 $title = get_the_title($comment_post->ID);
36                                 $title = apply_filters('the_title_rss', $title);
37                                 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
38                         } else {
39                                 printf(__('By: %s'), get_comment_author_rss());
40                         }
41                 ?></title>
42                 <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
43
44                 <author>
45                         <name><?php comment_author_rss(); ?></name>
46                         <?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
47
48                 </author>
49
50                 <id><?php comment_link(); ?></id>
51                 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></updated>
52                 <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></published>
53 <?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?>
54                 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
55 <?php else : // post pass ?>
56                 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
57 <?php endif; // post pass
58         do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);
59 ?>
60         </entry>
61 <?php endwhile; endif; ?>
62 </feed>