1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 13:55:55 +00:00

add support for dc:subject and slash:comments

This commit is contained in:
Andrew Dolgov
2013-05-01 20:55:08 +04:00
parent ee78f81ccd
commit d4992d6b48
4 changed files with 37 additions and 11 deletions

View File

@@ -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;
}