건국 등 문자열 입력 변경
This commit is contained in:
@@ -143,13 +143,30 @@ class StringUtil
|
||||
return static::padString($str, $maxsize, $ch, 0);
|
||||
}
|
||||
|
||||
public static function escapeTag($str)
|
||||
public static function escapeTag(?string $str):string
|
||||
{
|
||||
if(!$str){
|
||||
return '';
|
||||
}
|
||||
$str = htmlspecialchars($str);
|
||||
$str = str_replace(["\r\n", "\r", "\n"], '<br>', $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function neutralize(?string $str, ?int $maxLen = null){
|
||||
if(!$str){
|
||||
return '';
|
||||
}
|
||||
if($maxLen && $maxLen > 0){
|
||||
$str = StringUtil::subStringForWidth($str, 0, $maxLen);
|
||||
}
|
||||
$str = htmlspecialchars($str);
|
||||
$str = StringUtil::removeSpecialCharacter($str);
|
||||
$str = WebUtil::htmlPurify($str);
|
||||
$str = StringUtil::textStrip($str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function textStrip(?string $str):string{
|
||||
if(!$str){
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user