- Модуль: fileman
- Путь к файлу: ~/bitrix/modules/fileman/lib/block/editor.php
- Класс: BitrixFilemanBlockEditor
- Вызов: Editor::getHtmlForEditor
static function getHtmlForEditor($html, $charset = null)
{
$phpList = PHPParser::ParseFile($html);
foreach($phpList as $php)
{
$phpFormatted = htmlspecialcharsbx(str_replace(["r", "n"], "", $php[2]));
$id = 'bx_block_php_' . mt_rand();
$surrogate = '';
$html = str_replace($php[2], $surrogate, $html);
}
if(!$charset)
{
$charset = Application::getInstance()->getContext()->getCulture()->getCharset();
$charset = 'UTF-8';
}
$charsetPlaceholder = '#CHARSET#';
$html = static::replaceCharset($html, $charsetPlaceholder);
$html = str_replace($charsetPlaceholder, HtmlFilter::encode($charset), $html);
$html = Sanitizer::clean($html);
return $html;
}