• Модуль: mobile
  • Путь к файлу: ~/bitrix/modules/mobile/lib/livefeed/helper.php
  • Класс: BitrixMobileLivefeedHelper
  • Вызов: Helper::getDiskDataByCommentText
static function getDiskDataByCommentText($text)
{
	$result = false;

	if (
		!empty($text)
		&& BitrixMainModuleManager::isModuleInstalled('disk')
	)
	{
		$commentObjectId = $commentAttachedObjectId = array();

		if (preg_match_all("#\[disk file id=(n\d+)\]#is" . BX_UTF_PCRE_MODIFIER, $text, $matches))
		{
			$commentObjectId = array_map(static function($a) { return (int)mb_substr($a, 1); }, $matches[1]);
		}

		if (preg_match_all("#\[disk file id=(\d+)\]#is" . BX_UTF_PCRE_MODIFIER, $text, $matches))
		{
			$commentAttachedObjectId = array_map(static function($a) { return (int)$a; }, $matches[1]);
		}

		if (
			!empty($commentObjectId)
			|| !empty($commentAttachedObjectId)
		)
		{
			$result = array(
				'OBJECT_ID' => $commentObjectId,
				'ATTACHED_OBJECT_ID' => $commentAttachedObjectId
			);
		}
	}

	return $result;
}