You are here

function advagg_mod_devel_shutdown_real in Advanced CSS/JS Aggregation 7.2

Runs on shutdown to display developer information in the footer.

This function is registered by devel_shutdown() as a shutdown function.

1 string reference to 'advagg_mod_devel_shutdown_real'
advagg_mod_devel_shutdown in advagg_mod/advagg_mod.module
Runs on shutdown to clean up and display developer information.

File

advagg_mod/advagg_mod.module, line 3726
Advanced aggregation modifier module.

Code

function advagg_mod_devel_shutdown_real() {
  global $user;
  $output = '';

  // Set $GLOBALS['devel_shutdown'] = FALSE in order to suppress the
  // devel footer for a page.  Not necessary if your page outputs any
  // of the Content-type http headers tested below (e.g. text/xml,
  // text/javascript, etc).  This is is advised where applicable.
  if (!devel_silent() && !isset($GLOBALS['devel_shutdown']) && !isset($GLOBALS['devel_redirecting'])) {

    // 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;
          }
        }
      }
    }
    if (isset($user) && is_object($user) && user_access('access devel information')) {
      $queries = devel_query_enabled() ? Database::getLog('devel', 'default') : NULL;
      if (!empty($queries)) {

        // Remove caller args to avoid recursion.
        foreach ($queries as &$query) {
          unset($query['caller']['args']);
        }
      }
      $output .= devel_shutdown_summary($queries);
      $output .= advagg_mod_devel_shutdown_query($queries);
    }
    if ($output) {

      // @todo gzip this text if we are sending a gzip page.
      // See drupal_page_header().
      // For some reason, this is not actually printing for cached pages even
      // though it gets executed and $output looks good.
      print $output;
    }
  }
}