Make WordPress Core

Changeset 535


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.

Location:
trunk
Files:
2 added
3 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>
  • trunk/b2rss.php

    r412 r535  
    1 <?php /* These first lines are the first part of a CaféLog template.
    2          In every template you do, you got to copy them before the CaféLog 'loop' */
    3 $blog = 1; // enter your blog's ID
    4 $doing_rss=1;
    5 header('Content-type: text/xml',true);
    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 if (!isset($rss_language)) { $rss_language = 'en'; }
    42 if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
    43 if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
     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('rss_url') . "\n");
     7exit;
    448?>
    45 <?php echo "<?xml version=\"1.0\"?".">"; ?>
    46 <!-- generator="wordpress/<?php echo $b2_version ?>" -->
    47 <rss version="0.92">
    48     <channel>
    49         <title><?php bloginfo_rss("name") ?></title>
    50         <link><?php bloginfo_rss("url") ?></link>
    51         <description><?php bloginfo_rss("description") ?></description>
    52         <lastBuildDate><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</lastBuildDate>
    53         <docs>http://backend.userland.com/rss092</docs>
    54         <managingEditor><?php echo antispambot($admin_email) ?></managingEditor>
    55         <webMaster><?php echo antispambot($admin_email) ?></webMaster>
    56         <language><?php echo $rss_language ?></language>
    57 
    58 <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
    59         <item>
    60             <title><?php the_title_rss() ?></title>
    61 <?php
    62 // we might use this in the future, but not now, that's why it's commented in PHP
    63 // so that it doesn't appear at all in the RSS
    64 //          echo "<category>"; the_category_unicode(); echo "</category>";
    65 $more = 1;
    66 if ($rss_use_excerpt) {
    67 ?>
    68             <description><?php the_excerpt_rss($rss_excerpt_length, $rss_encoded_html) ?></description>
    69 <?php
    70 } else { // use content
    71 ?>
    72             <description><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></description>
    73 <?php
    74 } // end else use content
    75 ?>
    76             <link><?php permalink_single_rss() ?></link>
    77         </item>
    78 <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
    79     </channel>
    80 </rss>
  • trunk/b2rss2.php

    r412 r535  
    1 <?php /* These first lines are the first part of a WordPress template.
    2            In every template you do, you got to copy them before the CafeLog 'loop' */
    3 $blog=1; // enter your blog's ID
    4 $doing_rss=1;
    5 header('Content-type: text/xml');
    6 
    7 include('blog.header.php');
    8 
    9 // Handle Conditional GET
    10 
    11 // Get the time of the most recent article
    12 $sql = "SELECT max(post_date) FROM $tableposts";
    13 
    14 $maxdate = $wpdb->get_var($sql);
    15 
    16 $unixtime = strtotime($maxdate);
    17 
    18 // format timestamp for Last-Modified header
    19 $clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
    20 $cetag = md5($last);
    21 
    22 $slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
    23 $setag = $_SERVER['HTTP_IF_NONE_MATCH'];
    24 
    25 // send it in a Last-Modified header
    26 header("Last-Modified: " . $clast, true);
    27 header("Etag: " . $cetag, true);
    28 
    29 // compare it to aggregator's If-Modified-Since and If-None-Match headers
    30 // if they match, send a 304 and die
    31 
    32 // This logic says that if only one header is provided, just use that one,
    33 // but if both headers exist, they *both* must match up with the locally
    34 // generated values.
    35 //if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
    36 if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
    37     header("HTTP/1.1 304 Not Modified");
    38     echo "\r\n\r\n";
    39     exit;
    40 }
    41 
    42 if (!isset($rss_language)) { $rss_language = 'en'; }
    43 if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
    44 if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
     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('rss2_url') . "\n");
     7exit;
    458?>
    46 <?php echo "<?xml version=\"1.0\"?".">"; ?>
    47 <!-- generator="wordpress/<?php echo $b2_version ?>" -->
    48 <rss version="2.0"
    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:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    53     xmlns:content="http://purl.org/rss/1.0/modules/content/">
    54 
    55 <channel>
    56     <title><?php bloginfo_rss("name") ?></title>
    57     <link><?php bloginfo_rss("url") ?></link>
    58     <description><?php bloginfo_rss("description") ?></description>
    59     <dc:language><?php echo $rss_language ?></dc:language>
    60     <dc:creator><?php echo antispambot($admin_email) ?></dc:creator>
    61     <dc:rights>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></dc:rights>
    62     <dc:date><?php echo gmdate('Y-m-d\TH:i:s'); ?></dc:date>
    63     <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $b2_version ?>"/>
    64     <admin:errorReportsTo rdf:resource="mailto:<?php echo antispambot($admin_email) ?>"/>
    65     <sy:updatePeriod>hourly</sy:updatePeriod>
    66     <sy:updateFrequency>1</sy:updateFrequency>
    67     <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    68 
    69     <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_b2(); ?>
    70     <item rdf:about="<?php permalink_single_rss() ?>">
    71         <title><?php the_title_rss() ?></title>
    72         <link><?php permalink_single_rss() ?></link>
    73         <dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
    74         <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
    75         <dc:subject><?php the_category_rss() ?></dc:subject>
    76         <guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
    77 <?php $more = 1; if ($rss_use_excerpt) {
    78 ?>
    79         <description><?php the_excerpt_rss($rss_excerpt_length, 2) ?></description>
    80 <?php
    81 } else { // use content
    82 ?>
    83         <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
    84 <?php
    85 } // end else use content
    86 ?>
    87         <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
    88     </item>
    89     <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
    90 </channel>
    91 </rss>
Note: See TracChangeset for help on using the changeset viewer.