2
0

PhotoEntry.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Photos
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_MediaEntry
  23. */
  24. require_once 'Zend/Gdata/Media/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Photos_Extension_PhotoId
  27. */
  28. require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
  29. /**
  30. * @see Zend_Gdata_Photos_Extension_Version
  31. */
  32. require_once 'Zend/Gdata/Photos/Extension/Version.php';
  33. /**
  34. * @see Zend_Gdata_Photos_Extension_AlbumId
  35. */
  36. require_once 'Zend/Gdata/Photos/Extension/AlbumId.php';
  37. /**
  38. * @see Zend_Gdata_Photos_Extension_Id
  39. */
  40. require_once 'Zend/Gdata/Photos/Extension/Id.php';
  41. /**
  42. * @see Zend_Gdata_Photos_Extension_Width
  43. */
  44. require_once 'Zend/Gdata/Photos/Extension/Width.php';
  45. /**
  46. * @see Zend_Gdata_Photos_Extension_Height
  47. */
  48. require_once 'Zend/Gdata/Photos/Extension/Height.php';
  49. /**
  50. * @see Zend_Gdata_Photos_Extension_Size
  51. */
  52. require_once 'Zend/Gdata/Photos/Extension/Size.php';
  53. /**
  54. * @see Zend_Gdata_Photos_Extension_Client
  55. */
  56. require_once 'Zend/Gdata/Photos/Extension/Client.php';
  57. /**
  58. * @see Zend_Gdata_Photos_Extension_Checksum
  59. */
  60. require_once 'Zend/Gdata/Photos/Extension/Checksum.php';
  61. /**
  62. * @see Zend_Gdata_Photos_Extension_Timestamp
  63. */
  64. require_once 'Zend/Gdata/Photos/Extension/Timestamp.php';
  65. /**
  66. * @see Zend_Gdata_Photos_Extension_CommentingEnabled
  67. */
  68. require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php';
  69. /**
  70. * @see Zend_Gdata_Photos_Extension_CommentCount
  71. */
  72. require_once 'Zend/Gdata/Photos/Extension/CommentCount.php';
  73. /**
  74. * @see Zend_Gdata_Exif_Extension_Tags
  75. */
  76. require_once 'Zend/Gdata/Exif/Extension/Tags.php';
  77. /**
  78. * @see Zend_Gdata_Geo_Extension_GeoRssWhere
  79. */
  80. require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';
  81. /**
  82. * @see Zend_Gdata_App_Extension_Category
  83. */
  84. require_once 'Zend/Gdata/App/Extension/Category.php';
  85. /**
  86. * Data model class for a Comment Entry.
  87. *
  88. * To transfer user entries to and from the servers, including
  89. * creating new entries, refer to the service class,
  90. * Zend_Gdata_Photos.
  91. *
  92. * This class represents <atom:entry> in the Google Data protocol.
  93. *
  94. * @category Zend
  95. * @package Zend_Gdata
  96. * @subpackage Photos
  97. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  98. * @license http://framework.zend.com/license/new-bsd New BSD License
  99. */
  100. class Zend_Gdata_Photos_PhotoEntry extends Zend_Gdata_Media_Entry
  101. {
  102. protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry';
  103. /**
  104. * gphoto:id element
  105. *
  106. * @var Zend_Gdata_Photos_Extension_Id
  107. */
  108. protected $_gphotoId = null;
  109. /**
  110. * gphoto:albumid element
  111. *
  112. * @var Zend_Gdata_Photos_Extension_AlbumId
  113. */
  114. protected $_gphotoAlbumId = null;
  115. /**
  116. * gphoto:version element
  117. *
  118. * @var Zend_Gdata_Photos_Extension_Version
  119. */
  120. protected $_gphotoVersion = null;
  121. /**
  122. * gphoto:width element
  123. *
  124. * @var Zend_Gdata_Photos_Extension_Width
  125. */
  126. protected $_gphotoWidth = null;
  127. /**
  128. * gphoto:height element
  129. *
  130. * @var Zend_Gdata_Photos_Extension_Height
  131. */
  132. protected $_gphotoHeight = null;
  133. /**
  134. * gphoto:size element
  135. *
  136. * @var Zend_Gdata_Photos_Extension_Size
  137. */
  138. protected $_gphotoSize = null;
  139. /**
  140. * gphoto:client element
  141. *
  142. * @var Zend_Gdata_Photos_Extension_Client
  143. */
  144. protected $_gphotoClient = null;
  145. /**
  146. * gphoto:checksum element
  147. *
  148. * @var Zend_Gdata_Photos_Extension_Checksum
  149. */
  150. protected $_gphotoChecksum = null;
  151. /**
  152. * gphoto:timestamp element
  153. *
  154. * @var Zend_Gdata_Photos_Extension_Timestamp
  155. */
  156. protected $_gphotoTimestamp = null;
  157. /**
  158. * gphoto:commentCount element
  159. *
  160. * @var Zend_Gdata_Photos_Extension_CommentCount
  161. */
  162. protected $_gphotoCommentCount = null;
  163. /**
  164. * gphoto:commentingEnabled element
  165. *
  166. * @var Zend_Gdata_Photos_Extension_CommentingEnabled
  167. */
  168. protected $_gphotoCommentingEnabled = null;
  169. /**
  170. * exif:tags element
  171. *
  172. * @var Zend_Gdata_Exif_Extension_Tags
  173. */
  174. protected $_exifTags = null;
  175. /**
  176. * georss:where element
  177. *
  178. * @var Zend_Gdata_Geo_Extension_GeoRssWhere
  179. */
  180. protected $_geoRssWhere = null;
  181. /**
  182. * Create a new instance.
  183. *
  184. * @param DOMElement $element (optional) DOMElement from which this
  185. * object should be constructed.
  186. */
  187. public function __construct($element = null)
  188. {
  189. $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
  190. parent::__construct($element);
  191. $category = new Zend_Gdata_App_Extension_Category(
  192. 'http://schemas.google.com/photos/2007#photo',
  193. 'http://schemas.google.com/g/2005#kind');
  194. $this->setCategory(array($category));
  195. }
  196. /**
  197. * Retrieves a DOMElement which corresponds to this element and all
  198. * child properties. This is used to build an entry back into a DOM
  199. * and eventually XML text for application storage/persistence.
  200. *
  201. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  202. * @return DOMElement The DOMElement representing this element and all
  203. * child properties.
  204. */
  205. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  206. {
  207. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  208. if ($this->_gphotoAlbumId !== null) {
  209. $element->appendChild($this->_gphotoAlbumId->getDOM($element->ownerDocument));
  210. }
  211. if ($this->_gphotoId !== null) {
  212. $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
  213. }
  214. if ($this->_gphotoVersion !== null) {
  215. $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument));
  216. }
  217. if ($this->_gphotoWidth !== null) {
  218. $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument));
  219. }
  220. if ($this->_gphotoHeight !== null) {
  221. $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument));
  222. }
  223. if ($this->_gphotoSize !== null) {
  224. $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument));
  225. }
  226. if ($this->_gphotoClient !== null) {
  227. $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument));
  228. }
  229. if ($this->_gphotoChecksum !== null) {
  230. $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument));
  231. }
  232. if ($this->_gphotoTimestamp !== null) {
  233. $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
  234. }
  235. if ($this->_gphotoCommentingEnabled !== null) {
  236. $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
  237. }
  238. if ($this->_gphotoCommentCount !== null) {
  239. $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
  240. }
  241. if ($this->_exifTags !== null) {
  242. $element->appendChild($this->_exifTags->getDOM($element->ownerDocument));
  243. }
  244. if ($this->_geoRssWhere !== null) {
  245. $element->appendChild($this->_geoRssWhere->getDOM($element->ownerDocument));
  246. }
  247. return $element;
  248. }
  249. /**
  250. * Creates individual Entry objects of the appropriate type and
  251. * stores them as members of this entry based upon DOM data.
  252. *
  253. * @param DOMNode $child The DOMNode to process
  254. */
  255. protected function takeChildFromDOM($child)
  256. {
  257. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  258. switch ($absoluteNodeName) {
  259. case $this->lookupNamespace('gphoto') . ':' . 'albumid';
  260. $albumId = new Zend_Gdata_Photos_Extension_AlbumId();
  261. $albumId->transferFromDOM($child);
  262. $this->_gphotoAlbumId = $albumId;
  263. break;
  264. case $this->lookupNamespace('gphoto') . ':' . 'id';
  265. $id = new Zend_Gdata_Photos_Extension_Id();
  266. $id->transferFromDOM($child);
  267. $this->_gphotoId = $id;
  268. break;
  269. case $this->lookupNamespace('gphoto') . ':' . 'version';
  270. $version = new Zend_Gdata_Photos_Extension_Version();
  271. $version->transferFromDOM($child);
  272. $this->_gphotoVersion = $version;
  273. break;
  274. case $this->lookupNamespace('gphoto') . ':' . 'width';
  275. $width = new Zend_Gdata_Photos_Extension_Width();
  276. $width->transferFromDOM($child);
  277. $this->_gphotoWidth = $width;
  278. break;
  279. case $this->lookupNamespace('gphoto') . ':' . 'height';
  280. $height = new Zend_Gdata_Photos_Extension_Height();
  281. $height->transferFromDOM($child);
  282. $this->_gphotoHeight = $height;
  283. break;
  284. case $this->lookupNamespace('gphoto') . ':' . 'size';
  285. $size = new Zend_Gdata_Photos_Extension_Size();
  286. $size->transferFromDOM($child);
  287. $this->_gphotoSize = $size;
  288. break;
  289. case $this->lookupNamespace('gphoto') . ':' . 'client';
  290. $client = new Zend_Gdata_Photos_Extension_Client();
  291. $client->transferFromDOM($child);
  292. $this->_gphotoClient = $client;
  293. break;
  294. case $this->lookupNamespace('gphoto') . ':' . 'checksum';
  295. $checksum = new Zend_Gdata_Photos_Extension_Checksum();
  296. $checksum->transferFromDOM($child);
  297. $this->_gphotoChecksum = $checksum;
  298. break;
  299. case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
  300. $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
  301. $timestamp->transferFromDOM($child);
  302. $this->_gphotoTimestamp = $timestamp;
  303. break;
  304. case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
  305. $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
  306. $commentingEnabled->transferFromDOM($child);
  307. $this->_gphotoCommentingEnabled = $commentingEnabled;
  308. break;
  309. case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
  310. $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
  311. $commentCount->transferFromDOM($child);
  312. $this->_gphotoCommentCount = $commentCount;
  313. break;
  314. case $this->lookupNamespace('exif') . ':' . 'tags';
  315. $exifTags = new Zend_Gdata_Exif_Extension_Tags();
  316. $exifTags->transferFromDOM($child);
  317. $this->_exifTags = $exifTags;
  318. break;
  319. case $this->lookupNamespace('georss') . ':' . 'where';
  320. $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere();
  321. $geoRssWhere->transferFromDOM($child);
  322. $this->_geoRssWhere = $geoRssWhere;
  323. break;
  324. default:
  325. parent::takeChildFromDOM($child);
  326. break;
  327. }
  328. }
  329. /**
  330. * Get the value for this element's gphoto:albumid attribute.
  331. *
  332. * @see setGphotoAlbumId
  333. * @return string The requested attribute.
  334. */
  335. public function getGphotoAlbumId()
  336. {
  337. return $this->_gphotoAlbumId;
  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. * Get the value for this element's gphoto:id attribute.
  352. *
  353. * @see setGphotoId
  354. * @return string The requested attribute.
  355. */
  356. public function getGphotoId()
  357. {
  358. return $this->_gphotoId;
  359. }
  360. /**
  361. * Set the value for this element's gphoto:id attribute.
  362. *
  363. * @param string $value The desired value for this attribute.
  364. * @return Zend_Gdata_Photos_Extension_Id The element being modified.
  365. */
  366. public function setGphotoId($value)
  367. {
  368. $this->_gphotoId = $value;
  369. return $this;
  370. }
  371. /**
  372. * Get the value for this element's gphoto:version attribute.
  373. *
  374. * @see setGphotoVersion
  375. * @return string The requested attribute.
  376. */
  377. public function getGphotoVersion()
  378. {
  379. return $this->_gphotoVersion;
  380. }
  381. /**
  382. * Set the value for this element's gphoto:version attribute.
  383. *
  384. * @param string $value The desired value for this attribute.
  385. * @return Zend_Gdata_Photos_Extension_Version The element being modified.
  386. */
  387. public function setGphotoVersion($value)
  388. {
  389. $this->_gphotoVersion = $value;
  390. return $this;
  391. }
  392. /**
  393. * Get the value for this element's gphoto:width attribute.
  394. *
  395. * @see setGphotoWidth
  396. * @return string The requested attribute.
  397. */
  398. public function getGphotoWidth()
  399. {
  400. return $this->_gphotoWidth;
  401. }
  402. /**
  403. * Set the value for this element's gphoto:width attribute.
  404. *
  405. * @param string $value The desired value for this attribute.
  406. * @return Zend_Gdata_Photos_Extension_Width The element being modified.
  407. */
  408. public function setGphotoWidth($value)
  409. {
  410. $this->_gphotoWidth = $value;
  411. return $this;
  412. }
  413. /**
  414. * Get the value for this element's gphoto:height attribute.
  415. *
  416. * @see setGphotoHeight
  417. * @return string The requested attribute.
  418. */
  419. public function getGphotoHeight()
  420. {
  421. return $this->_gphotoHeight;
  422. }
  423. /**
  424. * Set the value for this element's gphoto:height attribute.
  425. *
  426. * @param string $value The desired value for this attribute.
  427. * @return Zend_Gdata_Photos_Extension_Height The element being modified.
  428. */
  429. public function setGphotoHeight($value)
  430. {
  431. $this->_gphotoHeight = $value;
  432. return $this;
  433. }
  434. /**
  435. * Get the value for this element's gphoto:size attribute.
  436. *
  437. * @see setGphotoSize
  438. * @return string The requested attribute.
  439. */
  440. public function getGphotoSize()
  441. {
  442. return $this->_gphotoSize;
  443. }
  444. /**
  445. * Set the value for this element's gphoto:size attribute.
  446. *
  447. * @param string $value The desired value for this attribute.
  448. * @return Zend_Gdata_Photos_Extension_Size The element being modified.
  449. */
  450. public function setGphotoSize($value)
  451. {
  452. $this->_gphotoSize = $value;
  453. return $this;
  454. }
  455. /**
  456. * Get the value for this element's gphoto:client attribute.
  457. *
  458. * @see setGphotoClient
  459. * @return string The requested attribute.
  460. */
  461. public function getGphotoClient()
  462. {
  463. return $this->_gphotoClient;
  464. }
  465. /**
  466. * Set the value for this element's gphoto:client attribute.
  467. *
  468. * @param string $value The desired value for this attribute.
  469. * @return Zend_Gdata_Photos_Extension_Client The element being modified.
  470. */
  471. public function setGphotoClient($value)
  472. {
  473. $this->_gphotoClient = $value;
  474. return $this;
  475. }
  476. /**
  477. * Get the value for this element's gphoto:checksum attribute.
  478. *
  479. * @see setGphotoChecksum
  480. * @return string The requested attribute.
  481. */
  482. public function getGphotoChecksum()
  483. {
  484. return $this->_gphotoChecksum;
  485. }
  486. /**
  487. * Set the value for this element's gphoto:checksum attribute.
  488. *
  489. * @param string $value The desired value for this attribute.
  490. * @return Zend_Gdata_Photos_Extension_Checksum The element being modified.
  491. */
  492. public function setGphotoChecksum($value)
  493. {
  494. $this->_gphotoChecksum = $value;
  495. return $this;
  496. }
  497. /**
  498. * Get the value for this element's gphoto:timestamp attribute.
  499. *
  500. * @see setGphotoTimestamp
  501. * @return string The requested attribute.
  502. */
  503. public function getGphotoTimestamp()
  504. {
  505. return $this->_gphotoTimestamp;
  506. }
  507. /**
  508. * Set the value for this element's gphoto:timestamp attribute.
  509. *
  510. * @param string $value The desired value for this attribute.
  511. * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
  512. */
  513. public function setGphotoTimestamp($value)
  514. {
  515. $this->_gphotoTimestamp = $value;
  516. return $this;
  517. }
  518. /**
  519. * Get the value for this element's gphoto:commentCount attribute.
  520. *
  521. * @see setGphotoCommentCount
  522. * @return string The requested attribute.
  523. */
  524. public function getGphotoCommentCount()
  525. {
  526. return $this->_gphotoCommentCount;
  527. }
  528. /**
  529. * Set the value for this element's gphoto:commentCount attribute.
  530. *
  531. * @param string $value The desired value for this attribute.
  532. * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
  533. */
  534. public function setGphotoCommentCount($value)
  535. {
  536. $this->_gphotoCommentCount = $value;
  537. return $this;
  538. }
  539. /**
  540. * Get the value for this element's gphoto:commentingEnabled attribute.
  541. *
  542. * @see setGphotoCommentingEnabled
  543. * @return string The requested attribute.
  544. */
  545. public function getGphotoCommentingEnabled()
  546. {
  547. return $this->_gphotoCommentingEnabled;
  548. }
  549. /**
  550. * Set the value for this element's gphoto:commentingEnabled attribute.
  551. *
  552. * @param string $value The desired value for this attribute.
  553. * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
  554. */
  555. public function setGphotoCommentingEnabled($value)
  556. {
  557. $this->_gphotoCommentingEnabled = $value;
  558. return $this;
  559. }
  560. /**
  561. * Get the value for this element's exif:tags attribute.
  562. *
  563. * @see setExifTags
  564. * @return string The requested attribute.
  565. */
  566. public function getExifTags()
  567. {
  568. return $this->_exifTags;
  569. }
  570. /**
  571. * Set the value for this element's exif:tags attribute.
  572. *
  573. * @param string $value The desired value for this attribute.
  574. * @return Zend_Gdata_Exif_Extension_Tags The element being modified.
  575. */
  576. public function setExifTags($value)
  577. {
  578. $this->_exifTags = $value;
  579. return $this;
  580. }
  581. /**
  582. * Get the value for this element's georss:where attribute.
  583. *
  584. * @see setGeoRssWhere
  585. * @return string The requested attribute.
  586. */
  587. public function getGeoRssWhere()
  588. {
  589. return $this->_geoRssWhere;
  590. }
  591. /**
  592. * Set the value for this element's georss:where attribute.
  593. *
  594. * @param string $value The desired value for this attribute.
  595. * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
  596. */
  597. public function setGeoRssWhere($value)
  598. {
  599. $this->_geoRssWhere = $value;
  600. return $this;
  601. }
  602. /**
  603. * Get the value for this element's media:group attribute.
  604. *
  605. * @see setMediaGroup
  606. * @return string The requested attribute.
  607. */
  608. public function getMediaGroup()
  609. {
  610. return $this->_mediaGroup;
  611. }
  612. /**
  613. * Set the value for this element's media:group attribute.
  614. *
  615. * @param string $value The desired value for this attribute.
  616. * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
  617. */
  618. public function setMediaGroup($value)
  619. {
  620. $this->_mediaGroup = $value;
  621. return $this;
  622. }
  623. }