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 Media
|
---|
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_Extension
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/Extension.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_Entry
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/Entry.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @see Zend_Gdata_Media_Extension_MediaContent
|
---|
35 | */
|
---|
36 | require_once 'Zend/Gdata/Media/Extension/MediaContent.php';
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * @see Zend_Gdata_Media_Extension_MediaCategory
|
---|
40 | */
|
---|
41 | require_once 'Zend/Gdata/Media/Extension/MediaCategory.php';
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * @see Zend_Gdata_Media_Extension_MediaCopyright
|
---|
45 | */
|
---|
46 | require_once 'Zend/Gdata/Media/Extension/MediaCopyright.php';
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * @see Zend_Gdata_Media_Extension_MediaCredit
|
---|
50 | */
|
---|
51 | require_once 'Zend/Gdata/Media/Extension/MediaCredit.php';
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * @see Zend_Gdata_Media_Extension_MediaDescription
|
---|
55 | */
|
---|
56 | require_once 'Zend/Gdata/Media/Extension/MediaDescription.php';
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * @see Zend_Gdata_Media_Extension_MediaHash
|
---|
60 | */
|
---|
61 | require_once 'Zend/Gdata/Media/Extension/MediaHash.php';
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * @see Zend_Gdata_Media_Extension_MediaKeywords
|
---|
65 | */
|
---|
66 | require_once 'Zend/Gdata/Media/Extension/MediaKeywords.php';
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * @see Zend_Gdata_Media_Extension_MediaPlayer
|
---|
70 | */
|
---|
71 | require_once 'Zend/Gdata/Media/Extension/MediaPlayer.php';
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * @see Zend_Gdata_Media_Extension_MediaRating
|
---|
75 | */
|
---|
76 | require_once 'Zend/Gdata/Media/Extension/MediaRating.php';
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * @see Zend_Gdata_Media_Extension_MediaRestriction
|
---|
80 | */
|
---|
81 | require_once 'Zend/Gdata/Media/Extension/MediaRestriction.php';
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * @see Zend_Gdata_Media_Extension_MediaText
|
---|
85 | */
|
---|
86 | require_once 'Zend/Gdata/Media/Extension/MediaText.php';
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * @see Zend_Gdata_Media_Extension_MediaThumbnail
|
---|
90 | */
|
---|
91 | require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * @see Zend_Gdata_Media_Extension_MediaTitle
|
---|
95 | */
|
---|
96 | require_once 'Zend/Gdata/Media/Extension/MediaTitle.php';
|
---|
97 |
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * This class represents the media:group element of Media RSS.
|
---|
101 | * It allows the grouping of media:content elements that are
|
---|
102 | * different representations of the same content. When it exists,
|
---|
103 | * it is a child of an Entry (Atom) or Item (RSS).
|
---|
104 | *
|
---|
105 | * @category Zend
|
---|
106 | * @package Zend_Gdata
|
---|
107 | * @subpackage Media
|
---|
108 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
109 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
110 | */
|
---|
111 | class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension
|
---|
112 | {
|
---|
113 |
|
---|
114 | protected $_rootElement = 'group';
|
---|
115 | protected $_rootNamespace = 'media';
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * @var array
|
---|
119 | */
|
---|
120 | protected $_content = array();
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * @var array
|
---|
124 | */
|
---|
125 | protected $_category = array();
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * @var Zend_Gdata_Media_Extension_MediaCopyright
|
---|
129 | */
|
---|
130 | protected $_copyright = null;
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * @var array
|
---|
134 | */
|
---|
135 | protected $_credit = array();
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * @var Zend_Gdata_Media_Extension_MediaDescription
|
---|
139 | */
|
---|
140 | protected $_description = null;
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * @var array
|
---|
144 | */
|
---|
145 | protected $_hash = array();
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * @var Zend_Gdata_Media_Extension_MediaKeywords
|
---|
149 | */
|
---|
150 | protected $_keywords = null;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * @var array
|
---|
154 | */
|
---|
155 | protected $_player = array();
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * @var array
|
---|
159 | */
|
---|
160 | protected $_rating = array();
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * @var array
|
---|
164 | */
|
---|
165 | protected $_restriction = array();
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * @var array
|
---|
169 | */
|
---|
170 | protected $_mediaText = array();
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * @var array
|
---|
174 | */
|
---|
175 | protected $_thumbnail = array();
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * @var string
|
---|
179 | */
|
---|
180 | protected $_title = null;
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * Creates an individual MediaGroup object.
|
---|
184 | */
|
---|
185 | public function __construct($element = null)
|
---|
186 | {
|
---|
187 | $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
|
---|
188 | parent::__construct($element);
|
---|
189 | }
|
---|
190 |
|
---|
191 | /**
|
---|
192 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
193 | * child properties. This is used to build an entry back into a DOM
|
---|
194 | * and eventually XML text for sending to the server upon updates, or
|
---|
195 | * for application storage/persistence.
|
---|
196 | *
|
---|
197 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
198 | * @return DOMElement The DOMElement representing this element and all
|
---|
199 | * child properties.
|
---|
200 | */
|
---|
201 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
202 | {
|
---|
203 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
204 | foreach ($this->_content as $content) {
|
---|
205 | $element->appendChild($content->getDOM($element->ownerDocument));
|
---|
206 | }
|
---|
207 | foreach ($this->_category as $category) {
|
---|
208 | $element->appendChild($category->getDOM($element->ownerDocument));
|
---|
209 | }
|
---|
210 | foreach ($this->_credit as $credit) {
|
---|
211 | $element->appendChild($credit->getDOM($element->ownerDocument));
|
---|
212 | }
|
---|
213 | foreach ($this->_player as $player) {
|
---|
214 | $element->appendChild($player->getDOM($element->ownerDocument));
|
---|
215 | }
|
---|
216 | foreach ($this->_rating as $rating) {
|
---|
217 | $element->appendChild($rating->getDOM($element->ownerDocument));
|
---|
218 | }
|
---|
219 | foreach ($this->_restriction as $restriction) {
|
---|
220 | $element->appendChild($restriction->getDOM($element->ownerDocument));
|
---|
221 | }
|
---|
222 | foreach ($this->_mediaText as $text) {
|
---|
223 | $element->appendChild($text->getDOM($element->ownerDocument));
|
---|
224 | }
|
---|
225 | foreach ($this->_thumbnail as $thumbnail) {
|
---|
226 | $element->appendChild($thumbnail->getDOM($element->ownerDocument));
|
---|
227 | }
|
---|
228 | if ($this->_copyright != null) {
|
---|
229 | $element->appendChild(
|
---|
230 | $this->_copyright->getDOM($element->ownerDocument));
|
---|
231 | }
|
---|
232 | if ($this->_description != null) {
|
---|
233 | $element->appendChild(
|
---|
234 | $this->_description->getDOM($element->ownerDocument));
|
---|
235 | }
|
---|
236 | foreach ($this->_hash as $hash) {
|
---|
237 | $element->appendChild($hash->getDOM($element->ownerDocument));
|
---|
238 | }
|
---|
239 | if ($this->_keywords != null) {
|
---|
240 | $element->appendChild(
|
---|
241 | $this->_keywords->getDOM($element->ownerDocument));
|
---|
242 | }
|
---|
243 | if ($this->_title != null) {
|
---|
244 | $element->appendChild(
|
---|
245 | $this->_title->getDOM($element->ownerDocument));
|
---|
246 | }
|
---|
247 | return $element;
|
---|
248 | }
|
---|
249 |
|
---|
250 | /**
|
---|
251 | * Creates individual Entry objects of the appropriate type and
|
---|
252 | * stores them in the $_entry array based upon DOM data.
|
---|
253 | *
|
---|
254 | * @param DOMNode $child The DOMNode to process
|
---|
255 | */
|
---|
256 | protected function takeChildFromDOM($child)
|
---|
257 | {
|
---|
258 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
259 | switch ($absoluteNodeName) {
|
---|
260 | case $this->lookupNamespace('media') . ':' . 'content';
|
---|
261 | $content = new Zend_Gdata_Media_Extension_MediaContent();
|
---|
262 | $content->transferFromDOM($child);
|
---|
263 | $this->_content[] = $content;
|
---|
264 | break;
|
---|
265 | case $this->lookupNamespace('media') . ':' . 'category';
|
---|
266 | $category = new Zend_Gdata_Media_Extension_MediaCategory();
|
---|
267 | $category->transferFromDOM($child);
|
---|
268 | $this->_category[] = $category;
|
---|
269 | break;
|
---|
270 | case $this->lookupNamespace('media') . ':' . 'copyright';
|
---|
271 | $copyright = new Zend_Gdata_Media_Extension_MediaCopyright();
|
---|
272 | $copyright->transferFromDOM($child);
|
---|
273 | $this->_copyright = $copyright;
|
---|
274 | break;
|
---|
275 | case $this->lookupNamespace('media') . ':' . 'credit';
|
---|
276 | $credit = new Zend_Gdata_Media_Extension_MediaCredit();
|
---|
277 | $credit->transferFromDOM($child);
|
---|
278 | $this->_credit[] = $credit;
|
---|
279 | break;
|
---|
280 | case $this->lookupNamespace('media') . ':' . 'description';
|
---|
281 | $description = new Zend_Gdata_Media_Extension_MediaDescription();
|
---|
282 | $description->transferFromDOM($child);
|
---|
283 | $this->_description = $description;
|
---|
284 | break;
|
---|
285 | case $this->lookupNamespace('media') . ':' . 'hash';
|
---|
286 | $hash = new Zend_Gdata_Media_Extension_MediaHash();
|
---|
287 | $hash->transferFromDOM($child);
|
---|
288 | $this->_hash[] = $hash;
|
---|
289 | break;
|
---|
290 | case $this->lookupNamespace('media') . ':' . 'keywords';
|
---|
291 | $keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
|
---|
292 | $keywords->transferFromDOM($child);
|
---|
293 | $this->_keywords = $keywords;
|
---|
294 | break;
|
---|
295 | case $this->lookupNamespace('media') . ':' . 'player';
|
---|
296 | $player = new Zend_Gdata_Media_Extension_MediaPlayer();
|
---|
297 | $player->transferFromDOM($child);
|
---|
298 | $this->_player[] = $player;
|
---|
299 | break;
|
---|
300 | case $this->lookupNamespace('media') . ':' . 'rating';
|
---|
301 | $rating = new Zend_Gdata_Media_Extension_MediaRating();
|
---|
302 | $rating->transferFromDOM($child);
|
---|
303 | $this->_rating[] = $rating;
|
---|
304 | break;
|
---|
305 | case $this->lookupNamespace('media') . ':' . 'restriction';
|
---|
306 | $restriction = new Zend_Gdata_Media_Extension_MediaRestriction();
|
---|
307 | $restriction->transferFromDOM($child);
|
---|
308 | $this->_restriction[] = $restriction;
|
---|
309 | break;
|
---|
310 | case $this->lookupNamespace('media') . ':' . 'text';
|
---|
311 | $text = new Zend_Gdata_Media_Extension_MediaText();
|
---|
312 | $text->transferFromDOM($child);
|
---|
313 | $this->_mediaText[] = $text;
|
---|
314 | break;
|
---|
315 | case $this->lookupNamespace('media') . ':' . 'thumbnail';
|
---|
316 | $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
|
---|
317 | $thumbnail->transferFromDOM($child);
|
---|
318 | $this->_thumbnail[] = $thumbnail;
|
---|
319 | break;
|
---|
320 | case $this->lookupNamespace('media') . ':' . 'title';
|
---|
321 | $title = new Zend_Gdata_Media_Extension_MediaTitle();
|
---|
322 | $title->transferFromDOM($child);
|
---|
323 | $this->_title = $title;
|
---|
324 | break;
|
---|
325 | default:
|
---|
326 | parent::takeChildFromDOM($child);
|
---|
327 | break;
|
---|
328 | }
|
---|
329 | }
|
---|
330 |
|
---|
331 | /**
|
---|
332 | * @return array
|
---|
333 | */
|
---|
334 | public function getContent()
|
---|
335 | {
|
---|
336 | return $this->_content;
|
---|
337 | }
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * @param array $value
|
---|
341 | * @return Zend_Gdata_Media_MediaGroup Provides a fluent interface
|
---|
342 | */
|
---|
343 | public function setContent($value)
|
---|
344 | {
|
---|
345 | $this->_content = $value;
|
---|
346 | return $this;
|
---|
347 | }
|
---|
348 |
|
---|
349 | /**
|
---|
350 | * @return array
|
---|
351 | */
|
---|
352 | public function getCategory()
|
---|
353 | {
|
---|
354 | return $this->_category;
|
---|
355 | }
|
---|
356 |
|
---|
357 | /**
|
---|
358 | * @param array $value
|
---|
359 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
360 | */
|
---|
361 | public function setCategory($value)
|
---|
362 | {
|
---|
363 | $this->_category = $value;
|
---|
364 | return $this;
|
---|
365 | }
|
---|
366 |
|
---|
367 | /**
|
---|
368 | * @return Zend_Gdata_Media_Extension_MediaCopyright
|
---|
369 | */
|
---|
370 | public function getCopyright()
|
---|
371 | {
|
---|
372 | return $this->_copyright;
|
---|
373 | }
|
---|
374 |
|
---|
375 | /**
|
---|
376 | * @param Zend_Gdata_Media_Extension_MediaCopyright $value
|
---|
377 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
378 | */
|
---|
379 | public function setCopyright($value)
|
---|
380 | {
|
---|
381 | $this->_copyright = $value;
|
---|
382 | return $this;
|
---|
383 | }
|
---|
384 |
|
---|
385 | /**
|
---|
386 | * @return array
|
---|
387 | */
|
---|
388 | public function getCredit()
|
---|
389 | {
|
---|
390 | return $this->_credit;
|
---|
391 | }
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * @param array $value
|
---|
395 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
396 | */
|
---|
397 | public function setCredit($value)
|
---|
398 | {
|
---|
399 | $this->_credit = $value;
|
---|
400 | return $this;
|
---|
401 | }
|
---|
402 |
|
---|
403 | /**
|
---|
404 | * @return Zend_Gdata_Media_Extension_MediaTitle
|
---|
405 | */
|
---|
406 | public function getTitle()
|
---|
407 | {
|
---|
408 | return $this->_title;
|
---|
409 | }
|
---|
410 |
|
---|
411 | /**
|
---|
412 | * @param Zend_Gdata_Media_Extension_MediaTitle $value
|
---|
413 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
414 | */
|
---|
415 | public function setTitle($value)
|
---|
416 | {
|
---|
417 | $this->_title = $value;
|
---|
418 | return $this;
|
---|
419 | }
|
---|
420 |
|
---|
421 | /**
|
---|
422 | * @return Zend_Gdata_Media_Extension_MediaDescription
|
---|
423 | */
|
---|
424 | public function getDescription()
|
---|
425 | {
|
---|
426 | return $this->_description;
|
---|
427 | }
|
---|
428 |
|
---|
429 | /**
|
---|
430 | * @param Zend_Gdata_Media_Extension_MediaDescription $value
|
---|
431 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
432 | */
|
---|
433 | public function setDescription($value)
|
---|
434 | {
|
---|
435 | $this->_description = $value;
|
---|
436 | return $this;
|
---|
437 | }
|
---|
438 |
|
---|
439 | /**
|
---|
440 | * @return array
|
---|
441 | */
|
---|
442 | public function getHash()
|
---|
443 | {
|
---|
444 | return $this->_hash;
|
---|
445 | }
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * @param array $value
|
---|
449 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
450 | */
|
---|
451 | public function setHash($value)
|
---|
452 | {
|
---|
453 | $this->_hash = $value;
|
---|
454 | return $this;
|
---|
455 | }
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * @return Zend_Gdata_Media_Extension_MediaKeywords
|
---|
459 | */
|
---|
460 | public function getKeywords()
|
---|
461 | {
|
---|
462 | return $this->_keywords;
|
---|
463 | }
|
---|
464 |
|
---|
465 | /**
|
---|
466 | * @param array $value
|
---|
467 | * @return Zend_Gdata_Media_Extension_MediaGroup Provides a fluent interface
|
---|
468 | */
|
---|
469 | public function setKeywords($value)
|
---|
470 | {
|
---|
471 | $this->_keywords = $value;
|
---|
472 | return $this;
|
---|
473 | }
|
---|
474 |
|
---|
475 | /**
|
---|
476 | * @return array
|
---|
477 | */
|
---|
478 | public function getPlayer()
|
---|
479 | {
|
---|
480 | return $this->_player;
|
---|
481 | }
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * @param array
|
---|
485 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
486 | */
|
---|
487 | public function setPlayer($value)
|
---|
488 | {
|
---|
489 | $this->_player = $value;
|
---|
490 | return $this;
|
---|
491 | }
|
---|
492 |
|
---|
493 | /**
|
---|
494 | * @return array
|
---|
495 | */
|
---|
496 | public function getRating()
|
---|
497 | {
|
---|
498 | return $this->_rating;
|
---|
499 | }
|
---|
500 |
|
---|
501 | /**
|
---|
502 | * @param array
|
---|
503 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
504 | */
|
---|
505 | public function setRating($value)
|
---|
506 | {
|
---|
507 | $this->_rating = $value;
|
---|
508 | return $this;
|
---|
509 | }
|
---|
510 |
|
---|
511 | /**
|
---|
512 | * @return array
|
---|
513 | */
|
---|
514 | public function getRestriction()
|
---|
515 | {
|
---|
516 | return $this->_restriction;
|
---|
517 | }
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * @param array
|
---|
521 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
522 | */
|
---|
523 | public function setRestriction($value)
|
---|
524 | {
|
---|
525 | $this->_restriction = $value;
|
---|
526 | return $this;
|
---|
527 | }
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * @return array
|
---|
531 | */
|
---|
532 | public function getThumbnail()
|
---|
533 | {
|
---|
534 | return $this->_thumbnail;
|
---|
535 | }
|
---|
536 |
|
---|
537 | /**
|
---|
538 | * @param array
|
---|
539 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
540 | */
|
---|
541 | public function setThumbnail($value)
|
---|
542 | {
|
---|
543 | $this->_thumbnail = $value;
|
---|
544 | return $this;
|
---|
545 | }
|
---|
546 |
|
---|
547 | /**
|
---|
548 | * @return array
|
---|
549 | */
|
---|
550 | public function getMediaText()
|
---|
551 | {
|
---|
552 | return $this->_mediaText;
|
---|
553 | }
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * @param array
|
---|
557 | * @return Zend_Gdata_Media_Extension_MediaGroup
|
---|
558 | */
|
---|
559 | public function setMediaText($value)
|
---|
560 | {
|
---|
561 | $this->_mediaText = $value;
|
---|
562 | return $this;
|
---|
563 | }
|
---|
564 |
|
---|
565 | }
|
---|