|
|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
|
|
|
Lib::loadClass('User');
|
|
|
+Lib::loadClass('UI');
|
|
|
|
|
|
class DBG {
|
|
|
|
|
|
@@ -195,13 +196,12 @@ class DBG {
|
|
|
<?php
|
|
|
}
|
|
|
|
|
|
- public static function nicePrint($variable, $varName) {
|
|
|
+ public static function nicePrint($variable, $varName, $params = []) {
|
|
|
$col = ['green'=>'#96c178', 'red'=>'#de6b74', 'blue'=>'#55b5c1', 'bg-dark'=>'#282c34', 'white'=>'#abb2bf', 'orange'=>'#d19a66', 'violet'=>'#c476db'];
|
|
|
$cnt = '';
|
|
|
ob_start();
|
|
|
- print_r($variable);
|
|
|
- $cnt = ob_get_contents();
|
|
|
- ob_end_clean();
|
|
|
+ print_r($variable);
|
|
|
+ $cnt = ob_get_clean();
|
|
|
|
|
|
$outLines = array();
|
|
|
$lines = explode("\n", $cnt);
|
|
|
@@ -225,8 +225,19 @@ class DBG {
|
|
|
$outLines[] = $line;
|
|
|
}
|
|
|
if ($varName) $outLines[0] = '<b style="color:'.$col['red'].'">' . $varName . "</b> => {$outLines[0]}";
|
|
|
- $outLines = implode("\n", $outLines);
|
|
|
- echo '<pre style="background-color:'.$col['bg-dark'].'; color:'.$col['white'].'; font-size:x-small">' . $outLines . '</pre>' . "\n";
|
|
|
+ $maxHeight = V::get('maxHeight', '400px', $params);
|
|
|
+ echo UI::h('details', ['style'=>"max-width:800px"], [
|
|
|
+ UI::h('summary', ['style'=>"padding:3px 8px;border:1px solid #ccc;background-color:{$col['bg-dark']};color:{$col['white']};font-size:small"], array_shift($outLines)),
|
|
|
+ UI::h('pre', [
|
|
|
+ 'style' => implode(";", [
|
|
|
+ 'background-color:'.$col['bg-dark'],
|
|
|
+ 'color:'.$col['white'],
|
|
|
+ 'border:1px solid #ccc;border-radius:0',
|
|
|
+ 'font-size:x-small',
|
|
|
+ ($maxHeight) ? "max-height:{$maxHeight};overflow:scroll" : ''
|
|
|
+ ])
|
|
|
+ ], implode("\n", $outLines))
|
|
|
+ ]) . "\n";
|
|
|
}
|
|
|
|
|
|
/**
|