You are here

function adserve_cache_build_hooks in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 adcache.inc \adserve_cache_build_hooks()
  2. 6.2 adcache.inc \adserve_cache_build_hooks()
  3. 7 adcache.inc \adserve_cache_build_hooks()

Helper function to build hook tree.

File

./adcache.inc, line 192

Code

function adserve_cache_build_hooks($cache) {
  $return = array();
  if (is_array($cache)) {
    foreach ($cache as $module => $hooks) {

      // supported cache hooks
      foreach (array(
        'hook_init',
        'hook_filter',
        'hook_weight',
        'hook_select',
        'hook_init_text',
        'hook_exit_text',
        'hook_increment_extra',
      ) as $hook) {
        if (is_array($hooks[$hook])) {
          $weight = isset($hooks[$hook]['weight']) ? (int) $hooks[$hook]['weight'] : 0;
          $return[$hook]['file'][$weight][] = $hooks[$hook]['file'];
          $return[$hook]['function'][$weight][] = $hooks[$hook]['function'];
        }
      }
    }
  }
  return $return;
}