2
0

Entry.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 Exif
  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_Entry
  23. */
  24. require_once 'Zend/Gdata/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Exif
  27. */
  28. require_once 'Zend/Gdata/Exif.php';
  29. /**
  30. * @see Zend_Gdata_Exif_Extension_Tags
  31. */
  32. require_once 'Zend/Gdata/Exif/Extension/Tags.php';
  33. /**
  34. * An Atom entry containing EXIF metadata.
  35. *
  36. * @category Zend
  37. * @package Zend_Gdata
  38. * @subpackage Exif
  39. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. */
  42. class Zend_Gdata_Exif_Entry extends Zend_Gdata_Entry
  43. {
  44. /**
  45. * The classname for individual feed elements.
  46. *
  47. * @var string
  48. */
  49. protected $_entryClassName = 'Zend_Gdata_Exif_Entry';
  50. /**
  51. * The tags that belong to the Exif group.
  52. *
  53. * @var string
  54. */
  55. protected $_tags = null;
  56. /**
  57. * Create a new instance.
  58. *
  59. * @param DOMElement $element (optional) DOMElement from which this
  60. * object should be constructed.
  61. */
  62. public function __construct($element = null)
  63. {
  64. $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces);
  65. parent::__construct($element);
  66. }
  67. /**
  68. * Retrieves a DOMElement which corresponds to this element and all
  69. * child properties. This is used to build an entry back into a DOM
  70. * and eventually XML text for sending to the server upon updates, or
  71. * for application storage/persistence.
  72. *
  73. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  74. * @return DOMElement The DOMElement representing this element and all
  75. * child properties.
  76. */
  77. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  78. {
  79. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  80. if ($this->_tags != null) {
  81. $element->appendChild($this->_tags->getDOM($element->ownerDocument));
  82. }
  83. return $element;
  84. }
  85. /**
  86. * Creates individual Entry objects of the appropriate type and
  87. * stores them as members of this entry based upon DOM data.
  88. *
  89. * @param DOMNode $child The DOMNode to process
  90. */
  91. protected function takeChildFromDOM($child)
  92. {
  93. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  94. switch ($absoluteNodeName) {
  95. case $this->lookupNamespace('exif') . ':' . 'tags':
  96. $tags = new Zend_Gdata_Exif_Extension_Tags();
  97. $tags->transferFromDOM($child);
  98. $this->_tags = $tags;
  99. break;
  100. default:
  101. parent::takeChildFromDOM($child);
  102. break;
  103. }
  104. }
  105. /**
  106. * Retrieve the tags for this entry.
  107. *
  108. * @see setTags
  109. * @return Zend_Gdata_Exif_Extension_Tags The requested object
  110. * or null if not set.
  111. */
  112. public function getTags()
  113. {
  114. return $this->_tags;
  115. }
  116. /**
  117. * Set the tags property for this entry. This property contains
  118. * various Exif data.
  119. *
  120. * This corresponds to the <exif:tags> property in the Google Data
  121. * protocol.
  122. *
  123. * @param Zend_Gdata_Exif_Extension_Tags $value The desired value
  124. * this element, or null to unset.
  125. * @return Zend_Gdata_Exif_Entry Provides a fluent interface
  126. */
  127. public function setTags($value)
  128. {
  129. $this->_tags = $value;
  130. return $this;
  131. }
  132. }