Is there a good way to generate a URL Slug from a post ? Currently i'm using the following :
public function URLGenerator($str)
{
setlocale(LC_ALL, 'en_US.UTF8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_| -]+/", '-', $clean);
return $clean;
}