本文整理汇总了PHP中repl_tab_nl函数的典型用法代码示例。如果您正苦于以下问题:PHP repl_tab_nl函数的具体用法?PHP repl_tab_nl怎么用?PHP repl_tab_nl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了repl_tab_nl函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: floor
$days = "-";
}
$score = $record['Score'];
if ($score < 0) {
$score = '<span class="scorered">0 <img src="icn/status-busy.png" title="Test today!" alt="Test today!" /></span>';
} else {
$score = '<span class="scoregreen">' . floor($score) . ($record['Score2'] < 0 ? ' <img src="icn/status-away.png" title="Test tomorrow!" alt="Test tomorrow!" />' : ' <img src="icn/status.png" title="-" alt="-" />') . '</span>';
}
echo '<tr>';
echo '<td class="td1 center"><a name="rec' . $record['WoID'] . '"><input name="marked[]" type="checkbox" class="markcheck" value="' . $record['WoID'] . '" ' . checkTest($record['WoID'], 'marked') . ' /></a></td>';
echo '<td class="td1 center" nowrap="nowrap"> <a href="' . $_SERVER['PHP_SELF'] . '?chg=' . $record['WoID'] . '"><img src="icn/sticky-note--pencil.png" title="Edit" alt="Edit" /></a> <a href="' . $_SERVER['PHP_SELF'] . '?del=' . $record['WoID'] . '"><img src="icn/minus-button.png" title="Delete" alt="Delete" /></a> </td>';
if ($currentlang == '') {
echo '<td class="td1 center">' . tohtml($record['LgName']) . '</td>';
}
echo '<td class="td1 "><span' . ($record['LgRightToLeft'] ? ' dir="rtl" ' : '') . '>' . tohtml($record['WoText']) . '</span>' . ($record['WoRomanization'] != '' ? ' / <span id="roman' . $record['WoID'] . '" class="edit_area clickedit">' . tohtml(repl_tab_nl($record['WoRomanization'])) . '</span>' : ' / <span id="roman' . $record['WoID'] . '" class="edit_area clickedit">*</span>') . '</td>';
echo '<td class="td1"><span id="trans' . $record['WoID'] . '" class="edit_area clickedit">' . tohtml(repl_tab_nl($record['WoTranslation'])) . '</span> <span class="smallgray2">' . tohtml($record['taglist']) . '</span></td>';
echo '<td class="td1 center"><b>' . ($record['SentOK'] != 0 ? '<img src="icn/status.png" title="' . tohtml($record['WoSentence']) . '" alt="Yes" />' : '<img src="icn/status-busy.png" title="(No valid sentence)" alt="No" />') . '</b></td>';
echo '<td class="td1 center" title="' . tohtml(get_status_name($record['WoStatus'])) . '">' . tohtml(get_status_abbr($record['WoStatus'])) . ($record['WoStatus'] < 98 ? '/' . $days : '') . '</td>';
echo '<td class="td1 center" nowrap="nowrap">' . $score . '</td>';
if ($currentsort == 6) {
echo '<td class="td1 center" nowrap="nowrap">' . $record['textswordcount'] . '</td>';
}
echo "</tr>\n";
}
mysql_free_result($res);
?>
</table>
</form>
<script type="text/javascript">
//<![CDATA[
示例2: trim
include "utilities.inc.php";
// INSERT
if (isset($_REQUEST['op'])) {
if ($_REQUEST['op'] == 'Save') {
$text = trim(prepare_textdata($_REQUEST["WoText"]));
$textlc = mb_strtolower($text, 'UTF-8');
$translation_raw = repl_tab_nl(getreq("WoTranslation"));
if ($translation_raw == '') {
$translation = '*';
} else {
$translation = $translation_raw;
}
$titeltext = "New Term: " . tohtml($textlc);
pagestart_nobody($titeltext);
echo '<h4><span class="bigger">' . $titeltext . '</span></h4>';
$message = runsql('insert into words (WoLgID, WoTextLC, WoText, ' . 'WoStatus, WoTranslation, WoSentence, WoRomanization, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $_REQUEST["WoLgID"] . ', ' . convert_string_to_sqlsyntax($textlc) . ', ' . convert_string_to_sqlsyntax($text) . ', ' . $_REQUEST["WoStatus"] . ', ' . convert_string_to_sqlsyntax($translation) . ', ' . convert_string_to_sqlsyntax(repl_tab_nl($_REQUEST["WoSentence"])) . ', ' . convert_string_to_sqlsyntax($_REQUEST["WoRomanization"]) . ', NOW(), ' . make_score_random_insert_update('id') . ')', "Term saved");
if (substr($message, 0, 22) == 'Error: Duplicate entry') {
$message = 'Error: Duplicate entry for ' . $textlc;
}
$wid = get_last_key();
$hex = strToClassName(prepare_textdata($textlc));
saveWordTags($wid);
$showAll = getSetting('showallwords');
$showAll = $showAll == '' ? 1 : ((int) $showAll != 0 ? 1 : 0);
?>
<p><?php
echo tohtml($message);
?>
</p>
示例3: die
die("Error: Term ID missing");
}
$sql = 'select WoText, WoLgID, WoTranslation, WoSentence, WoRomanization, WoStatus from words where WoID = ' . $wid;
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
$record = mysql_fetch_assoc($res);
if ($record) {
$term = $record['WoText'];
$lang = $record['WoLgID'];
$transl = repl_tab_nl($record['WoTranslation']);
if ($transl == '*') {
$transl = '';
}
$sentence = repl_tab_nl($record['WoSentence']);
$rom = $record['WoRomanization'];
$status = $record['WoStatus'];
} else {
die("Error: No results");
}
mysql_free_result($res);
$termlc = mb_strtolower($term, 'UTF-8');
$titeltext = "Edit Term: " . tohtml($term);
pagestart_nobody($titeltext);
$scrdir = getScriptDirectionTag($lang);
?>
<form name="editword" class="validate" action="<?php
echo $_SERVER['PHP_SELF'];
?>
示例4: do_mysql_query
$sql = 'select WoTranslation, WoSentence, WoRomanization, WoStatus from ' . $tbpref . 'words where WoID = ' . $wid;
$res = do_mysql_query($sql);
if ($record = mysql_fetch_assoc($res)) {
$status = $record['WoStatus'];
if ($fromAnn == '') {
if ($status >= 98) {
$status = 1;
}
}
$sentence = repl_tab_nl($record['WoSentence']);
if ($sentence == '' && isset($_REQUEST['tid']) && isset($_REQUEST['ord'])) {
$seid = get_first_value("select TiSeID as value from " . $tbpref . "textitems where TiTxID = " . $_REQUEST['tid'] . " and TiWordCount = 1 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="WoLgID" id="langfield" value="<?php
echo $lang;
?>
" />
<input type="hidden" name="fromAnn" value="<?php
echo $fromAnn;
示例5: adjust_autoincr
adjust_autoincr('texts', 'TxID');
adjust_autoincr('sentences', 'SeID');
adjust_autoincr('textitems', 'TiID');
} elseif ($markaction == 'addtag') {
$message = addtexttaglist($actiondata, $list);
} elseif ($markaction == 'deltag') {
$message = removetexttaglist($actiondata, $list);
header("Location: edit_texts.php");
exit;
} elseif ($markaction == 'setsent') {
$count = 0;
$sql = "select WoID, WoTextLC, min(TiSeID) as SeID from " . $tbpref . "words, " . $tbpref . "textitems where TiLgID = WoLgID and TiTextLC = WoTextLC and TiTxID in " . $list . " and ifnull(WoSentence,'') not like concat('%{',WoText,'}%') group by WoID order by WoID, min(TiSeID)";
$res = do_mysql_query($sql);
while ($record = mysql_fetch_assoc($res)) {
$sent = getSentence($record['SeID'], $record['WoTextLC'], (int) getSettingWithDefault('set-term-sentence-count'));
$count += runsql('update ' . $tbpref . 'words set WoSentence = ' . convert_string_to_sqlsyntax(repl_tab_nl($sent[1])) . ' where WoID = ' . $record['WoID'], '');
}
mysql_free_result($res);
$message = 'Term Sentences set from Text(s): ' . $count;
} elseif ($markaction == 'rebuild') {
$count = 0;
$sql = "select TxID, TxLgID from " . $tbpref . "texts where TxID in " . $list;
$res = do_mysql_query($sql);
while ($record = mysql_fetch_assoc($res)) {
$id = $record['TxID'];
$message2 = runsql('delete from ' . $tbpref . 'sentences where SeTxID = ' . $id, "Sentences deleted");
$message3 = runsql('delete from ' . $tbpref . 'textitems where TiTxID = ' . $id, "Text items deleted");
adjust_autoincr('sentences', 'SeID');
adjust_autoincr('textitems', 'TiID');
splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $record['TxLgID'], $id);
$count++;
示例6: strToClassName
echo 'status' . $record['WoStatus'];
?>
TERM<?php
echo strToClassName($record['TiTextLC']);
?>
" data_pos="<?php
echo $currcharcount;
?>
" data_order="<?php
echo $record['TiOrder'];
?>
" data_wid="<?php
echo $record['WoID'];
?>
" data_trans="<?php
echo tohtml(repl_tab_nl($record['WoTranslation']) . getWordTagList($record['WoID'], ' ', 1, 0));
?>
" data_rom="<?php
echo tohtml($record['WoRomanization']);
?>
" data_status="<?php
echo $record['WoStatus'];
?>
" data_mw2="<?php
echo tohtml($titext[2]);
?>
" data_mw3="<?php
echo tohtml($titext[3]);
?>
" data_mw4="<?php
echo tohtml($titext[4]);
示例7: splitCheckText
//.........这里部分代码省略.........
$term = mb_strtolower($lineWords[$sentNumber][$i], 'UTF-8');
if ($term != '') {
if ($i % 2 == 0) {
if (array_key_exists($term, $wordList)) {
$wordList[$term][0]++;
$wordList[$term][1][] = $sentNumber;
} else {
$wordList[$term] = array(1, array($sentNumber));
}
} else {
$ww = remove_spaces($term, $removeSpaces);
if (array_key_exists($ww, $wordSeps)) {
$wordSeps[$ww]++;
} else {
$wordSeps[$ww] = 1;
}
}
}
}
$sentNumber += 1;
}
$r .= "</ol><h4>Word List <span class=\"red2\">(red = already saved)</span></h4><ul>";
ksort($wordList);
$anz = 0;
foreach ($wordList as $key => $value) {
$trans = get_first_value("select WoTranslation as value from " . $tbpref . "words where WoLgID = " . $lid . " and WoTextLC = " . convert_string_to_sqlsyntax($key));
if (!isset($trans)) {
$trans = "";
}
if ($trans == "*") {
$trans = "";
}
if ($trans != "") {
$r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . "><span class=\"red2\">[" . tohtml($key) . "] — " . $value[0] . " - " . tohtml(repl_tab_nl($trans)) . "</span></li>";
} else {
$r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . ">[" . tohtml($key) . "] — " . $value[0] . "</li>";
}
$anz++;
}
$r .= "</ul><p>TOTAL: " . $anz . "</p><h4>Non-Word List</h4><ul>";
if (array_key_exists('', $wordSeps)) {
unset($wordSeps['']);
}
ksort($wordSeps);
$anz = 0;
foreach ($wordSeps as $key => $value) {
$r .= "<li>[" . str_replace(" ", "<span class=\"backgray\"> </span>", tohtml($key)) . "] — " . $value . "</li>";
$anz++;
}
$r .= "</ul><p>TOTAL: " . $anz . "</p></div>";
return $r;
}
////////////////////////////////////
// Split: insert sentences/textitems entries in DB
$sentNumber = 0;
$lfdnr = 0;
foreach ($textLines as $value) {
$dummy = runsql('INSERT INTO ' . $tbpref . 'sentences (SeLgID, SeTxID, SeOrder, SeText) VALUES (' . $lid . ',' . $id . ',' . ($sentNumber + 1) . ',' . convert_string_to_sqlsyntax_notrim_nonull(remove_spaces($value . ' ', $removeSpaces)) . ')', ' ');
$sentid = get_last_key();
$lineWords[$sentNumber] = preg_split('/([^' . $termchar . ']+)/u', $value . ' ', null, PREG_SPLIT_DELIM_CAPTURE);
$l = count($lineWords[$sentNumber]);
$sqltext = 'INSERT INTO ' . $tbpref . 'textitems (TiLgID, TiTxID, TiSeID, TiOrder, TiWordCount, TiText, TiTextLC, TiIsNotWord) VALUES ';
$lfdnr1 = 0;
for ($i = 0; $i < $l; $i++) {
$term = mb_strtolower($lineWords[$sentNumber][$i], 'UTF-8');
$rest2 = '';
示例8: mysql_query
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$status = $_REQUEST['status'];
$sql = 'SELECT WoText, WoTranslation, WoRomanization FROM words where WoID = ' . $wid;
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
$record = mysql_fetch_assoc($res);
if ($record) {
$word = $record['WoText'];
$trans = repl_tab_nl($record['WoTranslation']) . getWordTagList($wid, ' ', 1, 0);
$roman = $record['WoRomanization'];
} else {
die("Error: No results");
}
mysql_free_result($res);
pagestart("Term: " . $word, false);
$m1 = runsql('update words set WoStatus = ' . $_REQUEST['status'] . ', WoStatusChanged = NOW(),' . make_score_random_insert_update('u') . ' where WoID = ' . $wid, 'Status changed');
echo '<p>OK, this term has status ' . get_colored_status_msg($status) . ' from now!</p>';
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var status = '<?php
echo $status;
示例9: isset
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$value = isset($_POST['value']) ? $_POST['value'] : "";
$value = trim($value);
$id = isset($_POST['id']) ? $_POST['id'] : "";
if (substr($id, 0, 5) == "trans") {
$id = substr($id, 5);
if ($value == '') {
$value = '*';
}
$message = runsql('update ' . $tbpref . 'words set WoTranslation = ' . convert_string_to_sqlsyntax(repl_tab_nl($value)) . ' where WoID = ' . $id, "");
echo get_first_value("select WoTranslation as value from " . $tbpref . "words where WoID = " . $id);
exit;
}
if (substr($id, 0, 5) == "roman") {
if ($value == '*') {
$value = '';
}
$id = substr($id, 5);
$message = runsql('update ' . $tbpref . 'words set WoRomanization = ' . convert_string_to_sqlsyntax(repl_tab_nl($value)) . ' where WoID = ' . $id, "");
$value = get_first_value("select WoRomanization as value from " . $tbpref . "words where WoID = " . $id);
if ($value == '') {
echo '*';
} else {
echo $value;
}
exit;
}
echo "ERROR - please refresh page!";
示例10: checkText
//.........这里部分代码省略.........
$s = preg_replace('/([' . $splitSentence . '¶])\\s/u', "\$1\n", $s);
// echodebug($s,'$s/10');
$s = str_replace(" ¶\n", "\n¶\n", $s);
// echodebug($s,'$s/11');
$s = str_replace('‧', ' ', $s);
// echodebug($s,'$s/12');
if ($s == '') {
$textLines = array($s);
} else {
$s = explode("\n", $s);
$l = count($s);
for ($i = 0; $i < $l; $i++) {
$s[$i] = trim($s[$i]);
if ($s[$i] != '') {
$pos = strpos($splitSentence, $s[$i]);
while ($pos !== false && $i > 0) {
$s[$i - 1] .= " " . $s[$i];
for ($j = $i + 1; $j < $l; $j++) {
$s[$j - 1] = $s[$j];
}
array_pop($s);
$l = count($s);
$pos = strpos($splitSentence, $s[$i]);
}
}
}
$l = count($s);
$textLines = array();
for ($i = 0; $i < $l; $i++) {
$zz = trim($s[$i]);
if ($zz != '') {
$textLines[] = $zz;
}
}
}
// echodebug($textLines,'$textLines');
$lineWords = array();
$wordList = array();
$wordIndex = array();
$wordSeps = array();
$r .= "<h4>Sentences</h4><ol>";
$sentNumber = 0;
foreach ($textLines as $value) {
$r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . ">" . tohtml(remove_spaces($value, $removeSpaces)) . "</li>";
$lineWords[$sentNumber] = preg_split('/([^' . $termchar . ']{1,})/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
$l = count($lineWords[$sentNumber]);
for ($i = 0; $i < $l; $i++) {
$term = mb_strtolower($lineWords[$sentNumber][$i], 'UTF-8');
if ($term != '') {
if ($i % 2 == 0) {
if (array_key_exists($term, $wordList)) {
$wordList[$term][0]++;
$wordList[$term][1][] = $sentNumber;
} else {
$wordList[$term] = array(1, array($sentNumber));
$wordIndex[] = $term;
}
} else {
$ww = remove_spaces($term, $removeSpaces);
if (array_key_exists($ww, $wordSeps)) {
$wordSeps[$ww]++;
} else {
$wordSeps[$ww] = 1;
}
}
}
}
$sentNumber += 1;
}
$r .= "</ol><h4>Word List <span class=\"red2\">(red = already saved)</span></h4><ul>";
ksort($wordList);
$anz = 0;
foreach ($wordList as $key => $value) {
$trans = get_first_value("select WoTranslation as value from words where WoLgID = " . $lid . " and WoTextLC = " . convert_string_to_sqlsyntax($key));
if (!isset($trans)) {
$trans = "";
}
if ($trans == "*") {
$trans = "";
}
if ($trans != "") {
$r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . "><span class=\"red2\">[" . tohtml($key) . "] — " . $value[0] . " - " . tohtml(repl_tab_nl($trans)) . "</span></li>";
} else {
$r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . ">[" . tohtml($key) . "] — " . $value[0] . "</li>";
}
$anz++;
}
$r .= "</ul><p>TOTAL: " . $anz . "</p><h4>Non-Word List</h4><ul>";
if (array_key_exists('', $wordSeps)) {
unset($wordSeps['']);
}
ksort($wordSeps);
$anz = 0;
foreach ($wordSeps as $key => $value) {
$r .= "<li>[" . str_replace(" ", "<span class=\"backgray\"> </span>", tohtml($key)) . "] — " . $value . "</li>";
$anz++;
}
$r .= "</ul><p>TOTAL: " . $anz . "</p></div>";
return $r;
}
示例11: floor
$days = "-";
}
$score = $record['Score'];
if ($score < 0) {
$score = '<span class="scorered">0 <img src="icn/status-busy.png" title="Test today!" alt="Test today!" /></span>';
} else {
$score = '<span class="scoregreen">' . floor($score) . ($record['Score2'] < 0 ? ' <img src="icn/status-away.png" title="Test tomorrow!" alt="Test tomorrow!" />' : ' <img src="icn/status.png" title="-" alt="-" />') . '</span>';
}
echo '<tr>';
echo '<td class="td1 center"><a name="rec' . $record['WoID'] . '"><input name="marked[]" type="checkbox" class="markcheck" value="' . $record['WoID'] . '" ' . checkTest($record['WoID'], 'marked') . ' /></a></td>';
echo '<td class="td1 center" nowrap="nowrap"> <a href="' . $_SERVER['PHP_SELF'] . '?chg=' . $record['WoID'] . '"><img src="icn/sticky-note--pencil.png" title="Edit" alt="Edit" /></a> <a href="' . $_SERVER['PHP_SELF'] . '?del=' . $record['WoID'] . '"><img src="icn/minus-button.png" title="Delete" alt="Delete" /></a> </td>';
if ($currentlang == '') {
echo '<td class="td1 center">' . tohtml($record['LgName']) . '</td>';
}
echo '<td class="td1 "><span' . ($record['LgRightToLeft'] ? ' dir="rtl" ' : '') . '>' . tohtml($record['WoText']) . '</span>' . tohtml($record['WoRomanization'] != '' ? ' / ' . $record['WoRomanization'] : '') . '</td>';
echo '<td class="td1 ">' . tohtml(repl_tab_nl($record['WoTranslation'])) . ' <span class="smallgray2">' . tohtml($record['taglist']) . '</span></td>';
echo '<td class="td1 center"><b>' . ($record['SentOK'] != 0 ? '<img src="icn/status.png" title="' . tohtml($record['WoSentence']) . '" alt="Yes" />' : '<img src="icn/status-busy.png" title="(No valid sentence)" alt="No" />') . '</b></td>';
echo '<td class="td1 center" title="' . tohtml(get_status_name($record['WoStatus'])) . '">' . tohtml(get_status_abbr($record['WoStatus'])) . ($record['WoStatus'] < 98 ? '/' . $days : '') . '</td>';
echo '<td class="td1 center" nowrap="nowrap">' . $score . '</td>';
echo '</tr>';
}
mysql_free_result($res);
?>
</table>
</form>
<script type="text/javascript">
//<![CDATA[
$('#waitinfo').addClass('hide');
//]]>
</script>
示例12: do_mysql_query
<tr>
<th class="th1">Ed</th>
<th class="th1 clickable">Status</th>
<th class="th1 clickable">Term</th>
<th class="th1 clickable">Translation</th>
<th class="th1 clickable">Romanization</th>
<th class="th1 clickable">Sentence</th>
</tr>
<?php
$sql = 'SELECT DISTINCT WoID, WoText, WoTranslation, WoRomanization, WoSentence, WoStatus, WoTodayScore As Score FROM ' . $testsql . ' AND WoStatus BETWEEN 1 AND 5 AND WoTranslation != \'\' AND WoTranslation != \'*\' order by WoTodayScore, WoRandom*RAND()';
if ($debug) {
echo $sql;
}
$res = do_mysql_query($sql);
while ($record = mysql_fetch_assoc($res)) {
$sent = tohtml(repl_tab_nl($record["WoSentence"]));
$sent1 = str_replace("{", ' <b>[', str_replace("}", ']</b> ', mask_term_in_sentence($sent, $regexword)));
?>
<tr>
<td class="td1 center" nowrap="nowrap"><a href="edit_tword.php?wid=<?php
echo $record['WoID'];
?>
" target="ro"><img src="icn/sticky-note--pencil.png" title="Edit Term" alt="Edit Term" /></a></td>
<td class="td1 center" nowrap="nowrap"><span id="STAT<?php
echo $record['WoID'];
?>
"><?php
echo make_status_controls_test_table($record['Score'], $record['WoStatus'], $record['WoID']);
?>
</span></td>
<td class="td1 center" style="font-size:<?php