From 803442218be44f7daf61b22ec438e1e95cf0d4e9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jan 2022 10:25:02 +0900 Subject: [PATCH] Merge pull request #5527 from paulbalandan/kint-4.1.1 Update modified Kint files in `ThirdParty` --- .../ThirdParty/Kint/Renderer/CliRenderer.php | 29 +++++++++++++++++-- .../ThirdParty/Kint/Renderer/RichRenderer.php | 15 ++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/system/ThirdParty/Kint/Renderer/CliRenderer.php b/system/ThirdParty/Kint/Renderer/CliRenderer.php index f86671ff1cf3..12b18d036b62 100644 --- a/system/ThirdParty/Kint/Renderer/CliRenderer.php +++ b/system/ThirdParty/Kint/Renderer/CliRenderer.php @@ -59,6 +59,15 @@ class CliRenderer extends TextRenderer */ public static $min_terminal_width = 40; + /** + * Which stream to check for VT100 support on windows. + * + * null uses STDOUT if it's defined + * + * @var null|resource + */ + public static $windows_stream = null; + protected static $terminal_width = null; protected $windows_output = false; @@ -69,8 +78,22 @@ public function __construct() { parent::__construct(); - if (!self::$force_utf8) { - $this->windows_output = KINT_WIN; + if (!self::$force_utf8 && KINT_WIN) { + if (!KINT_PHP72) { + $this->windows_output = true; + } else { + $stream = self::$windows_stream; + + if (!$stream && \defined('STDOUT')) { + $stream = STDOUT; + } + + if (!$stream) { + $this->windows_output = true; + } else { + $this->windows_output = !\sapi_windows_vt100_support($stream); + } + } } if (!self::$terminal_width) { @@ -153,7 +176,7 @@ protected function utf8ToWindows($string) { return \str_replace( ['┌', '═', '┐', '│', '└', '─', '┘'], - ["\xda", "\xdc", "\xbf", "\xb3", "\xc0", "\xc4", "\xd9"], + [' ', '=', ' ', '|', ' ', '-', ' '], $string ); } diff --git a/system/ThirdParty/Kint/Renderer/RichRenderer.php b/system/ThirdParty/Kint/Renderer/RichRenderer.php index 94b7f98ab71f..46a8827ded56 100644 --- a/system/ThirdParty/Kint/Renderer/RichRenderer.php +++ b/system/ThirdParty/Kint/Renderer/RichRenderer.php @@ -133,6 +133,9 @@ class RichRenderer extends Renderer public static $always_pre_render = false; + public static $js_nonce = null; + public static $css_nonce = null; + protected $plugin_objs = []; protected $expand = false; protected $force_pre_render = false; @@ -389,10 +392,18 @@ public function preRender() switch ($type) { case 'script': - $output .= ''; + $output .= '