class FEED {
var $UseSSL = true; // If we're using SSL for blog and news links
function open_feed() {
header("Content-type: application/xml; charset=UTF-8");
echo "\n","\n\t\n";
echo ''."\n";
echo ''."\n";
}
function close_feed() {
echo "\t\n";
}
function channel($Title, $Description, $Section = '') {
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
echo "\t\t
$Title :: ". SITE_NAME. "\n";
echo "\t\t$Site/$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 = ($this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.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\t$Site/$Page\n";
$Item .= "\t\t\t$Site/$Page\n";
if ($Comments != '') {
$Item .= "\t\t\t$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
}
}