You are here

function domain_get_path in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain.module \domain_get_path()
  2. 7.3 domain.module \domain_get_path()
  3. 7.2 domain.module \domain_get_path()

Determine an absolute path for a domain

Parameters

$domain: The currently active $domain array, provided by domain_lookup().

2 calls to domain_get_path()
domain_check_response in ./domain_admin.inc
Checks to see if the webserver returns a valid response for a request to a domain.
domain_domainload in ./domain.module
Implement hook_domainload()
1 string reference to 'domain_get_path'
domain_nav_render in domain_nav/domain_nav.module
Renders output for the block.

File

./domain.module, line 594
Core module functions for the Domain Access suite.

Code

function domain_get_path($domain) {
  global $base_url;
  if (empty($base_url)) {
    return domain_check_scheme($domain['scheme']) . '://' . $domain['subdomain'];
  }
  $_url = parse_url($base_url);

  // PHP 5 does not return an empty path element.
  if (!isset($_url['path'])) {
    $_url['path'] = '/';
  }

  // We need a trailing slash at the end of the path
  if (substr($_url['path'], -1) != '/') {
    $_url['path'] .= '/';
  }
  $path = domain_check_scheme($domain['scheme']) . '://' . $domain['subdomain'] . $_url['path'];
  return $path;
}