/**
  * Render a dump for a string value
  *
  * @param mixed $data
  * @param string $name
  * @access private
  * @static
  */
 private static function _string($data, $name)
 {
     $collapsed = krumo::_isCollapsed(self::$_level, 1);
     if ($collapsed) {
         $collapse_style = 'style="display: none;"';
     } else {
         $collapse_style = '';
     }
     // extra
     $_extra = false;
     $_ = $data;
     // Get the truncate length from the config, or default to 100
     $truncate_length = krumo::_config('display', 'truncate_length', 100);
     if (strLen($data) > $truncate_length) {
         $_ = substr($data, 0, $truncate_length - 3) . '...';
         $_extra = true;
     }
     $expand_class = '';
     if ($_extra) {
         $expand_class = 'krumo-expand';
     }
     print "<li class=\"krumo-child\">";
     print "<div class=\"krumo-element {$expand_class}\" ";
     if ($_extra) {
         print " onClick=\"krumo.toggle(this);\" ";
     }
     print "onMouseOver=\"krumo.over(this);\" onMouseOut=\"krumo.out(this);\">\n";
     print "<a class=\"krumo-name\">{$name}</a> ";
     print "(<em class=\"krumo-type\">String, <strong class=\"krumo-string-length\">" . strlen($data) . " characters</strong></em>) ";
     print "<strong class=\"krumo-string\">" . htmlSpecialChars($_) . "</strong>";
     // callback
     if (is_callable($data)) {
         print "<span class=\"krumo-callback\"> | ";
         print "(<em class=\"krumo-type\">Callback</em>) <strong class=\"krumo-string\">" . htmlSpecialChars($_) . "()</strong></span>";
     }
     print "</div>";
     if ($_extra) {
         print "<div class=\"krumo-nest\" {$collapse_style}>";
         print "<ul class=\"krumo-node\">";
         print "<li class=\"krumo-child\"> <div class=\"krumo-preview\">" . htmlSpecialChars($data) . "</div></li>";
         print "</ul></div>";
     }
     print "</li>";
 }
示例#2
0
    /**
     * Print the skin (CSS)
     *
     * @return boolean
     * @access private
     * @static
     */
    private static function _css()
    {
        static $_css = false;
        // already set ?
        //
        if ($_css) {
            return true;
        }
        $css = '';
        $skin = krumo::_config('skin', 'selected', '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
            //
            $css_url = krumo::_config('css', 'url') . "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;
    }
示例#3
0
    /**
     * Print the skin (CSS)
     *
     * @return boolean
     * @access private
     * @static
     */
    private static function _css()
    {
        static $_css = false;
        // already set ?
        //
        if ($_css) {
            return true;
        }
        $skin = krumo::_config('skin', 'selected', 'default');
        JFactory::getDocument()->addStylesheet(JURI::root(true) . '/administrator/components/com_easycreator/helpers/krumo_0_2/skins/' . $skin . '/skin.css');
        JFactory::getDocument()->addScript(JURI::root(true) . '/administrator/components/com_easycreator/helpers/krumo_0_2/krumo.js');
        $_css = 'X';
        if (false) {
            $css = '';
            // 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
                //
                #			$css_url = krumo::_config('css', 'url') . "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
                */
            }
            //disabled..
            // the JS
            //
            ?>
<script type="text/javascript">
<!--//
<?php 
            echo join(file(KRUMO_DIR . 'krumo.js'));
            ?>

//-->
</script>
<?php 
        }
        return $_css;
    }