• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/textparser.php
  • Класс: CTextParser
  • Вызов: CTextParser::convertHTMLToBB
public function convertHTMLToBB($html = '', $allow = null)
{
	if (empty($html))
	{
		return $html;
	}

	$handler = AddEventHandler('main', 'TextParserBeforeTags', ['CTextParser', 'TextParserHTMLToBBHack']);

	$this->allow = array_merge(
		is_array($allow) ? $allow : [
			'ANCHOR' => 'Y',
			'BIU' => 'Y',
			'IMG' => 'Y',
			'QUOTE' => 'Y',
			'CODE' => 'Y',
			'FONT' => 'Y',
			'LIST' => 'Y',
			'SMILES' => 'Y',
			'NL2BR' => 'Y',
			'VIDEO' => 'Y',
			'TABLE' => 'Y',
			'ALIGN' => 'Y',
			'P' => 'Y',
		],
		['HTML' => 'N']
	);

	$html = $this->convertText($html);

	$html = preg_replace("//is" . BX_UTF_PCRE_MODIFIER,"n", $html);
	$html = preg_replace("/ /is" . BX_UTF_PCRE_MODIFIER, '', $html);

	RemoveEventHandler('main', 'TextParserBeforeTags', $handler);

	return $html;
}