[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Media/Extension/ -> MediaPlayer.php (source)

   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 [email protected] so we can send you a copy immediately.
  15   *
  16   * @category   Zend
  17   * @package    Zend_Gdata
  18   * @subpackage Media
  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
  21   * @version    $Id$
  22   */
  23  
  24  /**
  25   * @see Zend_Gdata_App_Extension
  26   */
  27  require_once 'Zend/Gdata/App/Extension.php';
  28  
  29  /**
  30   * Represents the media:player element
  31   *
  32   * @category   Zend
  33   * @package    Zend_Gdata
  34   * @subpackage Media
  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
  37   */
  38  class Zend_Gdata_Media_Extension_MediaPlayer extends Zend_Gdata_Extension
  39  {
  40  
  41      protected $_rootElement = 'player';
  42      protected $_rootNamespace = 'media';
  43  
  44      /**
  45       * @var string
  46       */
  47      protected $_url = null;
  48  
  49      /**
  50       * @var int
  51       */
  52      protected $_width = null;
  53  
  54      /**
  55       * @var int
  56       */
  57      protected $_height = null;
  58  
  59      /**
  60       * Constructs a new MediaPlayer element
  61       *
  62       * @param string $url
  63       * @param int $width
  64       * @param int $height
  65       */
  66      public function __construct($url = null, $width = null, $height = null)
  67      {
  68          $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
  69          parent::__construct();
  70          $this->_url = $url;
  71          $this->_width = $width;
  72          $this->_height = $height;
  73      }
  74  
  75      /**
  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.
  80       *
  81       * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  82       * @return DOMElement The DOMElement representing this element and all
  83       * child properties.
  84       */
  85      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  86      {
  87          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  88          if ($this->_url !== null) {
  89              $element->setAttribute('url', $this->_url);
  90          }
  91          if ($this->_width !== null) {
  92              $element->setAttribute('width', $this->_width);
  93          }
  94          if ($this->_height !== null) {
  95              $element->setAttribute('height', $this->_height);
  96          }
  97          return $element;
  98      }
  99  
 100      /**
 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.
 104       *
 105       * @param DOMNode $attribute The DOMNode attribute needed to be handled
 106       */
 107      protected function takeAttributeFromDOM($attribute)
 108      {
 109          switch ($attribute->localName) {
 110          case 'url':
 111              $this->_url = $attribute->nodeValue;
 112              break;
 113          case 'width':
 114              $this->_width = $attribute->nodeValue;
 115              break;
 116          case 'height':
 117              $this->_height = $attribute->nodeValue;
 118              break;
 119          default:
 120              parent::takeAttributeFromDOM($attribute);
 121          }
 122      }
 123  
 124      /**
 125       * @return string
 126       */
 127      public function getUrl()
 128      {
 129          return $this->_url;
 130      }
 131  
 132      /**
 133       * @param string $value
 134       * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
 135       */
 136      public function setUrl($value)
 137      {
 138          $this->_url = $value;
 139          return $this;
 140      }
 141  
 142      /**
 143       * @return int
 144       */
 145      public function getWidth()
 146      {
 147          return $this->_width;
 148      }
 149  
 150      /**
 151       * @param int $value
 152       * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
 153       */
 154      public function setWidth($value)
 155      {
 156          $this->_width = $value;
 157          return $this;
 158      }
 159  
 160      /**
 161       * @return int
 162       */
 163      public function getHeight()
 164      {
 165          return $this->_height;
 166      }
 167  
 168      /**
 169       * @param int $value
 170       * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
 171       */
 172      public function setHeight($value)
 173      {
 174          $this->_height = $value;
 175          return $this;
 176      }
 177  
 178  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1