From d0320daa84c1f5fc089f31387a01662c44151f77 Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Fri, 7 Jul 2023 09:39:51 +0800 Subject: [PATCH] * zin: use html to parse history comments. --- lib/zin/helper.php | 7 ++++++- lib/zin/wg/history/v1.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/zin/helper.php b/lib/zin/helper.php index 4195cc746b..d2e5cf695f 100644 --- a/lib/zin/helper.php +++ b/lib/zin/helper.php @@ -115,7 +115,12 @@ else } } -function uncamelize($camelCaps, $separator = '-') +function uncamelize(string $camelCaps, string $separator = '-'): string { return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $camelCaps)); } + +function isHTML(string $string): bool +{ + return $string !== strip_tags($string) ? true : false; +} diff --git a/lib/zin/wg/history/v1.php b/lib/zin/wg/history/v1.php index 927753ad26..68e5a2c61d 100644 --- a/lib/zin/wg/history/v1.php +++ b/lib/zin/wg/history/v1.php @@ -119,7 +119,7 @@ class history extends wg div ( setClass('comment-content mt-2 ml-6 p-2.5'), - $comment, + isHTML($comment) ? html($comment) : $comment, ), ); }