function devel_init

Same name in other branches
  1. 7.x-1.x devel.module \devel_init()

Implementation of hook_init().

File

./devel.module, line 268

Code

function devel_init() {
    if (!devel_silent()) {
        if (user_access('access devel information')) {
            devel_set_handler(variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD));
            // 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/.
            // Support Libraries API - http://drupal.org/project/libraries
            if (module_exists('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');
            }
        }
    }
    if (variable_get('devel_rebuild_theme_registry', FALSE)) {
        drupal_rebuild_theme_registry();
        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/settings/devel'),
                )));
            }
        }
    }
}