]> git.wh0rd.org - tt-rss.git/blob - classes/feeditem/rss.php
fix rss content:encoded not used
[tt-rss.git] / classes / feeditem / rss.php
1 <?php
2 class FeedItem_RSS extends FeedItem_Common {
3 function get_id() {
4 $id = $this->elem->getElementsByTagName("guid")->item(0);
5
6 if ($id) {
7 return $id->nodeValue;
8 } else {
9 return $this->get_link();
10 }
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 }
27 }
28
29 function get_title() {
30 $title = $this->elem->getElementsByTagName("title")->item(0);
31
32 if ($title) {
33 return $title->nodeValue;
34 }
35 }
36
37 function get_content() {
38 $content = $this->elem->getElementsByTagName("description")->item(0);
39
40 if ($content) {
41 return $content->nodeValue;
42 }
43
44 $content = $this->xpath->query("content:encoded", $this->elem)->item(0);
45
46 if ($content) {
47 return $content->nodeValue;
48 }
49
50 }
51
52 function get_description() {
53 $summary = $this->elem->getElementsByTagName("description")->item(0);
54
55 if ($summary) {
56 return $summary->nodeValue;
57 }
58 }
59
60 function get_categories() {
61 $categories = $this->elem->getElementsByTagName("category");
62 $cats = array();
63
64 foreach ($categories as $cat) {
65 array_push($cats, $cat->nodeValue);
66 }
67
68 $categories = $this->xpath->query("dc:subject", $this->elem);
69
70 foreach ($categories as $cat) {
71 array_push($cats, $cat->nodeValue);
72 }
73
74 return $cats;
75 }
76
77 function get_enclosures() {
78 $enclosures = $this->elem->getElementsByTagName("enclosure");
79
80 $encs = array();
81
82 foreach ($enclosures as $enclosure) {
83 $enc = new FeedEnclosure();
84
85 $enc->type = $enclosure->getAttribute("type");
86 $enc->link = $enclosure->getAttribute("url");
87 $enc->length = $enclosure->getAttribute("length");
88
89 array_push($encs, $enc);
90 }
91
92 $enclosures = $this->xpath->query("media:content", $this->elem);
93
94 foreach ($enclosures as $enclosure) {
95 $enc = new FeedEnclosure();
96
97 $enc->type = $enclosure->getAttribute("type");
98 $enc->link = $enclosure->getAttribute("url");
99 $enc->length = $enclosure->getAttribute("length");
100
101 array_push($encs, $enc);
102 }
103
104 return $encs;
105 }
106
107 }
108 ?>