You are here

function advagg_current_hooks_hash_array in Advanced CSS/JS Aggregation 7.2

Same name and namespace in other branches
  1. 8.2 advagg.module \advagg_current_hooks_hash_array()

Get an array of all hooks and settings that affect aggregated files contents.

Return value

array array('variables' => array(...), 'hooks' => array(...))

15 calls to advagg_current_hooks_hash_array()
advagg_admin_info_form in ./advagg.admin.inc
Form builder; Show info about advagg and advagg settings.
advagg_advagg_get_info_on_files_alter in ./advagg.advagg.inc
Implements hook_advagg_get_info_on_files_alter().
advagg_context_switch in ./advagg.inc
Changes context when generating CSS or JS files.
advagg_does_js_start_with_use_strict in ./advagg.inc
Given a js string, see if "use strict"; is the first thing ran.
advagg_generate_filesize_processed in ./advagg.inc
Given a filename calculate the processed filesize.

... See full list

1 string reference to 'advagg_current_hooks_hash_array'
advagg_push_new_changes in ./advagg.cache.inc
Flush the correct caches so CSS/JS changes go live.

File

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

Code

function advagg_current_hooks_hash_array() {
  $aggregate_settings =& drupal_static(__FUNCTION__);
  if (!empty($aggregate_settings)) {
    return $aggregate_settings;
  }
  list($css_path, $js_path) = advagg_get_root_files_dir();

  // Put all enabled hooks and settings into a big array.
  $aggregate_settings = array(
    'variables' => array(
      'advagg_gzip' => variable_get('advagg_gzip', ADVAGG_GZIP),
      'advagg_brotli' => variable_get('advagg_brotli', ADVAGG_BROTLI),
      'advagg_no_zopfli' => variable_get('advagg_no_zopfli', ADVAGG_NO_ZOPFLI),
      'is_https' => $GLOBALS['is_https'],
      'advagg_global_counter' => advagg_get_global_counter(),
      'base_path' => $GLOBALS['base_path'],
      'advagg_ie_css_selector_limiter' => variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER),
      'advagg_ie_css_selector_limiter_value' => variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE),
      'advagg_scripts_scope_anywhere' => variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE),
      'advagg_devel' => variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0 ? TRUE : FALSE,
      'advagg_convert_absolute_to_relative_path' => variable_get('advagg_convert_absolute_to_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_RELATIVE_PATH),
      'advagg_convert_absolute_to_protocol_relative_path' => variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH),
      'advagg_css_absolute_path' => variable_get('advagg_css_absolute_path', ADVAGG_CSS_ABSOLUTE_PATH),
      'advagg_force_https_path' => variable_get('advagg_force_https_path', ADVAGG_FORCE_HTTPS_PATH),
      'advagg_css_dir' => $css_path[0],
      'advagg_js_dir' => $js_path[0],
    ),
    'hooks' => advagg_hooks_implemented(FALSE),
  );

  // Add in language if locale is enabled.
  if (module_exists('locale')) {
    $aggregate_settings['variables']['language'] = isset($GLOBALS['language']->language) ? $GLOBALS['language']->language : '';
  }

  // Add the base url if so desired to.
  if (variable_get('advagg_include_base_url', ADVAGG_INCLUDE_BASE_URL)) {
    $aggregate_settings['variables']['base_url'] = $GLOBALS['base_url'];
  }

  // CDN module settings.
  // Patch in https://www.drupal.org/node/1942230#comment-7927171 is fine
  // on a technical level but I got frustrated with all the reports about it not
  // working with no good reason as to why it doesn't work.
  if (!function_exists('cdn_advagg_current_hooks_hash_array_alter') && module_exists('cdn')) {
    $aggregate_settings['variables'][CDN_MODE_VARIABLE] = variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC);
    $aggregate_settings['variables'][CDN_BASIC_FARFUTURE_VARIABLE] = variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT);
    $aggregate_settings['variables'][CDN_HTTPS_SUPPORT_VARIABLE] = variable_get(CDN_HTTPS_SUPPORT_VARIABLE, FALSE);
    $aggregate_settings['variables'][CDN_STATUS_VARIABLE] = variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED);
    $aggregate_settings['variables']['cdn_request_is_https'] = cdn_request_is_https();
    $aggregate_settings['variables']['cdn_check_drupal_path'] = cdn_check_drupal_path($_GET['q']);
  }

  // Allow other modules to add in their own settings and hooks.
  // Call hook_advagg_current_hooks_hash_array_alter().
  drupal_alter('advagg_current_hooks_hash_array', $aggregate_settings);
  return $aggregate_settings;
}