class RSS {
var $itemsarray;
var $details;
public function RSS() {
$this->itemsarray = array();
$this->details = array();
}
public function GetFeed() {
return $this->getDetails() . $this->getItems() . $this->getEnd();
}
public function setDetails($title, $link, $linkself, $description, $language) {
$this->details['title'] = $title;
$this->details['link'] = $link;
$this->details['linkself'] = $link;
$this->details['description'] = $description;
$this->details['language'] = $language;
}
private function getDetails() {
$details = '
'. $this->details['title'] .'
'. $this->details['link'] .'
'. $this->details['description'] .'
'. $this->details['language'] .'';
/*$details .= '
'. $row['image_title'] .'
'. $row['image_url'] .'
'. $row['image_link'] .'
'. $row['image_width'] .'
'. $row['image_height'] .'
';*/
return $details;
}
public function setItem($guid, $title, $link, $description,$date) {
$item = array();
$item['guid'] = $guid;
$item['title'] = $title;
$item['link'] = $link;
$item['description'] = $description;
/*$timestamp = strtotime($date);
$item['pubdate'] = strftime("%a, %e %b %Y %H:%M:%S",$timestamp);*/
$item['pubdate'] = $date;
array_push($this->itemsarray,$item);
}
public function setItemComplex($title, $subitems) {
$item = array();
$item['title'] = $title;
$item['subitems'] = $subitems;
array_push($this->itemsarray,$item);
}
private function getItems() {
foreach ($this->itemsarray as $none=>$item) {
$items .= '-
'. $item["title"] .'';
if (array_key_exists("subitems",$item)==false) {
$items .= ''. $item["link"] .'
'.$item['pubdate'].'
'. $item["guid"] .'';
}
else if (array_key_exists("subitems",$item)) {
$items .= '';
foreach ($item["subitems"] as $none=>$sub) {
$items .= '
'.$sub["date"].'
';
}
$items .= '';
}
$items .= '
';
}
return $items;
}
private function getEnd() {
$items .= '
';
return $items;
}
}
?>
angeldiaz