8
* This source file is subject to the new BSD license that is bundled
9
* with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://framework.zend.com/license/new-bsd
12
* If you did not receive a copy of the license and are unable to
13
* obtain it through the world-wide-web, please send an email
14
* to license@zend.com so we can send you a copy immediately.
19
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20
* @license http://framework.zend.com/license/new-bsd New BSD License
24
* @see Zend_Gdata_Entry
26
require_once 'Zend/Gdata/Entry.php';
29
* @see Zend_Gdata_Extension_FeedLink
31
require_once 'Zend/Gdata/Extension/FeedLink.php';
34
* @see Zend_Gdata_YouTube_Extension_Description
36
require_once 'Zend/Gdata/YouTube/Extension/Description.php';
39
* Represents the YouTube video subscription flavor of an Atom entry
43
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
44
* @license http://framework.zend.com/license/new-bsd New BSD License
46
class Zend_Gdata_YouTube_SubscriptionEntry extends Zend_Gdata_Entry
49
protected $_entryClassName = 'Zend_Gdata_YouTube_SubscriptionEntry';
56
protected $_feedLink = array();
59
* Creates a subscription entry, representing an individual subscription
60
* in a list of subscriptions, usually associated with an individual user.
62
* @param DOMElement $element (optional) DOMElement from which this
63
* object should be constructed.
65
public function __construct($element = null)
67
foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {
68
$this->registerNamespace($nsPrefix, $nsUri);
70
parent::__construct($element);
74
* Retrieves a DOMElement which corresponds to this element and all
75
* child properties. This is used to build an entry back into a DOM
76
* and eventually XML text for sending to the server upon updates, or
77
* for application storage/persistence.
79
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
80
* @return DOMElement The DOMElement representing this element and all
83
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
85
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
86
if ($this->_feedLink != null) {
87
foreach ($this->_feedLink as $feedLink) {
88
$element->appendChild($feedLink->getDOM($element->ownerDocument));
95
* Creates individual Entry objects of the appropriate type and
96
* stores them in the $_entry array based upon DOM data.
98
* @param DOMNode $child The DOMNode to process
100
protected function takeChildFromDOM($child)
102
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
103
switch ($absoluteNodeName) {
104
case $this->lookupNamespace('gd') . ':' . 'feedLink':
105
$feedLink = new Zend_Gdata_Extension_FeedLink();
106
$feedLink->transferFromDOM($child);
107
$this->_feedLink[] = $feedLink;
110
parent::takeChildFromDOM($child);
116
* Sets the array of embedded feeds related to the video
118
* @param array $feedLink The array of embedded feeds relating to the video
119
* @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface
121
public function setFeedLink($feedLink = null)
123
$this->_feedLink = $feedLink;
128
* Get the feed link property for this entry.
131
* @param string $rel (optional) The rel value of the link to be found.
132
* If null, the array of links is returned.
133
* @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
134
* object corresponding to the requested rel value is returned
135
* if found, or null if the requested value is not found. If
136
* $rel is null or not specified, an array of all available
137
* feed links for this entry is returned, or null if no feed
140
public function getFeedLink($rel = null)
143
return $this->_feedLink;
145
foreach ($this->_feedLink as $feedLink) {
146
if ($feedLink->rel == $rel) {