• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/urlmanager.php
  • Класс: BitrixDiskUrlManager
  • Вызов: UrlManager::getHostUrl
public function getHostUrl()
{
	$protocol = (CMain::isHTTPS() ? 'https' : 'http');
	if (defined("SITE_SERVER_NAME") && SITE_SERVER_NAME)
	{
		$host = SITE_SERVER_NAME;
	}
	else
	{
		$host =
			Option::get('main', 'server_name', Context::getCurrent()->getServer()->getHttpHost())?:
				Context::getCurrent()->getServer()->getHttpHost()
		;
	}

	$port = Context::getCurrent()->getServer()->getServerPort();
	if($port <> 80 && $port <> 443 && $port > 0 && mb_strpos($host, ':') === false)
	{
		$host .= ':'.$port;
	}
	elseif($protocol == 'http' && $port == 80)
	{
		$host = str_replace(':80', '', $host);
	}
	elseif($protocol == 'https' && $port == 443)
	{
		$host = str_replace(':443', '', $host);
	}

	return $protocol . '://' . $host;
}