本文整理汇总了PHP中get_first_value函数的典型用法代码示例。如果您正苦于以下问题:PHP get_first_value函数的具体用法?PHP get_first_value怎么用?PHP get_first_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_first_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_trans
function make_trans($i, $wid, $trans, $word, $lang)
{
global $tbpref;
$trans = trim($trans);
$widset = is_numeric($wid);
if ($widset) {
$alltrans = get_first_value("select WoTranslation as value from " . $tbpref . "words where WoID = " . $wid);
$transarr = preg_split('/[' . get_sepas() . ']/u', $alltrans);
$r = "";
$set = false;
foreach ($transarr as $t) {
$tt = trim($t);
if ($tt == '*' || $tt == '') {
continue;
}
if (!$set && $tt == $trans) {
$set = true;
$r .= '<span class="nowrap"><input class="impr-ann-radio" checked="checked" type="radio" name="rg' . $i . '" value="' . tohtml($tt) . '" /> ' . tohtml($tt) . '</span> <br /> ';
} else {
$r .= '<span class="nowrap"><input class="impr-ann-radio" type="radio" name="rg' . $i . '" value="' . tohtml($tt) . '" /> ' . tohtml($tt) . '</span> <br /> ';
}
}
if (!$set) {
$r .= '<span class="nowrap"><input class="impr-ann-radio" checked="checked" type="radio" name="rg' . $i . '" value="" /> <input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="' . tohtml($trans) . '" maxlength="50" size="40" />';
} else {
$r .= '<span class="nowrap"><input class="impr-ann-radio" type="radio" name="rg' . $i . '" value="" /> <input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="" maxlength="50" size="40" />';
}
} else {
$r = '<span class="nowrap"><input checked="checked" type="radio" name="rg' . $i . '" value="" /> <input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="' . tohtml($trans) . '" maxlength="50" size="40" />';
}
$r .= ' <img class="click" src="icn/eraser.png" title="Erase Text Field" alt="Erase Text Field" onclick="$(\'#tx' . $i . '\').val(\'\').trigger(\'change\');" />';
$r .= ' <img class="click" src="icn/star.png" title="* (Set to Term)" alt="* (Set to Term)" onclick="$(\'#tx' . $i . '\').val(\'*\').trigger(\'change\');" />';
if ($widset) {
$r .= ' <img class="click" src="icn/plus-button.png" title="Save another translation to existent term" alt="Save another translation to existent term" onclick="addTermTranslation(' . $wid . ', \'#tx' . $i . '\',\'\',' . $lang . ');" />';
} else {
$r .= ' <img class="click" src="icn/plus-button.png" title="Save translation to new term" alt="Save translation to new term" onclick="addTermTranslation(0, \'#tx' . $i . '\',' . prepare_textdata_js($word) . ',' . $lang . ');" />';
}
$r .= '</span>';
return $r;
}
示例2: Segmenter
function Segmenter(array $t_args, array $input, array $output, array $given_states)
{
$resType = ['fragment', 'multi'];
$system_headers = ['array', 'vector', 'memory', 'cinttypes', 'unordered_map'];
$user_headers = ['HashFunctions.h'];
$lib_headers = [];
$preferFragment = get_default($t_args, 'inner.prefer.fragment', false);
$wantedRes = $preferFragment ? ['fragment', 'multi'] : ['multi', 'fragment'];
$nInputs = \count($input);
grokit_assert($nInputs > 1, 'Segmenter: Not enough inputs specified!');
$keyName = array_keys($input)[0];
$keyType = array_get_index($input, 0);
$innerInputs = array_slice($input, 1, $nInputs - 1, true);
$gla = get_first_key($t_args, ['gla', 'GLA', 0]);
grokit_assert(is_gla($gla), 'Segmenter: [gla] argument must be a valid GLA');
$gla = $gla->apply($innerInputs, $output, $given_states);
$n_passes = get_default($t_args, 'passes', 1);
grokit_assert(is_int($n_passes), 'Segmenter: [passes] argument must be an integer');
grokit_assert($n_passes > 0, 'Segmenter: [passes] argument must be > 0');
$libraries = $gla->libraries();
$innerRes = get_first_value($gla->result_type(), $wantedRes);
$innerInputs = $gla->input();
$innerOutput = $gla->output();
$input = array_merge([$keyName => $keyType], $innerInputs);
$output = $innerOutput;
$segments = get_default($t_args, 'segments', 64);
$constState = lookupResource('BASE::SegmenterState', ['gla' => $gla, 'passes' => $n_passes, 'segments' => $segments]);
$className = generate_name('Segmenter_');
$savedArgs = [];
$cArgs = [];
$innerCArgs = [];
if ($gla->configurable()) {
$savedArgs['json_init'] = 'Json::Value';
$cArgs['json_init'] = 'Json::Value';
$innerCArgs[] = 'json_init';
}
$cArgs['const_state'] = $constState;
if ($gla->has_state()) {
$innerCArgs[] = 'constState.inner_cstate';
}
$cstStr = \count($innerCArgs) > 0 ? '(' . implode(',', $innerCArgs) . ')' : '';
grokit_assert(!$gla->iterable(), 'Segementer does not support iterable GLAs');
$iterable = $n_passes > 1;
?>
class <?php
echo $className;
?>
{
private:
using ConstantState = <?php
echo $constState;
?>
;
using SplitState = ConstantState::SplitState;
static constexpr const size_t NUM_STATES = SplitState::NUM_STATES;
using InnerGLA = <?php
echo $gla;
?>
;
using InnerGLAPtr = std::unique_ptr<InnerGLA>;
using GLA_Array = std::array<InnerGLAPtr, NUM_STATES>;
public:
using size_type = std::size_t;
<?php
if ($innerRes == 'fragment') {
?>
class Iterator {
private:
InnerGLA * gla;
int fragmentNum;
InnerGLA::Iterator * innerIter;
public:
Iterator( InnerGLA * _gla, int _fragmentNum, int _innerFrag ) :
gla(_gla), fragmentNum(_fragmentNum),
innerIter(nullptr)
{
innerIter = gla->Finalize(_innerFrag);
}
~Iterator(void) {
if( innerIter != nullptr ) {
delete innerIter;
innerIter = nullptr;
}
}
bool GetNextResult( <?php
echo typed_ref_args($gla->output());
?>
) {
return innerIter->GetNextResult(<?php
echo args($gla->output());
//.........这里部分代码省略.........
示例3: word
In case this is not legally possible, any entity is granted the
right to use this work for any purpose, without any conditions,
unless such conditions are required by law.
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: insert_word_wellknown.php?tid=[textid]&ord=[textpos]
Ignore single word (new term with status 99)
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$word = get_first_value("select TiText as value from textitems where TiWordCount = 1 and TiTxID = " . $_REQUEST['tid'] . " and TiOrder = " . $_REQUEST['ord']);
$wordlc = mb_strtolower($word, 'UTF-8');
$langid = get_first_value("select TxLgID as value from texts where TxID = " . $_REQUEST['tid']);
pagestart("Term: " . $word, false);
$m1 = runsql('insert into words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($word) . ', ' . convert_string_to_sqlsyntax($wordlc) . ', 99, NOW(), ' . make_score_random_insert_update('id') . ')', 'Term added');
$wid = get_last_key();
echo "<p>OK, you know this term well!</p>";
$hex = strToClassName($wordlc);
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php
echo prepare_textdata_js($word);
?>
,'*','','99');
$('.TERM<?php
示例4: where
<th class="th1 clickable">Tag Text</th>
<th class="th1 clickable">Tag Comment</th>
<th class="th1 clickable">Terms With Tag</th>
</tr>
<?php
$sql = 'select TgID, TgText, TgComment from tags where (1=1) ' . $wh_query . ' order by ' . $sorts[$currentsort - 1] . ' ' . $limit;
if ($debug) {
echo $sql;
}
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
while ($record = mysql_fetch_assoc($res)) {
$c = get_first_value('select count(*) as value from wordtags where WtTgID=' . $record['TgID']);
echo '<tr>';
echo '<td class="td1 center"><a name="rec' . $record['TgID'] . '"><input name="marked[]" type="checkbox" class="markcheck" value="' . $record['TgID'] . '" ' . checkTest($record['TgID'], 'marked') . ' /></a></td>';
echo '<td class="td1 center" nowrap="nowrap"> <a href="' . $_SERVER['PHP_SELF'] . '?chg=' . $record['TgID'] . '"><img src="icn/document--pencil.png" title="Edit" alt="Edit" /></a> <a href="' . $_SERVER['PHP_SELF'] . '?del=' . $record['TgID'] . '"><img src="icn/minus-button.png" title="Delete" alt="Delete" /></a> </td>';
echo '<td class="td1 center">' . tohtml($record['TgText']) . '</td>';
echo '<td class="td1 center">' . tohtml($record['TgComment']) . '</td>';
echo '<td class="td1 center">' . ($c > 0 ? '<a href="edit_words.php?page=1&query=&text=&status=&filterlang=&status=&tag12=0&tag2=&tag1=' . $record['TgID'] . '">' . $c . '</a>' : '0') . '</td>';
echo '</tr>';
}
mysql_free_result($res);
?>
</table>
</form>
<?php
if ($pages > 1) {
示例5: limitlength
$g = '';
}
$w = limitlength($w, 250);
$wl = limitlength(mb_strtolower($w, 'UTF-8'), 250);
$t = limitlength($t, 500);
$r = limitlength($r, 100);
$s = limitlength($s, 1000);
$g = explode(",", trim(str_replace(" ", ",", $g)));
$g = array_filter($g, "notempty");
array_walk($g, 'limit20');
$protokoll .= '<tr><td class="td1 right">' . ($i + 1) . '</td><td class="td1">' . tohtml($w) . '</td><td class="td1">' . tohtml($t) . '</td><td class="td1">' . tohtml($r) . '</td><td class="td1">' . tohtml($s) . '</td><td class="td1">' . implode(", ", $g) . '</td>';
if ($w != '') {
if ($t == '') {
$t = '*';
}
$excnt = get_first_value('select count(*) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoTextLC=' . convert_string_to_sqlsyntax($wl));
if ($excnt > 0) {
// exists
if ($overwrite) {
// update
$msg1 = runsql('delete from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoTextLC=' . convert_string_to_sqlsyntax($wl), "Exists, deleted");
runsql("DELETE " . $tbpref . "wordtags FROM (" . $tbpref . "wordtags LEFT JOIN " . $tbpref . "words on WtWoID = WoID) WHERE WoID IS NULL", '');
$msg2 = runsql('insert into ' . $tbpref . 'words (WoLgID, WoTextLC, WoText, WoStatus, WoTranslation, WoRomanization, WoSentence, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values ( ' . $lang . ', ' . convert_string_to_sqlsyntax($wl) . ', ' . convert_string_to_sqlsyntax($w) . ', ' . $status . ', ' . convert_string_to_sqlsyntax($t) . ', ' . convert_string_to_sqlsyntax($r) . ', ' . convert_string_to_sqlsyntax($s) . ', NOW(), ' . make_score_random_insert_update('id') . ')', "Imported");
$wid = get_last_key();
array_walk($g, 'savetag', $wid);
$sqlct++;
$protokoll .= '<td class="td1">' . tohtml($msg1 . ' / ' . $msg2) . ' (' . $sqlct . ')</td></tr>';
} else {
// no overwrite
$protokoll .= '<td class="td1"><span class="red2">EXISTS, NOT IMPORTED</span></td></tr>';
}
示例6: LWT
// ********* WORDPRESS LOGOUT *********
?>
<br /><br /></li>
<li><a href="info.htm">Help/Information</a></li>
<li><a href="mobile.php">Mobile LWT (Experimental)</a></li>
</ul>
<p class="smallgray graydotted"> </p>
<table><tr><td class="width50px"><a target="_blank" href="http://unlicense.org/"><img alt="Public Domain" title="Public Domain" src="img/public_domain.png" /></a></td><td><p class="smallgray"><a href="http://lwt.sourceforge.net/" target="_blank">"Learning with Texts" (LWT)</a> is free and unencumbered software released<br />into the <b>PUBLIC DOMAIN</b>. <a href="http://unlicense.org/" target="_blank">More information and detailed Unlicense ...</a><br />
<?php
flush();
// optimizedb();
$p = convert_string_to_sqlsyntax_nonull($tbpref);
$mb = get_first_value("SELECT round(sum(data_length+index_length)/1024/1024,1) as value FROM information_schema.TABLES where table_schema = " . convert_string_to_sqlsyntax($dbname) . " and table_name in (" . "CONCAT(" . $p . ",'archivedtexts')," . "CONCAT(" . $p . ",'archtexttags')," . "CONCAT(" . $p . ",'languages')," . "CONCAT(" . $p . ",'sentences')," . "CONCAT(" . $p . ",'settings')," . "CONCAT(" . $p . ",'tags')," . "CONCAT(" . $p . ",'tags2')," . "CONCAT(" . $p . ",'textitems')," . "CONCAT(" . $p . ",'texts')," . "CONCAT(" . $p . ",'texttags')," . "CONCAT(" . $p . ",'words')," . "CONCAT(" . $p . ",'wordtags'))");
if (!isset($mb)) {
$mb = '0.0';
}
?>
This is <b>LWT <?php
echo get_version();
?>
</b><br />Database: <b><?php
echo $dbname;
?>
</b> on <b><?php
echo $server;
?>
</b> / <?php
示例7: Known
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: all_words_wellknown.php?text=[textid]
Setting all unknown words to Well Known (99)
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$langid = get_first_value("select TxLgID as value from " . $tbpref . "texts where TxID = " . $_REQUEST['text']);
pagestart("Setting all blue words to Well-known", false);
$sql = 'select distinct TiText, TiTextLC from (' . $tbpref . 'textitems left join ' . $tbpref . 'words on (TiTextLC = WoTextLC) and (TiLgID = WoLgID)) where TiIsNotWord = 0 and WoID is null and TiWordCount = 1 and TiTxID = ' . $_REQUEST['text'] . ' order by TiOrder';
$res = do_mysql_query($sql);
$count = 0;
$javascript = "var title='';";
while ($record = mysql_fetch_assoc($res)) {
$term = $record['TiText'];
$termlc = $record['TiTextLC'];
$count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($term) . ', ' . convert_string_to_sqlsyntax($termlc) . ', 99 , NOW(), ' . make_score_random_insert_update('id') . ')', '');
$wid = get_last_key();
if ($count1 > 0) {
$javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','99');";
}
$javascript .= "\$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status99 word" . $wid . "').attr('data_status','99').attr('data_wid','" . $wid . "').attr('title',title);";
$count += $count1;
示例8: getSetting
unless such conditions are required by law.
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: delete_mword.php?wid=[wordid]&tid=[textid]
Delete an expression
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$showAll = getSetting('showallwords');
$showAll = $showAll == '' ? 1 : ((int) $showAll != 0 ? 1 : 0);
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$word = get_first_value("select WoText as value from words where WoID = " . $wid);
pagestart("Term: " . $word, false);
$m1 = runsql('delete from words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
$('.word<?php
echo $wid;
?>
', context).removeClass('status1 status2 status3 status4 status5 status98 status99 word<?php
echo $wid;
?>
示例9: get_annotation_link
function get_annotation_link($textid)
{
global $tbpref;
if (get_first_value('select length(TxAnnotatedText) as value from ' . $tbpref . 'texts where TxID=' . $textid) > 0) {
return ' <a href="print_impr_text.php?text=' . $textid . '" target="_top"><img src="icn/tick.png" title="Annotated Text" alt="Annotated Text" /></a>';
} else {
return '';
}
}
示例10: mysql_query
<th class="th1 sorttable_numeric clickable">Terms</th>
</tr>
<?php
$sql = 'select LgID, LgName from languages order by LgName';
if ($debug) {
echo $sql;
}
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
while ($record = mysql_fetch_assoc($res)) {
$textcount = get_first_value('select count(TxID) as value from texts where TxLgID=' . $record['LgID']);
$archtextcount = get_first_value('select count(AtID) as value from archivedtexts where AtLgID=' . $record['LgID']);
$wordcount = get_first_value('select count(WoID) as value from words where WoLgID=' . $record['LgID']);
echo '<tr>';
if ($current == $record['LgID']) {
$tdth = 'th';
echo '<th class="th1"><img src="icn/exclamation-red.png" title="Current Language" alt="Current Language" /></th>';
} else {
$tdth = 'td';
echo '<td class="td1 center"><a href="save_setting_redirect.php?k=currentlanguage&v=' . $record['LgID'] . '&u=edit_languages.php"><img src="icn/tick-button.png" title="Set as Current Language" alt="Set as Current Language" /></a></td>';
}
echo '<' . $tdth . ' class="' . $tdth . '1 center"><a href="do_test.php?lang=' . $record['LgID'] . '"><img src="icn/question-balloon.png" title="Test" alt="Test" /></a></' . $tdth . '>';
echo '<' . $tdth . ' class="' . $tdth . '1 center" nowrap="nowrap"> <a href="' . $_SERVER['PHP_SELF'] . '?chg=' . $record['LgID'] . '"><img src="icn/document--pencil.png" title="Edit" alt="Edit" /></a>';
if ($textcount == 0 && $archtextcount == 0 && $wordcount == 0) {
echo ' <span class="click" onclick="if (confirm (\'Are you sure?\')) location.href=\'' . $_SERVER['PHP_SELF'] . '?del=' . $record['LgID'] . '\';"><img src="icn/minus-button.png" title="Delete" alt="Delete" /></span>';
} else {
echo ' <img src="icn/placeholder.png" title="Delete not possible" alt="Delete not possible" />';
}
示例11: get_first_value
$kt = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99) and cast(WoStatusChanged as date) = curdate()');
$cy = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoCreated as date) = subdate(curdate(), \'1 day\')');
$ay = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')');
$ky = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99) and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')');
$cw = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoCreated as date) between subdate(curdate(), \'6 day\') and curdate()');
$aw = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()');
$kw = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()');
$cm = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoCreated as date) between subdate(curdate(), \'29 day\') and curdate()');
$am = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()');
$km = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()');
$ca = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoCreated as date) between subdate(curdate(), \'364 day\') and curdate()');
$aa = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()');
$ka = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()');
$call = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99)');
$aall = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (1,2,3,4,5,99)');
$kall = get_first_value('select count(WoID) as value from ' . $tbpref . 'words where WoLgID = ' . $lang . ' and WoStatus in (5,99)');
$sumct += $ct;
$sumat += $at;
$sumkt += $kt;
$sumcy += $cy;
$sumay += $ay;
$sumky += $ky;
$sumcw += $cw;
$sumaw += $aw;
$sumkw += $kw;
$sumcm += $cm;
$sumam += $am;
$sumkm += $km;
$sumca += $ca;
$sumaa += $aa;
$sumka += $ka;
示例12: pageend
pageend();
exit;
}
?>
<p>OK: <?php
echo tohtml($message);
?>
</p>
<?php
$lang = get_first_value('select WoLgID as value from ' . $tbpref . 'words where WoID = ' . $wid);
if (!isset($lang)) {
my_die('Cannot retrieve language in edit_tword.php');
}
$regexword = get_first_value('select LgRegexpWordCharacters as value from ' . $tbpref . 'languages where LgID = ' . $lang);
if (!isset($regexword)) {
my_die('Cannot retrieve language data in edit_tword.php');
}
$sent = tohtml(repl_tab_nl($_REQUEST["WoSentence"]));
$sent1 = str_replace("{", ' <b>[', str_replace("}", ']</b> ', mask_term_in_sentence($sent, $regexword)));
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var woid = <?php
echo prepare_textdata_js($wid);
?>
;
if(window.parent.frames['l'].location.href.indexOf('do_test_table') !== -1) {
示例13: text
This applies worldwide.
In case this is not legally possible, any entity is granted the
right to use this work for any purpose, without any conditions,
unless such conditions are required by law.
Developed by J.P. in 2011, 2012.
***************************************************************/
/**************************************************************
Call: do_text.php?start=[textid]
Start Reading a text (frameset)
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
if (isset($_REQUEST['start'])) {
$audio = get_first_value('select TxAudioURI as value from texts where TxID = ' . $_REQUEST['start']);
framesetheader('Read');
?>
<frameset cols="<?php
echo tohtml(getSettingWithDefault('set-text-l-framewidth-percent'));
?>
%,*">
<frameset rows="<?php
echo isset($audio) ? getSettingWithDefault('set-text-h-frameheight-with-audio') : getSettingWithDefault('set-text-h-frameheight-no-audio');
?>
,*">
<frame src="do_text_header.php?text=<?php
echo $_REQUEST['start'];
?>
" scrolling="no" name="h" />
<frame src="do_text_text.php?text=<?php
示例14: mysql_query
);"><img src="icn/sticky-notes-stack.png" title="Show Sentences" alt="Show Sentences" /> Show Sentences</span></div>
<?php
} else {
$sql = 'select WoTranslation, WoSentence, WoRomanization, WoStatus from words where WoID = ' . $wid;
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
if ($record = mysql_fetch_assoc($res)) {
$status = $record['WoStatus'];
if ($status >= 98) {
$status = 1;
}
$sentence = repl_tab_nl($record['WoSentence']);
if ($sentence == '') {
$seid = get_first_value("select TiSeID as value from textitems where TiTxID = " . $_REQUEST['tid'] . " and TiOrder = " . $_REQUEST['ord']);
$sent = getSentence($seid, $termlc, (int) getSettingWithDefault('set-term-sentence-count'));
$sentence = repl_tab_nl($sent[1]);
}
$transl = repl_tab_nl($record['WoTranslation']);
if ($transl == '*') {
$transl = '';
}
?>
<form name="editword" class="validate" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="post">
<input type="hidden" name="WoID" value="<?php
echo $wid;
示例15: Multiplexer
function Multiplexer(array $t_args, array $inputs, array $outputs)
{
$className = generate_name('Multiplexer');
if (\count($inputs) == 0) {
grokit_assert(array_key_exists('input', $t_args), 'No inputs specified for Multiplexer');
$inputs = $t_args['input'];
foreach ($t_args['inputs'] as $name => &$type) {
if (is_identifier($type)) {
$type = lookupType(strval($type));
}
grokit_assert(is_datatype($type), 'Only types may be specified as inputs to Multiplexer.');
}
$inputs = ensure_valid_names($inputs, 'multi_input');
}
$glas = get_first_key($t_args, ['glas', 0]);
grokit_assert(\count($glas) > 0, 'No GLAs specified for Multiplexer.');
$myGLAs = [];
$glaInputs = [];
$glaOutputs = [];
$resultType = 'multi';
$usedOutputs = [];
$libraries = [];
$glaGenStates = [];
$glaReqStates = [];
$configurable = false;
$constArgs = [];
$genStates = [];
$reqStates = [];
$iterable = null;
foreach ($glas as $name => $glaInfo) {
grokit_assert(is_array($glaInfo), 'Template argument \'glas\' must be an array');
grokit_assert(array_key_exists('gla', $glaInfo), 'No GLA given for glas[' . $name . ']');
grokit_assert(array_key_exists('inputs', $glaInfo), 'No inputs given for glas[' . $name . ']');
grokit_assert(array_key_exists('outputs', $glaInfo), 'No outputs given for glas[' . $name . ']');
$gla = $glaInfo['gla'];
$glaInAtts = $glaInfo['inputs'];
$glaOutAtts = $glaInfo['outputs'];
grokit_assert(is_gla($gla), 'Non-GLA given for glas[' . $name . '][gla]');
grokit_assert(is_array($glaInAtts), 'Non-array given for inputs for gla ' . $name);
grokit_assert(is_array($glaOutAtts), 'Non-array given for outputs for gla ' . $name);
$glaInAtts = array_map('strval', $glaInAtts);
$glaOutAtts = array_map('strval', $glaOutAtts);
$glaName = "innerGLA_" . $name;
$glaInputs[$glaName] = [];
$glaOutputs[$glaName] = [];
foreach ($glaInAtts as $att) {
grokit_assert(array_key_exists($att, $inputs), 'Input ' . $att . ' for GLA ' . $name . ' not found in inputs');
$glaInputs[$glaName][$att] = $inputs[$att];
}
foreach ($glaOutAtts as $att) {
grokit_assert(array_key_exists($att, $outputs), 'Output ' . $att . ' for GLA ' . $name . ' not found in outputs');
grokit_assert(!in_array($att, $usedOutputs), 'Output ' . $att . ' used by multiple GLAs');
$usedOutputs[] = $att;
$glaOutputs[$glaName][$att] = $outputs[$att];
}
//fwrite(STDERR, "Inputs for GLA " . $glaName . ": " . print_r($glaInputs[$glaName], true) . PHP_EOL );
//fwrite(STDERR, "Outputs for GLA " . $glaName . ": " . print_r($glaOutputs[$glaName], true) . PHP_EOL );
$gla = $gla->apply($glaInputs[$glaName], $glaOutputs[$glaName]);
$myGLAs[$glaName] = $gla;
$glaRez[$glaName] = get_first_value($gla->result_type(), ['multi', 'single', 'state']);
$libraries = array_merge($libraries, $gla->libraries());
if ($glaRez[$glaName] == 'state') {
grokit_assert(\count($glaOutputs[$glaName]) == 1, "GLA {$glaName} is produced as state, and thus must have exactly 1 output.");
$stateType = lookupType('base::STATE', ['type' => $gla]);
$glaOutputs[$glaName] = array_combine(array_keys($glaOutputs[$glaName]), [$stateType]);
} else {
grokit_assert(\count($glaOutputs[$glaName]) == \count($gla->output()), 'GLA ' . $glaName . ' produces different number of outputs than expected');
$glaOutputs[$glaName] = array_combine(array_keys($glaOutputs[$glaName]), $gla->output());
}
// Set types for our output
foreach ($glaOutputs[$glaName] as $attName => $type) {
$outputs[$attName] = $type;
}
if (is_null($iterable)) {
$iterable = $gla->iterable();
} else {
grokit_assert($iterable == $gla->iterable(), 'Multiplexer does not support mixing iterable and non-iterable GLAs');
}
$glaReqStates[$glaName] = $gla->req_states();
foreach ($gla->req_states() as $rstate) {
$reqStates[] = $rstate;
}
$glaGenStates[$glaName] = $gla->state();
// TODO: Support constant states
grokit_assert(!$gla->has_state(), 'Multiplexer currently does not support constant states.');
}
$libraries = array_unique($libraries);
$extra = ['glas' => $myGLAs];
?>
class <?php
echo $className;
?>
{
<?php
foreach ($myGLAs as $name => $type) {
?>
<?php
echo $type;
?>
//.........这里部分代码省略.........