當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Source::get_by_urlName方法代碼示例

本文整理匯總了PHP中Source::get_by_urlName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Source::get_by_urlName方法的具體用法?PHP Source::get_by_urlName怎麽用?PHP Source::get_by_urlName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Source的用法示例。


在下文中一共展示了Source::get_by_urlName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

<?php

$FROM = array('—', '◊', '♦', '[#Pr.#: -$', '$-]', '„', '”', '@ @');
$TO = array('-', '*', '**', '[#Pr.#: $-', '-$]', '"', '"', ' ');
$FROM_REGEXP = array('/@\\(([0-9])\\)([.,]?)@/', '/\\^\\{([0-9])\\}/');
$TO_REGEXP = array('(@$1@)$2', '^$1');
$dex09 = Source::get_by_urlName('dex09');
$defs = Model::factory('Definition')->where('sourceId', $dex09->id)->find_result_set();
$num = count($defs);
foreach ($defs as $i => $def) {
    $def->internalRep = str_replace($FROM, $TO, $def->internalRep);
    $def->internalRep = preg_replace($FROM_REGEXP, $TO_REGEXP, $def->internalRep);
    $def->htmlRep = AdminStringUtil::htmlize($def->internalRep, $def->sourceId);
    $def->save();
    if ($i % 1000 == 0) {
        printf("%d of %d definitions processed\n", $i, $num);
    }
}
開發者ID:florinp,項目名稱:dexonline,代碼行數:18,代碼來源:00123.php

示例2: define

<?php

require_once __DIR__ . '/../phplib/util.php';
define('SERVER_URL', 'http://localhost/~cata/DEX/wwwbase');
$opts = getopt('', array('user:', 'source:', 'date:'));
if (count($opts) != 3) {
    usage();
}
$user = User::get_by_nick($opts['user']);
$source = Source::get_by_urlName($opts['source']);
$timestamp = strtotime($opts['date']);
if (!$user || !$source || !$timestamp) {
    usage();
}
$similarSource = SimilarSource::getSimilarSource($source->id);
if (!$similarSource) {
    usage();
}
$defs = Model::factory('Definition')->where('userId', $user->id)->where('sourceId', $source->id)->where_gt('createDate', $timestamp)->where('status', Definition::ST_ACTIVE)->order_by_asc('lexicon')->find_many();
$truePositives = $falsePositives = $trueNegatives = 0;
foreach ($defs as $def) {
    $lexemIds = db_getArray("select distinct lexemId from LexemDefinitionMap where definitionId = {$def->id}");
    $similar = $def->loadSimilar($lexemIds, $diffSize);
    if ($similar) {
        $correct = ($def->similarSource == 1) == ($diffSize == 0);
        if ($correct) {
            if ($def->similarSource) {
                $truePositives++;
            } else {
                $trueNegatives++;
            }
開發者ID:florinp,項目名稱:dexonline,代碼行數:31,代碼來源:evalSimilarCheckbox.php

示例3: util_assertModerator

<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Greșeli de tipar');
$sourceClause = '';
$sourceId = 0;
$sourceUrlName = util_getRequestParameter('source');
if ($sourceUrlName) {
    $source = $sourceUrlName ? Source::get_by_urlName($sourceUrlName) : null;
    $sourceId = $source ? $source->id : 0;
    $sourceClause = $source ? "sourceId = {$sourceId} and " : '';
    SmartyWrap::assign('src_selected', $sourceId);
}
$defs = Model::factory('Definition')->raw_query("select * from Definition where {$sourceClause} id in (select definitionId from Typo) order by lexicon")->find_many();
SmartyWrap::assign('searchResults', SearchResult::mapDefinitionArray($defs));
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/viewTypos.tpl');
開發者ID:florinp,項目名稱:dexonline,代碼行數:19,代碼來源:viewTypos.php

示例4: array

<?php

$sourceMap = array('der' => Source::get_by_urlName('der'), 'dex' => Source::get_by_urlName('dex'), 'dlrm' => Source::get_by_urlName('dlrm'), 'dmlr' => Source::get_by_urlName('dmlr'), 'doom' => Source::get_by_urlName('doom'), 'nodex' => Source::get_by_urlName('nodex'), 'orto' => Source::get_by_urlName('do'));
$lexems = Model::factory('Lexem')->where_not_equal('source', '')->find_many();
$inserted = 0;
foreach ($lexems as $l) {
    $urlNames = explode(',', $l->source);
    foreach ($urlNames as $urlName) {
        $source = $sourceMap[$urlName];
        assert($source);
        $ls = Model::factory('LexemSource')->create();
        $ls->lexemId = $l->id;
        $ls->sourceId = $source->id;
        $ls->save();
        $inserted++;
    }
}
printf("%d lexems modified, %d lexem sources inserted.\n", count($lexems), $inserted);
開發者ID:florinp,項目名稱:dexonline,代碼行數:18,代碼來源:00092.php


注:本文中的Source::get_by_urlName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。