You are here

function boost_get_header_info in Boost 7

Gets and parses the header info.

Return value

array Contains info about the page that is about to be sent.

See also

drupal_send_headers()

4 calls to boost_get_header_info()
boost_block_flush_form_submit in ./boost.blocks.inc
boost_block_view_status in ./boost.blocks.inc
@file Prints the cache status of the currently displayed page.
boost_exit in ./boost.module
Implements hook_exit().
boost_expire_cache in ./boost.module
Implements hook_expire_cache (from the 'expire' module)

File

./boost.module, line 1039
Caches generated output as a static file to be served directly from the webserver.

Code

function boost_get_header_info() {
  $headers = drupal_get_http_header();
  $status = '200 OK';
  $status_number = '200';
  $content_type = 'text/html; charset=utf-8';
  $content_type_basic = 'text/html';
  $charset = 'utf-8';
  foreach ($headers as $name_lower => $value) {
    if ($name_lower === 'status') {
      $status = $value;
    }
    elseif ($name_lower === 'content-type') {
      $content_type = $value;
    }
  }
  preg_match('!^(\\d+)!', $status, $matches);
  if (isset($matches[1])) {
    $status_number = (int) $matches[1];
  }
  $content_type_info = explode('; charset=', $content_type);
  $content_type_basic = array_shift($content_type_info);
  if (!empty($content_type_info)) {
    $charset = array_shift($content_type_info);
  }
  return array(
    'status' => $status,
    'status-number' => $status_number,
    'content-type' => $content_type,
    'content-type-basic' => $content_type_basic,
    'charset' => $charset,
    'headers_sent' => headers_sent(),
  );
}