Revert "Url: Add support macros"
This reverts commit 33231d24da
.
There is no need for url macros, since we're handling absolute
urls correctly now.
This commit is contained in:
parent
33231d24da
commit
81e13109fc
|
@ -142,7 +142,7 @@ class Url
|
||||||
return $urlObject;
|
return $urlObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlParts = parse_url(static::resolveUrlMacros($url));
|
$urlParts = parse_url($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,33 +189,6 @@ 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