File indexing completed on 2024-12-22 05:36:45

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Photos
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Photos
0026  */
0027 // require_once 'Zend/Gdata/Photos.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Feed
0031  */
0032 // require_once 'Zend/Gdata/Feed.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Photos_PhotoEntry
0036  */
0037 // require_once 'Zend/Gdata/Photos/PhotoEntry.php';
0038 
0039 /**
0040  * Data model for a collection of photo entries, usually
0041  * provided by the Picasa servers.
0042  *
0043  * For information on requesting this feed from a server, see the
0044  * service class, Zend_Gdata_Photos.
0045  *
0046  * @category   Zend
0047  * @package    Zend_Gdata
0048  * @subpackage Photos
0049  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0050  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0051  */
0052 class Zend_Gdata_Photos_PhotoFeed extends Zend_Gdata_Feed
0053 {
0054 
0055     /**
0056      * gphoto:id element
0057      *
0058      * @var Zend_Gdata_Photos_Extension_Id
0059      */
0060     protected $_gphotoId = null;
0061 
0062     /**
0063      * gphoto:albumid element
0064      *
0065      * @var Zend_Gdata_Photos_Extension_AlbumId
0066      */
0067     protected $_gphotoAlbumId = null;
0068 
0069     /**
0070      * gphoto:version element
0071      *
0072      * @var Zend_Gdata_Photos_Extension_Version
0073      */
0074     protected $_gphotoVersion = null;
0075 
0076     /**
0077      * gphoto:width element
0078      *
0079      * @var Zend_Gdata_Photos_Extension_Width
0080      */
0081     protected $_gphotoWidth = null;
0082 
0083     /**
0084      * gphoto:height element
0085      *
0086      * @var Zend_Gdata_Photos_Extension_Height
0087      */
0088     protected $_gphotoHeight = null;
0089 
0090     /**
0091      * gphoto:size element
0092      *
0093      * @var Zend_Gdata_Photos_Extension_Size
0094      */
0095     protected $_gphotoSize = null;
0096 
0097     /**
0098      * gphoto:client element
0099      *
0100      * @var Zend_Gdata_Photos_Extension_Client
0101      */
0102     protected $_gphotoClient = null;
0103 
0104     /**
0105      * gphoto:checksum element
0106      *
0107      * @var Zend_Gdata_Photos_Extension_Checksum
0108      */
0109     protected $_gphotoChecksum = null;
0110 
0111     /**
0112      * gphoto:timestamp element
0113      *
0114      * @var Zend_Gdata_Photos_Extension_Timestamp
0115      */
0116     protected $_gphotoTimestamp = null;
0117 
0118     /**
0119      * gphoto:commentCount element
0120      *
0121      * @var Zend_Gdata_Photos_Extension_CommentCount
0122      */
0123     protected $_gphotoCommentCount = null;
0124 
0125     /**
0126      * gphoto:commentingEnabled element
0127      *
0128      * @var Zend_Gdata_Photos_Extension_CommentingEnabled
0129      */
0130     protected $_gphotoCommentingEnabled = null;
0131 
0132     /**
0133      * media:group element
0134      *
0135      * @var Zend_Gdata_Media_Extension_MediaGroup
0136      */
0137     protected $_mediaGroup = null;
0138 
0139     protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry';
0140     protected $_feedClassName = 'Zend_Gdata_Photos_PhotoFeed';
0141 
0142     protected $_entryKindClassMapping = array(
0143         'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
0144         'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
0145     );
0146 
0147     public function __construct($element = null)
0148     {
0149         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
0150         parent::__construct($element);
0151     }
0152 
0153     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0154     {
0155         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0156         if ($this->_gphotoId != null) {
0157             $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
0158         }
0159         if ($this->_gphotoVersion != null) {
0160             $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument));
0161         }
0162         if ($this->_gphotoWidth != null) {
0163             $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument));
0164         }
0165         if ($this->_gphotoHeight != null) {
0166             $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument));
0167         }
0168         if ($this->_gphotoSize != null) {
0169             $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument));
0170         }
0171         if ($this->_gphotoClient != null) {
0172             $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument));
0173         }
0174         if ($this->_gphotoChecksum != null) {
0175             $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument));
0176         }
0177         if ($this->_gphotoTimestamp != null) {
0178             $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
0179         }
0180         if ($this->_gphotoCommentingEnabled != null) {
0181             $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
0182         }
0183         if ($this->_gphotoCommentCount != null) {
0184             $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
0185         }
0186         if ($this->_mediaGroup != null) {
0187             $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
0188         }
0189 
0190         return $element;
0191     }
0192 
0193     protected function takeChildFromDOM($child)
0194     {
0195         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0196 
0197         switch ($absoluteNodeName) {
0198             case $this->lookupNamespace('gphoto') . ':' . 'id';
0199                 $id = new Zend_Gdata_Photos_Extension_Id();
0200                 $id->transferFromDOM($child);
0201                 $this->_gphotoId = $id;
0202                 break;
0203             case $this->lookupNamespace('gphoto') . ':' . 'version';
0204                 $version = new Zend_Gdata_Photos_Extension_Version();
0205                 $version->transferFromDOM($child);
0206                 $this->_gphotoVersion = $version;
0207                 break;
0208             case $this->lookupNamespace('gphoto') . ':' . 'albumid';
0209                 $albumid = new Zend_Gdata_Photos_Extension_AlbumId();
0210                 $albumid->transferFromDOM($child);
0211                 $this->_gphotoAlbumId = $albumid;
0212                 break;
0213             case $this->lookupNamespace('gphoto') . ':' . 'width';
0214                 $width = new Zend_Gdata_Photos_Extension_Width();
0215                 $width->transferFromDOM($child);
0216                 $this->_gphotoWidth = $width;
0217                 break;
0218             case $this->lookupNamespace('gphoto') . ':' . 'height';
0219                 $height = new Zend_Gdata_Photos_Extension_Height();
0220                 $height->transferFromDOM($child);
0221                 $this->_gphotoHeight = $height;
0222                 break;
0223             case $this->lookupNamespace('gphoto') . ':' . 'size';
0224                 $size = new Zend_Gdata_Photos_Extension_Size();
0225                 $size->transferFromDOM($child);
0226                 $this->_gphotoSize = $size;
0227                 break;
0228             case $this->lookupNamespace('gphoto') . ':' . 'client';
0229                 $client = new Zend_Gdata_Photos_Extension_Client();
0230                 $client->transferFromDOM($child);
0231                 $this->_gphotoClient = $client;
0232                 break;
0233             case $this->lookupNamespace('gphoto') . ':' . 'checksum';
0234                 $checksum = new Zend_Gdata_Photos_Extension_Checksum();
0235                 $checksum->transferFromDOM($child);
0236                 $this->_gphotoChecksum = $checksum;
0237                 break;
0238             case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
0239                 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
0240                 $timestamp->transferFromDOM($child);
0241                 $this->_gphotoTimestamp = $timestamp;
0242                 break;
0243             case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
0244                 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
0245                 $commentingEnabled->transferFromDOM($child);
0246                 $this->_gphotoCommentingEnabled = $commentingEnabled;
0247                 break;
0248             case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
0249                 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
0250                 $commentCount->transferFromDOM($child);
0251                 $this->_gphotoCommentCount = $commentCount;
0252                 break;
0253             case $this->lookupNamespace('media') . ':' . 'group';
0254                 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
0255                 $mediaGroup->transferFromDOM($child);
0256                 $this->_mediaGroup = $mediaGroup;
0257                 break;
0258             case $this->lookupNamespace('atom') . ':' . 'entry':
0259                 $entryClassName = $this->_entryClassName;
0260                 $tmpEntry = new Zend_Gdata_App_Entry($child);
0261                 $categories = $tmpEntry->getCategory();
0262                 foreach ($categories as $category) {
0263                     if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
0264                         $this->_entryKindClassMapping[$category->term] != "") {
0265                             $entryClassName = $this->_entryKindClassMapping[$category->term];
0266                             break;
0267                     } else {
0268                         // require_once 'Zend/Gdata/App/Exception.php';
0269                         throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
0270                     }
0271                 }
0272 
0273                 $newEntry = new $entryClassName($child);
0274                 $newEntry->setHttpClient($this->getHttpClient());
0275                 $this->_entry[] = $newEntry;
0276                 break;
0277             default:
0278                 parent::takeChildFromDOM($child);
0279                 break;
0280         }
0281     }
0282 
0283     /**
0284      * Get the value for this element's gphoto:id attribute.
0285      *
0286      * @see setGphotoId
0287      * @return string The requested attribute.
0288      */
0289     public function getGphotoId()
0290     {
0291         return $this->_gphotoId;
0292     }
0293 
0294     /**
0295      * Set the value for this element's gphoto:id attribute.
0296      *
0297      * @param string $value The desired value for this attribute.
0298      * @return Zend_Gdata_Photos_Extension_Id The element being modified.
0299      */
0300     public function setGphotoId($value)
0301     {
0302         $this->_gphotoId = $value;
0303         return $this;
0304     }
0305 
0306     /**
0307      * Get the value for this element's gphoto:version attribute.
0308      *
0309      * @see setGphotoVersion
0310      * @return string The requested attribute.
0311      */
0312     public function getGphotoVersion()
0313     {
0314         return $this->_gphotoVersion;
0315     }
0316 
0317     /**
0318      * Set the value for this element's gphoto:version attribute.
0319      *
0320      * @param string $value The desired value for this attribute.
0321      * @return Zend_Gdata_Photos_Extension_Version The element being modified.
0322      */
0323     public function setGphotoVersion($value)
0324     {
0325         $this->_gphotoVersion = $value;
0326         return $this;
0327     }
0328 
0329     /**
0330      * Get the value for this element's gphoto:albumid attribute.
0331      *
0332      * @see setGphotoAlbumId
0333      * @return string The requested attribute.
0334      */
0335     public function getGphotoAlbumId()
0336     {
0337         return $this->_gphotoAlbumId;
0338     }
0339 
0340     /**
0341      * Set the value for this element's gphoto:albumid attribute.
0342      *
0343      * @param string $value The desired value for this attribute.
0344      * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified.
0345      */
0346     public function setGphotoAlbumId($value)
0347     {
0348         $this->_gphotoAlbumId = $value;
0349         return $this;
0350     }
0351 
0352     /**
0353      * Get the value for this element's gphoto:width attribute.
0354      *
0355      * @see setGphotoWidth
0356      * @return string The requested attribute.
0357      */
0358     public function getGphotoWidth()
0359     {
0360         return $this->_gphotoWidth;
0361     }
0362 
0363     /**
0364      * Set the value for this element's gphoto:width attribute.
0365      *
0366      * @param string $value The desired value for this attribute.
0367      * @return Zend_Gdata_Photos_Extension_Width The element being modified.
0368      */
0369     public function setGphotoWidth($value)
0370     {
0371         $this->_gphotoWidth = $value;
0372         return $this;
0373     }
0374 
0375     /**
0376      * Get the value for this element's gphoto:height attribute.
0377      *
0378      * @see setGphotoHeight
0379      * @return string The requested attribute.
0380      */
0381     public function getGphotoHeight()
0382     {
0383         return $this->_gphotoHeight;
0384     }
0385 
0386     /**
0387      * Set the value for this element's gphoto:height attribute.
0388      *
0389      * @param string $value The desired value for this attribute.
0390      * @return Zend_Gdata_Photos_Extension_Height The element being modified.
0391      */
0392     public function setGphotoHeight($value)
0393     {
0394         $this->_gphotoHeight = $value;
0395         return $this;
0396     }
0397 
0398     /**
0399      * Get the value for this element's gphoto:size attribute.
0400      *
0401      * @see setGphotoSize
0402      * @return string The requested attribute.
0403      */
0404     public function getGphotoSize()
0405     {
0406         return $this->_gphotoSize;
0407     }
0408 
0409     /**
0410      * Set the value for this element's gphoto:size attribute.
0411      *
0412      * @param string $value The desired value for this attribute.
0413      * @return Zend_Gdata_Photos_Extension_Size The element being modified.
0414      */
0415     public function setGphotoSize($value)
0416     {
0417         $this->_gphotoSize = $value;
0418         return $this;
0419     }
0420 
0421     /**
0422      * Get the value for this element's gphoto:client attribute.
0423      *
0424      * @see setGphotoClient
0425      * @return string The requested attribute.
0426      */
0427     public function getGphotoClient()
0428     {
0429         return $this->_gphotoClient;
0430     }
0431 
0432     /**
0433      * Set the value for this element's gphoto:client attribute.
0434      *
0435      * @param string $value The desired value for this attribute.
0436      * @return Zend_Gdata_Photos_Extension_Client The element being modified.
0437      */
0438     public function setGphotoClient($value)
0439     {
0440         $this->_gphotoClient = $value;
0441         return $this;
0442     }
0443 
0444     /**
0445      * Get the value for this element's gphoto:checksum attribute.
0446      *
0447      * @see setGphotoChecksum
0448      * @return string The requested attribute.
0449      */
0450     public function getGphotoChecksum()
0451     {
0452         return $this->_gphotoChecksum;
0453     }
0454 
0455     /**
0456      * Set the value for this element's gphoto:checksum attribute.
0457      *
0458      * @param string $value The desired value for this attribute.
0459      * @return Zend_Gdata_Photos_Extension_Checksum The element being modified.
0460      */
0461     public function setGphotoChecksum($value)
0462     {
0463         $this->_gphotoChecksum = $value;
0464         return $this;
0465     }
0466 
0467     /**
0468      * Get the value for this element's gphoto:timestamp attribute.
0469      *
0470      * @see setGphotoTimestamp
0471      * @return string The requested attribute.
0472      */
0473     public function getGphotoTimestamp()
0474     {
0475         return $this->_gphotoTimestamp;
0476     }
0477 
0478     /**
0479      * Set the value for this element's gphoto:timestamp attribute.
0480      *
0481      * @param string $value The desired value for this attribute.
0482      * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
0483      */
0484     public function setGphotoTimestamp($value)
0485     {
0486         $this->_gphotoTimestamp = $value;
0487         return $this;
0488     }
0489 
0490     /**
0491      * Get the value for this element's gphoto:commentCount attribute.
0492      *
0493      * @see setGphotoCommentCount
0494      * @return string The requested attribute.
0495      */
0496     public function getGphotoCommentCount()
0497     {
0498         return $this->_gphotoCommentCount;
0499     }
0500 
0501     /**
0502      * Set the value for this element's gphoto:commentCount attribute.
0503      *
0504      * @param string $value The desired value for this attribute.
0505      * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
0506      */
0507     public function setGphotoCommentCount($value)
0508     {
0509         $this->_gphotoCommentCount = $value;
0510         return $this;
0511     }
0512 
0513     /**
0514      * Get the value for this element's gphoto:commentingEnabled attribute.
0515      *
0516      * @see setGphotoCommentingEnabled
0517      * @return string The requested attribute.
0518      */
0519     public function getGphotoCommentingEnabled()
0520     {
0521         return $this->_gphotoCommentingEnabled;
0522     }
0523 
0524     /**
0525      * Set the value for this element's gphoto:commentingEnabled attribute.
0526      *
0527      * @param string $value The desired value for this attribute.
0528      * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
0529      */
0530     public function setGphotoCommentingEnabled($value)
0531     {
0532         $this->_gphotoCommentingEnabled = $value;
0533         return $this;
0534     }
0535 
0536     /**
0537      * Get the value for this element's media:group attribute.
0538      *
0539      * @see setMediaGroup
0540      * @return string The requested attribute.
0541      */
0542     public function getMediaGroup()
0543     {
0544         return $this->_mediaGroup;
0545     }
0546 
0547     /**
0548      * Set the value for this element's media:group attribute.
0549      *
0550      * @param string $value The desired value for this attribute.
0551      * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
0552      */
0553     public function setMediaGroup($value)
0554     {
0555         $this->_mediaGroup = $value;
0556         return $this;
0557     }
0558 
0559 }