Fixed $lng in ConfigParser

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2015-02-03 20:04:31 +01:00
parent 7c153d5e76
commit c971d3fafe
2 changed files with 35 additions and 6 deletions

View File

@@ -285,11 +285,16 @@ class ConfigDaemon {
$content = preg_replace_callback('/\{\{(.*)\}\}/Ui', function ($matches) {
if (preg_match('/^settings\.(.*)$/', $matches[1], $match)) {
return Settings::Get($match[1]);
} elseif (preg_match('/^lng\.(.*)$/', $matches[1], $match)) {
$lngvar = str_replace('.', '"]["', $match[1]);
$lngvar = str_replace('lng"]', 'lng', $lngvar);
$lngvar .= '"]';
return ${$lngvar};
} elseif (preg_match('/^lng\.(.*)(?:\.(.*)(?:\.(.*)))$/U', $matches[1], $match)) {
global $lng;
if (isset($match[1]) && $match[1] != '' && isset($match[2]) && $match[2] != '' && isset($match[3]) && $match[3] != '') {
return $lng[$match[1]][$match[2]][$match[3]];
} elseif (isset($match[1]) && $match[1] != '' && isset($match[2]) && $match[2] != '') {
return $lng[$match[1]][$match[2]];
} elseif (isset($match[1]) && $match[1] != '') {
return $lng[$match[1]];
}
return '';
}
}, $content);
return $content;