8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * @see Zend_Gdata_Exif
32 require_once 'Zend/Gdata/Exif.php';
35 * @see Zend_Gdata_Exif_Extension_Distance
37 require_once 'Zend/Gdata/Exif/Extension/Distance.php';
40 * @see Zend_Gdata_Exif_Extension_Exposure
42 require_once 'Zend/Gdata/Exif/Extension/Exposure.php';
45 * @see Zend_Gdata_Exif_Extension_Flash
47 require_once 'Zend/Gdata/Exif/Extension/Flash.php';
50 * @see Zend_Gdata_Exif_Extension_FocalLength
52 require_once 'Zend/Gdata/Exif/Extension/FocalLength.php';
55 * @see Zend_Gdata_Exif_Extension_FStop
57 require_once 'Zend/Gdata/Exif/Extension/FStop.php';
60 * @see Zend_Gdata_Exif_Extension_ImageUniqueId
62 require_once 'Zend/Gdata/Exif/Extension/ImageUniqueId.php';
65 * @see Zend_Gdata_Exif_Extension_Iso
67 require_once 'Zend/Gdata/Exif/Extension/Iso.php';
70 * @see Zend_Gdata_Exif_Extension_Make
72 require_once 'Zend/Gdata/Exif/Extension/Make.php';
75 * @see Zend_Gdata_Exif_Extension_Model
77 require_once 'Zend/Gdata/Exif/Extension/Model.php';
80 * @see Zend_Gdata_Exif_Extension_Time
82 require_once 'Zend/Gdata/Exif/Extension/Time.php';
85 * Represents the exif:tags element used by the Gdata Exif extensions.
90 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
91 * @license http://framework.zend.com/license/new-bsd New BSD License
93 class Zend_Gdata_Exif_Extension_Tags extends Zend_Gdata_Extension
96 protected $_rootNamespace = 'exif';
97 protected $_rootElement = 'tags';
100 * exif:distance value
102 * @var Zend_Gdata_Exif_Extension_Distance
104 protected $_distance = null;
107 * exif:exposure value
109 * @var Zend_Gdata_Exif_Extension_Exposure
111 protected $_exposure = null;
116 * @var Zend_Gdata_Exif_Extension_Flash
118 protected $_flash = null;
121 * exif:focalLength value
123 * @var Zend_Gdata_Exif_Extension_FocalLength
125 protected $_focalLength = null;
130 * @var Zend_Gdata_Exif_Extension_FStop
132 protected $_fStop = null;
135 * exif:imageUniqueID value
137 * @var Zend_Gdata_Exif_Extension_ImageUniqueId
139 protected $_imageUniqueId = null;
144 * @var Zend_Gdata_Exif_Extension_Iso
146 protected $_iso = null;
151 * @var Zend_Gdata_Exif_Extension_Make
153 protected $_make = null;
158 * @var Zend_Gdata_Exif_Extension_Model
160 protected $_model = null;
165 * @var Zend_Gdata_Exif_Extension_Time
167 protected $_time = null;
170 * Constructs a new Zend_Gdata_Exif_Extension_Tags object.
172 * @param Zend_Gdata_Exif_Extension_Distance $distance (optional) The exif:distance
173 * value to be set in the constructed object.
174 * @param Zend_Gdata_Exif_Extension_Exposure $exposure (optional) The exif:exposure
175 * value to be set in the constructed object.
176 * @param Zend_Gdata_Exif_Extension_Flash $flash (optional) The exif:flash
177 * value to be set in the constructed object.
178 * @param Zend_Gdata_Exif_Extension_FocalLength$focalLength (optional) The exif:focallength
179 * value to be set in the constructed object.
180 * @param Zend_Gdata_Exif_Extension_FStop $fStop (optional) The exif:fstop
181 * value to be set in the constructed object.
182 * @param Zend_Gdata_Exif_Extension_ImageUniqueId $imageUniqueId (optional) The exif:imageUniqueID
183 * value to be set in the constructed object.
184 * @param Zend_Gdata_Exif_Extension_Iso $iso (optional) The exif:iso
185 * value to be set in the constructed object.
186 * @param Zend_Gdata_Exif_Extension_Make $make (optional) The exif:make
187 * value to be set in the constructed object.
188 * @param Zend_Gdata_Exif_Extension_Model $model (optional) The exif:model
189 * value to be set in the constructed object.
190 * @param Zend_Gdata_Exif_Extension_Time $time (optional) The exif:time
191 * value to be set in the constructed object.
193 public function __construct($distance = null, $exposure = null,
194 $flash = null, $focalLength = null, $fStop = null,
195 $imageUniqueId = null, $iso = null, $make = null,
196 $model = null, $time = null)
198 $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces);
199 parent::__construct();
200 $this->setDistance($distance);
201 $this->setExposure($exposure);
202 $this->setFlash($flash);
203 $this->setFocalLength($focalLength);
204 $this->setFStop($fStop);
205 $this->setImageUniqueId($imageUniqueId);
207 $this->setMake($make);
208 $this->setModel($model);
209 $this->setTime($time);
213 * Retrieves a DOMElement which corresponds to this element and all
214 * child properties. This is used to build an entry back into a DOM
215 * and eventually XML text for application storage/persistence.
217 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
218 * @return DOMElement The DOMElement representing this element and all
221 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
223 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
224 if ($this->_distance !== null) {
225 $element->appendChild($this->_distance->getDOM($element->ownerDocument));
227 if ($this->_exposure !== null) {
228 $element->appendChild($this->_exposure->getDOM($element->ownerDocument));
230 if ($this->_flash !== null) {
231 $element->appendChild($this->_flash->getDOM($element->ownerDocument));
233 if ($this->_focalLength !== null) {
234 $element->appendChild($this->_focalLength->getDOM($element->ownerDocument));
236 if ($this->_fStop !== null) {
237 $element->appendChild($this->_fStop->getDOM($element->ownerDocument));
239 if ($this->_imageUniqueId !== null) {
240 $element->appendChild($this->_imageUniqueId->getDOM($element->ownerDocument));
242 if ($this->_iso !== null) {
243 $element->appendChild($this->_iso->getDOM($element->ownerDocument));
245 if ($this->_make !== null) {
246 $element->appendChild($this->_make->getDOM($element->ownerDocument));
248 if ($this->_model !== null) {
249 $element->appendChild($this->_model->getDOM($element->ownerDocument));
251 if ($this->_time !== null) {
252 $element->appendChild($this->_time->getDOM($element->ownerDocument));
258 * Creates individual Entry objects of the appropriate type and
259 * stores them as members of this entry based upon DOM data.
261 * @param DOMNode $child The DOMNode to process
263 protected function takeChildFromDOM($child)
265 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
266 switch ($absoluteNodeName) {
267 case $this->lookupNamespace('exif') . ':' . 'distance';
268 $distance = new Zend_Gdata_Exif_Extension_Distance();
269 $distance->transferFromDOM($child);
270 $this->_distance = $distance;
272 case $this->lookupNamespace('exif') . ':' . 'exposure';
273 $exposure = new Zend_Gdata_Exif_Extension_Exposure();
274 $exposure->transferFromDOM($child);
275 $this->_exposure = $exposure;
277 case $this->lookupNamespace('exif') . ':' . 'flash';
278 $flash = new Zend_Gdata_Exif_Extension_Flash();
279 $flash->transferFromDOM($child);
280 $this->_flash = $flash;
282 case $this->lookupNamespace('exif') . ':' . 'focallength';
283 $focalLength = new Zend_Gdata_Exif_Extension_FocalLength();
284 $focalLength->transferFromDOM($child);
285 $this->_focalLength = $focalLength;
287 case $this->lookupNamespace('exif') . ':' . 'fstop';
288 $fStop = new Zend_Gdata_Exif_Extension_FStop();
289 $fStop->transferFromDOM($child);
290 $this->_fStop = $fStop;
292 case $this->lookupNamespace('exif') . ':' . 'imageUniqueID';
293 $imageUniqueId = new Zend_Gdata_Exif_Extension_ImageUniqueId();
294 $imageUniqueId->transferFromDOM($child);
295 $this->_imageUniqueId = $imageUniqueId;
297 case $this->lookupNamespace('exif') . ':' . 'iso';
298 $iso = new Zend_Gdata_Exif_Extension_Iso();
299 $iso->transferFromDOM($child);
302 case $this->lookupNamespace('exif') . ':' . 'make';
303 $make = new Zend_Gdata_Exif_Extension_Make();
304 $make->transferFromDOM($child);
305 $this->_make = $make;
307 case $this->lookupNamespace('exif') . ':' . 'model';
308 $model = new Zend_Gdata_Exif_Extension_Model();
309 $model->transferFromDOM($child);
310 $this->_model = $model;
312 case $this->lookupNamespace('exif') . ':' . 'time';
313 $time = new Zend_Gdata_Exif_Extension_Time();
314 $time->transferFromDOM($child);
315 $this->_time = $time;
321 * Get the value for this element's distance attribute.
324 * @return Zend_Gdata_Exif_Extension_Distance The requested attribute.
326 public function getDistance()
328 return $this->_distance;
332 * Set the value for this element's distance attribute.
334 * @param Zend_Gdata_Exif_Extension_Distance $value The desired value for this attribute.
335 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
337 public function setDistance($value)
339 $this->_distance = $value;
344 * Get the value for this element's exposure attribute.
347 * @return Zend_Gdata_Exif_Extension_Exposure The requested attribute.
349 public function getExposure()
351 return $this->_exposure;
355 * Set the value for this element's exposure attribute.
357 * @param Zend_Gdata_Exif_Extension_Exposure $value The desired value for this attribute.
358 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
360 public function setExposure($value)
362 $this->_exposure = $value;
367 * Get the value for this element's flash attribute.
370 * @return Zend_Gdata_Exif_Extension_Flash The requested attribute.
372 public function getFlash()
374 return $this->_flash;
378 * Set the value for this element's flash attribute.
380 * @param Zend_Gdata_Exif_Extension_Flash $value The desired value for this attribute.
381 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
383 public function setFlash($value)
385 $this->_flash = $value;
390 * Get the value for this element's name attribute.
392 * @see setFocalLength
393 * @return Zend_Gdata_Exif_Extension_FocalLength The requested attribute.
395 public function getFocalLength()
397 return $this->_focalLength;
401 * Set the value for this element's focalLength attribute.
403 * @param Zend_Gdata_Exif_Extension_FocalLength $value The desired value for this attribute.
404 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
406 public function setFocalLength($value)
408 $this->_focalLength = $value;
413 * Get the value for this element's fStop attribute.
416 * @return Zend_Gdata_Exif_Extension_FStop The requested attribute.
418 public function getFStop()
420 return $this->_fStop;
424 * Set the value for this element's fStop attribute.
426 * @param Zend_Gdata_Exif_Extension_FStop $value The desired value for this attribute.
427 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
429 public function setFStop($value)
431 $this->_fStop = $value;
436 * Get the value for this element's imageUniqueId attribute.
438 * @see setImageUniqueId
439 * @return Zend_Gdata_Exif_Extension_ImageUniqueId The requested attribute.
441 public function getImageUniqueId()
443 return $this->_imageUniqueId;
447 * Set the value for this element's imageUniqueId attribute.
449 * @param Zend_Gdata_Exif_Extension_ImageUniqueId $value The desired value for this attribute.
450 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
452 public function setImageUniqueId($value)
454 $this->_imageUniqueId = $value;
459 * Get the value for this element's iso attribute.
462 * @return Zend_Gdata_Exif_Extension_Iso The requested attribute.
464 public function getIso()
470 * Set the value for this element's iso attribute.
472 * @param Zend_Gdata_Exif_Extension_Iso $value The desired value for this attribute.
473 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
475 public function setIso($value)
477 $this->_iso = $value;
481 * Get the value for this element's make attribute.
484 * @return Zend_Gdata_Exif_Extension_Make The requested attribute.
486 public function getMake()
492 * Set the value for this element's make attribute.
494 * @param Zend_Gdata_Exif_Extension_Make $value The desired value for this attribute.
495 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
497 public function setMake($value)
499 $this->_make = $value;
504 * Get the value for this element's model attribute.
507 * @return Zend_Gdata_Exif_Extension_Model The requested attribute.
509 public function getModel()
511 return $this->_model;
515 * Set the value for this element's model attribute.
517 * @param Zend_Gdata_Exif_Extension_Model $value The desired value for this attribute.
518 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
520 public function setModel($value)
522 $this->_model = $value;
527 * Get the value for this element's time attribute.
530 * @return Zend_Gdata_Exif_Extension_Time The requested attribute.
532 public function getTime()
538 * Set the value for this element's time attribute.
540 * @param Zend_Gdata_Exif_Extension_Time $value The desired value for this attribute.
541 * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface
543 public function setTime($value)
545 $this->_time = $value;