| | 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_single() || is_page()) { |
| | 12 | printf(__('Comments on: %s'), get_the_title_rss()); |
| | 13 | } else { |
| | 14 | printf(__('Comments for %s'), get_bloginfo_rss('name')); |
| | 15 | } |
| | 16 | ?></title> |
| | 17 | <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> |
| | 18 | |
| | 19 | <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> |
| | 20 | <generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator> |
| | 21 | |
| | 22 | <link rel="alternate" type="<?php bloginfo_rss('content_type'); ?>" content="<?php bloginfo_rss('home'); ?>" /> |
| | 23 | <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" /> |
| | 24 | <id><?php bloginfo_rss('comments_atom_url'); ?></id> |
| | 25 | |
| | 26 | <?php |
| | 27 | $i = 0; |
| | 28 | if (have_posts()) : |
| | 29 | while (have_posts()) : the_post(); |
| | 30 | if ($i < 1) { |
| | 31 | $i++; |
| | 32 | } |
| | 33 | |
| | 34 | if (is_single() || is_page()) { |
| | 35 | $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, |
| | 36 | comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, |
| | 37 | $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments |
| | 38 | LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' |
| | 39 | AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' |
| | 40 | AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' |
| | 41 | ORDER BY comment_date_gmt ASC" ); |
| | 42 | } else { // if no post id passed in, we'll just use the last posts_per_rss comments. |
| | 43 | $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, |
| | 44 | comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, |
| | 45 | $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments |
| | 46 | LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' |
| | 47 | AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' |
| | 48 | ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); |
| | 49 | } |
| | 50 | |
| | 51 | if ($comments) { |
| | 52 | foreach ($comments as $comment) { |
| | 53 | $GLOBALS['comment'] =& $comment; |
| | 54 | get_post_custom($comment->comment_post_ID); |
| | 55 | ?> |
| | 56 | <entry> |
| | 57 | <title><?php |
| | 58 | if (!(is_single() || is_page())) { |
| | 59 | $title = get_the_title($comment->comment_post_ID); |
| | 60 | $title = apply_filters('the_title', $title); |
| | 61 | $title = apply_filters('the_title_rss', $title); |
| | 62 | printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); |
| | 63 | } else { |
| | 64 | printf(__('By: %s'), get_comment_author_rss()); |
| | 65 | } |
| | 66 | ?></title> |
| | 67 | <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" /> |
| | 68 | |
| | 69 | <author> |
| | 70 | <name><?php comment_author_rss(); ?></name> |
| | 71 | <?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?> |
| | 72 | </author> |
| | 73 | |
| | 74 | <id><?php comment_link(); ?></id> |
| | 75 | <updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated> |
| | 76 | <published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published> |
| | 77 | |
| | 78 | <?php if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { ?> |
| | 79 | <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> |
| | 80 | <?php } else { ?> |
| | 81 | <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content> |
| | 82 | <?php } ?> |
| | 83 | </entry> |
| | 84 | <?php |
| | 85 | } |
| | 86 | } |
| | 87 | |
| | 88 | endwhile; |
| | 89 | endif; |
| | 90 | ?> |
| | 91 | </feed> |
| | 92 | No newline at end of file |