function disclaimer_init in Disclaimer 6
Same name and namespace in other branches
- 6.2 disclaimer.module \disclaimer_init()
Implementation of hook_init().
File
- ./
disclaimer.module, line 43 - Create and show disclaimer for your site. Visotors need js enabled and accept cookie
Code
function disclaimer_init() {
global $user;
if ((!user_access('bypass disclaimer') || variable_get('disclaimer_logged', 1) == 1 && $user->uid) && _disclaimer_visibility() == 1) {
$path = drupal_get_path('module', 'disclaimer');
$modal = variable_get('disclaimer_modal', 'thickbox');
switch ($modal) {
case 'nyroModal':
$path_css = '/nyroModal/styles/nyroModal.css';
$path_js = '/nyroModal/js/jquery.nyroModal.js';
break;
case 'jqModal':
$path_css = '/jqModal/jqModal.css';
$path_js = '/jqModal/jqModal.js';
break;
case 'thickbox':
$path_css = FALSE;
$path_js = FALSE;
break;
}
if (file_exists($path . $path_css)) {
drupal_add_css(drupal_get_path('module', 'disclaimer') . $path_css);
}
if (file_exists($path . $path_js)) {
drupal_add_js(drupal_get_path('module', 'disclaimer') . $path_js);
}
drupal_add_js(drupal_get_path('module', 'disclaimer') . '/disclaimer.js', 'module', variable_get('disclaimer_location_js', 'header'));
drupal_add_js(_disclaimer_get_js(), 'inline', variable_get('disclaimer_location_js', 'header'));
}
}