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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 16.9 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 Photos
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_Photos
25 */
26require_once 'Zend/Gdata/Photos.php';
27
28/**
29 * @see Zend_Gdata_Feed
30 */
31require_once 'Zend/Gdata/Feed.php';
32
33/**
34 * @see Zend_Gdata_Photos_PhotoEntry
35 */
36require_once 'Zend/Gdata/Photos/PhotoEntry.php';
37
38/**
39 * Data model for a collection of photo entries, usually
40 * provided by the Picasa servers.
41 *
42 * For information on requesting this feed from a server, see the
43 * service class, Zend_Gdata_Photos.
44 *
45 * @category Zend
46 * @package Zend_Gdata
47 * @subpackage Photos
48 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
49 * @license http://framework.zend.com/license/new-bsd New BSD License
50 */
51class Zend_Gdata_Photos_PhotoFeed extends Zend_Gdata_Feed
52{
53
54 /**
55 * gphoto:id element
56 *
57 * @var Zend_Gdata_Photos_Extension_Id
58 */
59 protected $_gphotoId = null;
60
61 /**
62 * gphoto:albumid element
63 *
64 * @var Zend_Gdata_Photos_Extension_AlbumId
65 */
66 protected $_gphotoAlbumId = null;
67
68 /**
69 * gphoto:version element
70 *
71 * @var Zend_Gdata_Photos_Extension_Version
72 */
73 protected $_gphotoVersion = null;
74
75 /**
76 * gphoto:width element
77 *
78 * @var Zend_Gdata_Photos_Extension_Width
79 */
80 protected $_gphotoWidth = null;
81
82 /**
83 * gphoto:height element
84 *
85 * @var Zend_Gdata_Photos_Extension_Height
86 */
87 protected $_gphotoHeight = null;
88
89 /**
90 * gphoto:size element
91 *
92 * @var Zend_Gdata_Photos_Extension_Size
93 */
94 protected $_gphotoSize = null;
95
96 /**
97 * gphoto:client element
98 *
99 * @var Zend_Gdata_Photos_Extension_Client
100 */
101 protected $_gphotoClient = null;
102
103 /**
104 * gphoto:checksum element
105 *
106 * @var Zend_Gdata_Photos_Extension_Checksum
107 */
108 protected $_gphotoChecksum = null;
109
110 /**
111 * gphoto:timestamp element
112 *
113 * @var Zend_Gdata_Photos_Extension_Timestamp
114 */
115 protected $_gphotoTimestamp = null;
116
117 /**
118 * gphoto:commentCount element
119 *
120 * @var Zend_Gdata_Photos_Extension_CommentCount
121 */
122 protected $_gphotoCommentCount = null;
123
124 /**
125 * gphoto:commentingEnabled element
126 *
127 * @var Zend_Gdata_Photos_Extension_CommentingEnabled
128 */
129 protected $_gphotoCommentingEnabled = null;
130
131 /**
132 * media:group element
133 *
134 * @var Zend_Gdata_Media_Extension_MediaGroup
135 */
136 protected $_mediaGroup = null;
137
138 protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry';
139 protected $_feedClassName = 'Zend_Gdata_Photos_PhotoFeed';
140
141 protected $_entryKindClassMapping = array(
142 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
143 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
144 );
145
146 public function __construct($element = null)
147 {
148 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
149 parent::__construct($element);
150 }
151
152 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
153 {
154 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
155 if ($this->_gphotoId != null) {
156 $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
157 }
158 if ($this->_gphotoVersion != null) {
159 $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument));
160 }
161 if ($this->_gphotoWidth != null) {
162 $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument));
163 }
164 if ($this->_gphotoHeight != null) {
165 $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument));
166 }
167 if ($this->_gphotoSize != null) {
168 $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument));
169 }
170 if ($this->_gphotoClient != null) {
171 $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument));
172 }
173 if ($this->_gphotoChecksum != null) {
174 $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument));
175 }
176 if ($this->_gphotoTimestamp != null) {
177 $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
178 }
179 if ($this->_gphotoCommentingEnabled != null) {
180 $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
181 }
182 if ($this->_gphotoCommentCount != null) {
183 $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
184 }
185 if ($this->_mediaGroup != null) {
186 $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
187 }
188
189 return $element;
190 }
191
192 protected function takeChildFromDOM($child)
193 {
194 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
195
196 switch ($absoluteNodeName) {
197 case $this->lookupNamespace('gphoto') . ':' . 'id';
198 $id = new Zend_Gdata_Photos_Extension_Id();
199 $id->transferFromDOM($child);
200 $this->_gphotoId = $id;
201 break;
202 case $this->lookupNamespace('gphoto') . ':' . 'version';
203 $version = new Zend_Gdata_Photos_Extension_Version();
204 $version->transferFromDOM($child);
205 $this->_gphotoVersion = $version;
206 break;
207 case $this->lookupNamespace('gphoto') . ':' . 'albumid';
208 $albumid = new Zend_Gdata_Photos_Extension_AlbumId();
209 $albumid->transferFromDOM($child);
210 $this->_gphotoAlbumId = $albumid;
211 break;
212 case $this->lookupNamespace('gphoto') . ':' . 'width';
213 $width = new Zend_Gdata_Photos_Extension_Width();
214 $width->transferFromDOM($child);
215 $this->_gphotoWidth = $width;
216 break;
217 case $this->lookupNamespace('gphoto') . ':' . 'height';
218 $height = new Zend_Gdata_Photos_Extension_Height();
219 $height->transferFromDOM($child);
220 $this->_gphotoHeight = $height;
221 break;
222 case $this->lookupNamespace('gphoto') . ':' . 'size';
223 $size = new Zend_Gdata_Photos_Extension_Size();
224 $size->transferFromDOM($child);
225 $this->_gphotoSize = $size;
226 break;
227 case $this->lookupNamespace('gphoto') . ':' . 'client';
228 $client = new Zend_Gdata_Photos_Extension_Client();
229 $client->transferFromDOM($child);
230 $this->_gphotoClient = $client;
231 break;
232 case $this->lookupNamespace('gphoto') . ':' . 'checksum';
233 $checksum = new Zend_Gdata_Photos_Extension_Checksum();
234 $checksum->transferFromDOM($child);
235 $this->_gphotoChecksum = $checksum;
236 break;
237 case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
238 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
239 $timestamp->transferFromDOM($child);
240 $this->_gphotoTimestamp = $timestamp;
241 break;
242 case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
243 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
244 $commentingEnabled->transferFromDOM($child);
245 $this->_gphotoCommentingEnabled = $commentingEnabled;
246 break;
247 case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
248 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
249 $commentCount->transferFromDOM($child);
250 $this->_gphotoCommentCount = $commentCount;
251 break;
252 case $this->lookupNamespace('media') . ':' . 'group';
253 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
254 $mediaGroup->transferFromDOM($child);
255 $this->_mediaGroup = $mediaGroup;
256 break;
257 case $this->lookupNamespace('atom') . ':' . 'entry':
258 $entryClassName = $this->_entryClassName;
259 $tmpEntry = new Zend_Gdata_App_Entry($child);
260 $categories = $tmpEntry->getCategory();
261 foreach ($categories as $category) {
262 if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
263 $this->_entryKindClassMapping[$category->term] != "") {
264 $entryClassName = $this->_entryKindClassMapping[$category->term];
265 break;
266 } else {
267 require_once 'Zend/Gdata/App/Exception.php';
268 throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
269 }
270 }
271
272 $newEntry = new $entryClassName($child);
273 $newEntry->setHttpClient($this->getHttpClient());
274 $this->_entry[] = $newEntry;
275 break;
276 default:
277 parent::takeChildFromDOM($child);
278 break;
279 }
280 }
281
282 /**
283 * Get the value for this element's gphoto:id attribute.
284 *
285 * @see setGphotoId
286 * @return string The requested attribute.
287 */
288 public function getGphotoId()
289 {
290 return $this->_gphotoId;
291 }
292
293 /**
294 * Set the value for this element's gphoto:id attribute.
295 *
296 * @param string $value The desired value for this attribute.
297 * @return Zend_Gdata_Photos_Extension_Id The element being modified.
298 */
299 public function setGphotoId($value)
300 {
301 $this->_gphotoId = $value;
302 return $this;
303 }
304
305 /**
306 * Get the value for this element's gphoto:version attribute.
307 *
308 * @see setGphotoVersion
309 * @return string The requested attribute.
310 */
311 public function getGphotoVersion()
312 {
313 return $this->_gphotoVersion;
314 }
315
316 /**
317 * Set the value for this element's gphoto:version attribute.
318 *
319 * @param string $value The desired value for this attribute.
320 * @return Zend_Gdata_Photos_Extension_Version The element being modified.
321 */
322 public function setGphotoVersion($value)
323 {
324 $this->_gphotoVersion = $value;
325 return $this;
326 }
327
328 /**
329 * Get the value for this element's gphoto:albumid attribute.
330 *
331 * @see setGphotoAlbumId
332 * @return string The requested attribute.
333 */
334 public function getGphotoAlbumId()
335 {
336 return $this->_gphotoAlbumId;
337 }
338
339 /**
340 * Set the value for this element's gphoto:albumid attribute.
341 *
342 * @param string $value The desired value for this attribute.
343 * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified.
344 */
345 public function setGphotoAlbumId($value)
346 {
347 $this->_gphotoAlbumId = $value;
348 return $this;
349 }
350
351 /**
352 * Get the value for this element's gphoto:width attribute.
353 *
354 * @see setGphotoWidth
355 * @return string The requested attribute.
356 */
357 public function getGphotoWidth()
358 {
359 return $this->_gphotoWidth;
360 }
361
362 /**
363 * Set the value for this element's gphoto:width attribute.
364 *
365 * @param string $value The desired value for this attribute.
366 * @return Zend_Gdata_Photos_Extension_Width The element being modified.
367 */
368 public function setGphotoWidth($value)
369 {
370 $this->_gphotoWidth = $value;
371 return $this;
372 }
373
374 /**
375 * Get the value for this element's gphoto:height attribute.
376 *
377 * @see setGphotoHeight
378 * @return string The requested attribute.
379 */
380 public function getGphotoHeight()
381 {
382 return $this->_gphotoHeight;
383 }
384
385 /**
386 * Set the value for this element's gphoto:height attribute.
387 *
388 * @param string $value The desired value for this attribute.
389 * @return Zend_Gdata_Photos_Extension_Height The element being modified.
390 */
391 public function setGphotoHeight($value)
392 {
393 $this->_gphotoHeight = $value;
394 return $this;
395 }
396
397 /**
398 * Get the value for this element's gphoto:size attribute.
399 *
400 * @see setGphotoSize
401 * @return string The requested attribute.
402 */
403 public function getGphotoSize()
404 {
405 return $this->_gphotoSize;
406 }
407
408 /**
409 * Set the value for this element's gphoto:size attribute.
410 *
411 * @param string $value The desired value for this attribute.
412 * @return Zend_Gdata_Photos_Extension_Size The element being modified.
413 */
414 public function setGphotoSize($value)
415 {
416 $this->_gphotoSize = $value;
417 return $this;
418 }
419
420 /**
421 * Get the value for this element's gphoto:client attribute.
422 *
423 * @see setGphotoClient
424 * @return string The requested attribute.
425 */
426 public function getGphotoClient()
427 {
428 return $this->_gphotoClient;
429 }
430
431 /**
432 * Set the value for this element's gphoto:client attribute.
433 *
434 * @param string $value The desired value for this attribute.
435 * @return Zend_Gdata_Photos_Extension_Client The element being modified.
436 */
437 public function setGphotoClient($value)
438 {
439 $this->_gphotoClient = $value;
440 return $this;
441 }
442
443 /**
444 * Get the value for this element's gphoto:checksum attribute.
445 *
446 * @see setGphotoChecksum
447 * @return string The requested attribute.
448 */
449 public function getGphotoChecksum()
450 {
451 return $this->_gphotoChecksum;
452 }
453
454 /**
455 * Set the value for this element's gphoto:checksum attribute.
456 *
457 * @param string $value The desired value for this attribute.
458 * @return Zend_Gdata_Photos_Extension_Checksum The element being modified.
459 */
460 public function setGphotoChecksum($value)
461 {
462 $this->_gphotoChecksum = $value;
463 return $this;
464 }
465
466 /**
467 * Get the value for this element's gphoto:timestamp attribute.
468 *
469 * @see setGphotoTimestamp
470 * @return string The requested attribute.
471 */
472 public function getGphotoTimestamp()
473 {
474 return $this->_gphotoTimestamp;
475 }
476
477 /**
478 * Set the value for this element's gphoto:timestamp attribute.
479 *
480 * @param string $value The desired value for this attribute.
481 * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
482 */
483 public function setGphotoTimestamp($value)
484 {
485 $this->_gphotoTimestamp = $value;
486 return $this;
487 }
488
489 /**
490 * Get the value for this element's gphoto:commentCount attribute.
491 *
492 * @see setGphotoCommentCount
493 * @return string The requested attribute.
494 */
495 public function getGphotoCommentCount()
496 {
497 return $this->_gphotoCommentCount;
498 }
499
500 /**
501 * Set the value for this element's gphoto:commentCount attribute.
502 *
503 * @param string $value The desired value for this attribute.
504 * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
505 */
506 public function setGphotoCommentCount($value)
507 {
508 $this->_gphotoCommentCount = $value;
509 return $this;
510 }
511
512 /**
513 * Get the value for this element's gphoto:commentingEnabled attribute.
514 *
515 * @see setGphotoCommentingEnabled
516 * @return string The requested attribute.
517 */
518 public function getGphotoCommentingEnabled()
519 {
520 return $this->_gphotoCommentingEnabled;
521 }
522
523 /**
524 * Set the value for this element's gphoto:commentingEnabled attribute.
525 *
526 * @param string $value The desired value for this attribute.
527 * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
528 */
529 public function setGphotoCommentingEnabled($value)
530 {
531 $this->_gphotoCommentingEnabled = $value;
532 return $this;
533 }
534
535 /**
536 * Get the value for this element's media:group attribute.
537 *
538 * @see setMediaGroup
539 * @return string The requested attribute.
540 */
541 public function getMediaGroup()
542 {
543 return $this->_mediaGroup;
544 }
545
546 /**
547 * Set the value for this element's media:group attribute.
548 *
549 * @param string $value The desired value for this attribute.
550 * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
551 */
552 public function setMediaGroup($value)
553 {
554 $this->_mediaGroup = $value;
555 return $this;
556 }
557
558}
Note: See TracBrowser for help on using the repository browser.