You are here

function advagg_init in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg.module \advagg_init()

Implementation of hook_init().

File

./advagg.module, line 347
Advanced CSS/JS aggregation module

Code

function advagg_init() {
  global $base_path, $conf, $_advagg;

  // Disable advagg if requested.
  if (isset($_GET['advagg']) && $_GET['advagg'] == -1 && user_access('bypass advanced aggregation')) {
    $conf['advagg_enabled'] = FALSE;
    $conf['advagg_use_full_cache'] = FALSE;
  }

  // Enable debugging if requested.
  if (isset($_GET['advagg-debug']) && $_GET['advagg-debug'] == 1 && user_access('bypass advanced aggregation')) {
    $conf['advagg_debug'] = TRUE;
    $conf['advagg_use_full_cache'] = FALSE;
  }

  // Enable core preprocessing if requested.
  if (isset($_GET['advagg-core']) && $_GET['advagg-core'] == 1 && user_access('bypass advanced aggregation')) {
    $conf['preprocess_css'] = TRUE;
    $conf['preprocess_js'] = TRUE;
    $conf['advagg_use_full_cache'] = FALSE;
  }

  // Include the ctools_ajax_run_page_preprocess() function.
  if (function_exists('ctools_include')) {
    ctools_include('ajax');
  }

  // Disable ctools_ajax_page_preprocess() if this functionality is available.
  if (variable_get('advagg_enabled', ADVAGG_ENABLED) && function_exists('ctools_ajax_run_page_preprocess')) {
    ctools_ajax_run_page_preprocess(FALSE);
    $_advagg['ctools_patched'] = TRUE;
  }
}