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:thumbnail 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_MediaThumbnail extends Zend_Gdata_Extension 0039 { 0040 0041 protected $_rootElement = 'thumbnail'; 0042 protected $_rootNamespace = 'media'; 0043 0044 /** 0045 * @var string 0046 */ 0047 protected $_url = null; 0048 0049 /** 0050 * @var int 0051 */ 0052 protected $_width = null; 0053 0054 /** 0055 * @var int 0056 */ 0057 protected $_height = null; 0058 0059 /** 0060 * @var string 0061 */ 0062 protected $_time = null; 0063 0064 /** 0065 * Constructs a new MediaThumbnail element 0066 * 0067 * @param string $url 0068 * @param int $width 0069 * @param int $height 0070 * @param string $time 0071 */ 0072 public function __construct($url = null, $width = null, $height = null, 0073 $time = null) 0074 { 0075 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 0076 parent::__construct(); 0077 $this->_url = $url; 0078 $this->_width = $width; 0079 $this->_height = $height; 0080 $this->_time = $time ; 0081 } 0082 0083 /** 0084 * Retrieves a DOMElement which corresponds to this element and all 0085 * child properties. This is used to build an entry back into a DOM 0086 * and eventually XML text for sending to the server upon updates, or 0087 * for application storage/persistence. 0088 * 0089 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0090 * @return DOMElement The DOMElement representing this element and all 0091 * child properties. 0092 */ 0093 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0094 { 0095 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0096 if ($this->_url !== null) { 0097 $element->setAttribute('url', $this->_url); 0098 } 0099 if ($this->_width !== null) { 0100 $element->setAttribute('width', $this->_width); 0101 } 0102 if ($this->_height !== null) { 0103 $element->setAttribute('height', $this->_height); 0104 } 0105 if ($this->_time !== null) { 0106 $element->setAttribute('time', $this->_time); 0107 } 0108 return $element; 0109 } 0110 0111 /** 0112 * Given a DOMNode representing an attribute, tries to map the data into 0113 * instance members. If no mapping is defined, the name and value are 0114 * stored in an array. 0115 * 0116 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0117 */ 0118 protected function takeAttributeFromDOM($attribute) 0119 { 0120 switch ($attribute->localName) { 0121 case 'url': 0122 $this->_url = $attribute->nodeValue; 0123 break; 0124 case 'width': 0125 $this->_width = $attribute->nodeValue; 0126 break; 0127 case 'height': 0128 $this->_height = $attribute->nodeValue; 0129 break; 0130 case 'time': 0131 $this->_time = $attribute->nodeValue; 0132 break; 0133 default: 0134 parent::takeAttributeFromDOM($attribute); 0135 } 0136 } 0137 0138 /** 0139 * @return string 0140 */ 0141 public function getUrl() 0142 { 0143 return $this->_url; 0144 } 0145 0146 /** 0147 * @param string $value 0148 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface 0149 */ 0150 public function setUrl($value) 0151 { 0152 $this->_url = $value; 0153 return $this; 0154 } 0155 0156 /** 0157 * @return int 0158 */ 0159 public function getWidth() 0160 { 0161 return $this->_width; 0162 } 0163 0164 /** 0165 * @param int $value 0166 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface 0167 */ 0168 public function setWidth($value) 0169 { 0170 $this->_width = $value; 0171 return $this; 0172 } 0173 0174 /** 0175 * @return int 0176 */ 0177 public function getHeight() 0178 { 0179 return $this->_height; 0180 } 0181 0182 /** 0183 * @param int $value 0184 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface 0185 */ 0186 public function setHeight($value) 0187 { 0188 $this->_height = $value; 0189 return $this; 0190 } 0191 0192 /** 0193 * @return string 0194 */ 0195 public function getTime() 0196 { 0197 return $this->_time; 0198 } 0199 0200 /** 0201 * @param string $value 0202 * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface 0203 */ 0204 public function setTime($value) 0205 { 0206 $this->_time = $value; 0207 return $this; 0208 } 0209 0210 }