]> git.wh0rd.org - tt-rss.git/commitdiff
fix zoomed version
authormcbyte-it <ramikattan@tiscali.it>
Wed, 6 Aug 2014 18:13:01 +0000 (20:13 +0200)
committermcbyte-it <ramikattan@tiscali.it>
Wed, 6 Aug 2014 18:13:01 +0000 (20:13 +0200)
Fixed the gocomics filter to get the zoomed version of the comic

plugins/af_comics/filters/af_comics_gocomics.php

index bd57c08ff0636238df4b52d5e65922bc54232f3e..19ffe33f99ab293904fc2affa2fc8391a75f323a 100644 (file)
@@ -17,17 +17,15 @@ class Af_Comics_GoComics extends Af_ComicFilter {
 
                                if ($doc) {
                                        $xpath = new DOMXPath($doc);
-                                       $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess...
+                                       $entries = $xpath->query("(//img[@class='strip'])");
 
                                        $matches = array();
 
-                                       foreach ($entries as $entry) {
-
-                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*width.*)/i", $entry->getAttribute("src"), $matches)) {
-
+                                       if ($entries->length > 1) { // if we have more than one match, then get the zoomed one, which is the second for gocomics
+                                               $entry = $entries->item(1); // get the second element (items start at 0)
+                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
                                                        $entry->setAttribute("src", $matches[0]);
                                                        $basenode = $entry;
-                                                       break;
                                                }
                                        }