]>
git.wh0rd.org - tt-rss.git/blob - classes/feeditem/rss.php
2 class FeedItem_RSS
extends FeedItem_Common
{
4 $id = $this->elem
->getElementsByTagName("guid")->item(0);
9 return $this->get_link();
14 $pubDate = $this->elem
->getElementsByTagName("pubDate")->item(0);
17 return strtotime($pubDate->nodeValue
);
22 $links = $this->xpath
->query("atom:link", $this->elem
);
24 foreach ($links as $link) {
25 if ($link && $link->hasAttribute("href") &&
26 (!$link->hasAttribute("rel")
27 ||
$link->getAttribute("rel") == "alternate"
28 ||
$link->getAttribute("rel") == "standout")) {
30 return $link->getAttribute("href");
34 $link = $this->elem
->getElementsByTagName("guid")->item(0);
36 if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") {
37 return $link->nodeValue
;
40 $link = $this->elem
->getElementsByTagName("link")->item(0);
43 return $link->nodeValue
;
47 function get_title() {
48 $title = $this->elem
->getElementsByTagName("title")->item(0);
51 return $title->nodeValue
;
55 function get_content() {
56 $content = $this->xpath
->query("content:encoded", $this->elem
)->item(0);
59 return $content->nodeValue
;
62 $content = $this->elem
->getElementsByTagName("description")->item(0);
65 return $content->nodeValue
;
69 function get_description() {
70 $summary = $this->elem
->getElementsByTagName("description")->item(0);
73 return $summary->nodeValue
;
77 function get_categories() {
78 $categories = $this->elem
->getElementsByTagName("category");
81 foreach ($categories as $cat) {
82 array_push($cats, $cat->nodeValue
);
85 $categories = $this->xpath
->query("dc:subject", $this->elem
);
87 foreach ($categories as $cat) {
88 array_push($cats, $cat->nodeValue
);
94 function get_enclosures() {
95 $enclosures = $this->elem
->getElementsByTagName("enclosure");
99 foreach ($enclosures as $enclosure) {
100 $enc = new FeedEnclosure();
102 $enc->type
= $enclosure->getAttribute("type");
103 $enc->link
= $enclosure->getAttribute("url");
104 $enc->length
= $enclosure->getAttribute("length");
106 array_push($encs, $enc);
109 $enclosures = $this->xpath
->query("media:content", $this->elem
);
111 foreach ($enclosures as $enclosure) {
112 $enc = new FeedEnclosure();
114 $enc->type
= $enclosure->getAttribute("type");
115 $enc->link
= $enclosure->getAttribute("url");
116 $enc->length
= $enclosure->getAttribute("length");
118 array_push($encs, $enc);