/zf/library/Zend/Gdata/Photos/PhotoEntry.php

http://github.com/eryx/php-framework-benchmark · PHP · 691 lines · 287 code · 67 blank · 337 comment · 14 complexity · 7e33f519d6884c570f47356aa8886bc2 MD5 · raw file

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