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_Photos
27 require_once 'Zend/Gdata/Photos.php';
30 * @see Zend_Gdata_Feed
32 require_once 'Zend/Gdata/Feed.php';
35 * @see Zend_Gdata_Photos_PhotoEntry
37 require_once 'Zend/Gdata/Photos/PhotoEntry.php';
40 * Data model for a collection of photo entries, usually
41 * provided by the Picasa servers.
43 * For information on requesting this feed from a server, see the
44 * service class, Zend_Gdata_Photos.
49 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
50 * @license http://framework.zend.com/license/new-bsd New BSD License
52 class Zend_Gdata_Photos_PhotoFeed extends Zend_Gdata_Feed
58 * @var Zend_Gdata_Photos_Extension_Id
60 protected $_gphotoId = null;
63 * gphoto:albumid element
65 * @var Zend_Gdata_Photos_Extension_AlbumId
67 protected $_gphotoAlbumId = null;
70 * gphoto:version element
72 * @var Zend_Gdata_Photos_Extension_Version
74 protected $_gphotoVersion = null;
77 * gphoto:width element
79 * @var Zend_Gdata_Photos_Extension_Width
81 protected $_gphotoWidth = null;
84 * gphoto:height element
86 * @var Zend_Gdata_Photos_Extension_Height
88 protected $_gphotoHeight = null;
93 * @var Zend_Gdata_Photos_Extension_Size
95 protected $_gphotoSize = null;
98 * gphoto:client element
100 * @var Zend_Gdata_Photos_Extension_Client
102 protected $_gphotoClient = null;
105 * gphoto:checksum element
107 * @var Zend_Gdata_Photos_Extension_Checksum
109 protected $_gphotoChecksum = null;
112 * gphoto:timestamp element
114 * @var Zend_Gdata_Photos_Extension_Timestamp
116 protected $_gphotoTimestamp = null;
119 * gphoto:commentCount element
121 * @var Zend_Gdata_Photos_Extension_CommentCount
123 protected $_gphotoCommentCount = null;
126 * gphoto:commentingEnabled element
128 * @var Zend_Gdata_Photos_Extension_CommentingEnabled
130 protected $_gphotoCommentingEnabled = null;
133 * media:group element
135 * @var Zend_Gdata_Media_Extension_MediaGroup
137 protected $_mediaGroup = null;
139 protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry';
140 protected $_feedClassName = 'Zend_Gdata_Photos_PhotoFeed';
142 protected $_entryKindClassMapping = array(
143 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
144 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
147 public function __construct($element = null)
149 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
150 parent::__construct($element);
153 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
155 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
156 if ($this->_gphotoId != null) {
157 $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
159 if ($this->_gphotoVersion != null) {
160 $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument));
162 if ($this->_gphotoWidth != null) {
163 $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument));
165 if ($this->_gphotoHeight != null) {
166 $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument));
168 if ($this->_gphotoSize != null) {
169 $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument));
171 if ($this->_gphotoClient != null) {
172 $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument));
174 if ($this->_gphotoChecksum != null) {
175 $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument));
177 if ($this->_gphotoTimestamp != null) {
178 $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
180 if ($this->_gphotoCommentingEnabled != null) {
181 $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
183 if ($this->_gphotoCommentCount != null) {
184 $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
186 if ($this->_mediaGroup != null) {
187 $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
193 protected function takeChildFromDOM($child)
195 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
197 switch ($absoluteNodeName) {
198 case $this->lookupNamespace('gphoto') . ':' . 'id';
199 $id = new Zend_Gdata_Photos_Extension_Id();
200 $id->transferFromDOM($child);
201 $this->_gphotoId = $id;
203 case $this->lookupNamespace('gphoto') . ':' . 'version';
204 $version = new Zend_Gdata_Photos_Extension_Version();
205 $version->transferFromDOM($child);
206 $this->_gphotoVersion = $version;
208 case $this->lookupNamespace('gphoto') . ':' . 'albumid';
209 $albumid = new Zend_Gdata_Photos_Extension_AlbumId();
210 $albumid->transferFromDOM($child);
211 $this->_gphotoAlbumId = $albumid;
213 case $this->lookupNamespace('gphoto') . ':' . 'width';
214 $width = new Zend_Gdata_Photos_Extension_Width();
215 $width->transferFromDOM($child);
216 $this->_gphotoWidth = $width;
218 case $this->lookupNamespace('gphoto') . ':' . 'height';
219 $height = new Zend_Gdata_Photos_Extension_Height();
220 $height->transferFromDOM($child);
221 $this->_gphotoHeight = $height;
223 case $this->lookupNamespace('gphoto') . ':' . 'size';
224 $size = new Zend_Gdata_Photos_Extension_Size();
225 $size->transferFromDOM($child);
226 $this->_gphotoSize = $size;
228 case $this->lookupNamespace('gphoto') . ':' . 'client';
229 $client = new Zend_Gdata_Photos_Extension_Client();
230 $client->transferFromDOM($child);
231 $this->_gphotoClient = $client;
233 case $this->lookupNamespace('gphoto') . ':' . 'checksum';
234 $checksum = new Zend_Gdata_Photos_Extension_Checksum();
235 $checksum->transferFromDOM($child);
236 $this->_gphotoChecksum = $checksum;
238 case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
239 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
240 $timestamp->transferFromDOM($child);
241 $this->_gphotoTimestamp = $timestamp;
243 case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
244 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
245 $commentingEnabled->transferFromDOM($child);
246 $this->_gphotoCommentingEnabled = $commentingEnabled;
248 case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
249 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
250 $commentCount->transferFromDOM($child);
251 $this->_gphotoCommentCount = $commentCount;
253 case $this->lookupNamespace('media') . ':' . 'group';
254 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
255 $mediaGroup->transferFromDOM($child);
256 $this->_mediaGroup = $mediaGroup;
258 case $this->lookupNamespace('atom') . ':' . 'entry':
259 $entryClassName = $this->_entryClassName;
260 $tmpEntry = new Zend_Gdata_App_Entry($child);
261 $categories = $tmpEntry->getCategory();
262 foreach ($categories as $category) {
263 if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
264 $this->_entryKindClassMapping[$category->term] != "") {
265 $entryClassName = $this->_entryKindClassMapping[$category->term];
268 require_once 'Zend/Gdata/App/Exception.php';
269 throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
273 $newEntry = new $entryClassName($child);
274 $newEntry->setHttpClient($this->getHttpClient());
275 $this->_entry[] = $newEntry;
278 parent::takeChildFromDOM($child);
284 * Get the value for this element's gphoto:id attribute.
287 * @return string The requested attribute.
289 public function getGphotoId()
291 return $this->_gphotoId;
295 * Set the value for this element's gphoto:id attribute.
297 * @param string $value The desired value for this attribute.
298 * @return Zend_Gdata_Photos_Extension_Id The element being modified.
300 public function setGphotoId($value)
302 $this->_gphotoId = $value;
307 * Get the value for this element's gphoto:version attribute.
309 * @see setGphotoVersion
310 * @return string The requested attribute.
312 public function getGphotoVersion()
314 return $this->_gphotoVersion;
318 * Set the value for this element's gphoto:version attribute.
320 * @param string $value The desired value for this attribute.
321 * @return Zend_Gdata_Photos_Extension_Version The element being modified.
323 public function setGphotoVersion($value)
325 $this->_gphotoVersion = $value;
330 * Get the value for this element's gphoto:albumid attribute.
332 * @see setGphotoAlbumId
333 * @return string The requested attribute.
335 public function getGphotoAlbumId()
337 return $this->_gphotoAlbumId;
341 * Set the value for this element's gphoto:albumid attribute.
343 * @param string $value The desired value for this attribute.
344 * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified.
346 public function setGphotoAlbumId($value)
348 $this->_gphotoAlbumId = $value;
353 * Get the value for this element's gphoto:width attribute.
355 * @see setGphotoWidth
356 * @return string The requested attribute.
358 public function getGphotoWidth()
360 return $this->_gphotoWidth;
364 * Set the value for this element's gphoto:width attribute.
366 * @param string $value The desired value for this attribute.
367 * @return Zend_Gdata_Photos_Extension_Width The element being modified.
369 public function setGphotoWidth($value)
371 $this->_gphotoWidth = $value;
376 * Get the value for this element's gphoto:height attribute.
378 * @see setGphotoHeight
379 * @return string The requested attribute.
381 public function getGphotoHeight()
383 return $this->_gphotoHeight;
387 * Set the value for this element's gphoto:height attribute.
389 * @param string $value The desired value for this attribute.
390 * @return Zend_Gdata_Photos_Extension_Height The element being modified.
392 public function setGphotoHeight($value)
394 $this->_gphotoHeight = $value;
399 * Get the value for this element's gphoto:size attribute.
402 * @return string The requested attribute.
404 public function getGphotoSize()
406 return $this->_gphotoSize;
410 * Set the value for this element's gphoto:size attribute.
412 * @param string $value The desired value for this attribute.
413 * @return Zend_Gdata_Photos_Extension_Size The element being modified.
415 public function setGphotoSize($value)
417 $this->_gphotoSize = $value;
422 * Get the value for this element's gphoto:client attribute.
424 * @see setGphotoClient
425 * @return string The requested attribute.
427 public function getGphotoClient()
429 return $this->_gphotoClient;
433 * Set the value for this element's gphoto:client attribute.
435 * @param string $value The desired value for this attribute.
436 * @return Zend_Gdata_Photos_Extension_Client The element being modified.
438 public function setGphotoClient($value)
440 $this->_gphotoClient = $value;
445 * Get the value for this element's gphoto:checksum attribute.
447 * @see setGphotoChecksum
448 * @return string The requested attribute.
450 public function getGphotoChecksum()
452 return $this->_gphotoChecksum;
456 * Set the value for this element's gphoto:checksum attribute.
458 * @param string $value The desired value for this attribute.
459 * @return Zend_Gdata_Photos_Extension_Checksum The element being modified.
461 public function setGphotoChecksum($value)
463 $this->_gphotoChecksum = $value;
468 * Get the value for this element's gphoto:timestamp attribute.
470 * @see setGphotoTimestamp
471 * @return string The requested attribute.
473 public function getGphotoTimestamp()
475 return $this->_gphotoTimestamp;
479 * Set the value for this element's gphoto:timestamp attribute.
481 * @param string $value The desired value for this attribute.
482 * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
484 public function setGphotoTimestamp($value)
486 $this->_gphotoTimestamp = $value;
491 * Get the value for this element's gphoto:commentCount attribute.
493 * @see setGphotoCommentCount
494 * @return string The requested attribute.
496 public function getGphotoCommentCount()
498 return $this->_gphotoCommentCount;
502 * Set the value for this element's gphoto:commentCount attribute.
504 * @param string $value The desired value for this attribute.
505 * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
507 public function setGphotoCommentCount($value)
509 $this->_gphotoCommentCount = $value;
514 * Get the value for this element's gphoto:commentingEnabled attribute.
516 * @see setGphotoCommentingEnabled
517 * @return string The requested attribute.
519 public function getGphotoCommentingEnabled()
521 return $this->_gphotoCommentingEnabled;
525 * Set the value for this element's gphoto:commentingEnabled attribute.
527 * @param string $value The desired value for this attribute.
528 * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
530 public function setGphotoCommentingEnabled($value)
532 $this->_gphotoCommentingEnabled = $value;
537 * Get the value for this element's media:group attribute.
540 * @return string The requested attribute.
542 public function getMediaGroup()
544 return $this->_mediaGroup;
548 * Set the value for this element's media:group attribute.
550 * @param string $value The desired value for this attribute.
551 * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
553 public function setMediaGroup($value)
555 $this->_mediaGroup = $value;