public static function tourl2($str) { $str = ImpLib::utf2ascii($str); $str = preg_replace("~[^\\w\\d]+~", '_', strtolower($str)); $str = trim($str, "-"); $str = preg_replace('~[^-\\w\\d]+~', '', $str); return $str; }