You are here

function cdn_init in CDN 6.2

Same name and namespace in other branches
  1. 7.2 cdn.module \cdn_init()

Implementation of hook_init().

File

./cdn.module, line 395

Code

function cdn_init() {
  if (!cdn_status_is_enabled()) {
    return;
  }
  _cdn_prefetch_dns();

  // We only need to override CSS aggregation if the advagg module is not in
  // use; otherwise that module handles that perfectly fine already!
  $mode = variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC);
  if ($mode == CDN_MODE_BASIC && !module_exists('advagg')) {
    cdn_load_include('basic.css');
  }
  if (variable_get(CDN_THEME_LAYER_FALLBACK_VARIABLE, FALSE)) {
    cdn_load_include('fallback');
  }

  // When per-page statistics are enabled, add the CSS that will be used to
  // make these statistics more usable.
  if (variable_get(CDN_STATS_VARIABLE, FALSE) && user_access(CDN_PERM_ACCESS_STATS)) {
    drupal_add_css(drupal_get_path('module', 'cdn') . '/cdn.css');
  }
}