You are here

function popup_onload_init in Popup On Load 7

Implements hook_init().

File

./popup_onload.module, line 117
Contains main popup_onload hooks and functions.

Code

function popup_onload_init() {

  // Check if colorbox library is installed.
  $library_colorbox = libraries_detect('colorbox');
  if ($library_colorbox['installed']) {

    // Prevent popup from displaying on admin pages, if it is not explicitly
    // overriden by include paths settings.
    if (popup_onload_check_path()) {

      // Is normal popup flow enabled.
      if (!variable_get(POPUP_ONLOAD_VAR_USE_RULES, FALSE)) {
        if ($popup_onload = popup_onload_choose_popup()) {
          if (popup_onload_check_display_conditions($popup_onload)) {
            $popup_settings = popup_onload_prepare_popup($popup_onload);
            popup_onload_add_popup($popup_settings);
          }
        }
      }
      elseif (module_exists('rules')) {
        if ($popup_onload = popup_onload_choose_popup()) {
          rules_invoke_event('popup_onload_event_choose_popup', $popup_onload);
        }
      }
    }
  }
}