summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-07-03 12:56:59 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-07-03 12:56:59 -0700
commit8d5900f63956d6746a78a4bd5ac0c4f8086752bc (patch)
treee06d6c12e2751e56fcc27ccba1e146ee07704efa /modules/gallery
parentb6e5bf6eaade677187f99182e7face7c4b711bec (diff)
Fix for ticket #400: Add HTMLPurifier to gallery3 and change p::clean() to call HTMLPurifier->purify()
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/helpers/p.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php
index 527467f6..29d21497 100644
--- a/modules/gallery/helpers/p.php
+++ b/modules/gallery/helpers/p.php
@@ -18,7 +18,18 @@
* 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 GalleryHtmlPurifier::instance()->purify($dirty_html);
+ if (empty(self::$_purifier)) {
+ require_once(dirname(__file__) . "/../libraries/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);
}
}