mirror of
https://github.com/getgrav/grav.git
synced 2026-03-21 20:11:35 +01:00
more progress on matching lang keys
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user