videoentry.php

来自「Bug tracker, and reporter.」· PHP 代码 · 共 727 行 · 第 1/2 页

PHP
727
字号
<?php/** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category   Zend * @package    Zend_Gdata * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License * @version    $Id: VideoEntry.php 8754 2008-03-11 19:19:45Z rboyd $ *//** * @see Zend_Gdata_Extension_Comments */require_once 'Zend/Gdata/Extension/Comments.php';/** * @see Zend_Gdata_Extension_FeedLink */require_once 'Zend/Gdata/Extension/FeedLink.php';/** * @see Zend_Gdata_YouTube_MediaEntry */require_once 'Zend/Gdata/YouTube/MediaEntry.php';/** * @see Zend_Gdata_YouTube_Extension_NoEmbed */require_once 'Zend/Gdata/YouTube/Extension/NoEmbed.php';/** * @see Zend_Gdata_YouTube_Extension_Statistics */require_once 'Zend/Gdata/YouTube/Extension/Statistics.php';/** * @see Zend_Gdata_YouTube_Extension_Link */require_once 'Zend/Gdata/YouTube/Extension/Link.php';/** * @see Zend_Gdata_YouTube_Extension_Racy */require_once 'Zend/Gdata/YouTube/Extension/Racy.php';/** * @see Zend_Gdata_Extension_Rating */require_once 'Zend/Gdata/Extension/Rating.php';/** * @see Zend_Gdata_Geo_Extension_GeoRssWhere */require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';/** * @see Zend_Gdata_YouTube_Extension_Control */require_once 'Zend/Gdata/YouTube/Extension/Control.php';/** * Represents the YouTube video flavor of an Atom entry * * @category   Zend * @package    Zend_Gdata * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License */class Zend_Gdata_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry{    protected $_entryClassName = 'Zend_Gdata_YouTube_VideoEntry';    /**     * If null, the video can be embedded     *     * @var Zend_Gdata_YouTube_Extension_NoEmbed     */    protected $_noEmbed = null;    /**     * Specifies the statistics relating to the video.     *     * @var Zend_Gdata_YouTube_Extension_Statistics     */    protected $_statistics = null;    /**     * If not null, specifies that the video has racy content.     *     * @var Zend_Gdata_YouTube_Extension_Racy     */    protected $_racy = null;    /**     * Specifies the video's rating.     *     * @var Zend_Gdata_Extension_Rating     */    protected $_rating = null;    /**     * Specifies the comments associated with a video.     *     * @var Zend_Gdata_Extensions_Comments     */    protected $_comments = null;    /**     * Nested feed links     *     * @var array     */    protected $_feedLink = array();    /**     * Geo location for the video     *     * @var Zend_Gdata_Geo_Extension_GeoRssWhere     */    protected $_where = null;    /**     * Creates a Video entry, representing an individual video     *     * @param DOMElement $element (optional) DOMElement from which this     *          object should be constructed.     */    public function __construct($element = null)    {        foreach (Zend_Gdata_YouTube::$namespaces as $nsPrefix => $nsUri) {            $this->registerNamespace($nsPrefix, $nsUri);        }        parent::__construct($element);    }    /**     * Retrieves a DOMElement which corresponds to this element and all     * child properties.  This is used to build an entry back into a DOM     * and eventually XML text for sending to the server upon updates, or     * for application storage/persistence.     *     * @param DOMDocument $doc The DOMDocument used to construct DOMElements     * @return DOMElement The DOMElement representing this element and all     * child properties.     */    public function getDOM($doc = null)    {        $element = parent::getDOM($doc);        if ($this->_noEmbed != null) {            $element->appendChild($this->_noEmbed->getDOM($element->ownerDocument));        }        if ($this->_statistics != null) {            $element->appendChild($this->_statistics->getDOM($element->ownerDocument));        }        if ($this->_racy != null) {            $element->appendChild($this->_racy->getDOM($element->ownerDocument));        }        if ($this->_rating != null) {            $element->appendChild($this->_rating->getDOM($element->ownerDocument));        }        if ($this->_comments != null) {            $element->appendChild($this->_comments->getDOM($element->ownerDocument));        }        if ($this->_feedLink != null) {            foreach ($this->_feedLink as $feedLink) {                $element->appendChild($feedLink->getDOM($element->ownerDocument));            }        }        if ($this->_where != null) {           $element->appendChild($this->_where->getDOM($element->ownerDocument));        }        return $element;    }    /**     * Creates individual Entry objects of the appropriate type and     * stores them in the $_entry array based upon DOM data.     *     * @param DOMNode $child The DOMNode to process     */    protected function takeChildFromDOM($child)    {        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;        switch ($absoluteNodeName) {        case $this->lookupNamespace('yt') . ':' . 'statistics':            $statistics = new Zend_Gdata_YouTube_Extension_Statistics();            $statistics->transferFromDOM($child);            $this->_statistics = $statistics;            break;        case $this->lookupNamespace('yt') . ':' . 'racy':            $racy = new Zend_Gdata_YouTube_Extension_Racy();            $racy->transferFromDOM($child);            $this->_racy = $racy;            break;        case $this->lookupNamespace('gd') . ':' . 'rating':            $rating = new Zend_Gdata_Extension_Rating();            $rating->transferFromDOM($child);            $this->_rating = $rating;            break;        case $this->lookupNamespace('gd') . ':' . 'comments':            $comments = new Zend_Gdata_Extension_Comments();            $comments->transferFromDOM($child);            $this->_comments = $comments;            break;        case $this->lookupNamespace('yt') . ':' . 'noembed':            $noEmbed = new Zend_Gdata_YouTube_Extension_NoEmbed();            $noEmbed->transferFromDOM($child);            $this->_noEmbed = $noEmbed;            break;        case $this->lookupNamespace('gd') . ':' . 'feedLink':            $feedLink = new Zend_Gdata_Extension_FeedLink();            $feedLink->transferFromDOM($child);            $this->_feedLink[] = $feedLink;            break;        case $this->lookupNamespace('georss') . ':' . 'where':            $where = new Zend_Gdata_Geo_Extension_GeoRssWhere();            $where->transferFromDOM($child);            $this->_where = $where;            break;        case $this->lookupNamespace('atom') . ':' . 'link';            $link = new Zend_Gdata_YouTube_Extension_Link();            $link->transferFromDOM($child);            $this->_link[] = $link;            break;        case $this->lookupNamespace('app') . ':' . 'control':            $control = new Zend_Gdata_YouTube_Extension_Control();            $control->transferFromDOM($child);            $this->_control = $control;            break;        default:            parent::takeChildFromDOM($child);            break;        }    }    /**     * Sets when the video was recorded.     *     * @param Zend_Gdata_YouTube_Extension_RecordingDate $recordingDate When the video was recorded     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setRecordingDate($recordingDate = null)    {        $this->_recordingDate = $recordingDate;        return $this;    }    /**     * If an instance of Zend_Gdata_YouTube_Extension_NoEmbed is passed in,     * the video cannot be embedded.  Otherwise, if null is passsed in, the     * video is able to be embedded     * TODO: Make it easier to get/set this data     *     * @param Zend_Gdata_YouTube_Extension_NoEmbed $noEmbed Whether or not the video can be embedded     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setNoEmbed($noEmbed = null)    {        $this->_noEmbed = $noEmbed;        return $this;    }    /**     * If the return value is an instance of     * Zend_Gdata_YouTube_Extension_NoEmbed, this video cannot be embedded.     * TODO: Make it easier to get/set this data     *     * @return Zend_Gdata_YouTube_Extension_NoEmbed Whether or not the video can be embedded     */    public function getNoEmbed()    {        return $this->_noEmbed;    }    /**     * Sets the statistics relating to the video.     *     * @param Zend_Gdata_YouTube_Extension_Statistics $statistics The statistics relating to the video     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setStatistics($statistics = null)    {        $this->_statistics = $statistics;        return $this;    }    /**     * Returns the statistics relating to the video.     *     * @return Zend_Gdata_YouTube_Extension_Statistics  The statistics relating to the video     */    public function getStatistics()    {        return $this->_statistics;    }    /**     * Specifies that the video has racy content.     *     * @param Zend_Gdata_YouTube_Extension_Racy $racy The racy flag object     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setRacy($racy = null)    {        $this->_racy = $racy;        return $this;    }    /**     * Returns the racy flag object.     *     * @return Zend_Gdata_YouTube_Extension_Racy  The racy flag object     */    public function getRacy()    {        return $this->_racy;    }    /**     * Sets the rating relating to the video.     *     * @param Zend_Gdata_Extension_Rating $rating The rating relating to the video     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setRating($rating = null)    {        $this->_rating = $rating;        return $this;    }    /**     * Returns the rating relating to the video.     *     * @return Zend_Gdata_Extension_Rating  The rating relating to the video     */    public function getRating()    {        return $this->_rating;    }    /**     * Sets the comments relating to the video.     *     * @param Zend_Gdata_Extension_Comments $comments The comments relating to the video     * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface     */    public function setComments($comments = null)    {        $this->_comments = $comments;        return $this;    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?