From d93f0e4be9ebf1c161ac258b7a179d9ab71a8b98 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Feb 2017 15:27:57 +0300 Subject: initial --- init.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 init.php diff --git a/init.php b/init.php new file mode 100755 index 0000000..e62e353 --- /dev/null +++ b/init.php @@ -0,0 +1,54 @@ +host = $host; + + $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); + } + + function hook_article_filter($article) { + + $doc = new DOMDocument(); + + $found = false; + + if (@$doc->loadHTML($article["content"])) { + + $xpath = new DOMXpath($doc); + $images = $xpath->query('(//img[contains(@src, \'goodshowsir.co.uk\')])'); + + foreach ($images as $img) { + $src = $img->getAttribute("src"); + + if (strpos($src, " ") !== FALSE) { + $img->setAttribute("src", trim($src)); + + $found = true; + + } + } + } + + if ($found) { + $article["content"] = $doc->saveXML(); + } + + return $article; + + } + + + function api_version() { + return 2; + } + +} +?> -- cgit v1.2.3