function ldap_servers_get_globals in LDAP Single Sign On 7.2
Used to mock $_SERVER, $_SESSION, etc globals for simpletests.
Parameters
string $global_type: _SERVER, _ENV, _COOKIE, _GET, _POST, _REQUEST.
string $key: Such as 'SERVER_ADDR', 'SERVER_PROTOCOL', etc.
bool $only_mock_values: Don't get actual values when mock values don't exist.
Return value
mixed ldap_simpletest_globals variable for global and key or $_SERVER[][], $_ENV[][], etv value if not in a simpletest or mock variable not available.
2 calls to ldap_servers_get_globals()
- ldap_sso_path_excluded_from_sso in ./
ldap_sso.module - Paths excluded from SSO.
- ldap_sso_user_login_sso in ./
ldap_sso.module - A proxy function for the actual authentication routine.
File
- ./
ldap_sso.module, line 381 - This module injects itself into Drupal's Authentication stack.
Code
function ldap_servers_get_globals($global_type, $key, $only_mock_values = FALSE) {
$simpletest_globals = variable_get('ldap_simpletest_globals', array());
$simpletest = variable_get('ldap_simpletest', FALSE);
if ($simpletest && (isset($simpletest_globals[$global_type][$key]) || $only_mock_values)) {
return $simpletest_globals[$global_type][$key] ? $simpletest_globals[$global_type][$key] : NULL;
}
else {
return isset($GLOBALS[$global_type][$key]) && !$only_mock_values ? $GLOBALS[$global_type][$key] : NULL;
}
}