예제 #1
0
 static function purify($dirty_html)
 {
     if (!isset(self::$_purifier)) {
         require_once MODPATH . "purifier/vendor/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);
 }
예제 #2
0
 /**
  * Purify the string, removing any potentially malicious or unsafe HTML / JavaScript.
  */
 private static function _purify_for_html($dirty_html)
 {
     if (method_exists("purifier", "purify")) {
         return purifier::purify($dirty_html);
     } else {
         return self::_escape_for_html($dirty_html);
     }
 }