From 519ad1cfb81b45ac2df724c6afa2a85e3ded3471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 17 Jun 2021 13:35:25 +0800 Subject: [PATCH] Update error.tpl --- app/admin/view/error.tpl | 448 +++++++++++++++++++-------------------- 1 file changed, 221 insertions(+), 227 deletions(-) diff --git a/app/admin/view/error.tpl b/app/admin/view/error.tpl index 53daea770..43f724108 100644 --- a/app/admin/view/error.tpl +++ b/app/admin/view/error.tpl @@ -13,80 +13,80 @@ if (!function_exists('parse_class')) { { $names = explode('\\', $name); return '' . end($names) . ''; -} + } } if (!function_exists('parse_file')) { -function parse_file($file, $line) -{ -return '' . basename($file) . " line {$line}" . ''; -} + function parse_file($file, $line) + { + return '' . basename($file) . " line {$line}" . ''; + } } if (!function_exists('parse_args')) { -function parse_args($args) -{ -$result = []; -foreach ($args as $key => $item) { -switch (true) { -case is_object($item): -$value = sprintf('object(%s)', parse_class(get_class($item))); -break; -case is_array($item): -if (count($item) > 3) { -$value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); -} else { -$value = sprintf('[%s]', parse_args($item)); -} -break; -case is_string($item): -if (strlen($item) > 20) { -$value = sprintf( -'\'%s...\'', -htmlentities($item), -htmlentities(substr($item, 0, 20)) -); -} else { -$value = sprintf("'%s'", htmlentities($item)); -} -break; -case is_int($item): -case is_float($item): -$value = $item; -break; -case is_null($item): -$value = 'null'; -break; -case is_bool($item): -$value = '' . ($item ? 'true' : 'false') . ''; -break; -case is_resource($item): -$value = 'resource'; -break; -default: -$value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); -break; -} + function parse_args($args) + { + $result = []; + foreach ($args as $key => $item) { + switch (true) { + case is_object($item): + $value = sprintf('object(%s)', parse_class(get_class($item))); + break; + case is_array($item): + if (count($item) > 3) { + $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); + } else { + $value = sprintf('[%s]', parse_args($item)); + } + break; + case is_string($item): + if (strlen($item) > 20) { + $value = sprintf( + '\'%s...\'', + htmlentities($item), + htmlentities(substr($item, 0, 20)) + ); + } else { + $value = sprintf("'%s'", htmlentities($item)); + } + break; + case is_int($item): + case is_float($item): + $value = $item; + break; + case is_null($item): + $value = 'null'; + break; + case is_bool($item): + $value = '' . ($item ? 'true' : 'false') . ''; + break; + case is_resource($item): + $value = 'resource'; + break; + default: + $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); + break; + } -$result[] = is_int($key) ? $value : "'{$key}' => {$value}"; -} + $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; + } -return implode(', ', $result); -} + return implode(', ', $result); + } } if (!function_exists('echo_value')) { -function echo_value($val) -{ -if (is_array($val) || is_object($val)) { -echo htmlentities(json_encode($val, JSON_PRETTY_PRINT)); -} elseif (is_bool($val)) { -echo $val ? 'true' : 'false'; -} elseif (is_scalar($val)) { -echo htmlentities($val); -} else { -echo 'Resource'; -} -} + function echo_value($val) + { + if (is_array($val) || is_object($val)) { + echo htmlentities(json_encode($val, JSON_PRETTY_PRINT)); + } elseif (is_bool($val)) { + echo $val ? 'true' : 'false'; + } elseif (is_scalar($val)) { + echo htmlentities($val); + } else { + echo 'Resource'; + } + } } ?> @@ -374,37 +374,31 @@ echo 'Resource'; - $trace) { ?> -
-
-
-
-

+ $trace) { ?> +
+
+
+
+

+
+

+
-

-
-
- -
-
    $value) { ?>
  1. ">
-
- -
-

Call Stack

-
    -
  1. - -
  2. - +
    +
      $value) { ?>
    1. ">
    +
    + +
    +

    Call Stack

    +
      +
    1. + +
    2. + -
    3. - -
    -
    -
- + + + +
+
+ -
-

-
+
+

+
-
-

Exception Datas

- $value) { ?> - - - - - - - $val) { ?> - - - - +
+

Exception Datas

+ $value) { ?> +
empty
+ + + + + + $val) { ?> + + + + + + + +
empty
- - - - -
+
-
-

Environment Variables

- $value) { ?> - - - - - - - $val) { ?> - - - - +
+

Environment Variables

+ $value) { ?> +
empty
+ + + + + + $val) { ?> + + + + + + + +
empty
- - - - -
+ - + return elements; + } + } + + $.getScript = function (src, func) { + var script = document.createElement('script'); + + script.async = 'async'; + script.src = src; + script.onload = func || function () { + }; + + $('head')[0].appendChild(script); + } + + ;(function () { + var files = $('.toggle'); + var ol = $('ol', $('.prettyprint')[0]); + var li = $('li', ol[0]); + + // 短路径和长路径变换 + for (var i = 0; i < files.length; i++) { + files[i].ondblclick = function () { + var title = this.title; + + this.title = this.innerHTML; + this.innerHTML = title; + } + } + + (function () { + var expand = function (dom, expand) { + var ol = $('ol', dom.parentNode)[0]; + expand = undefined === expand ? dom.attributes['data-expand'].value === '0' : undefined; + if (expand) { + dom.attributes['data-expand'].value = '1'; + ol.style.display = 'none'; + dom.innerText = 'Call Stack (展开)'; + } else { + dom.attributes['data-expand'].value = '0'; + ol.style.display = 'block'; + dom.innerText = 'Call Stack (折叠)'; + } + }; + var traces = $('.trace'); + for (var i = 0; i < traces.length; i++) { + var h2 = $('h2', traces[i])[0]; + expand(h2); + h2.onclick = function () { + expand(this); + }; + } + })(); + + $.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function () { + prettyPrint(); + }); + })(); +