• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/textparser.php
  • Класс: CTextParser
  • Вызов: CTextParser::clearAllTags
static function clearAllTags($text)
{
	$text = strip_tags(trim($text));
	if ($text == '')
	{
		return '';
	}

	if (mb_stripos($text, '/is" . BX_UTF_PCRE_MODIFIER,
			"/^(.+?)\[cut(.*?)]/is" . BX_UTF_PCRE_MODIFIER,
		], "\1", $text);
	}
	if (mb_stripos($text, '[quote') !== false)
	{
		while (preg_match("/\[(?:quote)(?:.*?)](.*?)\[\/quote(.*?)]/is" . BX_UTF_PCRE_MODIFIER, $text))
		{
			$text = preg_replace(
				[
					"/\[quote(?:.*?)](.*?)\[\/quote(.*?)]/is" . BX_UTF_PCRE_MODIFIER,
					"/(.*?)<\/quote(.*?)>/is" . BX_UTF_PCRE_MODIFIER,
				],
				""\1"",
				$text
			);
		}
	}

	$text = preg_replace("/\[url\s*=\s*(\S+?)\s*](.*?)\[\/url]/is" . BX_UTF_PCRE_MODIFIER, "\2", $text);

	$arPattern = [];
	$arReplace = [];

	$arPattern[] = "/\/is" . BX_UTF_PCRE_MODIFIER;
	$arReplace[] = "";

	$arPattern[] = "/^(r|n)+?(.*)$/";
	$arReplace[] = "\2";

	$arPattern[] = "/\<(\/?)(code|font|color|video)(.*?)\>/is" . BX_UTF_PCRE_MODIFIER;
	$arReplace[] = "";
	$arPattern[] = "/\[\/td(.*?)\]\[td(.*?)\]/is" . BX_UTF_PCRE_MODIFIER;
	$arReplace[] = " ";
	$arPattern[] = "/\[(\/?)(p|b|i|u|s|list|code|quote|size|font|color|url|img|video|td|tr|table|file|document id|disk file id|user|project|left|right|center|justify|\*)(.*?)\]/is" . BX_UTF_PCRE_MODIFIER;
	$arReplace[] = "";

	return preg_replace($arPattern, $arReplace, $text);
}