00001 <?php
00002
00003
00004
00005
00006
00007
00008 class ConverterHtmlPurifier implements IConverter {
00009
00010
00011
00012
00013
00014
00015 public function encode($value, $params = false) {
00016 require_once Load::get_module_dir('text.htmlpurifier') . '3rdparty/htmlpurifier-4/HTMLPurifier.standalone.php';
00017
00018 $config = HTMLPurifier_Config::createDefault();
00019 $config->set('Core.Encoding', GyroLocale::get_charset());
00020 $config->set('Cache.SerializerPath', Config::get_value(Config::TEMP_DIR) . 'htmlpurifier');
00021
00022 $config->set('HTML.TidyLevel', 'medium');
00023
00024 $config->loadArray(Arr::force($params, false));
00025
00026 $purifier = new HTMLPurifier($config);
00027 $value = $purifier->purify($value);
00028
00029 return $value;
00030 }
00031
00032
00033
00034
00035 public function decode($value, $params = false) {
00036 return $value;
00037 }
00038 }