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-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_App_Extension
27 require_once 'Zend/Gdata/App/Extension.php';
30 * Represents the media:player element
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Media_Extension_MediaPlayer extends Zend_Gdata_Extension
41 protected $_rootElement = 'player';
42 protected $_rootNamespace = 'media';
47 protected $_url = null;
52 protected $_width = null;
57 protected $_height = null;
60 * Constructs a new MediaPlayer element
66 public function __construct($url = null, $width = null, $height = null)
68 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
69 parent::__construct();
71 $this->_width = $width;
72 $this->_height = $height;
76 * Retrieves a DOMElement which corresponds to this element and all
77 * child properties. This is used to build an entry back into a DOM
78 * and eventually XML text for sending to the server upon updates, or
79 * for application storage/persistence.
81 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
82 * @return DOMElement The DOMElement representing this element and all
85 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
87 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
88 if ($this->_url !== null) {
89 $element->setAttribute('url', $this->_url);
91 if ($this->_width !== null) {
92 $element->setAttribute('width', $this->_width);
94 if ($this->_height !== null) {
95 $element->setAttribute('height', $this->_height);
101 * Given a DOMNode representing an attribute, tries to map the data into
102 * instance members. If no mapping is defined, the name and value are
103 * stored in an array.
105 * @param DOMNode $attribute The DOMNode attribute needed to be handled
107 protected function takeAttributeFromDOM($attribute)
109 switch ($attribute->localName) {
111 $this->_url = $attribute->nodeValue;
114 $this->_width = $attribute->nodeValue;
117 $this->_height = $attribute->nodeValue;
120 parent::takeAttributeFromDOM($attribute);
127 public function getUrl()
133 * @param string $value
134 * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
136 public function setUrl($value)
138 $this->_url = $value;
145 public function getWidth()
147 return $this->_width;
152 * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
154 public function setWidth($value)
156 $this->_width = $value;
163 public function getHeight()
165 return $this->_height;
170 * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
172 public function setHeight($value)
174 $this->_height = $value;