]>
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
);
22 $links = $this->elem
->getElementsByTagName("link");
24 foreach ($links as $link) {
25 if ($link && $link->hasAttribute("href") && (!$link->hasAttribute("rel")
26 ||
$link->getAttribute("rel") == "alternate")) {
27 return $link->getAttribute("href");
32 function get_title() {
33 $title = $this->elem
->getElementsByTagName("title")->item(0);
36 return $title->nodeValue
;
40 function get_content() {
41 $content = $this->elem
->getElementsByTagName("content")->item(0);
44 if ($content->hasAttribute('type')) {
45 if ($content->getAttribute('type') == 'xhtml') {
46 return $this->doc
->saveXML($content->firstChild
->nextSibling
);
50 return $content->nodeValue
;
54 function get_description() {
55 $content = $this->elem
->getElementsByTagName("summary")->item(0);
58 if ($content->hasAttribute('type')) {
59 if ($content->getAttribute('type') == 'xhtml') {
60 return $this->doc
->saveXML($content->firstChild
->nextSibling
);
64 return $content->nodeValue
;
69 function get_categories() {
70 $categories = $this->elem
->getElementsByTagName("category");
73 foreach ($categories as $cat) {
74 if ($cat->hasAttribute("term"))
75 array_push($cats, $cat->getAttribute("term"));
78 $categories = $this->xpath
->query("dc:subject", $this->elem
);
80 foreach ($categories as $cat) {
81 array_push($cats, $cat->nodeValue
);
87 function get_enclosures() {
88 $links = $this->elem
->getElementsByTagName("link");
92 foreach ($links as $link) {
93 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
94 if ($link->getAttribute("rel") == "enclosure") {
95 $enc = new FeedEnclosure();
97 $enc->type
= $link->getAttribute("type");
98 $enc->link
= $link->getAttribute("href");
99 $enc->length
= $link->getAttribute("length");
101 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);