public function langEditFormResponder() { if (!OW::getRequest()->isAjax()) { throw new Redirect404Exception(); } if (OW::getRequest()->isPost()) { if (trim($_POST['form_name']) === 'lang_edit' && !empty($_POST['langId']) && !empty($_POST['label']) && !empty($_POST['tag'])) { $language = $this->service->findById((int) $_POST['langId']); if ($language !== null) { if ($_POST['tag'] != $language->tag) { $tmpLanguage = $this->service->findByTag($_POST['tag']); if (!empty($tmpLanguage)) { exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('admin', 'msg_lang_invalid_language_tag')))); } } $language->setLabel(trim($_POST['label'])); $language->setTag(trim($_POST['tag'])); if (!empty($_POST['rtl'])) { $language->setRtl(true); } else { $language->setRtl(false); } $event = new OW_Event('admin.before_save_lang_value', array('dto' => $language)); OW::getEventManager()->trigger($event); $this->service->save($language); exit(json_encode(array('result' => true, 'message' => OW::getLanguage()->text('admin', 'language_edit_form_success_message')))); } } } exit(json_encode(array('result' => false, 'message' => OW::getLanguage()->text('admin', 'language_edit_form_error_message')))); }