]> git.wh0rd.org Git - tt-rss.git/commitdiff
simplify media:content xpath
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 5 Aug 2013 07:50:15 +0000 (11:50 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 5 Aug 2013 07:50:15 +0000 (11:50 +0400)
classes/feeditem/atom.php
classes/feeditem/rss.php

index e88b5ec1ddfbaa4a8bff23af4e0bf681a5536f4e..b1251e6d315136cbe3079cb3dd6b1be4d6467fa1 100644 (file)
@@ -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();
index a2e9f01a27c81a4776b56f28320c692e3a5fe57d..095225a2a919fdd8498c5c63bf4be809fc0ff1a6 100644 (file)
@@ -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();