From 2154a130957b47587020914e17a467424db60e68 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 30 Dec 2018 19:50:36 +0100 Subject: [PATCH] minor performance improvements --- Controller/BackendController.php | 10 +++++----- Theme/Backend/mid-side.tpl.php | 2 +- Theme/Backend/mid.tpl.php | 2 +- Theme/Backend/side.tpl.php | 4 ++-- Theme/Backend/splash.tpl.php | 2 +- Theme/Backend/top.tpl.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index d15bebb..fdf5ae5 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -106,19 +106,19 @@ final class BackendController extends Controller public function loadLanguage(RequestAbstract $request, ResponseAbstract $response) : void { $languages = $this->app->moduleManager->getLanguageFiles($request); + $langCode = $response->getHeader()->getL11n()->getLanguage(); foreach ($languages as $path) { - if ($path[strlen($path) - 1] === '/') { - // Is not a navigation file + $path = __DIR__ . '/../../..' . $path . '.' . $langCode . '.lang.php'; + + if (!\file_exists($path)) { continue; } - $path = __DIR__ . '/../../..' . $path . '.' . $response->getHeader()->getL11n()->getLanguage() . '.lang.php'; - /** @noinspection PhpIncludeInspection */ $lang = include $path; - $this->app->l11nManager->loadLanguage($response->getHeader()->getL11n()->getLanguage(), 'Navigation', $lang); + $this->app->l11nManager->loadLanguage($langCode, 'Navigation', $lang); } } diff --git a/Theme/Backend/mid-side.tpl.php b/Theme/Backend/mid-side.tpl.php index 98ce3e3..3c1c639 100644 --- a/Theme/Backend/mid-side.tpl.php +++ b/Theme/Backend/mid-side.tpl.php @@ -17,7 +17,7 @@ /* Looping through all links */ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT_SIDE])) { echo '
' - . '

' . $this->getHtml('Navigation') + . '

' . $this->getHtml('Navigation', 'Navigation') . '' . '

' . '
' diff --git a/Theme/Backend/mid.tpl.php b/Theme/Backend/mid.tpl.php index a0089e8..84b956f 100644 --- a/Theme/Backend/mid.tpl.php +++ b/Theme/Backend/mid.tpl.php @@ -23,7 +23,7 @@ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT]) foreach ($parent as $link) { if ($link['nav_parent'] === $this->parent) { echo '
  • ' - . $this->getHtml($link['nav_name']) . ''; + . $this->getHtml($link['nav_name'], 'Navigation') . ''; } } } diff --git a/Theme/Backend/side.tpl.php b/Theme/Backend/side.tpl.php index 9a554e0..5bca8e4 100644 --- a/Theme/Backend/side.tpl.php +++ b/Theme/Backend/side.tpl.php @@ -22,13 +22,13 @@ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::SIDE])) : ?> - getHtml($parent['nav_name']) ?>
  • - getHtml($link['nav_name']) ?> + getHtml($link['nav_name'], 'Navigation') ?> diff --git a/Theme/Backend/splash.tpl.php b/Theme/Backend/splash.tpl.php index 4954ef2..a78cd85 100644 --- a/Theme/Backend/splash.tpl.php +++ b/Theme/Backend/splash.tpl.php @@ -21,7 +21,7 @@ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])) : diff --git a/Theme/Backend/top.tpl.php b/Theme/Backend/top.tpl.php index c6f24fa..1547034 100644 --- a/Theme/Backend/top.tpl.php +++ b/Theme/Backend/top.tpl.php @@ -25,7 +25,7 @@ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::TOP])): ?> 0) : ?>printHtml($unread[$link['nav_from']]); ?> - getHtml($link['nav_name']) ?> + getHtml($link['nav_name'], 'Navigation') ?>