import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -0,0 +1,231 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_YouTube_Extension_VideoId
*/
require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
/**
* @see Zend_Gdata_YouTube_Extension_Username
*/
require_once 'Zend/Gdata/YouTube/Extension/Username.php';
/**
* @see Zend_Gdata_YouTube_Extension_Rating
*/
require_once 'Zend/Gdata/Extension/Rating.php';
/**
* A concrete class for working with YouTube user activity entries.
*
* @link http://code.google.com/apis/youtube/
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_ActivityEntry extends Zend_Gdata_Entry
{
const ACTIVITY_CATEGORY_SCHEME =
'http://gdata.youtube.com/schemas/2007/userevents.cat';
/**
* The classname for individual user activity entry elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry';
/**
* The ID of the video that was part of the activity
*
* @var Zend_Gdata_YouTube_VideoId
*/
protected $_videoId = null;
/**
* The username for the user that was part of the activity
*
* @var Zend_Gdata_YouTube_Username
*/
protected $_username = null;
/**
* The rating element that was part of the activity
*
* @var Zend_Gdata_Extension_Rating
*/
protected $_rating = null;
/**
* Constructs a new Zend_Gdata_YouTube_ActivityEntry object.
* @param DOMElement $element (optional) The DOMElement on which to
* base this object.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_videoId !== null) {
$element->appendChild($this->_videoId->getDOM(
$element->ownerDocument));
}
if ($this->_username !== null) {
$element->appendChild($this->_username->getDOM(
$element->ownerDocument));
}
if ($this->_rating !== null) {
$element->appendChild($this->_rating->getDOM(
$element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('yt') . ':' . 'videoid':
$videoId = new Zend_Gdata_YouTube_Extension_VideoId();
$videoId->transferFromDOM($child);
$this->_videoId = $videoId;
break;
case $this->lookupNamespace('yt') . ':' . 'username':
$username = new Zend_Gdata_YouTube_Extension_Username();
$username->transferFromDOM($child);
$this->_username = $username;
break;
case $this->lookupNamespace('gd') . ':' . 'rating':
$rating = new Zend_Gdata_Extension_Rating();
$rating->transferFromDOM($child);
$this->_rating = $rating;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Returns the video ID for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_VideoId
*/
public function getVideoId()
{
return $this->_videoId;
}
/**
* Returns the username for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_Username
*/
public function getUsername()
{
return $this->_username;
}
/**
* Returns the rating for this activity entry.
*
* @return null|Zend_Gdata_YouTube_Extension_Rating
*/
public function getRating()
{
return $this->_rating;
}
/**
* Return the value of the rating for this video entry.
*
* Convenience method to save needless typing.
*
* @return integer|null The value of the rating that was created, if found.
*/
public function getRatingValue()
{
$rating = $this->_rating;
if ($rating) {
return $rating->getValue();
}
return null;
}
/**
* Return the activity type that was performed.
*
* Convenience method that inspects category where scheme is
* http://gdata.youtube.com/schemas/2007/userevents.cat.
*
* @return string|null The activity category if found.
*/
public function getActivityType()
{
$categories = $this->getCategory();
foreach($categories as $category) {
if ($category->getScheme() == self::ACTIVITY_CATEGORY_SCHEME) {
return $category->getTerm();
}
}
return null;
}
/**
* Convenience method to quickly get access to the author of the activity
*
* @return string The author of the activity
*/
public function getAuthorName()
{
$authors = $this->getAuthor();
return $authors[0]->getName()->getText();
}
}

View File

@ -0,0 +1,65 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_YouTube_ActivityEntry
*/
require_once 'Zend/Gdata/YouTube/ActivityEntry.php';
/**
* A feed of user activity entries for YouTube
*
* @link http://code.google.com/apis/youtube/
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_ActivityFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry';
/**
* Creates an Activity feed, representing a list of activity entries
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Media/Feed.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -43,4 +44,15 @@ class Zend_Gdata_YouTube_CommentEntry extends Zend_Gdata_Entry
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_CommentEntry';
/**
* Constructs a new Zend_Gdata_YouTube_CommentEntry object.
* @param DOMElement $element (optional) The DOMElement on which to
* base this object.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}

View File

@ -35,6 +35,7 @@ require_once 'Zend/Gdata/YouTube/CommentEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -57,9 +58,7 @@ class Zend_Gdata_YouTube_CommentFeed extends Zend_Gdata_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -36,6 +36,7 @@ require_once 'Zend/Gdata/YouTube/Extension/Status.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -65,20 +66,18 @@ class Zend_Gdata_YouTube_ContactEntry extends Zend_Gdata_YouTube_UserProfileEntr
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)

View File

@ -37,6 +37,7 @@ require_once 'Zend/Gdata/YouTube/ContactEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -59,9 +60,7 @@ class Zend_Gdata_YouTube_ContactFeed extends Zend_Gdata_Media_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:aboutMe element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_AboutMe extends Zend_Gdata_Extension
{
protected $_rootElement = 'aboutMe';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Age extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -26,10 +26,11 @@
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:recordingDate element
* Represents the yt:books element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Books extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Company extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -35,6 +35,7 @@ require_once 'Zend/Gdata/YouTube/Extension/State.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -51,9 +52,7 @@ class Zend_Gdata_YouTube_Extension_Control extends Zend_Gdata_App_Extension_Cont
*/
public function __construct($draft = null, $state = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($draft);
$this->_state = $state;
}
@ -120,7 +119,7 @@ class Zend_Gdata_YouTube_Extension_Control extends Zend_Gdata_App_Extension_Cont
return $this;
}
/**
/**
* Get the value of this element's state attribute.
*
* @return string The state's text value

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:countHint element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_CountHint extends Zend_Gdata_Extension
{
protected $_rootElement = 'countHint';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Description extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -44,23 +45,21 @@ class Zend_Gdata_YouTube_Extension_Duration extends Zend_Gdata_Extension
* Constructs a new Zend_Gdata_YouTube_Extension_Duration object.
* @param bool $seconds(optional) The seconds value of the element.
*/
public function __construct($seconds = null)
public function __construct($seconds = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_seconds = $seconds;
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_seconds = $seconds;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
@ -74,7 +73,7 @@ class Zend_Gdata_YouTube_Extension_Duration extends Zend_Gdata_Extension
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and valueare
* instance members. If no mapping is defined, the name and valueare
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
@ -118,7 +117,7 @@ class Zend_Gdata_YouTube_Extension_Duration extends Zend_Gdata_Extension
*
* @return string The duration in seconds
*/
public function __toString()
public function __toString()
{
return $this->_seconds;
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:firstName element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_FirstName extends Zend_Gdata_Extension
{
protected $_rootElement = 'firstName';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Gender extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Hobbies extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Hometown extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:lastName element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_LastName extends Zend_Gdata_Extension
{
protected $_rootElement = 'lastName';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -35,6 +35,7 @@ require_once 'Zend/Gdata/YouTube/Extension/Token.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -51,9 +52,7 @@ class Zend_Gdata_YouTube_Extension_Link extends Zend_Gdata_App_Extension_Link
public function __construct($href = null, $rel = null, $type = null,
$hrefLang = null, $title = null, $length = null, $token = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
$this->_token = $token;
}
@ -120,7 +119,7 @@ class Zend_Gdata_YouTube_Extension_Link extends Zend_Gdata_App_Extension_Link
return $this;
}
/**
/**
* Get the value of this element's token attribute.
*
* @return string The token's text value

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Location extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -28,11 +28,12 @@ require_once 'Zend/Gdata/Media/Extension/MediaContent.php';
/**
* Represents the media:content element of Media RSS.
* Represents media objects. Multiple media objects representing
* the same content can be represented using a
* the same content can be represented using a
* media:group (Zend_Gdata_Media_Extension_MediaGroup) element.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -48,12 +49,10 @@ class Zend_Gdata_YouTube_Extension_MediaContent extends Zend_Gdata_Media_Extensi
* @var int
*/
protected $_format = null;
function __construct() {
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
}
@ -78,7 +77,7 @@ class Zend_Gdata_YouTube_Extension_MediaContent extends Zend_Gdata_Media_Extensi
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled

View File

@ -0,0 +1,188 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Media
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_App_Extension
*/
require_once 'Zend/Gdata/App/Extension.php';
/**
* Represents the YouTube specific media:credit element
*
* @category Zend
* @package Zend_Gdata
* @subpackage Media
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_MediaCredit extends Zend_Gdata_Extension
{
protected $_rootElement = 'credit';
protected $_rootNamespace = 'media';
/**
* @var string
*/
protected $_role = null;
/**
* @var string
*/
protected $_scheme = null;
/**
* Represents the value of the yt:type attribute.
*
* Set to 'partner' if the uploader of this video is a YouTube
* partner.
*
* @var string
*/
protected $_yttype = null;
/**
* Creates an individual MediaCredit object.
*
* @param string $text
* @param string $role
* @param string $scheme
*/
public function __construct($text = null, $role = null, $scheme = null,
$yttype = null)
{
$this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
parent::__construct();
$this->_text = $text;
$this->_role = $role;
$this->_scheme = $scheme;
$this->_yttype = $yttype;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_role !== null) {
$element->setAttribute('role', $this->_role);
}
if ($this->_scheme !== null) {
$element->setAttribute('scheme', $this->_scheme);
}
if ($this->_yttype !== null) {
$element->setAttributeNS('http://gdata.youtube.com/schemas/2007',
'yt:type', $this->_yttype);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'role':
$this->_role = $attribute->nodeValue;
break;
case 'scheme':
$this->_scheme = $attribute->nodeValue;
break;
case 'type':
$this->_yttype = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* @return string
*/
public function getRole()
{
return $this->_role;
}
/**
* @param string $value
* @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
* interface
*/
public function setRole($value)
{
$this->_role = $value;
return $this;
}
/**
* @return string
*/
public function getScheme()
{
return $this->_scheme;
}
/**
* @param string $value
* @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
* interface
*/
public function setScheme($value)
{
$this->_scheme = $value;
return $this;
}
/**
* @return string
*/
public function getYTtype()
{
return $this->_yttype;
}
/**
* @param string $value
* @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
* interface
*/
public function setYTtype($value)
{
$this->_yttype = $value;
return $this;
}
}

View File

@ -35,19 +35,40 @@ require_once 'Zend/Gdata/YouTube/Extension/MediaContent.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Duration.php';
/**
* @see Zend_Gdata_YouTube_Extension_MediaRating
*/
require_once 'Zend/Gdata/YouTube/Extension/MediaRating.php';
/**
* @see Zend_Gdata_YouTube_Extension_MediaCredit
*/
require_once 'Zend/Gdata/YouTube/Extension/MediaCredit.php';
/**
* @see Zend_Gdata_YouTube_Extension_Private
*/
require_once 'Zend/Gdata/YouTube/Extension/Private.php';
/**
* @see Zend_Gdata_YouTube_Extension_VideoId
*/
require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
/**
* @see Zend_Gdata_YouTube_Extension_Uploaded
*/
require_once 'Zend/Gdata/YouTube/Extension/Uploaded.php';
/**
* This class represents the media:group element of Media RSS.
* It allows the grouping of media:content elements that are
* It allows the grouping of media:content elements that are
* different representations of the same content. When it exists,
* it is a child of an Entry (Atom) or Item (RSS).
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -57,14 +78,39 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
protected $_rootElement = 'group';
protected $_rootNamespace = 'media';
/**
* @var Zend_Gdata_YouTube_Extension_Duration
*/
protected $_duration = null;
/**
* @var Zend_Gdata_YouTube_Extension_Private
*/
protected $_private = null;
/**
* @var Zend_Gdata_YouTube_Extension_VideoId
*/
protected $_videoid = null;
/**
* @var Zend_Gdata_YouTube_Extension_MediaRating
*/
protected $_mediarating = null;
/**
* @var Zend_Gdata_YouTube_Extension_MediaCredit
*/
protected $_mediacredit = null;
/**
* @var Zend_Gdata_YouTube_Extension_Uploaded
*/
protected $_uploaded = null;
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
@ -72,10 +118,28 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_duration !== null) {
$element->appendChild($this->_duration->getDOM($element->ownerDocument));
$element->appendChild(
$this->_duration->getDOM($element->ownerDocument));
}
if ($this->_private !== null) {
$element->appendChild($this->_private->getDOM($element->ownerDocument));
$element->appendChild(
$this->_private->getDOM($element->ownerDocument));
}
if ($this->_videoid != null) {
$element->appendChild(
$this->_videoid->getDOM($element->ownerDocument));
}
if ($this->_uploaded != null) {
$element->appendChild(
$this->_uploaded->getDOM($element->ownerDocument));
}
if ($this->_mediacredit != null) {
$element->appendChild(
$this->_mediacredit->getDOM($element->ownerDocument));
}
if ($this->_mediarating != null) {
$element->appendChild(
$this->_mediarating->getDOM($element->ownerDocument));
}
return $element;
}
@ -95,6 +159,16 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
$content->transferFromDOM($child);
$this->_content[] = $content;
break;
case $this->lookupNamespace('media') . ':' . 'rating':
$mediarating = new Zend_Gdata_YouTube_Extension_MediaRating();
$mediarating->transferFromDOM($child);
$this->_mediarating = $mediarating;
break;
case $this->lookupNamespace('media') . ':' . 'credit':
$mediacredit = new Zend_Gdata_YouTube_Extension_MediaCredit();
$mediacredit->transferFromDOM($child);
$this->_mediacredit = $mediacredit;
break;
case $this->lookupNamespace('yt') . ':' . 'duration':
$duration = new Zend_Gdata_YouTube_Extension_Duration();
$duration->transferFromDOM($child);
@ -105,7 +179,16 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
$private->transferFromDOM($child);
$this->_private = $private;
break;
case $this->lookupNamespace('yt') . ':' . 'videoid':
$videoid = new Zend_Gdata_YouTube_Extension_VideoId();
$videoid ->transferFromDOM($child);
$this->_videoid = $videoid;
break;
case $this->lookupNamespace('yt') . ':' . 'uploaded':
$uploaded = new Zend_Gdata_YouTube_Extension_Uploaded();
$uploaded ->transferFromDOM($child);
$this->_uploaded = $uploaded;
break;
default:
parent::takeChildFromDOM($child);
break;
@ -126,7 +209,8 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
* Sets the duration value of this element
*
* @param Zend_Gdata_YouTube_Extension_Duration $value The duration value
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent interface
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setDuration($value)
{
@ -134,6 +218,52 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
return $this;
}
/**
* Returns the videoid value of this element
*
* @return Zend_Gdata_YouTube_Extension_VideoId
*/
public function getVideoId()
{
return $this->_videoid;
}
/**
* Sets the videoid value of this element
*
* @param Zend_Gdata_YouTube_Extension_VideoId $value The video id value
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setVideoId($value)
{
$this->_videoid = $value;
return $this;
}
/**
* Returns the yt:uploaded element
*
* @return Zend_Gdata_YouTube_Extension_Uploaded
*/
public function getUploaded()
{
return $this->_uploaded;
}
/**
* Sets the yt:uploaded element
*
* @param Zend_Gdata_YouTube_Extension_Uploaded $value The uploaded value
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setUploaded($value)
{
$this->_uploaded = $value;
return $this;
}
/**
* Returns the private value of this element
*
@ -148,7 +278,8 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
* Sets the private value of this element
*
* @param Zend_Gdata_YouTube_Extension_Private $value The private value
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent interface
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setPrivate($value)
{
@ -156,4 +287,49 @@ class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension
return $this;
}
/**
* Returns the rating value of this element
*
* @return Zend_Gdata_YouTube_Extension_MediaRating
*/
public function getMediaRating()
{
return $this->_mediarating;
}
/**
* Sets the media:rating value of this element
*
* @param Zend_Gdata_YouTube_Extension_MediaRating $value The rating element
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setMediaRating($value)
{
$this->_mediarating = $value;
return $this;
}
/**
* Returns the media:credit value of this element
*
* @return Zend_Gdata_YouTube_Extension_MediaCredit
*/
public function getMediaCredit()
{
return $this->_mediacredit;
}
/**
* Sets the media:credit value of this element
*
* @param Zend_Gdata_YouTube_Extension_MediaCredit $value The credit element
* @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
* interface
*/
public function setMediaCredit($value)
{
$this->_mediacredit = $value;
return $this;
}
}

View File

@ -0,0 +1,149 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Media
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the media:rating element specific to YouTube.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_MediaRating extends Zend_Gdata_Extension
{
protected $_rootElement = 'rating';
protected $_rootNamespace = 'media';
/**
* @var string
*/
protected $_scheme = null;
/**
* @var string
*/
protected $_country = null;
/**
* Constructs a new MediaRating element
*
* @param string $text
* @param string $scheme
* @param string $country
*/
public function __construct($text = null, $scheme = null, $country = null)
{
$this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
parent::__construct();
$this->_scheme = $scheme;
$this->_country = $country;
$this->_text = $text;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_scheme !== null) {
$element->setAttribute('scheme', $this->_scheme);
}
if ($this->_country != null) {
$element->setAttribute('country', $this->_country);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'scheme':
$this->_scheme = $attribute->nodeValue;
break;
case 'country':
$this->_country = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* @return string
*/
public function getScheme()
{
return $this->_scheme;
}
/**
* @param string $value
* @return Zend_Gdata_YouTube_Extension_MediaRating Provides a fluent interface
*/
public function setScheme($value)
{
$this->_scheme = $value;
return $this;
}
/**
* @return string
*/
public function getCountry()
{
return $this->_country;
}
/**
* @param string $value
* @return Zend_Gdata_YouTube_Extension_MediaRating Provides a fluent interface
*/
public function setCountry($value)
{
$this->_country = $value;
return $this;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Movies extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Music extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -43,12 +44,10 @@ class Zend_Gdata_YouTube_Extension_NoEmbed extends Zend_Gdata_Extension
* Constructs a new Zend_Gdata_YouTube_Extension_VideoShare object.
* @param bool $enabled(optional) The enabled value of the element.
*/
public function __construct($enabled = null)
public function __construct($enabled = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Occupation extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:playlistId element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_PlaylistId extends Zend_Gdata_Extension
{
protected $_rootElement = 'playlistId';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:playlistTitle element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_PlaylistTitle extends Zend_Gdata_Extension
{
protected $_rootElement = 'playlistTitle';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,14 +42,12 @@ class Zend_Gdata_YouTube_Extension_Position extends Zend_Gdata_Extension
/**
* Constructs a new Zend_Gdata_YouTube_Extension_Position object.
*
*
* @param string $value (optional) The 1-based position in the playlist
*/
public function __construct($value = null)
public function __construct($value = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $value;
}
@ -85,6 +84,6 @@ class Zend_Gdata_YouTube_Extension_Position extends Zend_Gdata_Extension
{
return $this->getValue();
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -42,22 +43,20 @@ class Zend_Gdata_YouTube_Extension_Private extends Zend_Gdata_Extension
/**
* Constructs a new Zend_Gdata_YouTube_Extension_Private object.
*/
public function __construct()
public function __construct()
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
@ -68,7 +67,7 @@ class Zend_Gdata_YouTube_Extension_Private extends Zend_Gdata_Extension
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and valueare
* instance members. If no mapping is defined, the name and valueare
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:queryString element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_QueryString extends Zend_Gdata_Extension
{
protected $_rootElement = 'queryString';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -44,23 +45,21 @@ class Zend_Gdata_YouTube_Extension_Racy extends Zend_Gdata_Extension
* Constructs a new Zend_Gdata_YouTube_Extension_Racy object.
* @param bool $state(optional) The state value of the element.
*/
public function __construct($state = null)
public function __construct($state = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_state = $state;
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_state = $state;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
@ -74,7 +73,7 @@ class Zend_Gdata_YouTube_Extension_Racy extends Zend_Gdata_Extension
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
@ -116,7 +115,7 @@ class Zend_Gdata_YouTube_Extension_Racy extends Zend_Gdata_Extension
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*/
public function __toString()
public function __toString()
{
return $this->_state;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Recorded extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Relationship extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_ReleaseDate extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_School extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -50,27 +51,25 @@ class Zend_Gdata_YouTube_Extension_State extends Zend_Gdata_Extension
* @param string $reasonCode(optional) The reasonCode value
* @param string $helpUrl(optional) The helpUrl value
*/
public function __construct($explanation = null, $name = null,
$reasonCode = null, $helpUrl = null)
public function __construct($explanation = null, $name = null,
$reasonCode = null, $helpUrl = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_text = $explanation;
$this->_name = $name;
$this->_reasonCode = $reasonCode;
$this->_helpUrl = $reasonCode;
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $explanation;
$this->_name = $name;
$this->_reasonCode = $reasonCode;
$this->_helpUrl = $reasonCode;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
@ -90,7 +89,7 @@ class Zend_Gdata_YouTube_Extension_State extends Zend_Gdata_Extension
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and valueare
* instance members. If no mapping is defined, the name and valueare
* stored in an array.
* TODO: Convert attributes to proper types
*
@ -185,7 +184,7 @@ class Zend_Gdata_YouTube_Extension_State extends Zend_Gdata_Extension
*
* @return string
*/
public function __toString()
public function __toString()
{
return $this->_text;
}

View File

@ -16,7 +16,7 @@
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -30,7 +30,8 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
@ -38,49 +39,114 @@ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
protected $_rootNamespace = 'yt';
protected $_rootElement = 'statistics';
/**
* The videoWatchCount attribute specifies the number of videos
* that a user has watched on YouTube. The videoWatchCount attribute
* is only specified when the <yt:statistics> tag appears within a
* user profile entry.
*
* @var integer
*/
protected $_videoWatchCount = null;
/**
* When the viewCount attribute refers to a video entry, the attribute
* specifies the number of times that the video has been viewed.
* When the viewCount attribute refers to a user profile, the attribute
* specifies the number of times that the user's profile has been
* viewed.
*
* @var integer
*/
protected $_viewCount = null;
protected $_watchCount = null;
/**
* The subscriberCount attribute specifies the number of YouTube users
* who have subscribed to a particular user's YouTube channel.
* The subscriberCount attribute is only specified when the
* <yt:statistics> tag appears within a user profile entry.
*
* @var integer
*/
protected $_subscriberCount = null;
/**
* The lastWebAccess attribute indicates the most recent time that
* a particular user used YouTube.
*
* @var string
*/
protected $_lastWebAccess = null;
/**
* The favoriteCount attribute specifies the number of YouTube users
* who have added a video to their list of favorite videos. The
* favoriteCount attribute is only specified when the
* <yt:statistics> tag appears within a video entry.
*
* @var integer
*/
protected $_favoriteCount = null;
/**
* Constructs a new Zend_Gdata_YouTube_Extension_Statistics object.
* @param string $viewCount(optional) The viewCount value
* @param string $watchCount(optional) The watchCount value
* @param string $videoWatchCount(optional) The videoWatchCount value
* @param string $subscriberCount(optional) The subscriberCount value
* @param string $lastWebAccess(optional) The lastWebAccess value
* @param string $favoriteCount(optional) The favoriteCount value
*/
public function __construct($viewCount = null, $watchCount = null)
public function __construct($viewCount = null, $videoWatchCount = null,
$subscriberCount = null, $lastWebAccess = null,
$favoriteCount = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_viewCount = $viewCount;
$this->_watchCount = $watchCount;
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_viewCount = $viewCount;
$this->_videoWatchCount = $videoWatchCount;
$this->_subscriberCount = $subscriberCount;
$this->_lastWebAccess = $lastWebAccess;
$this->_favoriteCount = $favoriteCount;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_videoWatchCount !== null) {
$element->setAttribute('watchCount', $this->_videoWatchCount);
}
if ($this->_viewCount !== null) {
$element->setAttribute('viewCount', $this->_viewCount);
}
if ($this->_watchCount !== null) {
$element->setAttribute('watchCount', $this->_watchCount);
if ($this->_subscriberCount !== null) {
$element->setAttribute('subscriberCount',
$this->_subscriberCount);
}
if ($this->_lastWebAccess !== null) {
$element->setAttribute('lastWebAccess',
$this->_lastWebAccess);
}
if ($this->_favoriteCount !== null) {
$element->setAttribute('favoriteCount',
$this->_favoriteCount);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and valueare
* instance members. If no mapping is defined, the name and valueare
* stored in an array.
* TODO: Convert attributes to proper types
*
@ -89,11 +155,20 @@ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'videoWatchCount':
$this->_videoWatchCount = $attribute->nodeValue;
break;
case 'viewCount':
$this->_viewCount = $attribute->nodeValue;
break;
case 'watchCount':
$this->_watchCount = $attribute->nodeValue;
case 'subscriberCount':
$this->_subscriberCount = $attribute->nodeValue;
break;
case 'lastWebAccess':
$this->_lastWebAccess = $attribute->nodeValue;
break;
case 'favoriteCount':
$this->_favoriteCount = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
@ -114,7 +189,8 @@ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
* Set the value for this element's viewCount attribute.
*
* @param int $value The desired value for this attribute.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being modified.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being
* modified.
*/
public function setViewCount($value)
{
@ -123,24 +199,94 @@ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
}
/**
* Get the value for this element's watchCount attribute.
* Get the value for this element's videoWatchCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getWatchCount()
public function getVideoWatchCount()
{
return $this->_watchCount;
return $this->_videoWatchCount;
}
/**
* Set the value for this element's watchCount attribute.
* Set the value for this element's videoWatchCount attribute.
*
* @param int $value The desired value for this attribute.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being modified.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being
* modified.
*/
public function setWatchCount($value)
public function setVideoWatchCount($value)
{
$this->_watchCount = $value;
$this->_videoWatchCount = $value;
return $this;
}
/**
* Get the value for this element's subscriberCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getSubscriberCount()
{
return $this->_subscriberCount;
}
/**
* Set the value for this element's subscriberCount attribute.
*
* @param int $value The desired value for this attribute.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being
* modified.
*/
public function setSubscriberCount($value)
{
$this->_subscriberCount = $value;
return $this;
}
/**
* Get the value for this element's lastWebAccess attribute.
*
* @return int The value associated with this attribute.
*/
public function getLastWebAccess()
{
return $this->_lastWebAccess;
}
/**
* Set the value for this element's lastWebAccess attribute.
*
* @param int $value The desired value for this attribute.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being
* modified.
*/
public function setLastWebAccess($value)
{
$this->_lastWebAccess = $value;
return $this;
}
/**
* Get the value for this element's favoriteCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getFavoriteCount()
{
return $this->_favoriteCount;
}
/**
* Set the value for this element's favoriteCount attribute.
*
* @param int $value The desired value for this attribute.
* @return Zend_Gdata_YouTube_Extension_Statistics The element being
* modified.
*/
public function setFavoriteCount($value)
{
$this->_favoriteCount = $value;
return $this;
}
@ -150,9 +296,13 @@ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension
*
* @return string
*/
public function __toString()
public function __toString()
{
return 'View Count=' . $this->_viewCount;
return 'View Count=' . $this->_viewCount .
' VideoWatchCount=' . $this->_videoWatchCount .
' SubscriberCount=' . $this->_subscriberCount .
' LastWebAccess=' . $this->_lastWebAccess .
' FavoriteCount=' . $this->_favoriteCount;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Status extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -44,14 +45,12 @@ class Zend_Gdata_YouTube_Extension_Token extends Zend_Gdata_App_Extension
*/
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
/**
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:uploaded element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_Uploaded extends Zend_Gdata_Extension
{
protected $_rootElement = 'uploaded';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -41,9 +42,7 @@ class Zend_Gdata_YouTube_Extension_Username extends Zend_Gdata_Extension
public function __construct($text = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Represents the yt:videoid element
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_Extension_VideoId extends Zend_Gdata_Extension
{
protected $_rootElement = 'videoid';
protected $_rootNamespace = 'yt';
public function __construct($text = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_text = $text;
}
}

View File

@ -0,0 +1,280 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Media_Entry
*/
require_once 'Zend/Gdata/Media/Entry.php';
/**
* @see Zend_Gdata_Extension_Rating
*/
require_once 'Zend/Gdata/Extension/Rating.php';
/**
* @see Zend_Gdata_Extension_Comments
*/
require_once 'Zend/Gdata/Extension/Comments.php';
/**
* @see Zend_Gdata_YouTube_Extension_Statistics
*/
require_once 'Zend/Gdata/YouTube/Extension/Statistics.php';
/**
* @see Zend_Gdata_YouTube_Extension_Description
*/
require_once 'Zend/Gdata/YouTube/Extension/Description.php';
/**
* Represents the YouTube message flavor of an Atom entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_InboxEntry extends Zend_Gdata_Media_Entry
{
protected $_entryClassName = 'Zend_Gdata_YouTube_InboxEntry';
/**
* The gd:comments element of this entry.
*
* @var Zend_Gdata_Extension_Comments
*/
protected $_comments = null;
/**
* The gd:rating element of this entry.
*
* @var Zend_Gdata_Extension_Rating
*/
protected $_rating = null;
/**
* The yt:statistics element of this entry.
*
* @var Zend_Gdata_YouTube_Extension_Statistics
*/
protected $_statistics = null;
/**
* The yt:description element of this entry.
*
* @var Zend_Gdata_YouTube_Extension_Description
*/
protected $_description = null;
/**
* Creates a subscription entry, representing an individual subscription
* in a list of subscriptions, usually associated with an individual user.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_description != null) {
$element->appendChild(
$this->_description->getDOM($element->ownerDocument));
}
if ($this->_rating != null) {
$element->appendChild(
$this->_rating->getDOM($element->ownerDocument));
}
if ($this->_statistics != null) {
$element->appendChild(
$this->_statistics->getDOM($element->ownerDocument));
}
if ($this->_comments != null) {
$element->appendChild(
$this->_comments->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them in the $_entry array based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('gd') . ':' . 'comments':
$comments = new Zend_Gdata_Extension_Comments();
$comments->transferFromDOM($child);
$this->_comments = $comments;
break;
case $this->lookupNamespace('gd') . ':' . 'rating':
$rating = new Zend_Gdata_Extension_Rating();
$rating->transferFromDOM($child);
$this->_rating = $rating;
break;
case $this->lookupNamespace('yt') . ':' . 'description':
$description = new Zend_Gdata_YouTube_Extension_Description();
$description->transferFromDOM($child);
$this->_description = $description;
break;
case $this->lookupNamespace('yt') . ':' . 'statistics':
$statistics = new Zend_Gdata_YouTube_Extension_Statistics();
$statistics->transferFromDOM($child);
$this->_statistics = $statistics;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Get the yt:description
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_Description|null
*/
public function getDescription()
{
if ($this->getMajorProtocolVersion() == 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getDescription ' .
' method is only supported in version 1 of the YouTube ' .
'API.');
} else {
return $this->_description;
}
}
/**
* Sets the yt:description element for a new inbox entry.
*
* @param Zend_Gdata_YouTube_Extension_Description $description The
* description.
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface
*/
public function setDescription($description = null)
{
if ($this->getMajorProtocolVersion() == 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setDescription ' .
' method is only supported in version 1 of the YouTube ' .
'API.');
} else {
$this->_description = $description;
return $this;
}
}
/**
* Get the gd:rating element for the inbox entry
*
* @return Zend_Gdata_Extension_Rating|null
*/
public function getRating()
{
return $this->_rating;
}
/**
* Sets the gd:rating element for the inbox entry
*
* @param Zend_Gdata_Extension_Rating $rating The rating for the video in
* the message
* @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface
*/
public function setRating($rating = null)
{
$this->_rating = $rating;
return $this;
}
/**
* Get the gd:comments element of the inbox entry.
*
* @return Zend_Gdata_Extension_Comments|null
*/
public function getComments()
{
return $this->_comments;
}
/**
* Sets the gd:comments element for the inbox entry
*
* @param Zend_Gdata_Extension_Comments $comments The comments feed link
* @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface
*/
public function setComments($comments = null)
{
$this->_comments = $comments;
return $this;
}
/**
* Get the yt:statistics element for the inbox entry
*
* @return Zend_Gdata_YouTube_Extension_Statistics|null
*/
public function getStatistics()
{
return $this->_statistics;
}
/**
* Sets the yt:statistics element for the inbox entry
*
* @param Zend_Gdata_YouTube_Extension_Statistics $statistics The
* statistics element for the video in the message
* @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface
*/
public function setStatistics($statistics = null)
{
$this->_statistics = $statistics;
return $this;
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Media_Feed
*/
require_once 'Zend/Gdata/Media/Feed.php';
/**
* @see Zend_Gdata_YouTube_InboxEntry
*/
require_once 'Zend/Gdata/YouTube/InboxEntry.php';
/**
* The YouTube inbox feed list flavor of an Atom Feed with media support
* Represents a list of individual inbox entries, where each contained entry is
* a message.
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_YouTube_InboxFeed extends Zend_Gdata_Media_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_YouTube_InboxEntry';
/**
* Creates an Inbox feed, representing a list of messages,
* associated with an individual user.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
}

View File

@ -40,6 +40,7 @@ require_once 'Zend/Gdata/YouTube/Extension/MediaGroup.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

View File

@ -40,11 +40,22 @@ require_once 'Zend/Gdata/Extension/FeedLink.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Description.php';
/**
* @see Zend_Gdata_YouTube_Extension_PlaylistId
*/
require_once 'Zend/Gdata/YouTube/Extension/PlaylistId.php';
/**
* @see Zend_Gdata_YouTube_Extension_CountHint
*/
require_once 'Zend/Gdata/YouTube/Extension/CountHint.php';
/**
* Represents the YouTube video playlist flavor of an Atom entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -63,10 +74,25 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
/**
* Description of this playlist
*
* @var string
* @deprecated Deprecated as of version 2 of the YouTube API.
* @var Zend_Gdata_YouTube_Extension_Description
*/
protected $_description = null;
/**
* Id of this playlist
*
* @var Zend_Gdata_YouTube_Extension_PlaylistId
*/
protected $_playlistId = null;
/**
* CountHint for this playlist.
*
* @var Zend_Gdata_YouTube_Extension_CountHint
*/
protected $_countHint = null;
/**
* Creates a Playlist list entry, representing an individual playlist
* in a list of playlists, usually associated with an individual user.
@ -76,21 +102,19 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
@ -98,6 +122,12 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
if ($this->_description != null) {
$element->appendChild($this->_description->getDOM($element->ownerDocument));
}
if ($this->_countHint != null) {
$element->appendChild($this->_countHint->getDOM($element->ownerDocument));
}
if ($this->_playlistId != null) {
$element->appendChild($this->_playlistId->getDOM($element->ownerDocument));
}
if ($this->_feedLink != null) {
foreach ($this->_feedLink as $feedLink) {
$element->appendChild($feedLink->getDOM($element->ownerDocument));
@ -121,6 +151,16 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
$description->transferFromDOM($child);
$this->_description = $description;
break;
case $this->lookupNamespace('yt') . ':' . 'countHint':
$countHint = new Zend_Gdata_YouTube_Extension_CountHint();
$countHint->transferFromDOM($child);
$this->_countHint = $countHint;
break;
case $this->lookupNamespace('yt') . ':' . 'playlistId':
$playlistId = new Zend_Gdata_YouTube_Extension_PlaylistId();
$playlistId->transferFromDOM($child);
$this->_playlistId = $playlistId;
break;
case $this->lookupNamespace('gd') . ':' . 'feedLink':
$feedLink = new Zend_Gdata_Extension_FeedLink();
$feedLink->transferFromDOM($child);
@ -135,27 +175,76 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
/**
* Sets the description relating to the playlist.
*
* @deprecated Deprecated as of version 2 of the YouTube API.
* @param Zend_Gdata_YouTube_Extension_Description $description The description relating to the video
* @return Zend_Gdata_YouTube_PlaylistListEntry Provides a fluent interface
*/
public function setDescription($description = null)
*/
public function setDescription($description = null)
{
$this->_description = $description;
if ($this->getMajorProtocolVersion() >= 2) {
$this->setSummary($description);
} else {
$this->_description = $description;
}
return $this;
}
}
/**
* Returns the description relating to the video.
*
* @return Zend_Gdata_YouTube_Extension_Description The description relating to the video
* @return Zend_Gdata_YouTube_Extension_Description The description
* relating to the video
*/
public function getDescription()
{
return $this->_description;
if ($this->getMajorProtocolVersion() >= 2) {
return $this->getSummary();
} else {
return $this->_description;
}
}
/**
* Sets the array of embedded feeds related to the video
* Returns the countHint relating to the playlist.
*
* The countHint is the number of videos on a playlist.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_CountHint The count of videos on
* a playlist.
*/
public function getCountHint()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The yt:countHint ' .
'element is not supported in versions earlier than 2.');
} else {
return $this->_countHint;
}
}
/**
* Returns the Id relating to the playlist.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_PlaylistId The id of this playlist.
*/
public function getPlaylistId()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The yt:playlistId ' .
'element is not supported in versions earlier than 2.');
} else {
return $this->_playlistId;
}
}
/**
* Sets the array of embedded feeds related to the playlist
*
* @param array $feedLink The array of embedded feeds relating to the video
* @return Zend_Gdata_YouTube_PlaylistListEntry Provides a fluent interface
@ -200,7 +289,11 @@ class Zend_Gdata_YouTube_PlaylistListEntry extends Zend_Gdata_Entry
*/
public function getPlaylistVideoFeedUrl()
{
return $this->getFeedLink(Zend_Gdata_YouTube::PLAYLIST_REL)->href;
if ($this->getMajorProtocolVersion() >= 2) {
return $this->getContent()->getSrc();
} else {
return $this->getFeedLink(Zend_Gdata_YouTube::PLAYLIST_REL)->href;
}
}
}

View File

@ -37,6 +37,7 @@ require_once 'Zend/Gdata/YouTube/PlaylistListEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -59,9 +60,7 @@ class Zend_Gdata_YouTube_PlaylistListFeed extends Zend_Gdata_Media_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -35,6 +35,7 @@ require_once 'Zend/Gdata/YouTube/Extension/Position.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -59,21 +60,19 @@ class Zend_Gdata_YouTube_PlaylistVideoEntry extends Zend_Gdata_YouTube_VideoEntr
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
@ -109,7 +108,7 @@ class Zend_Gdata_YouTube_PlaylistVideoEntry extends Zend_Gdata_YouTube_VideoEntr
/**
* Sets the array of embedded feeds related to the video
*
* @param Zend_Gdata_YouTube_Extension_Position $position
* @param Zend_Gdata_YouTube_Extension_Position $position
* The position of the entry in the feed, as specified by the user.
* @return Zend_Gdata_YouTube_PlaylistVideoEntry Provides a fluent interface
*/

View File

@ -37,6 +37,7 @@ require_once 'Zend/Gdata/YouTube/PlaylistVideoEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -59,9 +60,7 @@ class Zend_Gdata_YouTube_PlaylistVideoFeed extends Zend_Gdata_Media_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -35,11 +35,42 @@ require_once 'Zend/Gdata/Extension/FeedLink.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Description.php';
/**
* @see Zend_Gdata_YouTube_Extension_PlaylistTitle
*/
require_once 'Zend/Gdata/YouTube/Extension/PlaylistTitle.php';
/**
* @see Zend_Gdata_YouTube_Extension_PlaylistId
*/
require_once 'Zend/Gdata/YouTube/Extension/PlaylistId.php';
/**
* @see Zend_Gdata_Media_Extension_MediaThumbnail
*/
require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
/**
* @see Zend_Gdata_YouTube_Extension_Username
*/
require_once 'Zend/Gdata/YouTube/Extension/Username.php';
/**
* @see Zend_Gdata_YouTube_Extension_CountHint
*/
require_once 'Zend/Gdata/YouTube/Extension/CountHint.php';
/**
* @see Zend_Gdata_YouTube_Extension_QueryString
*/
require_once 'Zend/Gdata/YouTube/Extension/QueryString.php';
/**
* Represents the YouTube video subscription flavor of an Atom entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -54,6 +85,54 @@ class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry
* @var array
*/
protected $_feedLink = array();
/**
* The username of this entry.
*
* @var Zend_Gdata_YouTube_Extension_Username
*/
protected $_username = null;
/**
* The playlist title for this entry.
*
* This element is only used on subscriptions to playlists.
*
* @var Zend_Gdata_YouTube_Extension_PlaylistTitle
*/
protected $_playlistTitle = null;
/**
* The playlist id for this entry.
*
* This element is only used on subscriptions to playlists.
*
* @var Zend_Gdata_YouTube_Extension_PlaylistId
*/
protected $_playlistId = null;
/**
* The media:thumbnail element for this entry.
*
* This element is only used on subscriptions to playlists.
*
* @var Zend_Gdata_Media_Extension_MediaThumbnail
*/
protected $_mediaThumbnail = null;
/**
* The countHint for this entry.
*
* @var Zend_Gdata_YouTube_Extension_CountHint
*/
protected $_countHint = null;
/**
* The queryString for this entry.
*
* @var Zend_Gdata_YouTube_Extension_QueryString
*/
protected $_queryString = null;
/**
* Creates a subscription entry, representing an individual subscription
@ -64,25 +143,41 @@ class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_countHint != null) {
$element->appendChild($this->_countHint->getDOM($element->ownerDocument));
}
if ($this->_playlistTitle != null) {
$element->appendChild($this->_playlistTitle->getDOM($element->ownerDocument));
}
if ($this->_playlistId != null) {
$element->appendChild($this->_playlistId->getDOM($element->ownerDocument));
}
if ($this->_mediaThumbnail != null) {
$element->appendChild($this->_mediaThumbnail->getDOM($element->ownerDocument));
}
if ($this->_username != null) {
$element->appendChild($this->_username->getDOM($element->ownerDocument));
}
if ($this->_queryString != null) {
$element->appendChild($this->_queryString->getDOM($element->ownerDocument));
}
if ($this->_feedLink != null) {
foreach ($this->_feedLink as $feedLink) {
$element->appendChild($feedLink->getDOM($element->ownerDocument));
@ -106,6 +201,36 @@ class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry
$feedLink->transferFromDOM($child);
$this->_feedLink[] = $feedLink;
break;
case $this->lookupNamespace('media') . ':' . 'thumbnail':
$mediaThumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
$mediaThumbnail->transferFromDOM($child);
$this->_mediaThumbnail = $mediaThumbnail;
break;
case $this->lookupNamespace('yt') . ':' . 'countHint':
$countHint = new Zend_Gdata_YouTube_Extension_CountHint();
$countHint->transferFromDOM($child);
$this->_countHint = $countHint;
break;
case $this->lookupNamespace('yt') . ':' . 'playlistTitle':
$playlistTitle = new Zend_Gdata_YouTube_Extension_PlaylistTitle();
$playlistTitle->transferFromDOM($child);
$this->_playlistTitle = $playlistTitle;
break;
case $this->lookupNamespace('yt') . ':' . 'playlistId':
$playlistId = new Zend_Gdata_YouTube_Extension_PlaylistId();
$playlistId->transferFromDOM($child);
$this->_playlistId = $playlistId;
break;
case $this->lookupNamespace('yt') . ':' . 'queryString':
$queryString = new Zend_Gdata_YouTube_Extension_QueryString();
$queryString->transferFromDOM($child);
$this->_queryString = $queryString;
break;
case $this->lookupNamespace('yt') . ':' . 'username':
$username = new Zend_Gdata_YouTube_Extension_Username();
$username->transferFromDOM($child);
$this->_username = $username;
break;
default:
parent::takeChildFromDOM($child);
break;
@ -150,5 +275,171 @@ class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry
return null;
}
}
/**
* Get the playlist title for a 'playlist' subscription.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_PlaylistId
*/
public function getPlaylistId()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getPlaylistId ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_playlistId;
}
}
/**
* Sets the yt:playlistId element for a new playlist subscription.
*
* @param Zend_Gdata_YouTube_Extension_PlaylistId $id The id of
* the playlist to which to subscribe to.
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface
*/
public function setPlaylistId($id = null)
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
$this->_playlistId = $id;
return $this;
}
}
/**
* Get the queryString of the subscription
*
* @return Zend_Gdata_YouTube_Extension_QueryString
*/
public function getQueryString()
{
return $this->_queryString;
}
/**
* Sets the yt:queryString element for a new keyword subscription.
*
* @param Zend_Gdata_YouTube_Extension_QueryString $queryString The query
* string to subscribe to
* @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface
*/
public function setQueryString($queryString = null)
{
$this->_queryString = $queryString;
return $this;
}
/**
* Get the playlist title for a 'playlist' subscription.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_PlaylistTitle
*/
public function getPlaylistTitle()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getPlaylistTitle ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_playlistTitle;
}
}
/**
* Sets the yt:playlistTitle element for a new playlist subscription.
*
* @param Zend_Gdata_YouTube_Extension_PlaylistTitle $title The title of
* the playlist to which to subscribe to.
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface
*/
public function setPlaylistTitle($title = null)
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
$this->_playlistTitle = $title;
return $this;
}
}
/**
* Get the counthint for a subscription.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_CountHint
*/
public function getCountHint()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getCountHint ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_countHint;
}
}
/**
* Get the thumbnail for a subscription.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_Media_Extension_MediaThumbnail
*/
public function getMediaThumbnail()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getMediaThumbnail ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_mediaThumbnail;
}
}
/**
* Get the username for a channel subscription.
*
* @return Zend_Gdata_YouTube_Extension_Username
*/
public function getUsername()
{
return $this->_username;
}
/**
* Sets the username for a new channel subscription.
*
* @param Zend_Gdata_YouTube_Extension_Username $username The username of
* the channel to which to subscribe to.
* @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface
*/
public function setUsername($username = null)
{
$this->_username = $username;
return $this;
}
}

View File

@ -37,6 +37,7 @@ require_once 'Zend/Gdata/YouTube/SubscriptionEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -59,9 +60,7 @@ class Zend_Gdata_YouTube_SubscriptionFeed extends Zend_Gdata_Media_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -35,6 +35,11 @@ require_once 'Zend/Gdata/Extension/FeedLink.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Description.php';
/**
* @see Zend_Gdata_YouTube_Extension_AboutMe
*/
require_once 'Zend/Gdata/YouTube/Extension/AboutMe.php';
/**
* @see Zend_Gdata_YouTube_Extension_Age
*/
@ -100,11 +105,32 @@ require_once 'Zend/Gdata/YouTube/Extension/Gender.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Relationship.php';
/**
* @see Zend_Gdata_YouTube_Extension_FirstName
*/
require_once 'Zend/Gdata/YouTube/Extension/FirstName.php';
/**
* @see Zend_Gdata_YouTube_Extension_LastName
*/
require_once 'Zend/Gdata/YouTube/Extension/LastName.php';
/**
* @see Zend_Gdata_YouTube_Extension_Statistics
*/
require_once 'Zend/Gdata/YouTube/Extension/Statistics.php';
/**
* @see Zend_Gdata_Media_Extension_MediaThumbnail
*/
require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
/**
* Represents the YouTube video playlist flavor of an Atom entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -124,7 +150,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
* The username for this profile entry
*
* @var string
*/
*/
protected $_username = null;
/**
@ -134,6 +160,13 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
protected $_description = null;
/**
* The contents of the 'About Me' field.
*
* @var string
*/
protected $_aboutMe = null;
/**
* The age of the user
*
@ -149,8 +182,8 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
protected $_books = null;
/**
* Company
*
* Company
*
* @var string
*/
protected $_company = null;
@ -218,6 +251,34 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
protected $_relationship = null;
/**
* First name
*
* @var string
*/
protected $_firstName = null;
/**
* Last name
*
* @var string
*/
protected $_lastName = null;
/**
* Statistics
*
* @var Zend_Gdata_YouTube_Extension_Statistics
*/
protected $_statistics = null;
/**
* Thumbnail
*
* @var Zend_Gdata_Media_Extension_MediaThumbnail
*/
protected $_thumbnail = null;
/**
* Creates a User Profile entry, representing an individual user
* and their attributes.
@ -227,21 +288,19 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
@ -249,6 +308,9 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
if ($this->_description != null) {
$element->appendChild($this->_description->getDOM($element->ownerDocument));
}
if ($this->_aboutMe != null) {
$element->appendChild($this->_aboutMe->getDOM($element->ownerDocument));
}
if ($this->_age != null) {
$element->appendChild($this->_age->getDOM($element->ownerDocument));
}
@ -288,6 +350,18 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
if ($this->_relationship != null) {
$element->appendChild($this->_relationship->getDOM($element->ownerDocument));
}
if ($this->_firstName != null) {
$element->appendChild($this->_firstName->getDOM($element->ownerDocument));
}
if ($this->_lastName != null) {
$element->appendChild($this->_lastName->getDOM($element->ownerDocument));
}
if ($this->_statistics != null) {
$element->appendChild($this->_statistics->getDOM($element->ownerDocument));
}
if ($this->_thumbnail != null) {
$element->appendChild($this->_thumbnail->getDOM($element->ownerDocument));
}
if ($this->_feedLink != null) {
foreach ($this->_feedLink as $feedLink) {
$element->appendChild($feedLink->getDOM($element->ownerDocument));
@ -311,6 +385,11 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
$description->transferFromDOM($child);
$this->_description = $description;
break;
case $this->lookupNamespace('yt') . ':' . 'aboutMe':
$aboutMe = new Zend_Gdata_YouTube_Extension_AboutMe();
$aboutMe->transferFromDOM($child);
$this->_aboutMe = $aboutMe;
break;
case $this->lookupNamespace('yt') . ':' . 'age':
$age = new Zend_Gdata_YouTube_Extension_Age();
$age->transferFromDOM($child);
@ -376,6 +455,26 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
$relationship->transferFromDOM($child);
$this->_relationship = $relationship;
break;
case $this->lookupNamespace('yt') . ':' . 'firstName':
$firstName = new Zend_Gdata_YouTube_Extension_FirstName();
$firstName->transferFromDOM($child);
$this->_firstName = $firstName;
break;
case $this->lookupNamespace('yt') . ':' . 'lastName':
$lastName = new Zend_Gdata_YouTube_Extension_LastName();
$lastName->transferFromDOM($child);
$this->_lastName = $lastName;
break;
case $this->lookupNamespace('yt') . ':' . 'statistics':
$statistics = new Zend_Gdata_YouTube_Extension_Statistics();
$statistics->transferFromDOM($child);
$this->_statistics = $statistics;
break;
case $this->lookupNamespace('media') . ':' . 'thumbnail':
$thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
$thumbnail->transferFromDOM($child);
$this->_thumbnail = $thumbnail;
break;
case $this->lookupNamespace('gd') . ':' . 'feedLink':
$feedLink = new Zend_Gdata_Extension_FeedLink();
$feedLink->transferFromDOM($child);
@ -388,21 +487,180 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the age
* Sets the content of the 'about me' field.
*
* @param Zend_Gdata_YouTube_Extension_Age $age The age
* @param Zend_Gdata_YouTube_Extension_AboutMe $aboutMe The 'about me'
* information.
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setAge($age = null)
*/
public function setAboutMe($aboutMe = null)
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setAboutMe ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
$this->_aboutMe = $aboutMe;
return $this;
}
}
/**
* Returns the contents of the 'about me' field.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_AboutMe The 'about me' information
*/
public function getAboutMe()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getAboutMe ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_aboutMe;
}
}
/**
* Sets the content of the 'first name' field.
*
* @param Zend_Gdata_YouTube_Extension_FirstName $firstName The first name
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setFirstName($firstName = null)
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setFirstName ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
$this->_firstName = $firstName;
return $this;
}
}
/**
* Returns the first name
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_FirstName The first name
*/
public function getFirstName()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getFirstName ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_firstName;
}
}
/**
* Sets the content of the 'last name' field.
*
* @param Zend_Gdata_YouTube_Extension_LastName $lastName The last name
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setLastName($lastName = null)
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The setLastName ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
$this->_lastName = $lastName;
return $this;
}
}
/**
* Returns the last name
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_LastName The last name
*/
public function getLastName()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getLastName ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_lastName;
}
}
/**
* Returns the statistics
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_Statistics The profile statistics
*/
public function getStatistics()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getStatistics ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_statistics;
}
}
/**
* Returns the thumbnail
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_Media_Extension_MediaThumbnail The profile thumbnail
*/
public function getThumbnail()
{
if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The getThumbnail ' .
' method is only supported as of version 2 of the YouTube ' .
'API.');
} else {
return $this->_thumbnail;
}
}
/**
* Sets the age
*
* @param Zend_Gdata_YouTube_Extension_Age $age The age
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setAge($age = null)
{
$this->_age = $age;
return $this;
}
}
/**
* Returns the age
* Returns the age
*
* @return Zend_Gdata_YouTube_Extension_Age The age
* @return Zend_Gdata_YouTube_Extension_Age The age
*/
public function getAge()
{
@ -410,21 +668,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the username
* Sets the username
*
* @param Zend_Gdata_YouTube_Extension_Username $username The username
* @param Zend_Gdata_YouTube_Extension_Username $username The username
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setUsername($username = null)
*/
public function setUsername($username = null)
{
$this->_username = $username;
return $this;
}
}
/**
* Returns the username
* Returns the username
*
* @return Zend_Gdata_YouTube_Extension_Username The username
* @return Zend_Gdata_YouTube_Extension_Username The username
*/
public function getUsername()
{
@ -432,21 +690,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the books
* Sets the books
*
* @param Zend_Gdata_YouTube_Extension_Books $books The books
* @param Zend_Gdata_YouTube_Extension_Books $books The books
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setBooks($books = null)
*/
public function setBooks($books = null)
{
$this->_books = $books;
return $this;
}
}
/**
* Returns the books
* Returns the books
*
* @return Zend_Gdata_YouTube_Extension_Books The books
* @return Zend_Gdata_YouTube_Extension_Books The books
*/
public function getBooks()
{
@ -454,21 +712,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the company
* Sets the company
*
* @param Zend_Gdata_YouTube_Extension_Company $company The company
* @param Zend_Gdata_YouTube_Extension_Company $company The company
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setCompany($company = null)
*/
public function setCompany($company = null)
{
$this->_company = $company;
return $this;
}
}
/**
* Returns the company
* Returns the company
*
* @return Zend_Gdata_YouTube_Extension_Company The company
* @return Zend_Gdata_YouTube_Extension_Company The company
*/
public function getCompany()
{
@ -476,21 +734,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the hobbies
* Sets the hobbies
*
* @param Zend_Gdata_YouTube_Extension_Hobbies $hobbies The hobbies
* @param Zend_Gdata_YouTube_Extension_Hobbies $hobbies The hobbies
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setHobbies($hobbies = null)
*/
public function setHobbies($hobbies = null)
{
$this->_hobbies = $hobbies;
return $this;
}
}
/**
* Returns the hobbies
* Returns the hobbies
*
* @return Zend_Gdata_YouTube_Extension_Hobbies The hobbies
* @return Zend_Gdata_YouTube_Extension_Hobbies The hobbies
*/
public function getHobbies()
{
@ -498,21 +756,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the hometown
* Sets the hometown
*
* @param Zend_Gdata_YouTube_Extension_Hometown $hometown The hometown
* @param Zend_Gdata_YouTube_Extension_Hometown $hometown The hometown
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setHometown($hometown = null)
*/
public function setHometown($hometown = null)
{
$this->_hometown = $hometown;
return $this;
}
}
/**
* Returns the hometown
* Returns the hometown
*
* @return Zend_Gdata_YouTube_Extension_Hometown The hometown
* @return Zend_Gdata_YouTube_Extension_Hometown The hometown
*/
public function getHometown()
{
@ -520,21 +778,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the location
* Sets the location
*
* @param Zend_Gdata_YouTube_Extension_Location $location The location
* @param Zend_Gdata_YouTube_Extension_Location $location The location
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setLocation($location = null)
*/
public function setLocation($location = null)
{
$this->_location = $location;
return $this;
}
}
/**
* Returns the location
* Returns the location
*
* @return Zend_Gdata_YouTube_Extension_Location The location
* @return Zend_Gdata_YouTube_Extension_Location The location
*/
public function getLocation()
{
@ -542,21 +800,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the movies
* Sets the movies
*
* @param Zend_Gdata_YouTube_Extension_Movies $movies The movies
* @param Zend_Gdata_YouTube_Extension_Movies $movies The movies
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setMovies($movies = null)
*/
public function setMovies($movies = null)
{
$this->_movies = $movies;
return $this;
}
}
/**
* Returns the movies
* Returns the movies
*
* @return Zend_Gdata_YouTube_Extension_Movies The movies
* @return Zend_Gdata_YouTube_Extension_Movies The movies
*/
public function getMovies()
{
@ -564,21 +822,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the music
* Sets the music
*
* @param Zend_Gdata_YouTube_Extension_Music $music The music
* @param Zend_Gdata_YouTube_Extension_Music $music The music
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setMusic($music = null)
*/
public function setMusic($music = null)
{
$this->_music = $music;
return $this;
}
}
/**
* Returns the music
* Returns the music
*
* @return Zend_Gdata_YouTube_Extension_Music The music
* @return Zend_Gdata_YouTube_Extension_Music The music
*/
public function getMusic()
{
@ -586,21 +844,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the occupation
* Sets the occupation
*
* @param Zend_Gdata_YouTube_Extension_Occupation $occupation The occupation
* @param Zend_Gdata_YouTube_Extension_Occupation $occupation The occupation
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setOccupation($occupation = null)
*/
public function setOccupation($occupation = null)
{
$this->_occupation = $occupation;
return $this;
}
}
/**
* Returns the occupation
* Returns the occupation
*
* @return Zend_Gdata_YouTube_Extension_Occupation The occupation
* @return Zend_Gdata_YouTube_Extension_Occupation The occupation
*/
public function getOccupation()
{
@ -608,21 +866,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the school
* Sets the school
*
* @param Zend_Gdata_YouTube_Extension_School $school The school
* @param Zend_Gdata_YouTube_Extension_School $school The school
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setSchool($school = null)
*/
public function setSchool($school = null)
{
$this->_school = $school;
return $this;
}
}
/**
* Returns the school
* Returns the school
*
* @return Zend_Gdata_YouTube_Extension_School The school
* @return Zend_Gdata_YouTube_Extension_School The school
*/
public function getSchool()
{
@ -630,21 +888,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the gender
* Sets the gender
*
* @param Zend_Gdata_YouTube_Extension_Gender $gender The gender
* @param Zend_Gdata_YouTube_Extension_Gender $gender The gender
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setGender($gender = null)
*/
public function setGender($gender = null)
{
$this->_gender = $gender;
return $this;
}
}
/**
* Returns the gender
* Returns the gender
*
* @return Zend_Gdata_YouTube_Extension_Gender The gender
* @return Zend_Gdata_YouTube_Extension_Gender The gender
*/
public function getGender()
{
@ -652,21 +910,21 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
}
/**
* Sets the relationship
* Sets the relationship
*
* @param Zend_Gdata_YouTube_Extension_Relationship $relationship The relationship
* @param Zend_Gdata_YouTube_Extension_Relationship $relationship The relationship
* @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
*/
public function setRelationship($relationship = null)
*/
public function setRelationship($relationship = null)
{
$this->_relationship = $relationship;
return $this;
}
}
/**
* Returns the relationship
* Returns the relationship
*
* @return Zend_Gdata_YouTube_Extension_Relationship The relationship
* @return Zend_Gdata_YouTube_Extension_Relationship The relationship
*/
public function getRelationship()
{
@ -716,7 +974,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
* Returns the URL in the gd:feedLink with the provided rel value
*
* @param string $rel The rel value to find
* @return mixed Either the URL as a string or null if a feedLink wasn't
* @return mixed Either the URL as a string or null if a feedLink wasn't
* found with the provided rel value
*/
public function getFeedLinkHref($rel)
@ -736,7 +994,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function getPlaylistListFeedUrl()
{
return getFeedLinkHref(Zend_Gdata_YouTube::USER_PLAYLISTS_REL);
return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_PLAYLISTS_REL);
}
/**
@ -746,7 +1004,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function getUploadsFeedUrl()
{
return getFeedLinkHref(Zend_Gdata_YouTube::USER_UPLOADS_REL);
return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_UPLOADS_REL);
}
/**
@ -756,7 +1014,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function getSubscriptionsFeedUrl()
{
return getFeedLinkHref(Zend_Gdata_YouTube::USER_SUBSCRIPTIONS_REL);
return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_SUBSCRIPTIONS_REL);
}
/**
@ -766,7 +1024,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function getContactsFeedUrl()
{
return getFeedLinkHref(Zend_Gdata_YouTube::USER_CONTACTS_REL);
return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_CONTACTS_REL);
}
/**
@ -776,7 +1034,7 @@ class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
*/
public function getFavoritesFeedUrl()
{
return getFeedLinkHref(Zend_Gdata_YouTube::USER_FAVORITES_REL);
return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_FAVORITES_REL);
}
}

View File

@ -18,7 +18,7 @@
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: VideoEntry.php 12403 2008-11-08 03:16:43Z tjohns $
* @version $Id: VideoEntry.php 13359 2008-12-18 22:49:31Z jhartmann $
*/
/**
@ -81,11 +81,17 @@ require_once 'Zend/Gdata/YouTube/Extension/Control.php';
*/
require_once 'Zend/Gdata/YouTube/Extension/Recorded.php';
/**
* @see Zend_Gdata_YouTube_Extension_Location
*/
require_once 'Zend/Gdata/YouTube/Extension/Location.php';
/**
* Represents the YouTube video flavor of an Atom entry
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -159,6 +165,13 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
*/
protected $_recorded = null;
/**
* Location informtion for the video
*
* @var Zend_Gdata_YouTube_Extension_Location|null
*/
protected $_location = null;
/**
* Creates a Video entry, representing an individual video
*
@ -167,10 +180,7 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}
@ -203,6 +213,10 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
$element->appendChild($this->_recorded->getDOM(
$element->ownerDocument));
}
if ($this->_location != null) {
$element->appendChild($this->_location->getDOM(
$element->ownerDocument));
}
if ($this->_rating != null) {
$element->appendChild($this->_rating->getDOM(
$element->ownerDocument));
@ -233,6 +247,7 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('yt') . ':' . 'statistics':
$statistics = new Zend_Gdata_YouTube_Extension_Statistics();
@ -249,6 +264,11 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
$recorded->transferFromDOM($child);
$this->_recorded = $recorded;
break;
case $this->lookupNamespace('yt') . ':' . 'location':
$location = new Zend_Gdata_YouTube_Extension_Location();
$location->transferFromDOM($child);
$this->_location = $location;
break;
case $this->lookupNamespace('gd') . ':' . 'rating':
$rating = new Zend_Gdata_Extension_Rating();
$rating->transferFromDOM($child);
@ -312,6 +332,29 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
return $this->_recorded;
}
/**
* Sets the location information.
*
* @param Zend_Gdata_YouTube_Extension_Location $location Where the video
* was recorded
* @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface
*/
public function setLocation($location = null)
{
$this->_location = $location;
return $this;
}
/**
* Gets the location where the video was recorded.
*
* @return Zend_Gdata_YouTube_Extension_Location|null
*/
public function getLocation()
{
return $this->_location;
}
/**
* If an instance of Zend_Gdata_YouTube_Extension_NoEmbed is passed in,
* the video cannot be embedded. Otherwise, if null is passsed in, the
@ -378,10 +421,18 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
* Specifies that the video has racy content.
*
* @param Zend_Gdata_YouTube_Extension_Racy $racy The racy flag object
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface
*/
public function setRacy($racy = null)
{
if ($this->getMajorProtocolVersion() == 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException(
'Calling getRacy() on a YouTube VideoEntry is deprecated ' .
'as of version 2 of the API.');
}
$this->_racy = $racy;
return $this;
}
@ -389,10 +440,17 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
/**
* Returns the racy flag object.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_Racy|null The racy flag object
*/
public function getRacy()
{
if ($this->getMajorProtocolVersion() == 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException(
'Calling getRacy() on a YouTube VideoEntry is deprecated ' .
'as of version 2 of the API.');
}
return $this->_racy;
}
@ -516,14 +574,20 @@ class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry
*/
public function getVideoId()
{
$fullId = $this->getId()->getText();
$position = strrpos($fullId, '/');
if ($position === false) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Slash not found in atom:id');
if ($this->getMajorProtocolVersion() == 2) {
$videoId = $this->getMediaGroup()->getVideoId()->text;
} else {
return substr($fullId, strrpos($fullId,'/') + 1);
$fullId = $this->getId()->getText();
$position = strrpos($fullId, '/');
if ($position === false) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception(
'Slash not found in atom:id of ' . $fullId);
} else {
$videoId = substr($fullId, $position + 1);
}
}
return $videoId;
}
/**

View File

@ -35,6 +35,7 @@ require_once 'Zend/Gdata/YouTube/VideoEntry.php';
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -56,9 +57,7 @@ class Zend_Gdata_YouTube_VideoFeed extends Zend_Gdata_Media_Feed
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
$this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
parent::__construct($element);
}

View File

@ -37,6 +37,7 @@ require_once('Zend/Gdata/Query.php');
*
* @category Zend
* @package Zend_Gdata
* @subpackage YouTube
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -47,7 +48,7 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
* Create Gdata_YouTube_VideoQuery object
*/
public function __construct($url = null)
{
{
parent::__construct($url);
}
@ -75,26 +76,32 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
break;
case 'related':
if ($videoId === null) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Video ID must be set for feed of type: ' . $feedType);
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Video ID must be set for feed of type: ' . $feedType);
} else {
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId . '/related';
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId .
'/related';
}
break;
case 'responses':
if ($videoId === null) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Video ID must be set for feed of type: ' . $feedType);
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_Exception(
'Video ID must be set for feed of type: ' . $feedType);
} else {
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId . 'responses';
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId .
'responses';
}
break;
case 'comments':
if ($videoId === null) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Video ID must be set for feed of type: ' . $feedType);
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_Exception(
'Video ID must be set for feed of type: ' . $feedType);
} else {
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId . 'comments';
$this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' .
$videoId . 'comments';
if ($entry !== null) {
$this->_url .= '/' . $entry;
}
@ -107,11 +114,95 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
}
/**
* Sets the location parameter for the query
*
* @param string $value
* @throws Zend_Gdata_App_InvalidArgumentException
* @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface
*/
public function setLocation($value)
{
switch($value) {
case null:
unset($this->_params['location']);
default:
$parameters = explode(',', $value);
if (count($parameters) != 2) {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'You must provide 2 coordinates to the location ' .
'URL parameter');
}
foreach($parameters as $param) {
$temp = trim($param);
// strip off the optional exclamation mark for numeric check
if (substr($temp, -1) == '!') {
$temp = substr($temp, -1);
}
if (!is_numeric($temp)) {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Value provided to location parameter must' .
' be in the form of two coordinates');
}
}
$this->_params['location'] = $value;
}
}
/**
* Get the value of the location parameter
*
* @return string|null Return the location if it exists, null otherwise.
*/
public function getLocation()
{
if (array_key_exists('location', $this->_params)) {
return $this->_params['location'];
} else {
return null;
}
}
/**
* Sets the location-radius parameter for the query
*
* @param string $value
* @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface
*/
public function setLocationRadius($value)
{
switch($value) {
case null:
unset($this->_params['location-radius']);
default:
$this->_params['location-radius'] = $value;
}
}
/**
* Get the value of the location-radius parameter
*
* @return string|null Return the location-radius if it exists,
* null otherwise.
*/
public function getLocationRadius()
{
if (array_key_exists('location-radius', $this->_params)) {
return $this->_params['location-radius'];
} else {
return null;
}
}
/**
* Sets the time period over which this query should apply
*
* @param string $value
* @throws Zend_Gdata_App_InvalidArgumentException
* @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface
*/
public function setTime($value = null)
@ -132,13 +223,39 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
case null:
unset($this->_params['time']);
default:
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Unknown time value');
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Unknown time value');
break;
}
return $this;
}
/**
* Sets the value of the uploader parameter
*
* @param string $value The value of the uploader parameter. Currently this
* can only be set to the value of 'partner'.
* @throws Zend_Gdata_App_InvalidArgumentException
* @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface
*/
public function setUploader($value = null)
{
switch ($value) {
case 'partner':
$this->_params['uploader'] = 'partner';
break;
case null:
unset($this->_params['uploader']);
break;
default:
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Unknown value for uploader');
}
return $this;
}
/**
* Sets the formatted video query (vq) URL param value
*
@ -194,6 +311,66 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* Whether or not to include racy videos in the search results
*
* @return string|null The value of racy if it exists, null otherwise.
*/
public function getRacy()
{
if (array_key_exists('racy', $this->_params)) {
return $this->_params['racy'];
} else {
return null;
}
}
/**
* Set the safeSearch parameter
*
* @param string $value The value of the parameter, currently only 'none',
* 'moderate' or 'strict' are allowed values.
* @throws Zend_Gdata_App_InvalidArgumentException
* @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface
*/
public function setSafeSearch($value)
{
switch ($value) {
case 'none':
$this->_params['safeSearch'] = 'none';
break;
case 'moderate':
$this->_params['safeSearch'] = 'moderate';
break;
case 'strict':
$this->_params['safeSearch'] = 'strict';
break;
case null:
unset($this->_params['safeSearch']);
default:
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'The safeSearch parameter only supports the values '.
'\'none\', \'moderate\' or \'strict\'.');
}
}
/**
* Return the value of the safeSearch parameter
*
* @return string|null The value of the safeSearch parameter if it has been
* set, null otherwise.
*/
public function getSafeSearch()
{
if (array_key_exists('safeSearch', $this->_params)) {
return $this->_params['safeSearch'];
}
return $this;
}
/**
* Set the value of the orderby parameter
*
* @param string $value
* @return Zend_Gdata_YouTube_Query Provides a fluent interface
*/
@ -208,23 +385,9 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* Whether or not to include racy videos in the search results
* Return the value of the format parameter
*
* @return string racy
*/
public function getRacy()
{
if (array_key_exists('racy', $this->_params)) {
return $this->_params['racy'];
} else {
return null;
}
}
/**
* The format used for videos
*
* @return string format
* @return string|null The value of format if it exists, null otherwise.
*/
public function getFormat()
{
@ -236,9 +399,10 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* The video query
* Return the value of the video query that has been set
*
* @return string video query
* @return string|null The value of the video query if it exists,
* null otherwise.
*/
public function getVideoQuery()
{
@ -250,9 +414,9 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* The time
* Return the value of the time parameter
*
* @return string time
* @return string|null The time parameter if it exists, null otherwise.
*/
public function getTime()
{
@ -264,7 +428,9 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* @return string orderby
* Return the value of the orderby parameter if it exists
*
* @return string|null The value of orderby if it exists, null otherwise.
*/
public function getOrderBy()
{
@ -276,11 +442,86 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
}
/**
* Returns the generated full query URL
* Generate the query string from the URL parameters, optionally modifying
* them based on protocol version.
*
* @param integer $majorProtocolVersion The major protocol version
* @param integer $minorProtocolVersion The minor protocol version
* @throws Zend_Gdata_App_VersionException
* @return string querystring
*/
public function getQueryString($majorProtocolVersion = null,
$minorProtocolVersion = null)
{
$queryArray = array();
foreach ($this->_params as $name => $value) {
if (substr($name, 0, 1) == '_') {
continue;
}
switch($name) {
case 'location-radius':
if ($majorProtocolVersion == 1) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException("The $name " .
"parameter is only supported in version 2.");
}
break;
case 'racy':
if ($majorProtocolVersion == 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException("The $name " .
"parameter is not supported in version 2. " .
"Please use 'safeSearch'.");
}
break;
case 'safeSearch':
if ($majorProtocolVersion == 1) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException("The $name " .
"parameter is only supported in version 2. " .
"Please use 'racy'.");
}
break;
case 'uploader':
if ($majorProtocolVersion == 1) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException("The $name " .
"parameter is only supported in version 2.");
}
break;
case 'vq':
if ($majorProtocolVersion == 2) {
$name = 'q';
}
break;
}
$queryArray[] = urlencode($name) . '=' . urlencode($value);
}
if (count($queryArray) > 0) {
return '?' . implode('&', $queryArray);
} else {
return '';
}
}
/**
* Returns the generated full query URL, optionally modifying it based on
* the protocol version.
*
* @param integer $majorProtocolVersion The major protocol version
* @param integer $minorProtocolVersion The minor protocol version
* @return string The URL
*/
public function getQueryUrl()
public function getQueryUrl($majorProtocolVersion = null,
$minorProtocolVersion = null)
{
if (isset($this->_url)) {
$url = $this->_url;
@ -290,7 +531,8 @@ class Zend_Gdata_YouTube_VideoQuery extends Zend_Gdata_Query
if ($this->getCategory() !== null) {
$url .= '/-/' . $this->getCategory();
}
$url = $url . $this->getQueryString();
$url = $url . $this->getQueryString($majorProtocolVersion,
$minorProtocolVersion);
return $url;
}