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_App_Extension
27 require_once 'Zend/Gdata/App/Extension.php';
30 * Represents the media:thumbnail element
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Media_Extension_MediaThumbnail extends Zend_Gdata_Extension
41 protected $_rootElement = 'thumbnail';
42 protected $_rootNamespace = 'media';
47 protected $_url = null;
52 protected $_width = null;
57 protected $_height = null;
62 protected $_time = null;
65 * Constructs a new MediaThumbnail element
72 public function __construct($url = null, $width = null, $height = null,
75 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
76 parent::__construct();
78 $this->_width = $width;
79 $this->_height = $height;
80 $this->_time = $time ;
84 * Retrieves a DOMElement which corresponds to this element and all
85 * child properties. This is used to build an entry back into a DOM
86 * and eventually XML text for sending to the server upon updates, or
87 * for application storage/persistence.
89 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
90 * @return DOMElement The DOMElement representing this element and all
93 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
95 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
96 if ($this->_url !== null) {
97 $element->setAttribute('url', $this->_url);
99 if ($this->_width !== null) {
100 $element->setAttribute('width', $this->_width);
102 if ($this->_height !== null) {
103 $element->setAttribute('height', $this->_height);
105 if ($this->_time !== null) {
106 $element->setAttribute('time', $this->_time);
112 * Given a DOMNode representing an attribute, tries to map the data into
113 * instance members. If no mapping is defined, the name and value are
114 * stored in an array.
116 * @param DOMNode $attribute The DOMNode attribute needed to be handled
118 protected function takeAttributeFromDOM($attribute)
120 switch ($attribute->localName) {
122 $this->_url = $attribute->nodeValue;
125 $this->_width = $attribute->nodeValue;
128 $this->_height = $attribute->nodeValue;
131 $this->_time = $attribute->nodeValue;
134 parent::takeAttributeFromDOM($attribute);
141 public function getUrl()
147 * @param string $value
148 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface
150 public function setUrl($value)
152 $this->_url = $value;
159 public function getWidth()
161 return $this->_width;
166 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface
168 public function setWidth($value)
170 $this->_width = $value;
177 public function getHeight()
179 return $this->_height;
184 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface
186 public function setHeight($value)
188 $this->_height = $value;
195 public function getTime()
201 * @param string $value
202 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface
204 public function setTime($value)
206 $this->_time = $value;