function ajaxblocks_page_cacheable in Ajax Blocks 6
Same name and namespace in other branches
- 7 ajaxblocks.module \ajaxblocks_page_cacheable()
Returns TRUE if current page will be cached (for anonymous or for authenticated users) by Drupal core or by contrib modules (boost and authcache are supported).
1 call to ajaxblocks_page_cacheable()
- ajaxblocks_preprocess_block in ./
ajaxblocks.module - Implements hook_preprocess_block().
File
- ./
ajaxblocks.module, line 300 - Loads dynamic blocks on cached page for anonymous users by performing AJAX request.
Code
function ajaxblocks_page_cacheable() {
static $page_cacheable = NULL;
if (!is_null($page_cacheable)) {
return $page_cacheable;
}
if ($_SERVER['REQUEST_METHOD'] != 'GET' || count(drupal_set_message()) > 0 || $_SERVER['SERVER_SOFTWARE'] === 'PHP CLI') {
$page_cacheable = FALSE;
return $page_cacheable;
}
if (module_exists('boost') && isset($GLOBALS['_boost_cache_this']) && $GLOBALS['_boost_cache_this']) {
//TODO check 403 and 404 for Boost: boost_get_http_status 403 404 for anon -> uncached
$page_cacheable = TRUE;
return $page_cacheable;
}
if (module_exists('authcache') && isset($GLOBALS['is_page_authcache']) && $GLOBALS['is_page_authcache']) {
//TODO check 403 and 404 for authcache: (variable_get('authcache_http200', FALSE) && _authcache_get_http_status() != 200)
$page_cacheable = TRUE;
return $page_cacheable;
}
$page_cacheable = $GLOBALS['user']->uid == 0 && variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED;
return $page_cacheable;
}