• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Implemented [Suggestion] Option to have romanized URLs

Benjy

Well-known member
#1
Hi,

The function responsible for rendering a text as an URL (XenForo_Link::getTitleForUrl()) has the option of having that text/URL romanized. Would it be possible to add an option in the admin panel so we could enable romanized URLs throughout the forums?

Also, instead of going with strtr, using utf8_stripspecials (and adding the missing ":\r\n\t" characters) is way more complete. Here's my suggestion, replace the function with:
PHP:
public static function getTitleForUrl($title, $romanize = false)
{
	if ($romanize)
	{
		$title = utf8_romanize(utf8_deaccent($title));
	}

	$title = utf8_strtolower($title);
	$title = unhtmlentities($title); //let's remove ugly "quote" text from URLs
	$title = strtr($title, array('"' => '', "'" => '', "’" => '')); //I don't particularly like this... in french "J'aime" shouldn't give "jaime", but preferably "j-aime"
	$title = utf8_stripspecials($title, ' ', ':\s'); //for an unknown reason $UTF8_SPECIAL_CHARS2 doesn't include ":"

	$title = preg_replace('/[ ]+/', '-', trim($title));

	return $title;
}