Summary:
Auto generated alias and emphasis
Detailed Description:
Hi,
I'm a french user of CmsMadeSimple and LISE module (best ever module for CMSMS)
I got problems with generated alias and french emphais.
Please have a look to this "_to_alias_format " function version i used to have
clean generated alias.
It remove emphasis and use hyphens rather than underscores.
Hope you can put it in the next release of LISE ?
/**
* first pass to conform to a valid alias
*/
private static function _to_alias_format($str)
{
// left trim up to the first letter
$str = preg_replace('/^[^a-zA-Z0-9_\x7f-\xff]*/', '', $str);
// remove emphasis
$str = iconv('UTF-8','ASCII//TRANSLIT',$str);
// replace ' and ’ to hyphen
$str = str_replace("'","-", $str);
$str = str_replace("’","-", $str);
// replace any invalid characters with an hyphen
$str = preg_replace('/[^a-zA-Z0-9_\-\x7f-\xff]/', '-', $str);
// replace multiple hyphens with single hyphen
$str = preg_replace('/-+/', '-', $str);
// convert to lowercase
$str = strtolower($str);
// remove hyphen from start and end
$str = trim($str, '-');
return $str;
}
Best regards,
Benoit