Add adapter for kannel phones

This commit is contained in:
osaajani 2021-11-05 23:26:09 +01:00
parent 69bf62f115
commit a39c9577b1
7 changed files with 512 additions and 2 deletions

View file

@ -372,4 +372,24 @@ namespace controllers\internals;
return $new_dir;
}
/**
* Forge back an url parsed with PHP parse_url function
*
* @param array $parsed_url : Parsed url returned by parse_url function
* @return string : The url as a string
*/
public static function unparse_url(array $parsed_url)
{
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
$pass = ($user || $pass) ? "$pass@" : '';
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
return "$scheme$user$pass$host$port$path$query$fragment";
}
}