• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/functions.php
  • Класс: CSocNetTextParser
  • Вызов: CSocNetTextParser::convert_code_tag
function convert_code_tag($text = "", $type = "html")
{
	if ($text == '') return;
	$type = ($type == "rss" ? "rss" : "html");
	$text = str_replace(array("<", ">", "\r", "\n", "\"), array("<", ">", "\r", "\n", "\"), $text);
	$text = stripslashes($text);
	$text = str_replace(array("  ", "t", ), array("  ", "   "), $text);
	$txt = $text;

	$this->matchType = 'code';
	$this->matchType2 = $type;
	$txt = preg_replace_callback(
		"/[code]/i".BX_UTF_PCRE_MODIFIER,
		array($this, "convert_open_tag_callback"),
		$txt
	);
	$this->matchType = 'code';
	$txt = preg_replace_callback(
		"/[/code]/i".BX_UTF_PCRE_MODIFIER,
		array($this, "convert_close_tag_callback"),
		$txt
	);			

	if (
		($this->code_open == $this->code_closed) 
		&& ($this->code_error == 0)
	)
	{
		return $txt;
	}
	return $text;
}