diff options
author | Urban Müller | 2008-11-26 19:40:27 +0000 |
---|---|---|
committer | Urban Müller | 2008-11-26 19:40:27 +0000 |
commit | 83a825a668fb248d4c2050ca2829f80d469c3711 (patch) | |
tree | 5e3408b93563c90e3973a1d86688ff07c7983003 /it_debug.class | |
parent | 643e9f34522a7c07d9f41c0f4f28f7169dad31c5 (diff) | |
download | itools-83a825a668fb248d4c2050ca2829f80d469c3711.tar.gz itools-83a825a668fb248d4c2050ca2829f80d469c3711.tar.bz2 itools-83a825a668fb248d4c2050ca2829f80d469c3711.zip |
debugged
Diffstat (limited to 'it_debug.class')
-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)) |