Make WordPress Core

source: trunk/wp-rss.php @ 836

Last change on this file since 836 was 836, checked in by rboren, 21 years ago

Clean feed and trackback URLs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1<?php /* These first lines are the first part of a CafeLog template.
2         In every template you do, you got to copy them before the CafeLog 'loop' */
3if (! $feed) {
4    $blog = 1; // enter your blog's ID
5    $doing_rss = 1;
6    require('wp-blog-header.php');
7}
8
9header('Content-type: text/xml', true);
10
11/* This doesn't take into account edits
12// Get the time of the most recent article
13$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
14$unixtime = strtotime($maxdate);
15
16// format timestamp for Last-Modified header
17$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
18$cetag = (isset($clast)) ? md5($clast) : '';
19
20// send it in a Last-Modified header
21header("Last-Modified: " . $clast, true);
22header("Etag: " . $cetag, true);
23*/
24
25if (!isset($rss_language)) { $rss_language = 'en'; }
26if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
27if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
28?>
29<?php echo "<?xml version=\"1.0\"?".">"; ?>
30<!-- generator="wordpress/<?php echo $wp_version ?>" -->
31<rss version="0.92">
32    <channel>
33        <title><?php bloginfo_rss("name") ?></title>
34        <link><?php bloginfo_rss("url") ?></link>
35        <description><?php bloginfo_rss("description") ?></description>
36        <lastBuildDate><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</lastBuildDate>
37        <docs>http://backend.userland.com/rss092</docs>
38        <managingEditor><?php echo antispambot($admin_email) ?></managingEditor>
39        <webMaster><?php echo antispambot($admin_email) ?></webMaster>
40        <language><?php echo $rss_language ?></language>
41
42<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
43        <item>
44            <title><?php the_title_rss() ?></title>
45<?php
46// we might use this in the future, but not now, that's why it's commented in PHP
47// so that it doesn't appear at all in the RSS
48//          echo "<category>"; the_category_unicode(); echo "</category>";
49$more = 1; 
50if ($rss_use_excerpt) {
51?>
52            <description><?php the_excerpt_rss($rss_excerpt_length, $rss_encoded_html) ?></description>
53<?php
54} else { // use content
55?>
56            <description><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></description>
57<?php
58} // end else use content
59?>
60            <link><?php permalink_single_rss() ?></link>
61        </item>
62<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
63    </channel>
64</rss>
Note: See TracBrowser for help on using the repository browser.