You are here

function domain_request_name in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain.module \domain_request_name()
  2. 7.3 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.

See also

conf_init()

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 2407
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']));
}