File indexing completed on 2025-03-02 05:29:28
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_Entry 0026 */ 0027 // require_once 'Zend/Gdata/Entry.php'; 0028 0029 /** 0030 * @see Zend_Gdata_Media 0031 */ 0032 // require_once 'Zend/Gdata/Media.php'; 0033 0034 /** 0035 * @see Zend_Gdata_Media_Extension_MediaGroup 0036 */ 0037 // require_once 'Zend/Gdata/Media/Extension/MediaGroup.php'; 0038 0039 /** 0040 * Represents the Gdata flavor of an Atom entry 0041 * 0042 * @category Zend 0043 * @package Zend_Gdata 0044 * @subpackage Media 0045 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0046 * @license http://framework.zend.com/license/new-bsd New BSD License 0047 */ 0048 class Zend_Gdata_Media_Entry extends Zend_Gdata_Entry 0049 { 0050 0051 protected $_entryClassName = 'Zend_Gdata_Media_Entry'; 0052 0053 /** 0054 * media:group element 0055 * 0056 * @var Zend_Gdata_Media_Extension_MediaGroup 0057 */ 0058 protected $_mediaGroup = null; 0059 0060 /** 0061 * Create a new instance. 0062 * 0063 * @param DOMElement $element (optional) DOMElement from which this 0064 * object should be constructed. 0065 */ 0066 public function __construct($element = null) 0067 { 0068 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 0069 parent::__construct($element); 0070 } 0071 0072 /** 0073 * Retrieves a DOMElement which corresponds to this element and all 0074 * child properties. This is used to build an entry back into a DOM 0075 * and eventually XML text for application storage/persistence. 0076 * 0077 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0078 * @return DOMElement The DOMElement representing this element and all 0079 * child properties. 0080 */ 0081 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0082 { 0083 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0084 if ($this->_mediaGroup != null) { 0085 $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument)); 0086 } 0087 return $element; 0088 } 0089 0090 /** 0091 * Creates individual Entry objects of the appropriate type and 0092 * stores them as members of this entry based upon DOM data. 0093 * 0094 * @param DOMNode $child The DOMNode to process 0095 */ 0096 protected function takeChildFromDOM($child) 0097 { 0098 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 0099 switch ($absoluteNodeName) { 0100 case $this->lookupNamespace('media') . ':' . 'group': 0101 $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); 0102 $mediaGroup->transferFromDOM($child); 0103 $this->_mediaGroup = $mediaGroup; 0104 break; 0105 default: 0106 parent::takeChildFromDOM($child); 0107 break; 0108 } 0109 } 0110 0111 /** 0112 * Returns the entry's mediaGroup object. 0113 * 0114 * @return Zend_Gdata_Media_Extension_MediaGroup 0115 */ 0116 public function getMediaGroup() 0117 { 0118 return $this->_mediaGroup; 0119 } 0120 0121 /** 0122 * Sets the entry's mediaGroup object. 0123 * 0124 * @param Zend_Gdata_Media_Extension_MediaGroup $mediaGroup 0125 * @return Zend_Gdata_Media_Entry Provides a fluent interface 0126 */ 0127 public function setMediaGroup($mediaGroup) 0128 { 0129 $this->_mediaGroup = $mediaGroup; 0130 return $this; 0131 } 0132 0133 0134 }