*/
function cleanup_url($url)
{
- $obj_url = new Url($url);
- return $obj_url->cleanup();
+ $obj_url = new Url($url);
+ return $obj_url->cleanup();
}
/**
*/
function get_url_scheme($url)
{
- $obj_url = new Url($url);
- return $obj_url->getScheme();
+ $obj_url = new Url($url);
+ return $obj_url->getScheme();
}
/**
// Protocol not allowed: we remove it and replace it with http
if ($protocol === 1 && ! in_array($match[1], $protocols)) {
$url = str_replace($match[0], 'http://', $url);
- } else if ($protocol !== 1) {
+ } elseif ($protocol !== 1) {
$url = 'http://' . $url;
}
return $url;
}
$this->parts['query'] = implode('&', $queryParams);
- }
+ }
/**
* Removes undesired fragments
if (! function_exists('idn_to_ascii') || ! isset($this->parts['host'])) {
return $out;
}
- $asciiHost = idn_to_ascii($this->parts['host']);
+ $asciiHost = idn_to_ascii($this->parts['host'], 0, INTL_IDNA_VARIANT_UTS46);
return str_replace($this->parts['host'], $asciiHost, $out);
}
*
* @return string the URL scheme or false if none is provided.
*/
- public function getScheme() {
+ public function getScheme()
+ {
if (!isset($this->parts['scheme'])) {
return false;
}
*
* @return string the URL host or false if none is provided.
*/
- public function getHost() {
+ public function getHost()
+ {
if (empty($this->parts['host'])) {
return false;
}
*
* @return true is HTTP, false otherwise.
*/
- public function isHttp() {
+ public function isHttp()
+ {
return strpos(strtolower($this->parts['scheme']), 'http') !== false;
}
}