]> git.wh0rd.org Git - tt-rss.git/commitdiff
Try to use larger GoComics image
authorJeffrey Tolar <tolar.jeffrey@gmail.com>
Sat, 13 Jul 2013 03:55:27 +0000 (22:55 -0500)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 14 Jul 2013 07:27:44 +0000 (11:27 +0400)
plugins/af_gocomics/init.php

index e95de9f141602ccb5a838bb3971130c1318d2fd4..35c535492dce558a6334a8b18da39d4d72dd97c2 100644 (file)
@@ -32,7 +32,7 @@ class Af_GoComics extends Plugin {
 
                                        foreach ($entries as $entry) {
 
-                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
+                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*width.*)/i", $entry->getAttribute("src"), $matches)) {
 
                                                        $entry->setAttribute("src", $matches[0]);
                                                        $basenode = $entry;
@@ -40,6 +40,19 @@ class Af_GoComics extends Plugin {
                                                }
                                        }
 
+                    if (!$basenode) {
+                        // fallback on the smaller version
+                        foreach ($entries as $entry) {
+
+                            if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
+
+                                $entry->setAttribute("src", $matches[0]);
+                                $basenode = $entry;
+                                break;
+                            }
+                        }
+                    }
+
                                        if ($basenode) {
                                                $article["content"] = $doc->saveXML($basenode);
                                                $article["plugin_data"] = "gocomics,$owner_uid:" . $article["plugin_data"];