8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_App_Entry
27 require_once 'Zend/Gdata/App/Entry.php';
30 * @see Zend_Gdata_App_FeedSourceParent
32 require_once 'Zend/Gdata/App/FeedEntryParent.php';
35 * @see Zend_Gdata_App_Extension_Generator
37 require_once 'Zend/Gdata/App/Extension/Generator.php';
40 * @see Zend_Gdata_App_Extension_Icon
42 require_once 'Zend/Gdata/App/Extension/Icon.php';
45 * @see Zend_Gdata_App_Extension_Logo
47 require_once 'Zend/Gdata/App/Extension/Logo.php';
50 * @see Zend_Gdata_App_Extension_Subtitle
52 require_once 'Zend/Gdata/App/Extension/Subtitle.php';
60 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
61 * @license http://framework.zend.com/license/new-bsd New BSD License
63 abstract class Zend_Gdata_App_FeedSourceParent extends Zend_Gdata_App_FeedEntryParent
67 * The classname for individual feed elements.
71 protected $_entryClassName = 'Zend_Gdata_App_Entry';
74 * Root XML element for Atom entries.
78 protected $_rootElement = null;
80 protected $_generator = null;
81 protected $_icon = null;
82 protected $_logo = null;
83 protected $_subtitle = null;
86 * Set the HTTP client instance
88 * Sets the HTTP client object to use for retrieving the feed.
90 * @deprecated Deprecated as of Zend Framework 1.7. Use
91 * setService() instead.
92 * @param Zend_Http_Client $httpClient
93 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
95 public function setHttpClient(Zend_Http_Client $httpClient)
97 parent::setHttpClient($httpClient);
98 foreach ($this->_entry as $entry) {
99 $entry->setHttpClient($httpClient);
105 * Set the active service instance for this feed and all enclosed entries.
106 * This will be used to perform network requests, such as when calling
107 * save() and delete().
109 * @param Zend_Gdata_App $instance The new service instance.
110 * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface.
112 public function setService($instance)
114 parent::setService($instance);
115 foreach ($this->_entry as $entry) {
116 $entry->setService($instance);
122 * Make accessing some individual elements of the feed easier.
124 * Special accessors 'entry' and 'entries' are provided so that if
125 * you wish to iterate over an Atom feed's entries, you can do so
126 * using foreach ($feed->entries as $entry) or foreach
127 * ($feed->entry as $entry).
129 * @param string $var The property to access.
132 public function __get($var)
136 return parent::__get($var);
141 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
143 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
144 if ($this->_generator != null) {
145 $element->appendChild($this->_generator->getDOM($element->ownerDocument));
147 if ($this->_icon != null) {
148 $element->appendChild($this->_icon->getDOM($element->ownerDocument));
150 if ($this->_logo != null) {
151 $element->appendChild($this->_logo->getDOM($element->ownerDocument));
153 if ($this->_subtitle != null) {
154 $element->appendChild($this->_subtitle->getDOM($element->ownerDocument));
160 * Creates individual Entry objects of the appropriate type and
161 * stores them in the $_entry array based upon DOM data.
163 * @param DOMNode $child The DOMNode to process
165 protected function takeChildFromDOM($child)
167 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
168 switch ($absoluteNodeName) {
169 case $this->lookupNamespace('atom') . ':' . 'generator':
170 $generator = new Zend_Gdata_App_Extension_Generator();
171 $generator->transferFromDOM($child);
172 $this->_generator = $generator;
174 case $this->lookupNamespace('atom') . ':' . 'icon':
175 $icon = new Zend_Gdata_App_Extension_Icon();
176 $icon->transferFromDOM($child);
177 $this->_icon = $icon;
179 case $this->lookupNamespace('atom') . ':' . 'logo':
180 $logo = new Zend_Gdata_App_Extension_Logo();
181 $logo->transferFromDOM($child);
182 $this->_logo = $logo;
184 case $this->lookupNamespace('atom') . ':' . 'subtitle':
185 $subtitle = new Zend_Gdata_App_Extension_Subtitle();
186 $subtitle->transferFromDOM($child);
187 $this->_subtitle = $subtitle;
190 parent::takeChildFromDOM($child);
196 * @return Zend_Gdata_AppExtension_Generator
198 public function getGenerator()
200 return $this->_generator;
204 * @param Zend_Gdata_App_Extension_Generator $value
205 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
207 public function setGenerator($value)
209 $this->_generator = $value;
214 * @return Zend_Gdata_AppExtension_Icon
216 public function getIcon()
222 * @param Zend_Gdata_App_Extension_Icon $value
223 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
225 public function setIcon($value)
227 $this->_icon = $value;
232 * @return Zend_Gdata_AppExtension_logo
234 public function getlogo()
240 * @param Zend_Gdata_App_Extension_logo $value
241 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
243 public function setlogo($value)
245 $this->_logo = $value;
250 * @return Zend_Gdata_AppExtension_Subtitle
252 public function getSubtitle()
254 return $this->_subtitle;
258 * @param Zend_Gdata_App_Extension_Subtitle $value
259 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
261 public function setSubtitle($value)
263 $this->_subtitle = $value;