File indexing completed on 2024-06-16 05:30:01

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Feed
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 
0024 /**
0025  * @see Zend_Feed_Entry_Abstract
0026  */
0027 // require_once 'Zend/Feed/Entry/Abstract.php';
0028 
0029 
0030 /**
0031  * Concrete class for working with RSS items.
0032  *
0033  * @category   Zend
0034  * @package    Zend_Feed
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract
0039 {
0040     /**
0041      * Root XML element for RSS items.
0042      *
0043      * @var string
0044      */
0045     protected $_rootElement = 'item';
0046 
0047     /**
0048      * Overwrites parent::_get method to enable read access
0049      * to content:encoded element.
0050      *
0051      * @param  string $var The property to access.
0052      * @return mixed
0053      */
0054     public function __get($var)
0055     {
0056         switch ($var) {
0057             case 'content':
0058                 $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/');
0059                 return parent::__get("$prefix:encoded");
0060             default:
0061                 return parent::__get($var);
0062         }
0063     }
0064 
0065     /**
0066      * Overwrites parent::_set method to enable write access
0067      * to content:encoded element.
0068      *
0069      * @param  string $var The property to change.
0070      * @param  string $val The property's new value.
0071      * @return void
0072      */
0073     public function __set($var, $value)
0074     {
0075         switch ($var) {
0076             case 'content':
0077                 parent::__set('content:encoded', $value);
0078                 break;
0079             default:
0080                 parent::__set($var, $value);
0081         }
0082     }
0083 
0084     /**
0085      * Overwrites parent::_isset method to enable access
0086      * to content:encoded element.
0087      *
0088      * @param  string $var
0089      * @return boolean
0090      */
0091     public function __isset($var)
0092     {
0093         switch ($var) {
0094             case 'content':
0095                 // don't use other callback to prevent invalid returned value
0096                 return $this->content() !== null;
0097             default:
0098                 return parent::__isset($var);
0099         }
0100     }
0101 
0102     /**
0103      * Overwrites parent::_call method to enable read access
0104      * to content:encoded element.
0105      * Please note that method-style write access is not currently supported
0106      * by parent method, consequently this method doesn't as well.
0107      *
0108      * @param  string $var    The element to get the string value of.
0109      * @param  mixed  $unused This parameter is not used.
0110      * @return mixed The node's value, null, or an array of nodes.
0111      */
0112     public function __call($var, $unused)
0113     {
0114         switch ($var) {
0115             case 'content':
0116                 $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/');
0117                 return parent::__call("$prefix:encoded", $unused);
0118             default:
0119                 return parent::__call($var, $unused);
0120         }
0121     }
0122 }