diff options
author | Andy Staudacher <andy.st@gmail.com> | 2009-09-03 08:49:14 -0700 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2009-09-03 08:49:14 -0700 |
commit | e2d5944e56f7e7433e7f1bda290ba779df447c3c (patch) | |
tree | 6052dcb80a0d5e499af2d882fcf2f0e48e8a8c44 | |
parent | 8f6a120b52360475859c361514500e46698f0e74 (diff) |
Minor performance improvement: Reduce module var cache lookups in SafeString.
-rw-r--r-- | modules/gallery/libraries/SafeString.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/gallery/libraries/SafeString.php b/modules/gallery/libraries/SafeString.php index e6f54add..93905572 100644 --- a/modules/gallery/libraries/SafeString.php +++ b/modules/gallery/libraries/SafeString.php @@ -158,8 +158,8 @@ class SafeString_Core { // Purifies the string, removing any potentially malicious or unsafe HTML / JavaScript. private static function _purify_for_html($dirty_html) { - if (module::is_active("htmlpurifier")) { - if (empty(self::$_purifier)) { + if (null === self::$_purifier) { + if (module::is_active("htmlpurifier")) { require_once(MODPATH . "htmlpurifier/lib/HTMLPurifier/HTMLPurifier.auto.php"); $config = HTMLPurifier_Config::createDefault(); foreach (Kohana::config('purifier') as $category => $key_value) { @@ -168,7 +168,11 @@ class SafeString_Core { } } self::$_purifier = new HTMLPurifier($config); + } else { + self::$_purifier = false; } + } + if (self::$_purifier) { return self::$_purifier->purify($dirty_html); } else { return self::_escape_for_html($dirty_html); |