- Модуль: forum
- Путь к файлу: ~/bitrix/modules/forum/classes/general/functions.php
- Класс: forumTextParser
- Вызов: forumTextParser::convert4mail
function convert4mail($text, $files = false, $allow = array(), $params = array())
{
$this->arFiles = (is_array($files) ? $files : ($files ? array($files) : array()));
$this->arFilesIDParsed = array();
if (!empty($params))
{
$mail = array(
"RECIPIENT_ID" => intval($params["RECIPIENT_ID"]),
"SITE_ID" => ($params["SITE_ID"] ?: SITE_ID)
);
$allow = array_merge(((is_array($allow) ? $allow : array()) + array(
"HTML" => "N",
"ANCHOR" => "Y",
"BIU" => "Y",
"IMG" => "Y",
"QUOTE" => "Y",
"CODE" => "Y",
"FONT" => "Y",
"LIST" => "Y",
"NL2BR" => "N",
"TABLE" => "Y"
)), array("SMILES" => "N"));
$this->RECIPIENT_ID = $mail["RECIPIENT_ID"];
$this->SITE_ID = $mail["SITE_ID"];
if (is_array($this->arUserfields))
{
foreach ($this->arUserfields as &$f)
{
$f += $mail;
}
}
return $this->convert($text, $allow, "mail");
}
else
{
$text = parent::convert4mail($text);
if (!empty($this->arFiles))
$this->ParserFile($text, $this, "mail");
if (preg_match("/\[cut(([^\]])*)\]/is".BX_UTF_PCRE_MODIFIER, $text, $matches))
{
$text = preg_replace(
array("/\[cut(([^\]])*)\]/is".BX_UTF_PCRE_MODIFIER,
"/\[\/cut\]/is".BX_UTF_PCRE_MODIFIER),
array(" 01\1 02",
" 03"),
$text);
while (preg_match("/( 01([^ 02]*) 02([^ 01 02 03]+) 03)/is".BX_UTF_PCRE_MODIFIER, $text, $arMatches))
$text = preg_replace(
"/( 01([^ 02]*) 02([^ 01 02 03]+) 03)/is".BX_UTF_PCRE_MODIFIER,
"n>================== CUT ===================n\3n>==========================================n",
$text);
$text = preg_replace(
array("/ 01([^ 02]+) 02/",
"/ 01 02/",
"/ 03/"),
array("[cut\1]",
"[cut]",
"[/cut]"),
$text);
}
}
return $text;
}