25 public function getHtml(
string $text): string
30 "ANCHOR" =>
"Y",
"BIU" =>
"Y",
31 "IMG" =>
"Y",
"QUOTE" =>
"Y",
32 "CODE" =>
"Y",
"FONT" =>
"Y",
33 "LIST" =>
"Y",
"SMILES" =>
"Y",
34 "NL2BR" =>
"Y",
"MULTIPLE_BR" =>
"N",
35 "VIDEO" =>
"Y",
"LOG_VIDEO" =>
"N",
41 if(
$parser instanceof \blogTextParser)
43 $result =
$parser->convert($text, [], $rules);
45 elseif(
$parser instanceof \forumTextParser)
47 $result =
$parser->convert($text, $rules,
"html", []);
49 elseif(
$parser instanceof \logTextParser)
51 $result =
$parser->convert($text, [], $rules);
55 $result =
$parser->convertText($text);
58 $result = \Bitrix\Main\Text\Emoji::decode($result);
59 $result = preg_replace(
'/\[[^\]]+\]/',
'', $result);
81 $mentionedUserIds = [];
83 if(preg_match_all(
"/\[user\s*=\s*([^\]]*)\](.+?)\[\/user\]/is" . BX_UTF_PCRE_MODIFIER, $text, $matches) && is_array($matches[1]))
85 $mentionedUserIds = $matches[1];
86 $mentionedUserIds = array_unique($mentionedUserIds);
87 foreach($mentionedUserIds as &$mentionedUserId)
89 $mentionedUserId = (int) $mentionedUserId;
93 return $mentionedUserIds;
99 if($this->parser ===
null && Loader::includeModule(
'blog'))
101 $this->parser = new \blogTextParser($languageId);
103 if($this->parser ===
null && Loader::includeModule(
'forum'))
105 $this->parser = new \forumTextParser($languageId);
107 if($this->parser ===
null && Loader::includeModule(
'socialnetwork'))
109 $this->parser = new \logTextParser($languageId);
111 if($this->parser ===
null)
113 $this->parser = new \CTextParser();
116 if(is_array($this->userFields))