$bz_target_string2 = $target_string2 = isset($tmx_target2[$entity]) ? Utils::secureText($tmx_target2[$entity]) : ''; // Highlight non-breaking spaces only after strings have been escaped $target_string2 = str_replace(' ', '<span class="highlight-gray"> </span>', $target_string2); switch ($current_repo) { case 'mozilla_org': $path_locale3 = VersionControl::gitPath($locale2, $current_repo, $entity); break; case 'firefox_ios': $path_locale3 = VersionControl::svnPath($locale2, $current_repo, $entity); break; default: $path_locale3 = VersionControl::hgPath($locale2, $current_repo, $entity); break; } // Link to entity $entity_link = "?sourcelocale={$source_locale}" . "&locale={$locale2}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$entity}"; $file_bug = '<a class="bug_link" target="_blank" href="' . Bugzilla::reportErrorLink($locale2, $entity, $source_string, $bz_target_string2, $current_repo, $entity_link) . '"><report a bug></a>'; $extra_column_rows = "\n <td dir='{$direction3}'>\n <span class='celltitle'>{$locale2}</span>\n <div class='string'>{$target_string2}</div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$path_locale3}'><em><source></em></a>\n {$file_bug}\n </div>\n </td>"; } else { $extra_column_rows = ''; } // Link to entity $entity_link = "?sourcelocale={$source_locale}" . "&locale={$locale}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$entity}"; $file_bug = '<a class="bug_link" target="_blank" href="' . Bugzilla::reportErrorLink($locale, $entity, $source_string, $bz_target_string, $current_repo, $entity_link) . '"><report a bug></a>'; $anchor_name = str_replace(['/', ':'], '_', $entity); $table .= "\n <tr>\n <td>\n <span class='celltitle'>Entity</span>\n <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this result'>link</a>\n <a class='l10n tag' href='/string/?entity={$entity}&repo={$current_repo}' title='List all translations for this entity'>l10n</a>\n <a class='link_to_entity' href='/{$entity_link}'>" . ShowResults::formatEntity($entity, $initial_search) . "</a>\n </td>\n <td dir='{$direction1}'>\n <span class='celltitle'>{$source_locale}</span>\n <div class='string'>{$source_string}</div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$path_locale1}'><em><source></em></a>\n </div>\n </td>\n <td dir='{$direction2}'>\n <span class='celltitle'>{$locale}</span>\n <div class='string'>{$target_string}</div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$path_locale2}'><em><source></em></a>\n {$file_bug}\n </div>\n </td>\n {$extra_column_rows}\n </tr>\n"; } $table .= "</table>\n\n"; if ($entities) { print $table; }
$terms = Utils::uniqueWords($initial_search); // Define our regex $search = (new Search())->setSearchTerms(Utils::cleanString($initial_search))->setRegexWholeWords($get_option('whole_word'))->setRegexCaseInsensitive($get_option('case_sensitive'))->setRegexPerfectMatch($get_option('perfect_match')); // We loop through all repositories and merge the results foreach ($repositories as $repository) { $source_strings = Utils::getRepoStrings($request->parameters[3], $repository); foreach ($terms as $word) { $search->setRegexSearchTerms($word); $source_strings = preg_grep($search->getRegex(), $source_strings); } /* If we don't have any match for a repo, no need to do heavy calculations, just skip to the next repo. */ if (empty($source_strings)) { continue; } /* We are only interested in target strings with keys in common with our source strings. */ $target_strings = Utils::getRepoStrings($request->parameters[4], $repository); foreach ($source_strings as $key => $value) { if (isset($target_strings[$key]) && !empty($target_strings[$key])) { $output[] = [$value, $target_strings[$key]]; } } unset($source_strings, $target_strings); } return $json = ShowResults::getTranslationMemoryResults($output, $initial_search, $get_option('max_results'), $get_option('min_quality'));
$common_keys = array_intersect_key($strings[$englishchanges[0] . '-en-US'], $strings[$englishchanges[1] . '-en-US']); $repo_one = $repos_nice_names[$englishchanges[0]]; $repo_two = $repos_nice_names[$englishchanges[1]]; $table = '<table id="englishchanges" class="collapsable">' . '<tr>' . '<th colspan="3">Strings that have changed significantly in English between ' . $repo_one . ' and ' . $repo_two . ' but for which the entity name didn\'t change</th>' . '</tr>' . '<tr>' . '<th>Key</th>' . '<th>' . $repo_one . '</th>' . '<th>' . $repo_two . '</th>' . '</tr>'; foreach ($common_keys as $key => $val) { if (trim(strtolower($strings[$englishchanges[0] . '-en-US'][$key])) != trim(strtolower($strings[$englishchanges[1] . '-en-US'][$key]))) { $table .= '<tr>' . '<td><span class="celltitle">Key</span><div class="string">' . ShowResults::formatEntity($key) . '</div></td>' . '<td><span class="celltitle">Gaia' . $repo_one . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$englishchanges[0] . '-en-US'][$key]), 'en-US') . '<br><small>' . Utils::secureText($strings[$englishchanges[0]][$key]) . '</small></div></td>' . '<td><span class="celltitle">Gaia' . $repo_two . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$englishchanges[1] . '-en-US'][$key]), 'en-US') . '<br><small>' . Utils::secureText($strings[$englishchanges[1]][$key]) . '</small></div></td>' . '</tr>'; } } $table .= '</table>'; print $anchor_title('changed_english'); print $table; // String diff between two repositories $strings_added = function ($reverted_comparison, $strings, $repo_one, $repo_two, $anchor, $cssclass) use($locale, $repos_nice_names) { $temp = array_diff_key($strings[$repo_one . '-en-US'], $strings[$repo_two . '-en-US']); $count = count($temp); if ($reverted_comparison) { $comparison_type = '<span class="added_string">' . $count . ' new strings</span>'; } else { $comparison_type = '<span class="deleted_string">' . $count . ' deleted strings</span>'; } $table = '<table id="' . $anchor . '" class="' . $cssclass . '">' . '<tr>' . '<th colspan="3">' . $comparison_type . ' between ' . $repos_nice_names[$repo_one] . ' and ' . $repos_nice_names[$repo_two] . '</th>' . '</tr>' . '<tr>' . '<th>Key</th>' . '<th>New strings</th>' . '</tr>'; foreach ($temp as $k => $v) { $translation = array_key_exists($k, $strings[$repo_one]) ? $strings[$repo_one][$k] : '<b>String untranslated</b>'; $table .= '<tr>' . '<td><span class="celltitle">Key</span><div class="string">' . ShowResults::formatEntity($k) . '</td>' . '<td><span class="celltitle">' . $locale . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$repo_one . '-en-US'][$k]), 'en-US') . '<br><small>' . ShowResults::highlight(Utils::secureText($translation), $locale) . '</small></div></td>' . '</tr>'; } $table .= '</table>'; return $table; }; print $anchor_title('new_strings'); print $strings_added($reverted_comparison, $strings, $repo1, $repo2, 'newstrings', 'collapsable');
if ($get_option('perfect_match')) { $regex = '~' . $whole_word . trim('^' . preg_quote($initial_search, '~') . '$') . $whole_word . '~' . $case_sensitive . 'u'; if ($request->parameters[2] == 'entities') { $entities = ShowResults::searchEntities($source_strings, $regex); $source_strings = array_intersect_key($source_strings, array_flip($entities)); } else { $source_strings = preg_grep($regex, $source_strings); $entities = array_keys($source_strings); } } else { foreach (Utils::uniqueWords($initial_search) as $word) { $regex = '~' . $whole_word . preg_quote($word, '~') . $whole_word . '~' . $case_sensitive . 'u'; if ($request->parameters[2] == 'entities') { $entities = ShowResults::searchEntities($source_strings, $regex); $source_strings = array_intersect_key($source_strings, array_flip($entities)); } else { $source_strings = preg_grep($regex, $source_strings); $entities = array_keys($source_strings); } } } // We have our list of filtered source strings, get corresponding target locale strings $target_strings = array_intersect_key(Utils::getRepoStrings($request->parameters[5], $request->parameters[3]), array_flip($entities)); // We sort arrays by key before array_splice() to keep matching keys ksort($source_strings); ksort($target_strings); // Limit results to 200 array_splice($source_strings, 200); array_splice($target_strings, 200); return $json = ShowResults::getRepositorySearchResults($entities, [$source_strings, $target_strings]);
echo $target_locales_list; ?> </select> </fieldset> <fieldset> <label>Channel 1:</label> <select name='chan1'> <?php echo $chan_selector1; ?> </select> </fieldset> <fieldset> <label>Channel 2:</label> <select name='chan2'> <?php echo $chan_selector2; ?> </select> </fieldset> <input type="submit" value="Go" alt="Go" /> </fieldset> </form> <?php echo "\n<table class='collapsable'>" . " <tr>\n" . " <th colspan='3'>Locale: {$locale}</th>\n" . " </tr>\n" . " <tr>\n" . " <th>Key</th>\n" . " <th>{$chan1}</th>\n" . " <th>{$chan2}</th>\n" . " </tr>\n"; foreach ($temp as $k => $v) { echo " <tr>" . " <td><span class='celltitle'>Key</span><div class='string'>" . ShowResults::formatEntity($k) . "</div></td>\n" . " <td><span class='celltitle'>{$chan1}</span><div class='string'>" . ShowResults::highlight($v, $locale) . "</div></td>\n" . " <td><span class='celltitle'>{$chan2}</span><div class='string'>" . ShowResults::highlight($strings[$chan2][$k], $locale) . "</div></td>\n" . " </tr>\n"; } echo "</table>\n";
function ShowTips($module_id) { $wb = $GLOBALS['wb']; $sr = new ShowResults(); $sr->SetParameters(True); $sr->DrawFriendlyColHead(array("", "")); /* COLS */ $sr->Columns(array("description", "logo")); $sr->Query("SELECT description,logo\n\t\t\t\t\t\t\tFROM " . $GLOBALS['database_prefix'] . "module_tips\n\t\t\t\t\t\t\tWHERE module_id = '" . $module_id . "'\n\t\t\t\t\t\t\t"); for ($i = 0; $i < $sr->CountRows(); $i++) { $logo = $sr->GetRowVal($i, 1); /* FASTER THAN CALLING EACH TIME IN THE NEXT LINES */ $sr->ModifyData($i, 1, "<img src='" . $wb . "images/" . $logo . "'>"); } $sr->WrapData(); //$sr->TableTitle("nuovext/22x22/actions/info.png","Tips"); $sr->TableTitle("", "Tips"); return $sr->Draw(); }
$searches[$locale2] = $locale3_strings; $data[] = $tmx_target2; } $search_yields_results = false; // This will hold the components names for the search filters $components = []; foreach ($searches as $key => $value) { $search_results = ShowResults::getTMXResults(array_keys($value), $data); $components += Project::getComponents($search_results); if (count($value) > 0) { // We have results, we won't display search suggestions but search results $search_yields_results = true; $search_id = strtolower(str_replace('-', '', $key)); $message_count = $real_search_results > $limit_results ? "<span class=\"results_count_{$search_id}\">{$limit_results} results</span> out of {$real_search_results}" : "<span class=\"results_count_{$search_id}\">" . Utils::pluralize(count($search_results), 'result') . '</span>'; $output[$key] = "<h2>Displaying {$message_count} for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span> in {$key}:</h2>"; $output[$key] .= ShowResults::resultsTable($search_id, $search_results, $initial_search, $source_locale, $locale, $check); } else { $output[$key] = "<h2>No matching results for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span>" . " for the locale {$key}</h2>"; } } // Remove duplicated components $components = array_unique($components); // Display a search hint for the closest string we have if we have no search results if (!$search_yields_results) { $merged_strings = []; foreach ($data as $key => $values) { $merged_strings = array_merge($merged_strings, array_values($values)); } $best_matches = Strings::getSimilar($initial_search, $merged_strings, 3); include VIEWS . 'results_similar.php'; return;
<?php namespace Transvision; // RTL support $direction1 = RTLSupport::getDirection($source_locale); $direction2 = RTLSupport::getDirection($locale); if ($url['path'] == '3locales') { $direction3 = RTLSupport::getDirection($locale2); $extra_column_header = "<th>{$locale2}</th>"; } else { $extra_column_header = ''; } $entities = ShowResults::searchEntities($tmx_source, $search->getRegex()); // Display a search hint for the closest string we have if we have no search results if (count($entities) == 0) { $merged_strings = []; $best_matches = Strings::getSimilar($initial_search, array_keys($tmx_source), 3); include VIEWS . 'results_similar.php'; return; }
<?php namespace Transvision; // get all strings $source_strings = Utils::getRepoStrings($request->parameters[3], $request->parameters[2]); $target_strings = Utils::getRepoStrings($request->parameters[4], $request->parameters[2]); // The search $initial_search = Utils::cleanString($request->parameters[5]); $terms = Utils::uniqueWords($initial_search); // Regex options (not currenty used) $delimiter = '~'; $whole_word = isset($check['whole_word']) ? '\\b' : ''; $case_sensitive = isset($check['case_sensitive']) ? '' : 'i'; $regex = $delimiter . $whole_word . $initial_search . $whole_word . $delimiter . $case_sensitive . 'u'; // Closure to get extra parameters set $get_option = function ($option) use($request) { $value = 0; if (isset($request->extra_parameters[$option]) && (int) $request->extra_parameters[$option] != 0) { $value = (int) $request->extra_parameters[$option]; } return $value; }; foreach ($terms as $word) { $regex = $delimiter . $whole_word . preg_quote($word, $delimiter) . $whole_word . $delimiter . $case_sensitive . 'u'; $source_strings = preg_grep($regex, $source_strings); } return $json = ShowResults::getTranslationMemoryResults(array_keys($source_strings), [$source_strings, $target_strings], $initial_search, $get_option('max_results'), $get_option('min_quality'));
/** * Html table of search results used by the main view (needs a lot of refactoring) * * @param array $search_results list of rows * @param string $recherche The words searched for * @param string $locale1 Reference locale to search in, usually en-US * @param string $locale2 Target locale to search in * @param array $search_options All the search options from the query * * @return string html table to insert in the view */ public static function resultsTable($search_results, $recherche, $locale1, $locale2, $search_options) { $direction1 = RTLSupport::getDirection($locale1); $direction2 = RTLSupport::getDirection($locale2); if (isset($search_options['extra_locale'])) { $locale3 = $search_options['extra_locale']; $direction3 = RTLSupport::getDirection($locale3); $extra_column_header = "<th>{$locale3}</th>"; } else { $extra_column_header = ''; } $table = "<table class='collapsable'>\n <tr class='column_headers'>\n <th>Entity</th>\n <th>{$locale1}</th>\n <th>{$locale2}</th>\n {$extra_column_header}\n </tr>"; if (!$search_options['whole_word'] && !$search_options['perfect_match']) { $recherche = Utils::uniqueWords($recherche); } else { $recherche = [$recherche]; } foreach ($search_results as $key => $strings) { // Don't highlight search matches in entities when searching strings if ($search_options['search_type'] == 'strings') { $result_entity = ShowResults::formatEntity($key); } else { $result_entity = ShowResults::formatEntity($key, $recherche[0]); } $component = explode('/', $key)[0]; $source_string = trim($strings[0]); $target_string = trim($strings[1]); $entity_link = "?sourcelocale={$locale1}" . "&locale={$locale2}" . "&repo={$search_options['repo']}" . "&search_type=entities&recherche={$key}"; $bz_link = [Bugzilla::reportErrorLink($locale2, $key, $source_string, $target_string, $search_options['repo'], $entity_link)]; if (isset($search_options['extra_locale'])) { $target_string2 = trim($strings[2]); $entity_link = "?sourcelocale={$locale1}" . "&locale={$search_options['extra_locale']}" . "&repo={$search_options['repo']}" . "&search_type=entities&recherche={$key}"; $bz_link[] = Bugzilla::reportErrorLink($search_options['extra_locale'], $key, $source_string, $target_string2, $search_options['repo'], $entity_link); } else { $target_string2 = ''; } foreach ($recherche as $val) { $source_string = Utils::markString($val, $source_string); $target_string = Utils::markString($val, $target_string); if (isset($search_options["extra_locale"])) { $target_string2 = Utils::markString($val, $target_string2); } } // Escape HTML before highlighing search terms $source_string = htmlspecialchars($source_string); $target_string = htmlspecialchars($target_string); $source_string = Utils::highlightString($source_string); $target_string = Utils::highlightString($target_string); if (isset($search_options["extra_locale"])) { $target_string2 = htmlspecialchars($target_string2); $target_string2 = Utils::highlightString($target_string2); } $replacements = [' ' => '<span class="highlight-gray" title="Non breakable space"> </span>', ' ' => '<span class="highlight-red" title="Thin space"> </span>', '…' => '<span class="highlight-gray">…</span>', '…' => '<span class="highlight-gray">…</span>']; $target_string = Strings::multipleStringReplace($replacements, $target_string); $temp = explode('-', $locale1); $locale1_short_code = $temp[0]; $temp = explode('-', $locale2); $locale2_short_code = $temp[0]; if ($search_options['repo'] == 'mozilla_org') { $locale1_path = VersionControl::svnPath($locale1, $search_options['repo'], $key); $locale2_path = VersionControl::svnPath($locale2, $search_options['repo'], $key); } else { $locale1_path = VersionControl::hgPath($locale1, $search_options['repo'], $key); $locale2_path = VersionControl::hgPath($locale2, $search_options['repo'], $key); } // errors $error_message = ''; // check for final dot if (substr(strip_tags($source_string), -1) == '.' && substr(strip_tags($target_string), -1) != '.') { $error_message = '<em class="error"> No final dot?</em>'; } // check abnormal string length $length_diff = Utils::checkAbnormalStringLength($source_string, $target_string); if ($length_diff) { switch ($length_diff) { case 'small': $error_message = $error_message . '<em class="error"> Small string?</em>'; break; case 'large': $error_message = $error_message . '<em class="error"> Large String?</em>'; break; } } // Missing string error if (!$source_string) { $source_string = '<em class="error">warning: missing string</em>'; $error_message = ''; } if (!$target_string) { $target_string = '<em class="error">warning: missing string</em>'; $error_message = ''; } if (!$target_string2) { $target_string2 = '<em class="error">warning: missing string</em>'; $error_message = ''; } // Replace / and : in the key name and use it as an anchor name $anchor_name = str_replace(['/', ':'], '_', $key); // 3locales view if (isset($search_options["extra_locale"])) { if ($search_options['repo'] == 'mozilla_org') { $locale3_path = VersionControl::svnPath($locale3, $search_options['repo'], $key); } else { $locale3_path = VersionControl::hgPath($locale3, $search_options['repo'], $key); } $extra_column_rows = "\n <td dir='{$direction3}' lang='{$locale3}'>\n <span class='celltitle'>{$locale3}</span>\n <div class='string'>{$target_string2}</div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$locale3_path}'>\n <source>\n </a>\n \n <a class='bug_link' target='_blank' href='{$bz_link[1]}'>\n <report a bug>\n </a>\n </div>\n </td>"; } else { $extra_column_rows = ''; } $table .= "\n <tr class='{$component}'>\n <td>\n <span class='celltitle'>Entity</span>\n <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this result'>link</a>\n <a class='l10n tag' href='/string/?entity={$key}&repo={$search_options['repo']}' title='List all translations for this entity'>l10n</a>\n <a class='link_to_entity' href=\"/{$entity_link}\">{$result_entity}</a>\n </td>\n <td dir='{$direction1}' lang='{$locale1}'>\n <span class='celltitle'>{$locale1}</span>\n <div class='string'>\n {$source_string}\n </div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$locale1_path}'>\n <source>\n </a>\n <span>Translate with:</span>\n <a href='http://translate.google.com/#{$locale1_short_code}/{$locale2_short_code}/" . urlencode(strip_tags(html_entity_decode(html_entity_decode($source_string)))) . "' target='_blank'>Google</a>\n <a href='http://www.bing.com/translator/?from={$locale1_short_code}&to={$locale2_short_code}&text=" . urlencode(strip_tags(html_entity_decode(html_entity_decode($source_string)))) . "' target='_blank'>BING</a>\n </div>\n </td>\n\n <td dir='{$direction2}' lang='{$locale2}'>\n <span class='celltitle'>{$locale2}</span>\n <div class='string'>{$target_string}</div>\n <div dir='ltr' class='result_meta_link'>\n <a class='source_link' href='{$locale2_path}'>\n <source>\n </a>\n \n <a class='bug_link' target='_blank' href='{$bz_link[0]}'>\n <report a bug>\n </a>\n {$error_message}\n </div>\n </td>\n {$extra_column_rows}\n </tr>"; } $table .= " </table>"; return $table; }
<?php namespace Transvision; // Include the common simple search form include __DIR__ . '/simplesearchform.php'; if ($error_count > 0) { $search_id = 'check_variable'; $content = "<h2><span class=\"results_count_{$search_id}\">" . Utils::pluralize($error_count, 'result') . "</span> found</h2>\n"; if (isset($filter_block)) { $content .= "<div id='filters'>" . " <h4>Filter by folder:</h4>\n" . " <a href='#showall' id='showall' class='filter'>Show all results</a>\n" . $filter_block . "</div>\n"; } $content .= "<table class='collapsable results_table {$search_id}'>\n" . " <tr>\n" . " <th>Entity</th>\n" . " <th>{$source_locale}</th>\n" . " <th>{$locale}</th>\n" . " </tr>\n"; foreach ($var_errors as $string_id) { // Link to entity $string_id_link = "?sourcelocale={$source_locale}" . "&locale={$locale}" . "&repo={$repo}" . "&search_type=entities&recherche={$string_id}"; $bugzilla_link = Bugzilla::reportErrorLink($locale, $string_id, $source[$string_id], $target[$string_id], $repo, $string_id_link); $path_locale1 = VersionControl::hgPath($source_locale, $repo, $string_id); $path_locale2 = VersionControl::hgPath($locale, $repo, $string_id); $component = explode('/', $string_id)[0]; $content .= "<tr class='{$component} {$search_id}'>\n <td>\n <span class='celltitle'>Entity</span>\n <a class='link_to_entity' href=\"/{$string_id_link}\">" . ShowResults::formatEntity($string_id) . "</a>\n </td>\n <td dir='{$direction1}'>\n <span class='celltitle'>{$source_locale}</span>\n <div class='string'>" . Utils::secureText($source[$string_id]) . "</div>\n <div class='result_meta_link'>\n <a class='source_link' href='{$path_locale1}'><em><source></em></a>\n </div>\n </td>\n <td dir='{$direction2}'>\n <span class='celltitle'>{$locale}</span>\n <div class='string'>" . Utils::secureText($target[$string_id]) . "</div>\n <div class='result_meta_link'>\n <a class='source_link' href='{$path_locale2}'><em><source></em></a>\n <a class='bug_link' target='_blank' href='{$bugzilla_link}'><report a bug></a>\n </div>\n </td>\n </tr>\n"; } $content .= "</table>\n"; } else { $content = "<h2>Congratulations, no errors found.</h2>"; } print $content;
$target_strings_merged = []; // The search $initial_search = Utils::cleanString($request->parameters[5]); $terms = Utils::uniqueWords($initial_search); // Define our regex $search = (new Search())->setSearchTerms(Utils::cleanString($initial_search))->setRegexWholeWords($get_option('whole_word'))->setRegexCaseInsensitive($get_option('case_sensitive'))->setRegexPerfectMatch($get_option('perfect_match')); // Loop through all repositories searching in both source and target languages foreach ($repositories as $repository) { $source_strings = Utils::getRepoStrings($request->parameters[3], $repository); foreach ($terms as $word) { $search->setRegexSearchTerms($word); $source_strings = preg_grep($search->getRegex(), $source_strings); } $source_strings_merged = array_merge($source_strings, $source_strings_merged); $target_strings = Utils::getRepoStrings($request->parameters[4], $repository); foreach ($terms as $word) { $search->setRegexSearchTerms($word); $target_strings = preg_grep($search->getRegex(), $target_strings); } $target_strings_merged = array_merge($target_strings, $target_strings_merged); } // Closure to get extra parameters set $get_option = function ($option) use($request) { $value = 0; if (isset($request->extra_parameters[$option]) && (int) $request->extra_parameters[$option] != 0) { $value = (int) $request->extra_parameters[$option]; } return $value; }; return $json = ShowResults::getSuggestionsResults($source_strings_merged, $target_strings_merged, $initial_search, $get_option('max_results'));
<?php namespace Transvision; // rtl support $direction1 = RTLSupport::getDirection($source_locale); $direction2 = RTLSupport::getDirection($locale); if ($url['path'] == '3locales') { $direction3 = RTLSupport::getDirection($locale2); $extra_column_header = "<th>{$locale2}</th>"; } else { $extra_column_header = ''; } $entities = ShowResults::searchEntities($tmx_source, $main_regex); // Display a search hint for the closest string we have if we have no search results if (count($entities) == 0) { $merged_strings = []; $best_matches = Strings::getSimilar($initial_search, array_keys($tmx_source), 3); include VIEWS . 'results_similar.php'; return; }