mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
NEW add option keepspace into dol_string_nospecialchar()
This commit is contained in:
@@ -1447,13 +1447,17 @@ function dol_string_unaccent($str)
|
||||
* @param string $newstr String to replace forbidden chars with
|
||||
* @param array|string $badcharstoreplace Array of forbidden characters to replace. Use '' to keep default list.
|
||||
* @param array|string $badcharstoremove Array of forbidden characters to remove. Use '' to keep default list.
|
||||
* @param int $keepspaces 1=Do not treat space as a special char to replace or remove
|
||||
* @return string Cleaned string
|
||||
*
|
||||
* @see dol_sanitizeFilename(), dol_string_unaccent(), dol_string_nounprintableascii()
|
||||
*/
|
||||
function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $badcharstoremove = '')
|
||||
function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $badcharstoremove = '', $keepspaces = 0)
|
||||
{
|
||||
$forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°', '$', ';'); // more complete than dol_sanitizeFileName
|
||||
$forbidden_chars_to_replace = array("'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°', '$', ';'); // more complete than dol_sanitizeFileName
|
||||
if (empty($keepspaces)) {
|
||||
$forbidden_chars_to_replace[] = " ";
|
||||
}
|
||||
$forbidden_chars_to_remove = array();
|
||||
//$forbidden_chars_to_remove=array("(",")");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user