From 34bb73ac4b519fc80ddf5070dc6df6b4f3feb7f6 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 20 Sep 2018 16:00:08 +0200 Subject: [PATCH] add new params html_debug for strig in one line and new alias hd --- pandora_console/include/functions_html.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 783f1a9cab..932e8a3457 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -47,13 +47,13 @@ else{ /** * Prints the print_r with < pre > tags */ -function html_debug_print ($var, $file = '') { +function html_debug_print ($var, $file = '', $oneline = false) { $more_info = ''; if (is_string($var)) { $more_info = 'size: ' . strlen($var); } elseif (is_bool($var)) { - $more_info = 'val: ' . + $more_info = 'val: ' . ($var ? 'true' : 'false'); } elseif (is_null($var)) { @@ -62,10 +62,13 @@ function html_debug_print ($var, $file = '') { elseif (is_array($var)) { $more_info = count($var); } - + if ($file === true) $file = '/tmp/logDebug'; - + + if($oneline && is_string($var)) + $var = preg_replace("/[\t|\n| ]+/", " ", $var); + if (strlen($file) > 0) { $f = fopen($file, "a"); ob_start(); @@ -85,8 +88,13 @@ function html_debug_print ($var, $file = '') { } // Alias for "html_debug_print" -function html_debug ($var, $file = '') { - html_debug_print ($var, $file); +function html_debug ($var, $file = '', $oneline = false) { + html_debug_print ($var, $file, $oneline); +} + +// Alias for "html_debug_print" +function hd ($var, $file = '', $oneline = false) { + html_debug_print ($var, $file, $oneline); } function html_f2str($function, $params) {