From b6e5bf6eaade677187f99182e7face7c4b711bec Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 3 Jul 2009 12:56:29 -0700 Subject: Fix for ticket #400: Add HTMLPurifier to gallery3 and change p::clean() to call HTMLPurifier->purify() --- .../libraries/HTMLPurifier/HTMLPurifier.kses.php | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 modules/gallery/libraries/HTMLPurifier/HTMLPurifier.kses.php (limited to 'modules/gallery/libraries/HTMLPurifier/HTMLPurifier.kses.php') diff --git a/modules/gallery/libraries/HTMLPurifier/HTMLPurifier.kses.php b/modules/gallery/libraries/HTMLPurifier/HTMLPurifier.kses.php new file mode 100644 index 00000000..3143feb1 --- /dev/null +++ b/modules/gallery/libraries/HTMLPurifier/HTMLPurifier.kses.php @@ -0,0 +1,30 @@ + $attributes) { + $allowed_elements[$element] = true; + foreach ($attributes as $attribute => $x) { + $allowed_attributes["$element.$attribute"] = true; + } + } + $config->set('HTML.AllowedElements', $allowed_elements); + $config->set('HTML.AllowedAttributes', $allowed_attributes); + $allowed_schemes = array(); + if ($allowed_protocols !== null) { + $config->set('URI.AllowedSchemes', $allowed_protocols); + } + $purifier = new HTMLPurifier($config); + return $purifier->purify($string); +} + +// vim: et sw=4 sts=4 -- cgit v1.2.3