diff options
-rw-r--r-- | it.class | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -123,6 +123,7 @@ static function timerlog($label = '') * @param $p['graceperiod'] number of seconds within which additional errors are ignored if id is set * @param $p['timewindow'] number of seconds after graceperiod within which the second error must occur if id is set * @param $p['backtraceskip'] number of stack levels to drop + * @param $p['skipfiles'] files to skip in backtrace * @param $p['blockmail'] number of seconds to block mails after having sent a mail [3600] * @param $p['blockmailid'] block mail for $p['blockmail'] seconds with same id. Default: $p['to'] * @param $p['omitdebuginfo'] Do not add stack dump, locals and environment to output [false] @@ -193,7 +194,7 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de if ($toscreen || $sendmail) { - $trace = it_debug::backtrace($p['backtraceskip']); # moved in here for performance in mass error case + $trace = it_debug::backtrace(array('skiplevels' => $p['backtraceskip'], 'skipfiles' => $p['skipfiles'])); # moved in here for performance in mass error case if (strlen($p['body']) > 500000) { @@ -230,7 +231,7 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de it::mail(array('To' => $p['to'], 'Subject' => substr($p['title'], 0, 80), 'Body' => $body) + (($cc = $GLOBALS['it_defaultconfig']['error_cc']) ? array('Cc' => $cc) : array())); } else if ($_SERVER['REMOTE_ADDR']) # toscreen mode: web - echo "<pre>{$p['title']}\n".rtrim($body)."</pre>"; + echo "<pre>" . htmlspecialchars($p['title'] . "\n" . rtrim($body), ENT_COMPAT, $GLOBALS['it_html']->p['charset']) . "</pre>"; else # toscreen mode: shell (outputs to stderr) error_log($p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']} Url: $url") . " " . (EDC('verbose') ? D($p['locals']) : "")); } @@ -401,6 +402,22 @@ static function replace($replacements, $string, $p = array()) } /** + * Uppercase first character similar to ucfirst() but for mbstring.internal_encoding + */ +static function ucfirst($string) +{ + return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1); +} + +/** + * Uppercase first character of each word similar to ucwords() but for mbstring.internal_encoding + */ +static function ucwords($string) +{ + return preg_replace_callback('/\b\w/u', function($m) { return mb_strtoupper($m[1]); }, mb_strtolower($string)); +} + +/** * Extract key => value pairs from assoc array by key * @param $array array to filter * @param $keys array or comma separated list of keys to keep |