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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 4.5 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 Gdata
19 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 */
22
23/**
24 * @see Zend_Gdata_Extension
25 */
26require_once 'Zend/Gdata/Extension.php';
27
28/**
29 * @see Zend_Gdata_Feed
30 */
31require_once 'Zend/Gdata/Feed.php';
32
33/**
34 * Represents the gd:feedLink element
35 *
36 * @category Zend
37 * @package Zend_Gdata
38 * @subpackage Gdata
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_Extension_FeedLink extends Zend_Gdata_Extension
43{
44
45 protected $_rootElement = 'feedLink';
46 protected $_countHint = null;
47 protected $_href = null;
48 protected $_readOnly = null;
49 protected $_rel = null;
50 protected $_feed = null;
51
52 public function __construct($href = null, $rel = null,
53 $countHint = null, $readOnly = null, $feed = null)
54 {
55 parent::__construct();
56 $this->_countHint = $countHint;
57 $this->_href = $href;
58 $this->_readOnly = $readOnly;
59 $this->_rel = $rel;
60 $this->_feed = $feed;
61 }
62
63 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
64 {
65 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
66 if ($this->_countHint !== null) {
67 $element->setAttribute('countHint', $this->_countHint);
68 }
69 if ($this->_href !== null) {
70 $element->setAttribute('href', $this->_href);
71 }
72 if ($this->_readOnly !== null) {
73 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
74 }
75 if ($this->_rel !== null) {
76 $element->setAttribute('rel', $this->_rel);
77 }
78 if ($this->_feed !== null) {
79 $element->appendChild($this->_feed->getDOM($element->ownerDocument));
80 }
81 return $element;
82 }
83
84 protected function takeChildFromDOM($child)
85 {
86 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
87 switch ($absoluteNodeName) {
88 case $this->lookupNamespace('atom') . ':' . 'feed';
89 $feed = new Zend_Gdata_Feed();
90 $feed->transferFromDOM($child);
91 $this->_feed = $feed;
92 break;
93 default:
94 parent::takeChildFromDOM($child);
95 break;
96 }
97 }
98
99 protected function takeAttributeFromDOM($attribute)
100 {
101 switch ($attribute->localName) {
102 case 'countHint':
103 $this->_countHint = $attribute->nodeValue;
104 break;
105 case 'href':
106 $this->_href = $attribute->nodeValue;
107 break;
108 case 'readOnly':
109 if ($attribute->nodeValue == "true") {
110 $this->_readOnly = true;
111 }
112 else if ($attribute->nodeValue == "false") {
113 $this->_readOnly = false;
114 }
115 else {
116 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
117 }
118 break;
119 case 'rel':
120 $this->_rel = $attribute->nodeValue;
121 break;
122 default:
123 parent::takeAttributeFromDOM($attribute);
124 }
125 }
126
127 /**
128 * @return string
129 */
130 public function getHref()
131 {
132 return $this->_href;
133 }
134
135 public function setHref($value)
136 {
137 $this->_href = $value;
138 return $this;
139 }
140
141 public function getReadOnly()
142 {
143 return $this->_readOnly;
144 }
145
146 public function setReadOnly($value)
147 {
148 $this->_readOnly = $value;
149 return $this;
150 }
151
152 public function getRel()
153 {
154 return $this->_rel;
155 }
156
157 public function setRel($value)
158 {
159 $this->_rel = $value;
160 return $this;
161 }
162
163 public function getFeed()
164 {
165 return $this->_feed;
166 }
167
168 public function setFeed($value)
169 {
170 $this->_feed = $value;
171 return $this;
172 }
173
174}
Note: See TracBrowser for help on using the repository browser.