当前位置: 首页>>代码示例>>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;未经允许,请勿转载。