class FEED {
function open_feed() {
header("Content-type: application/xml; charset=UTF-8");
echo "\n","\n\t\n";
}
function close_feed() {
echo "\t\n";
}
function channel($Title, $Description, $Section='') {
echo "\t\t
", $Title, " :: ", SITE_NAME, "\n";
echo "\t\thttp://", SITE_URL, "/", $Section, "\n";
echo "\t\t", $Description, "\n";
echo "\t\ten-us\n";
echo "\t\t", date('r'), "\n";
echo "\t\thttp://blogs.law.harvard.edu/tech/rss\n";
echo "\t\tGazelle Feed Class\n\n";
}
function item($Title, $Description, $Page, $Creator, $Comments='', $Category='', $Date='') { //Escape with CDATA, otherwise the feed breaks.
if ($Date == '') {
$Date = date("r");
} else {
$Date = date("r",strtotime($Date));
}
$Site = NONSSL_SITE_URL;
$Item = "\t\t- \n";
$Item .= "\t\t\t\n";
$Item .= "\t\t\t\n";
$Item .= "\t\t\t$Date\n";
$Item .= "\t\t\thttp://$Site/$Page\n";
$Item .= "\t\t\thttp://$Site/$Page\n";
if ($Comments != '') {
$Item .= "\t\t\thttp://$Site/$Comments\n";
}
if ($Category != '') {
$Item .= "\t\t\t\n";
}
$Item .= "\t\t\t$Creator\n\t\t
\n";
return $Item;
}
function retrieve($CacheKey,$AuthKey,$PassKey) {
global $Cache;
$Entries = $Cache->get_value($CacheKey);
if(!$Entries){
$Entries = array();
} else {
foreach($Entries as $Item){
echo str_replace(array('[[PASSKEY]]','[[AUTHKEY]]'),array(display_str($PassKey),display_str($AuthKey)),$Item);
}
}
}
function populate($CacheKey,$Item) {
global $Cache;
$Entries = $Cache->get_value($CacheKey,true);
if(!$Entries){
$Entries = array();
} else {
if(count($Entries)>=50) {
array_pop($Entries);
}
}
array_unshift($Entries, $Item);
$Cache->cache_value($CacheKey, $Entries, 0); //inf cache
}
}