Changeset 568
- Timestamp:
- 12/05/03 01:21:09 (5 years ago)
- Files:
-
- trunk/wp-rdf.php (modified) (1 diff)
- trunk/wp-rss.php (modified) (1 diff)
- trunk/wp-rss2.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-rdf.php
r558 r568 1 1 <?php /* RDF 1.0 generator, original version by garym@teledyn.com */ 2 2 $blog = 1; // enter your blog's ID 3 $doing_rss=1; 4 header('Content-type: text/xml'); 5 3 $doing_rss = 1; 4 header('Content-type: text/xml', true); 6 5 include('blog.header.php'); 7 6 8 // Handle Conditional GET9 10 7 // Get the time of the most recent article 11 $sql = "SELECT max(post_date) FROM $tableposts"; 12 13 $maxdate = $wpdb->get_var($sql); 14 ++$querycount; 8 $maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts"); 15 9 $unixtime = strtotime($maxdate); 16 10 17 11 // 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']; 12 $clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime); 13 $cetag = (isset($clast)) ? md5($clast) : ''; 23 14 24 15 // send it in a Last-Modified header 25 16 header("Last-Modified: " . $clast, true); 26 17 header("Etag: " . $cetag, true); 27 28 // compare it to aggregator's If-Modified-Since and If-None-Match headers29 // if they match, send a 304 and die30 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 locally33 // 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 18 41 19 add_filter('the_content', 'trim'); trunk/wp-rss.php
r559 r568 3 3 $blog = 1; // enter your blog's ID 4 4 $doing_rss = 1; 5 header('Content-type: text/xml', true);5 header('Content-type: text/xml', true); 6 6 include('blog.header.php'); 7 8 // Handle Conditional GET9 7 10 8 // Get the time of the most recent article 11 9 $maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts"); 12 ++$querycount;13 10 $unixtime = strtotime($maxdate); 14 11 15 12 // format timestamp for Last-Modified header 16 13 $clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime); 17 $cetag = (isset($last)) ? md5($last) : ''; 18 19 $slast = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : '' ; 20 $setag = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? $_SERVER['HTTP_IF_NONE_MATCH'] : ''; 14 $cetag = (isset($clast)) ? md5($clast) : ''; 21 15 22 16 // send it in a Last-Modified header 23 17 header("Last-Modified: " . $clast, true); 24 18 header("Etag: " . $cetag, true); 25 26 // compare it to aggregator's If-Modified-Since and If-None-Match headers27 // if they match, send a 304 and die28 29 // This logic says that if only one header is provided, just use that one,30 // but if both headers exist, they *both* must match up with the locally31 // generated values.32 //if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){33 if (($slast != '') && ($setag != '')) {34 if (($slast == $clast) && ($setag == $cetag)) {35 header("HTTP/1.1 304 Not Modified");36 echo "\r\n\r\n";37 exit;38 } else if (($slast == $clast)39 || ($setag == $cetag)) {40 header("HTTP/1.1 304 Not Modified");41 echo "\r\n\r\n";42 exit;43 }44 }45 19 46 20 if (!isset($rss_language)) { $rss_language = 'en'; } trunk/wp-rss2.php
r558 r568 1 1 <?php 2 $blog=1; 3 $doing_rss=1; 4 header('Content-type: text/xml'); 5 2 $blog = 1; 3 $doing_rss = 1; 4 header('Content-type: text/xml', true); 6 5 include('blog.header.php'); 7 6 8 // Handle Conditional GET9 10 7 // Get the time of the most recent article 11 $sql = "SELECT max(post_date) FROM $tableposts"; 12 13 $maxdate = $wpdb->get_var($sql); 14 ++$querycount; 15 8 $maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts"); 16 9 $unixtime = strtotime($maxdate); 17 10 18 11 // 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']; 12 $clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime); 13 $cetag = (isset($clast)) ? md5($clast) : ''; 24 14 25 15 // send it in a Last-Modified header 26 16 header("Last-Modified: " . $clast, true); 27 17 header("Etag: " . $cetag, true); 28 29 // compare it to aggregator's If-Modified-Since and If-None-Match headers30 // if they match, send a 304 and die31 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 locally34 // 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 18 42 19 if (!isset($rss_language)) { $rss_language = 'en'; }
