You are here

function xhprof_shutdown_real in XHProf 6

Same name and namespace in other branches
  1. 7 xhprof.module \xhprof_shutdown_real()

See xhprof_shutdown() which registers this function as a shutdown function. Displays xhprof link in the footer.

1 string reference to 'xhprof_shutdown_real'
xhprof_shutdown in ./xhprof.module
See xhprof_start() which registers this function as a shutdown function.

File

./xhprof.module, line 146

Code

function xhprof_shutdown_real() {
  global $user;

  // Try not to break non html pages.
  if (function_exists('drupal_get_http_header')) {
    $header = drupal_get_http_header('content-type');
    if ($header) {
      $formats = array(
        'xml',
        'javascript',
        'json',
        'plain',
        'image',
        'application',
        'csv',
        'x-comma-separated-values',
      );
      foreach ($formats as $format) {
        if (strstr($header, $format)) {
          return;
        }
      }
    }
  }
  $output = $txt = '';
  if (isset($user) && user_access('access xhprof data')) {
    $output .= '<div class="xhprof-ui">' . xhprof_build_link($GLOBALS['xhprof_run_id']) . '</div>';
  }
  if ($output) {
    print $output;
  }
}