You are here

static function krumo::_css in Devel 6

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

* Print the skin (CSS) * *

Return value

boolean * @access private * @static

1 call to krumo::_css()
krumo::dump in krumo/class.krumo.php
* Dump information about a variable * *

File

krumo/class.krumo.php, line 629

Class

krumo
Krumo API

Code

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', 'orange');

  // 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 = base_path() . drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/";
    $css = preg_replace('~%url%~Uis', $css_url, $css);

    // the CSS
    //
    ?>
<!-- Using Krumo Skin: <?php

    echo preg_replace('~^' . preg_quote(realpath(KRUMO_DIR) . DIRECTORY_SEPARATOR) . '~Uis', '', realpath($_));
    ?> -->
<style type="text/css">
<!--/**/
<?php

    echo $css;
    ?>

/**/-->
</style>
<?php


    // the JS
    //
    ?>
<script type="text/javascript">
<!--//
<?php

    echo join(file(KRUMO_DIR . "krumo.js"));
    ?>

//-->
</script>
<?php

  }
  return $_css;
}