diff --git a/framework/helper.class.php b/framework/helper.class.php index 1d8062f78c..438b738d4b 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -739,27 +739,3 @@ function getVisions(): array $visionList = $lang->visionList; return array_intersect_key($visionList, $visions); } - -/** - * 对数据进行HTML实体转为字符。 - * Un HTML array. - * - * @param mixed $data - * @access public - * @return mixed - */ -function unHTMLArray($data, $processed = array()) -{ - if(is_string($data)) return htmlspecialchars_decode($data); - - if(is_array($data) || is_object($data)) - { - if(in_array($data, $processed, true)) { - return $data; - } - - $processed[] = $data; - foreach($data as &$value) $value = unHTMLArray($value, $processed); - } - return $data; -} diff --git a/lib/zin/utils/json.func.php b/lib/zin/utils/json.func.php index f3e6c3d116..1c6ed9393c 100644 --- a/lib/zin/utils/json.func.php +++ b/lib/zin/utils/json.func.php @@ -2,6 +2,29 @@ declare(strict_types=1); namespace zin\utils; +/** + * 对数据进行HTML实体转为字符。 + * Un HTML array. + * + * @param mixed $data + * @access public + * @return mixed + */ +function unHTMLArray($data, $processed = array()) +{ + if(is_string($data)) return htmlspecialchars_decode($data); + + if(is_array($data) || is_object($data)) + { + if(in_array($data, $processed, true)) return $data; + + $processed[] = $data; + foreach($data as &$value) $value = unHTMLArray($value, $processed); + } + return $data; +} + + function jsonEncode($data, $flags = 0, $depth = 512): string|false { $data = unHTMLArray($data);