]>
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->hasChildNodes()) {
46 if ($content->getElementsByTagName("*")->length
> 1) {
47 return $this->doc
->saveXML($content->firstChild
->nextSibling
);
51 return $content->nodeValue
;
55 function get_description() {
56 $summary = $this->elem
->getElementsByTagName("summary")->item(0);
59 return $summary->nodeValue
;
63 function get_categories() {
64 $categories = $this->elem
->getElementsByTagName("category");
67 foreach ($categories as $cat) {
68 if ($cat->hasAttribute("term"))
69 array_push($cats, $cat->getAttribute("term"));
72 $categories = $this->xpath
->query("dc:subject", $this->elem
);
74 foreach ($categories as $cat) {
75 array_push($cats, $cat->nodeValue
);
81 function get_enclosures() {
82 $links = $this->elem
->getElementsByTagName("link");
86 foreach ($links as $link) {
87 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
88 if ($link->getAttribute("rel") == "enclosure") {
89 $enc = new FeedEnclosure();
91 $enc->type
= $link->getAttribute("type");
92 $enc->link
= $link->getAttribute("href");
93 $enc->length
= $link->getAttribute("length");
95 array_push($encs, $enc);
100 $enclosures = $this->xpath
->query("media:content", $this->elem
);
102 foreach ($enclosures as $enclosure) {
103 $enc = new FeedEnclosure();
105 $enc->type
= $enclosure->getAttribute("type");
106 $enc->link
= $enclosure->getAttribute("url");
107 $enc->length
= $enclosure->getAttribute("length");
109 array_push($encs, $enc);