]>
git.wh0rd.org - tt-rss.git/blob - classes/feeditem/rss.php
e5960243cf2b723195981bae471d38a5cd9b66c4
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
);
20 $date = $this->xpath
->query("dc:date", $this->elem
)->item(0);
23 return strtotime($date->nodeValue
);
28 $links = $this->xpath
->query("atom:link", $this->elem
);
30 foreach ($links as $link) {
31 if ($link && $link->hasAttribute("href") &&
32 (!$link->hasAttribute("rel")
33 ||
$link->getAttribute("rel") == "alternate"
34 ||
$link->getAttribute("rel") == "standout")) {
36 return $link->getAttribute("href");
40 $link = $this->elem
->getElementsByTagName("guid")->item(0);
42 if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") {
43 return $link->nodeValue
;
46 $link = $this->elem
->getElementsByTagName("link")->item(0);
49 return $link->nodeValue
;
53 function get_title() {
54 $title = $this->elem
->getElementsByTagName("title")->item(0);
57 return $title->nodeValue
;
61 function get_content() {
62 $content = $this->xpath
->query("content:encoded", $this->elem
)->item(0);
65 return $content->nodeValue
;
68 $content = $this->elem
->getElementsByTagName("description")->item(0);
71 return $content->nodeValue
;
75 function get_description() {
76 $summary = $this->elem
->getElementsByTagName("description")->item(0);
79 return $summary->nodeValue
;
83 function get_categories() {
84 $categories = $this->elem
->getElementsByTagName("category");
87 foreach ($categories as $cat) {
88 array_push($cats, $cat->nodeValue
);
91 $categories = $this->xpath
->query("dc:subject", $this->elem
);
93 foreach ($categories as $cat) {
94 array_push($cats, $cat->nodeValue
);
100 function get_enclosures() {
101 $enclosures = $this->elem
->getElementsByTagName("enclosure");
105 foreach ($enclosures as $enclosure) {
106 $enc = new FeedEnclosure();
108 $enc->type
= $enclosure->getAttribute("type");
109 $enc->link
= $enclosure->getAttribute("url");
110 $enc->length
= $enclosure->getAttribute("length");
112 array_push($encs, $enc);
115 $enclosures = $this->xpath
->query("media:content", $this->elem
);
117 foreach ($enclosures as $enclosure) {
118 $enc = new FeedEnclosure();
120 $enc->type
= $enclosure->getAttribute("type");
121 $enc->link
= $enclosure->getAttribute("url");
122 $enc->length
= $enclosure->getAttribute("length");
124 array_push($encs, $enc);