From 6bfad7579c317ab619acb26a174a48b4a1b0fcd8 Mon Sep 17 00:00:00 2001 From: Paul Gear Date: Sat, 6 Jun 2015 21:11:23 +1000 Subject: [PATCH] Add a couple of convenience functions to help make code tidier --- includes/functions.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 96d6a52275..bcde5c598c 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1247,3 +1247,23 @@ function ip_exists($ip) { } return true; } + +/* + * convenience function - please use this instead of 'if ($debug) { echo ...; }' + */ +function d_echo($text) { + global $debug; + if ($debug) { + echo "$text\n"; + } +} + +/* + * convenience function - please use this instead of 'if ($debug) { print_r ...; }' + */ +function d_print_r($var) { + global $debug; + if ($debug) { + print_r($var); + } +}