New: Add parameter unaccent

This commit is contained in:
Laurent Destailleur 2012-03-21 15:58:04 +01:00
parent b6b33877a7
commit 3ef88384b8

View File

@ -430,14 +430,15 @@ function dol_size($size,$type='')
* *
* @param string $str String to clean * @param string $str String to clean
* @param string $newstr String to replace bad chars with * @param string $newstr String to replace bad chars with
* @param string $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_) * @return string String cleaned (a-zA-Z_)
* *
* @see dol_string_nospecial, dol_string_unaccent * @see dol_string_nospecial, dol_string_unaccent
*/ */
function dol_sanitizeFileName($str,$newstr='_') function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
{ {
$filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"'); $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"');
return dol_string_nospecial(dol_string_unaccent($str), $newstr, $filesystem_forbidden_chars); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
} }
/** /**