|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Media/Extension/MediaContent.php'; 00028 00041 class Zend_Gdata_YouTube_Extension_MediaContent extends Zend_Gdata_Media_Extension_MediaContent 00042 { 00043 protected $_rootElement = 'content'; 00044 protected $_rootNamespace = 'media'; 00045 00046 /* 00047 * Format of the video 00048 * Optional. 00049 * 00050 * @var int 00051 */ 00052 protected $_format = null; 00053 00054 00055 function __construct() { 00056 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); 00057 parent::__construct(); 00058 } 00059 00070 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00071 { 00072 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00073 if ($this->_format!= null) { 00074 $element->setAttributeNS($this->lookupNamespace('yt'), 'yt:format', $this->_format); 00075 } 00076 return $element; 00077 } 00078 00086 protected function takeAttributeFromDOM($attribute) 00087 { 00088 $absoluteAttrName = $attribute->namespaceURI . ':' . $attribute->localName; 00089 if ($absoluteAttrName == $this->lookupNamespace('yt') . ':' . 'format') { 00090 $this->_format = $attribute->nodeValue; 00091 } else { 00092 parent::takeAttributeFromDOM($attribute); 00093 } 00094 } 00095 00102 public function getFormat() 00103 { 00104 return $this->_format; 00105 } 00106 00114 public function setFormat($value) 00115 { 00116 $this->_format = $value; 00117 return $this; 00118 } 00119 00120 }