source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/YouTube/Extension/Link.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 4.1 KB
Line 
1<?php
2/**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Gdata
17 * @subpackage YouTube
18 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22/**
23 * @see Zend_Gdata_App_Extension_Link
24 */
25require_once 'Zend/Gdata/App/Extension/Link.php';
26
27/**
28 * @see Zend_Gdata_YouTube_Extension_Token
29 */
30require_once 'Zend/Gdata/YouTube/Extension/Token.php';
31
32
33/**
34 * Specialized Link class for use with YouTube. Enables use of yt extension elements.
35 *
36 * @category Zend
37 * @package Zend_Gdata
38 * @subpackage YouTube
39 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license http://framework.zend.com/license/new-bsd New BSD License
41 */
42class Zend_Gdata_YouTube_Extension_Link extends Zend_Gdata_App_Extension_Link
43{
44
45 protected $_token = null;
46
47 /**
48 * Constructs a new Zend_Gdata_Calendar_Extension_Link object.
49 * @see Zend_Gdata_App_Extension_Link#__construct
50 * @param Zend_Gdata_YouTube_Extension_Token $token
51 */
52 public function __construct($href = null, $rel = null, $type = null,
53 $hrefLang = null, $title = null, $length = null, $token = null)
54 {
55 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
56 parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
57 $this->_token = $token;
58 }
59
60 /**
61 * Retrieves a DOMElement which corresponds to this element and all
62 * child properties. This is used to build an entry back into a DOM
63 * and eventually XML text for sending to the server upon updates, or
64 * for application storage/persistence.
65 *
66 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
67 * @return DOMElement The DOMElement representing this element and all
68 * child properties.
69 */
70 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
71 {
72 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
73 if ($this->_token != null) {
74 $element->appendChild($this->_token->getDOM($element->ownerDocument));
75 }
76 return $element;
77 }
78
79 /**
80 * Creates individual Entry objects of the appropriate type and
81 * stores them as members of this entry based upon DOM data.
82 *
83 * @param DOMNode $child The DOMNode to process
84 */
85 protected function takeChildFromDOM($child)
86 {
87 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
88 switch ($absoluteNodeName) {
89 case $this->lookupNamespace('yt') . ':' . 'token':
90 $token = new Zend_Gdata_YouTube_Extension_Token();
91 $token->transferFromDOM($child);
92 $this->_token = $token;
93 break;
94 default:
95 parent::takeChildFromDOM($child);
96 break;
97 }
98 }
99
100 /**
101 * Get the value for this element's token attribute.
102 *
103 * @return Zend_Gdata_YouTube_Extension_Token The token element.
104 */
105 public function getToken()
106 {
107 return $this->_token;
108 }
109
110 /**
111 * Set the value for this element's token attribute.
112 *
113 * @param Zend_Gdata_YouTube_Extension_Token $value The desired value for this attribute.
114 * @return Zend_YouTube_Extension_Link The element being modified.
115 */
116 public function setToken($value)
117 {
118 $this->_token = $value;
119 return $this;
120 }
121
122 /**
123 * Get the value of this element's token attribute.
124 *
125 * @return string The token's text value
126 */
127 public function getTokenValue()
128 {
129 return $this->getToken()->getText();
130 }
131
132}
Note: See TracBrowser for help on using the repository browser.