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

📄 rss.php

📁 Piwik#Opensourcewebanalytics一款可以和GOOGLE媲美的开源统计系统,运用AJAX.功能强大.无色提示:按照需要PHP5.1以上和MySQL数据库支持。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category   Zend * @package    Zend_Feed * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License * @version    $Id: Rss.php 8064 2008-02-16 10:58:39Z thomas $ *//** * @see Zend_Feed_Abstract */require_once 'Zend/Feed/Abstract.php';/** * @see Zend_Feed_Entry_Rss */require_once 'Zend/Feed/Entry/Rss.php';/** * RSS channel class * * The Zend_Feed_Rss class is a concrete subclass of * Zend_Feed_Abstract meant for representing RSS channels. It does not * add any methods to its parent, just provides a classname to check * against with the instanceof operator, and expects to be handling * RSS-formatted data instead of Atom. * * @category   Zend * @package    Zend_Feed * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License */class Zend_Feed_Rss extends Zend_Feed_Abstract{    /**     * The classname for individual channel elements.     *     * @var string     */    protected $_entryClassName = 'Zend_Feed_Entry_Rss';    /**     * The element name for individual channel elements (RSS <item>s).     *     * @var string     */    protected $_entryElementName = 'item';    /**     * The default namespace for RSS channels.     *     * @var string     */    protected $_defaultNamespace = 'rss';    /**     * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases.     *     * @return void     * @throws Zend_Feed_Exception     */    public function __wakeup()    {        parent::__wakeup();        // Find the base channel element and create an alias to it.        $this->_element = $this->_element->getElementsByTagName('channel')->item(0);        if (!$this->_element) {            /**              * @see Zend_Feed_Exception             */            require_once 'Zend/Feed/Exception.php';            throw new Zend_Feed_Exception('No root <channel> element found, cannot parse channel.');        }        // Find the entries and save a pointer to them for speed and        // simplicity.        $this->_buildEntryCache();    }    /**     * Make accessing some individual elements of the channel easier.     *     * Special accessors 'item' and 'items' are provided so that if     * you wish to iterate over an RSS channel's items, you can do so     * using foreach ($channel->items as $item) or foreach     * ($channel->item as $item).     *     * @param  string $var The property to access.     * @return mixed     */    public function __get($var)    {        switch ($var) {            case 'item':                // fall through to the next case            case 'items':                return $this;            default:                return parent::__get($var);        }    }    /**     * Generate the header of the feed when working in write mode     *     * @param  array $array the data to use     * @return DOMElement root node     */    protected function _mapFeedHeaders($array)    {        $channel = $this->_element->createElement('channel');        $title = $this->_element->createElement('title');        $title->appendChild($this->_element->createCDATASection($array->title));        $channel->appendChild($title);        $link = $this->_element->createElement('link', $array->link);        $channel->appendChild($link);        $desc = isset($array->description) ? $array->description : '';        $description = $this->_element->createElement('description');        $description->appendChild($this->_element->createCDATASection($desc));        $channel->appendChild($description);        $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time();        $pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate));        $channel->appendChild($pubdate);        if (isset($array->published)) {            $lastBuildDate = $this->_element->createElement('lastBuildDate', gmdate('r', $array->published));        }        $editor = '';        if (!empty($array->email)) {            $editor .= $array->email;        }        if (!empty($array->author)) {            $editor .= ' (' . $array->author . ')';        }        if (!empty($editor)) {            $author = $this->_element->createElement('managingEditor', ltrim($editor));            $channel->appendChild($author);        }        if (isset($array->webmaster)) {            $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster));        }        if (!empty($array->copyright)) {            $copyright = $this->_element->createElement('copyright', $array->copyright);            $channel->appendChild($copyright);        }        if (!empty($array->image)) {            $image = $this->_element->createElement('image');            $url = $this->_element->createElement('url', $array->image);            $image->appendChild($url);            $imagetitle = $this->_element->createElement('title', $array->title);            $image->appendChild($imagetitle);            $imagelink = $this->_element->createElement('link', $array->link);            $image->appendChild($imagelink);            $channel->appendChild($image);        }        $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed';        $generator = $this->_element->createElement('generator', $generator);        $channel->appendChild($generator);        if (!empty($array->language)) {            $language = $this->_element->createElement('language', $array->language);            $channel->appendChild($language);        }        $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss');        $channel->appendChild($doc);        if (isset($array->cloud)) {            $cloud = $this->_element->createElement('cloud');            $cloud->setAttribute('domain', $array->cloud['uri']->getHost());            $cloud->setAttribute('port', $array->cloud['uri']->getPort());            $cloud->setAttribute('path', $array->cloud['uri']->getPath());            $cloud->setAttribute('registerProcedure', $array->cloud['procedure']);            $cloud->setAttribute('protocol', $array->cloud['protocol']);            $channel->appendChild($cloud);        }        if (isset($array->rating)) {            $rating = $this->_element->createElement('rating', $array->rating);            $channel->appendChild($rating);        }        if (isset($array->textInput)) {            $textinput = $this->_element->createElement('textInput');            $textinput->appendChild($this->_element->createElement('title', $array->textInput['title']));            $textinput->appendChild($this->_element->createElement('description', $array->textInput['description']));            $textinput->appendChild($this->_element->createElement('name', $array->textInput['name']));            $textinput->appendChild($this->_element->createElement('link', $array->textInput['link']));            $channel->appendChild($textinput);        }        if (isset($array->skipHours)) {            $skipHours = $this->_element->createElement('skipHours');            foreach ($array->skipHours as $hour) {                $skipHours->appendChild($this->_element->createElement('hour', $hour));            }            $channel->appendChild($skipHours);        }        if (isset($array->skipDays)) {            $skipDays = $this->_element->createElement('skipDays');            foreach ($array->skipDays as $day) {                $skipDays->appendChild($this->_element->createElement('day', $day));            }            $channel->appendChild($skipDays);        }        if (isset($array->itunes)) {            $this->_buildiTunes($channel, $array);        }        return $channel;    }    /**     * Adds the iTunes extensions to a root node     *     * @param  DOMElement $root     * @param  array $array     * @return void     */    private function _buildiTunes(DOMElement $root, $array)    {        /* author node */        $author = '';

⌨️ 快捷键说明

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