diff --git a/application/helpers/ecards_helper.php b/application/helpers/ecards_helper.php index ef378da..67f2676 100644 --- a/application/helpers/ecards_helper.php +++ b/application/helpers/ecards_helper.php @@ -435,3 +435,43 @@ function parseCardEntryValues($post) return $values; } + +/** + * debug + * handy little debugging commaind + * + * @param mixed $thing What you want to see + * @param boolean $show Should it be visible on page or only on source code + * + * @author Ismo Vuorinen + * @package Default + * + * @return true Script prints debugged thing, returns true always. + */ +function debug($thing = null, $show = false) +{ + if (ENVIRONMENT != "development") { + return false; + } + + // What triggered this? + $caller = array_shift(debug_backtrace()); + $from = str_replace(dirname(BASEPATH), '', $caller['file']) + . '#' . $caller['line']; + unset($caller); + + if ($show) { + $start = "\n
";
+        $end   = "\n
\n"; + } else { + $start = "\n\n"; + } + + $debug = $start . $from . "\n" . print_r($thing, true) . $end; + + echo $debug; + + return true; +} +