more progress on matching lang keys

This commit is contained in:
Andy Miller
2015-06-28 09:23:48 -06:00
parent 917a5c3082
commit eb421bc95e

View File

@@ -87,13 +87,18 @@ class Uri
// process params
$uri = $this->processParams($uri, $config->get('system.param_sep'));
$regex = '/(\/(?:'.$language->getAvailablekeys().')\/).*/';
$regex = '/(\/('.$language->getAvailablekeys().'\/)).*/';
if (preg_match($regex, $uri, $matches)) {
$uri = preg_replace("/\\".$matches[1]."/", '', $matches[0], 1);
$lang = $matches[2];
// if languages set
if ($language->defaultKey()) {
if (preg_match($regex, $uri, $matches)) {
$lang = $matches[2];
} else {
$lang = $language->getDefaultKey();
}
}
// split the URL and params
$bits = parse_url($uri);