当前位置: 首页>>代码示例>>PHP>>正文


PHP Strings::getSimilar方法代码示例

本文整理汇总了PHP中Strings::getSimilar方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::getSimilar方法的具体用法?PHP Strings::getSimilar怎么用?PHP Strings::getSimilar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Strings的用法示例。


在下文中一共展示了Strings::getSimilar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array_keys

<?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;
}
开发者ID:benoit-l,项目名称:transvision,代码行数:21,代码来源:mainsearch_entities.php

示例2: strtolower

        // 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;
} else {
    if (in_array($check['repo'], $desktop_repos)) {
        // Build logic to filter components
        $javascript_include[] = '/js/component_filter.js';
        $filter_block = '';
        foreach ($components as $value) {
            $filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>";
        }
    }
}
开发者ID:benoit-l,项目名称:transvision,代码行数:31,代码来源:mainsearch_strings.php


注:本文中的Strings::getSimilar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。