A lot small fixes

This commit is contained in:
RainLoop Team 2015-06-04 22:02:31 +04:00
parent 4457cdbc23
commit 09334159c2
38 changed files with 1496 additions and 239 deletions

View file

@ -550,6 +550,17 @@ END;
return \MailSo\Base\Utils::IsAscii($sValue) ? \strtoupper($sValue) : $sValue;
}
/**
* @param string $sValue
*
* @return string
*/
public static function StripSpaces($sValue)
{
return \MailSo\Base\Utils::Trim(
\preg_replace('/[\s]+/u', ' ', $sValue));
}
/**
* @param string $sValue
*
@ -557,7 +568,7 @@ END;
*/
public static function IsUtf8($sValue)
{
return (bool) ( \function_exists('mb_check_encoding') ?
return (bool) (\function_exists('mb_check_encoding') ?
\mb_check_encoding($sValue, 'UTF-8') : \preg_match('//u', $sValue));
}
@ -1362,8 +1373,9 @@ END;
*/
public static function ClearFileName($sFileName)
{
return \MailSo\Base\Utils::ClearNullBite(\preg_replace('/[\s]+/u', ' ',
\str_replace(array('"', '/', '\\', '*', '?', '<', '>', '|', ':'), ' ', $sFileName)));
return \MailSo\Base\Utils::Trim(\MailSo\Base\Utils::ClearNullBite(
\MailSo\Base\Utils::StripSpaces(
\str_replace(array('"', '/', '\\', '*', '?', '<', '>', '|', ':'), ' ', $sFileName))));
}
/**
@ -1373,8 +1385,8 @@ END;
*/
public static function ClearXss($sValue)
{
return \MailSo\Base\Utils::ClearNullBite(
\str_replace(array('"', '/', '\\', '*', '?', '<', '>', '|', ':'), ' ', $sValue));
return \MailSo\Base\Utils::Trim(\MailSo\Base\Utils::ClearNullBite(
\str_replace(array('"', '/', '\\', '*', '?', '<', '>', '|', ':'), ' ', $sValue)));
}
/**