function devel_init

Implements hook_init().

File

./devel.module, line 429

Code

function devel_init() {
    if (!devel_silent()) {
        if (user_access('access devel information')) {
            devel_set_handler(devel_get_handlers());
            // We want to include the class early so that anyone may call krumo()
            // as needed. See http://krumo.sourceforge.net/
            has_krumo();
            // See http://www.firephp.org/HQ/Install.htm
            $path = NULL;
            if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                // FirePHPCore is in include_path. Probably a PEAR installation.
                $path = '';
            }
            elseif (module_exists('libraries')) {
                // Support Libraries API - http://drupal.org/project/libraries
                $firephp_path = libraries_get_path('FirePHPCore');
                $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                $chromephp_path = libraries_get_path('chromephp');
            }
            else {
                $firephp_path = './' . drupal_get_path('module', 'devel') . '/FirePHPCore/lib/FirePHPCore/';
                $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
            }
            // Include FirePHP if it exists.
            if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                include_once $firephp_path . 'fb.php';
                include_once $firephp_path . 'FirePHP.class.php';
            }
            // Include ChromePHP if it exists.
            if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                include_once $chromephp_path;
            }
            // Add CSS for query log if should be displayed.
            if (variable_get('devel_query_display', 0)) {
                drupal_add_css(drupal_get_path('module', 'devel') . '/devel.css');
                drupal_add_js(drupal_get_path('module', 'devel') . '/devel.js');
            }
        }
    }
    if (variable_get('devel_rebuild_theme_registry', FALSE)) {
        drupal_theme_rebuild();
        if (flood_is_allowed('devel_rebuild_registry_warning', 1)) {
            flood_register_event('devel_rebuild_registry_warning');
            if (!devel_silent() && user_access('access devel information')) {
                drupal_set_message(t('The theme registry is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array(
                    "!url" => url('admin/config/development/devel', array(
                        'fragment' => 'edit-devel-rebuild-theme-registry',
                    )),
                )));
            }
        }
    }
}