]> git.wh0rd.org - tt-rss.git/blame - classes/feeditem/rss.php
try to force-convert feed data to utf8
[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 }
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() {
99b82567 38 $content = $this->xpath->query("content:encoded", $this->elem)->item(0);
04d2f9c8
AD
39
40 if ($content) {
41 return $content->nodeValue;
42 }
8a95d630 43
99b82567 44 $content = $this->elem->getElementsByTagName("description")->item(0);
8a95d630
AD
45
46 if ($content) {
47 return $content->nodeValue;
48 }
04d2f9c8
AD
49 }
50
51 function get_description() {
52 $summary = $this->elem->getElementsByTagName("description")->item(0);
53
54 if ($summary) {
55 return $summary->nodeValue;
56 }
57 }
58
04d2f9c8
AD
59 function get_categories() {
60 $categories = $this->elem->getElementsByTagName("category");
61 $cats = array();
62
63 foreach ($categories as $cat) {
64 array_push($cats, $cat->nodeValue);
65 }
66
d4992d6b
AD
67 $categories = $this->xpath->query("dc:subject", $this->elem);
68
69 foreach ($categories as $cat) {
70 array_push($cats, $cat->nodeValue);
71 }
72
04d2f9c8
AD
73 return $cats;
74 }
75
76 function get_enclosures() {
77 $enclosures = $this->elem->getElementsByTagName("enclosure");
78
79 $encs = array();
80
81 foreach ($enclosures as $enclosure) {
82 $enc = new FeedEnclosure();
83
84 $enc->type = $enclosure->getAttribute("type");
85 $enc->link = $enclosure->getAttribute("url");
86 $enc->length = $enclosure->getAttribute("length");
87
88 array_push($encs, $enc);
89 }
90
4c00e15b
AD
91 $enclosures = $this->xpath->query("media:content", $this->elem);
92
4c00e15b
AD
93 foreach ($enclosures as $enclosure) {
94 $enc = new FeedEnclosure();
95
96 $enc->type = $enclosure->getAttribute("type");
97 $enc->link = $enclosure->getAttribute("url");
98 $enc->length = $enclosure->getAttribute("length");
99
100 array_push($encs, $enc);
101 }
102
04d2f9c8
AD
103 return $encs;
104 }
105
04d2f9c8
AD
106}
107?>