public function saveAction() { $id = $this->getRequest()->getParam('id'); if (!$id) { $this->getResponse()->setStatus(0)->setBody(__('tag does not exist'))->toJson(); } $rs = Admin_TranslateModel::get(array('id' => $id)); if (!$rs) { $this->getResponse()->setStatus(0)->setBody(__('tag does not exist'))->toJson(); } $update_data = array('value' => $this->getRequest()->getPost('value')); Admin_TranslateModel::set($update_data, array('id' => $id)); Cms_Translate::cacheSet($rs['tag_hash'], $this->getRequest()->getPost('value')); $this->getResponse()->setStatus(1)->setBody(__('Translate updated'))->toJson(); }
public function scanAction() { $this->getFilesTags(cfg()->root_path); $this->getAdditionalTags(); $this->tags[] = array('tag' => 'LES TEST', 'location' => null); $tags = array(); $hashes = array(); foreach ($this->tags as $row) { $tags[] = strtolower($row['tag']); $hashes[] = '"' . Cms_Translate::hash($row['tag']) . '"'; Default_TranslateModel::addIgnore(array('tag' => strtolower($row['tag']), 'tag_hash' => Cms_Translate::hash($row['tag']), 'language_code' => Cms_Translate::getLanguageCode('default'))); } Default_TranslateModel::setNotFound($hashes); $tags = array_unique($tags); $this->addResponse(count($tags)); // print json_encode(array( // 'tags' => $tags, // )); }