From 110ce72a72468c30ffb9bb9b77e449314e4b10a1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 21 Oct 2014 16:53:17 +0400 Subject: [PATCH] add af_comics filter for toothpastefordinner --- plugins/af_comics/filters/af_comics_tfd.php | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 plugins/af_comics/filters/af_comics_tfd.php diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php new file mode 100644 index 00000000..c4e59455 --- /dev/null +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -0,0 +1,32 @@ +loadHTML(fetch_file_contents($article["link"])); + + $basenode = false; + + if ($doc) { + $xpath = new DOMXPath($doc); + $basenode = $xpath->query('//img[@class="comic"]')->item(0); + + if ($basenode) { + $article["content"] = $doc->saveXML($basenode); + return true; + } + } + } + + return false; + } +} +?> -- 2.39.2