if ($poster_name_val = get_username($req_poster_id)) { $poster_name_val = stripslashes(html_entity_decode($poster_name_val)); $poster_id_val = $req_poster_id; } } } } if (isset($_REQUEST[$hash_key])) { hash_search($_REQUEST[$hash_key]); } if ($tm =& $_REQUEST[$title_match_key] and is_string($tm)) { if ($tmp = mb_substr(trim($tm), 0, $title_match_max_len)) { if ($bb_cfg['autocorrect_wkl']) { // Autocorrect wrong keyboard layout $tlc = new Text_LangCorrect(); $title_match_val = $tlc->parse($tlc->parse($tmp, 1), 2); } else { $title_match_val = $tmp; } $title_match_sql = clean_text_match($title_match_val, true, false, false); } } } $dl_status = array(); if ($dl_cancel_val) { $dl_status[] = DL_STATUS_CANCEL; } if ($dl_compl_val) { $dl_status[] = DL_STATUS_COMPLETE; } if ($dl_down_val) {
/** * Конвертирует текст в поиске в правильную раскладку. * @param string $text - текст который необходимо конвертировать. * @return string */ public function convertLang($text) { $php = explode('.', phpversion()); if ($php[0] < 5) { return $text; } if ($php[1] < 3) { return $text; } require_once CORE_JS . 'langcorrect/ReflectionTypeHint.php'; require_once CORE_JS . 'langcorrect/UTF8.php'; require_once CORE_JS . 'langcorrect/Text/LangCorrect.php'; $corrector = new Text_LangCorrect(); $text = $corrector->parse($text, 2); return $text; }
<?php /** * User: kostapc * Date: 12/9/2015 * Time: 4:08 AM */ define('CODE', realpath(__DIR__ . '/../code/')); echo "code: " . CODE . " \n"; require CODE . '/UTF8.php'; require CODE . '/ReflectionTypeHint.php'; require CODE . '/LangCorrect.php'; $lang = new Text_LangCorrect(); $source = "yt d njq hfccrkflrt yf,hfk ghtlkj;tybt"; $result = $lang->parse($source, Text_LangCorrect::KEYBOARD_LAYOUT); echo "source: {$source} \n"; echo "result: {$result} \n";