]>
git.wh0rd.org - tt-rss.git/blob - classes/feeditem/rss.php
6 function __construct($elem, $doc, $xpath) {
12 $id = $this->elem
->getElementsByTagName("guid")->item(0);
15 return $id->nodeValue
;
17 return $this->get_link();
22 $pubDate = $this->elem
->getElementsByTagName("pubDate")->item(0);
25 return strtotime($pubDate->nodeValue
);
30 $link = $this->elem
->getElementsByTagName("link")->item(0);
33 return $link->nodeValue
;
37 function get_title() {
38 $title = $this->elem
->getElementsByTagName("title")->item(0);
41 return $title->nodeValue
;
45 function get_content() {
46 $content = $this->elem
->getElementsByTagName("description")->item(0);
49 return $content->nodeValue
;
53 function get_description() {
54 $summary = $this->elem
->getElementsByTagName("description")->item(0);
57 return $summary->nodeValue
;
62 function get_comments_url() {
66 function get_comments_count() {
67 $comments = $this->xpath
->query("slash:comments", $this->elem
)->item(0);
70 return $comments->nodeValue
;
74 function get_categories() {
75 $categories = $this->elem
->getElementsByTagName("category");
78 foreach ($categories as $cat) {
79 array_push($cats, $cat->nodeValue
);
82 $categories = $this->xpath
->query("dc:subject", $this->elem
);
84 foreach ($categories as $cat) {
85 array_push($cats, $cat->nodeValue
);
91 function get_enclosures() {
92 $enclosures = $this->elem
->getElementsByTagName("enclosure");
96 foreach ($enclosures as $enclosure) {
97 $enc = new FeedEnclosure();
99 $enc->type
= $enclosure->getAttribute("type");
100 $enc->link
= $enclosure->getAttribute("url");
101 $enc->length
= $enclosure->getAttribute("length");
103 array_push($encs, $enc);
106 $enclosures = $this->xpath
->query("media:content", $this->elem
);
108 foreach ($enclosures as $enclosure) {
109 $enc = new FeedEnclosure();
111 $enc->type
= $enclosure->getAttribute("type");
112 $enc->link
= $enclosure->getAttribute("url");
113 $enc->length
= $enclosure->getAttribute("length");
115 array_push($encs, $enc);
121 function get_author() {
122 $author = $this->elem
->getElementsByTagName("author")->item(0);
125 $name = $author->getElementsByTagName("name")->item(0);
127 if ($name) return $name->nodeValue
;
129 $email = $author->getElementsByTagName("email")->item(0);
131 if ($email) return $email->nodeValue
;