File indexing completed on 2024-06-16 05:30:07

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Media
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Entry
0031  */
0032 // require_once 'Zend/Gdata/Entry.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Media_Extension_MediaContent
0036  */
0037 // require_once 'Zend/Gdata/Media/Extension/MediaContent.php';
0038 
0039 /**
0040  * @see Zend_Gdata_Media_Extension_MediaCategory
0041  */
0042 // require_once 'Zend/Gdata/Media/Extension/MediaCategory.php';
0043 
0044 /**
0045  * @see Zend_Gdata_Media_Extension_MediaCopyright
0046  */
0047 // require_once 'Zend/Gdata/Media/Extension/MediaCopyright.php';
0048 
0049 /**
0050  * @see Zend_Gdata_Media_Extension_MediaCredit
0051  */
0052 // require_once 'Zend/Gdata/Media/Extension/MediaCredit.php';
0053 
0054 /**
0055  * @see Zend_Gdata_Media_Extension_MediaDescription
0056  */
0057 // require_once 'Zend/Gdata/Media/Extension/MediaDescription.php';
0058 
0059 /**
0060  * @see Zend_Gdata_Media_Extension_MediaHash
0061  */
0062 // require_once 'Zend/Gdata/Media/Extension/MediaHash.php';
0063 
0064 /**
0065  * @see Zend_Gdata_Media_Extension_MediaKeywords
0066  */
0067 // require_once 'Zend/Gdata/Media/Extension/MediaKeywords.php';
0068 
0069 /**
0070  * @see Zend_Gdata_Media_Extension_MediaPlayer
0071  */
0072 // require_once 'Zend/Gdata/Media/Extension/MediaPlayer.php';
0073 
0074 /**
0075  * @see Zend_Gdata_Media_Extension_MediaRating
0076  */
0077 // require_once 'Zend/Gdata/Media/Extension/MediaRating.php';
0078 
0079 /**
0080  * @see Zend_Gdata_Media_Extension_MediaRestriction
0081  */
0082 // require_once 'Zend/Gdata/Media/Extension/MediaRestriction.php';
0083 
0084 /**
0085  * @see Zend_Gdata_Media_Extension_MediaText
0086  */
0087 // require_once 'Zend/Gdata/Media/Extension/MediaText.php';
0088 
0089 /**
0090  * @see Zend_Gdata_Media_Extension_MediaThumbnail
0091  */
0092 // require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
0093 
0094 /**
0095  * @see Zend_Gdata_Media_Extension_MediaTitle
0096  */
0097 // require_once 'Zend/Gdata/Media/Extension/MediaTitle.php';
0098 
0099 
0100 /**
0101  * This class represents the media:group element of Media RSS.
0102  * It allows the grouping of media:content elements that are
0103  * different representations of the same content.  When it exists,
0104  * it is a child of an Entry (Atom) or Item (RSS).
0105  *
0106  * @category   Zend
0107  * @package    Zend_Gdata
0108  * @subpackage Media
0109  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0110  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0111  */
0112 class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension
0113 {
0114 
0115     protected $_rootElement = 'group';
0116     protected $_rootNamespace = 'media';
0117 
0118     /**
0119      * @var array
0120      */
0121     protected $_content = array();
0122 
0123     /**
0124      * @var array
0125      */
0126     protected $_category = array();
0127 
0128     /**
0129      * @var Zend_Gdata_Media_Extension_MediaCopyright
0130      */
0131     protected $_copyright = null;
0132 
0133     /**
0134      * @var array
0135      */
0136     protected $_credit = array();
0137 
0138     /**
0139      * @var Zend_Gdata_Media_Extension_MediaDescription
0140      */
0141     protected $_description = null;
0142 
0143     /**
0144      * @var array
0145      */
0146     protected $_hash = array();
0147 
0148     /**
0149      * @var Zend_Gdata_Media_Extension_MediaKeywords
0150      */
0151     protected $_keywords = null;
0152 
0153     /**
0154      * @var array
0155      */
0156     protected $_player = array();
0157 
0158     /**
0159      * @var array
0160      */
0161     protected $_rating = array();
0162 
0163     /**
0164      * @var array
0165      */
0166     protected $_restriction = array();
0167 
0168     /**
0169      * @var array
0170      */
0171     protected $_mediaText = array();
0172 
0173     /**
0174      * @var array
0175      */
0176     protected $_thumbnail = array();
0177 
0178     /**
0179      * @var string
0180      */
0181     protected $_title = null;
0182 
0183     /**
0184      * Creates an individual MediaGroup object.
0185      */
0186     public function __construct($element = null)
0187     {
0188         $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
0189         parent::__construct($element);
0190     }
0191 
0192     /**
0193      * Retrieves a DOMElement which corresponds to this element and all
0194      * child properties.  This is used to build an entry back into a DOM
0195      * and eventually XML text for sending to the server upon updates, or
0196      * for application storage/persistence.
0197      *
0198      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0199      * @return DOMElement The DOMElement representing this element and all
0200      * child properties.
0201      */
0202     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0203     {
0204         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0205         foreach ($this->_content as $content) {
0206             $element->appendChild($content->getDOM($element->ownerDocument));
0207         }
0208         foreach ($this->_category as $category) {
0209             $element->appendChild($category->getDOM($element->ownerDocument));
0210         }
0211         foreach ($this->_credit as $credit) {
0212             $element->appendChild($credit->getDOM($element->ownerDocument));
0213         }
0214         foreach ($this->_player as $player) {
0215             $element->appendChild($player->getDOM($element->ownerDocument));
0216         }
0217         foreach ($this->_rating as $rating) {
0218             $element->appendChild($rating->getDOM($element->ownerDocument));
0219         }
0220         foreach ($this->_restriction as $restriction) {
0221             $element->appendChild($restriction->getDOM($element->ownerDocument));
0222         }
0223         foreach ($this->_mediaText as $text) {
0224             $element->appendChild($text->getDOM($element->ownerDocument));
0225         }
0226         foreach ($this->_thumbnail as $thumbnail) {
0227             $element->appendChild($thumbnail->getDOM($element->ownerDocument));
0228         }
0229         if ($this->_copyright != null) {
0230             $element->appendChild(
0231                     $this->_copyright->getDOM($element->ownerDocument));
0232         }
0233         if ($this->_description != null) {
0234             $element->appendChild(
0235                     $this->_description->getDOM($element->ownerDocument));
0236         }
0237         foreach ($this->_hash as $hash) {
0238             $element->appendChild($hash->getDOM($element->ownerDocument));
0239         }
0240         if ($this->_keywords != null) {
0241             $element->appendChild(
0242                     $this->_keywords->getDOM($element->ownerDocument));
0243         }
0244         if ($this->_title != null) {
0245             $element->appendChild(
0246                     $this->_title->getDOM($element->ownerDocument));
0247         }
0248         return $element;
0249     }
0250 
0251     /**
0252      * Creates individual Entry objects of the appropriate type and
0253      * stores them in the $_entry array based upon DOM data.
0254      *
0255      * @param DOMNode $child The DOMNode to process
0256      */
0257     protected function takeChildFromDOM($child)
0258     {
0259         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0260         switch ($absoluteNodeName) {
0261             case $this->lookupNamespace('media') . ':' . 'content';
0262                 $content = new Zend_Gdata_Media_Extension_MediaContent();
0263                 $content->transferFromDOM($child);
0264                 $this->_content[] = $content;
0265                 break;
0266             case $this->lookupNamespace('media') . ':' . 'category';
0267                 $category = new Zend_Gdata_Media_Extension_MediaCategory();
0268                 $category->transferFromDOM($child);
0269                 $this->_category[] = $category;
0270                 break;
0271             case $this->lookupNamespace('media') . ':' . 'copyright';
0272                 $copyright = new Zend_Gdata_Media_Extension_MediaCopyright();
0273                 $copyright->transferFromDOM($child);
0274                 $this->_copyright = $copyright;
0275                 break;
0276             case $this->lookupNamespace('media') . ':' . 'credit';
0277                 $credit = new Zend_Gdata_Media_Extension_MediaCredit();
0278                 $credit->transferFromDOM($child);
0279                 $this->_credit[] = $credit;
0280                 break;
0281             case $this->lookupNamespace('media') . ':' . 'description';
0282                 $description = new Zend_Gdata_Media_Extension_MediaDescription();
0283                 $description->transferFromDOM($child);
0284                 $this->_description = $description;
0285                 break;
0286             case $this->lookupNamespace('media') . ':' . 'hash';
0287                 $hash = new Zend_Gdata_Media_Extension_MediaHash();
0288                 $hash->transferFromDOM($child);
0289                 $this->_hash[] = $hash;
0290                 break;
0291             case $this->lookupNamespace('media') . ':' . 'keywords';
0292                 $keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
0293                 $keywords->transferFromDOM($child);
0294                 $this->_keywords = $keywords;
0295                 break;
0296             case $this->lookupNamespace('media') . ':' . 'player';
0297                 $player = new Zend_Gdata_Media_Extension_MediaPlayer();
0298                 $player->transferFromDOM($child);
0299                 $this->_player[] = $player;
0300                 break;
0301             case $this->lookupNamespace('media') . ':' . 'rating';
0302                 $rating = new Zend_Gdata_Media_Extension_MediaRating();
0303                 $rating->transferFromDOM($child);
0304                 $this->_rating[] = $rating;
0305                 break;
0306             case $this->lookupNamespace('media') . ':' . 'restriction';
0307                 $restriction = new Zend_Gdata_Media_Extension_MediaRestriction();
0308                 $restriction->transferFromDOM($child);
0309                 $this->_restriction[] = $restriction;
0310                 break;
0311             case $this->lookupNamespace('media') . ':' . 'text';
0312                 $text = new Zend_Gdata_Media_Extension_MediaText();
0313                 $text->transferFromDOM($child);
0314                 $this->_mediaText[] = $text;
0315                 break;
0316             case $this->lookupNamespace('media') . ':' . 'thumbnail';
0317                 $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
0318                 $thumbnail->transferFromDOM($child);
0319                 $this->_thumbnail[] = $thumbnail;
0320                 break;
0321             case $this->lookupNamespace('media') . ':' . 'title';
0322                 $title = new Zend_Gdata_Media_Extension_MediaTitle();
0323                 $title->transferFromDOM($child);
0324                 $this->_title = $title;
0325                 break;
0326         default:
0327             parent::takeChildFromDOM($child);
0328             break;
0329         }
0330     }
0331 
0332     /**
0333      * @return array
0334      */
0335     public function getContent()
0336     {
0337         return $this->_content;
0338     }
0339 
0340     /**
0341      * @param array $value
0342      * @return Zend_Gdata_Media_MediaGroup Provides a fluent interface
0343      */
0344     public function setContent($value)
0345     {
0346         $this->_content = $value;
0347         return $this;
0348     }
0349 
0350     /**
0351      * @return array
0352      */
0353     public function getCategory()
0354     {
0355         return $this->_category;
0356     }
0357 
0358     /**
0359      * @param array $value
0360      * @return Zend_Gdata_Media_Extension_MediaGroup
0361      */
0362     public function setCategory($value)
0363     {
0364         $this->_category = $value;
0365         return $this;
0366     }
0367 
0368     /**
0369      * @return Zend_Gdata_Media_Extension_MediaCopyright
0370      */
0371     public function getCopyright()
0372     {
0373         return $this->_copyright;
0374     }
0375 
0376     /**
0377      * @param Zend_Gdata_Media_Extension_MediaCopyright $value
0378      * @return Zend_Gdata_Media_Extension_MediaGroup
0379      */
0380     public function setCopyright($value)
0381     {
0382         $this->_copyright = $value;
0383         return $this;
0384     }
0385 
0386     /**
0387      * @return array
0388      */
0389     public function getCredit()
0390     {
0391         return $this->_credit;
0392     }
0393 
0394     /**
0395      * @param array $value
0396      * @return Zend_Gdata_Media_Extension_MediaGroup
0397      */
0398     public function setCredit($value)
0399     {
0400         $this->_credit = $value;
0401         return $this;
0402     }
0403 
0404     /**
0405      * @return Zend_Gdata_Media_Extension_MediaTitle
0406      */
0407     public function getTitle()
0408     {
0409         return $this->_title;
0410     }
0411 
0412     /**
0413      * @param Zend_Gdata_Media_Extension_MediaTitle $value
0414      * @return Zend_Gdata_Media_Extension_MediaGroup
0415      */
0416     public function setTitle($value)
0417     {
0418         $this->_title = $value;
0419         return $this;
0420     }
0421 
0422     /**
0423      * @return Zend_Gdata_Media_Extension_MediaDescription
0424      */
0425     public function getDescription()
0426     {
0427         return $this->_description;
0428     }
0429 
0430     /**
0431      * @param Zend_Gdata_Media_Extension_MediaDescription $value
0432      * @return Zend_Gdata_Media_Extension_MediaGroup
0433      */
0434     public function setDescription($value)
0435     {
0436         $this->_description = $value;
0437         return $this;
0438     }
0439 
0440     /**
0441      * @return array
0442      */
0443     public function getHash()
0444     {
0445         return $this->_hash;
0446     }
0447 
0448     /**
0449      * @param array $value
0450      * @return Zend_Gdata_Media_Extension_MediaGroup
0451      */
0452     public function setHash($value)
0453     {
0454         $this->_hash = $value;
0455         return $this;
0456     }
0457 
0458     /**
0459      * @return Zend_Gdata_Media_Extension_MediaKeywords
0460      */
0461     public function getKeywords()
0462     {
0463         return $this->_keywords;
0464     }
0465 
0466     /**
0467      * @param array $value
0468      * @return Zend_Gdata_Media_Extension_MediaGroup Provides a fluent interface
0469      */
0470     public function setKeywords($value)
0471     {
0472         $this->_keywords = $value;
0473         return $this;
0474     }
0475 
0476     /**
0477      * @return array
0478      */
0479     public function getPlayer()
0480     {
0481         return $this->_player;
0482     }
0483 
0484     /**
0485      * @param array
0486      * @return Zend_Gdata_Media_Extension_MediaGroup
0487      */
0488     public function setPlayer($value)
0489     {
0490         $this->_player = $value;
0491         return $this;
0492     }
0493 
0494     /**
0495      * @return array
0496      */
0497     public function getRating()
0498     {
0499         return $this->_rating;
0500     }
0501 
0502     /**
0503      * @param array
0504      * @return Zend_Gdata_Media_Extension_MediaGroup
0505      */
0506     public function setRating($value)
0507     {
0508         $this->_rating = $value;
0509         return $this;
0510     }
0511 
0512     /**
0513      * @return array
0514      */
0515     public function getRestriction()
0516     {
0517         return $this->_restriction;
0518     }
0519 
0520     /**
0521      * @param array
0522      * @return Zend_Gdata_Media_Extension_MediaGroup
0523      */
0524     public function setRestriction($value)
0525     {
0526         $this->_restriction = $value;
0527         return $this;
0528     }
0529 
0530     /**
0531      * @return array
0532      */
0533     public function getThumbnail()
0534     {
0535         return $this->_thumbnail;
0536     }
0537 
0538     /**
0539      * @param array
0540      * @return Zend_Gdata_Media_Extension_MediaGroup
0541      */
0542     public function setThumbnail($value)
0543     {
0544         $this->_thumbnail = $value;
0545         return $this;
0546     }
0547 
0548     /**
0549      * @return array
0550      */
0551     public function getMediaText()
0552     {
0553         return $this->_mediaText;
0554     }
0555 
0556     /**
0557      * @param array
0558      * @return Zend_Gdata_Media_Extension_MediaGroup
0559      */
0560     public function setMediaText($value)
0561     {
0562         $this->_mediaText = $value;
0563         return $this;
0564     }
0565 
0566 }