public function set_admin_mode() { $mask = '#^(http|https)://(%s)#'; $allowURI = Variable::lire('htmlpurifier_whiteList', 'www.youtube.com/embed/\\nplayer.vimeo.com/video/\\nmaps.google.*/'); $config = HTMLPurifier_Config::createDefault(); $config->set('Core.Encoding', "UTF-8"); $config->set('HTML.DefinitionID', 'Thelia back-office content filter'); $config->set('HTML.DefinitionRev', 1); $config->set('Attr.EnableID', true); $config->set('CSS.AllowTricky', true); $config->set('HTML.Allowed', 'a,strong,em,div,p,span,img,li,ul,ol,sup,sub,small,big,code,blockquote,h1,h2,h3,h4,h5, iframe'); $config->set('HTML.AllowedAttributes', 'a.href,a.title,img.src,img.alt,img.title,img.width,img.height,*.style,*.id,*.class, iframe.width, iframe.height, iframe.src, iframe.frameborder'); $config->set('AutoFormat.Linkify', true); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); //Filter.Youtube est déprécié, à remplacer dans thelia 1.5.3.5, voir début de la méthode // $config->set('Filter.YouTube', true); $config->set('HTML.SafeObject', true); $config->set('Output.FlashCompat', true); $config->set('HTML.SafeIframe', true); $config->set('URI.SafeIframeRegexp', sprintf($mask, str_replace("\n", "|", $allowURI))); $config->set('HTML.TidyLevel', 'medium'); // Recreate a new instance with this config self::$purifier = new HTMLPurifier($config); }