⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rss.class.php

📁 Phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -