| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * RSS2 Feed Template for displaying RSS2 Comments feed. |
|---|
| 4 | * |
|---|
| 5 | * @package WordPress |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true); |
|---|
| 9 | |
|---|
| 10 | echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; |
|---|
| 11 | ?> |
|---|
| 12 | <rss version="2.0" |
|---|
| 13 | xmlns:content="http://purl.org/rss/1.0/modules/content/" |
|---|
| 14 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
|---|
| 15 | xmlns:atom="http://www.w3.org/2005/Atom" |
|---|
| 16 | xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" |
|---|
| 17 | > |
|---|
| 18 | <channel> |
|---|
| 19 | <title><?php |
|---|
| 20 | if ( is_singular() ) |
|---|
| 21 | printf(html_entity_decode(__('Comments on: %s', ENT_QUOTES, get_option('blog_charset')), get_the_title_rss())); |
|---|
| 22 | elseif ( is_search() ) |
|---|
| 23 | printf(html_entity_decode(__('Comments for %s searching on %s'), ENT_QUOTES, get_option('blog_charset')), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s'])); |
|---|
| 24 | else |
|---|
| 25 | printf(html_entity_decode(__('Comments for %s'), ENT_QUOTES, get_option('blog_charset')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); |
|---|
| 26 | ?></title> |
|---|
| 27 | <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
|---|
| 28 | <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link> |
|---|
| 29 | <description><?php bloginfo_rss("description") ?></description> |
|---|
| 30 | <pubDate><?php echo gmdate('r'); ?></pubDate> |
|---|
| 31 | <?php the_generator( 'rss2' ); ?> |
|---|
| 32 | <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod> |
|---|
| 33 | <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency> |
|---|
| 34 | <?php do_action('commentsrss2_head'); ?> |
|---|
| 35 | <?php |
|---|
| 36 | if ( have_comments() ) : while ( have_comments() ) : the_comment(); |
|---|
| 37 | $comment_post = get_post($comment->comment_post_ID); |
|---|
| 38 | get_post_custom($comment_post->ID); |
|---|
| 39 | ?> |
|---|
| 40 | <item> |
|---|
| 41 | <title><?php |
|---|
| 42 | if ( !is_singular() ) { |
|---|
| 43 | $title = get_the_title($comment_post->ID); |
|---|
| 44 | $title = apply_filters('the_title_rss', $title); |
|---|
| 45 | printf(html_entity_decode(__('Comment on %1$s by %2$s'), ENT_QUOTES, get_option('blog_charset')), $title, get_comment_author_rss()); |
|---|
| 46 | } else { |
|---|
| 47 | printf(html_entity_decode(__('By: %s'), ENT_QUOTES, get_option('blog_charset')), get_comment_author_rss()); |
|---|
| 48 | } |
|---|
| 49 | ?></title> |
|---|
| 50 | <link><?php comment_link() ?></link> |
|---|
| 51 | <dc:creator><?php echo get_comment_author_rss() ?></dc:creator> |
|---|
| 52 | <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> |
|---|
| 53 | <guid isPermaLink="false"><?php comment_guid() ?></guid> |
|---|
| 54 | <?php if ( post_password_required($comment_post) ) : ?> |
|---|
| 55 | <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description> |
|---|
| 56 | <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded> |
|---|
| 57 | <?php else : // post pass ?> |
|---|
| 58 | <description><?php comment_text_rss() ?></description> |
|---|
| 59 | <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> |
|---|
| 60 | <?php endif; // post pass |
|---|
| 61 | do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID); |
|---|
| 62 | ?> |
|---|
| 63 | </item> |
|---|
| 64 | <?php endwhile; endif; ?> |
|---|
| 65 | </channel> |
|---|
| 66 | </rss> |
|---|