source: extensions/Google2Piwigo/include/Zend/Gdata/Exif/Extension/Tags.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 16.5 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
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.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage Exif
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: Tags.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_Extension
26 */
27require_once 'Zend/Gdata/Extension.php';
28
29/**
30 * @see Zend_Gdata_Exif
31 */
32require_once 'Zend/Gdata/Exif.php';
33
34/**
35 * @see Zend_Gdata_Exif_Extension_Distance
36 */
37require_once 'Zend/Gdata/Exif/Extension/Distance.php';
38
39/**
40 * @see Zend_Gdata_Exif_Extension_Exposure
41 */
42require_once 'Zend/Gdata/Exif/Extension/Exposure.php';
43
44/**
45 * @see Zend_Gdata_Exif_Extension_Flash
46 */
47require_once 'Zend/Gdata/Exif/Extension/Flash.php';
48
49/**
50 * @see Zend_Gdata_Exif_Extension_FocalLength
51 */
52require_once 'Zend/Gdata/Exif/Extension/FocalLength.php';
53
54/**
55 * @see Zend_Gdata_Exif_Extension_FStop
56 */
57require_once 'Zend/Gdata/Exif/Extension/FStop.php';
58
59/**
60 * @see Zend_Gdata_Exif_Extension_ImageUniqueId
61 */
62require_once 'Zend/Gdata/Exif/Extension/ImageUniqueId.php';
63
64/**
65 * @see Zend_Gdata_Exif_Extension_Iso
66 */
67require_once 'Zend/Gdata/Exif/Extension/Iso.php';
68
69/**
70 * @see Zend_Gdata_Exif_Extension_Make
71 */
72require_once 'Zend/Gdata/Exif/Extension/Make.php';
73
74/**
75 * @see Zend_Gdata_Exif_Extension_Model
76 */
77require_once 'Zend/Gdata/Exif/Extension/Model.php';
78
79/**
80 * @see Zend_Gdata_Exif_Extension_Time
81 */
82require_once 'Zend/Gdata/Exif/Extension/Time.php';
83
84/**
85 * Represents the exif:tags element used by the Gdata Exif extensions.
86 *
87 * @category   Zend
88 * @package    Zend_Gdata
89 * @subpackage Exif
90 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
91 * @license    http://framework.zend.com/license/new-bsd     New BSD License
92 */
93class Zend_Gdata_Exif_Extension_Tags extends Zend_Gdata_Extension
94{
95
96    protected $_rootNamespace = 'exif';
97    protected $_rootElement = 'tags';
98
99    /**
100     * exif:distance value
101     *
102     * @var Zend_Gdata_Exif_Extension_Distance
103     */
104    protected $_distance = null;
105
106    /**
107     * exif:exposure value
108     *
109     * @var Zend_Gdata_Exif_Extension_Exposure
110     */
111    protected $_exposure = null;
112
113    /**
114     * exif:flash value
115     *
116     * @var Zend_Gdata_Exif_Extension_Flash
117     */
118    protected $_flash = null;
119
120    /**
121     * exif:focalLength value
122     *
123     * @var Zend_Gdata_Exif_Extension_FocalLength
124     */
125    protected $_focalLength = null;
126
127    /**
128     * exif:fStop value
129     *
130     * @var Zend_Gdata_Exif_Extension_FStop
131     */
132    protected $_fStop = null;
133
134    /**
135     * exif:imageUniqueID value
136     *
137     * @var Zend_Gdata_Exif_Extension_ImageUniqueId
138     */
139    protected $_imageUniqueId = null;
140
141    /**
142     * exif:iso value
143     *
144     * @var Zend_Gdata_Exif_Extension_Iso
145     */
146    protected $_iso = null;
147
148    /**
149     * exif:make value
150     *
151     * @var Zend_Gdata_Exif_Extension_Make
152     */
153    protected $_make = null;
154
155    /**
156     * exif:model value
157     *
158     * @var Zend_Gdata_Exif_Extension_Model
159     */
160    protected $_model = null;
161
162    /**
163     * exif:time value
164     *
165     * @var Zend_Gdata_Exif_Extension_Time
166     */
167    protected $_time = null;
168
169    /**
170     * Constructs a new Zend_Gdata_Exif_Extension_Tags object.
171     *
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.
192     */
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)
197    {
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);
206        $this->setIso($iso);
207        $this->setMake($make);
208        $this->setModel($model);
209        $this->setTime($time);
210    }
211
212    /**
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.
216     *
217     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
218     * @return DOMElement The DOMElement representing this element and all
219     *          child properties.
220     */
221    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
222    {
223        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
224        if ($this->_distance !== null) {
225            $element->appendChild($this->_distance->getDOM($element->ownerDocument));
226        }
227        if ($this->_exposure !== null) {
228            $element->appendChild($this->_exposure->getDOM($element->ownerDocument));
229        }
230        if ($this->_flash !== null) {
231            $element->appendChild($this->_flash->getDOM($element->ownerDocument));
232        }
233        if ($this->_focalLength !== null) {
234            $element->appendChild($this->_focalLength->getDOM($element->ownerDocument));
235        }
236        if ($this->_fStop !== null) {
237            $element->appendChild($this->_fStop->getDOM($element->ownerDocument));
238        }
239        if ($this->_imageUniqueId !== null) {
240            $element->appendChild($this->_imageUniqueId->getDOM($element->ownerDocument));
241        }
242        if ($this->_iso !== null) {
243            $element->appendChild($this->_iso->getDOM($element->ownerDocument));
244        }
245        if ($this->_make !== null) {
246            $element->appendChild($this->_make->getDOM($element->ownerDocument));
247        }
248        if ($this->_model !== null) {
249            $element->appendChild($this->_model->getDOM($element->ownerDocument));
250        }
251        if ($this->_time !== null) {
252            $element->appendChild($this->_time->getDOM($element->ownerDocument));
253        }
254        return $element;
255    }
256
257    /**
258     * Creates individual Entry objects of the appropriate type and
259     * stores them as members of this entry based upon DOM data.
260     *
261     * @param DOMNode $child The DOMNode to process
262     */
263    protected function takeChildFromDOM($child)
264    {
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;
271                break;
272            case $this->lookupNamespace('exif') . ':' . 'exposure';
273                $exposure = new Zend_Gdata_Exif_Extension_Exposure();
274                $exposure->transferFromDOM($child);
275                $this->_exposure = $exposure;
276                break;
277            case $this->lookupNamespace('exif') . ':' . 'flash';
278                $flash = new Zend_Gdata_Exif_Extension_Flash();
279                $flash->transferFromDOM($child);
280                $this->_flash = $flash;
281                break;
282            case $this->lookupNamespace('exif') . ':' . 'focallength';
283                $focalLength = new Zend_Gdata_Exif_Extension_FocalLength();
284                $focalLength->transferFromDOM($child);
285                $this->_focalLength = $focalLength;
286                break;
287            case $this->lookupNamespace('exif') . ':' . 'fstop';
288                $fStop = new Zend_Gdata_Exif_Extension_FStop();
289                $fStop->transferFromDOM($child);
290                $this->_fStop = $fStop;
291                break;
292            case $this->lookupNamespace('exif') . ':' . 'imageUniqueID';
293                $imageUniqueId = new Zend_Gdata_Exif_Extension_ImageUniqueId();
294                $imageUniqueId->transferFromDOM($child);
295                $this->_imageUniqueId = $imageUniqueId;
296                break;
297            case $this->lookupNamespace('exif') . ':' . 'iso';
298                $iso = new Zend_Gdata_Exif_Extension_Iso();
299                $iso->transferFromDOM($child);
300                $this->_iso = $iso;
301                break;
302            case $this->lookupNamespace('exif') . ':' . 'make';
303                $make = new Zend_Gdata_Exif_Extension_Make();
304                $make->transferFromDOM($child);
305                $this->_make = $make;
306                break;
307            case $this->lookupNamespace('exif') . ':' . 'model';
308                $model = new Zend_Gdata_Exif_Extension_Model();
309                $model->transferFromDOM($child);
310                $this->_model = $model;
311                break;
312            case $this->lookupNamespace('exif') . ':' . 'time';
313                $time = new Zend_Gdata_Exif_Extension_Time();
314                $time->transferFromDOM($child);
315                $this->_time = $time;
316                break;
317        }
318    }
319
320    /**
321     * Get the value for this element's distance attribute.
322     *
323     * @see setDistance
324     * @return Zend_Gdata_Exif_Extension_Distance The requested attribute.
325     */
326    public function getDistance()
327    {
328        return $this->_distance;
329    }
330
331    /**
332     * Set the value for this element's distance attribute.
333     *
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
336     */
337    public function setDistance($value)
338    {
339        $this->_distance = $value;
340        return $this;
341    }
342
343    /**
344     * Get the value for this element's exposure attribute.
345     *
346     * @see setExposure
347     * @return Zend_Gdata_Exif_Extension_Exposure The requested attribute.
348     */
349    public function getExposure()
350    {
351        return $this->_exposure;
352    }
353
354    /**
355     * Set the value for this element's exposure attribute.
356     *
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
359     */
360    public function setExposure($value)
361    {
362        $this->_exposure = $value;
363        return $this;
364    }
365
366    /**
367     * Get the value for this element's flash attribute.
368     *
369     * @see setFlash
370     * @return Zend_Gdata_Exif_Extension_Flash The requested attribute.
371     */
372    public function getFlash()
373    {
374        return $this->_flash;
375    }
376
377    /**
378     * Set the value for this element's flash attribute.
379     *
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
382     */
383    public function setFlash($value)
384    {
385        $this->_flash = $value;
386        return $this;
387    }
388
389    /**
390     * Get the value for this element's name attribute.
391     *
392     * @see setFocalLength
393     * @return Zend_Gdata_Exif_Extension_FocalLength The requested attribute.
394     */
395    public function getFocalLength()
396    {
397        return $this->_focalLength;
398    }
399
400    /**
401     * Set the value for this element's focalLength attribute.
402     *
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
405     */
406    public function setFocalLength($value)
407    {
408        $this->_focalLength = $value;
409        return $this;
410    }
411
412    /**
413     * Get the value for this element's fStop attribute.
414     *
415     * @see setFStop
416     * @return Zend_Gdata_Exif_Extension_FStop The requested attribute.
417     */
418    public function getFStop()
419    {
420        return $this->_fStop;
421    }
422
423    /**
424     * Set the value for this element's fStop attribute.
425     *
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
428     */
429    public function setFStop($value)
430    {
431        $this->_fStop = $value;
432        return $this;
433    }
434
435    /**
436     * Get the value for this element's imageUniqueId attribute.
437     *
438     * @see setImageUniqueId
439     * @return Zend_Gdata_Exif_Extension_ImageUniqueId The requested attribute.
440     */
441    public function getImageUniqueId()
442    {
443        return $this->_imageUniqueId;
444    }
445
446    /**
447     * Set the value for this element's imageUniqueId attribute.
448     *
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
451     */
452    public function setImageUniqueId($value)
453    {
454        $this->_imageUniqueId = $value;
455        return $this;
456    }
457
458    /**
459     * Get the value for this element's iso attribute.
460     *
461     * @see setIso
462     * @return Zend_Gdata_Exif_Extension_Iso The requested attribute.
463     */
464    public function getIso()
465    {
466        return $this->_iso;
467    }
468
469    /**
470     * Set the value for this element's iso attribute.
471     *
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
474     */
475    public function setIso($value)
476    {
477        $this->_iso = $value;
478        return $this;
479    }
480    /**
481     * Get the value for this element's make attribute.
482     *
483     * @see setMake
484     * @return Zend_Gdata_Exif_Extension_Make The requested attribute.
485     */
486    public function getMake()
487    {
488        return $this->_make;
489    }
490
491    /**
492     * Set the value for this element's make attribute.
493     *
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
496     */
497    public function setMake($value)
498    {
499        $this->_make = $value;
500        return $this;
501    }
502
503    /**
504     * Get the value for this element's model attribute.
505     *
506     * @see setModel
507     * @return Zend_Gdata_Exif_Extension_Model The requested attribute.
508     */
509    public function getModel()
510    {
511        return $this->_model;
512    }
513
514    /**
515     * Set the value for this element's model attribute.
516     *
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
519     */
520    public function setModel($value)
521    {
522        $this->_model = $value;
523        return $this;
524    }
525
526    /**
527     * Get the value for this element's time attribute.
528     *
529     * @see setTime
530     * @return Zend_Gdata_Exif_Extension_Time The requested attribute.
531     */
532    public function getTime()
533    {
534        return $this->_time;
535    }
536
537    /**
538     * Set the value for this element's time attribute.
539     *
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
542     */
543    public function setTime($value)
544    {
545        $this->_time = $value;
546        return $this;
547    }
548
549}
Note: See TracBrowser for help on using the repository browser.