// opti
This commit is contained in:
1 parent
02bbfb25d6
commit
a4997405dc
1 file changed
+7
-2
+7
-2
@@ -968,15 +968,20 @@ class ToolsCore
|
|||||||
*/
|
*/
|
||||||
public static function str2url($str)
|
public static function str2url($str)
|
||||||
{
|
{
|
||||||
|
static $allow_accented_chars = null;
|
||||||
|
|
||||||
|
if ($allow_accented_chars === null)
|
||||||
|
$allow_accented_chars = Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
|
||||||
|
|
||||||
if (function_exists('mb_strtolower'))
|
if (function_exists('mb_strtolower'))
|
||||||
$str = mb_strtolower($str, 'utf-8');
|
$str = mb_strtolower($str, 'utf-8');
|
||||||
|
|
||||||
$str = trim($str);
|
$str = trim($str);
|
||||||
if (!function_exists('mb_strtolower') || !Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'))
|
if (!function_exists('mb_strtolower') || !$allow_accented_chars)
|
||||||
$str = Tools::replaceAccentedChars($str);
|
$str = Tools::replaceAccentedChars($str);
|
||||||
|
|
||||||
// Remove all non-whitelist chars.
|
// Remove all non-whitelist chars.
|
||||||
if (Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'))
|
if ($allow_accented_chars)
|
||||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
|
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
|
||||||
else
|
else
|
||||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
|
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
|
||||||
|
|||||||
Reference in new issue
Block a user