]>
git.wh0rd.org - tt-rss.git/blob - classes/feeditem/atom.php
6 function __construct($elem, $doc, $xpath) {
12 $id = $this->elem
->getElementsByTagName("id")->item(0);
15 return $id->nodeValue
;
17 return $this->get_link();
22 $updated = $this->elem
->getElementsByTagName("updated")->item(0);
25 return strtotime($updated->nodeValue
);
30 $links = $this->elem
->getElementsByTagName("link");
32 foreach ($links as $link) {
33 if ($link && $link->hasAttribute("href") && !$link->hasAttribute("rel")) {
34 return $link->getAttribute("href");
39 function get_title() {
40 $title = $this->elem
->getElementsByTagName("title")->item(0);
43 return $title->nodeValue
;
47 function get_content() {
48 $content = $this->elem
->getElementsByTagName("content")->item(0);
51 return $content->nodeValue
;
55 function get_description() {
56 $summary = $this->elem
->getElementsByTagName("summary")->item(0);
59 return $summary->nodeValue
;
64 function get_comments_url() {
68 function get_comments_count() {
69 $comments = $this->xpath
->query("slash:comments", $this->elem
)->item(0);
72 return $comments->nodeValue
;
76 function get_categories() {
77 $categories = $this->elem
->getElementsByTagName("category");
80 foreach ($categories as $cat) {
81 if ($cat->hasAttribute("term"))
82 array_push($cats, $cat->getAttribute("term"));
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 $links = $this->elem
->getElementsByTagName("link");
99 foreach ($links as $link) {
100 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
101 if ($link->getAttribute("rel") == "enclosure") {
102 $enc = new FeedEnclosure();
104 $enc->type
= $link->getAttribute("type");
105 $enc->link
= $link->getAttribute("href");
106 $enc->length
= $link->getAttribute("length");
108 array_push($encs, $enc);
113 $enclosures = $this->xpath
->query("media:content", $this->elem
);
115 foreach ($enclosures as $enclosure) {
116 $enc = new FeedEnclosure();
118 $enc->type
= $enclosure->getAttribute("type");
119 $enc->link
= $enclosure->getAttribute("url");
120 $enc->length
= $enclosure->getAttribute("length");
122 array_push($encs, $enc);
128 function get_author() {
129 $author = $this->elem
->getElementsByTagName("author")->item(0);
132 $name = $author->getElementsByTagName("name")->item(0);
134 if ($name) return $name->nodeValue
;
136 $email = $author->getElementsByTagName("email")->item(0);
138 if ($email) return $email->nodeValue
;