You are here

function securepages_baseurl in Secure Pages 6.2

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

Returns the secure base path.

3 calls to securepages_baseurl()
securepages_form_alter in ./securepages.module
Implements hook_form_alter().
securepages_goto in ./securepages.module
Redirects the current page to the secure or insecure version.
securepages_redirect in ./securepages.module
Checks the current page and see if we need to redirect to the secure or insecure version of the page.

File

./securepages.module, line 254
Provide method of creating allowing certain pages to only viewable from https pages

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);
}