diff options
author | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-16 17:31:20 +0200 |
---|---|---|
committer | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-16 17:31:20 +0200 |
commit | 7f5030ac208c30a7dc576a57cd9e665022ccbde5 (patch) | |
tree | 6b23e78aa8cc2dd363def46e083217e3c9b52f1b /modules/gallery/helpers/p.php | |
parent | 923732ca4dca6db218f6252a7133cd72f98fa086 (diff) | |
parent | 85b0f580291e375a2c5ec21b8210e59023ee24c2 (diff) |
Merge commit 'upstream/master'
Diffstat (limited to 'modules/gallery/helpers/p.php')
-rw-r--r-- | modules/gallery/helpers/p.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php index 0a6210dc..862c769b 100644 --- a/modules/gallery/helpers/p.php +++ b/modules/gallery/helpers/p.php @@ -18,7 +18,22 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class p_Core { + private static $_purifier = null; static function clean($dirty_html) { return html::specialchars($dirty_html); } + + static function purify($dirty_html) { + if (empty(self::$_purifier)) { + require_once(dirname(__file__) . "/../lib/HTMLPurifier/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + foreach (Kohana::config('purifier') as $category => $key_value) { + foreach ($key_value as $key => $value) { + $config->set("$category.$key", $value); + } + } + self::$_purifier = new HTMLPurifier($config); + } + return self::$_purifier->purify($dirty_html); + } } |