source: extensions/Google2Piwigo/include/Zend/Gdata/YouTube/PlaylistVideoEntry.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 4.2 KB
Line 
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 license@zend.com so we can send you a copy immediately.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage YouTube
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: PlaylistVideoEntry.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_YouTube_VideoEntry
26 */
27require_once 'Zend/Gdata/YouTube/VideoEntry.php';
28
29/**
30 * @see Zend_Gdata_YouTube_Extension_Position
31 */
32require_once 'Zend/Gdata/YouTube/Extension/Position.php';
33
34/**
35 * Represents the YouTube video playlist flavor of an Atom entry
36 *
37 * @category   Zend
38 * @package    Zend_Gdata
39 * @subpackage YouTube
40 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license    http://framework.zend.com/license/new-bsd     New BSD License
42 */
43class Zend_Gdata_YouTube_PlaylistVideoEntry extends Zend_Gdata_YouTube_VideoEntry
44{
45
46    protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistVideoEntry';
47
48    /**
49     * Position of the entry in the feed, as specified by the user
50     *
51     * @var Zend_Gdata_YouTube_Extension_Position
52     */
53    protected $_position = null;
54
55    /**
56     * Creates a Playlist video entry, representing an individual video
57     * in a list of videos contained within a specific playlist
58     *
59     * @param DOMElement $element (optional) DOMElement from which this
60     *          object should be constructed.
61     */
62    public function __construct($element = null)
63    {
64        $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
65        parent::__construct($element);
66    }
67
68    /**
69     * Retrieves a DOMElement which corresponds to this element and all
70     * child properties.  This is used to build an entry back into a DOM
71     * and eventually XML text for sending to the server upon updates, or
72     * for application storage/persistence.
73     *
74     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
75     * @return DOMElement The DOMElement representing this element and all
76     * child properties.
77     */
78    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
79    {
80        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
81        if ($this->_position !== null) {
82            $element->appendChild($this->_position->getDOM($element->ownerDocument));
83        }
84        return $element;
85    }
86
87    /**
88     * Creates individual Entry objects of the appropriate type and
89     * stores them in the $_entry array based upon DOM data.
90     *
91     * @param DOMNode $child The DOMNode to process
92     */
93    protected function takeChildFromDOM($child)
94    {
95        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
96        switch ($absoluteNodeName) {
97        case $this->lookupNamespace('yt') . ':' . 'position':
98            $position = new Zend_Gdata_YouTube_Extension_Position();
99            $position->transferFromDOM($child);
100            $this->_position = $position;
101            break;
102        default:
103            parent::takeChildFromDOM($child);
104            break;
105        }
106    }
107
108
109    /**
110     * Sets the array of embedded feeds related to the video
111     *
112     * @param Zend_Gdata_YouTube_Extension_Position $position
113     *     The position of the entry in the feed, as specified by the user.
114     * @return Zend_Gdata_YouTube_PlaylistVideoEntry Provides a fluent interface
115     */
116    public function setPosition($position = null)
117    {
118        $this->_position = $position;
119        return $this;
120    }
121
122    /**
123     * Returns the position of the entry in the feed, as specified by the user
124     *
125     * @return Zend_Gdata_YouTube_Extension_Position The position
126     */
127    public function getPosition()
128    {
129        return $this->_position;
130    }
131
132}
Note: See TracBrowser for help on using the repository browser.