本文整理汇总了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);
}
}
示例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++;
}
示例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');
示例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);