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_Extension 0026 */ 0027 // require_once 'Zend/Gdata/Extension.php'; 0028 0029 /** 0030 * Represents the media:content element of Media RSS. 0031 * Represents media objects. Multiple media objects representing 0032 * the same content can be represented using a 0033 * media:group (Zend_Gdata_Media_Extension_MediaGroup) element. 0034 * 0035 * @category Zend 0036 * @package Zend_Gdata 0037 * @subpackage Media 0038 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0039 * @license http://framework.zend.com/license/new-bsd New BSD License 0040 */ 0041 class Zend_Gdata_Media_Extension_MediaContent extends Zend_Gdata_Extension 0042 { 0043 protected $_rootElement = 'content'; 0044 protected $_rootNamespace = 'media'; 0045 0046 /** 0047 * @var string 0048 */ 0049 protected $_url = null; 0050 0051 /** 0052 * @var int 0053 */ 0054 protected $_fileSize = null; 0055 0056 /** 0057 * @var string 0058 */ 0059 protected $_type = null; 0060 0061 /** 0062 * @var string 0063 */ 0064 protected $_medium = null; 0065 0066 /** 0067 * @var string 0068 */ 0069 protected $_isDefault = null; 0070 0071 /** 0072 * @var string 0073 */ 0074 protected $_expression = null; 0075 0076 /** 0077 * @var int 0078 */ 0079 protected $_bitrate = null; 0080 0081 /** 0082 * @var int 0083 */ 0084 protected $_framerate = null; 0085 0086 /** 0087 * @var int 0088 */ 0089 protected $_samplingrate = null; 0090 0091 /** 0092 * @var int 0093 */ 0094 protected $_channels = null; 0095 0096 /** 0097 * @var int 0098 */ 0099 protected $_duration = null; 0100 0101 /** 0102 * @var int 0103 */ 0104 protected $_height = null; 0105 0106 /** 0107 * @var int 0108 */ 0109 protected $_width = null; 0110 0111 /** 0112 * @var string 0113 */ 0114 protected $_lang = null; 0115 0116 /** 0117 * Creates an individual MediaContent object. 0118 */ 0119 public function __construct($url = null, $fileSize = null, $type = null, 0120 $medium = null, $isDefault = null, $expression = null, 0121 $bitrate = null, $framerate = null, $samplingrate = null, 0122 $channels = null, $duration = null, $height = null, $width = null, 0123 $lang = null) 0124 { 0125 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 0126 parent::__construct(); 0127 $this->_url = $url; 0128 $this->_fileSize = $fileSize; 0129 $this->_type = $type; 0130 $this->_medium = $medium; 0131 $this->_isDefault = $isDefault; 0132 $this->_expression = $expression; 0133 $this->_bitrate = $bitrate; 0134 $this->_framerate = $framerate; 0135 $this->_samplingrate = $samplingrate; 0136 $this->_channels = $channels; 0137 $this->_duration = $duration; 0138 $this->_height = $height; 0139 $this->_width = $width; 0140 $this->_lang = $lang; 0141 } 0142 0143 0144 /** 0145 * Retrieves a DOMElement which corresponds to this element and all 0146 * child properties. This is used to build an entry back into a DOM 0147 * and eventually XML text for sending to the server upon updates, or 0148 * for application storage/persistence. 0149 * 0150 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0151 * @return DOMElement The DOMElement representing this element and all 0152 * child properties. 0153 */ 0154 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0155 { 0156 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0157 if ($this->_url !== null) { 0158 $element->setAttribute('url', $this->_url); 0159 } 0160 if ($this->_fileSize !== null) { 0161 $element->setAttribute('fileSize', $this->_fileSize); 0162 } 0163 if ($this->_type !== null) { 0164 $element->setAttribute('type', $this->_type); 0165 } 0166 if ($this->_medium !== null) { 0167 $element->setAttribute('medium', $this->_medium); 0168 } 0169 if ($this->_isDefault !== null) { 0170 $element->setAttribute('isDefault', $this->_isDefault); 0171 } 0172 if ($this->_expression !== null) { 0173 $element->setAttribute('expression', $this->_expression); 0174 } 0175 if ($this->_bitrate !== null) { 0176 $element->setAttribute('bitrate', $this->_bitrate); 0177 } 0178 if ($this->_framerate !== null) { 0179 $element->setAttribute('framerate', $this->_framerate); 0180 } 0181 if ($this->_samplingrate !== null) { 0182 $element->setAttribute('samplingrate', $this->_samplingrate); 0183 } 0184 if ($this->_channels !== null) { 0185 $element->setAttribute('channels', $this->_channels); 0186 } 0187 if ($this->_duration !== null) { 0188 $element->setAttribute('duration', $this->_duration); 0189 } 0190 if ($this->_height !== null) { 0191 $element->setAttribute('height', $this->_height); 0192 } 0193 if ($this->_width !== null) { 0194 $element->setAttribute('width', $this->_width); 0195 } 0196 if ($this->_lang !== null) { 0197 $element->setAttribute('lang', $this->_lang); 0198 } 0199 return $element; 0200 } 0201 0202 /** 0203 * Given a DOMNode representing an attribute, tries to map the data into 0204 * instance members. If no mapping is defined, the name and value are 0205 * stored in an array. 0206 * 0207 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0208 */ 0209 protected function takeAttributeFromDOM($attribute) 0210 { 0211 switch ($attribute->localName) { 0212 case 'url': 0213 $this->_url = $attribute->nodeValue; 0214 break; 0215 case 'fileSize': 0216 $this->_fileSize = $attribute->nodeValue; 0217 break; 0218 case 'type': 0219 $this->_type = $attribute->nodeValue; 0220 break; 0221 case 'medium': 0222 $this->_medium = $attribute->nodeValue; 0223 break; 0224 case 'isDefault': 0225 $this->_isDefault = $attribute->nodeValue; 0226 break; 0227 case 'expression': 0228 $this->_expression = $attribute->nodeValue; 0229 break; 0230 case 'bitrate': 0231 $this->_bitrate = $attribute->nodeValue; 0232 break; 0233 case 'framerate': 0234 $this->_framerate = $attribute->nodeValue; 0235 break; 0236 case 'samplingrate': 0237 $this->_samplingrate = $attribute->nodeValue; 0238 break; 0239 case 'channels': 0240 $this->_channels = $attribute->nodeValue; 0241 break; 0242 case 'duration': 0243 $this->_duration = $attribute->nodeValue; 0244 break; 0245 case 'height': 0246 $this->_height = $attribute->nodeValue; 0247 break; 0248 case 'width': 0249 $this->_width = $attribute->nodeValue; 0250 break; 0251 case 'lang': 0252 $this->_lang = $attribute->nodeValue; 0253 break; 0254 default: 0255 parent::takeAttributeFromDOM($attribute); 0256 } 0257 } 0258 0259 /** 0260 * Returns the URL representing this MediaContent object 0261 * 0262 * @return string The URL representing this MediaContent object. 0263 */ 0264 public function __toString() 0265 { 0266 return $this->getUrl(); 0267 } 0268 0269 /** 0270 * @return string The direct URL to the media object 0271 */ 0272 public function getUrl() 0273 { 0274 return $this->_url; 0275 } 0276 0277 /** 0278 * @param string $value The direct URL to the media object 0279 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0280 */ 0281 public function setUrl($value) 0282 { 0283 $this->_url = $value; 0284 return $this; 0285 } 0286 0287 /** 0288 * @return int The size of the media in bytes 0289 */ 0290 public function getFileSize() 0291 { 0292 return $this->_fileSize; 0293 } 0294 0295 /** 0296 * @param int $value 0297 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0298 */ 0299 public function setFileSize($value) 0300 { 0301 $this->_fileSize = $value; 0302 return $this; 0303 } 0304 0305 /** 0306 * @return string 0307 */ 0308 public function getType() 0309 { 0310 return $this->_type; 0311 } 0312 0313 /** 0314 * @param string $value 0315 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0316 */ 0317 public function setType($value) 0318 { 0319 $this->_type = $value; 0320 return $this; 0321 } 0322 0323 /** 0324 * @return string 0325 */ 0326 public function getMedium() 0327 { 0328 return $this->_medium; 0329 } 0330 0331 /** 0332 * @param string $value 0333 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0334 */ 0335 public function setMedium($value) 0336 { 0337 $this->_medium = $value; 0338 return $this; 0339 } 0340 0341 /** 0342 * @return bool 0343 */ 0344 public function getIsDefault() 0345 { 0346 return $this->_isDefault; 0347 } 0348 0349 /** 0350 * @param bool $value 0351 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0352 */ 0353 public function setIsDefault($value) 0354 { 0355 $this->_isDefault = $value; 0356 return $this; 0357 } 0358 0359 /** 0360 * @return string 0361 */ 0362 public function getExpression() 0363 { 0364 return $this->_expression; 0365 } 0366 0367 /** 0368 * @param string 0369 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0370 */ 0371 public function setExpression($value) 0372 { 0373 $this->_expression = $value; 0374 return $this; 0375 } 0376 0377 /** 0378 * @return int 0379 */ 0380 public function getBitrate() 0381 { 0382 return $this->_bitrate; 0383 } 0384 0385 /** 0386 * @param int 0387 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0388 */ 0389 public function setBitrate($value) 0390 { 0391 $this->_bitrate = $value; 0392 return $this; 0393 } 0394 0395 /** 0396 * @return int 0397 */ 0398 public function getFramerate() 0399 { 0400 return $this->_framerate; 0401 } 0402 0403 /** 0404 * @param int 0405 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0406 */ 0407 public function setFramerate($value) 0408 { 0409 $this->_framerate = $value; 0410 return $this; 0411 } 0412 0413 /** 0414 * @return int 0415 */ 0416 public function getSamplingrate() 0417 { 0418 return $this->_samplingrate; 0419 } 0420 0421 /** 0422 * @param int 0423 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0424 */ 0425 public function setSamplingrate($value) 0426 { 0427 $this->_samplingrate = $value; 0428 return $this; 0429 } 0430 0431 /** 0432 * @return int 0433 */ 0434 public function getChannels() 0435 { 0436 return $this->_channels; 0437 } 0438 0439 /** 0440 * @param int 0441 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0442 */ 0443 public function setChannels($value) 0444 { 0445 $this->_channels = $value; 0446 return $this; 0447 } 0448 0449 /** 0450 * @return int 0451 */ 0452 public function getDuration() 0453 { 0454 return $this->_duration; 0455 } 0456 0457 /** 0458 * 0459 * @param int 0460 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0461 */ 0462 public function setDuration($value) 0463 { 0464 $this->_duration = $value; 0465 return $this; 0466 } 0467 0468 /** 0469 * @return int 0470 */ 0471 public function getHeight() 0472 { 0473 return $this->_height; 0474 } 0475 0476 /** 0477 * @param int 0478 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0479 */ 0480 public function setHeight($value) 0481 { 0482 $this->_height = $value; 0483 return $this; 0484 } 0485 0486 /** 0487 * @return int 0488 */ 0489 public function getWidth() 0490 { 0491 return $this->_width; 0492 } 0493 0494 /** 0495 * @param int 0496 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0497 */ 0498 public function setWidth($value) 0499 { 0500 $this->_width = $value; 0501 return $this; 0502 } 0503 0504 /** 0505 * @return string 0506 */ 0507 public function getLang() 0508 { 0509 return $this->_lang; 0510 } 0511 0512 /** 0513 * @param string 0514 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface 0515 */ 0516 public function setLang($value) 0517 { 0518 $this->_lang = $value; 0519 return $this; 0520 } 0521 0522 }