File indexing completed on 2025-03-02 05:29:28
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Media 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_App_Extension 0026 */ 0027 // require_once 'Zend/Gdata/App/Extension.php'; 0028 0029 /** 0030 * Represents the media:text element 0031 * 0032 * @category Zend 0033 * @package Zend_Gdata 0034 * @subpackage Media 0035 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0036 * @license http://framework.zend.com/license/new-bsd New BSD License 0037 */ 0038 class Zend_Gdata_Media_Extension_MediaText extends Zend_Gdata_Extension 0039 { 0040 0041 protected $_rootElement = 'text'; 0042 protected $_rootNamespace = 'media'; 0043 0044 /** 0045 * @var string 0046 */ 0047 protected $_type = null; 0048 0049 /** 0050 * @var string 0051 */ 0052 protected $_lang = null; 0053 0054 /** 0055 * @var string 0056 */ 0057 protected $_start = null; 0058 0059 /** 0060 * @var string 0061 */ 0062 protected $_end = null; 0063 0064 /** 0065 * Constructs a new MediaText element 0066 * 0067 * @param string $text 0068 * @param string $type 0069 * @param string $lang 0070 * @param string $start 0071 * @param string $end 0072 */ 0073 public function __construct($text = null, $type = null, $lang = null, 0074 $start = null, $end = null) 0075 { 0076 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 0077 parent::__construct(); 0078 $this->_text = $text; 0079 $this->_type = $type; 0080 $this->_lang = $lang; 0081 $this->_start = $start; 0082 $this->_end = $end; 0083 } 0084 0085 /** 0086 * Retrieves a DOMElement which corresponds to this element and all 0087 * child properties. This is used to build an entry back into a DOM 0088 * and eventually XML text for sending to the server upon updates, or 0089 * for application storage/persistence. 0090 * 0091 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0092 * @return DOMElement The DOMElement representing this element and all 0093 * child properties. 0094 */ 0095 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0096 { 0097 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0098 if ($this->_type !== null) { 0099 $element->setAttribute('type', $this->_type); 0100 } 0101 if ($this->_lang !== null) { 0102 $element->setAttribute('lang', $this->_lang); 0103 } 0104 if ($this->_start !== null) { 0105 $element->setAttribute('start', $this->_start); 0106 } 0107 if ($this->_end !== null) { 0108 $element->setAttribute('end', $this->_end); 0109 } 0110 return $element; 0111 } 0112 0113 /** 0114 * Given a DOMNode representing an attribute, tries to map the data into 0115 * instance members. If no mapping is defined, the name and value are 0116 * stored in an array. 0117 * 0118 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0119 */ 0120 protected function takeAttributeFromDOM($attribute) 0121 { 0122 switch ($attribute->localName) { 0123 case 'type': 0124 $this->_type = $attribute->nodeValue; 0125 break; 0126 case 'lang': 0127 $this->_lang = $attribute->nodeValue; 0128 break; 0129 case 'start': 0130 $this->_start = $attribute->nodeValue; 0131 break; 0132 case 'end': 0133 $this->_end = $attribute->nodeValue; 0134 break; 0135 default: 0136 parent::takeAttributeFromDOM($attribute); 0137 } 0138 } 0139 0140 /** 0141 * @return string 0142 */ 0143 public function getType() 0144 { 0145 return $this->_type; 0146 } 0147 0148 /** 0149 * @param string $value 0150 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface 0151 */ 0152 public function setType($value) 0153 { 0154 $this->_type = $value; 0155 return $this; 0156 } 0157 0158 /** 0159 * @return string 0160 */ 0161 public function getLang() 0162 { 0163 return $this->_lang; 0164 } 0165 0166 /** 0167 * @param string $value 0168 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface 0169 */ 0170 public function setLang($value) 0171 { 0172 $this->_lang = $value; 0173 return $this; 0174 } 0175 0176 /** 0177 * @return string 0178 */ 0179 public function getStart() 0180 { 0181 return $this->_start; 0182 } 0183 0184 /** 0185 * @param string $value 0186 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface 0187 */ 0188 public function setStart($value) 0189 { 0190 $this->_start = $value; 0191 return $this; 0192 } 0193 0194 /** 0195 * @return string 0196 */ 0197 public function getEnd() 0198 { 0199 return $this->_end; 0200 } 0201 0202 /** 0203 * @param string $value 0204 * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface 0205 */ 0206 public function setEnd($value) 0207 { 0208 $this->_end = $value; 0209 return $this; 0210 } 0211 }