/** * 行を解析し、text、answer、descriptionフィールドに対応する文字列を取り出します。 * @param Dictionary $dictionary * @param string $line */ protected function parseLine(Dictionary $dictionary, string $line) { // コメントの分離 $textAndDescription = preg_split('#(/+|;+|\\[)#u', $line, 2, PREG_SPLIT_DELIM_CAPTURE); if ($textAndDescription[0] !== '' && str_replace(' ', '', $textAndDescription[0]) === '') { // 空行でなく、半角スペースのみで構成されている行なら throw new SyntaxException(_('半角スペースとコメントのみの行は作ることができません。')); } $answers = array_filter(array_map(function ($answer) { // 正規表現文字列扱いを抑止 return (new \esperecyan\dictionary_php\validator\AnswerValidator())->isRegExp($answer) ? trim($answer, '/') : $answer; }, explode(',', rtrim($textAndDescription[0], ' ')))); if ($answers) { if (count($answers) === 1) { $fieldsAsMultiDimensionalArray['text'] = $answers; } else { $fieldsAsMultiDimensionalArray = ['text' => [$answers[0]], 'answer' => $answers]; } if (isset($textAndDescription[1])) { $comment = trim($textAndDescription[1] === '[' ? rtrim($textAndDescription[2], ']') : $textAndDescription[2]); if ($comment !== '') { $fieldsAsMultiDimensionalArray['description'][] = $comment; } } try { $dictionary->addWord($fieldsAsMultiDimensionalArray); } catch (SyntaxException $e) { $this->logInconvertibleError($line, $e); } } }
/** * Возвращает словарь по его имени * @param $name String: Имя словаря * @retval Dictionary Словарь */ public function __get($name) { $name = strtolower($name); if (isset($this->dicts_cache[$name])) return $this->dicts_cache[$name]; $dictionary = $this->objects->Cache->get($name, self::CacheClass); if ($dictionary !== false) { $this->dicts_cache[$name] = &$dictionary; return $dictionary; } $dictionary = new Dictionary($this); $result = parent::__get("DB")->load_all($name); while (($row = $result->fetch())) $dictionary->add($row); $this->objects->Cache->set($name, self::CacheClass, $dictionary); $this->dicts_cache[$name] = &$dictionary; return $dictionary; }
/** * {@inheritdoc} */ public function prepare($connection = null) { if (!is_null($connection)) { $this->connection = $connection; $this->prepared = true; } $tables = $this->getTablesOf($this->connection); $run = new ScriptBuilder(['indent' => 4, 'padding' => 8]); foreach ($tables as $key => $value) { if (in_array($value['table_name'], self::$ignoring)) { continue; } $destination = $this->dictionary->translate($table['table_name']); $records = $this->getDataOf($value['table_name']); $clause = new ScriptBuilder(['indent' => 4, 'padding' => 12]); foreach ($records as $record) { $clause->append('[')->lineBreak()->indent(); foreach ($record as $column => $data) { $clause->append($this->parse($column, $data, $this->dictionary->getColumnsOf($table['table_name'])))->lineBreak(); } if ($this->hasRecords($records, 1)) { $clause->unindent()->append('],')->lineBreak(); } else { $clause->unindent()->append(']')->lineBreak(); } } if ($this->hasRecords($records)) { $run->append('DB::table("' . $destination . '")->insert([')->lineBreak()->append($clause->build(), false)->lineBreak()->append(']);')->lineBreak()->lineBreak(); } } $this->records = $run; return $this; }
/** * @param Dictionary $dictionary * @throws EmptyOutputException 該当の辞書形式に変換可能なお題が一つも存在しなかった。 * @return string[] */ public function serialize(Dictionary $dictionary) : array { foreach ($dictionary->getWords() as $word) { $serialized = $this->serializeWord($word); if ($serialized !== '') { $words[] = $serialized; } } if (empty($words)) { throw new EmptyOutputException(sprintf(_('%sの辞書形式に変換可能なお題が見つかりませんでした。'), 'ピクトセンス')); } $wordsLength = count($words); if ($wordsLength > PictsenseParser::WORDS_MAX) { $this->logger->critical(sprintf(_('お題が%1$d個あります。%2$d個以内でなければピクトセンスに辞書登録することはできません。'), $wordsLength, PictsenseParser::WORDS_MAX)); } elseif ($wordsLength < PictsenseParser::WORDS_MIN) { $this->logger->critical(sprintf(_('お題が%1$d個しかありません。%2$d個以上でなければピクトセンスに辞書登録することはできません。'), $wordsLength, PictsenseParser::WORDS_MIN)); } $dictioanryCodePoints = mb_strlen(implode('', $words), 'UTF-8'); if ($dictioanryCodePoints > PictsenseParser::DICTIONARY_CODE_POINTS_MAX) { $this->logger->critical(sprintf(_('辞書全体で%1$d文字あります。%2$d文字以内でなければピクトセンスに辞書登録することはできません。'), $dictioanryCodePoints, PictsenseParser::DICTIONARY_CODE_POINTS_MAX)); } $name = $this->getFilename($dictionary, 'csv'); $nameLength = (new PictsenseParser())->getLengthAs16BitCodeUnits(str_replace('.csv', '', $name)); if ($nameLength > PictsenseParser::TITLE_MAX) { $this->logger->error(sprintf(_('辞書名が%1$d文字 (補助文字は2文字扱い) あります。ピクトセンスに辞書登録する場合、%2$d文字より後の部分は切り詰められます。'), $dictioanryCodePoints, PictsenseParser::TITLE_MAX)); } return ['bytes' => implode("\r\n", $words) . "\r\n", 'type' => 'text/csv; charset=UTF-8; header=absent', 'name' => $name]; }
/** * @param $string * @return null */ public static function translate($string) { if (is_null(self::$dico) && ENV == MicroMuffin::ENV_PROD) { return null; } else { echo self::$dico->translate($string); } }
/** * Check if a string contains naughty words * @param string $string * @return bool */ public function isDirty(string $string) : bool { foreach ($this->dictionary->get() as $naughtyWord) { if (substr_count($string, $naughtyWord) > 0) { return true; } } return false; }
public function getActions() { $dictionaryModel = new Dictionary(); $dictionary = $dictionaryModel->findOne($this->id_dictionary); if ($dictionary->is_system) { return array(); } else { return parent::getActions(); } }
/** * @param Dictionary $dictionary * @throws EmptyOutputException 該当の辞書形式に変換可能なお題が一つも存在しなかった。 * @return string[] */ public function serialize(Dictionary $dictionary) : array { foreach ($dictionary->getWords() as $word) { $serialized = $this->serializeWord($word); if ($serialized !== '') { $words[] = $serialized; } } if (empty($words)) { throw new EmptyOutputException(sprintf(_('%sの辞書形式に変換可能なお題が見つかりませんでした。'), 'キャッチフィーリング')); } return ['bytes' => mb_convert_encoding(implode('', $words), 'Windows-31J', 'UTF-8'), 'type' => 'text/plain; charset=Shift_JIS', 'name' => $this->getFilename($dictionary, 'cfq', ' [語数 ' . count($words) . ']')]; }
/** * @param Dictionary $dictionary * @throws EmptyOutputException 該当の辞書形式に変換可能なお題が一つも存在しなかった。 * @return string[] */ public function serialize(Dictionary $dictionary) : array { foreach ($dictionary->getWords() as $word) { $serialized = $this->serializeWord($word); if ($serialized !== '') { $words[] = $serialized; } } if (empty($words)) { throw new EmptyOutputException(_('きゃっちまの辞書形式に変換可能なお題が見つかりませんでした。')); } return ['bytes' => mb_convert_encoding($this->serializeMetadata($dictionary, '//', ['[', ']']) . implode('', $words), 'Windows-31J', 'UTF-8'), 'type' => 'text/plain; charset=Shift_JIS', 'name' => $this->getFilename($dictionary, 'dat')]; }
/** * @param string[][][] $fieldsAsMultiDimensionalArrays * @param string[] $metadata * @param string[] $files * @return Dictionary */ protected function generateDictionary(array $fieldsAsMultiDimensionalArrays, array $metadata, array $files) : Dictionary { if ($files) { $tempDirectory = (new \esperecyan\dictionary_php\parser\GenericDictionaryParser())->generateTempDirectory(); foreach ($files as $filename => $file) { file_put_contents("{$tempDirectory}/{$filename}", $file); } } $dictionary = new Dictionary(isset($tempDirectory) ? new \FilesystemIterator($tempDirectory) : null); foreach ($fieldsAsMultiDimensionalArrays as $fieldsAsMultiDimensionalArray) { $dictionary->addWord($fieldsAsMultiDimensionalArray); } $dictionary->setMetadata($metadata); return $dictionary; }
protected function db(){ if( isset( self::$db ) ) return self::$db; $path = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'db' . DIRECTORY_SEPARATOR . strtolower( __CLASS__) . '.db'; $db = new PDO('sqlite2:' . $path, NULL, NULL, array(PDO::ATTR_PERSISTENT=>TRUE)); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return self::$db = $db; }
protected function inflexion($count) { $int = null; $inflexion = Dictionary::getInflexion($this->lang); $int = $inflexion->inflex($count); return $int; }
public function __toString() { $this->_convertListeners(); $combo = Ext_Factory::object('Form_Field_Combobox'); $combo->setName($this->getName()); Ext_Factory::copyProperties($this, $combo); if ($this->isValidProperty('dictionary') && strlen($this->dictionary)) { $dM = new Dictionary_Manager(); if ($dM->isValidDictionary($this->dictionary)) { $allowBlank = false; if ($this->_config->allowBlank && !$this->_config->showAll) { $allowBlank = true; } if ($this->_config->isValidProperty('showAll') && !empty($this->_config->showAllText)) { $allText = $this->_config->showAllText; } else { $allText = false; } $data = Dictionary::getInstance($this->dictionary)->__toJs($this->_config->showAll, $allowBlank, $allText); if (strlen($data)) { $combo->store = 'Ext.create("Ext.data.Store",{ model:"app.comboStringModel", data: ' . $data . ' })'; } } } return $combo->getConfig()->__toString(); }
public function listAction() { $data = $this->_tManager->getList(); if (!empty($data)) { $dict = Dictionary::getInstance('task'); foreach ($data as $k => &$v) { $v['status_code'] = $v['status']; if ($dict->isValidKey($v['status'])) { $v['status'] = $dict->getValue($v['status']); } $finish = strtotime($v['time_finished']); if ($finish <= 0) { $finish = time(); } $v['runtime'] = Utils::formatTime($finish - strtotime($v['time_started'])); $v['memory'] = Utils::formatFileSize($v['memory']); $v['memory_peak'] = Utils::formatFileSize($v['memory_peak']); if ($v['op_total'] == 0) { $v['progress'] = 0; } else { $v['progress'] = number_format($v['op_finished'] / $v['op_total'], 2) * 100; } } unset($v); } Response::jsonSuccess($data); }
/** * @param \SplFileInfo $file * @param string|null $filename * @param string|null $title * @throws SyntaxException お題の数、辞書全体の文字数が制限範囲外であるとき。 * @return Dictionary */ public function parse(\SplFileInfo $file, string $filename = null, string $title = null) : Dictionary { $dictionary = new Dictionary(); $words = []; if (!$file instanceof \SplFileObject) { $file = $file->openFile(); } else { $file->rewind(); } $file->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::READ_AHEAD | \SplFileObject::SKIP_EMPTY); foreach ($file as $line) { $word = $this->parseLine($line); if (!in_array($word, $words)) { $dictionary->addWord(['text' => [str_replace('ヴ', 'ゔ', $line)]]); $words[] = $word; } } $wordsLength = count($words); if ($wordsLength < self::WORDS_MIN) { throw new SyntaxException(sprintf(_('お題が%1$d個しかありません。%2$d個以上必要です。'), $wordsLength, self::WORDS_MIN)); } if ($wordsLength > self::WORDS_MAX) { throw new SyntaxException(sprintf(_('お題が%1$d個あります。%2$d個以内にする必要があります。'), $wordsLength, self::WORDS_MAX)); } $dictionaryCodePoints = mb_strlen(implode('', $words), 'UTF-8'); if ($dictionaryCodePoints > self::DICTIONARY_CODE_POINTS_MAX) { throw new SyntaxException(sprintf(_('辞書全体で%1$d文字あります。%2$d文字以内にする必要があります。'), $dictionaryCodePoints, self::DICTIONARY_CODE_POINTS_MAX)); } if (!is_null($title) || !is_null($filename)) { if (!is_null($title) && $title !== '') { $trimedTitle = preg_replace('/^[ \\t]+|[ \\t]+$/u', '', $title); } if (!is_null($filename) && (!isset($trimedTitle) || $trimedTitle === '')) { $trimedTitle = preg_replace('/^[ \\t]+|[ \\t]+$/u', '', (new GenericDictionaryParser())->getTitleFromFilename($filename)); } if (isset($trimedTitle) && $trimedTitle !== '') { $dictionary->setMetadata(['@title' => $trimedTitle]); $titleLength = $this->getLengthAs16BitCodeUnits($trimedTitle); if ($titleLength > self::TITLE_MAX) { $this->logger->error(sprintf(_('辞書名が%1$d文字 (補助文字は2文字扱い) あります。ピクトセンスにおける辞書名の最大文字数は%2$d文字です。'), $titleLength, self::TITLE_MAX)); } } else { $this->logger->error(_('辞書名が空です。先頭末尾の空白は取り除かれます。')); } } return $dictionary; }
public function start() { $this->millis = self::TIMER; $this->grid = BoggleGrid::create($this->lang); $this->dictionary = Dictionary::create($this->lang, "4x4"); $this->words = new ArrayList("BoggleWord"); return "games/boggle/boggle"; }
/** * ヘッダ行に用いるフィールド名の一覧を生成します。 * @param Dictionary $dictionary * @return string[] */ protected function getFieldNames(Dictionary $dictionary) : array { // 各フィールド名について、全レコード中の最大数をそれぞれ取得 foreach ($dictionary->getWords() as $word) { foreach ($word as $fieldName => $fields) { $fieldLengths[$fieldName] = max(count($fields), $fieldLengths[$fieldName] ?? 0); } } $fieldLengths += array_fill_keys(array_keys($dictionary->getMetadata()), 1); uksort($fieldLengths, function (string $a, string $b) : int { return $this->getColumnPosition($a) <=> $this->getColumnPosition($b); }); // ヘッダを生成 return array_merge(...array_map(function (string $fieldName, int $length) : array { return array_fill(0, $length, $fieldName); }, array_keys($fieldLengths), $fieldLengths)); }
/** * @param mixed $offset * @param mixed $value * @param mixed */ public function offsetSet($offset, $value) { $valueOffset = $this->offsetMethod->invoke($value, $this->offsetArgs); $this->checkValue($value); if (!is_null($offset) && $offset !== $valueOffset) { throw new \InvalidArgumentException(); } return parent::offsetSet($valueOffset, $value); }
/** * 辞書自体のタイトルと説明文を直列化します。Shift_JISに存在しない符号位置が含まれているタイトル、または説明文は存在しないものとして扱います。 * @param Dictionary $dictionary * @param string $lineCommentString 行コメント文字。 * @param string[]|null $brackets 開き括弧と閉じ括弧の配列。指定されていればタイトルをこの括弧で囲み、タイトル先頭の行コメント文字を省略します。 * @return string 改行はCRLFを使用します。辞書にタイトルか説明文のいずれかが存在すれば、末尾に改行を2つ付けます。どちらも無ければ空文字列を返します。 */ protected function serializeMetadata(Dictionary $dictionary, string $lineCommentString = '//', array $brackets = null) : string { $metadata = $dictionary->getMetadata(); if (isset($metadata['@title'])) { $shiftJisableTitle = $this->convertToShiftJISable($metadata['@title']); if ($this->isShiftJISable($shiftJisableTitle)) { $prefix = ($brackets ? '' : "{$lineCommentString} ") . ($brackets[0] ?? self::DEFAULT_BRACKETS[0]); $serialized[] = $prefix . str_replace("\n", "\r\n{$lineCommentString} " . str_repeat(' ', max(0, mb_strwidth($prefix) - mb_strwidth("{$lineCommentString} "))), $shiftJisableTitle) . ($brackets[1] ?? self::DEFAULT_BRACKETS[1]); } } if (isset($metadata['@summary'])) { $shiftJisableSummary = $this->convertToShiftJISable($metadata['@summary']['lml']); if ($this->isShiftJISable($shiftJisableSummary)) { $serialized[] = "{$lineCommentString} " . str_replace("\n", "\r\n{$lineCommentString} ", $shiftJisableSummary); } } return isset($serialized) ? implode("\r\n", $serialized) . "\r\n\r\n" : ''; }
public function result($xmlData, $intLevel = 0) { $xlyTemplate = new Dictionary(); if ($this->hasDataset('frame')) { $strTemplate = $this->hasDataset('frame'); } elseif ($this->hasAttribute('file') && is_readable($this->attribute('file'))) { $strTemplate = $this->fileRead($this->attribute('file')); } else { throw new beanException('No Template specified for view:frame'); } $arrSection = $this->children('section'); foreach ($arrSection as $section) { if ($section->hasAttribute('name')) { $xlyTemplate->set($section->attribute('name'), $section->dump()); } } // Insert the blocks into the template and return the result return $xlyTemplate->insertInto($strTemplate); }
/** * 行を解析し、textフィールドとdescriptionフィールドに対応する文字列を取り出します。 * @param Dictionary $dictionary * @param string $line */ protected function parseLine(Dictionary $dictionary, string $line) { // コメントの分離 $textAndDescription = preg_split('#[\\t ]*//#u', $line, 2); if (str_replace(["\t", ' ', ' '], '', $textAndDescription[0]) === '') { throw new SyntaxException(_('空行 (スペース、コメントのみの行) があります。')); } else { $fieldsAsMultiDimensionalArray['text'] = [(new AnswerValidator())->isRegExp($textAndDescription[0]) ? trim($textAndDescription[0], '/') : $textAndDescription[0]]; if (isset($textAndDescription[1])) { // コメントが存在すれば $description = trim($textAndDescription[1], " \t"); if ($description !== '') { $fieldsAsMultiDimensionalArray['description'] = [$description]; } } try { $dictionary->addWord($fieldsAsMultiDimensionalArray); } catch (SyntaxException $e) { $this->logInconvertibleError($line, $e); } } }
function display() { $content = $this->render(); // translation if (preg_match_all('/{([\\^a-z0-9-]+)}/', $content, $matches)) { $codes = array_unique($matches[1]); foreach ($codes as $code) { if ($replace = Dictionary::get($code)) { $content = str_replace("{" . $code . "}", $replace, $content); } } } echo str_replace(array("\t", "\n\n"), "", $content); }
function import() { try { $page = isset($_GET['page']) ? $_GET['page'] : null; if ($page == 0) { del_feature(); } $results = get_writing($page); $size = sizeof($results); foreach ($results as $r) { $f = new Feature(); $w = json_decode($r->writing); $char_id = $r->char_id; $features = $f->make_feature($w); //获取特征 $dic = new Dictionary(); $dict_feature = $dic->get_feature($char_id); //获取数据库中已存的特征值 $dict_feature = isset($dict_feature) ? json_decode($dict_feature) : null; $t = new Trainer(); $t->train($features, $dict_feature); $c = new Character(); $first_stroke_type = $c->get_first_stroke_type($w); //首笔的笔画类型(横竖撇点折) $int_strokes = sizeof($w->s); //笔画数 $dic->update_character($char_id, json_encode($t->train_features), $int_strokes, $first_stroke_type); } if ($size > 0) { echo "<meta HTTP-EQUIV=REFRESH CONTENT='5;URL=import.php?page=" . ($page + 1) . "'>"; } else { echo "导入完成"; } } catch (Exception $e) { echo $e->getMessage(); } }
/** * (non-PHPdoc) * @see Backend_Controller_Crud::indexAction() */ public function indexAction() { $this->_resource->addInlineJs(' var canEdit = ' . $this->_user->canEdit($this->_module) . '; var canDelete = ' . $this->_user->canDelete($this->_module) . '; var menuItemlinkTypes = ' . Dictionary::getInstance('link_type')->__toJs() . '; '); $modulesConfig = Config::factory(Config::File_Array, $this->_configMain->get('backend_modules')); Model::factory('Medialib')->includeScripts(); $this->_resource->addJs('/js/lib/ext_ux/SearchField.js', 0); $this->_resource->addJs('/js/app/system/SearchPanel.js', 0); $this->_resource->addJs('/js/app/system/HistoryPanel.js', 0); $this->_resource->addJs('/js/app/system/EditWindow.js', 0); $this->_resource->addJs('/js/app/system/crud/' . strtolower($this->_module) . '.js', 4); }
public function expression($str) { $input = new Stack(); $output = new Stack(); foreach ($this->tokenizer->tokenize($str) as $token) { $part = Dictionary::fromString($token); $part->isOperator() ? $input->push($part) : $output->push($part); } while ($operator = $input->pop()) { $output->push($operator); } // Ran out of time, this'll only work with addition $op = $output->pop(); $val = $op->operate($output); return $val; }
/** * {@inheritdoc} */ public function render() { $up = new ScriptBuilder(['padding' => 8]); $down = new ScriptBuilder(['padding' => 8]); if (!is_null($this->schema) && count($this->schema)) { foreach ($this->schema as $name => $values) { if (in_array($name, self::$ignoring)) { continue; } $up->append('/** Table: ' . $this->dictionary->translate($name) . ' */')->lineBreak()->append('{$values["up"]}', false)->lineBreak(); $down->append('{$values["down"]}', false)->lineBreak(); } } $template = file_get_contents(__DIR__ . '/templates/migration.txt'); $template = str_replace('{{name}}', 'Create' . camel_case($this->connection) . 'Database', $template); $template = str_replace('{{up}}', $up->build(), $template); $template = str_replace('{{down}}', $down->build(), $template); return $template; }
public function actionCheck() { $result = []; $request = Yii::$app->request; $username = $request->post('username'); $testId = $request->post('testId'); $word = $request->post('word'); $translation = $request->post('translation'); $order = $request->post('order'); $user = Users::findByUsername($username); $test = Test::findOne($testId); if ($order) { $dictionary = Dictionary::findOne(['translation' => $word]); } else { $dictionary = Dictionary::findOne(['word' => $word]); } if (!$user || !$test) { return ['error' => true, 'message' => 'Either the user or test not found']; } $error = $order ? $dictionary->word !== $translation : $dictionary->translation !== $translation; if ($error) { $result['error'] = $error; } if (TestRecords::hasMaxErrors($testId)) { $result['maxErrors'] = true; return $result; } // TODO: transaction here $testRecord = new TestRecords(); $testRecord->attributes = ['user_id' => $user->id, 'test_id' => $testId, 'dictionary_id' => $dictionary->id, 'order' => $order, 'is_error' => (int) $error, 'wrong_translation' => $error ? $translation : null]; $testRecord->save(); // Check once again for max errors after the save if (TestRecords::hasMaxErrors($testId)) { $result['maxErrors'] = true; return $result; } if (!$error) { // Increase the score by 1 $test->scoreUp(); } return $result; }
/** * Load language file. Each language file contains three arrays: * about, dictionary and transliterations. * * @param string $path * Path of the language file that should be loaded * @param boolean $clear * True, if the current dictionary should be cleared, defaults to false */ public static function load($path, $clear = false) { // Initialize or clear dictionary if (!self::$_dictionary instanceof Dictionary || $clear === true) { self::initialize(); } // Load language file if (file_exists($path)) { require $path; } // Define default dates if (empty(self::$_dates)) { $dates = array('yesterday', 'today', 'tomorrow', 'now', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'sec', 'second', 'min', 'minute', 'hour', 'day', 'fortnight', 'forthnight', 'month', 'year', 'secs', 'seconds', 'mins', 'minutes', 'hours', 'days', 'fortnights', 'forthnights', 'months', 'years', 'weekday', 'weekdays', 'week', 'weeks', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth', 'next', 'last', 'previous', 'this'); foreach ($dates as $date) { self::$_dates[$date] = $date; } } // Merge dictionaries if (isset($dictionary) && is_array($dictionary)) { self::$_dictionary->merge($dictionary); // Add date translations foreach (self::$_dates as $key => $value) { self::$_dates[$key] = __($key); } } // Populate transliterations if (isset($transliterations) && is_array($transliterations)) { self::$_transliterations = array_merge(self::$_transliterations, $transliterations); } // Use default if no transliterations are provided with the translations if (empty(self::$_transliterations)) { include LANG . '/lang.en.php'; self::$_transliterations = $transliterations; } }
public function current() { $k = $this->it->current(); $v = $this->dict->get($k); return new KeyValuePair($k, $v); }
public static function RenderEmptyResultSet($ctrl, $__fullName = null) { $views = self::ctrlToView($ctrl); require_once $_SERVER['DOCUMENT_ROOT'] . $views['header']; $phrase = Dictionary::dictLookup('NO_RESULTS'); $msg = "<h4>{$phrase}</h4>"; echo $msg; }