From 6bf61bdc639f60957ce4edc9e0160de3e78dc7df Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 5 Aug 2013 11:50:15 +0400 Subject: [PATCH] simplify media:content xpath --- classes/feeditem/atom.php | 14 +------------- classes/feeditem/rss.php | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) 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(); -- 2.39.5