From: Andrew Dolgov Date: Mon, 5 Aug 2013 07:50:15 +0000 (+0400) Subject: simplify media:content xpath X-Git-Tag: 1.10~31 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=6bf61bdc639f60957ce4edc9e0160de3e78dc7df;p=tt-rss.git simplify media:content xpath --- diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index e88b5ec1..b1251e6d 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -137,19 +137,7 @@ class FeedItem_Atom extends FeedItem_Common { } } - $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); - } - - $enclosures = $this->xpath->query("media:group/media:content", $this->elem); + $enclosures = $this->xpath->query("media:content | media:group/media:content", $this->elem); foreach ($enclosures as $enclosure) { $enc = new FeedEnclosure(); diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php index a2e9f01a..095225a2 100644 --- a/classes/feeditem/rss.php +++ b/classes/feeditem/rss.php @@ -112,19 +112,7 @@ class FeedItem_RSS extends FeedItem_Common { array_push($encs, $enc); } - $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); - } - - $enclosures = $this->xpath->query("media:group/media:content", $this->elem); + $enclosures = $this->xpath->query("media:content | media:group/media:content", $this->elem); foreach ($enclosures as $enclosure) { $enc = new FeedEnclosure();