@ Paramstring $ titleRSS channel name * @ paramstring $ linkRSS Channel link * @ paramstring $ descriptionRSS channel description * @ paramstring $ imgurlRSS Channel icon
Channel_title = $ title; $ this-> channel_link = $ link; $ this-> channel_description = $ description; $ this-> channel_imgurl = $ imgurl; $ this-> pubDate = Date ('Y-m-d H: I: S', time ()); $ this-> lastBuildDate = Date ('Y-m-d H: I: S', time ());} /** + variable * set private variables + variable * @ access public + variable * @ param string $ key variable name * @ param string $ value variable value + ---------------------------------------------------- */public function config ($ key, $ value) {$ this-> {$ key} = $ value ;} /** + ---------------------------------------------------------- * add RSS items + links * @ access public + -------------------------------------------------------------- * @ param string $ title log title * @ param string $ link log link * @ param string $ description log summary * @ param string $ pubDate log release date + -------------------------------------------------------------- */function AddItem ($ title, $ link, $ description, $ pubDate) {$ this-> items [] = array ('title' => $ title, 'link' => $ link, 'description' => $ description, 'pubdate' => $ pubDate );} /** + response * the XML output of RSS is a string + response * @ access public + response * @ return string + -------------------------------------------------- */public function Fetch () {$ rss. ="
\ R \ n "; $ rss. ="
\ R \ n "; $ rss. ="
\ R \ n "; $ rss. ="
<! [CDATA [{$ this-> channel_title}]>\ R \ n "; $ rss. ="
{$this->channel_description}
\ R \ n "; $ rss. ="
{$ This-> channel_link}\ R \ n "; $ rss. ="
{$ This-> language}
\ R \ n "; if (! Empty ($ this-> pubDate) $ rss. ="
{$ This-> pubDate}
\ R \ n "; if (! Empty ($ this-> lastBuildDate) $ rss. ="
{$ This-> lastBuildDate}
\ R \ n "; if (! Empty ($ this-> generator) $ rss. ="
{$ This-> generator}
\ R \ n "; $ rss. ="
5
\ R \ n "; if (! Empty ($ this-> channel_imgurl) {$ rss. ="
\ R \ n "; $ rss. ="
<! [CDATA [{$ this-> channel_title}]>\ R \ n "; $ rss. ="
{$ This-> channel_link}\ R \ n "; $ rss. ="
{$ This-> channel_imgurl}
\ R \ n "; $ rss. ="\ R \ n ";}for ($ I = 0; $ I <count ($ this-> items); $ I ++) {$ rss. ="
\ R \ n "; $ rss. ="
<! [CDATA [{$ this-> items [$ I] ['title']}]>\ R \ n "; $ rss. ="
{$ This-> items [$ I] ['link']}\ R \ n "; $ rss. ="
{$this->items[$i]['description']}
\ R \ n "; $ rss. ="
{$ This-> items [$ I] ['pubdate']}
\ R \ n "; $ rss. ="
\ R \ n ";}$ rss. ="
\ R \ n
"; Return $ rss;}/** + response * output rss xml to the browser + response * @ access public + ------------------------------------------------------ * @ return void + response */public function Display () {header ("Content-Type: text/xml; charset = utf-8"); echo $ this- > Fetch (); exit ;}}?>