/** * Загружаем язык * @param null|string $lang * @throws \Exception */ private static function loadLanguage($lang = null) { if ($lang !== null) { $file = LIW_WEB . 'config/languages/' . $lang . '.php'; if (file_exists($file)) { $_SESSION['language'] = $lang; Liw::$lang = (require $file); return; } else { throw new \Exception("File " . $file . " not exist."); } } if (!empty($_SESSION['language'])) { $file = LIW_WEB . 'config/languages/' . $_SESSION['language'] . '.php'; if (file_exists($file)) { Liw::$lang = (require $file); return; } } if (isset($_SESSION['language'])) { unset($_SESSION['language']); } $file = LIW_WEB . 'config/languages/' . Liw::$config['def_lang'] . '.php'; Liw::$lang = (require $file); }