本文整理汇总了PHP中Auth_OpenID::urlunparse方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth_OpenID::urlunparse方法的具体用法?PHP Auth_OpenID::urlunparse怎么用?PHP Auth_OpenID::urlunparse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth_OpenID
的用法示例。
在下文中一共展示了Auth_OpenID::urlunparse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalizeUrl
/**
* Given a URL, this "normalizes" it by adding a trailing slash
* and / or a leading http:// scheme where necessary. Returns
* null if the original URL is malformed and cannot be normalized.
*
* @access private
* @param string $url The URL to be normalized.
* @return mixed $new_url The URL after normalization, or null if
* $url was malformed.
*/
function normalizeUrl($url)
{
if ($url === null) {
return null;
}
assert(is_string($url));
$old_url = $url;
$url = trim($url);
if (strpos($url, "://") === false) {
$url = "http://" . $url;
}
$parsed = @parse_url($url);
if ($parsed === false) {
return null;
}
$defaults = array('scheme' => '', 'host' => '', 'path' => '', 'query' => '', 'fragment' => '', 'port' => '');
$parsed = array_merge($defaults, $parsed);
if ($parsed['scheme'] == '' || $parsed['host'] == '') {
if ($parsed['path'] == '' && $parsed['query'] == '' && $parsed['fragment'] == '') {
return null;
}
$url = 'http://' + $url;
$parsed = parse_url($url);
$parsed = array_merge($defaults, $parsed);
}
$tail = array_map(array('Auth_OpenID', 'quoteMinimal'), array($parsed['path'], $parsed['query'], $parsed['fragment']));
if ($tail[0] == '') {
$tail[0] = '/';
}
$url = Auth_OpenID::urlunparse($parsed['scheme'], $parsed['host'], $parsed['port'], $tail[0], $tail[1], $tail[2]);
assert(is_string($url));
return $url;
}