summaryrefslogtreecommitdiff
path: root/classes/feeditem/atom.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-05-01 20:55:08 +0400
committerAndrew Dolgov <[email protected]>2013-05-01 20:55:08 +0400
commitd4992d6b48ed458ae3ff39c5cd5ac19244ccd6a8 (patch)
treefa9dcf17ff825b3304a94aba34dc559c3b45a13d /classes/feeditem/atom.php
parentee78f81ccdcc12055927a708e31ab0a85442b27b (diff)
add support for dc:subject and slash:comments
Diffstat (limited to 'classes/feeditem/atom.php')
-rw-r--r--classes/feeditem/atom.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php
index 7dc4ce5c1..d21933897 100644
--- a/classes/feeditem/atom.php
+++ b/classes/feeditem/atom.php
@@ -1,9 +1,11 @@
<?php
class FeedItem_Atom {
private $elem;
+ private $xpath;
function __construct($elem, $doc, $xpath) {
$this->elem = $elem;
+ $this->xpath = $xpath;
}
function get_id() {
@@ -63,9 +65,12 @@ class FeedItem_Atom {
}
- // todo
function get_comments_count() {
+ $comments = $this->xpath->query("slash:comments", $this->elem)->item(0);
+ if ($comments) {
+ return $comments->nodeValue;
+ }
}
function get_categories() {
@@ -77,6 +82,11 @@ class FeedItem_Atom {
array_push($cats, $cat->getAttribute("term"));
}
+ $categories = $this->xpath->query("dc:subject", $this->elem);
+
+ foreach ($categories as $cat) {
+ array_push($cats, $cat->nodeValue);
+ }
return $cats;
}
@@ -100,6 +110,18 @@ class FeedItem_Atom {
}
}
+ $enclosures = $this->xpath->query("media:content", $this->elem);
+
+ foreach ($enclosures as $enclosure) {
+ $enc = new FeedEnclosure();
+
+ $enc->type = $enclosure->getAttribute("type");
+ $enc->link = $enclosure->getAttribute("url");
+ $enc->length = $enclosure->getAttribute("length");
+
+ array_push($encs, $enc);
+ }
+
return $encs;
}