public static function language() { $isCMS = null !== container()->getPage(); $session = session('web'); if (true === $isCMS) { if (count($_POST)) { if (ake('cms_lng', $_POST)) { $session->setLanguage($_POST['cms_lng']); } else { $language = $session->getLanguage(); $language = null === $language ? Cms::getOption('default_language') : $language; $session->setLanguage($language); } } else { $language = $session->getLanguage(); $language = null === $language ? Cms::getOption('default_language') : $language; $session->setLanguage($language); } } else { $route = Utils::get('appDispatch'); $language = $session->getLanguage(); if (null === $language || $language != $route->getLanguage()) { $language = null === $route->getLanguage() ? options()->getDefaultLanguage() : $route->getLanguage(); $session->setLanguage($language); } $module = $route->getModule(); $controller = $route->getController(); $action = $route->getAction(); $module = is_string($action) ? Inflector::lower($module) : $module; $controller = is_string($action) ? Inflector::lower($controller) : $controller; $action = is_string($action) ? Inflector::lower($action) : $action; $config = array(); $config['language'] = $language; $config['module'] = $module; $config['controller'] = $controller; $config['action'] = $action; $configLanguage = new Container(); $configLanguage->populate($config); container()->setLanguage(new Language($configLanguage)); } }
function cms_option($option) { return Cms::executePHP(Cms::getOption($option), false); }