From 6def8f617d76fc61beafe21c7d1e4fc5d2893a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 24 Mar 2021 17:47:48 +0800 Subject: [PATCH] Update error.tpl --- app/admin/view/error.tpl | 469 ++++++++++++++++++++------------------- 1 file changed, 239 insertions(+), 230 deletions(-) diff --git a/app/admin/view/error.tpl b/app/admin/view/error.tpl index c0516caa2..53daea770 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'; +} +} } ?> @@ -161,8 +161,8 @@ if (!function_exists('echo_value')) { } .echo pre > pre { - margin: 0; padding: 0; + margin: 0; } /* Exception Info */ @@ -171,11 +171,11 @@ if (!function_exists('echo_value')) { } .exception .message { - border: 1px solid #ddd; padding: 12px; - font-size: 16px; - line-height: 18px; + border: 1px solid #ddd; border-bottom: 0 none; + line-height: 18px; + font-size: 16px; border-top-left-radius: 4px; border-top-right-radius: 4px; font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif; @@ -192,10 +192,12 @@ if (!function_exists('echo_value')) { } .exception .source-code { - border: 1px solid #ddd; padding: 6px; - overflow-x: auto; + border: 1px solid #ddd; + background: #f9f9f9; + overflow-x: auto; + } .exception .source-code pre { @@ -207,24 +209,25 @@ if (!function_exists('echo_value')) { color: #4288ce; display: inline-block; min-width: 100%; - font-size: 14px; box-sizing: border-box; + font-size: 14px; font-family: "Century Gothic", Consolas, "Liberation Mono", Courier, Verdana, serif; - padding-left: px; + padding-left: < ? php echo (isset($ source) & & ! empty($ source)) ? parse_padding($ source): 40; + ? > px; } .exception .source-code pre li { + border-left: 1px solid #ddd; height: 18px; line-height: 18px; - border-left: 1px solid #ddd; } .exception .source-code pre code { color: #333; height: 100%; - font-size: 14px; display: inline-block; border-left: 1px solid #fff; + font-size: 14px; font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif; } @@ -371,37 +374,28 @@ if (!function_exists('echo_value')) { - $trace) { ?> -
-
-
-
-

-
-

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

- -
-
-                        ";
-                        foreach ((array)$trace['source']['source'] as $key => $value) {
-                            $class = " {$index}-" . ($key + $trace['source']['first']) . ($trace['line'] === $key + $trace['source']['first'] ? ' line-error' : '');
-                            echo "
  • " . htmlentities($value) . "
  • "; - } - echo ""; - ?> -
    -
    - -
    -

    Call Stack

    -
      -
    1. - -
    2. -

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

    Call Stack

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

    + + +
    +
    + + +
    +

    +
    -
    -

    Exception Datas

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

    Exception Datas

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

    Environment Variables

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

    Environment Variables

    + $value) { ?> + + + + + + + $val) { ?> + + + + - + + +
    empty
    + +
    - + + $.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function () { + prettyPrint(); + }); + })(); +