array( 'title' => 'Emergency', 'class' => 'error' ), 1 => array( 'title' => 'Alert', 'class' => 'error' ), 2 => array( 'title' => 'Critical', 'class' => 'error' ), 3 => array( 'title' => 'Error', 'class' => 'error' ), 4 => array( 'title' => 'Warning', 'class' => 'warning' ), 5 => array( 'title' => 'Notice', 'class' => 'notice' ), 6 => array( 'title' => 'Information', 'class' => 'info' ), 7=> array( 'title' => 'SilverStripe\\Dev\\Debug', 'class' => 'debug' ), E_USER_ERROR => array( 'title' => 'User Error', 'class' => 'error' ), E_CORE_ERROR => array( 'title' => 'Core Error', 'class' => 'error' ), E_NOTICE => array( 'title' => 'Notice', 'class' => 'notice' ), E_USER_NOTICE => array( 'title' => 'User Notice', 'class' => 'notice' ), E_DEPRECATED => array( 'title' => 'Deprecated', 'class' => 'notice' ), E_USER_DEPRECATED => array( 'title' => 'User Deprecated', 'class' => 'notice' ), E_CORE_ERROR => array( 'title' => 'Core Error', 'class' => 'error' ), E_WARNING => array( 'title' => 'Warning', 'class' => 'warning' ), E_CORE_WARNING => array( 'title' => 'Core Warning', 'class' => 'warning' ), E_USER_WARNING => array( 'title' => 'User Warning', 'class' => 'warning' ), E_STRICT => array( 'title' => 'Strict Notice', 'class' => 'notice' ), E_RECOVERABLE_ERROR => array( 'title' => 'Recoverable Error', 'class' => 'warning' ) ); protected static $unknown_error = array( 'title' => 'Unknown Error', 'class' => 'error' ); /** * Generate breadcrumb links to the URL path being displayed * * @return string */ public function Breadcrumbs() { $basePath = str_replace(Director::protocolAndHost(), '', Director::absoluteBaseURL()); $relPath = parse_url( substr($_SERVER['REQUEST_URI'], strlen($basePath), strlen($_SERVER['REQUEST_URI'])), PHP_URL_PATH ); $parts = explode('/', $relPath); $base = Director::absoluteBaseURL(); $pathPart = ""; $pathLinks = array(); foreach ($parts as $part) { if ($part != '') { $pathPart .= "$part/"; $pathLinks[] = "$part"; } } return implode(' → ', $pathLinks); } /** * @deprecated 4.0.0:5.0.0 Use renderHeader() instead */ public function writeHeader() { Deprecation::notice('4.0', 'Use renderHeader() instead'); echo $this->renderHeader(); } /** * @deprecated 4.0.0:5.0.0 Use renderInfo() instead */ public function writeInfo($title, $subtitle, $description = false) { Deprecation::notice('4.0', 'Use renderInfo() instead'); echo $this->renderInfo($title, $subtitle, $description); } /** * @deprecated 4.0.0:5.0.0 Use renderFooter() instead */ public function writeFooter() { Deprecation::notice('4.0', 'Use renderFooter() instead'); echo $this->renderFooter(); } /** * @deprecated 4.0.0:5.0.0 Use renderError() instead */ public function writeError($httpRequest, $errno, $errstr, $errfile, $errline) { Deprecation::notice('4.0', 'Use renderError() instead'); echo $this->renderError($httpRequest, $errno, $errstr, $errfile, $errline); } /** * @deprecated 4.0.0:5.0.0 Use renderSourceFragment() instead */ public function writeSourceFragment($lines, $errline) { Deprecation::notice('4.0', 'Use renderSourceFragment() instead'); echo $this->renderSourceFragment($lines, $errline); } /** * @deprecated 4.0.0:5.0.0 Use renderTrace() instead */ public function writeTrace($trace) { Deprecation::notice('4.0', 'Use renderTrace() instead'); echo $this->renderTrace($trace); } /** * @deprecated 4.0.0:5.0.0 Use renderVariable() instead */ public function writeVariable($val, $caller) { Deprecation::notice('4.0', 'Use renderVariable() instead'); echo $this->renderVariable($val, $caller); } /** * Render HTML header for development views * * @param HTTPRequest $httpRequest * @return string */ public function renderHeader($httpRequest = null) { $url = htmlentities( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'], ENT_COMPAT, 'UTF-8' ); $debugCSS = ModuleResourceLoader::singleton() ->resolveURL('silverstripe/framework:client/styles/debug.css'); $output = '
$description
"; } else { $output .= $this->Breadcrumbs(); } $output .= 'Line $errline in $errfile
"; $output .= ''; foreach ($lines as $offset => $line) { $line = htmlentities($line, ENT_COMPAT, 'UTF-8'); if ($offset == $errline) { $output .= "$offset $line"; } else { $output .= "$offset $line"; } } $output .= '
' . $text . '
';
$output .= "" . $this->formatCaller($caller) . " - \n";
if (is_string($val)) {
$output .= wordwrap($val, self::config()->columns);
} else {
$output .= var_export($val, true);
}
$output .= '
';
return $output;
}
public function renderMessage($message, $caller, $showHeader = true)
{
$header = '';
if ($showHeader) {
$file = basename($caller['file']);
$line = $caller['line'];
$header .= "Debug (line {$line} of {$file}):\n";
}
return " \n";
}
/**
* Similar to renderVariable() but respects debug() method on object if available
*
* @param mixed $val
* @param array $caller
* @param bool $showHeader
* @return string
*/
public function debugVariable($val, $caller, $showHeader = true)
{
$text = $this->debugVariableText($val);
if ($showHeader) {
$callerFormatted = $this->formatCaller($caller);
return "{$html}\n"; } }