]>
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 return $content->nodeValue
;
48 function get_description() {
49 $summary = $this->elem
->getElementsByTagName("summary")->item(0);
52 return $summary->nodeValue
;
56 function get_categories() {
57 $categories = $this->elem
->getElementsByTagName("category");
60 foreach ($categories as $cat) {
61 if ($cat->hasAttribute("term"))
62 array_push($cats, $cat->getAttribute("term"));
65 $categories = $this->xpath
->query("dc:subject", $this->elem
);
67 foreach ($categories as $cat) {
68 array_push($cats, $cat->nodeValue
);
74 function get_enclosures() {
75 $links = $this->elem
->getElementsByTagName("link");
79 foreach ($links as $link) {
80 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
81 if ($link->getAttribute("rel") == "enclosure") {
82 $enc = new FeedEnclosure();
84 $enc->type
= $link->getAttribute("type");
85 $enc->link
= $link->getAttribute("href");
86 $enc->length
= $link->getAttribute("length");
88 array_push($encs, $enc);
93 $enclosures = $this->xpath
->query("media:content", $this->elem
);
95 foreach ($enclosures as $enclosure) {
96 $enc = new FeedEnclosure();
98 $enc->type
= $enclosure->getAttribute("type");
99 $enc->link
= $enclosure->getAttribute("url");
100 $enc->length
= $enclosure->getAttribute("length");
102 array_push($encs, $enc);