- Модуль: fileman
- Путь к файлу: ~/bitrix/modules/fileman/lib/block/sanitizer.php
- Класс: BitrixFilemanBlockSanitizer
- Вызов: Sanitizer::clean
static function clean($html)
{
$tags = self::getTags() + array(
'html' => array('xmlns'),
'head' => array(),
'body' => array(),
'meta' => array('content', 'name', 'http-equiv'),
'title' => array(),
'style' => array(Editor::STYLIST_TAG_ATTR, 'type'),
'link' => array('type', 'rel', 'href'),
);
$commonAttributes = self::getCommonAttributes();
foreach ($tags as $tagName => $attributes)
{
$tags[$tagName] = array_merge($attributes, $commonAttributes);
}
$sanitizer = new CBXSanitizer();
$sanitizer->setLevel(CBXSanitizer::SECURE_LEVEL_LOW);
$sanitizer->addTags($tags);
$sanitizer->allowAttributes([
Editor::BLOCK_PHP_ATTR => [
'tag' => function ()
{
return true;
},
'content' => function ()
{
return true;
},
]
]);
$sanitizer->applyDoubleEncode(false);
$storedMap = self::replacePhpToTags($html);
$html = $sanitizer->sanitizeHtml($html);
self::replaceTagsToPhp($html, $storedMap);
return $html;
}