/zf/library/Zend/Gdata/Exif/Entry.php

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