source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/App/FeedSourceParent.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 7.2 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
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.
15 *
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage App
19 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 */
22
23/**
24 * @see Zend_Gdata_App_Entry
25 */
26require_once 'Zend/Gdata/App/Entry.php';
27
28/**
29 * @see Zend_Gdata_App_FeedSourceParent
30 */
31require_once 'Zend/Gdata/App/FeedEntryParent.php';
32
33/**
34 * @see Zend_Gdata_App_Extension_Generator
35 */
36require_once 'Zend/Gdata/App/Extension/Generator.php';
37
38/**
39 * @see Zend_Gdata_App_Extension_Icon
40 */
41require_once 'Zend/Gdata/App/Extension/Icon.php';
42
43/**
44 * @see Zend_Gdata_App_Extension_Logo
45 */
46require_once 'Zend/Gdata/App/Extension/Logo.php';
47
48/**
49 * @see Zend_Gdata_App_Extension_Subtitle
50 */
51require_once 'Zend/Gdata/App/Extension/Subtitle.php';
52
53/**
54 * Atom feed class
55 *
56 * @category Zend
57 * @package Zend_Gdata
58 * @subpackage App
59 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
60 * @license http://framework.zend.com/license/new-bsd New BSD License
61 */
62abstract class Zend_Gdata_App_FeedSourceParent extends Zend_Gdata_App_FeedEntryParent
63{
64
65 /**
66 * The classname for individual feed elements.
67 *
68 * @var string
69 */
70 protected $_entryClassName = 'Zend_Gdata_App_Entry';
71
72 /**
73 * Root XML element for Atom entries.
74 *
75 * @var string
76 */
77 protected $_rootElement = null;
78
79 protected $_generator = null;
80 protected $_icon = null;
81 protected $_logo = null;
82 protected $_subtitle = null;
83
84 /**
85 * Set the HTTP client instance
86 *
87 * Sets the HTTP client object to use for retrieving the feed.
88 *
89 * @deprecated Deprecated as of Zend Framework 1.7. Use
90 * setService() instead.
91 * @param Zend_Http_Client $httpClient
92 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
93 */
94 public function setHttpClient(Zend_Http_Client $httpClient)
95 {
96 parent::setHttpClient($httpClient);
97 foreach ($this->_entry as $entry) {
98 $entry->setHttpClient($httpClient);
99 }
100 return $this;
101 }
102
103 /**
104 * Set the active service instance for this feed and all enclosed entries.
105 * This will be used to perform network requests, such as when calling
106 * save() and delete().
107 *
108 * @param Zend_Gdata_App $instance The new service instance.
109 * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface.
110 */
111 public function setService($instance)
112 {
113 parent::setService($instance);
114 foreach ($this->_entry as $entry) {
115 $entry->setService($instance);
116 }
117 return $this;
118 }
119
120 /**
121 * Make accessing some individual elements of the feed easier.
122 *
123 * Special accessors 'entry' and 'entries' are provided so that if
124 * you wish to iterate over an Atom feed's entries, you can do so
125 * using foreach ($feed->entries as $entry) or foreach
126 * ($feed->entry as $entry).
127 *
128 * @param string $var The property to access.
129 * @return mixed
130 */
131 public function __get($var)
132 {
133 switch ($var) {
134 default:
135 return parent::__get($var);
136 }
137 }
138
139
140 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
141 {
142 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
143 if ($this->_generator != null) {
144 $element->appendChild($this->_generator->getDOM($element->ownerDocument));
145 }
146 if ($this->_icon != null) {
147 $element->appendChild($this->_icon->getDOM($element->ownerDocument));
148 }
149 if ($this->_logo != null) {
150 $element->appendChild($this->_logo->getDOM($element->ownerDocument));
151 }
152 if ($this->_subtitle != null) {
153 $element->appendChild($this->_subtitle->getDOM($element->ownerDocument));
154 }
155 return $element;
156 }
157
158 /**
159 * Creates individual Entry objects of the appropriate type and
160 * stores them in the $_entry array based upon DOM data.
161 *
162 * @param DOMNode $child The DOMNode to process
163 */
164 protected function takeChildFromDOM($child)
165 {
166 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
167 switch ($absoluteNodeName) {
168 case $this->lookupNamespace('atom') . ':' . 'generator':
169 $generator = new Zend_Gdata_App_Extension_Generator();
170 $generator->transferFromDOM($child);
171 $this->_generator = $generator;
172 break;
173 case $this->lookupNamespace('atom') . ':' . 'icon':
174 $icon = new Zend_Gdata_App_Extension_Icon();
175 $icon->transferFromDOM($child);
176 $this->_icon = $icon;
177 break;
178 case $this->lookupNamespace('atom') . ':' . 'logo':
179 $logo = new Zend_Gdata_App_Extension_Logo();
180 $logo->transferFromDOM($child);
181 $this->_logo = $logo;
182 break;
183 case $this->lookupNamespace('atom') . ':' . 'subtitle':
184 $subtitle = new Zend_Gdata_App_Extension_Subtitle();
185 $subtitle->transferFromDOM($child);
186 $this->_subtitle = $subtitle;
187 break;
188 default:
189 parent::takeChildFromDOM($child);
190 break;
191 }
192 }
193
194 /**
195 * @return Zend_Gdata_AppExtension_Generator
196 */
197 public function getGenerator()
198 {
199 return $this->_generator;
200 }
201
202 /**
203 * @param Zend_Gdata_App_Extension_Generator $value
204 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
205 */
206 public function setGenerator($value)
207 {
208 $this->_generator = $value;
209 return $this;
210 }
211
212 /**
213 * @return Zend_Gdata_AppExtension_Icon
214 */
215 public function getIcon()
216 {
217 return $this->_icon;
218 }
219
220 /**
221 * @param Zend_Gdata_App_Extension_Icon $value
222 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
223 */
224 public function setIcon($value)
225 {
226 $this->_icon = $value;
227 return $this;
228 }
229
230 /**
231 * @return Zend_Gdata_AppExtension_logo
232 */
233 public function getlogo()
234 {
235 return $this->_logo;
236 }
237
238 /**
239 * @param Zend_Gdata_App_Extension_logo $value
240 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
241 */
242 public function setlogo($value)
243 {
244 $this->_logo = $value;
245 return $this;
246 }
247
248 /**
249 * @return Zend_Gdata_AppExtension_Subtitle
250 */
251 public function getSubtitle()
252 {
253 return $this->_subtitle;
254 }
255
256 /**
257 * @param Zend_Gdata_App_Extension_Subtitle $value
258 * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
259 */
260 public function setSubtitle($value)
261 {
262 $this->_subtitle = $value;
263 return $this;
264 }
265
266}
Note: See TracBrowser for help on using the repository browser.