📄 xml_domit_rss.php
字号:
} //getDocs /** * Returns the cloud of the channel * @return object A reference to the cloud object for the channel, or null */ function getCloud() { if ($this->hasElement(DOMIT_RSS_ELEMENT_CLOUD)) { return $this->getElement(DOMIT_RSS_ELEMENT_CLOUD); } return null; } //getCloud /** * Returns the ttl of the channel * @return string The ttl of the channel, or an empty string */ function getTTL() { return $this->getElementText(DOMIT_RSS_ELEMENT_TTL); } //getTTL /** * Returns the image of the channel * @return object A reference to an image object for the channel, or null */ function getImage() { if ($this->hasElement(DOMIT_RSS_ELEMENT_IMAGE)) { return $this->getElement(DOMIT_RSS_ELEMENT_IMAGE); } return null; } //getImage /** * Returns the rating of the channel * @return string The rating of the channel, or an empty string */ function getRating() { return $this->getElementText(DOMIT_RSS_ELEMENT_RATING); } //getRating /** * Returns the text input box of the channel * @return object A reference to a text input box object for the channel, or null */ function getTextInput() { if ($this->hasElement(DOMIT_RSS_ELEMENT_TEXTINPUT)) { return $this->getElement(DOMIT_RSS_ELEMENT_TEXTINPUT); } return null; } //getTextInput /** * Returns the skip days of the channel * @return object A reference to the skip days object for the channel, or null */ function getSkipDays() { if ($this->hasElement(DOMIT_RSS_ELEMENT_SKIPDAYS)) { return $this->getElement(DOMIT_RSS_ELEMENT_SKIPDAYS); } return null; } //getSkipDays /** * Returns the skip hours of the channel * @return object A reference to the skip hours object for the channel, or null */ function getSkipHours() { if ($this->hasElement(DOMIT_RSS_ELEMENT_SKIPHOURS)) { return $this->getElement(DOMIT_RSS_ELEMENT_SKIPHOURS); } return null; } //getSkipHours /** * Returns the number of items in the channel * @return int The number of items in the channel */ function getItemCount() { return count($this->domit_rss_items); } //getItemCount /** * Returns a reference to the item at the specified index * @param int The index of the requested item * @return Object A reference to the item at the specified index */ function &getItem($index) { return $this->domit_rss_items[$index]; } //getItem /** * Returns the number of categories in the channel * @return int The number of categories in the channel */ function getCategoryCount() { return count($this->domit_rss_categories); } //getCategoryCount /** * Returns a reference to the category at the specified index * @param int The index of the requested category * @return Object A reference to the category at the specified index */ function &getCategory($index) { return $this->domit_rss_categories[$index]; } //getCategory} //xml_domit_rss_channel/*** Represents an RSS item** @package domit-rss* @subpackage domit-rss-main* @author John Heinstein <johnkarl@nbnet.nb.ca>*/class xml_domit_rss_item extends xml_domit_rss_elementindexer { /** @var array A list of references to category items */ var $domit_rss_categories = array(); /** * Constructor * @param Object A DOM node containing item data */ function xml_domit_rss_item(&$item) { $this->node =& $item; $this->rssDefinedElements = array('title','link','description','author','comments', 'enclosure','guid','pubDate','source','domit_rss_categories'); $this->_init(); } //xml_domit_rss_item /** * Performs initialization of the item element */ function _init(){ $total = $this->node->childCount; $categoryCounter = 0; for($i = 0; $i < $total; $i++) { $currNode =& $this->node->childNodes[$i]; $tagName = strtolower($currNode->nodeName); switch ($tagName) { case DOMIT_RSS_ELEMENT_CATEGORY: $this->categories[$categoryCounter] = new xml_domit_rss_category($currNode); $categoryCounter++; break; case DOMIT_RSS_ELEMENT_ENCLOSURE: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_enclosure($currNode); break; case DOMIT_RSS_ELEMENT_SOURCE: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_source($currNode); break; case DOMIT_RSS_ELEMENT_GUID: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_guid($currNode); break; case DOMIT_RSS_ELEMENT_TITLE: case DOMIT_RSS_ELEMENT_LINK: case DOMIT_RSS_ELEMENT_DESCRIPTION: case DOMIT_RSS_ELEMENT_AUTHOR: case DOMIT_RSS_ELEMENT_COMMENTS: case DOMIT_RSS_ELEMENT_PUBDATE: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); break; default: $this->addIndexedElement($currNode); //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; } } if ($categoryCounter != 0) { $this->DOMIT_RSS_indexer[DOMIT_RSS_ARRAY_CATEGORIES] =& $this->domit_rss_categories; } } //init /** * Returns the title of the item * @return string The title of the item, or an empty string */ function getTitle() { return $this->getElementText(DOMIT_RSS_ELEMENT_TITLE); } //getTitle /** * Returns the url of the item * @return string The url of the item, or an empty string */ function getLink() { return $this->getElementText(DOMIT_RSS_ELEMENT_LINK); } //getLink /** * Returns a description of the item * @return string A description of the item, or an empty string */ function getDescription() { return $this->getElementText(DOMIT_RSS_ELEMENT_DESCRIPTION); } //getDescription /** * Returns the author of the item * @return string The author of the item, or an empty string */ function getAuthor() { return $this->getElementText(DOMIT_RSS_ELEMENT_AUTHOR); } //getAuthor /** * Returns the comments of the item * @return string The comments of the item, or an empty string */ function getComments() { return $this->getElementText(DOMIT_RSS_ELEMENT_COMMENTS); } //getComments /** * Returns the enclosure of the item * @return object A reference to the enclosure object for the item, or null */ function getEnclosure() { if ($this->hasElement(DOMIT_RSS_ELEMENT_ENCLOSURE)) { return $this->getElement(DOMIT_RSS_ELEMENT_ENCLOSURE); } return null; } //getEnclosure /** * Returns the guid of the item * @return object A reference to the guid object for the item, or null */ function getGUID() { if ($this->hasElement(DOMIT_RSS_ELEMENT_GUID)) { return $this->getElement(DOMIT_RSS_ELEMENT_GUID); } return null; } //getGUID /** * Returns the publication date of the item * @return string The publication date of the item, or an empty string */ function getPubDate() { return $this->getElementText(DOMIT_RSS_ELEMENT_PUBDATE); } //getPubDate /** * Returns the source of the item * @return object A reference to the source object for the item, or null */ function getSource() { if ($this->hasElement(DOMIT_RSS_ELEMENT_SOURCE)) { return $this->getElement(DOMIT_RSS_ELEMENT_SOURCE); } return null; } //getSource /** * Returns the number of categories in the item * @return int The number of categories in the item */ function getCategoryCount() { return count($this->domit_rss_categories); } //getCategoryCount /** * Returns a reference to the category at the specified index * @param int The index of the requested category * @return Object A reference to the category at the specified index */ function &getCategory($index) { return $this->domit_rss_categories[$index]; } //getCategory} //xml_domit_rss_item/*** Represents an RSS category** @package domit-rss* @subpackage domit-rss-main* @author John Heinstein <johnkarl@nbnet.nb.ca>*/class xml_domit_rss_category extends xml_domit_rss_elementindexer { /** * Constructor * @param Object A DOM node containing category data */ function xml_domit_rss_category(&$category) { $this->node =& $category; $this->_init(); } //xml_domit_rss_category /** * Returns the category * @return string The category text */ function getCategory() { return $this->node->firstChild->toString(); } //getCategory /** * Returns the category domain * @return string The category domain */ function getDomain() { return $this->getAttribute(DOMIT_RSS_ATTR_DOMAIN); } //getDomain} //xml_domit_rss_category/*** Represents an RSS image** @package domit-rss* @subpackage domit-rss-main* @author John Heinstein <johnkarl@nbnet.nb.ca>*/class xml_domit_rss_image extends xml_domit_rss_elementindexer { /** * Constructor * @param Object A DOM node containing image data */ function xml_domit_rss_image(&$image) { $this->node =& $image; $this->rssDefinedElements = array('title','link','description','url', 'width', 'height'); $this->_init(); } //xml_domit_rss_image /** * Performs initialization of image element */ function _init(){ $total = $this->node->childCount; for($i = 0; $i < $total; $i++) { $currNode =& $this->node->childNodes[$i]; $tagName = strtolower($currNode->nodeName); switch ($tagName) { case DOMIT_RSS_ELEMENT_TITLE: case DOMIT_RSS_ELEMENT_LINK: case DOMIT_RSS_ELEMENT_DESCRIPTION: case DOMIT_RSS_ELEMENT_URL: case DOMIT_RSS_ELEMENT_WIDTH: case DOMIT_RSS_ELEMENT_HEIGHT: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); break; default: $this->addIndexedElement($currNode); //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; } } } //_init /** * Returns the image title * @return string The image title */ function getTitle() { return $this->getElementText(DOMIT_RSS_ELEMENT_TITLE); } //getTitle /** * Returns the image link * @return string The image link */ function getLink() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -