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


PHP StringUtil::cleanupQuery方法代码示例

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


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

示例1: util_getRequestParameter

<?php

require_once "../phplib/util.php";
$form = util_getRequestParameter('form');
$locVersion = util_getRequestParameter('locVersion');
$locVersions = pref_getLocVersions();
if ($locVersion && $form) {
    LocVersion::changeDatabase($locVersion);
    $form = StringUtil::cleanupQuery($form);
    smarty_assign('page_title', 'Verificare LOC: ' . $form);
    $ifs = loadLoc($form);
    $lexems = array();
    $inflections = array();
    foreach ($ifs as $if) {
        $lexems[] = Lexem::get_by_id($if->lexemId);
        $inflections[] = Inflection::get_by_id($if->inflectionId);
    }
    smarty_assign('form', $form);
    smarty_assign('selectedLocVersion', $locVersion);
    smarty_assign('ifs', $ifs);
    smarty_assign('lexems', $lexems);
    smarty_assign('inflections', $inflections);
} else {
    smarty_assign('selectedLocVersion', $locVersions[1]->name);
    smarty_assign('page_title', 'Căutare formă flexionară în LOC ' . $form);
}
setlocale(LC_ALL, "ro_RO.utf8");
smarty_assign('locVersions', $locVersions);
smarty_displayCommonPageWithSkin('scrabble-flexiune.ihtml');
function loadLoc($cuv)
{
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:scrabble-flexiune.php

示例2: array

    $lexem = Lexem::get_by_id($lexemId);
    if ($lexem) {
        $lexems = array($lexem);
        $cuv = $lexem->formNoAccent;
    } else {
        $lexems = array();
        $cuv = NULL;
    }
}
if ($lexemId) {
    SmartyWrap::assign('paradigmLink', util_getWwwRoot() . "lexem/{$cuv}/{$lexemId}/paradigma");
} else {
    SmartyWrap::assign('paradigmLink', util_getWwwRoot() . "definitie/{$cuv}/paradigma");
}
if ($cuv) {
    $cuv = StringUtil::cleanupQuery($cuv);
}
// Normal search
if ($searchType == SEARCH_INFLECTED) {
    $lexems = Lexem::searchInflectedForms($cuv, $hasDiacritics);
    if (count($lexems) == 0) {
        $cuv_old = StringUtil::tryOldOrthography($cuv);
        $lexems = Lexem::searchInflectedForms($cuv_old, $hasDiacritics);
    }
}
// Maps lexems to arrays of inflected forms (some lexems may lack inflections)
// Also compute the text of the link to the paradigm div,
// which can be 'conjugări', 'declinări' or both
if (!empty($lexems)) {
    $conjugations = false;
    $declensions = false;
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:paradigm.php

示例3: assertAbbreviations

// Abbreviation is not delimited by spaces
assertAbbreviations("AGNUS DEI", "AGNUS DEI", "AGNUS DEI", 32);
assertEquals('@MÁRE^2,@ $mări,$ s.f.', AdminStringUtil::migrateFormatChars('@MÁRE^2@, $mări$, s.f.'));
assertEquals('@$%spaced% text$@', AdminStringUtil::migrateFormatChars('@$ % spaced % text $@'));
assertEquals('40\\% dolomite', AdminStringUtil::migrateFormatChars('40\\% dolomite'));
assertEquals('40 %dolomite%', AdminStringUtil::migrateFormatChars('40% dolomite%'));
assertEquals('cățel', AdminStringUtil::internalizeWordName("C~A,t'EL"));
assertEquals('ă', AdminStringUtil::internalizeWordName("~~A~~!@#\$%^&*()123456790"));
assertEquals('casă', AdminStringUtil::removeAccents('cásă'));
assertEquals('mama', StringUtil::cleanupQuery("'mama'"));
assertEquals('mama', StringUtil::cleanupQuery('"mama"'));
assertEquals('aăbcdef', StringUtil::cleanupQuery("aăbc<mamă foo bar>def"));
assertEquals('AĂBCDEF', StringUtil::cleanupQuery("AĂBC<MAMĂ FOO BAR>DEF"));
assertEquals('a~abcdef', StringUtil::cleanupQuery("a~abc<mam~a foo bar>def"));
assertEquals('a~ABcdef', StringUtil::cleanupQuery("a~ABc<mam~a foo bar>def"));
assertEquals('1234', StringUtil::cleanupQuery('12&qweasd;34'));
assert(StringUtil::hasDiacritics('mamă'));
assert(!StringUtil::hasDiacritics('mama'));
$def = Model::factory('Definition')->create();
$def->sourceId = 1;
$def->internalRep = 'abcd';
assertEquals('abcd', AdminStringUtil::extractLexicon($def));
$def->internalRep = 'wxyz';
assertEquals('wxyz', AdminStringUtil::extractLexicon($def));
$def->internalRep = 'mamă';
assertEquals('mamă', AdminStringUtil::extractLexicon($def));
assert(StringUtil::hasRegexp('asd[0-9]'));
assert(!StringUtil::hasRegexp('ăâîșț'));
assert(StringUtil::hasRegexp('cop?l'));
assertEquals("like 'cop%l'", StringUtil::dexRegexpToMysqlRegexp('cop*l'));
assertEquals("like 'cop_l'", StringUtil::dexRegexpToMysqlRegexp('cop?l'));
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:test.php

示例4: util_getRequestParameter

$name = util_getRequestParameter('name');
$status = util_getRequestIntParameter('status');
$nick = util_getRequestParameter('nick');
$sourceId = util_getRequestIntParameter('source');
$yr1 = util_getRequestIntParameter('yr1');
$mo1 = util_getRequestIntParameter('mo1');
$da1 = util_getRequestIntParameter('da1');
$yr2 = util_getRequestIntParameter('yr2');
$mo2 = util_getRequestIntParameter('mo2');
$da2 = util_getRequestIntParameter('da2');
$searchButton = util_getRequestParameter('searchButton');
$ip = $_SERVER['REMOTE_ADDR'];
// Execute query and display results
// Convert wildcards to mysql format
if ($searchButton) {
    $name = StringUtil::cleanupQuery($name);
    $arr = StringUtil::analyzeQuery($name);
    $hasDiacritics = $arr[0];
    $hasRegexp = $arr[1];
    $isAllDigits = $arr[2];
    $field = $hasDiacritics ? 'formNoAccent' : 'formUtf8General';
    $userId = '';
    if ($nick) {
        $user = User::get_by_nick($nick);
        if ($user) {
            $userId = $user->id;
        }
    }
    $beginTime = mktime(0, 0, 0, $mo1, $da1, $yr1);
    $endTime = mktime(23, 59, 59, $mo2, $da2, $yr2);
    // Query the database and output the results
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:definitionLookup.php

示例5: lookup

function lookup($sourceId, $cuv, $fd)
{
    if (!source_exists($sourceId)) {
        socket_write($fd, "550 invalid database, use SHOW DB for a list\r\n");
        return;
    }
    if ($sourceId == '*' || $sourceId == '!') {
        $sourceId = 0;
    }
    $cuv = StringUtil::cleanupQuery($cuv);
    $arr = StringUtil::analyzeQuery($cuv);
    $field = $arr[0] ? 'formNoAccent' : 'formUtf8General';
    $lexems = db_find(new Lexem(), "{$field} = '{$cuv}' order by formNoAccent");
    $definitions = Definition::loadForLexems($lexems, $sourceId, $cuv);
    $searchResults = SearchResult::mapDefinitionArray($definitions);
    if (!count($definitions)) {
        socket_write($fd, "552 no match\r\n");
        return;
    }
    socket_write($fd, "150 " . count($definitions) . " definition(s) found\r\n");
    foreach ($searchResults as $sr) {
        $def = pretty_print($sr->definition->internalRep);
        socket_write($fd, "151 \"" . $cuv . "\" " . $sr->source->id . " \"" . $sr->source->name . "\"\r\n");
        socket_write($fd, "{$cuv}\r\n{$def}");
        socket_write($fd, ".\r\n");
    }
    socket_write($fd, "250 ok\r\n");
}
开发者ID:florinp,项目名称:dexonline,代码行数:28,代码来源:dict-server.php


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