From a3013adedd45fea4ae323c8621ef570119c3b489 Mon Sep 17 00:00:00 2001 From: aliz27 Date: Wed, 13 May 2015 18:19:32 +0200 Subject: [PATCH] Add support for sillies --- plugins/af_comics/filters/af_comics_cad.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php index 43836724..15b8d7ad 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -8,8 +8,8 @@ class Af_Comics_Cad extends Af_ComicFilter { function process(&$article) { $owner_uid = $article["owner_uid"]; - if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) { - if (strpos($article["title"], "News:") === FALSE) { + if (strpos($article["title"], "News:") === FALSE) { + if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) { $doc = new DOMDocument(); @$doc->loadHTML(fetch_file_contents($article["link"])); @@ -24,9 +24,24 @@ class Af_Comics_Cad extends Af_ComicFilter { $article["content"] = $doc->saveXML($basenode); } } - } + + elseif (strpos($article["link"], "cad-comic.com/sillies/") !== FALSE) { + $doc = new DOMDocument(); + @$doc->loadHTML(fetch_file_contents($article["link"])); + $basenode = false; + + if ($doc) { + $xpath = new DOMXPath($doc); + $basenode = $xpath->query('(//img[contains(@src, "/comics/sillies-")])')->item(0); + + if ($basenode) { + $article["content"] = $doc->saveXML($basenode); + } + } + } + return true; } -- 2.39.5