]>
git.wh0rd.org - tt-rss.git/blob - classes/feeditem/atom.php
2 class FeedItem_Atom
extends FeedItem_Common
{
4 $id = $this->elem
->getElementsByTagName("id")->item(0);
9 return $this->get_link();
14 $updated = $this->elem
->getElementsByTagName("updated")->item(0);
17 return strtotime($updated->nodeValue
);
20 $published = $this->elem
->getElementsByTagName("published")->item(0);
23 return strtotime($published->nodeValue
);
26 $date = $this->xpath
->query("dc:date", $this->elem
)->item(0);
29 return strtotime($date->nodeValue
);
34 $links = $this->elem
->getElementsByTagName("link");
36 foreach ($links as $link) {
37 if ($link && $link->hasAttribute("href") &&
38 (!$link->hasAttribute("rel")
39 ||
$link->getAttribute("rel") == "alternate"
40 ||
$link->getAttribute("rel") == "standout")) {
42 return $link->getAttribute("href");
47 function get_title() {
48 $title = $this->elem
->getElementsByTagName("title")->item(0);
51 return $title->nodeValue
;
55 function get_content() {
56 $content = $this->elem
->getElementsByTagName("content")->item(0);
59 if ($content->hasAttribute('type')) {
60 if ($content->getAttribute('type') == 'xhtml') {
61 return $this->doc
->saveXML($content->firstChild
->nextSibling
);
65 return $content->nodeValue
;
69 function get_description() {
70 $content = $this->elem
->getElementsByTagName("summary")->item(0);
73 if ($content->hasAttribute('type')) {
74 if ($content->getAttribute('type') == 'xhtml') {
75 return $this->doc
->saveXML($content->firstChild
->nextSibling
);
79 return $content->nodeValue
;
84 function get_categories() {
85 $categories = $this->elem
->getElementsByTagName("category");
88 foreach ($categories as $cat) {
89 if ($cat->hasAttribute("term"))
90 array_push($cats, $cat->getAttribute("term"));
93 $categories = $this->xpath
->query("dc:subject", $this->elem
);
95 foreach ($categories as $cat) {
96 array_push($cats, $cat->nodeValue
);
102 function get_enclosures() {
103 $links = $this->elem
->getElementsByTagName("link");
107 foreach ($links as $link) {
108 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
109 if ($link->getAttribute("rel") == "enclosure") {
110 $enc = new FeedEnclosure();
112 $enc->type
= $link->getAttribute("type");
113 $enc->link
= $link->getAttribute("href");
114 $enc->length
= $link->getAttribute("length");
116 array_push($encs, $enc);
121 $enclosures = $this->xpath
->query("media:content", $this->elem
);
123 foreach ($enclosures as $enclosure) {
124 $enc = new FeedEnclosure();
126 $enc->type
= $enclosure->getAttribute("type");
127 $enc->link
= $enclosure->getAttribute("url");
128 $enc->length
= $enclosure->getAttribute("length");
130 array_push($encs, $enc);