From: Jeffrey Tolar Date: Sat, 13 Jul 2013 03:55:27 +0000 (-0500) Subject: Try to use larger GoComics image X-Git-Tag: 1.9~25 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=726eccd93d66514eca0f5b13ccbf1d8f9234113b;p=tt-rss.git Try to use larger GoComics image --- diff --git a/plugins/af_gocomics/init.php b/plugins/af_gocomics/init.php index e95de9f1..35c53549 100644 --- a/plugins/af_gocomics/init.php +++ b/plugins/af_gocomics/init.php @@ -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"];