?php/**//* * @ (#) Rss2Gen.inc.php (Beta) 2005/2/19 * * Exblog RSS2 generates classes that implement most of the RSS2 specification. * * Use the method to see the bottom of this class (Rss2gen class using annotations) information. * * This program is a free program, the source code users can change any (please do not use for commercial purposes), but please keep this copyright information! * * @author hexuzhong <?xml version= "1.0" encoding= "gb2312"
RN "; $this->rss_header. = "<rss version=" 2.0 ">rn"; /**//** * Sets the channel header, where three elements are required. * @param String $title The name of the channel, the title of the channel should be as consistent as possible with the title of the Web site. * @param String $link The URL of the Web site or site zone associated with the channel. * @param String $description A brief description of the channel and briefly describes what the channel does. * * Function Setchannel ($title = "Exblog", $link = "http://www.exblog.org", $description = "Exblog") {$this->channel_h Eader = "<title><! [cdata[". $title."]] ></title>n "; $this->channel_header. = "<link>". $link. " </link>rn "; $this->channel_header. = "<description><! [cdata[". $description."]] ></description>rn "; The function halt ($msg) {if ($this->halt_on_error) {$this->haltmsg ($msg); } die ("Exblog RSS2 exit"); function Haltmsg ($msg) {sprintf ("<b>exblog RSS2 builder ERROR:%s</b><br>rn", $msg);} /**//** * Set the language of the RSS document, default to Simplified Chinese. * @access Public/function setlanguage ($lang = "Zh_cn") {$this->channel_language = "<language>". $lang." </language>rn "; /**//** * The copyright statement of the channel content * @access public/function setcopyright ($copyright = "Exblog") {$this->channel_copyrig HT = "<copyright>". $copyright. " </copyright>rn "; /**//** * Email Address * @access public/function setmanagingeditor ($email = NULL) {if (empty ($email)) for the person responsible for the channel content {$this->halt ("If you set up the email address of the individual responsible for the channel content, please fill in her.") "); $this->channel_managingeditor = "<managingEditor>". $email. " </managingeditor>rn "; /**//** * The email address of the individual responsible for the channel's technical support * @access public */function setwebmaster ($email = NULL) {if (empty ($email)) { $this->halt ("If you set up the channel for the technical support of the personal email address, please fill in her." :)"); $this->channel_webmaster = "<webMaster>". $email. " </webmaster>rn "; /**//** * Publication date for the content of the channel. * @access Public/function setpubdate ($date = NULL) {if (empty ($date)) {$date = date ("y/m/d"); $this->channel_pubdate = "<pubDate>". $date. " </pubdate>rn "; } $this->Channel_pubdate = "<pubDate>". $date. " </pubdate>rn "; /**//** * Last Channel content change time * @access public/function setlastbuilddate ($date = NULL) {if (empty ($date)) {$date = Date ("y/m/d"); $this->channel_lastbuilddate = "<lastBuildDate>". $date. " </lastbuilddate>rn "; $this->channel_lastbuilddate = "<lastBuildDate>". $date. " </lastbuilddate>rn "; /**//** * Describes which or many categories the channel belongs to * @access public/function Setcategory ($category) {$this->channel_category = " ;category> ". $category." </category>rn "; The URL of the format used for the/**//** * RSS file is * @access public/function Setdocs ($url) {$this->channel_docs = "<docs > ". $url." </docs>rn "; The/**//** * TTL represents the survival time, which is a number that represents the number of minutes that the feed was buffered before it was refreshed * @access public/function Setttl ($minute) {$this->channel_t TL = "<ttl>". $minute. " </ttl>rn "; /**//** * Specifies a GIF, JPEG, or PNG image that can be displayed on the channel * @param String $url required, is the URL of a GIF, JPEG, or PNG image that represents the channel* @param String $title required, is the description of the image. Used as an ALT attribute for HTML <image> tags when the channel is rendered in HTML. * @param String $link required, is the URL of the site. If the channel is rendered in HTML, the image is used as a link to this site. * @param Integer $width represents the pixel width of the image and must be set with the $height, otherwise this property will not be displayed. * @param Integer $height indicates the pixel height of the image and must be set with the $width, otherwise this property will not be displayed. * @param String $description The title property of the link element that is formed around the image. * @access Public */function setchannelimage ($url, $title, $link, $width = null, $height = NULL, $description = NULL) {if (!isset ($url)) $this->halt ("If you want to set the picture, the image address attribute must be filled in." "); if (!isset ($title)) $this->halt ("If you want to set the picture, the image description attribute must be filled in." "); if (!isset ($link)) $this->halt ("If you want to set the picture, the image link attribute must be filled in." This URL is generally the same as the Image Address property "); $this->channel_image = "<image>rn"; $this->channel_image. = "<url>". $url. " </url>rn "; $this->channel_image. = "<title><! [cdata[". $title."]] ></title>rn "; $this->channel_image. = "<link>". $link. " </link>rn "; Add this property if the image is set wide and high. if (!empty ($width) &&!eMpty ($height)) {$this->channel_image. = "<width>". $width. " </width>rn "; $this->channel_image. = "