summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/include/functions.php b/include/functions.php
index 2120a96b9..ae9561337 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -2597,12 +2597,25 @@
//$node = $doc->getElementsByTagName('body')->item(0);
- $doc->removeChild($doc->firstChild); //remove doctype
- $res = $doc->saveHTML();
- $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
- $spec = 'img=width,height';
- $res = htmLawed($res, $config, $spec);
+ $beforehooks = $res;
+
+ global $pluginhost;
+ if ($pluginhost) {
+ foreach ($pluginhost->get_hooks($pluginhost::HOOK_SANITIZE) as $p) {
+ $res = $p->hook_sanitize($res);
+ }
+ }
+
+ // nothing changed, use standard filters
+ if ($beforehooks == $res) {
+ $doc->removeChild($doc->firstChild); //remove doctype
+ $res = $doc->saveHTML();
+
+ $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
+ $spec = 'img=width,height';
+ $res = htmLawed($res, $config, $spec);
+ }
return $res;
}