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 return $link->getAttribute("href");
31 function get_title() {
32 $title = $this->elem->getElementsByTagName("title")->item(0);
35 return $title->nodeValue;
39 function get_content() {
40 $content = $this->elem->getElementsByTagName("content")->item(0);
43 return $content->nodeValue;
47 function get_description() {
48 $summary = $this->elem->getElementsByTagName("summary")->item(0);
51 return $summary->nodeValue;
55 function get_categories() {
56 $categories = $this->elem->getElementsByTagName("category");
59 foreach ($categories as $cat) {
60 if ($cat->hasAttribute("term"))
61 array_push($cats, $cat->getAttribute("term"));
64 $categories = $this->xpath->query("dc:subject", $this->elem);
66 foreach ($categories as $cat) {
67 array_push($cats, $cat->nodeValue);
73 function get_enclosures() {
74 $links = $this->elem->getElementsByTagName("link");
78 foreach ($links as $link) {
79 if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
80 if ($link->getAttribute("rel") == "enclosure") {
81 $enc = new FeedEnclosure();
83 $enc->type = $link->getAttribute("type");
84 $enc->link = $link->getAttribute("href");
85 $enc->length = $link->getAttribute("length");
87 array_push($encs, $enc);
92 $enclosures = $this->xpath->query("media:content", $this->elem);
94 foreach ($enclosures as $enclosure) {
95 $enc = new FeedEnclosure();
97 $enc->type = $enclosure->getAttribute("type");
98 $enc->link = $enclosure->getAttribute("url");
99 $enc->length = $enclosure->getAttribute("length");
101 array_push($encs, $enc);