function domain_request_name in Domain Access 6.2
Same name and namespace in other branches
- 7.3 domain.module \domain_request_name()
- 7.2 domain.module \domain_request_name()
Determines current, fully qualified domain name.
Relies on $_SERVER['HTTP_HOST'] being set. Note that this value has already been security checked by Drupal core. Otherwise, we never get this far.
Return value
The current (host) domain name as a string, or the default domain if no host value was passed by the request.
See also
1 call to domain_request_name()
- domain_resolve_host in ./
domain.module - Tries to match the current (host) domain name to a domain in the {domain} table and returns a respective domain_id.
File
- ./
domain.module, line 2265 - Core module functions for the Domain Access suite.
Code
function domain_request_name() {
// An empty host (provided by some bots) always fails, so don't bother
// trying to resolve it.
if (empty($_SERVER['HTTP_HOST'])) {
$domain = domain_default(FALSE, FALSE);
return $domain['subdomain'];
}
// Otherwise, trim and return the HTTP_HOST value for checking against
// registered domains. Note that we lower case this, since the RFC states
// that EXAMPLE.com == example.com.
return strtolower(rtrim($_SERVER['HTTP_HOST']));
}