]>
Commit | Line | Data |
---|---|---|
04d2f9c8 | 1 | <?php |
b4d16900 | 2 | class 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() { | |
2f6b75d5 | 22 | $link = $this->xpath->query("atom:link", $this->elem)->item(0); |
04d2f9c8 AD |
23 | |
24 | if ($link) { | |
2f6b75d5 | 25 | return $link->getAttribute("href"); |
04d2f9c8 | 26 | } |
f7d64d03 | 27 | |
2f6b75d5 | 28 | $link = $this->elem->getElementsByTagName("link")->item(0); |
f7d64d03 AD |
29 | |
30 | if ($link) { | |
31 | return $link->nodeValue; | |
32 | } | |
04d2f9c8 AD |
33 | } |
34 | ||
35 | function get_title() { | |
36 | $title = $this->elem->getElementsByTagName("title")->item(0); | |
37 | ||
38 | if ($title) { | |
39 | return $title->nodeValue; | |
40 | } | |
41 | } | |
42 | ||
43 | function get_content() { | |
99b82567 | 44 | $content = $this->xpath->query("content:encoded", $this->elem)->item(0); |
04d2f9c8 AD |
45 | |
46 | if ($content) { | |
47 | return $content->nodeValue; | |
48 | } | |
8a95d630 | 49 | |
99b82567 | 50 | $content = $this->elem->getElementsByTagName("description")->item(0); |
8a95d630 AD |
51 | |
52 | if ($content) { | |
53 | return $content->nodeValue; | |
54 | } | |
04d2f9c8 AD |
55 | } |
56 | ||
57 | function get_description() { | |
58 | $summary = $this->elem->getElementsByTagName("description")->item(0); | |
59 | ||
60 | if ($summary) { | |
61 | return $summary->nodeValue; | |
62 | } | |
63 | } | |
64 | ||
04d2f9c8 AD |
65 | function get_categories() { |
66 | $categories = $this->elem->getElementsByTagName("category"); | |
67 | $cats = array(); | |
68 | ||
69 | foreach ($categories as $cat) { | |
70 | array_push($cats, $cat->nodeValue); | |
71 | } | |
72 | ||
d4992d6b AD |
73 | $categories = $this->xpath->query("dc:subject", $this->elem); |
74 | ||
75 | foreach ($categories as $cat) { | |
76 | array_push($cats, $cat->nodeValue); | |
77 | } | |
78 | ||
04d2f9c8 AD |
79 | return $cats; |
80 | } | |
81 | ||
82 | function get_enclosures() { | |
83 | $enclosures = $this->elem->getElementsByTagName("enclosure"); | |
84 | ||
85 | $encs = array(); | |
86 | ||
87 | foreach ($enclosures as $enclosure) { | |
88 | $enc = new FeedEnclosure(); | |
89 | ||
90 | $enc->type = $enclosure->getAttribute("type"); | |
91 | $enc->link = $enclosure->getAttribute("url"); | |
92 | $enc->length = $enclosure->getAttribute("length"); | |
93 | ||
94 | array_push($encs, $enc); | |
95 | } | |
96 | ||
4c00e15b AD |
97 | $enclosures = $this->xpath->query("media:content", $this->elem); |
98 | ||
4c00e15b AD |
99 | foreach ($enclosures as $enclosure) { |
100 | $enc = new FeedEnclosure(); | |
101 | ||
102 | $enc->type = $enclosure->getAttribute("type"); | |
103 | $enc->link = $enclosure->getAttribute("url"); | |
104 | $enc->length = $enclosure->getAttribute("length"); | |
105 | ||
106 | array_push($encs, $enc); | |
107 | } | |
108 | ||
04d2f9c8 AD |
109 | return $encs; |
110 | } | |
111 | ||
04d2f9c8 AD |
112 | } |
113 | ?> |