Make WordPress Core

Ticket #3846: relocate_feeds.diff

File relocate_feeds.diff, 24.5 KB (added by ryan, 18 years ago)
  • wp-rss.php

     
    55        wp('feed=rss');
    66}
    77
    8 header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
    9 $more = 1;
     8require (ABSPATH . WPINC . '/feed-rss.php');
    109
    11 ?>
    12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    13 <!-- generator="wordpress/<?php echo $wp_version ?>" -->
    14 <rss version="0.92">
    15 <channel>
    16         <title><?php bloginfo_rss('name') ?></title>
    17         <link><?php bloginfo_rss('url') ?></link>
    18         <description><?php bloginfo_rss('description') ?></description>
    19         <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
    20         <docs>http://backend.userland.com/rss092</docs>
    21         <language><?php echo get_option('rss_language'); ?></language>
    22         <?php do_action('rss_head'); ?>
    23 
    24 <?php while (have_posts()) : the_post(); ?>
    25         <item>
    26                 <title><?php the_title_rss() ?></title>
    27 <?php if (get_option('rss_use_excerpt')) { ?>
    28                 <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    29 <?php } else { // use content ?>
    30                 <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
    31 <?php } ?>
    32                 <link><?php permalink_single_rss() ?></link>
    33                 <?php do_action('rss_item'); ?>
    34         </item>
    35 <?php endwhile; ?>
    36 </channel>
    37 </rss>
     10?>
     11 No newline at end of file
  • wp-rdf.php

     
    55        wp('feed=rdf');
    66}
    77
    8 header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
    9 $more = 1;
     8require (ABSPATH . WPINC . '/feed-rdf.php');
    109
    11 ?>
    12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    13 <!-- generator="wordpress/<?php echo $wp_version ?>" -->
    14 <rdf:RDF
    15         xmlns="http://purl.org/rss/1.0/"
    16         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    17         xmlns:dc="http://purl.org/dc/elements/1.1/"
    18         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    19         xmlns:admin="http://webns.net/mvcb/"
    20         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    21         <?php do_action('rdf_ns'); ?>
    22 >
    23 <channel rdf:about="<?php bloginfo_rss("url") ?>">
    24         <title><?php bloginfo_rss('name') ?></title>
    25         <link><?php bloginfo_rss('url') ?></link>
    26         <description><?php bloginfo_rss('description') ?></description>
    27         <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
    28         <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
    29         <sy:updatePeriod>hourly</sy:updatePeriod>
    30         <sy:updateFrequency>1</sy:updateFrequency>
    31         <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    32         <?php do_action('rdf_header'); ?>
    33         <items>
    34                 <rdf:Seq>
    35                 <?php while (have_posts()): the_post(); ?>
    36                         <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
    37                 <?php endwhile; ?>
    38                 </rdf:Seq>
    39         </items>
    40 </channel>
    41 <?php rewind_posts(); while (have_posts()): the_post(); ?>
    42 <item rdf:about="<?php permalink_single_rss() ?>">
    43         <title><?php the_title_rss() ?></title>
    44         <link><?php permalink_single_rss() ?></link>
    45          <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
    46         <dc:creator><?php the_author() ?></dc:creator>
    47         <?php the_category_rss('rdf') ?>
    48 <?php if (get_option('rss_use_excerpt')) : ?>
    49         <description><?php the_excerpt_rss() ?></description>
    50 <?php else : ?>
    51         <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length'), 2) ?></description>
    52         <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
    53 <?php endif; ?>
    54         <?php do_action('rdf_item'); ?>
    55 </item>
    56 <?php endwhile;  ?>
    57 </rdf:RDF>
     10?>
     11 No newline at end of file
  • wp-includes/feed-rss2.php

     
     1<?php
     2header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
     3$more = 1;
     4
     5?>
     6<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     7
     8<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
     9<rss version="2.0"
     10        xmlns:content="http://purl.org/rss/1.0/modules/content/"
     11        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     12        xmlns:dc="http://purl.org/dc/elements/1.1/"
     13        <?php do_action('rss2_ns'); ?>
     14>
     15
     16<channel>
     17        <title><?php bloginfo_rss('name'); ?></title>
     18        <link><?php bloginfo_rss('url') ?></link>
     19        <description><?php bloginfo_rss("description") ?></description>
     20        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
     21        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
     22        <language><?php echo get_option('rss_language'); ?></language>
     23        <?php do_action('rss2_head'); ?>
     24        <?php while( have_posts()) : the_post(); ?>
     25        <item>
     26                <title><?php the_title_rss() ?></title>
     27                <link><?php permalink_single_rss() ?></link>
     28                <comments><?php comments_link(); ?></comments>
     29                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
     30                <dc:creator><?php the_author() ?></dc:creator>
     31                <?php the_category_rss() ?>
     32
     33                <guid isPermaLink="false"><?php the_guid(); ?></guid>
     34<?php if (get_option('rss_use_excerpt')) : ?>
     35                <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
     36<?php else : ?>
     37                <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
     38        <?php if ( strlen( $post->post_content ) > 0 ) : ?>
     39                <content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
     40        <?php else : ?>
     41                <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
     42        <?php endif; ?>
     43<?php endif; ?>
     44                <wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
     45<?php rss_enclosure(); ?>
     46        <?php do_action('rss2_item'); ?>
     47        </item>
     48        <?php endwhile; ?>
     49</channel>
     50</rss>
  • wp-includes/feed-atom.php

     
     1<?php
     2header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true);
     3$more = 1;
     4
     5?>
     6<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     7<feed
     8  xmlns="http://www.w3.org/2005/Atom"
     9  xmlns:thr="http://purl.org/syndication/thread/1.0"
     10  xml:lang="<?php echo get_option('rss_language'); ?>"
     11  xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php"
     12  <?php do_action('atom_ns'); ?>
     13 >
     14        <title type="text"><?php bloginfo_rss('name') ?></title>
     15        <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
     16       
     17        <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
     18        <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
     19
     20        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
     21        <id><?php bloginfo('atom_url'); ?></id>
     22        <link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
     23
     24        <?php do_action('atom_head'); ?>
     25        <?php while (have_posts()) : the_post(); ?>
     26        <entry>
     27                <author>
     28                        <name><?php the_author() ?></name>
     29                        <uri><?php the_author_url()?></uri>
     30                </author>
     31                <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
     32                <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
     33                <id><?php the_guid(); ?></id>
     34                <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
     35                <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
     36                <?php the_category_rss('atom') ?>
     37                <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
     38<?php if ( !get_option('rss_use_excerpt') ) : ?>
     39                <content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
     40<?php endif; ?>
     41<?php rss_enclosure(); ?>
     42<?php do_action('atom_entry'); ?>
     43        </entry>
     44        <?php endwhile ; ?>
     45</feed>
  • wp-includes/feed-rss2-comments.php

     
     1<?php
     2header('Content-type: text/xml;charset=' . get_option('blog_charset'), true);
     3
     4echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
     5?>
     6<!-- generator="wordpress/<?php echo $wp_version ?>" -->
     7<rss version="2.0"
     8        xmlns:content="http://purl.org/rss/1.0/modules/content/">
     9<channel>
     10<?php
     11$i = 0;
     12if (have_posts()) :
     13  while (have_posts()) : the_post();
     14        if ($i < 1) {
     15                $i++;
     16?>
     17        <title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?></title>
     18        <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
     19        <description><?php bloginfo_rss("description") ?></description>
     20        <pubDate><?php echo gmdate('r'); ?></pubDate>
     21        <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
     22
     23<?php
     24                if (is_single() || is_page()) {
     25                        $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
     26                        comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
     27                        $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
     28                        LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "'
     29                        AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
     30                        AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
     31                        ORDER BY comment_date_gmt ASC" );
     32                } else { // if no post id passed in, we'll just ue the last 10 comments.
     33                        $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
     34                        comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
     35                        $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
     36                        LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
     37                        AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 
     38                        ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') );
     39                }
     40        // this line is WordPress' motor, do not delete it.
     41                if ($comments) {
     42                        foreach ($comments as $comment) {
     43                                $GLOBALS['comment'] =& $comment;
     44                                // Some plugins may need to know the metadata
     45                                // associated with this comment's post:
     46                                get_post_custom($comment->comment_post_ID);
     47?>
     48        <item>
     49                <title><?php if ( ! (is_single() || is_page()) ) {
     50                        $title = get_the_title($comment->comment_post_ID);
     51                        $title = apply_filters('the_title', $title);
     52                        $title = apply_filters('the_title_rss', $title);
     53                        printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
     54                } else {
     55                        printf(__('By: %s'), get_comment_author_rss());
     56                } ?></title>
     57                <link><?php comment_link() ?></link>
     58                <author><?php echo get_comment_author_rss() ?></author>
     59                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
     60                <guid><?php comment_link() ?></guid>
     61                        <?php
     62                        if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
     63                        ?>
     64                <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
     65                <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
     66                        <?php
     67                        } else {
     68                        ?>
     69                <description><?php comment_text_rss() ?></description>
     70                <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
     71                        <?php
     72                        } // close check for password
     73                        do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID);
     74                        ?>
     75        </item>
     76<?php
     77                        }
     78                }
     79        }
     80endwhile; endif;
     81?>
     82</channel>
     83</rss>
  • wp-includes/functions.php

     
    969969        if ( $for_comments ) {
    970970                load_template(ABSPATH . 'wp-commentsrss2.php');
    971971        } else {
    972                 load_template(ABSPATH . 'wp-rss2.php');
     972                load_template(ABSPATH . WPINC . '/feed-rss2.php');
    973973        }
    974974}
    975975
    976976function do_feed_atom() {
    977         load_template(ABSPATH . 'wp-atom.php');
     977        load_template(ABSPATH . WPINC . '/feed-atom.php');
    978978}
    979979
    980980function do_robots() {
  • wp-includes/feed-rss.php

     
     1<?php
     2header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
     3$more = 1;
     4
     5?>
     6<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     7<!-- generator="wordpress/<?php echo $wp_version ?>" -->
     8<rss version="0.92">
     9<channel>
     10        <title><?php bloginfo_rss('name') ?></title>
     11        <link><?php bloginfo_rss('url') ?></link>
     12        <description><?php bloginfo_rss('description') ?></description>
     13        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
     14        <docs>http://backend.userland.com/rss092</docs>
     15        <language><?php echo get_option('rss_language'); ?></language>
     16        <?php do_action('rss_head'); ?>
     17
     18<?php while (have_posts()) : the_post(); ?>
     19        <item>
     20                <title><?php the_title_rss() ?></title>
     21<?php if (get_option('rss_use_excerpt')) { ?>
     22                <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
     23<?php } else { // use content ?>
     24                <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
     25<?php } ?>
     26                <link><?php permalink_single_rss() ?></link>
     27                <?php do_action('rss_item'); ?>
     28        </item>
     29<?php endwhile; ?>
     30</channel>
     31</rss>
  • wp-includes/feed-rdf.php

     
     1<?php
     2header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
     3$more = 1;
     4
     5?>
     6<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     7<!-- generator="wordpress/<?php echo $wp_version ?>" -->
     8<rdf:RDF
     9        xmlns="http://purl.org/rss/1.0/"
     10        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     11        xmlns:dc="http://purl.org/dc/elements/1.1/"
     12        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     13        xmlns:admin="http://webns.net/mvcb/"
     14        xmlns:content="http://purl.org/rss/1.0/modules/content/"
     15        <?php do_action('rdf_ns'); ?>
     16>
     17<channel rdf:about="<?php bloginfo_rss("url") ?>">
     18        <title><?php bloginfo_rss('name') ?></title>
     19        <link><?php bloginfo_rss('url') ?></link>
     20        <description><?php bloginfo_rss('description') ?></description>
     21        <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
     22        <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
     23        <sy:updatePeriod>hourly</sy:updatePeriod>
     24        <sy:updateFrequency>1</sy:updateFrequency>
     25        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
     26        <?php do_action('rdf_header'); ?>
     27        <items>
     28                <rdf:Seq>
     29                <?php while (have_posts()): the_post(); ?>
     30                        <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
     31                <?php endwhile; ?>
     32                </rdf:Seq>
     33        </items>
     34</channel>
     35<?php rewind_posts(); while (have_posts()): the_post(); ?>
     36<item rdf:about="<?php permalink_single_rss() ?>">
     37        <title><?php the_title_rss() ?></title>
     38        <link><?php permalink_single_rss() ?></link>
     39         <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
     40        <dc:creator><?php the_author() ?></dc:creator>
     41        <?php the_category_rss('rdf') ?>
     42<?php if (get_option('rss_use_excerpt')) : ?>
     43        <description><?php the_excerpt_rss() ?></description>
     44<?php else : ?>
     45        <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length'), 2) ?></description>
     46        <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
     47<?php endif; ?>
     48        <?php do_action('rdf_item'); ?>
     49</item>
     50<?php endwhile;  ?>
     51</rdf:RDF>
  • wp-rss2.php

     
    55        wp('feed=rss2');
    66}
    77
    8 header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
    9 $more = 1;
     8require (ABSPATH . WPINC . '/feed-rss2.php');
    109
    11 ?>
    12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    13 
    14 <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
    15 <rss version="2.0"
    16         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    17         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    18         xmlns:dc="http://purl.org/dc/elements/1.1/"
    19         <?php do_action('rss2_ns'); ?>
    20 >
    21 
    22 <channel>
    23         <title><?php bloginfo_rss('name'); ?></title>
    24         <link><?php bloginfo_rss('url') ?></link>
    25         <description><?php bloginfo_rss("description") ?></description>
    26         <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
    27         <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
    28         <language><?php echo get_option('rss_language'); ?></language>
    29         <?php do_action('rss2_head'); ?>
    30         <?php while( have_posts()) : the_post(); ?>
    31         <item>
    32                 <title><?php the_title_rss() ?></title>
    33                 <link><?php permalink_single_rss() ?></link>
    34                 <comments><?php comments_link(); ?></comments>
    35                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    36                 <dc:creator><?php the_author() ?></dc:creator>
    37                 <?php the_category_rss() ?>
    38 
    39                 <guid isPermaLink="false"><?php the_guid(); ?></guid>
    40 <?php if (get_option('rss_use_excerpt')) : ?>
    41                 <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    42 <?php else : ?>
    43                 <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    44         <?php if ( strlen( $post->post_content ) > 0 ) : ?>
    45                 <content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
    46         <?php else : ?>
    47                 <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
    48         <?php endif; ?>
    49 <?php endif; ?>
    50                 <wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
    51 <?php rss_enclosure(); ?>
    52         <?php do_action('rss2_item'); ?>
    53         </item>
    54         <?php endwhile; ?>
    55 </channel>
    56 </rss>
     10?>
     11 No newline at end of file
  • wp-commentsrss2.php

     
    55        wp('feed=rss2&withcomments=1');
    66}
    77
    8 header('Content-type: text/xml;charset=' . get_option('blog_charset'), true);
     8require (ABSPATH . WPINC . '/feed-rss2-comments.php');
    99
    10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    11 ?>
    12 <!-- generator="wordpress/<?php echo $wp_version ?>" -->
    13 <rss version="2.0"
    14         xmlns:content="http://purl.org/rss/1.0/modules/content/">
    15 <channel>
    16 <?php
    17 $i = 0;
    18 if (have_posts()) :
    19   while (have_posts()) : the_post();
    20         if ($i < 1) {
    21                 $i++;
    22 ?>
    23         <title><?php if (is_single() || is_page() ) { printf(__('Comments on: %s'), get_the_title_rss()); } else { printf(__('Comments for %s'), get_bloginfo_rss("name")); } ?></title>
    24         <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
    25         <description><?php bloginfo_rss("description") ?></description>
    26         <pubDate><?php echo gmdate('r'); ?></pubDate>
    27         <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
    28 
    29 <?php
    30                 if (is_single() || is_page()) {
    31                         $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
    32                         comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
    33                         $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
    34                         LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "'
    35                         AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
    36                         AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
    37                         ORDER BY comment_date_gmt ASC" );
    38                 } else { // if no post id passed in, we'll just ue the last 10 comments.
    39                         $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
    40                         comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
    41                         $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
    42                         LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
    43                         AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 
    44                         ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') );
    45                 }
    46         // this line is WordPress' motor, do not delete it.
    47                 if ($comments) {
    48                         foreach ($comments as $comment) {
    49                                 $GLOBALS['comment'] =& $comment;
    50                                 // Some plugins may need to know the metadata
    51                                 // associated with this comment's post:
    52                                 get_post_custom($comment->comment_post_ID);
    53 ?>
    54         <item>
    55                 <title><?php if ( ! (is_single() || is_page()) ) {
    56                         $title = get_the_title($comment->comment_post_ID);
    57                         $title = apply_filters('the_title', $title);
    58                         $title = apply_filters('the_title_rss', $title);
    59                         printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
    60                 } else {
    61                         printf(__('By: %s'), get_comment_author_rss());
    62                 } ?></title>
    63                 <link><?php comment_link() ?></link>
    64                 <author><?php echo get_comment_author_rss() ?></author>
    65                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
    66                 <guid><?php comment_link() ?></guid>
    67                         <?php
    68                         if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
    69                         ?>
    70                 <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
    71                 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
    72                         <?php
    73                         } else {
    74                         ?>
    75                 <description><?php comment_text_rss() ?></description>
    76                 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
    77                         <?php
    78                         } // close check for password
    79                         do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID);
    80                         ?>
    81         </item>
    82 <?php
    83                         }
    84                 }
    85         }
    86 endwhile; endif;
    87 ?>
    88 </channel>
    89 </rss>
     10?>
     11 No newline at end of file
  • wp-atom.php

     
    55        wp('feed=atom');
    66}
    77
    8 header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true);
    9 $more = 1;
     8require (ABSPATH . WPINC . '/feed-atom.php');
    109
    11 ?>
    12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    13 <feed
    14   xmlns="http://www.w3.org/2005/Atom"
    15   xmlns:thr="http://purl.org/syndication/thread/1.0"
    16   xml:lang="<?php echo get_option('rss_language'); ?>"
    17   xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php"
    18   <?php do_action('atom_ns'); ?>
    19  >
    20         <title type="text"><?php bloginfo_rss('name') ?></title>
    21         <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
    22        
    23         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
    24         <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
    25 
    26         <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
    27         <id><?php bloginfo('atom_url'); ?></id>
    28         <link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
    29 
    30         <?php do_action('atom_head'); ?>
    31         <?php while (have_posts()) : the_post(); ?>
    32         <entry>
    33                 <author>
    34                         <name><?php the_author() ?></name>
    35                         <uri><?php the_author_url()?></uri>
    36                 </author>
    37                 <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
    38                 <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
    39                 <id><?php the_guid(); ?></id>
    40                 <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
    41                 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
    42                 <?php the_category_rss('atom') ?>
    43                 <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
    44 <?php if ( !get_option('rss_use_excerpt') ) : ?>
    45                 <content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
    46 <?php endif; ?>
    47 <?php rss_enclosure(); ?>
    48 <?php do_action('atom_entry'); ?>
    49         </entry>
    50         <?php endwhile ; ?>
    51 </feed>
     10?>
     11 No newline at end of file