Форуми / Cotonti / Extensions / [RELEASE] AutoALIAS <- simple way to autocreate aliases

dervan
#10751 30.03.2009 18:48
# Koradhil : The best thing to use would be the php command:
$output = preg_replace("/[^A-Za-z0-9]/", "", $input);
Even though it will remove illegal chars instead of replace them.
and good practice would be to use "transliteration" feature which is supported in Cotonti, like this:
if ($lang != 'en' && is_array($sed_translit))
{
	$output = strtr($input, $sed_translit); // transliterate non-English characters
}
$output = preg_replace("/[^A-Za-z0-9]/", "", $output);

transliteration works when transition tables ($sed_translit, $sed_translitb) are defined in main.lang.php, see system/lang/ru/main.lang.php for example of these tables