• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar.php
  • Класс: CCalendar
  • Вызов: CCalendar::ParseHTMLToBB
static function ParseHTMLToBB($html = "")
{
	$id = AddEventHandler("main", "TextParserBeforeTags", Array("CCalendar", "_ParseHack"));

	$TextParser = new CTextParser();
	$TextParser->allow = array("HTML" => "N", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "Y", "ALIGN" => "Y");
	$html = $TextParser->convertText($html);

	$html = htmlspecialcharsback($html);
	// Replace BR
	$html = preg_replace("//is".BX_UTF_PCRE_MODIFIER,"n", $html);
	//replace /p && /div to n
	$html = preg_replace("//is".BX_UTF_PCRE_MODIFIER,"n", $html);
	// Kill  
	$html = preg_replace("/ /is".BX_UTF_PCRE_MODIFIER,"", $html);
	// For images in Office 365
	$html = preg_replace(
		"#]+src\s*=[\s'"]*((cid):[.\-_:a-z0-9@]+)*[\s'"]*[^>]*>#is"
		.BX_UTF_PCRE_MODIFIER,
		"[img]\1[/img]", $html
	);
	// Kill tags
	$html = preg_replace("/<([^>]*?)>/is".BX_UTF_PCRE_MODIFIER,"", $html);
	// Clean multiple n symbols
	$html = preg_replace("/n[sn]+n/", "n" , $html);

	$html = htmlspecialcharsbx($html);

	RemoveEventHandler("main", "TextParserBeforeTags", $id);

	return $html;
}