diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-06 09:45:27 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-06 09:45:27 +0100 |
commit | 42c80841c846610be280218d53fcde06b0f0063b (patch) | |
tree | 26f7b26af6ca27ec8d3d7b8579e93cfe8a85be22 /inc/3rdparty/simplepie/SimplePie/Source.php | |
parent | 59cc585271a5f253b15617d97e26a29403a929dc (diff) | |
download | wallabag-42c80841c846610be280218d53fcde06b0f0063b.tar.gz wallabag-42c80841c846610be280218d53fcde06b0f0063b.tar.zst wallabag-42c80841c846610be280218d53fcde06b0f0063b.zip |
[change] we now use Full-Text RSS 3.1, thank you so much @fivefilters
Diffstat (limited to 'inc/3rdparty/simplepie/SimplePie/Source.php')
-rw-r--r-- | inc/3rdparty/simplepie/SimplePie/Source.php | 597 |
1 files changed, 0 insertions, 597 deletions
diff --git a/inc/3rdparty/simplepie/SimplePie/Source.php b/inc/3rdparty/simplepie/SimplePie/Source.php deleted file mode 100644 index a6605c18..00000000 --- a/inc/3rdparty/simplepie/SimplePie/Source.php +++ /dev/null | |||
@@ -1,597 +0,0 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * SimplePie | ||
4 | * | ||
5 | * A PHP-Based RSS and Atom Feed Framework. | ||
6 | * Takes the hard work out of managing a complete RSS/Atom solution. | ||
7 | * | ||
8 | * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without modification, are | ||
12 | * permitted provided that the following conditions are met: | ||
13 | * | ||
14 | * * Redistributions of source code must retain the above copyright notice, this list of | ||
15 | * conditions and the following disclaimer. | ||
16 | * | ||
17 | * * Redistributions in binary form must reproduce the above copyright notice, this list | ||
18 | * of conditions and the following disclaimer in the documentation and/or other materials | ||
19 | * provided with the distribution. | ||
20 | * | ||
21 | * * Neither the name of the SimplePie Team nor the names of its contributors may be used | ||
22 | * to endorse or promote products derived from this software without specific prior | ||
23 | * written permission. | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS | ||
26 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS | ||
28 | * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
32 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
33 | * POSSIBILITY OF SUCH DAMAGE. | ||
34 | * | ||
35 | * @package SimplePie | ||
36 | * @version 1.3-dev | ||
37 | * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue | ||
38 | * @author Ryan Parman | ||
39 | * @author Geoffrey Sneddon | ||
40 | * @author Ryan McCue | ||
41 | * @link http://simplepie.org/ SimplePie | ||
42 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License | ||
43 | * @todo phpDoc comments | ||
44 | */ | ||
45 | |||
46 | |||
47 | class SimplePie_Source | ||
48 | { | ||
49 | var $item; | ||
50 | var $data = array(); | ||
51 | |||
52 | public function __construct($item, $data) | ||
53 | { | ||
54 | $this->item = $item; | ||
55 | $this->data = $data; | ||
56 | } | ||
57 | |||
58 | public function __toString() | ||
59 | { | ||
60 | return md5(serialize($this->data)); | ||
61 | } | ||
62 | |||
63 | public function get_source_tags($namespace, $tag) | ||
64 | { | ||
65 | if (isset($this->data['child'][$namespace][$tag])) | ||
66 | { | ||
67 | return $this->data['child'][$namespace][$tag]; | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | return null; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public function get_base($element = array()) | ||
76 | { | ||
77 | return $this->item->get_base($element); | ||
78 | } | ||
79 | |||
80 | public function sanitize($data, $type, $base = '') | ||
81 | { | ||
82 | return $this->item->sanitize($data, $type, $base); | ||
83 | } | ||
84 | |||
85 | public function get_item() | ||
86 | { | ||
87 | return $this->item; | ||
88 | } | ||
89 | |||
90 | public function get_title() | ||
91 | { | ||
92 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) | ||
93 | { | ||
94 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
95 | } | ||
96 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) | ||
97 | { | ||
98 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
99 | } | ||
100 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) | ||
101 | { | ||
102 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
103 | } | ||
104 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) | ||
105 | { | ||
106 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
107 | } | ||
108 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) | ||
109 | { | ||
110 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
111 | } | ||
112 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) | ||
113 | { | ||
114 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
115 | } | ||
116 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) | ||
117 | { | ||
118 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | return null; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | public function get_category($key = 0) | ||
127 | { | ||
128 | $categories = $this->get_categories(); | ||
129 | if (isset($categories[$key])) | ||
130 | { | ||
131 | return $categories[$key]; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | return null; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | public function get_categories() | ||
140 | { | ||
141 | $categories = array(); | ||
142 | |||
143 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) | ||
144 | { | ||
145 | $term = null; | ||
146 | $scheme = null; | ||
147 | $label = null; | ||
148 | if (isset($category['attribs']['']['term'])) | ||
149 | { | ||
150 | $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
151 | } | ||
152 | if (isset($category['attribs']['']['scheme'])) | ||
153 | { | ||
154 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
155 | } | ||
156 | if (isset($category['attribs']['']['label'])) | ||
157 | { | ||
158 | $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
159 | } | ||
160 | $categories[] = new $this->item->feed->category_class($term, $scheme, $label); | ||
161 | } | ||
162 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) | ||
163 | { | ||
164 | // This is really the label, but keep this as the term also for BC. | ||
165 | // Label will also work on retrieving because that falls back to term. | ||
166 | $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
167 | if (isset($category['attribs']['']['domain'])) | ||
168 | { | ||
169 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
170 | } | ||
171 | else | ||
172 | { | ||
173 | $scheme = null; | ||
174 | } | ||
175 | $categories[] = new $this->item->feed->category_class($term, $scheme, null); | ||
176 | } | ||
177 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) | ||
178 | { | ||
179 | $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); | ||
180 | } | ||
181 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) | ||
182 | { | ||
183 | $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); | ||
184 | } | ||
185 | |||
186 | if (!empty($categories)) | ||
187 | { | ||
188 | return SimplePie_Misc::array_unique($categories); | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | return null; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | public function get_author($key = 0) | ||
197 | { | ||
198 | $authors = $this->get_authors(); | ||
199 | if (isset($authors[$key])) | ||
200 | { | ||
201 | return $authors[$key]; | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | return null; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | public function get_authors() | ||
210 | { | ||
211 | $authors = array(); | ||
212 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) | ||
213 | { | ||
214 | $name = null; | ||
215 | $uri = null; | ||
216 | $email = null; | ||
217 | if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) | ||
218 | { | ||
219 | $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
220 | } | ||
221 | if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) | ||
222 | { | ||
223 | $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); | ||
224 | } | ||
225 | if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) | ||
226 | { | ||
227 | $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
228 | } | ||
229 | if ($name !== null || $email !== null || $uri !== null) | ||
230 | { | ||
231 | $authors[] = new $this->item->feed->author_class($name, $uri, $email); | ||
232 | } | ||
233 | } | ||
234 | if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) | ||
235 | { | ||
236 | $name = null; | ||
237 | $url = null; | ||
238 | $email = null; | ||
239 | if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) | ||
240 | { | ||
241 | $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
242 | } | ||
243 | if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) | ||
244 | { | ||
245 | $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); | ||
246 | } | ||
247 | if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) | ||
248 | { | ||
249 | $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
250 | } | ||
251 | if ($name !== null || $email !== null || $url !== null) | ||
252 | { | ||
253 | $authors[] = new $this->item->feed->author_class($name, $url, $email); | ||
254 | } | ||
255 | } | ||
256 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) | ||
257 | { | ||
258 | $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); | ||
259 | } | ||
260 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) | ||
261 | { | ||
262 | $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); | ||
263 | } | ||
264 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) | ||
265 | { | ||
266 | $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); | ||
267 | } | ||
268 | |||
269 | if (!empty($authors)) | ||
270 | { | ||
271 | return SimplePie_Misc::array_unique($authors); | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | return null; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | public function get_contributor($key = 0) | ||
280 | { | ||
281 | $contributors = $this->get_contributors(); | ||
282 | if (isset($contributors[$key])) | ||
283 | { | ||
284 | return $contributors[$key]; | ||
285 | } | ||
286 | else | ||
287 | { | ||
288 | return null; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | public function get_contributors() | ||
293 | { | ||
294 | $contributors = array(); | ||
295 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) | ||
296 | { | ||
297 | $name = null; | ||
298 | $uri = null; | ||
299 | $email = null; | ||
300 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) | ||
301 | { | ||
302 | $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
303 | } | ||
304 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) | ||
305 | { | ||
306 | $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); | ||
307 | } | ||
308 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) | ||
309 | { | ||
310 | $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
311 | } | ||
312 | if ($name !== null || $email !== null || $uri !== null) | ||
313 | { | ||
314 | $contributors[] = new $this->item->feed->author_class($name, $uri, $email); | ||
315 | } | ||
316 | } | ||
317 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) | ||
318 | { | ||
319 | $name = null; | ||
320 | $url = null; | ||
321 | $email = null; | ||
322 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) | ||
323 | { | ||
324 | $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
325 | } | ||
326 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) | ||
327 | { | ||
328 | $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); | ||
329 | } | ||
330 | if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) | ||
331 | { | ||
332 | $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
333 | } | ||
334 | if ($name !== null || $email !== null || $url !== null) | ||
335 | { | ||
336 | $contributors[] = new $this->item->feed->author_class($name, $url, $email); | ||
337 | } | ||
338 | } | ||
339 | |||
340 | if (!empty($contributors)) | ||
341 | { | ||
342 | return SimplePie_Misc::array_unique($contributors); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | return null; | ||
347 | } | ||
348 | } | ||
349 | |||
350 | public function get_link($key = 0, $rel = 'alternate') | ||
351 | { | ||
352 | $links = $this->get_links($rel); | ||
353 | if (isset($links[$key])) | ||
354 | { | ||
355 | return $links[$key]; | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | return null; | ||
360 | } | ||
361 | } | ||
362 | |||
363 | /** | ||
364 | * Added for parity between the parent-level and the item/entry-level. | ||
365 | */ | ||
366 | public function get_permalink() | ||
367 | { | ||
368 | return $this->get_link(0); | ||
369 | } | ||
370 | |||
371 | public function get_links($rel = 'alternate') | ||
372 | { | ||
373 | if (!isset($this->data['links'])) | ||
374 | { | ||
375 | $this->data['links'] = array(); | ||
376 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) | ||
377 | { | ||
378 | foreach ($links as $link) | ||
379 | { | ||
380 | if (isset($link['attribs']['']['href'])) | ||
381 | { | ||
382 | $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; | ||
383 | $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) | ||
388 | { | ||
389 | foreach ($links as $link) | ||
390 | { | ||
391 | if (isset($link['attribs']['']['href'])) | ||
392 | { | ||
393 | $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; | ||
394 | $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); | ||
395 | |||
396 | } | ||
397 | } | ||
398 | } | ||
399 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) | ||
400 | { | ||
401 | $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); | ||
402 | } | ||
403 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) | ||
404 | { | ||
405 | $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); | ||
406 | } | ||
407 | if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) | ||
408 | { | ||
409 | $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); | ||
410 | } | ||
411 | |||
412 | $keys = array_keys($this->data['links']); | ||
413 | foreach ($keys as $key) | ||
414 | { | ||
415 | if (SimplePie_Misc::is_isegment_nz_nc($key)) | ||
416 | { | ||
417 | if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) | ||
418 | { | ||
419 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); | ||
420 | $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; | ||
425 | } | ||
426 | } | ||
427 | elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) | ||
428 | { | ||
429 | $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; | ||
430 | } | ||
431 | $this->data['links'][$key] = array_unique($this->data['links'][$key]); | ||
432 | } | ||
433 | } | ||
434 | |||
435 | if (isset($this->data['links'][$rel])) | ||
436 | { | ||
437 | return $this->data['links'][$rel]; | ||
438 | } | ||
439 | else | ||
440 | { | ||
441 | return null; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | public function get_description() | ||
446 | { | ||
447 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) | ||
448 | { | ||
449 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
450 | } | ||
451 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) | ||
452 | { | ||
453 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
454 | } | ||
455 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) | ||
456 | { | ||
457 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
458 | } | ||
459 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) | ||
460 | { | ||
461 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
462 | } | ||
463 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) | ||
464 | { | ||
465 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); | ||
466 | } | ||
467 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) | ||
468 | { | ||
469 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
470 | } | ||
471 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) | ||
472 | { | ||
473 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
474 | } | ||
475 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) | ||
476 | { | ||
477 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); | ||
478 | } | ||
479 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) | ||
480 | { | ||
481 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | return null; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | public function get_copyright() | ||
490 | { | ||
491 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) | ||
492 | { | ||
493 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
494 | } | ||
495 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) | ||
496 | { | ||
497 | return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); | ||
498 | } | ||
499 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) | ||
500 | { | ||
501 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
502 | } | ||
503 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) | ||
504 | { | ||
505 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
506 | } | ||
507 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) | ||
508 | { | ||
509 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
510 | } | ||
511 | else | ||
512 | { | ||
513 | return null; | ||
514 | } | ||
515 | } | ||
516 | |||
517 | public function get_language() | ||
518 | { | ||
519 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) | ||
520 | { | ||
521 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
522 | } | ||
523 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) | ||
524 | { | ||
525 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
526 | } | ||
527 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) | ||
528 | { | ||
529 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
530 | } | ||
531 | elseif (isset($this->data['xml_lang'])) | ||
532 | { | ||
533 | return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); | ||
534 | } | ||
535 | else | ||
536 | { | ||
537 | return null; | ||
538 | } | ||
539 | } | ||
540 | |||
541 | public function get_latitude() | ||
542 | { | ||
543 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) | ||
544 | { | ||
545 | return (float) $return[0]['data']; | ||
546 | } | ||
547 | elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) | ||
548 | { | ||
549 | return (float) $match[1]; | ||
550 | } | ||
551 | else | ||
552 | { | ||
553 | return null; | ||
554 | } | ||
555 | } | ||
556 | |||
557 | public function get_longitude() | ||
558 | { | ||
559 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) | ||
560 | { | ||
561 | return (float) $return[0]['data']; | ||
562 | } | ||
563 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) | ||
564 | { | ||
565 | return (float) $return[0]['data']; | ||
566 | } | ||
567 | elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) | ||
568 | { | ||
569 | return (float) $match[2]; | ||
570 | } | ||
571 | else | ||
572 | { | ||
573 | return null; | ||
574 | } | ||
575 | } | ||
576 | |||
577 | public function get_image_url() | ||
578 | { | ||
579 | if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) | ||
580 | { | ||
581 | return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); | ||
582 | } | ||
583 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) | ||
584 | { | ||
585 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); | ||
586 | } | ||
587 | elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) | ||
588 | { | ||
589 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); | ||
590 | } | ||
591 | else | ||
592 | { | ||
593 | return null; | ||
594 | } | ||
595 | } | ||
596 | } | ||
597 | |||