You are here

function drupalforfirebug_exit in Drupal For Firebug 6

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

Implementation of hook_init()

File

./drupalforfirebug.module, line 6

Code

function drupalforfirebug_exit() {
  $dff = TRUE;

  // Try not to break non html pages. [from devel.module]
  if (function_exists('drupal_get_headers')) {
    $headers = drupal_get_headers();
    $formats = array(
      'xml',
      'javascript',
      'json',
      'plain',
      'image',
      'application',
      'csv',
      'x-comma-separated-values',
    );
    foreach ($formats as $format) {
      if (strstr($headers, $format)) {
        $dff = FALSE;
      }
    }
  }

  // Check with Devel if Installed
  if (module_exists('devel')) {
    if (devel_verify_cli()) {
      $dff = FALSE;
    }
  }
  if ($dff) {

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