diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-11-10 13:15:07 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-11-10 13:15:07 +0300 |
commit | f7ae507970268081cfb038f28a8281d66d3063d2 (patch) | |
tree | 40898a9ff3de43dbfdd2f5d0e4d872452deeaac7 /functions.php | |
parent | 913dee125adea39abec363f55e2fb54a42e0c9b8 (diff) |
Better detection logic
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/functions.php b/functions.php index 683d25d1..d8f91503 100644 --- a/functions.php +++ b/functions.php @@ -22,8 +22,13 @@ function translationUrlFilter($url, $path, $orig_scheme, $blog_id) { $language = explode('/', substr($_SERVER['REQUEST_URI'], strlen($path))); if(isset($language[1]) && $language[1] === 'de') { $url = explode('/', $url); + if($path !== null) { + $count = 4; + } else { + $count = 3; + } $languageEntry = ['de']; - array_splice($url, 4, 0, $languageEntry); + array_splice($url, $count, 0, $languageEntry); return implode('/', $url); } return $url; |