Make WordPress Core

source: trunk/wp-rss2.php @ 601

Last change on this file since 601 was 601, checked in by saxmatt, 21 years ago

The great renaming.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1<?php 
2$blog = 1;
3$doing_rss = 1;
4header('Content-type: text/xml', true);
5require('wp-blog-header.php');
6
7// Get the time of the most recent article
8$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
9$unixtime = strtotime($maxdate);
10
11// format timestamp for Last-Modified header
12$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
13$cetag = (isset($clast)) ? md5($clast) : '';
14
15// send it in a Last-Modified header
16header("Last-Modified: " . $clast, true);
17header("Etag: " . $cetag, true);
18
19if (!isset($rss_language)) { $rss_language = 'en'; }
20if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
21if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
22?>
23<?php echo "<?xml version=\"1.0\"?".">"; ?>
24<!-- generator="wordpress/<?php echo $b2_version ?>" -->
25<rss version="2.0"
26        xmlns:content="http://purl.org/rss/1.0/modules/content/">
27
28<channel>
29        <title><?php bloginfo_rss("name") ?></title>
30        <link><?php bloginfo_rss("url") ?></link>
31        <description><?php bloginfo_rss("description") ?></description>
32        <language><?php echo $rss_language ?></language>
33        <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></copyright>
34        <pubDate><?php echo gmdate('r'); ?></pubDate>
35        <generator>http://wordpress.org/?v=<?php echo $b2_version ?>"</generator>
36
37        <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
38        <item>
39                <title><?php the_title_rss() ?></title>
40                <link><?php permalink_single_rss() ?></link>
41                <comments><?php comments_link(); ?></comments>
42                <pubDate><?php the_time('r'); ?></pubDate>
43                <author><?php the_author() ?> (mailto:<?php the_author_email() ?>)</author>
44                <category><?php the_category_rss() ?></category>
45                <guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
46<?php $more = 1; if ($rss_use_excerpt) {
47?>
48                <description><?php the_excerpt_rss($rss_excerpt_length, 2) ?></description>
49<?php
50} else { // use content
51?>
52                <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
53<?php
54} // end else use content
55?>
56                <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
57        </item>
58        <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
59</channel>
60</rss>
Note: See TracBrowser for help on using the repository browser.