mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 19:05:55 +00:00
pass xpath object to feeditem, support media-rss objects
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
class FeedItem_RSS {
|
||||
private $elem;
|
||||
private $xpath;
|
||||
|
||||
function __construct($elem) {
|
||||
function __construct($elem, $doc, $xpath) {
|
||||
$this->elem = $elem;
|
||||
$this->xpath = $xpath;
|
||||
}
|
||||
|
||||
function get_id() {
|
||||
@@ -92,6 +94,20 @@ class FeedItem_RSS {
|
||||
array_push($encs, $enc);
|
||||
}
|
||||
|
||||
$enclosures = $this->xpath->query("media:content", $this->elem);
|
||||
|
||||
$encs = array();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user