From c2c6a887e5e9e92a8ae2ec9cd580d5615379187b Mon Sep 17 00:00:00 2001 From: tianya Date: Sat, 29 Apr 2023 23:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3php5.6=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/common.func.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/system/common.func.php b/src/system/common.func.php index 56ee57c1..b5a50db6 100755 --- a/src/system/common.func.php +++ b/src/system/common.func.php @@ -18,22 +18,22 @@ define('ALERT_WARNING', 5); define('ALERT_INFO', 6); define('ALERT_LIGHT', 7); define('ALERT_DARK', 8); -define('ALERT_COLORS', array( - ALERT_PRIMARY => array('#cfe2ff','#b6d4fe','#084298'), - ALERT_SECONDARY => array('#e2e3e5','#d3d6d8','#41464b'), - ALERT_SUCCESS => array('#d1e7dd','#badbcc','#0f5132'), - ALERT_DANGER => array('#f8d7da','#f5c2c7','#842029'), - ALERT_WARNING => array('#fff3cd','#ffecb5','#664d03'), - ALERT_INFO => array('#cff4fc','#b6effb','#055160'), - ALERT_LIGHT => array('#fefefe','#fdfdfe','#636464'), - ALERT_DARK => array('#d3d3d4','#bcbebf','#141619'), -)); define("ALERT_TPL", '
~content~
'); //$content:文档,$type:alert类型 function DedeAlert($content, $type = ALERT_PRIMARY, $isHTML = false) { - $content = $isHTML? RemoveXSS($content) : htmlspecialchars($content); - $colors = isset(ALERT_COLORS[$type])? ALERT_COLORS[$type] : ALERT_COLORS[ALERT_PRIMARY]; + $colors = array( + ALERT_PRIMARY => array('#cfe2ff','#b6d4fe','#084298'), + ALERT_SECONDARY => array('#e2e3e5','#d3d6d8','#41464b'), + ALERT_SUCCESS => array('#d1e7dd','#badbcc','#0f5132'), + ALERT_DANGER => array('#f8d7da','#f5c2c7','#842029'), + ALERT_WARNING => array('#fff3cd','#ffecb5','#664d03'), + ALERT_INFO => array('#cff4fc','#b6effb','#055160'), + ALERT_LIGHT => array('#fefefe','#fdfdfe','#636464'), + ALERT_DARK => array('#d3d3d4','#bcbebf','#141619'), + ); + $content = $isHTML? RemoveXSS($content) : htmlspecialchars($content); + $colors = isset($colors[$type])? $colors[$type] : $colors[ALERT_PRIMARY]; list($background, $border, $color) = $colors; return str_replace(array('~color~','~background~','~border~', '~content~'),array($color,$background,$border,$content),ALERT_TPL); }