function hidden_language_init in Hidden Language 7
Implements hook_init().
File
- ./
hidden_language.module, line 6
Code
function hidden_language_init() {
global $language;
$access_hidden_language = user_access('access all hidden languages') || user_access("access hidden language {$language->language}");
// Check if Drush executed this request.
$is_drush = drupal_is_cli() && function_exists('drush_main');
// Check if current path is user login form.
$path = current_path();
$is_user_page = user_is_anonymous() && (in_array($path, array(
'user',
'user/login',
'user/password',
)) || fnmatch('user/reset/*', $path));
if (isset($language->hidden) && $language->hidden && !$access_hidden_language && !$is_drush && !$is_user_page) {
drupal_access_denied();
drupal_exit();
}
}