1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Zend Framework
|
---|
5 | *
|
---|
6 | * LICENSE
|
---|
7 | *
|
---|
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.
|
---|
15 | *
|
---|
16 | * @category Zend
|
---|
17 | * @package Zend_Gdata
|
---|
18 | * @subpackage YouTube
|
---|
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
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_Media_Extension_MediaGroup
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_YouTube_Extension_MediaContent
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/YouTube/Extension/MediaContent.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @see Zend_Gdata_YouTube_Extension_Duration
|
---|
35 | */
|
---|
36 | require_once 'Zend/Gdata/YouTube/Extension/Duration.php';
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * @see Zend_Gdata_YouTube_Extension_MediaRating
|
---|
40 | */
|
---|
41 | require_once 'Zend/Gdata/YouTube/Extension/MediaRating.php';
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * @see Zend_Gdata_YouTube_Extension_MediaCredit
|
---|
45 | */
|
---|
46 | require_once 'Zend/Gdata/YouTube/Extension/MediaCredit.php';
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * @see Zend_Gdata_YouTube_Extension_Private
|
---|
50 | */
|
---|
51 | require_once 'Zend/Gdata/YouTube/Extension/Private.php';
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * @see Zend_Gdata_YouTube_Extension_VideoId
|
---|
55 | */
|
---|
56 | require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * @see Zend_Gdata_YouTube_Extension_Uploaded
|
---|
60 | */
|
---|
61 | require_once 'Zend/Gdata/YouTube/Extension/Uploaded.php';
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * This class represents the media:group element of Media RSS.
|
---|
65 | * It allows the grouping of media:content elements that are
|
---|
66 | * different representations of the same content. When it exists,
|
---|
67 | * it is a child of an Entry (Atom) or Item (RSS).
|
---|
68 | *
|
---|
69 | * @category Zend
|
---|
70 | * @package Zend_Gdata
|
---|
71 | * @subpackage YouTube
|
---|
72 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
73 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
74 | */
|
---|
75 | class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension_MediaGroup
|
---|
76 | {
|
---|
77 |
|
---|
78 | protected $_rootElement = 'group';
|
---|
79 | protected $_rootNamespace = 'media';
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * @var Zend_Gdata_YouTube_Extension_Duration
|
---|
83 | */
|
---|
84 | protected $_duration = null;
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * @var Zend_Gdata_YouTube_Extension_Private
|
---|
88 | */
|
---|
89 | protected $_private = null;
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * @var Zend_Gdata_YouTube_Extension_VideoId
|
---|
93 | */
|
---|
94 | protected $_videoid = null;
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * @var Zend_Gdata_YouTube_Extension_MediaRating
|
---|
98 | */
|
---|
99 | protected $_mediarating = null;
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * @var Zend_Gdata_YouTube_Extension_MediaCredit
|
---|
103 | */
|
---|
104 | protected $_mediacredit = null;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * @var Zend_Gdata_YouTube_Extension_Uploaded
|
---|
108 | */
|
---|
109 | protected $_uploaded = null;
|
---|
110 |
|
---|
111 | public function __construct($element = null)
|
---|
112 | {
|
---|
113 | $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
|
---|
114 | parent::__construct($element);
|
---|
115 | }
|
---|
116 |
|
---|
117 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
118 | {
|
---|
119 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
120 | if ($this->_duration !== null) {
|
---|
121 | $element->appendChild(
|
---|
122 | $this->_duration->getDOM($element->ownerDocument));
|
---|
123 | }
|
---|
124 | if ($this->_private !== null) {
|
---|
125 | $element->appendChild(
|
---|
126 | $this->_private->getDOM($element->ownerDocument));
|
---|
127 | }
|
---|
128 | if ($this->_videoid != null) {
|
---|
129 | $element->appendChild(
|
---|
130 | $this->_videoid->getDOM($element->ownerDocument));
|
---|
131 | }
|
---|
132 | if ($this->_uploaded != null) {
|
---|
133 | $element->appendChild(
|
---|
134 | $this->_uploaded->getDOM($element->ownerDocument));
|
---|
135 | }
|
---|
136 | if ($this->_mediacredit != null) {
|
---|
137 | $element->appendChild(
|
---|
138 | $this->_mediacredit->getDOM($element->ownerDocument));
|
---|
139 | }
|
---|
140 | if ($this->_mediarating != null) {
|
---|
141 | $element->appendChild(
|
---|
142 | $this->_mediarating->getDOM($element->ownerDocument));
|
---|
143 | }
|
---|
144 | return $element;
|
---|
145 | }
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Creates individual Entry objects of the appropriate type and
|
---|
149 | * stores them in the $_entry array based upon DOM data.
|
---|
150 | *
|
---|
151 | * @param DOMNode $child The DOMNode to process
|
---|
152 | */
|
---|
153 | protected function takeChildFromDOM($child)
|
---|
154 | {
|
---|
155 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
156 | switch ($absoluteNodeName) {
|
---|
157 | case $this->lookupNamespace('media') . ':' . 'content':
|
---|
158 | $content = new Zend_Gdata_YouTube_Extension_MediaContent();
|
---|
159 | $content->transferFromDOM($child);
|
---|
160 | $this->_content[] = $content;
|
---|
161 | break;
|
---|
162 | case $this->lookupNamespace('media') . ':' . 'rating':
|
---|
163 | $mediarating = new Zend_Gdata_YouTube_Extension_MediaRating();
|
---|
164 | $mediarating->transferFromDOM($child);
|
---|
165 | $this->_mediarating = $mediarating;
|
---|
166 | break;
|
---|
167 | case $this->lookupNamespace('media') . ':' . 'credit':
|
---|
168 | $mediacredit = new Zend_Gdata_YouTube_Extension_MediaCredit();
|
---|
169 | $mediacredit->transferFromDOM($child);
|
---|
170 | $this->_mediacredit = $mediacredit;
|
---|
171 | break;
|
---|
172 | case $this->lookupNamespace('yt') . ':' . 'duration':
|
---|
173 | $duration = new Zend_Gdata_YouTube_Extension_Duration();
|
---|
174 | $duration->transferFromDOM($child);
|
---|
175 | $this->_duration = $duration;
|
---|
176 | break;
|
---|
177 | case $this->lookupNamespace('yt') . ':' . 'private':
|
---|
178 | $private = new Zend_Gdata_YouTube_Extension_Private();
|
---|
179 | $private->transferFromDOM($child);
|
---|
180 | $this->_private = $private;
|
---|
181 | break;
|
---|
182 | case $this->lookupNamespace('yt') . ':' . 'videoid':
|
---|
183 | $videoid = new Zend_Gdata_YouTube_Extension_VideoId();
|
---|
184 | $videoid ->transferFromDOM($child);
|
---|
185 | $this->_videoid = $videoid;
|
---|
186 | break;
|
---|
187 | case $this->lookupNamespace('yt') . ':' . 'uploaded':
|
---|
188 | $uploaded = new Zend_Gdata_YouTube_Extension_Uploaded();
|
---|
189 | $uploaded ->transferFromDOM($child);
|
---|
190 | $this->_uploaded = $uploaded;
|
---|
191 | break;
|
---|
192 | default:
|
---|
193 | parent::takeChildFromDOM($child);
|
---|
194 | break;
|
---|
195 | }
|
---|
196 | }
|
---|
197 |
|
---|
198 | /**
|
---|
199 | * Returns the duration value of this element
|
---|
200 | *
|
---|
201 | * @return Zend_Gdata_YouTube_Extension_Duration
|
---|
202 | */
|
---|
203 | public function getDuration()
|
---|
204 | {
|
---|
205 | return $this->_duration;
|
---|
206 | }
|
---|
207 |
|
---|
208 | /**
|
---|
209 | * Sets the duration value of this element
|
---|
210 | *
|
---|
211 | * @param Zend_Gdata_YouTube_Extension_Duration $value The duration value
|
---|
212 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
213 | * interface
|
---|
214 | */
|
---|
215 | public function setDuration($value)
|
---|
216 | {
|
---|
217 | $this->_duration = $value;
|
---|
218 | return $this;
|
---|
219 | }
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * Returns the videoid value of this element
|
---|
223 | *
|
---|
224 | * @return Zend_Gdata_YouTube_Extension_VideoId
|
---|
225 | */
|
---|
226 | public function getVideoId()
|
---|
227 | {
|
---|
228 | return $this->_videoid;
|
---|
229 | }
|
---|
230 |
|
---|
231 | /**
|
---|
232 | * Sets the videoid value of this element
|
---|
233 | *
|
---|
234 | * @param Zend_Gdata_YouTube_Extension_VideoId $value The video id value
|
---|
235 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
236 | * interface
|
---|
237 | */
|
---|
238 | public function setVideoId($value)
|
---|
239 | {
|
---|
240 | $this->_videoid = $value;
|
---|
241 | return $this;
|
---|
242 | }
|
---|
243 |
|
---|
244 | /**
|
---|
245 | * Returns the yt:uploaded element
|
---|
246 | *
|
---|
247 | * @return Zend_Gdata_YouTube_Extension_Uploaded
|
---|
248 | */
|
---|
249 | public function getUploaded()
|
---|
250 | {
|
---|
251 | return $this->_uploaded;
|
---|
252 | }
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * Sets the yt:uploaded element
|
---|
256 | *
|
---|
257 | * @param Zend_Gdata_YouTube_Extension_Uploaded $value The uploaded value
|
---|
258 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
259 | * interface
|
---|
260 | */
|
---|
261 | public function setUploaded($value)
|
---|
262 | {
|
---|
263 | $this->_uploaded = $value;
|
---|
264 | return $this;
|
---|
265 | }
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * Returns the private value of this element
|
---|
269 | *
|
---|
270 | * @return Zend_Gdata_YouTube_Extension_Private
|
---|
271 | */
|
---|
272 | public function getPrivate()
|
---|
273 | {
|
---|
274 | return $this->_private;
|
---|
275 | }
|
---|
276 |
|
---|
277 | /**
|
---|
278 | * Sets the private value of this element
|
---|
279 | *
|
---|
280 | * @param Zend_Gdata_YouTube_Extension_Private $value The private value
|
---|
281 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
282 | * interface
|
---|
283 | */
|
---|
284 | public function setPrivate($value)
|
---|
285 | {
|
---|
286 | $this->_private = $value;
|
---|
287 | return $this;
|
---|
288 | }
|
---|
289 |
|
---|
290 | /**
|
---|
291 | * Returns the rating value of this element
|
---|
292 | *
|
---|
293 | * @return Zend_Gdata_YouTube_Extension_MediaRating
|
---|
294 | */
|
---|
295 | public function getMediaRating()
|
---|
296 | {
|
---|
297 | return $this->_mediarating;
|
---|
298 | }
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * Sets the media:rating value of this element
|
---|
302 | *
|
---|
303 | * @param Zend_Gdata_YouTube_Extension_MediaRating $value The rating element
|
---|
304 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
305 | * interface
|
---|
306 | */
|
---|
307 | public function setMediaRating($value)
|
---|
308 | {
|
---|
309 | $this->_mediarating = $value;
|
---|
310 | return $this;
|
---|
311 | }
|
---|
312 |
|
---|
313 | /**
|
---|
314 | * Returns the media:credit value of this element
|
---|
315 | *
|
---|
316 | * @return Zend_Gdata_YouTube_Extension_MediaCredit
|
---|
317 | */
|
---|
318 | public function getMediaCredit()
|
---|
319 | {
|
---|
320 | return $this->_mediacredit;
|
---|
321 | }
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * Sets the media:credit value of this element
|
---|
325 | *
|
---|
326 | * @param Zend_Gdata_YouTube_Extension_MediaCredit $value The credit element
|
---|
327 | * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
|
---|
328 | * interface
|
---|
329 | */
|
---|
330 | public function setMediaCredit($value)
|
---|
331 | {
|
---|
332 | $this->_mediacredit = $value;
|
---|
333 | return $this;
|
---|
334 | }
|
---|
335 | }
|
---|