parent
7321d67b4f
commit
33231d24da
|
@ -142,7 +142,7 @@ class Url
|
||||||
return $urlObject;
|
return $urlObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlParts = parse_url($url);
|
$urlParts = parse_url(static::resolveUrlMacros($url));
|
||||||
if (isset($urlParts['scheme']) && $urlParts['scheme'] !== $request->getScheme()) {
|
if (isset($urlParts['scheme']) && $urlParts['scheme'] !== $request->getScheme()) {
|
||||||
$baseUrl = $urlParts['scheme'] . '://' . $urlParts['host'] . (isset($urlParts['port'])
|
$baseUrl = $urlParts['scheme'] . '://' . $urlParts['host'] . (isset($urlParts['port'])
|
||||||
? (':' . $urlParts['port'])
|
? (':' . $urlParts['port'])
|
||||||
|
@ -189,6 +189,33 @@ class Url
|
||||||
return $urlObject;
|
return $urlObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the given url with all macros being resolved
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function resolveUrlMacros($url)
|
||||||
|
{
|
||||||
|
$serverName = static::getRequest()->getServer('SERVER_NAME');
|
||||||
|
$macros = array(
|
||||||
|
'HTTP_AUTHORITY' => 'http://' . $serverName,
|
||||||
|
'HTTPS_AUTHORITY' => 'https://' . $serverName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (preg_match_all('@\$([^\$\s]+)\$@', $url, $matches)) {
|
||||||
|
foreach ($matches[1] as $macroIndex => $macroName) {
|
||||||
|
if (isset($macros[$macroName])) {
|
||||||
|
$placeholder = $matches[0][$macroIndex];
|
||||||
|
$url = str_replace($placeholder, $macros[$macroName], $url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new filter that needs to fullfill the base filter and the optional filter (if it exists)
|
* Create a new filter that needs to fullfill the base filter and the optional filter (if it exists)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue