domain_get_path

Definition

domain_get_path($domain)
domain.module, line 567

Description

Determine an absolute path for a domain

Parameters

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

Code

function domain_get_path($domain) {
  global $base_url;
  $_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['scheme'] .'://'. $domain['subdomain'] . $_url['path'];
  return $path;
}