diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-02-03 04:54:37 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-02-03 04:55:51 -0500 |
commit | c8cd1da88fbf0df1a99463032d97ac42d221a774 (patch) | |
tree | 9ee74797bf0f7b90f96ccbfd2f8b8829cbc49fd0 /lib/debug.lib.php | |
parent | 10d54c9f7fd0b15b64a0474c6f33b63caabc4d03 (diff) | |
download | ampache-c8cd1da88fbf0df1a99463032d97ac42d221a774.tar.gz ampache-c8cd1da88fbf0df1a99463032d97ac42d221a774.tar.bz2 ampache-c8cd1da88fbf0df1a99463032d97ac42d221a774.zip |
Fix the debug_result convenience function
The point of a convenience function is to be convenient, not to have an
unused first parameter and always be surrounded by the same boilerplate.
Diffstat (limited to 'lib/debug.lib.php')
-rw-r--r-- | lib/debug.lib.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/debug.lib.php b/lib/debug.lib.php index d3fa035b..0c8f9ab9 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -279,19 +279,18 @@ function escape_ini($str) { /** - * debug_ok - * Return an "OK" with the specified string + * debug_result + * + * Convenience function to format the output. */ -function debug_result($comment,$status=false,$value=false) { - +function debug_result($status = false, $value = null, $comment = '') { $class = $status ? 'ok' : 'notok'; + if (!$value) { $value = $status ? 'OK' : 'ERROR'; } - $final = '<span class="' . $class . '">' . scrub_out($value) . '</span> <em>' . $comment . '</em>'; - - return $final; - -} // debug_ok + return '[ <span class="' . $class . '">' . scrub_out($value) . + '</span> <em>' . $comment . '</em> ]'; +} ?> |