_title=$title; } public function __get($name) { if ($name=='encoding') return $this->_encoding; if ($name=='title') return $this->_title; if ($name=='language') return $this->_language; if ($name=='description') return $this->_description; if ($name=='generator') return $this->_generator; if ($name=='link') return $this->_link; } public function __set($name,$value) { if ($name=='encoding') $this->_encoding=stripslashes($value); if ($name=='title') $this->_title=stripslashes($value); if ($name=='language') $this->_language=stripslashes($value); if ($name=='description') $this->_description=stripslashes($value); if ($name=='generator') $this->_generator=stripslashes($value); if ($name=='link') $this->_link=stripslashes($value); } /** Make an xml document of the rss stream @param: items: n row of associative array with theses field: 'title': title of the item 'description': short description of the item 'pubData': publication timestamp of the item 'link': url to show the item @result: xml document of rss stream **/ public function get($items, $view_type = false) { $res=""; // header $res.="_encoding."\"?>\n"; $res.="\n"; $res.="\t\n"; if ($view_type==='xspyz') $res.="\t\t".stripslashes(htmlspecialchars($this->_title))."\n"; else $res.="\t\t<![CDATA[".$this->_title."]]>\n"; if ($view_type==='xspyz') $res.="\t\t".stripslashes(htmlspecialchars($this->_description))."\n"; else $res.="\t\t_description."]]>\n"; $res.="\t\t".$this->_link."\n"; $res.="\t\t".$this->_language."\n"; $res.="\t\t".$this->_generator."\n"; //items switch ($view_type) { case 'torrenttab' : foreach($items as $item) { $res.="\t\t\n"; $res.="\t\t\t<![CDATA[".stripslashes($item["title"])."]]>\n"; $res.="\t\t\t\n"; $res.="\t\t\t\n"; $res.="\t\t\n"; } break; case 'xspyz' : foreach($items as $item) { $res.="\t\t\n"; foreach($item as $key=>$value) { $res.="\t\t\t<$key>" . stripslashes($value) . "\n"; } $res.="\t\t\n"; } break; case 'rss' : foreach($items as $item) { $res.="\t\t\n"; $res.="\t\t\t<![CDATA[".stripslashes($item["title"])."]]>\n"; if (!empty($item["pubDate"])) $res.="\t\t\t".date("r", stripslashes($item["pubDate"]))."\n"; $res.="\t\t\t\n"; // $res.="\t\t\t\n"; $res.="\t\t\t\n"; $res.="\t\t\t\n"; $res.="\t\t\n"; } break; default : foreach($items as $item) { $res.="\t\t\n"; $res.="\t\t\t<![CDATA[".stripslashes($item["title"])."]]>\n"; $res.="\t\t\t\n"; $res.="\t\t\t\n"; $res.="\t\t\t{$item["size"]}\n"; $res.="\t\t\t{$item["seeds"]}\n"; $res.="\t\t\t{$item["leechers"]}\n"; $res.="\t\t\t{$item["created"]}\n"; $res.="\t\t\n"; } break; } //footer $res.="\t\n"; $res.="\n"; return $res; } } ?>