Make WordPress Core

Changeset 535 for trunk/b2rdf.php


Ignore:
Timestamp:
11/10/2003 11:32:02 PM (23 years ago)
Author:
mikelittle
Message:

b2rss/rdf -> wp-rss/rdf
Plus old files do permanent redirect to the new ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2rdf.php

    r412 r535  
    1 <?php /* RDF 1.0 generator, original version by garym@teledyn.com */
    2 $blog = 1; // enter your blog's ID
    3 $doing_rss=1;
    4 header('Content-type: text/xml');
    5 
    6 include('blog.header.php');
    7 
    8 // Handle Conditional GET
    9 
    10 // Get the time of the most recent article
    11 $sql = "SELECT max(post_date) FROM $tableposts";
    12 
    13 $maxdate = $wpdb->get_var($sql);
    14 
    15 $unixtime = strtotime($maxdate);
    16 
    17 // format timestamp for Last-Modified header
    18 $clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
    19 $cetag = md5($last);
    20 
    21 $slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
    22 $setag = $_SERVER['HTTP_IF_NONE_MATCH'];
    23 
    24 // send it in a Last-Modified header
    25 header("Last-Modified: " . $clast, true);
    26 header("Etag: " . $cetag, true);
    27 
    28 // compare it to aggregator's If-Modified-Since and If-None-Match headers
    29 // if they match, send a 304 and die
    30 
    31 // This logic says that if only one header is provided, just use that one,
    32 // but if both headers exist, they *both* must match up with the locally
    33 // generated values.
    34 //if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
    35 if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
    36         header("HTTP/1.1 304 Not Modified");
    37         echo "\r\n\r\n";
    38         exit;
    39 }
    40 
    41 add_filter('the_content', 'trim');
    42 if (!isset($rss_language)) { $rss_language = 'en'; }
     1<?php
     2$curpath = dirname(__FILE__).'/';
     3require_once ($curpath.'wp-config.php');
     4require_once ($curpath.$b2inc.'/b2template.functions.php');
     5header('HTTP/1.0 301 Moved Permanently');
     6header('Location: ' . get_bloginfo('rdf_url') . "\n");
     7exit;
    438?>
    44 <?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?".">"; ?>
    45 <!-- generator="wordpress/<?php echo $b2_version ?>" -->
    46 <rdf:RDF
    47         xmlns="http://purl.org/rss/1.0/"
    48         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    49         xmlns:dc="http://purl.org/dc/elements/1.1/"
    50         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    51         xmlns:admin="http://webns.net/mvcb/"
    52         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    53 >
    54 <channel rdf:about="<?php bloginfo_rss("url") ?>">
    55         <title><?php bloginfo_rss('name') ?></title>
    56         <link><?php bloginfo_rss('url') ?></link>
    57         <description><?php bloginfo_rss('description') ?></description>
    58         <dc:language><?php echo $rss_language ?></dc:language>
    59         <dc:date><?php echo gmdate('Y-m-d\TH:i:s'); ?></dc:date>
    60         <dc:creator><?php echo antispambot($admin_email) ?></dc:creator>
    61         <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $b2_version ?>"/>
    62         <admin:errorReportsTo rdf:resource="mailto:<?php echo antispambot($admin_email) ?>"/>
    63         <sy:updatePeriod>hourly</sy:updatePeriod>
    64         <sy:updateFrequency>1</sy:updateFrequency>
    65         <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    66         <items>
    67                 <rdf:Seq>
    68                 <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
    69                         <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
    70                 <?php $b2_items[] = $row; $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
    71                 </rdf:Seq>
    72         </items>
    73 </channel>
    74 <?php if ($posts) { foreach ($posts as $post) { start_b2(); ?>
    75 <item rdf:about="<?php permalink_single_rss() ?>">
    76         <title><?php the_title_rss() ?></title>
    77         <link><?php permalink_single_rss() ?></link>
    78         <dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
    79         <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
    80         <dc:subject><?php the_category_rss() ?></dc:subject>
    81 <?php $more = 1; if ($rss_use_excerpt) {
    82 ?>
    83         <description><?php the_excerpt_rss($rss_excerpt_length, 2) ?></description>
    84 <?php
    85 } else { // use content
    86 ?>
    87         <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
    88 <?php
    89 } // end else use content
    90 ?>
    91         <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
    92 </item>
    93 <?php } }  ?>
    94 </rdf:RDF>
Note: See TracChangeset for help on using the changeset viewer.