You are here

function disclaimer_init in Disclaimer 6.2

Same name and namespace in other branches
  1. 6 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) {

    // settings
    $settings = array(
      // common
      'url' => base_path() . 'disclaimer',
      'content' => _disclaimer_get_content(),
      'modal' => variable_get('disclaimer_modal', 'thickbox'),
      'cookie_path' => variable_get('disclaimer_cookie_path', '/'),
      'cookie_domain' => variable_get('disclaimer_cookie_domain', NULL),
      'width' => variable_get('disclaimer_width', '400px'),
      'height' => variable_get('disclaimer_height', '300px'),
      // colorbox
      'opacity' => variable_get('disclaimer_overlay', 0.85),
      'speed' => variable_get('disclaimer_speed', 350),
      'transition' => variable_get('disclaimer_transition', 'elastic'),
    );

    //dsm($settings);
    drupal_add_js(array(
      'disclaimer' => $settings,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'disclaimer') . '/disclaimer.js', 'module', variable_get('disclaimer_location_js', 'header'));
  }
}