function admin_menu_js_callback_cache in Administration menu 7.3
Implements MODULE_js_callback_HOOK().
1 string reference to 'admin_menu_js_callback_cache'
- admin_menu_menu in ./
admin_menu.module - Implements hook_menu().
File
- ./
admin_menu.module, line 450 - Render an administrative menu as a dropdown menu at the top of the window.
Code
function admin_menu_js_callback_cache() {
global $conf, $devel_shutdown;
// Suppress Devel module.
$devel_shutdown = FALSE;
// Force core page caching.
$conf['cache'] = 1;
drupal_page_is_cacheable(TRUE);
// Normalize the URL. Remove any /js prefix and query parameters.
// Because the callback is GET, all passed parameters (like the parameters
// for the JS module) will be appended to the URL as query parameters. This,
// unfortunately, can cause issues down the road. It's better to just strip
// them off the request URL path now so page cache can function reliably.
$url = preg_replace('/^' . preg_quote(base_path() . 'js', '/') . '/', '', parse_url(request_uri(), PHP_URL_PATH));
$_SERVER['REQUEST_URI'] = $url;
// If there is a page cache, serve it.
// @see _drupal_bootstrap_page_cache()
$cache = drupal_page_get_cache();
if (is_object($cache)) {
header('X-Drupal-Cache: HIT');
// Restore the metadata cached with the page.
$_GET['q'] = $cache->data['path'];
date_default_timezone_set(drupal_get_user_timezone());
drupal_serve_page_from_cache($cache);
exit;
}
// Otherwise, build the admin menu output.
return admin_menu_output();
}