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:text 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_MediaText extends Zend_Gdata_Extension
41 protected $_rootElement = 'text';
42 protected $_rootNamespace = 'media';
47 protected $_type = null;
52 protected $_lang = null;
57 protected $_start = null;
62 protected $_end = null;
65 * Constructs a new MediaText element
70 * @param $start string
73 public function __construct($text = null, $type = null, $lang = null,
74 $start = null, $end = null)
76 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
77 parent::__construct();
81 $this->_start = $start;
86 * Retrieves a DOMElement which corresponds to this element and all
87 * child properties. This is used to build an entry back into a DOM
88 * and eventually XML text for sending to the server upon updates, or
89 * for application storage/persistence.
91 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
92 * @return DOMElement The DOMElement representing this element and all
95 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
97 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
98 if ($this->_type !== null) {
99 $element->setAttribute('type', $this->_type);
101 if ($this->_lang !== null) {
102 $element->setAttribute('lang', $this->_lang);
104 if ($this->_start !== null) {
105 $element->setAttribute('start', $this->_start);
107 if ($this->_end !== null) {
108 $element->setAttribute('end', $this->_end);
114 * Given a DOMNode representing an attribute, tries to map the data into
115 * instance members. If no mapping is defined, the name and value are
116 * stored in an array.
118 * @param DOMNode $attribute The DOMNode attribute needed to be handled
120 protected function takeAttributeFromDOM($attribute)
122 switch ($attribute->localName) {
124 $this->_type = $attribute->nodeValue;
127 $this->_lang = $attribute->nodeValue;
130 $this->_start = $attribute->nodeValue;
133 $this->_end = $attribute->nodeValue;
136 parent::takeAttributeFromDOM($attribute);
143 public function getType()
149 * @param string $value
150 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
152 public function setType($value)
154 $this->_type = $value;
161 public function getLang()
167 * @param string $value
168 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
170 public function setLang($value)
172 $this->_lang = $value;
179 public function getStart()
181 return $this->_start;
185 * @param string $value
186 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
188 public function setStart($value)
190 $this->_start = $value;
197 public function getEnd()
203 * @param string $value
204 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
206 public function setEnd($value)
208 $this->_end = $value;