• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/internals/postfiles.php
  • Класс: Bitrix\Sender\Internals\PostFiles
  • Вызов: PostFiles::getMediaLib
public function getMediaLib(array $files = null)
{
	//New from media library and file structure
	$result = array();

	if (empty($files))
	{
		$files = $this->request->get($this->inputName);
	}
	if(!is_array($files))
	{
		return $result;
	}

	foreach($files as $index => $value)
	{
		if (is_string($value) && preg_match("/^https?:\\/\\//", $value))
		{
			$result[$index] = \CFile::MakeFileArray($value);
		}
		else
		{
			if(is_array($value))
			{
				$filePath = $value['tmp_name'];
			}
			else
			{
				$filePath = $value;
			}

			$checkResult = self::checkAbsolutePath($filePath);

			if(is_null($checkResult))
			{
				continue;
			}

			if($checkResult['isSuccess'])
			{
				$io = \CBXVirtualIo::GetInstance();
				$result[$index] = \CFile::MakeFileArray($io->GetPhysicalName($checkResult['absPath']));
				if(is_array($value))
				{
					$result[$index]['name'] = $value['name'];
				}
			}

		}
	}

	return $result;
}