You are here

function admin_menu_js_callback_cache_deliver in Administration menu 7.3

Delivery callback for the admin_menu "cache" Ajax callback.

Parameters

string $page_callback_result: THe page callback result.

See also

admin_menu_js_callback_cache()

2 string references to 'admin_menu_js_callback_cache_deliver'
admin_menu_js_info in ./admin_menu.module
Implements hook_js_info().
admin_menu_menu in ./admin_menu.module
Implements hook_menu().

File

./admin_menu.module, line 492
Render an administrative menu as a dropdown menu at the top of the window.

Code

function admin_menu_js_callback_cache_deliver($page_callback_result) {
  global $language;

  // If callback has reached this point, there was no page cache.
  header('X-Drupal-Cache: MISS');

  // The Expires HTTP header is the heart of the client-side HTTP caching. The
  // additional server-side page cache only takes effect when the client
  // accesses the callback URL again (e.g., after clearing the browser cache or
  // when force-reloading a Drupal page).
  $max_age = 3600 * 24 * 365;
  drupal_add_http_header('Expires', gmdate(DATE_RFC1123, REQUEST_TIME + $max_age));
  drupal_add_http_header('Cache-Control', 'private, max-age=' . $max_age);

  // Indicate that this content is HTML.
  drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');

  // Send appropriate language header for browsers.
  drupal_add_http_header('Content-Language', $language->language);

  // Capture content for page cache (minus hook_boot and drupal_page_header).
  // @see _drupal_bootstrap_page_header()
  ob_start();

  // The $page_callback_result value is always a string returned from
  // admin_menu_output(); just print it.
  print $page_callback_result;

  // Finish end of request (minus hook_exit and cron).
  // @see drupal_page_footer()
  drupal_session_commit();
  if (variable_get('cache', 0) && ($cache = drupal_page_set_cache())) {
    drupal_serve_page_from_cache($cache);
  }
  else {
    ob_flush();
  }
  _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE);
  drupal_cache_system_paths();
  module_implements_write_cache();
}