You are here

function themekey_system_themekey_global in ThemeKey 7

Same name and namespace in other branches
  1. 6.4 modules/themekey.system.inc \themekey_system_themekey_global()
  2. 6 modules/themekey.system.inc \themekey_system_themekey_global()
  3. 6.2 modules/themekey.system.inc \themekey_system_themekey_global()
  4. 6.3 modules/themekey.system.inc \themekey_system_themekey_global()
  5. 7.3 modules/themekey.system.inc \themekey_system_themekey_global()
  6. 7.2 modules/themekey.system.inc \themekey_system_themekey_global()

Implements hook_themekey_global().

File

modules/themekey.system.inc, line 320
Provides some ThemeKey properties.

Code

function themekey_system_themekey_global() {
  global $user;
  $parameters = array();
  $parameters['system:host'] = $_SERVER['HTTP_HOST'];
  $parameters['drupal:get_q'] = themekey_get_q();
  $parameters['system:server_ip'] = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : NULL;
  $parameters['system:server_port'] = !empty($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : NULL;
  $parameters['system:server_name'] = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : NULL;

  // Note that when using ISAPI with IIS, the value will be 'off' if the request was not made through the HTTPS protocol.
  $parameters['system:https'] = !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS'] ? 'true' : 'false';
  $parameters['system:remote_ip'] = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : NULL;
  $parameters['system:referer'] = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL;
  $parameters['system:user_agent'] = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL;
  $parameters['system:dummy'] = 'dummy';
  $parameters['system:random'] = rand(0, 1);
  $parameters['drupal:base_path'] = base_path();
  $parameters['drupal:is_front_page'] = drupal_is_front_page() ? 'true' : 'false';
  return $parameters;
}