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 Photos |
---|
19 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
21 | * @version $Id: AlbumFeed.php 24594 2012-01-05 21:27:01Z matthew $ |
---|
22 | */ |
---|
23 | |
---|
24 | /** |
---|
25 | * @see Zend_Gdata_Photos |
---|
26 | */ |
---|
27 | require_once 'Zend/Gdata/Photos.php'; |
---|
28 | |
---|
29 | /** |
---|
30 | * @see Zend_Gdata_Feed |
---|
31 | */ |
---|
32 | require_once 'Zend/Gdata/Feed.php'; |
---|
33 | |
---|
34 | /** |
---|
35 | * @see Zend_Gdata_Photos_AlbumEntry |
---|
36 | */ |
---|
37 | require_once 'Zend/Gdata/Photos/AlbumEntry.php'; |
---|
38 | |
---|
39 | /** |
---|
40 | * Data model for a collection of album entries, usually |
---|
41 | * provided by the servers. |
---|
42 | * |
---|
43 | * For information on requesting this feed from a server, see the |
---|
44 | * service class, Zend_Gdata_Photos. |
---|
45 | * |
---|
46 | * @category Zend |
---|
47 | * @package Zend_Gdata |
---|
48 | * @subpackage Photos |
---|
49 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
50 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
51 | */ |
---|
52 | class Zend_Gdata_Photos_AlbumFeed extends Zend_Gdata_Feed |
---|
53 | { |
---|
54 | protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry'; |
---|
55 | protected $_feedClassName = 'Zend_Gdata_Photos_AlbumFeed'; |
---|
56 | |
---|
57 | /** |
---|
58 | * gphoto:id element |
---|
59 | * |
---|
60 | * @var Zend_Gdata_Photos_Extension_Id |
---|
61 | */ |
---|
62 | protected $_gphotoId = null; |
---|
63 | |
---|
64 | /** |
---|
65 | * gphoto:user element |
---|
66 | * |
---|
67 | * @var Zend_Gdata_Photos_Extension_User |
---|
68 | */ |
---|
69 | protected $_gphotoUser = null; |
---|
70 | |
---|
71 | /** |
---|
72 | * gphoto:access element |
---|
73 | * |
---|
74 | * @var Zend_Gdata_Photos_Extension_Access |
---|
75 | */ |
---|
76 | protected $_gphotoAccess = null; |
---|
77 | |
---|
78 | /** |
---|
79 | * gphoto:location element |
---|
80 | * |
---|
81 | * @var Zend_Gdata_Photos_Extension_Location |
---|
82 | */ |
---|
83 | protected $_gphotoLocation = null; |
---|
84 | |
---|
85 | /** |
---|
86 | * gphoto:nickname element |
---|
87 | * |
---|
88 | * @var Zend_Gdata_Photos_Extension_Nickname |
---|
89 | */ |
---|
90 | protected $_gphotoNickname = null; |
---|
91 | |
---|
92 | /** |
---|
93 | * gphoto:timestamp element |
---|
94 | * |
---|
95 | * @var Zend_Gdata_Photos_Extension_Timestamp |
---|
96 | */ |
---|
97 | protected $_gphotoTimestamp = null; |
---|
98 | |
---|
99 | /** |
---|
100 | * gphoto:name element |
---|
101 | * |
---|
102 | * @var Zend_Gdata_Photos_Extension_Name |
---|
103 | */ |
---|
104 | protected $_gphotoName = null; |
---|
105 | |
---|
106 | /** |
---|
107 | * gphoto:numphotos element |
---|
108 | * |
---|
109 | * @var Zend_Gdata_Photos_Extension_NumPhotos |
---|
110 | */ |
---|
111 | protected $_gphotoNumPhotos = null; |
---|
112 | |
---|
113 | /** |
---|
114 | * gphoto:commentCount element |
---|
115 | * |
---|
116 | * @var Zend_Gdata_Photos_Extension_CommentCount |
---|
117 | */ |
---|
118 | protected $_gphotoCommentCount = null; |
---|
119 | |
---|
120 | /** |
---|
121 | * gphoto:commentingEnabled element |
---|
122 | * |
---|
123 | * @var Zend_Gdata_Photos_Extension_CommentingEnabled |
---|
124 | */ |
---|
125 | protected $_gphotoCommentingEnabled = null; |
---|
126 | |
---|
127 | protected $_entryKindClassMapping = array( |
---|
128 | 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', |
---|
129 | 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', |
---|
130 | 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' |
---|
131 | ); |
---|
132 | |
---|
133 | public function __construct($element = null) |
---|
134 | { |
---|
135 | $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); |
---|
136 | parent::__construct($element); |
---|
137 | } |
---|
138 | |
---|
139 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) |
---|
140 | { |
---|
141 | $element = parent::getDOM($doc, $majorVersion, $minorVersion); |
---|
142 | if ($this->_gphotoId != null) { |
---|
143 | $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); |
---|
144 | } |
---|
145 | if ($this->_gphotoUser != null) { |
---|
146 | $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); |
---|
147 | } |
---|
148 | if ($this->_gphotoNickname != null) { |
---|
149 | $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); |
---|
150 | } |
---|
151 | if ($this->_gphotoName != null) { |
---|
152 | $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument)); |
---|
153 | } |
---|
154 | if ($this->_gphotoLocation != null) { |
---|
155 | $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument)); |
---|
156 | } |
---|
157 | if ($this->_gphotoAccess != null) { |
---|
158 | $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument)); |
---|
159 | } |
---|
160 | if ($this->_gphotoTimestamp != null) { |
---|
161 | $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); |
---|
162 | } |
---|
163 | if ($this->_gphotoNumPhotos != null) { |
---|
164 | $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument)); |
---|
165 | } |
---|
166 | if ($this->_gphotoCommentingEnabled != null) { |
---|
167 | $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); |
---|
168 | } |
---|
169 | if ($this->_gphotoCommentCount != null) { |
---|
170 | $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); |
---|
171 | } |
---|
172 | |
---|
173 | return $element; |
---|
174 | } |
---|
175 | |
---|
176 | protected function takeChildFromDOM($child) |
---|
177 | { |
---|
178 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; |
---|
179 | |
---|
180 | switch ($absoluteNodeName) { |
---|
181 | case $this->lookupNamespace('gphoto') . ':' . 'id'; |
---|
182 | $id = new Zend_Gdata_Photos_Extension_Id(); |
---|
183 | $id->transferFromDOM($child); |
---|
184 | $this->_gphotoId = $id; |
---|
185 | break; |
---|
186 | case $this->lookupNamespace('gphoto') . ':' . 'user'; |
---|
187 | $user = new Zend_Gdata_Photos_Extension_User(); |
---|
188 | $user->transferFromDOM($child); |
---|
189 | $this->_gphotoUser = $user; |
---|
190 | break; |
---|
191 | case $this->lookupNamespace('gphoto') . ':' . 'nickname'; |
---|
192 | $nickname = new Zend_Gdata_Photos_Extension_Nickname(); |
---|
193 | $nickname->transferFromDOM($child); |
---|
194 | $this->_gphotoNickname = $nickname; |
---|
195 | break; |
---|
196 | case $this->lookupNamespace('gphoto') . ':' . 'name'; |
---|
197 | $name = new Zend_Gdata_Photos_Extension_Name(); |
---|
198 | $name->transferFromDOM($child); |
---|
199 | $this->_gphotoName = $name; |
---|
200 | break; |
---|
201 | case $this->lookupNamespace('gphoto') . ':' . 'location'; |
---|
202 | $location = new Zend_Gdata_Photos_Extension_Location(); |
---|
203 | $location->transferFromDOM($child); |
---|
204 | $this->_gphotoLocation = $location; |
---|
205 | break; |
---|
206 | case $this->lookupNamespace('gphoto') . ':' . 'access'; |
---|
207 | $access = new Zend_Gdata_Photos_Extension_Access(); |
---|
208 | $access->transferFromDOM($child); |
---|
209 | $this->_gphotoAccess = $access; |
---|
210 | break; |
---|
211 | case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; |
---|
212 | $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); |
---|
213 | $timestamp->transferFromDOM($child); |
---|
214 | $this->_gphotoTimestamp = $timestamp; |
---|
215 | break; |
---|
216 | case $this->lookupNamespace('gphoto') . ':' . 'numphotos'; |
---|
217 | $numphotos = new Zend_Gdata_Photos_Extension_NumPhotos(); |
---|
218 | $numphotos->transferFromDOM($child); |
---|
219 | $this->_gphotoNumPhotos = $numphotos; |
---|
220 | break; |
---|
221 | case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; |
---|
222 | $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); |
---|
223 | $commentingEnabled->transferFromDOM($child); |
---|
224 | $this->_gphotoCommentingEnabled = $commentingEnabled; |
---|
225 | break; |
---|
226 | case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; |
---|
227 | $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); |
---|
228 | $commentCount->transferFromDOM($child); |
---|
229 | $this->_gphotoCommentCount = $commentCount; |
---|
230 | break; |
---|
231 | case $this->lookupNamespace('atom') . ':' . 'entry': |
---|
232 | $entryClassName = $this->_entryClassName; |
---|
233 | $tmpEntry = new Zend_Gdata_App_Entry($child); |
---|
234 | $categories = $tmpEntry->getCategory(); |
---|
235 | foreach ($categories as $category) { |
---|
236 | if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && |
---|
237 | $this->_entryKindClassMapping[$category->term] != "") { |
---|
238 | $entryClassName = $this->_entryKindClassMapping[$category->term]; |
---|
239 | break; |
---|
240 | } else { |
---|
241 | require_once 'Zend/Gdata/App/Exception.php'; |
---|
242 | throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); |
---|
243 | } |
---|
244 | } |
---|
245 | |
---|
246 | $newEntry = new $entryClassName($child); |
---|
247 | $newEntry->setHttpClient($this->getHttpClient()); |
---|
248 | $this->_entry[] = $newEntry; |
---|
249 | break; |
---|
250 | default: |
---|
251 | parent::takeChildFromDOM($child); |
---|
252 | break; |
---|
253 | } |
---|
254 | } |
---|
255 | |
---|
256 | /** |
---|
257 | * Get the value for this element's gphoto:user attribute. |
---|
258 | * |
---|
259 | * @see setGphotoUser |
---|
260 | * @return string The requested attribute. |
---|
261 | */ |
---|
262 | public function getGphotoUser() |
---|
263 | { |
---|
264 | return $this->_gphotoUser; |
---|
265 | } |
---|
266 | |
---|
267 | /** |
---|
268 | * Set the value for this element's gphoto:user attribute. |
---|
269 | * |
---|
270 | * @param string $value The desired value for this attribute. |
---|
271 | * @return Zend_Gdata_Photos_Extension_User The element being modified. |
---|
272 | */ |
---|
273 | public function setGphotoUser($value) |
---|
274 | { |
---|
275 | $this->_gphotoUser = $value; |
---|
276 | return $this; |
---|
277 | } |
---|
278 | |
---|
279 | /** |
---|
280 | * Get the value for this element's gphoto:access attribute. |
---|
281 | * |
---|
282 | * @see setGphotoAccess |
---|
283 | * @return string The requested attribute. |
---|
284 | */ |
---|
285 | public function getGphotoAccess() |
---|
286 | { |
---|
287 | return $this->_gphotoAccess; |
---|
288 | } |
---|
289 | |
---|
290 | /** |
---|
291 | * Set the value for this element's gphoto:access attribute. |
---|
292 | * |
---|
293 | * @param string $value The desired value for this attribute. |
---|
294 | * @return Zend_Gdata_Photos_Extension_Access The element being modified. |
---|
295 | */ |
---|
296 | public function setGphotoAccess($value) |
---|
297 | { |
---|
298 | $this->_gphotoAccess = $value; |
---|
299 | return $this; |
---|
300 | } |
---|
301 | |
---|
302 | /** |
---|
303 | * Get the value for this element's gphoto:location attribute. |
---|
304 | * |
---|
305 | * @see setGphotoLocation |
---|
306 | * @return string The requested attribute. |
---|
307 | */ |
---|
308 | public function getGphotoLocation() |
---|
309 | { |
---|
310 | return $this->_gphotoLocation; |
---|
311 | } |
---|
312 | |
---|
313 | /** |
---|
314 | * Set the value for this element's gphoto:location attribute. |
---|
315 | * |
---|
316 | * @param string $value The desired value for this attribute. |
---|
317 | * @return Zend_Gdata_Photos_Extension_Location The element being modified. |
---|
318 | */ |
---|
319 | public function setGphotoLocation($value) |
---|
320 | { |
---|
321 | $this->_gphotoLocation = $value; |
---|
322 | return $this; |
---|
323 | } |
---|
324 | |
---|
325 | /** |
---|
326 | * Get the value for this element's gphoto:name attribute. |
---|
327 | * |
---|
328 | * @see setGphotoName |
---|
329 | * @return string The requested attribute. |
---|
330 | */ |
---|
331 | public function getGphotoName() |
---|
332 | { |
---|
333 | return $this->_gphotoName; |
---|
334 | } |
---|
335 | |
---|
336 | /** |
---|
337 | * Set the value for this element's gphoto:name attribute. |
---|
338 | * |
---|
339 | * @param string $value The desired value for this attribute. |
---|
340 | * @return Zend_Gdata_Photos_Extension_Name The element being modified. |
---|
341 | */ |
---|
342 | public function setGphotoName($value) |
---|
343 | { |
---|
344 | $this->_gphotoName = $value; |
---|
345 | return $this; |
---|
346 | } |
---|
347 | |
---|
348 | /** |
---|
349 | * Get the value for this element's gphoto:numphotos attribute. |
---|
350 | * |
---|
351 | * @see setGphotoNumPhotos |
---|
352 | * @return string The requested attribute. |
---|
353 | */ |
---|
354 | public function getGphotoNumPhotos() |
---|
355 | { |
---|
356 | return $this->_gphotoNumPhotos; |
---|
357 | } |
---|
358 | |
---|
359 | /** |
---|
360 | * Set the value for this element's gphoto:numphotos attribute. |
---|
361 | * |
---|
362 | * @param string $value The desired value for this attribute. |
---|
363 | * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified. |
---|
364 | */ |
---|
365 | public function setGphotoNumPhotos($value) |
---|
366 | { |
---|
367 | $this->_gphotoNumPhotos = $value; |
---|
368 | return $this; |
---|
369 | } |
---|
370 | |
---|
371 | /** |
---|
372 | * Get the value for this element's gphoto:commentCount attribute. |
---|
373 | * |
---|
374 | * @see setGphotoCommentCount |
---|
375 | * @return string The requested attribute. |
---|
376 | */ |
---|
377 | public function getGphotoCommentCount() |
---|
378 | { |
---|
379 | return $this->_gphotoCommentCount; |
---|
380 | } |
---|
381 | |
---|
382 | /** |
---|
383 | * Set the value for this element's gphoto:commentCount attribute. |
---|
384 | * |
---|
385 | * @param string $value The desired value for this attribute. |
---|
386 | * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. |
---|
387 | */ |
---|
388 | public function setGphotoCommentCount($value) |
---|
389 | { |
---|
390 | $this->_gphotoCommentCount = $value; |
---|
391 | return $this; |
---|
392 | } |
---|
393 | |
---|
394 | /** |
---|
395 | * Get the value for this element's gphoto:commentingEnabled attribute. |
---|
396 | * |
---|
397 | * @see setGphotoCommentingEnabled |
---|
398 | * @return string The requested attribute. |
---|
399 | */ |
---|
400 | public function getGphotoCommentingEnabled() |
---|
401 | { |
---|
402 | return $this->_gphotoCommentingEnabled; |
---|
403 | } |
---|
404 | |
---|
405 | /** |
---|
406 | * Set the value for this element's gphoto:commentingEnabled attribute. |
---|
407 | * |
---|
408 | * @param string $value The desired value for this attribute. |
---|
409 | * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. |
---|
410 | */ |
---|
411 | public function setGphotoCommentingEnabled($value) |
---|
412 | { |
---|
413 | $this->_gphotoCommentingEnabled = $value; |
---|
414 | return $this; |
---|
415 | } |
---|
416 | |
---|
417 | /** |
---|
418 | * Get the value for this element's gphoto:id attribute. |
---|
419 | * |
---|
420 | * @see setGphotoId |
---|
421 | * @return string The requested attribute. |
---|
422 | */ |
---|
423 | public function getGphotoId() |
---|
424 | { |
---|
425 | return $this->_gphotoId; |
---|
426 | } |
---|
427 | |
---|
428 | /** |
---|
429 | * Set the value for this element's gphoto:id attribute. |
---|
430 | * |
---|
431 | * @param string $value The desired value for this attribute. |
---|
432 | * @return Zend_Gdata_Photos_Extension_Id The element being modified. |
---|
433 | */ |
---|
434 | public function setGphotoId($value) |
---|
435 | { |
---|
436 | $this->_gphotoId = $value; |
---|
437 | return $this; |
---|
438 | } |
---|
439 | |
---|
440 | /** |
---|
441 | * Get the value for this element's georss:where attribute. |
---|
442 | * |
---|
443 | * @see setGeoRssWhere |
---|
444 | * @return string The requested attribute. |
---|
445 | */ |
---|
446 | public function getGeoRssWhere() |
---|
447 | { |
---|
448 | return $this->_geoRssWhere; |
---|
449 | } |
---|
450 | |
---|
451 | /** |
---|
452 | * Set the value for this element's georss:where attribute. |
---|
453 | * |
---|
454 | * @param string $value The desired value for this attribute. |
---|
455 | * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified. |
---|
456 | */ |
---|
457 | public function setGeoRssWhere($value) |
---|
458 | { |
---|
459 | $this->_geoRssWhere = $value; |
---|
460 | return $this; |
---|
461 | } |
---|
462 | |
---|
463 | /** |
---|
464 | * Get the value for this element's gphoto:nickname attribute. |
---|
465 | * |
---|
466 | * @see setGphotoNickname |
---|
467 | * @return string The requested attribute. |
---|
468 | */ |
---|
469 | public function getGphotoNickname() |
---|
470 | { |
---|
471 | return $this->_gphotoNickname; |
---|
472 | } |
---|
473 | |
---|
474 | /** |
---|
475 | * Set the value for this element's gphoto:nickname attribute. |
---|
476 | * |
---|
477 | * @param string $value The desired value for this attribute. |
---|
478 | * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. |
---|
479 | */ |
---|
480 | public function setGphotoNickname($value) |
---|
481 | { |
---|
482 | $this->_gphotoNickname = $value; |
---|
483 | return $this; |
---|
484 | } |
---|
485 | |
---|
486 | /** |
---|
487 | * Get the value for this element's gphoto:timestamp attribute. |
---|
488 | * |
---|
489 | * @see setGphotoTimestamp |
---|
490 | * @return string The requested attribute. |
---|
491 | */ |
---|
492 | public function getGphotoTimestamp() |
---|
493 | { |
---|
494 | return $this->_gphotoTimestamp; |
---|
495 | } |
---|
496 | |
---|
497 | /** |
---|
498 | * Set the value for this element's gphoto:timestamp attribute. |
---|
499 | * |
---|
500 | * @param string $value The desired value for this attribute. |
---|
501 | * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. |
---|
502 | */ |
---|
503 | public function setGphotoTimestamp($value) |
---|
504 | { |
---|
505 | $this->_gphotoTimestamp = $value; |
---|
506 | return $this; |
---|
507 | } |
---|
508 | |
---|
509 | } |
---|