| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723 | <?php/*** @package RSSBuilder* @category FLP*//*** Abstract class for getting ini preferences** Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2)* Last change: 2003-06-26** @desc Abstract class for the RSS classes* @access protected* @author Michael Wimmer <flaimo 'at' gmx 'dot' net>* @copyright Michael Wimmer* @link http://www.flaimo.com/* @global array $GLOBALS['_TICKER_ini_settings']* @abstract* @package RSSBuilder* @category FLP* @version 1.002*/class RSSBase {	/*-----------------------*/	/* C O N S T R U C T O R */	/*-----------------------*/	/**	* Constructor	*	* @desc Constructor	* @return void	* @access private	*/	function RSSBase() {	} // end constructor} // end class RSSBase//---------------------------------------------------------------------------/*** Class for creating a RSS file** Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2)* Last change: 2003-06-26** @desc Class for creating a RSS file* @access public* @author Michael Wimmer <flaimo@gmx.net>* @copyright Michael Wimmer* @link http://www.flaimo.com/* @example rss_sample_script.php Sample script* @package RSSBuilder* @category FLP* @version 1.002*/class RSSBuilder extends RSSBase {	/*-------------------*/	/* V A R I A B L E S */	/*-------------------*/	/**#@+	* @access private	* @var string	*/	/**	* encoding of the XML file	*	* @desc encoding of the XML file	*/	var $encoding;	/**	* URL where the RSS document will be made available	*	* @desc URL where the RSS document will be made available	*/	var $about;	/**	* title of the rss stream	*	* @desc title of the rss stream	*/	var $title;	/**	* description of the rss stream	*	* @desc description of the rss stream	*/	var $description;	/**	* publisher of the rss stream (person, an organization, or a service)	*	* @desc publisher of the rss stream	*/	var $publisher;	/**	* creator of the rss stream (person, an organization, or a service)	*	* @desc creator of the rss stream	*/	var $creator;	/**	* creation date of the file (format: 2003-05-29T00:03:07+0200)	*	* @desc creation date of the file (format: 2003-05-29T00:03:07+0200)	*/	var $date;	/**	* iso format language	*	* @desc iso format language	*/	var $language;	/**	* copyrights for the rss stream	*	* @desc copyrights for the rss stream	*/	var $rights;	/**	* URL to an small image	*	* @desc URL to an small image	*/	var $image_link;	/**	* spatial location, temporal period or jurisdiction	*	* spatial location (a place name or geographic coordinates), temporal	* period (a period label, date, or date range) or jurisdiction (such as a	* named administrative entity)	*	* @desc spatial location, temporal period or jurisdiction	*/	var $coverage;	/**	* person, an organization, or a service	*	* @desc person, an organization, or a service	*/	var $contributor;	/**	* 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'	*	* @desc 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'	*/	var $period;	/**	* date (format: 2003-05-29T00:03:07+0200)	*	* Defines a base date to be used in concert with updatePeriod and	* updateFrequency to calculate the publishing schedule.	*	* @desc base date to calculate from (format: 2003-05-29T00:03:07+0200)	*/	var $base;	/**	* category (rss 2.0)	*	* @desc category (rss 2.0)	* @since 1.001 - 2003-05-30	*/	var $category;	/**	* compiled outputstring	*	* @desc compiled outputstring	*/	var $output;	/**#@-*/	/**#@+	* @access private	*/	/**	* every X hours/days/weeks/...	*	* @desc every X hours/days/weeks/...	* @var int	*/	var $frequency;	/**	* caching time in minutes (rss 2.0)	*	* @desc caching time in minutes (rss 2.0)	* @var int	* @since 1.001 - 2003-05-30	*/	var $cache;	/**	* array wich all the rss items	*	* @desc array wich all the rss items	* @var array	*/	var $items = array();	/**	* use DC data	*	* @desc use DC data	* @var boolean	*/	var $use_dc_data = FALSE;	/**	* use SY data	*	* @desc use SY data	* @var boolean	*/	var $use_sy_data = FALSE;	/**#@-*/	/*-----------------------*/	/* C O N S T R U C T O R */	/*-----------------------*/	/**#@+	* @return void	*/	/**	* Constructor	*	* @desc Constructor	* @param string $encoding encoding of the xml file	* @param string $about URL where the RSS document will be made available	* @param string $title	* @param string $description	* @param string $image_link  URL	* @uses setEncoding()	* @uses setAbout()	* @uses setTitle()	* @uses setDescription()	* @uses setImageLink()	* @uses setCategory()	* @uses etCache()	* @access private	*/	function RSSBuilder($encoding = '',						$about = '',						$title = '',						$description = '',						$image_link = '',						$category = '',						$cache = '') {		$this->setEncoding($encoding);		$this->setAbout($about);		$this->setTitle($title);		$this->setDescription($description);		$this->setImageLink($image_link);		$this->setCategory($category);		$this->setCache($cache);	} // end constructor	/*-------------------*/	/* F U N C T I O N S */	/*-------------------*/	/**	* add additional DC data	*	* @desc add additional DC data	* @param string $publisher person, an organization, or a service	* @param string $creator person, an organization, or a service	* @param string $date  format: 2003-05-29T00:03:07+0200	* @param string $language  iso-format	* @param string $rights  copyright information	* @param string $coverage  spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity)	* @param string $contributor  person, an organization, or a service	* @uses setPublisher()	* @uses setCreator()	* @uses setDate()	* @uses setLanguage()	* @uses setRights()	* @uses setCoverage()	* @uses setContributor()	* @access public	*/	function addDCdata($publisher = '',						$creator = '',						$date = '',						$language = '',						$rights = '',						$coverage = '',						$contributor = '') {		$this->setPublisher($publisher);		$this->setCreator($creator);		$this->setDate($date);		$this->setLanguage($language);		$this->setRights($rights);		$this->setCoverage($coverage);		$this->setContributor($contributor);		$this->use_dc_data = (boolean) TRUE;	} // end function	/**	* add additional SY data	*	* @desc add additional DC data	* @param string $period  'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'	* @param int $frequency  every x hours/days/weeks/...	* @param string $base  format: 2003-05-29T00:03:07+0200	* @uses setPeriod()	* @uses setFrequency()	* @uses setBase()	* @access public	*/	function addSYdata($period = '', $frequency = '', $base = '') {		$this->setPeriod($period);		$this->setFrequency($frequency);		$this->setBase($base);		$this->use_sy_data = (boolean) TRUE;	} // end function	/**#@-*/	/**#@+	* @return void	* @access private	*/	/**	* Sets $encoding variable	*	* @desc Sets $encoding variable	* @param string $encoding  encoding of the xml file	* @see $encoding	*/	function setEncoding($encoding = '') {		if (!isset($this->encoding)) {			$this->encoding = (string) ((strlen(trim($encoding)) > 0) ? trim($encoding) : 'UTF-8');		} // end if	} // end function	/**	* Sets $about variable	*	* @desc Sets $about variable	* @param string $about	* @see $about	*/	function setAbout($about = '') {		if (!isset($this->about) && strlen(trim($about)) > 0) {			$this->about = (string) trim($about);		} // end if	} // end function	/**	* Sets $title variable	*	* @desc Sets $title variable	* @param string $title	* @see $title	*/	function setTitle($title = '') {		if (!isset($this->title) && strlen(trim($title)) > 0) {			$this->title = (string) trim($title);		} // end if	} // end function	/**	* Sets $description variable	*	* @desc Sets $description variable	* @param string $description	* @see $description	*/	function setDescription($description = '') {		if (!isset($this->description) && strlen(trim($description)) > 0) {			$this->description = (string) trim($description);		} // end if	} // end function	/**	* Sets $publisher variable	*	* @desc Sets $publisher variable	* @param string $publisher	* @see $publisher	*/	function setPublisher($publisher = '') {		if (!isset($this->publisher) && strlen(trim($publisher)) > 0) {			$this->publisher = (string) trim($publisher);		} // end if	} // end function	/**	* Sets $creator variable	*	* @desc Sets $creator variable	* @param string $creator	* @see $creator	*/	function setCreator($creator = '') {		if (!isset($this->creator) && strlen(trim($creator)) > 0) {			$this->creator = (string) trim($creator);		} // end if	} // end function	/**	* Sets $date variable	*	* @desc Sets $date variable	* @param string $date  format: 2003-05-29T00:03:07+0200	* @see $date	*/	function setDate($date = '') {		if (!isset($this->date) && strlen(trim($date)) > 0) {			$this->date = (string) trim($date);		} // end if	} // end function	/**	* Sets $language variable	*	* @desc Sets $language variable	* @param string $language	* @see $language	* @uses isValidLanguageCode()	*/	function setLanguage($language = '') {		if (!isset($this->language) && $this->isValidLanguageCode($language) === TRUE) {			$this->language = (string) trim($language);		} // end if	} // end function	/**	* Sets $rights variable	*	* @desc Sets $rights variable	* @param string $rights	* @see $rights	*/	function setRights($rights = '') {		if (!isset($this->rights) && strlen(trim($rights)) > 0) {			$this->rights = (string) trim($rights);		} // end if	} // end function	/**	* Sets $coverage variable	*	* @desc Sets $coverage variable	* @param string $coverage	* @see $coverage	*/	function setCoverage($coverage = '') {		if (!isset($this->coverage) && strlen(trim($coverage)) > 0) {			$this->coverage = (string) trim($coverage);		} // end if	} // end function	/**	* Sets $contributor variable	*	* @desc Sets $contributor variable	* @param string $contributor	* @see $contributor	*/	function setContributor($contributor = '') {		if (!isset($this->contributor) && strlen(trim($contributor)) > 0) {			$this->contributor = (string) trim($contributor);		} // end if	} // end function	/**	* Sets $image_link variable	*	* @desc Sets $image_link variable	* @param string $image_link	* @see $image_link	*/	function setImageLink($image_link = '') {		if (!isset($this->image_link) && strlen(trim($image_link)) > 0) {			$this->image_link = (string) trim($image_link);		} // end if	} // end function	/**	* Sets $period variable	*	* @desc Sets $period variable	* @param string $period  'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'	* @see $period	*/	function setPeriod($period = '') {		if (!isset($this->period) && strlen(trim($period)) > 0) {			switch ($period) {				case 'hourly':				case 'daily':				case 'weekly':				case 'monthly':				case 'yearly':					$this->period = (string) trim($period);					break;				default:					$this->period = (string) '';					break;			} // end switch		} // end if	} // end function	/**	* Sets $frequency variable	*	* @desc Sets $frequency variable	* @param int $frequency	* @see $frequency	*/	function setFrequency($frequency = '') {		if (!isset($this->frequency) && strlen(trim($frequency)) > 0) {			$this->frequency = (int) $frequency;		} // end if	} // end function	/**	* Sets $base variable	*	* @desc Sets $base variable	* @param string $base	* @see $base	*/	function setBase($base = '') {		if (!isset($this->base) && strlen(trim($base)) > 0) {			$this->base = (string) trim($base);		} // end if	} // end function	/**	* Sets $category variable	*	* @desc Sets $category variable	* @param string $category	* @see $category	* @since 1.001 - 2003-05-30	*/	function setCategory($category = '') {		if (strlen(trim($category)) > 0) {			$this->category = (string) trim($category);		} // end if	} // end function	/**	* Sets $cache variable	*	* @desc Sets $cache variable	* @param int $cache	* @see $cache	* @since 1.001 - 2003-05-30	*/	function setCache($cache = '') {		if (strlen(trim($cache)) > 0) {			$this->cache = (int) $cache;		} // end if	} // end function	/**#@-*/	/**#@+	* @access public	*/	/**	* Checks if a given string is a valid iso-language-code	*	* @desc Checks if a given string is a valid iso-language-code	* @param string $code  String that should validated	* @return boolean $isvalid  If string is valid or not	* @static	*/	function isValidLanguageCode($code = '') {		return (boolean) ((preg_match('(^([a-zA-Z]{2})$)',$code) > 0) ? TRUE : FALSE);	} // end function	/**	* Returns $encoding variable	*	* @desc Returns $encoding variable	* @return string $encoding	* @see $image_link	*/	function getEncoding() {		return (string) $this->encoding;	} // end function	/**	* Returns $about variable	*	* @desc Returns $about variable	* @return string $about	* @see $about	*/	function getAbout() {		return (string) $this->about;	} // end function	/**	* Returns $title variable	*	* @desc Returns $title variable	* @return string $title	* @see $title	*/	function getTitle() {		return (string) $this->title;	} // end function	/**	* Returns $description variable	*	* @desc Returns $description variable	* @return string $description	* @see $description	*/	function getDescription() {		return (string) $this->description;	} // end function	/**	* Returns $publisher variable	*	* @desc Returns $publisher variable	* @return string $publisher	* @see $publisher	*/	function getPublisher() {		return (string) $this->publisher;	} // end function	/**	* Returns $creator variable	*	* @desc Returns $creator variable	* @return string $creator	* @see $creator	*/	function getCreator() {		return (string) $this->creator;	} // end function	/**	* Returns $date variable	*	* @desc Returns $date variable	* @return string $date	* @see $date	*/	function getDate() {		return (string) $this->date;	} // end function	/**	* Returns $language variable	*	* @desc Returns $language variable	* @return string $language	* @see $language	*/	function getLanguage() {		return (string) $this->language;	} // end function	/**	* Returns $rights variable	*	* @desc Returns $rights variable	* @return string $rights	* @see $rights	*/	function getRights() {		return (string) $this->rights;	} // end function	/**	* Returns $coverage variable	*	* @desc Returns $coverage variable	* @return string $coverage	* @see $coverage	*/	function getCoverage() {		return (string) $this->coverage;	} // end function	/**	* Returns $contributor variable	*	* @desc Returns $contributor variable	* @return string $contributor	* @see $contributor	*/	function getContributor() {		return (string) $this->contributor;	} // end function	/**	* Returns $image_link variable	*	* @desc Returns $image_link variable	* @return string $image_link	* @see $image_link	*/	function getImageLink() {		return (string) $this->image_link;	} // end function	/**	* Returns $period variable	*	* @desc Returns $period variable	* @return string $period	* @see $period	*/	function getPeriod() {		return (string) $this->period;	} // end function	/**	* Returns $frequency variable	*	* @desc Returns $frequency variable	* @return string $frequency	* @see $frequency	*/	function getFrequency() {		return (int) $this->frequency;	} // end function	/**	* Returns $base variable	*	* @desc Returns $base variable	* @return string $base	* @see $base	*/	function getBase() {		return (string) $this->base;	} // end function	/**	* Returns $category variable	*	* @desc Returns $category variable	* @return string $category	* @see $category	* @since 1.001 - 2003-05-30	*/	function getCategory() {		return (string) $this->category;	} // end function	/**	* Returns $cache variable	*	* @desc Returns $cache variable	* @return int $cache	* @see $cache	* @since 1.001 - 2003-05-30	*/	function getCache() {		return (int) $this->cache;	} // end function	/**	* Adds another rss item to the object	*	* @desc Adds another rss item to the object	* @param string $about  URL	* @param string $title	* @param string $link  URL	* @param string $description (optional)	* @param string $subject  some sort of category (optional dc value - only shows up if DC data has been set before)	* @param string $date  format: 2003-05-29T00:03:07+0200 (optional dc value - only shows up if DC data has been set before)	* @param string $author  some sort of category author of item	* @param string $comments  url to comment page rss 2.0 value	* @param string $image  optional mod_im value for dispaying a different pic for every item	* @return void	* @see $items	* @uses RSSItem	*/	function addItem($about = '',					$title = '',					$link = '',					$description = '',					$subject = '',					$date = '',					$author = '',					$comments = '',					$image = '') {		$item = new RSSItem($about,							$title,							$link,							$description,							$subject,							$date,							$author,							$comments,							$image);		$this->items[] = $item;	} // end function	/**	* Deletes a rss item from the array	*	* @desc Deletes a rss item from the array	* @param int $id  id of the element in the $items array	* @return boolean true if item was deleted	* @see $items	*/	function deleteItem($id = -1) {		if (array_key_exists($id, $this->items)) {			unset($this->items[$id]);			return (boolean) TRUE;		} else {			return (boolean) FALSE;		} // end if	} // end function	/**	* Returns an array with all the keys of the $items array	*	* @desc Returns an array with all the keys of the $items array	* @return array array with all the keys of the $items array	* @see $items	*/	function getItemList() {		return (array) array_keys($this->items);	} // end function	/**	* Returns the $items array	*	* @desc Returns the $items array	* @return array $items	*/	function getItems() {		return (array) $this->items;	} // end function	/**	* Returns a single rss item by ID	*	* @desc Returns a single rss item by ID	* @param int $id  id of the element in the $items array	* @return mixed RSSItem or FALSE	* @see RSSItem	*/	function getItem($id = -1) {		if (array_key_exists($id, $this->items)) {			return (object) $this->items[$id];		} else {			return (boolean) FALSE;		} // end if	} // end function	/**#@-*/	/**#@+	* @return void	* @access private	*/	/**	* creates the output based on the 0.91 rss version	*	* @desc creates the output based on the 0.91 rss version	* @see $output	*/	function createOutputV090() {		// not implemented		$this->createOutputV100();	} // end function	/**	* creates the output based on the 0.91 rss version	*	* @desc creates the output based on the 0.91 rss version	* @see $output	* @since 1.001 - 2003-05-30	*/	function createOutputV091() {		$this->output  = (string) '<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\n";		$this->output .= (string) '<rss version="0.91">' . "\n";		$this->output .= (string) '<channel>' . "\n";		if (strlen($this->rights) > 0) {			$this->output .= (string) '<copyright>' . $this->rights . '</copyright>' . "\n";		} // end if		if (strlen($this->date) > 0) {			$this->output .= (string) '<pubDate>' .$this->date . '</pubDate>' . "\n";			$this->output .= (string) '<lastBuildDate>' .$this->date . '</lastBuildDate>' . "\n";		} // end if		if (strlen($this->about) > 0) {			$this->output .= (string) '<docs>' . $this->about . '</docs>' . "\n";		} // end if		if (strlen($this->description) > 0) {			$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";		} // end if		if (strlen($this->about) > 0) {			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";		} // end if		if (strlen($this->title) > 0) {			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";		} // end if		if (strlen($this->image_link) > 0) {			$this->output .= (string) '<image>' . "\n";			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";			$this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n";			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";			if (strlen($this->description) > 0) {				$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";			} // end if			$this->output .= (string) '</image>' . "\n";		} // end if		if (strlen($this->publisher) > 0) {			$this->output .= (string) '<managingEditor>' . $this->publisher . '</managingEditor>' . "\n";		} // end if		if (strlen($this->creator) > 0) {			$this->output .= (string) '<webMaster>' . $this->creator . '</webMaster>' . "\n";		} // end if		if (strlen($this->language) > 0) {			$this->output .= (string) '<language>' . $this->language . '</language>' . "\n";		} // end if		if (count($this->getItemList()) > 0) {			foreach ($this->getItemList() as $id) {				$item =& $this->items[$id];				if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) {					$this->output .= (string) '<item>' . "\n";					$this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n";					$this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n";					if (strlen($item->getDescription()) > 0) {						$this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n";					} // end if					$this->output .= (string) '</item>' . "\n";				} // end if			} // end foreach		} // end if		$this->output .= (string) '</channel>' . "\n";		$this->output .= (string) '</rss>' . "\n";	} // end function	/**	* creates the output based on the 1.0 rss version	*	* @desc creates the output based on the 1.0 rss version	* @see $output	*/	function createOutputV100() {		$this->output  = (string) '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:im="http://purl.org/rss/1.0/item-images/" ';		if ($this->use_dc_data === TRUE) {			$this->output .= (string) 'xmlns:dc="http://purl.org/dc/elements/1.1/" ';		} // end if		if ($this->use_sy_data === TRUE) {			$this->output .= (string) 'xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" ';		} // end if		$this->output .= (string) 'xmlns="http://purl.org/rss/1.0/">' . "\n";		if (strlen($this->about) > 0) {			$this->output .= (string) '<channel rdf:about="' . $this->about . '">' . "\n";		} else {			$this->output .= (string) '<channel>' . "\n";		} // end if		if (strlen($this->title) > 0) {			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";		} // end if		if (strlen($this->about) > 0) {			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";		} // end if		if (strlen($this->description) > 0) {			$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";		} // end if		// additional dc data		if (strlen($this->publisher) > 0) {			$this->output .= (string) '<dc:publisher>' . $this->publisher . '</dc:publisher>' . "\n";		} // end if		if (strlen($this->creator) > 0) {			$this->output .= (string) '<dc:creator>' . $this->creator . '</dc:creator>' . "\n";		} // end if		if (strlen($this->date) > 0) {			$this->output .= (string) '<dc:date>' .$this->date . '</dc:date>' . "\n";		} // end if		if (strlen($this->language) > 0) {			$this->output .= (string) '<dc:language>' . $this->language . '</dc:language>' . "\n";		} // end if		if (strlen($this->rights) > 0) {			$this->output .= (string) '<dc:rights>' . $this->rights . '</dc:rights>' . "\n";		} // end if		if (strlen($this->coverage) > 0) {			$this->output .= (string) '<dc:coverage>' . $this->coverage . '</dc:coverage>' . "\n";		} // end if		if (strlen($this->contributor) > 0) {			$this->output .= (string) '<dc:contributor>' . $this->contributor . '</dc:contributor>' . "\n";		} // end if		// additional SY data		if (strlen($this->period) > 0) {			$this->output .= (string) '<sy:updatePeriod>' . $this->period . '</sy:updatePeriod>' . "\n";		} // end if		if (strlen($this->frequency) > 0) {			$this->output .= (string) '<sy:updateFrequency>' . $this->frequency . '</sy:updateFrequency>' . "\n";		} // end if		if (strlen($this->base) > 0) {			$this->output .= (string) '<sy:updateBase>' . $this->base . '</sy:updateBase>' . "\n";		} // end if		if (strlen($this->image_link) > 0) {			$this->output .= (string) '<image rdf:about="' . $this->image_link . '">' . "\n";			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";			$this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n";			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";			if (strlen($this->description) > 0) {				$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";			} // end if			$this->output .= (string) '</image>' . "\n";		} // end if		if (count($this->getItemList()) > 0) {			$this->output .= (string) '<items><rdf:Seq>' . "\n";			foreach ($this->getItemList() as $id) {				$item =& $this->items[$id];				if (strlen($item->getAbout()) > 0) {					$this->output .= (string) ' <rdf:li resource="' . $item->getAbout() . '" />' . "\n";				} // end if			} // end foreach			$this->output .= (string) '</rdf:Seq></items>' . "\n";		} // end if		$this->output .= (string) '</channel>' . "\n";		if (count($this->getItemList()) > 0) {			foreach ($this->getItemList() as $id) {				$item =& $this->items[$id];				if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) {					if (strlen($item->getAbout()) > 0) {						$this->output .= (string) '<item rdf:about="' . $item->getAbout() . '">' . "\n";					} else {						$this->output .= (string) '<item>' . "\n";					} // end if					$this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n";					$this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n";					if (strlen($item->getDescription()) > 0) {						$this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n";					} // end if					if ($this->use_dc_data === TRUE && strlen($item->getSubject()) > 0) {						$this->output .= (string) '<dc:subject>' . $item->getSubject() . '</dc:subject>' . "\n";					} // end if					if ($this->use_dc_data === TRUE && strlen($item->getDate()) > 0) {						$this->output .= (string) '<dc:date>' . $item->getDate() . '</dc:date>' . "\n";					} // end if					if (strlen($item->getImage()) > 0) {						$this->output .= (string) '<im:image>' . $item->getImage() . '</im:image>' . "\n";					} // end if					$this->output .= (string) '</item>' . "\n";				} // end if			} // end foreach		} // end if		$this->output .= (string) '</rdf:RDF>';	} // end function	/**	* creates the output based on the 2.0 rss draft	*	* @desc creates the output based on the 0.91 rss draft	* @see $output	* @since 1.001 - 2003-05-30	*/	function createOutputV200() {		$this->output  = (string) '<rss version="2.0" xmlns:im="http://purl.org/rss/1.0/item-images/" ';		if ($this->use_dc_data === TRUE) {			$this->output .= (string) 'xmlns:dc="http://purl.org/dc/elements/1.1/" ';		} // end if		if ($this->use_sy_data === TRUE) {			$this->output .= (string) 'xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" ';		} // end if		$this->output .= (string) '>' . "\n";		$this->output .= (string) '<channel>' . "\n";		if (strlen($this->rights) > 0) {			$this->output .= (string) '<copyright>' . $this->rights . '</copyright>' . "\n";		} // end if		if (strlen($this->date) > 0) {			$this->output .= (string) '<pubDate>' .$this->date . '</pubDate>' . "\n";			$this->output .= (string) '<lastBuildDate>' .$this->date . '</lastBuildDate>' . "\n";		} // end if		if (strlen($this->about) > 0) {			$this->output .= (string) '<docs>' . $this->about . '</docs>' . "\n";		} // end if		if (strlen($this->description) > 0) {			$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";		} // end if		if (strlen($this->about) > 0) {			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";		} // end if		if (strlen($this->title) > 0) {			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";		} // end if		if (strlen($this->image_link) > 0) {			$this->output .= (string) '<image>' . "\n";			$this->output .= (string) '<title>' . $this->title . '</title>' . "\n";			$this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n";			$this->output .= (string) '<link>' . $this->about . '</link>' . "\n";			if (strlen($this->description) > 0) {				$this->output .= (string) '<description>' . $this->description . '</description>' . "\n";			} // end if			$this->output .= (string) '</image>' . "\n";		} // end if		if (strlen($this->publisher) > 0) {			$this->output .= (string) '<managingEditor>' . $this->publisher . '</managingEditor>' . "\n";		} // end if		if (strlen($this->creator) > 0) {			$this->output .= (string) '<webMaster>' . $this->creator . '</webMaster>' . "\n";			$this->output .= (string) '<generator>' . $this->creator . '</generator>' . "\n";		} // end if		if (strlen($this->language) > 0) {			$this->output .= (string) '<language>' . $this->language . '</language>' . "\n";		} // end if		if (strlen($this->category) > 0) {			$this->output .= (string) '<category>' . $this->category . '</category>' . "\n";		} // end if		if (strlen($this->cache) > 0) {			$this->output .= (string) '<ttl>' . $this->cache . '</ttl>' . "\n";		} // end if		// additional dc data		if (strlen($this->publisher) > 0) {			$this->output .= (string) '<dc:publisher>' . $this->publisher . '</dc:publisher>' . "\n";		} // end if		if (strlen($this->creator) > 0) {			$this->output .= (string) '<dc:creator>' . $this->creator . '</dc:creator>' . "\n";		} // end if		if (strlen($this->date) > 0) {			$this->output .= (string) '<dc:date>' .$this->date . '</dc:date>' . "\n";		} // end if		if (strlen($this->language) > 0) {			$this->output .= (string) '<dc:language>' . $this->language . '</dc:language>' . "\n";		} // end if		if (strlen($this->rights) > 0) {			$this->output .= (string) '<dc:rights>' . $this->rights . '</dc:rights>' . "\n";		} // end if		if (strlen($this->coverage) > 0) {			$this->output .= (string) '<dc:coverage>' . $this->coverage . '</dc:coverage>' . "\n";		} // end if		if (strlen($this->contributor) > 0) {			$this->output .= (string) '<dc:contributor>' . $this->contributor . '</dc:contributor>' . "\n";		} // end if		// additional SY data		if (strlen($this->period) > 0) {			$this->output .= (string) '<sy:updatePeriod>' . $this->period . '</sy:updatePeriod>' . "\n";		} // end if		if (strlen($this->frequency) > 0) {			$this->output .= (string) '<sy:updateFrequency>' . $this->frequency . '</sy:updateFrequency>' . "\n";		} // end if		if (strlen($this->base) > 0) {			$this->output .= (string) '<sy:updateBase>' . $this->base . '</sy:updateBase>' . "\n";		} // end if		if (count($this->getItemList()) > 0) {			foreach ($this->getItemList() as $id) {				$item =& $this->items[$id];				if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) {					$this->output .= (string) '<item>' . "\n";					$this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n";					$this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n";					if (strlen($item->getDescription()) > 0) {						$this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n";					} // end if					if ($this->use_dc_data === TRUE && strlen($item->getSubject()) > 0) {						$this->output .= (string) '<category>' . $item->getSubject() . '</category>' . "\n";					} // end if					if ($this->use_dc_data === TRUE && strlen($item->getDate()) > 0) {						$this->output .= (string) '<pubDate>' . $item->getDate() . '</pubDate>' . "\n";					} // end if					if (strlen($item->getAbout()) > 0) {						$this->output .= (string) '<guid>' . $item->getAbout() . '</guid>' . "\n";					} // end if					if (strlen($item->getAuthor()) > 0) {						$this->output .= (string) '<author>' . $item->getAuthor() . '</author>' . "\n";					} // end if					if (strlen($item->getComments()) > 0) {						$this->output .= (string) '<comments>' . $item->getComments() . '</comments>' . "\n";					} // end if					if (strlen($item->getImage()) > 0) {						$this->output .= (string) '<im:image>' . $item->getImage() . '</im:image>' . "\n";					} // end if					$this->output .= (string) '</item>' . "\n";				} // end if			} // end foreach		} // end if		$this->output .= (string) '</channel>' . "\n";		$this->output .= (string) '</rss>' . "\n";	} // end function	/**	* creates the output	*	* @desc creates the output	* @uses createOutputV090()	* @uses createOutputV091()	* @uses createOutputV200()	* @uses createOutputV100()	*/	function createOutput($version = '') {		if (strlen(trim($version)) === 0) {			$version = (string) '1.0';		} // end if		switch ($version) {			case '0.9':				$this->createOutputV090();				break;			case '0.91':				$this->createOutputV091();				break;			case '2.00':				$this->createOutputV200();				break;			case '1.0':			default:				$this->createOutputV100();				break;		} // end switch	} // end function	/**#@-*/	/**#@+	* @return void	* @access public	* @uses createOutput()	*/	/**	* echos the output	*	* use this function if you want to directly output the rss stream	*	* @desc echos the output	*/	function outputRSS($version = '') {		if (!isset($this->output)) {			$this->createOutput($version);		} // end if		header ('content-type: text/xml');		header('Content-Disposition: inline; filename=rss_' . str_replace(' ','',$this->title) . '.xml');		$this->output = '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" .						'<!--  RSS generated by phpcms.cn RSS Builder [' .  date('Y-m-d H:i:s')  .']  --> '. "\n"  . $this->output;		echo $this->output;	} // end function	/**	* returns the output	*	* use this function if you want to have the output stream as a string (for example to write it in a cache file)	*	* @desc returns the output	*/	function getRSSOutput($version = '') {		if (!isset($this->output)) {			$this->createOutput($version);		} // end if		return (string) '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" .						'<!--  RSS generated by phpcms.cn RSS Builder [' .  date('Y-m-d H:i:s')  .']  --> ' . $this->output;	} // end function	/**#@-*/} // end class RSSBuilder//---------------------------------------------------------------------------/*** single rss item object** Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2)* Last change: 2003-06-26** @desc single rss item object* @access private* @author Michael Wimmer <flaimo@gmx.net>* @copyright Michael Wimmer* @link http://www.flaimo.com/* @package RSSBuilder* @category FLP* @version 1.002*/class RSSItem extends RSSBase {	/*-------------------*/	/* V A R I A B L E S */	/*-------------------*/	/**#@+	* @access private	* @var string	*/	/**	* URL	*	* @desc URL	*/	var $about;	/**	* headline	*	* @desc headline	*/	var $title;	/**	* URL to the full item	*	* @desc URL to the full item	*/	var $link;	/**	* optional description	*	* @desc optional description	*/	var $description;	/**	* optional subject (category)	*	* @desc optional subject (category)	*/	var $subject;	/**	* optional date	*	* @desc optional date	*/	var $date;	/**	* author of item	*	* @desc author of item	* @since 1.001 - 2003-05-30	*/	var $author;	/**	* url to comments page (rss 2.0)	*	* @desc url to comments page (rss 2.0)	* @since 1.001 - 2003-05-30	*/	var $comments;	/**	* imagelink for this item (mod_im only)	*	* @desc imagelink for this item (mod_im only)	* @since 1.002 - 2003-06-26	*/	var $image;	/**#@-*/	/*-----------------------*/	/* C O N S T R U C T O R */	/*-----------------------*/	/**#@+	* @access private	* @return void	*/	/**	* Constructor	*	* @desc Constructor	* @param string $about  URL	* @param string $title	* @param string $link  URL	* @param string $description (optional)	* @param string $subject  some sort of category (optional)	* @param string $date  format: 2003-05-29T00:03:07+0200 (optional)	* @param string $author  some sort of category author of item	* @param string $comments  url to comment page rss 2.0 value	* @param string $image  optional mod_im value for dispaying a different pic for every item	* @uses setAbout()	* @uses setTitle()	* @uses setLink()	* @uses setDescription()	* @uses setSubject()	* @uses setDate()	* @uses setAuthor()	* @uses setComments()	* @uses setImage()	*/	function RSSItem($about = '',					$title = '',					$link = '',					$description = '',					$subject = '',					$date = '',					$author = '',					$comments = '',					$image = '') {		$this->setAbout($about);		$this->setTitle($title);		$this->setLink($link);		$this->setDescription($description);		$this->setSubject($subject);		$this->setDate($date);		$this->setAuthor($author);		$this->setComments($comments);		$this->setImage($image);	} // end constructor	/**	* Sets $about variable	*	* @desc Sets $about variable	* @param string $about	* @see $about	*/	function setAbout($about = '') {		if (!isset($this->about) && strlen(trim($about)) > 0) {			$this->about = (string) trim($about);		} // end if	} // end function	/**	* Sets $title variable	*	* @desc Sets $title variable	* @param string $title	* @see $title	*/	function setTitle($title = '') {		if (!isset($this->title) && strlen(trim($title)) > 0) {			$this->title = (string) trim($title);		} // end if	} // end function	/**	* Sets $link variable	*	* @desc Sets $link variable	* @param string $link	* @see $link	*/	function setLink($link = '') {		if (!isset($this->link) && strlen(trim($link)) > 0) {			$this->link = (string) trim($link);		} // end if	} // end function	/**	* Sets $description variable	*	* @desc Sets $description variable	* @param string $description	* @see $description	*/	function setDescription($description = '') {		if (!isset($this->description) && strlen(trim($description)) > 0) {			$this->description = (string) trim($description);		} // end if	} // end function	/**	* Sets $subject variable	*	* @desc Sets $subject variable	* @param string $subject	* @see $subject	*/	function setSubject($subject = '') {		if (!isset($this->subject) && strlen(trim($subject)) > 0) {			$this->subject = (string) trim($subject);		} // end if	} // end function	/**	* Sets $date variable	*	* @desc Sets $date variable	* @param string $date	* @see $date	*/	function setDate($date = '') {		if (!isset($this->date) && strlen(trim($date)) > 0) {			$this->date = (string) trim($date);		} // end if	} // end function	/**	* Sets $author variable	*	* @desc Sets $author variable	* @param string $author	* @see $author	* @since 1.001 - 2003-05-30	*/	function setAuthor($author = '') {		if (!isset($this->author) && strlen(trim($author)) > 0) {			$this->author = (string) trim($author);		} // end if	} // end function	/**	* Sets $comments variable	*	* @desc Sets $comments variable	* @param string $comments	* @see $comments	* @since 1.001 - 2003-05-30	*/	function setComments($comments = '') {		if (!isset($this->comments) && strlen(trim($comments)) > 0) {			$this->comments = (string) trim($comments);		} // end if	} // end function	/**	* Sets $image variable	*	* @desc Sets $image variable	* @param string $image	* @see $image	* @since 1.002 - 2003-06-26	*/	function setImage($image = '') {		if (!isset($this->image) && strlen(trim($image)) > 0) {			$this->image = (string) trim($image);		} // end if	} // end function	/**#@-*/	/**#@+	* @access public	*/	/**	* Returns $about variable	*	* @desc Returns $about variable	* @return string $about	* @see $about	*/	function getAbout() {		return (string) $this->about;	} // end function	/**	* Returns $title variable	*	* @desc Returns $title variable	* @return string $title	* @see $title	*/	function getTitle() {		return (string) $this->title;	} // end function	/**	* Returns $link variable	*	* @desc Returns $link variable	* @return string $link	* @see $link	*/	function getLink() {		return (string) $this->link;	} // end function	/**	* Returns $description variable	*	* @desc Returns $description variable	* @return string $description	* @see $description	*/	function getDescription() {		return (string) $this->description;	} // end function	/**	* Returns $subject variable	*	* @desc Returns $subject variable	* @return string $subject	* @see $subject	*/	function getSubject() {		return (string) $this->subject;	} // end function	/**	* Returns $date variable	*	* @desc Returns $date variable	* @return string $date	* @see $date	*/	function getDate() {		return (string) $this->date;	} // end function	/**	* Returns $author variable	*	* @desc Returns $author variable	* @return string $author	* @see $author	* @since 1.001 - 2003-05-30	*/	function getAuthor() {		return (string) $this->author;	} // end function	/**	* Returns $comments variable	*	* @desc Returns $comments variable	* @return string $comments	* @see $comments	* @since 1.001 - 2003-05-30	*/	function getComments() {		return (string) $this->comments;	} // end function	/**	* Returns $image variable	*	* @desc Returns $image variable	* @return string $image	* @see $image	* @since 1.002 - 2003-06-26	*/	function getImage() {		return (string) $this->image;	} // end function	/**#@-*/} // end class RSSItem?>
 |