function _extlink_extra_http_build_url in External Links Extra 8
Builds a full URL from the separate parts.
Parameters
array $parts: The array of URL parts.
Return value
string The full URL as constructed from the parts.
1 call to _extlink_extra_http_build_url()
- _extlink_extra_encode_url_parts in ./
extlink_extra.module - Encodes all parts of an URL.
File
- ./
extlink_extra.module, line 207
Code
function _extlink_extra_http_build_url($parts) {
// Unfortunately http_build_url() isn't always available but we will use it
// when available.
if (function_exists('http_build_url')) {
$url = http_build_url($parts);
}
else {
// Base URL starting with URI scheme.
$url = $parts['scheme'] . '://' . $parts['host'];
// Add the path if available.
if (!empty($parts['path'])) {
$url .= $parts['path'];
}
// Add the query string if available.
if (!empty($parts['query'])) {
$url .= '?' . UrlHelper::buildQuery($parts['query']);
}
// Add the fragment if available.
if (!empty($parts['fragment'])) {
$url .= '#' . $parts['fragment'];
}
}
return $url;
}