Krumo::_config PHP Méthode

_config() private static méthode

Returns values from Krumo's configuration
private static _config ( string $group, string $name, mixed $fallback = null ) : mixed
$group string
$name string
$fallback mixed
Résultat mixed
    private static function _config($group, $name, $fallback = null)
    {
        $krumo_ini = KRUMO_DIR . 'krumo.ini';
        // The config isn't loaded yet
        if (empty(static::$_config) && is_readable($krumo_ini)) {
            static::$_config = (array) parse_ini_file($krumo_ini, true);
        }
        // exists
        if (isset(static::$_config[$group][$name])) {
            return static::$_config[$group][$name];
        } else {
            return $fallback;
        }
    }

Usage Example

Exemple #1
0
 /**
  * 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);
     $display_cr = Krumo::_config('display', 'carriage_returns', true);
     if (strLen($data) > $truncate_length) {
         $_ = substr($data, 0, $truncate_length - 1);
         $_extra = true;
     }
     $_ = htmlentities($_);
     if ($display_cr) {
         $_ = preg_replace("/\\n/", "<strong class=\"krumo-carrage-return\"> &para; </strong>", $_);
     } else {
         $_ = nl2br($_);
     }
     $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) . "</strong>)</em> ";
     print Krumo::get_separator() . " <strong class=\"krumo-string\">" . $_;
     // This has to go AFTER the htmlspecialchars
     if ($_extra) {
         print "&hellip;";
     }
     print "</strong>";
     $ut = Krumo::is_datetime($name, $data);
     if ($ut) {
         print " ~ <strong class=\"krumo-datetime\">{$ut}</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) {
         $data = htmlentities($data);
         if ($display_cr) {
             $data = preg_replace("/\\n/", "<strong class=\"krumo-carrage-return\"> &para; </strong>", $data);
         } else {
             $data = nl2br($data);
         }
         print "<div class=\"krumo-nest\" {$collapse_style}>";
         print "<ul class=\"krumo-node\">";
         print "<li class=\"krumo-child\"> <div class=\"krumo-preview\">" . $data . "</div></li>";
         print "</ul></div>";
     }
     print "</li>";
 }
All Usage Examples Of Krumo::_config