Varous improvements
This commit is contained in:
@@ -13,6 +13,12 @@ final class HtmlSanitizer
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Créer le répertoire de cache s'il n'existe pas
|
||||
$cacheDir = __DIR__ . '/../../var/cache/htmlpurifier';
|
||||
if (!is_dir($cacheDir)) {
|
||||
@mkdir($cacheDir, 0755, true);
|
||||
}
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
// Autoriser les balises courantes de formatage
|
||||
$config->set('HTML.Allowed', 'p,br,strong,em,u,h1,h2,h3,h4,h5,h6,ul,ol,li,blockquote,a[href],img[src|alt|width|height]');
|
||||
@@ -20,7 +26,7 @@ final class HtmlSanitizer
|
||||
$config->set('HTML.AllowedAttributes', 'href,src,alt,width,height,title');
|
||||
// Activer le cache
|
||||
$config->set('Cache.DefinitionImpl', 'Serializer');
|
||||
$config->set('Cache.SerializerPath', __DIR__ . '/../../var/cache/htmlpurifier');
|
||||
$config->set('Cache.SerializerPath', $cacheDir);
|
||||
|
||||
$this->purifier = new HTMLPurifier($config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user