public function __construct($cacheDirectory = null)
{
if (!$cacheDirectory) {
$cacheDirectory = realpath(sys_get_temp_dir());
}
if (!is_writable($cacheDirectory)) {
throw new InvalidArgumentException($cacheDirectory . ' is not writable');
}
// require to configure some CONSTANST
new \HTMLPurifier_Bootstrap();
$config = \HTMLPurifier_Config::createDefault();
$config->set('Cache.SerializerPath', $cacheDirectory);
$this->purifier = new \HTMLPurifier($config);
}