|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Entry.php'; 00028 00032 require_once 'Zend/Gdata/Extension/FeedLink.php'; 00033 00037 require_once 'Zend/Gdata/YouTube/Extension/Description.php'; 00038 00042 require_once 'Zend/Gdata/YouTube/Extension/PlaylistTitle.php'; 00043 00047 require_once 'Zend/Gdata/YouTube/Extension/PlaylistId.php'; 00048 00052 require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php'; 00053 00057 require_once 'Zend/Gdata/YouTube/Extension/Username.php'; 00058 00062 require_once 'Zend/Gdata/YouTube/Extension/CountHint.php'; 00063 00067 require_once 'Zend/Gdata/YouTube/Extension/QueryString.php'; 00068 00078 class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry 00079 { 00080 00081 protected $_entryClassName = 'Zend_Gdata_YouTube_SubscriptionEntry'; 00082 00088 protected $_feedLink = array(); 00089 00095 protected $_username = null; 00096 00104 protected $_playlistTitle = null; 00105 00113 protected $_playlistId = null; 00114 00122 protected $_mediaThumbnail = null; 00123 00129 protected $_countHint = null; 00130 00136 protected $_queryString = null; 00137 00145 public function __construct($element = null) 00146 { 00147 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); 00148 parent::__construct($element); 00149 } 00150 00161 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00162 { 00163 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00164 if ($this->_countHint != null) { 00165 $element->appendChild($this->_countHint->getDOM($element->ownerDocument)); 00166 } 00167 if ($this->_playlistTitle != null) { 00168 $element->appendChild($this->_playlistTitle->getDOM($element->ownerDocument)); 00169 } 00170 if ($this->_playlistId != null) { 00171 $element->appendChild($this->_playlistId->getDOM($element->ownerDocument)); 00172 } 00173 if ($this->_mediaThumbnail != null) { 00174 $element->appendChild($this->_mediaThumbnail->getDOM($element->ownerDocument)); 00175 } 00176 if ($this->_username != null) { 00177 $element->appendChild($this->_username->getDOM($element->ownerDocument)); 00178 } 00179 if ($this->_queryString != null) { 00180 $element->appendChild($this->_queryString->getDOM($element->ownerDocument)); 00181 } 00182 if ($this->_feedLink != null) { 00183 foreach ($this->_feedLink as $feedLink) { 00184 $element->appendChild($feedLink->getDOM($element->ownerDocument)); 00185 } 00186 } 00187 return $element; 00188 } 00189 00196 protected function takeChildFromDOM($child) 00197 { 00198 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00199 switch ($absoluteNodeName) { 00200 case $this->lookupNamespace('gd') . ':' . 'feedLink': 00201 $feedLink = new Zend_Gdata_Extension_FeedLink(); 00202 $feedLink->transferFromDOM($child); 00203 $this->_feedLink[] = $feedLink; 00204 break; 00205 case $this->lookupNamespace('media') . ':' . 'thumbnail': 00206 $mediaThumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail(); 00207 $mediaThumbnail->transferFromDOM($child); 00208 $this->_mediaThumbnail = $mediaThumbnail; 00209 break; 00210 case $this->lookupNamespace('yt') . ':' . 'countHint': 00211 $countHint = new Zend_Gdata_YouTube_Extension_CountHint(); 00212 $countHint->transferFromDOM($child); 00213 $this->_countHint = $countHint; 00214 break; 00215 case $this->lookupNamespace('yt') . ':' . 'playlistTitle': 00216 $playlistTitle = new Zend_Gdata_YouTube_Extension_PlaylistTitle(); 00217 $playlistTitle->transferFromDOM($child); 00218 $this->_playlistTitle = $playlistTitle; 00219 break; 00220 case $this->lookupNamespace('yt') . ':' . 'playlistId': 00221 $playlistId = new Zend_Gdata_YouTube_Extension_PlaylistId(); 00222 $playlistId->transferFromDOM($child); 00223 $this->_playlistId = $playlistId; 00224 break; 00225 case $this->lookupNamespace('yt') . ':' . 'queryString': 00226 $queryString = new Zend_Gdata_YouTube_Extension_QueryString(); 00227 $queryString->transferFromDOM($child); 00228 $this->_queryString = $queryString; 00229 break; 00230 case $this->lookupNamespace('yt') . ':' . 'username': 00231 $username = new Zend_Gdata_YouTube_Extension_Username(); 00232 $username->transferFromDOM($child); 00233 $this->_username = $username; 00234 break; 00235 default: 00236 parent::takeChildFromDOM($child); 00237 break; 00238 } 00239 } 00240 00247 public function setFeedLink($feedLink = null) 00248 { 00249 $this->_feedLink = $feedLink; 00250 return $this; 00251 } 00252 00266 public function getFeedLink($rel = null) 00267 { 00268 if ($rel == null) { 00269 return $this->_feedLink; 00270 } else { 00271 foreach ($this->_feedLink as $feedLink) { 00272 if ($feedLink->rel == $rel) { 00273 return $feedLink; 00274 } 00275 } 00276 return null; 00277 } 00278 } 00279 00286 public function getPlaylistId() 00287 { 00288 if (($this->getMajorProtocolVersion() == null) || 00289 ($this->getMajorProtocolVersion() == 1)) { 00290 require_once 'Zend/Gdata/App/VersionException.php'; 00291 throw new Zend_Gdata_App_VersionException('The getPlaylistId ' . 00292 ' method is only supported as of version 2 of the YouTube ' . 00293 'API.'); 00294 } else { 00295 return $this->_playlistId; 00296 } 00297 } 00298 00307 public function setPlaylistId($id = null) 00308 { 00309 if (($this->getMajorProtocolVersion() == null) || 00310 ($this->getMajorProtocolVersion() == 1)) { 00311 require_once 'Zend/Gdata/App/VersionException.php'; 00312 throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' . 00313 ' method is only supported as of version 2 of the YouTube ' . 00314 'API.'); 00315 } else { 00316 $this->_playlistId = $id; 00317 return $this; 00318 } 00319 } 00320 00326 public function getQueryString() 00327 { 00328 return $this->_queryString; 00329 } 00330 00338 public function setQueryString($queryString = null) 00339 { 00340 $this->_queryString = $queryString; 00341 return $this; 00342 } 00343 00350 public function getPlaylistTitle() 00351 { 00352 if (($this->getMajorProtocolVersion() == null) || 00353 ($this->getMajorProtocolVersion() == 1)) { 00354 require_once 'Zend/Gdata/App/VersionException.php'; 00355 throw new Zend_Gdata_App_VersionException('The getPlaylistTitle ' . 00356 ' method is only supported as of version 2 of the YouTube ' . 00357 'API.'); 00358 } else { 00359 return $this->_playlistTitle; 00360 } 00361 } 00362 00371 public function setPlaylistTitle($title = null) 00372 { 00373 if (($this->getMajorProtocolVersion() == null) || 00374 ($this->getMajorProtocolVersion() == 1)) { 00375 require_once 'Zend/Gdata/App/VersionException.php'; 00376 throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' . 00377 ' method is only supported as of version 2 of the YouTube ' . 00378 'API.'); 00379 } else { 00380 $this->_playlistTitle = $title; 00381 return $this; 00382 } 00383 } 00384 00391 public function getCountHint() 00392 { 00393 if (($this->getMajorProtocolVersion() == null) || 00394 ($this->getMajorProtocolVersion() == 1)) { 00395 require_once 'Zend/Gdata/App/VersionException.php'; 00396 throw new Zend_Gdata_App_VersionException('The getCountHint ' . 00397 ' method is only supported as of version 2 of the YouTube ' . 00398 'API.'); 00399 } else { 00400 return $this->_countHint; 00401 } 00402 } 00403 00410 public function getMediaThumbnail() 00411 { 00412 if (($this->getMajorProtocolVersion() == null) || 00413 ($this->getMajorProtocolVersion() == 1)) { 00414 require_once 'Zend/Gdata/App/VersionException.php'; 00415 throw new Zend_Gdata_App_VersionException('The getMediaThumbnail ' . 00416 ' method is only supported as of version 2 of the YouTube ' . 00417 'API.'); 00418 } else { 00419 return $this->_mediaThumbnail; 00420 } 00421 } 00422 00428 public function getUsername() 00429 { 00430 return $this->_username; 00431 } 00432 00440 public function setUsername($username = null) 00441 { 00442 $this->_username = $username; 00443 return $this; 00444 } 00445 00446 }