You are here

private static function krumo::_css in Devel 7

Same name and namespace in other branches
  1. 6 krumo/class.krumo.php \krumo::_css()

Print the skin (CSS)

@access private @static

Return value

boolean

2 calls to krumo::_css()
krumo::addCssJs in krumo/class.krumo.php
Allows CSS and Javascript to be included without performing a krumo::dump().
krumo::dump in krumo/class.krumo.php
Dump information about a variable

File

krumo/class.krumo.php, line 674

Class

krumo
Krumo API

Code

private static function _css() {
  static $_css = false;

  // already set ?
  //
  if ($_css) {
    return true;
  }
  $css = '';

  // DEVEL: changed for Drupal variables system
  $skin = variable_get('devel_krumo_skin', 'default');

  // custom selected skin ?
  //
  $_ = KRUMO_DIR . "skins/{$skin}/skin.css";
  if ($fp = @fopen($_, 'r', 1)) {
    $css = fread($fp, filesize($_));
    fclose($fp);
  }

  // defautl skin ?
  //
  if (!$css && $skin != 'default') {
    $skin = 'default';
    $_ = KRUMO_DIR . "skins/default/skin.css";
    $css = join('', @file($_));
  }

  // print ?
  //
  if ($_css = $css != '') {

    // fix the urls
    //
    // DEVEL: changed for Drupal path system.
    $css_url = file_create_url(drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/");
    $css = preg_replace('~%url%~Uis', $css_url, $css);

    // the CSS
    //
    drupal_add_css($css, 'inline');
    drupal_add_js(join(file(KRUMO_DIR . "krumo.js")), 'inline');
  }
  return $_css;
}