public function ServicesClientOAuthRequest::get_normalized_http_url in Services Client 7
Same name and namespace in other branches
- 7.2 services_client_connection/modules/services_client_oauth/plugins/ServicesClientOAuthRequest.inc \ServicesClientOAuthRequest::get_normalized_http_url()
parses the url and rebuilds it to be scheme://host/path
File
- services_client_connection/
modules/ services_client_oauth/ plugins/ ServicesClientOAuthRequest.inc, line 49
Class
Code
public function get_normalized_http_url($use_force_port = TRUE) {
$parts = parse_url($this->http_url);
$scheme = isset($parts['scheme']) ? $parts['scheme'] : 'http';
$port = isset($parts['port']) ? $parts['port'] : ($scheme == 'https' ? '443' : '80');
$host = isset($parts['host']) ? $parts['host'] : '';
$path = isset($parts['path']) ? $parts['path'] : '';
if ($scheme == 'https' && $port != '443' || $scheme == 'http' && $port != '80') {
$host = "{$host}:{$port}";
}
if ($use_force_port && $this->force_port) {
$host = "{$host}:{$this->force_port}";
}
return "{$scheme}://{$host}{$path}";
}