diff options
-rw-r--r-- | it_debug.class | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/it_debug.class b/it_debug.class index 3f7ca81..0ca045c 100644 --- a/it_debug.class +++ b/it_debug.class @@ -66,6 +66,9 @@ function srcline($stackoffs = 0) if (!isset($GLOBALS['it_debug::dump source'][$file])) $GLOBALS['it_debug::dump source'][$file] = file($file); + if (preg_match('/^#!/', $GLOBALS['it_debug::dump source'][$file][0])) + $line++; + return $GLOBALS['it_debug::dump source'][$file][$line-1]; } @@ -77,15 +80,16 @@ function srcline($stackoffs = 0) */ function dump($args) { - if (ereg('(csv|txt|gif|jpg)', $_SERVER['PHP_SELF']) || !$_SERVER['HTTP_USER_AGENT']) + if (ereg('(csv|txt|gif|jpg)', $_SERVER['PHP_SELF'])) $plain = 1; else if ($_SERVER['REMOTE_ADDR']) { $blue = "<span style='color:#00c'>"; $noblue = "</span>"; } - else if (getenv('USER') != 'cschneid') # ;) + else if (getenv('USER') != 'cschneid' && posix_isatty(STDOUT)) # ;) { + echo posix_isatty(STDOUT) . "\n"; $blue = "\033[34m"; $noblue = "\033[m"; $red = "\033[31m"; @@ -126,7 +130,7 @@ function dump($args) foreach ($args as $arg) { $var = array_shift($argnames); - $item = gettype($arg) == 'resource' ? trim(print_r($arg, true)) : trim(var_export($arg, true)); + $item = gettype($arg) == 'resource' || is_a($arg, "SimpleXMLElement") ? trim(print_r($arg, true)) : trim(var_export($arg, true)); # Replace PHP 5 var_export object representation by old style while (preg_match("#(.*\b)(\w+)::__set_state\(array\(([^()]+)\)\)(.*)#s", $item, $regs)) |