You are here

function securepages_baseurl in Secure Pages 5

Same name and namespace in other branches
  1. 6.2 securepages.module \securepages_baseurl()
  2. 6 securepages.module \securepages_baseurl()
  3. 7 securepages.module \securepages_baseurl()

Return the secure base path

2 calls to securepages_baseurl()
securepages_init in ./securepages.module
Implementation of hook_init()
securepages_url in ./securepages.module
Generate a URL from a Drupal menu path. Will also pass-through existing URLs.

File

./securepages.module, line 346

Code

function securepages_baseurl($secure = TRUE) {
  global $base_url;
  if ($secure) {
    $url = variable_get('securepages_basepath_ssl', NULL);
  }
  else {
    $url = variable_get('securepages_basepath', NULL);
  }
  if (!empty($url)) {
    return $url;
  }

  // No url has been set, so convert the base_url from 1 to the other
  return preg_replace('/http[s]?:\\/\\//i', $secure ? 'https://' : 'http://', $base_url, 1);
}