diff options
author | Heiko Adams <[email protected]> | 2015-11-30 10:29:44 +0100 |
---|---|---|
committer | Heiko Adams <[email protected]> | 2015-11-30 10:29:44 +0100 |
commit | 05761788b7b5a8a7e6c14333669acd0793886223 (patch) | |
tree | 464ccc3d98900e5dcf1a437662056161fa1280a4 /plugins/af_comics/filters/af_comics_whomp.php | |
parent | 635ecdb9fa039adb8a0e8ead045bfda023e72bc4 (diff) | |
parent | 6f5d9c6889b6376527d7598857ac8816cf7980ab (diff) |
Merge remote-tracking branch 'origin/master' into german-translation
Diffstat (limited to 'plugins/af_comics/filters/af_comics_whomp.php')
-rw-r--r-- | plugins/af_comics/filters/af_comics_whomp.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php new file mode 100644 index 000000000..5bc6a14e7 --- /dev/null +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -0,0 +1,37 @@ +<?php +class Af_Comics_Whomp extends Af_ComicFilter { + + function supported() { + return array("Whomp!"); + } + + function process(&$article) { + if (strpos($article["guid"], "whompcomic.com") !== FALSE) { + + $res = fetch_file_contents($article["link"], false, false, false, + false, false, 0, + "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + + global $fetch_last_error_content; + + if (!$res && $fetch_last_error_content) + $res = $fetch_last_error_content; + + $doc = new DOMDocument(); + + if (@$doc->loadHTML($res)) { + $xpath = new DOMXPath($doc); + $basenode = $xpath->query('//img[@id="cc-comic"]')->item(0); + + if ($basenode) { + $article["content"] = $doc->saveXML($basenode); + } + } + + return true; + } + + return false; + } +} +?> |