Added support for Conditional GET
git-svn-id: https://develop.svn.wordpress.org/trunk@347 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c4bbff4c72
commit
9a5e444594
24
b2rdf.php
24
b2rdf.php
@ -2,6 +2,30 @@
|
|||||||
$blog = 1; // enter your blog's ID
|
$blog = 1; // enter your blog's ID
|
||||||
$doing_rss=1;
|
$doing_rss=1;
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
|
|
||||||
|
// Handle Conditional GET
|
||||||
|
|
||||||
|
// Get the time of the most recent article
|
||||||
|
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||||
|
|
||||||
|
$maxdate = $wbdp->get_var($sql);
|
||||||
|
|
||||||
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
|
// format timestamp for Last-Modified header
|
||||||
|
$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
||||||
|
|
||||||
|
// send it in a Last-Modified header
|
||||||
|
header("Last-Modified: $last");
|
||||||
|
|
||||||
|
// compare it to aggregator's If_Modified_Since
|
||||||
|
// if they match, send a 304 and die
|
||||||
|
if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
add_filter('the_content', 'trim');
|
add_filter('the_content', 'trim');
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
|
24
b2rss.php
24
b2rss.php
@ -3,6 +3,30 @@
|
|||||||
$blog = 1; // enter your blog's ID
|
$blog = 1; // enter your blog's ID
|
||||||
$doing_rss=1;
|
$doing_rss=1;
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
|
|
||||||
|
// Handle Conditional GET
|
||||||
|
|
||||||
|
// Get the time of the most recent article
|
||||||
|
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||||
|
|
||||||
|
$maxdate = $wbdp->get_var($sql);
|
||||||
|
|
||||||
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
|
// format timestamp for Last-Modified header
|
||||||
|
$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
||||||
|
|
||||||
|
// send it in a Last-Modified header
|
||||||
|
header("Last-Modified: $last");
|
||||||
|
|
||||||
|
// compare it to aggregator's If_Modified_Since
|
||||||
|
// if they match, send a 304 and die
|
||||||
|
if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
||||||
|
23
b2rss2.php
23
b2rss2.php
@ -3,6 +3,29 @@
|
|||||||
$blog=1; // enter your blog's ID
|
$blog=1; // enter your blog's ID
|
||||||
$doing_rss=1;
|
$doing_rss=1;
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
|
|
||||||
|
// Handle Conditional GET
|
||||||
|
|
||||||
|
// Get the time of the most recent article
|
||||||
|
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||||
|
|
||||||
|
$maxdate = $wbdp->get_var($sql);
|
||||||
|
|
||||||
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
|
// format timestamp for Last-Modified header
|
||||||
|
$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
||||||
|
|
||||||
|
// send it in a Last-Modified header
|
||||||
|
header("Last-Modified: $last");
|
||||||
|
|
||||||
|
// compare it to aggregator's If_Modified_Since
|
||||||
|
// if they match, send a 304 and die
|
||||||
|
if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
||||||
|
Loading…
Reference in New Issue
Block a user