You are here

function drupalforfirebug_exit in Drupal For Firebug 7.2

Same name and namespace in other branches
  1. 5 drupalforfirebug.module \drupalforfirebug_exit()
  2. 6 drupalforfirebug.module \drupalforfirebug_exit()
  3. 7 drupalforfirebug.module \drupalforfirebug_exit()

Implementation of hook_exit()

File

./drupalforfirebug.module, line 13

Code

function drupalforfirebug_exit() {
  $dff = TRUE;

  // Try not to break non html pages. [from new devel.module]
  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)) {
          $dff = FALSE;
        }
      }
    }
  }

  // Exclude AJAX Functionality from Ctools
  if (arg(1) == 'ajax' || arg(3) == 'ajax') {
    $dff = FALSE;
  }

  // Try not to break non html pages. [from new devel.module]
  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)) {
          $dff = FALSE;
        }
      }
    }
  }

  // Check with Devel if Installed
  if (module_exists('devel')) {
    if (drupal_is_cli()) {
      $dff = FALSE;
    }
  }
  global $_drupalforfirebug_enable_output;
  if ($_drupalforfirebug_enable_output !== TRUE) {
    $dff = FALSE;
  }
  if ($dff) {

    // Load Relevant Files and Register Shutdown
    drupal_load('module', 'user');
    register_shutdown_function('drupalforfirebug_shutdown');

    // Load the SQL Query Information
    global $queries;
    $queries = Database::getLog('devel', 'default');
  }
}