• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/emoji/client.php
  • Класс: BitrixImConnectorEmojiClient
  • Вызов: Client::unicodeToImageCallback
public function unicodeToImageCallback($m)
{
	if ((!is_array($m)) || (!isset($m[1])) || (empty($m[1])))
	{
		return $m[0];
	}
	else
	{
		$ruleset = $this->getRuleset();
		$shortcodeReplace = $ruleset->getShortcodeReplace();
		$unicodeReplace = $ruleset->getUnicodeReplace();

		$unicode = $m[1];

		if (!in_array($unicode, $unicodeReplace))
		{
			$unicode .= "xEFxB8x8F";

			if (!in_array($unicode, $unicodeReplace))
			{
				$unicode = mb_substr($m[1], 0, 4);

				if (!in_array($unicode, $unicodeReplace))
				{
					if ("xE2x83xA3" === mb_substr($m[1], 1, 3))
					{
						$unicode = mb_substr($m[1], 0, 1)."xEFxB8x8FxE2x83xA3";

						if (!in_array($unicode, $unicodeReplace))
						{
							return $m[0];
						}
					}
					else
					{
						return $m[0];
					}
				}
			}
		}

		$shortname = array_search($unicode, $unicodeReplace);
		$filename = $shortcodeReplace[$shortname];

		if ($this->unicodeAlt)
		{
			$alt = $unicode;
		}
		else
		{
			$alt = $shortname;
		}


		return '[ICON=' . $this->imagePathSVG . $filename . '.svg' . $this->cacheBustParam . ' title=' . $alt . ']';
	}
}