You are here

function authcache_authcache_info in Authenticated User Page Caching (Authcache) 6

Same name and namespace in other branches
  1. 7 authcache.module \authcache_authcache_info()

Implements hook_authcache_info().

Modifies footer JSON for JavaScript info.

File

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

Code

function authcache_authcache_info() {
  global $user;
  $authcache_info = array();
  $node = arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '' ? node_load(arg(1)) : FALSE;
  if ($node) {
    if ($user->uid) {
      $authcache_info['node_author'] = $node->name;
    }

    // Comment functionality for users
    if ($user->uid && $node->comment_count) {
      $authcache_info['t']['new'] = t('new');

      // "new" marker
      $authcache_info['t']['edit'] = t('edit');

      // "edit" marker
      $authcache_info['comment_usertime'] = node_last_viewed($node->nid);

      // For first page request and to inform JS phase that comments exist
    }
  }

  // Debug mode by user only
  if (!variable_get('authcache_debug_all', FALSE) && $user->uid && ($debug_users = variable_get('authcache_debug_users', array()))) {
    $authcache_info['debug_users'] = $debug_users;
  }
  return $authcache_info;
}