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 App
|
---|
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 | */
|
---|
26 | require_once 'Zend/Gdata/Extension.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Data model for representing an atom:link element
|
---|
30 | *
|
---|
31 | * @category Zend
|
---|
32 | * @package Zend_Gdata
|
---|
33 | * @subpackage App
|
---|
34 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
35 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
36 | */
|
---|
37 | class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
|
---|
38 | {
|
---|
39 |
|
---|
40 | protected $_rootElement = 'link';
|
---|
41 | protected $_href = null;
|
---|
42 | protected $_rel = null;
|
---|
43 | protected $_type = null;
|
---|
44 | protected $_hrefLang = null;
|
---|
45 | protected $_title = null;
|
---|
46 | protected $_length = null;
|
---|
47 |
|
---|
48 | public function __construct($href = null, $rel = null, $type = null,
|
---|
49 | $hrefLang = null, $title = null, $length = null)
|
---|
50 | {
|
---|
51 | parent::__construct();
|
---|
52 | $this->_href = $href;
|
---|
53 | $this->_rel = $rel;
|
---|
54 | $this->_type = $type;
|
---|
55 | $this->_hrefLang = $hrefLang;
|
---|
56 | $this->_title = $title;
|
---|
57 | $this->_length = $length;
|
---|
58 | }
|
---|
59 |
|
---|
60 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
61 | {
|
---|
62 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
63 | if ($this->_href !== null) {
|
---|
64 | $element->setAttribute('href', $this->_href);
|
---|
65 | }
|
---|
66 | if ($this->_rel !== null) {
|
---|
67 | $element->setAttribute('rel', $this->_rel);
|
---|
68 | }
|
---|
69 | if ($this->_type !== null) {
|
---|
70 | $element->setAttribute('type', $this->_type);
|
---|
71 | }
|
---|
72 | if ($this->_hrefLang !== null) {
|
---|
73 | $element->setAttribute('hreflang', $this->_hrefLang);
|
---|
74 | }
|
---|
75 | if ($this->_title !== null) {
|
---|
76 | $element->setAttribute('title', $this->_title);
|
---|
77 | }
|
---|
78 | if ($this->_length !== null) {
|
---|
79 | $element->setAttribute('length', $this->_length);
|
---|
80 | }
|
---|
81 | return $element;
|
---|
82 | }
|
---|
83 |
|
---|
84 | protected function takeAttributeFromDOM($attribute)
|
---|
85 | {
|
---|
86 | switch ($attribute->localName) {
|
---|
87 | case 'href':
|
---|
88 | $this->_href = $attribute->nodeValue;
|
---|
89 | break;
|
---|
90 | case 'rel':
|
---|
91 | $this->_rel = $attribute->nodeValue;
|
---|
92 | break;
|
---|
93 | case 'type':
|
---|
94 | $this->_type = $attribute->nodeValue;
|
---|
95 | break;
|
---|
96 | case 'hreflang':
|
---|
97 | $this->_hrefLang = $attribute->nodeValue;
|
---|
98 | break;
|
---|
99 | case 'title':
|
---|
100 | $this->_title = $attribute->nodeValue;
|
---|
101 | break;
|
---|
102 | case 'length':
|
---|
103 | $this->_length = $attribute->nodeValue;
|
---|
104 | break;
|
---|
105 | default:
|
---|
106 | parent::takeAttributeFromDOM($attribute);
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * @return string|null
|
---|
112 | */
|
---|
113 | public function getHref()
|
---|
114 | {
|
---|
115 | return $this->_href;
|
---|
116 | }
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * @param string|null $value
|
---|
120 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
121 | */
|
---|
122 | public function setHref($value)
|
---|
123 | {
|
---|
124 | $this->_href = $value;
|
---|
125 | return $this;
|
---|
126 | }
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * @return string|null
|
---|
130 | */
|
---|
131 | public function getRel()
|
---|
132 | {
|
---|
133 | return $this->_rel;
|
---|
134 | }
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * @param string|null $value
|
---|
138 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
139 | */
|
---|
140 | public function setRel($value)
|
---|
141 | {
|
---|
142 | $this->_rel = $value;
|
---|
143 | return $this;
|
---|
144 | }
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * @return string|null
|
---|
148 | */
|
---|
149 | public function getType()
|
---|
150 | {
|
---|
151 | return $this->_type;
|
---|
152 | }
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * @param string|null $value
|
---|
156 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
157 | */
|
---|
158 | public function setType($value)
|
---|
159 | {
|
---|
160 | $this->_type = $value;
|
---|
161 | return $this;
|
---|
162 | }
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * @return string|null
|
---|
166 | */
|
---|
167 | public function getHrefLang()
|
---|
168 | {
|
---|
169 | return $this->_hrefLang;
|
---|
170 | }
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * @param string|null $value
|
---|
174 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
175 | */
|
---|
176 | public function setHrefLang($value)
|
---|
177 | {
|
---|
178 | $this->_hrefLang = $value;
|
---|
179 | return $this;
|
---|
180 | }
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * @return string|null
|
---|
184 | */
|
---|
185 | public function getTitle()
|
---|
186 | {
|
---|
187 | return $this->_title;
|
---|
188 | }
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * @param string|null $value
|
---|
192 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
193 | */
|
---|
194 | public function setTitle($value)
|
---|
195 | {
|
---|
196 | $this->_title = $value;
|
---|
197 | return $this;
|
---|
198 | }
|
---|
199 |
|
---|
200 | /**
|
---|
201 | * @return string|null
|
---|
202 | */
|
---|
203 | public function getLength()
|
---|
204 | {
|
---|
205 | return $this->_length;
|
---|
206 | }
|
---|
207 |
|
---|
208 | /**
|
---|
209 | * @param string|null $value
|
---|
210 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
211 | */
|
---|
212 | public function setLength($value)
|
---|
213 | {
|
---|
214 | $this->_length = $value;
|
---|
215 | return $this;
|
---|
216 | }
|
---|
217 |
|
---|
218 | }
|
---|