diff options
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/minz/Url.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/minz/Url.php b/lib/minz/Url.php index c1c3e9a0f..9bda98363 100755 --- a/lib/minz/Url.php +++ b/lib/minz/Url.php @@ -16,25 +16,21 @@ class Url { * @param $encodage pour indiquer comment encoder les & (& ou & pour html) * @return l'url formatée */ - public static function display ($url = array (), $encodage = 'html') { + public static function display ($url = array (), $encodage = 'html', $absolute = false) { $url = self::checkUrl ($url); $url_string = ''; - if (is_array ($url) && isset ($url['protocol'])) { - $protocol = $url['protocol']; - } else { - if(isset($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == 'on') { - $protocol = 'https'; - } else { - $protocol = 'http'; - } + if ($absolute) { + $protocol = (is_array ($url) && isset ($url['protocol'])) ? ($url['protocol'] . ':') : ''; //Empty protocol will use automatic http or https + $url_string = $protocol + . '//' + . Request::getDomainName () + . Request::getBaseUrl (); + } + else { + $url_string = '.'; } - $url_string .= $protocol . '://'; - - $url_string .= Request::getDomainName (); - - $url_string .= Request::getBaseUrl (); if (is_array ($url)) { $router = new Router (); |
