]> git.wh0rd.org - tt-rss.git/blame - classes/feeditem/rss.php
fix atom:link not supported in rss feeds (fucking fuck)
[tt-rss.git] / classes / feeditem / rss.php
CommitLineData
04d2f9c8 1<?php
b4d16900 2class FeedItem_RSS extends FeedItem_Common {
04d2f9c8 3 function get_id() {
b09a4cdc
AD
4 $id = $this->elem->getElementsByTagName("guid")->item(0);
5
6 if ($id) {
7 return $id->nodeValue;
8 } else {
9 return $this->get_link();
10 }
04d2f9c8
AD
11 }
12
13 function get_date() {
14 $pubDate = $this->elem->getElementsByTagName("pubDate")->item(0);
15
16 if ($pubDate) {
17 return strtotime($pubDate->nodeValue);
18 }
19 }
20
21 function get_link() {
22 $link = $this->elem->getElementsByTagName("link")->item(0);
23
24 if ($link) {
25 return $link->nodeValue;
26 }
f7d64d03
AD
27
28 $link = $this->xpath->query("atom:link", $this->elem)->item(0);
29
30 if ($link) {
31 return $link->nodeValue;
32 }
33
04d2f9c8
AD
34 }
35
36 function get_title() {
37 $title = $this->elem->getElementsByTagName("title")->item(0);
38
39 if ($title) {
40 return $title->nodeValue;
41 }
42 }
43
44 function get_content() {
99b82567 45 $content = $this->xpath->query("content:encoded", $this->elem)->item(0);
04d2f9c8
AD
46
47 if ($content) {
48 return $content->nodeValue;
49 }
8a95d630 50
99b82567 51 $content = $this->elem->getElementsByTagName("description")->item(0);
8a95d630
AD
52
53 if ($content) {
54 return $content->nodeValue;
55 }
04d2f9c8
AD
56 }
57
58 function get_description() {
59 $summary = $this->elem->getElementsByTagName("description")->item(0);
60
61 if ($summary) {
62 return $summary->nodeValue;
63 }
64 }
65
04d2f9c8
AD
66 function get_categories() {
67 $categories = $this->elem->getElementsByTagName("category");
68 $cats = array();
69
70 foreach ($categories as $cat) {
71 array_push($cats, $cat->nodeValue);
72 }
73
d4992d6b
AD
74 $categories = $this->xpath->query("dc:subject", $this->elem);
75
76 foreach ($categories as $cat) {
77 array_push($cats, $cat->nodeValue);
78 }
79
04d2f9c8
AD
80 return $cats;
81 }
82
83 function get_enclosures() {
84 $enclosures = $this->elem->getElementsByTagName("enclosure");
85
86 $encs = array();
87
88 foreach ($enclosures as $enclosure) {
89 $enc = new FeedEnclosure();
90
91 $enc->type = $enclosure->getAttribute("type");
92 $enc->link = $enclosure->getAttribute("url");
93 $enc->length = $enclosure->getAttribute("length");
94
95 array_push($encs, $enc);
96 }
97
4c00e15b
AD
98 $enclosures = $this->xpath->query("media:content", $this->elem);
99
4c00e15b
AD
100 foreach ($enclosures as $enclosure) {
101 $enc = new FeedEnclosure();
102
103 $enc->type = $enclosure->getAttribute("type");
104 $enc->link = $enclosure->getAttribute("url");
105 $enc->length = $enclosure->getAttribute("length");
106
107 array_push($encs, $enc);
108 }
109
04d2f9c8
AD
110 return $encs;
111 }
112
04d2f9c8
AD
113}
114?>