You are here

function authcache_authcache_ajax in Authenticated User Page Caching (Authcache) 7

Same name and namespace in other branches
  1. 6 authcache.module \authcache_authcache_ajax()

Implements hook_authcache_ajax().

Modifies footer JSON for Ajax call.

File

./authcache.module, line 698
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_authcache_ajax() {
  global $user;
  $authcache_ajax = array();
  $node = arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '' ? node_load(arg(1)) : FALSE;

  // @see node.module
  if ($user->uid && $node) {
    $authcache_ajax['node_history'] = arg(1);
  }

  // @see contact.module
  if ($user->uid && arg(0) == 'contact') {
    $authcache_ajax['contact'] = 1;
  }

  // @see statistics.module
  if (module_exists('statistics')) {
    if ($node && variable_get('statistics_count_content_views', 0)) {
      $authcache_ajax['statistics'] = 1;
    }
    if (variable_get('statistics_enable_access_log', 0) && module_invoke('throttle', 'status') == 0) {
      $authcache_ajax['statistics'] = 1;
    }
  }
  return $authcache_ajax;
}