SetChannelInfo($url, $title, $description, $date); } function AddItem($url, $title, $description, $date, $brief = '', $author = '', $category = '') { array_push($this->items, array( 'url' => $url, 'title' => $title, 'description'=>$description, 'date' => $date, 'category' => $category, 'author' => $author, 'brief' => ($brief ? $brief : $description) )); } function getRSS() { $file_array = file( "rss_news.txt" ); return $file_array; } function Get() { $content = "GetXMLVersion()."\" encoding=\"".$this->GetEncoding()."\"?>\r\n"; $content .= "GetRSSVersion()."\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n"; $content .= "\n"; $content .= "<![CDATA[".$this->GetChannelTitle()."]]>\n"; $content .= "".$this->GetChannelURL()."\n"; $content .= "GetChannelDescription()."]]>\n"; $content .= "".$this->GetLang()."\n"; # $content .= "\n"; $content .= "".$this->GetDate()."\n"; $content .= "".$this->GetTTL()."\n"; if ($image = $this->GetImage()) { $content .= "\n"; $content .= "".$image['path']."\n"; $content .= "<![CDATA[".$image['title']."]]>\n"; $content .= "".$image['url']."\n"; $content .= "\n"; } if ($items = $this->GetItems()) { foreach($items as $item) { $content .= "\n"; $content .= "<![CDATA[".$item['title']."]]>\n"; $content .= "".date("r", strtotime($item['date']))."\n"; $content .= "".$item['url']."\n"; $content .= "".$item['url']."\n"; if ($item['category']) $content .= "\n"; if ($item['author']) $content .= "".$item['author']."\n"; $content .= "\n"; $content .= ""; $content .= "\n\n"; $content .= "\n"; $content .= ""; $content .= "\n\n"; $content .= "\n"; } } $content .= "\n"; $content .= ""; $this->content = $content; return $this->content; } function Publish($content = "") { header("Content-Type: application/xml"); if (!$content) { $this->Get(); $content = trim($this->content); } #header("Content-Length: " . strlen($content)); print "$content"; //print "123"; } function SetChannelInfo($url, $title, $description, $date = null) { $this->url = $url; $this->title = $title; $this->description = $description; $this->date = $date ? date("r", strtotime($date)) : date("r"); } function SetImage($path, $title, $url) { $this->image['path'] = $path; $this->image['title']= $title; $this->image['url'] = $url; } function GetXMLVersion() { return $this->xml_ver; } function GetRSSVersion() { return $this->rss_ver; } function GetEncoding() { return $this->encoding; } function GetChannelTitle() { return $this->title; } function GetChannelURL() { return $this->url; } function GetChannelDescription() { return $this->description; } function GetLang() { return $this->lang; } function GetDate() { return $this->date; } function GetTTL() { return $this->ttl; } function GetImage() { return $this->image; } function GetItems() { return $this->items; } } ?>