File indexing completed on 2025-03-02 05:29:26
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_Gdata 0018 * @subpackage App 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_App_Entry 0026 */ 0027 // require_once 'Zend/Gdata/App/Entry.php'; 0028 0029 /** 0030 * @see Zend_Gdata_App_FeedSourceParent 0031 */ 0032 // require_once 'Zend/Gdata/App/FeedEntryParent.php'; 0033 0034 /** 0035 * @see Zend_Gdata_App_Extension_Generator 0036 */ 0037 // require_once 'Zend/Gdata/App/Extension/Generator.php'; 0038 0039 /** 0040 * @see Zend_Gdata_App_Extension_Icon 0041 */ 0042 // require_once 'Zend/Gdata/App/Extension/Icon.php'; 0043 0044 /** 0045 * @see Zend_Gdata_App_Extension_Logo 0046 */ 0047 // require_once 'Zend/Gdata/App/Extension/Logo.php'; 0048 0049 /** 0050 * @see Zend_Gdata_App_Extension_Subtitle 0051 */ 0052 // require_once 'Zend/Gdata/App/Extension/Subtitle.php'; 0053 0054 /** 0055 * Atom feed class 0056 * 0057 * @category Zend 0058 * @package Zend_Gdata 0059 * @subpackage App 0060 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0061 * @license http://framework.zend.com/license/new-bsd New BSD License 0062 */ 0063 abstract class Zend_Gdata_App_FeedSourceParent extends Zend_Gdata_App_FeedEntryParent 0064 { 0065 0066 /** 0067 * The classname for individual feed elements. 0068 * 0069 * @var string 0070 */ 0071 protected $_entryClassName = 'Zend_Gdata_App_Entry'; 0072 0073 /** 0074 * Root XML element for Atom entries. 0075 * 0076 * @var string 0077 */ 0078 protected $_rootElement = null; 0079 0080 protected $_generator = null; 0081 protected $_icon = null; 0082 protected $_logo = null; 0083 protected $_subtitle = null; 0084 0085 /** 0086 * Set the HTTP client instance 0087 * 0088 * Sets the HTTP client object to use for retrieving the feed. 0089 * 0090 * @deprecated Deprecated as of Zend Framework 1.7. Use 0091 * setService() instead. 0092 * @param Zend_Http_Client $httpClient 0093 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface 0094 */ 0095 public function setHttpClient(Zend_Http_Client $httpClient) 0096 { 0097 parent::setHttpClient($httpClient); 0098 foreach ($this->_entry as $entry) { 0099 $entry->setHttpClient($httpClient); 0100 } 0101 return $this; 0102 } 0103 0104 /** 0105 * Set the active service instance for this feed and all enclosed entries. 0106 * This will be used to perform network requests, such as when calling 0107 * save() and delete(). 0108 * 0109 * @param Zend_Gdata_App $instance The new service instance. 0110 * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface. 0111 */ 0112 public function setService($instance) 0113 { 0114 parent::setService($instance); 0115 foreach ($this->_entry as $entry) { 0116 $entry->setService($instance); 0117 } 0118 return $this; 0119 } 0120 0121 /** 0122 * Make accessing some individual elements of the feed easier. 0123 * 0124 * Special accessors 'entry' and 'entries' are provided so that if 0125 * you wish to iterate over an Atom feed's entries, you can do so 0126 * using foreach ($feed->entries as $entry) or foreach 0127 * ($feed->entry as $entry). 0128 * 0129 * @param string $var The property to access. 0130 * @return mixed 0131 */ 0132 public function __get($var) 0133 { 0134 switch ($var) { 0135 default: 0136 return parent::__get($var); 0137 } 0138 } 0139 0140 0141 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0142 { 0143 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0144 if ($this->_generator != null) { 0145 $element->appendChild($this->_generator->getDOM($element->ownerDocument)); 0146 } 0147 if ($this->_icon != null) { 0148 $element->appendChild($this->_icon->getDOM($element->ownerDocument)); 0149 } 0150 if ($this->_logo != null) { 0151 $element->appendChild($this->_logo->getDOM($element->ownerDocument)); 0152 } 0153 if ($this->_subtitle != null) { 0154 $element->appendChild($this->_subtitle->getDOM($element->ownerDocument)); 0155 } 0156 return $element; 0157 } 0158 0159 /** 0160 * Creates individual Entry objects of the appropriate type and 0161 * stores them in the $_entry array based upon DOM data. 0162 * 0163 * @param DOMNode $child The DOMNode to process 0164 */ 0165 protected function takeChildFromDOM($child) 0166 { 0167 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 0168 switch ($absoluteNodeName) { 0169 case $this->lookupNamespace('atom') . ':' . 'generator': 0170 $generator = new Zend_Gdata_App_Extension_Generator(); 0171 $generator->transferFromDOM($child); 0172 $this->_generator = $generator; 0173 break; 0174 case $this->lookupNamespace('atom') . ':' . 'icon': 0175 $icon = new Zend_Gdata_App_Extension_Icon(); 0176 $icon->transferFromDOM($child); 0177 $this->_icon = $icon; 0178 break; 0179 case $this->lookupNamespace('atom') . ':' . 'logo': 0180 $logo = new Zend_Gdata_App_Extension_Logo(); 0181 $logo->transferFromDOM($child); 0182 $this->_logo = $logo; 0183 break; 0184 case $this->lookupNamespace('atom') . ':' . 'subtitle': 0185 $subtitle = new Zend_Gdata_App_Extension_Subtitle(); 0186 $subtitle->transferFromDOM($child); 0187 $this->_subtitle = $subtitle; 0188 break; 0189 default: 0190 parent::takeChildFromDOM($child); 0191 break; 0192 } 0193 } 0194 0195 /** 0196 * @return Zend_Gdata_AppExtension_Generator 0197 */ 0198 public function getGenerator() 0199 { 0200 return $this->_generator; 0201 } 0202 0203 /** 0204 * @param Zend_Gdata_App_Extension_Generator $value 0205 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface 0206 */ 0207 public function setGenerator($value) 0208 { 0209 $this->_generator = $value; 0210 return $this; 0211 } 0212 0213 /** 0214 * @return Zend_Gdata_AppExtension_Icon 0215 */ 0216 public function getIcon() 0217 { 0218 return $this->_icon; 0219 } 0220 0221 /** 0222 * @param Zend_Gdata_App_Extension_Icon $value 0223 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface 0224 */ 0225 public function setIcon($value) 0226 { 0227 $this->_icon = $value; 0228 return $this; 0229 } 0230 0231 /** 0232 * @return Zend_Gdata_AppExtension_logo 0233 */ 0234 public function getlogo() 0235 { 0236 return $this->_logo; 0237 } 0238 0239 /** 0240 * @param Zend_Gdata_App_Extension_logo $value 0241 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface 0242 */ 0243 public function setlogo($value) 0244 { 0245 $this->_logo = $value; 0246 return $this; 0247 } 0248 0249 /** 0250 * @return Zend_Gdata_AppExtension_Subtitle 0251 */ 0252 public function getSubtitle() 0253 { 0254 return $this->_subtitle; 0255 } 0256 0257 /** 0258 * @param Zend_Gdata_App_Extension_Subtitle $value 0259 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface 0260 */ 0261 public function setSubtitle($value) 0262 { 0263 $this->_subtitle = $value; 0264 return $this; 0265 } 0266 0267 }