- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/recent.php
- Класс: BitrixImRecent
- Вызов: Recent::jsonRow
static function jsonRow($item)
{
if (!is_array($item))
{
return $item;
}
foreach ($item as $key => $value)
{
if ($value instanceof BitrixMainTypeDateTime)
{
$item[$key] = date('c', $value->getTimestamp());
}
else if (is_array($value))
{
foreach ($value as $subKey => $subValue)
{
if ($subValue instanceof BitrixMainTypeDateTime)
{
$value[$subKey] = date('c', $subValue->getTimestamp());
}
else if (
is_string($subValue)
&& $subValue
&& in_array($subKey, ['URL', 'AVATAR'])
&& mb_strpos($subValue, 'http') !== 0
)
{
$value[$subKey] = BitrixImCommon::getPublicDomain().$subValue;
}
else if (is_array($subValue))
{
$value[$subKey] = array_change_key_case($subValue, CASE_LOWER);
}
}
$item[$key] = array_change_key_case($value, CASE_LOWER);
}
}
return array_change_key_case($item, CASE_LOWER);
}