Fixed plugins using d_echo (#9498)

Move d_echo to helpers.php and include in autoload
Don't remove from common.php yet to be extra safe.
This commit is contained in:
Tony Murray
2018-12-08 07:16:49 -06:00
committed by Neil Lathwood
parent 757e984e5d
commit 8bddfe7225
4 changed files with 75 additions and 16 deletions

View File

@@ -657,20 +657,23 @@ function is_valid_hostname($hostname)
/*
* convenience function - please use this instead of 'if ($debug) { echo ...; }'
*/
function d_echo($text, $no_debug_text = null)
{
global $debug;
if (!function_exists('d_echo')) {
//TODO remove this after installs have updated, leaving it for for transition
function d_echo($text, $no_debug_text = null)
{
global $debug;
if (class_exists('\Log')) {
\Log::debug(is_string($text) ? rtrim($text) : $text);
} elseif ($debug) {
print_r($text);
}
if (class_exists('\Log')) {
\Log::debug(is_string($text) ? rtrim($text) : $text);
} elseif ($debug) {
print_r($text);
}
if (!$debug && $no_debug_text) {
echo "$no_debug_text";
if (!$debug && $no_debug_text) {
echo "$no_debug_text";
}
}
} // d_echo
}
/**
* Output using console color if possible