2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2024-07-31 19:36:57 +02:00
parent 31a560422d
commit 75158556c9
4 changed files with 55 additions and 9 deletions

View File

@@ -1574,7 +1574,7 @@ function dol_size($size, $type = '')
* @param string $str String to clean
* @param string $newstr String to replace bad chars with.
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_)
* @return string String cleaned
*
* @see dol_string_nospecial(), dol_string_unaccent(), dol_sanitizePathName()
*/
@@ -1601,7 +1601,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_)
* @return string String cleaned
*
* @see dol_string_nospecial(), dol_string_unaccent(), dol_sanitizeFileName()
*/
@@ -1672,6 +1672,20 @@ function dol_sanitizeEmail($stringtoclean)
return $stringtoclean;
}
/**
* Clean a string to use it as a key or code. So only char a-Z, A-Z, _ and 0-9 is kept.
*
* @param string $str String to clean
* @return string String cleaned (a-zA-Z_)
*
* @see dol_string_nospecial(), dol_string_unaccent(), dol_sanitize...()
*/
function dol_sanitizeKeyCode($str)
{
return preg_replace('/[^\w]+/', '', $str);
}
/**
* Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName
*
@@ -1682,8 +1696,6 @@ function dol_sanitizeEmail($stringtoclean)
*/
function dol_string_unaccent($str)
{
global $conf;
if (is_null($str)) {
return '';
}