Project

General

Profile

« Previous | Next » 

Revision 13698

bugfix: web/username_prefix.php: user2path(): padding used to visually separate 1st element of URL: require all padding to be __ because sometimes terms contain a leading or trailing _

View differences:

trunk/web/username_prefix.php
7 7

  
8 8
function user2path($user) # multiple @ and nested . OK: a@b.c@url -> url?b.c.a
9 9
{
10
	# remove padding used to visually separate 1st element: _x_@url -> x@url
11
	# supports embedded @ inside highlighted part: _x@y_.z@url
12
	$user = preg_replace('/^_*(.*?)_+(?=[@.]|$)/', '$1', $user);
10
	# remove padding used to visually separate elements:__x__@y__@url -> x@y@url
11
	$user = preg_replace('/\b__|__\b/', '', $user);
13 12
	# translate reverse @-paths into forward .-paths
14 13
	return implode(".", array_reverse(explode("@", $user)));
15 14
}

Also available in: Unified diff