本文整理匯總了PHP中prepare_textdata_js函數的典型用法代碼示例。如果您正苦於以下問題:PHP prepare_textdata_js函數的具體用法?PHP prepare_textdata_js怎麽用?PHP prepare_textdata_js使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了prepare_textdata_js函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: get_first_value
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
echo $hex;
?>
', context).removeClass('status0').addClass('status99 word<?php
echo $wid;
?>
').attr('data_status','99').attr('data_wid','<?php
echo $wid;
?>
').attr('title',title);
$('#learnstatus', contexth).html('<?php
echo texttodocount2($_REQUEST['tid']);
?>
示例3: get_first_value
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$term = get_first_value("select WoText as value from " . $tbpref . "words where WoID = " . $wid);
pagestart("Term: " . $term, false);
$m1 = runsql('delete from ' . $tbpref . 'words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted, now unknown (" . $m1 . ").</p>";
?>
<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($term);
?>
,'','','');
$('.word<?php
echo $wid;
?>
', context).removeClass('status99 status98 status1 status2 status3 status4 status5 word<?php
echo $wid;
?>
').addClass('status0').attr('data_status','0').attr('data_trans','').attr('data_rom','').attr('data_wid','').attr('title',title);
$('#learnstatus', contexth).html('<?php
echo texttodocount2($tid);
?>
');
window.parent.frames['l'].focus();
window.parent.frames['l'].setTimeout('cClick()', 100);
示例4: get_first_value
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;
}
mysql_free_result($res);
echo "<p>OK, you know all " . $count . " word(s) well!</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
<?php
echo $javascript;
?>
示例5: function
}
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
<?php
$audio = trim($audio);
if (strcasecmp(substr($audio, -4), '.mp3') == 0) {
echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} elseif (strcasecmp(substr($audio, -4), '.ogg') == 0) {
echo 'oga: ' . prepare_textdata_js(encodeURI($audio)) . ",\n" . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} elseif (strcasecmp(substr($audio, -4), '.wav') == 0) {
echo 'wav: ' . prepare_textdata_js(encodeURI($audio)) . ",\n" . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} else {
echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
}
?>
});
},
swfPath: "js",
});
$("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, function(event) {
$("#playTime").text(Math.floor(event.jPlayer.status.currentTime));
});
$("#backbutt").click(click_back);
$("#forwbutt").click(click_forw);
$("#do-single").click(click_single);
$("#do-repeat").click(click_repeat);
示例6: createDictLinksInEditWin2
echo createDictLinksInEditWin2($record['WoLgID'], 'document.forms[\'editword\'].WoSentence', 'document.forms[\'editword\'].WoText');
?>
<input type="button" value="Cancel" onclick="{resetDirty(); location.href='edit_words.php#rec<?php
echo $_REQUEST['chg'];
?>
';}" />
<input type="submit" name="op" value="Change" /></td>
</tr>
</table>
</form>
<div id="exsent"><span class="click" onclick="do_ajax_show_sentences(<?php
echo $record['LgID'];
?>
, <?php
echo prepare_textdata_js($wordlc) . ', ' . prepare_textdata_js("document.forms['editword'].WoSentence");
?>
);"><img src="icn/sticky-notes-stack.png" title="Show Sentences" alt="Show Sentences" /> Show Sentences</span></div>
<?php
}
mysql_free_result($res);
} else {
if (substr($message, 0, 24) == "Error: Duplicate entry '" && substr($message, -24) == "' for key 'WoLgIDTextLC'") {
$lgID = $_REQUEST["WoLgID"] . "-";
$message = substr($message, 24 + strlen($lgID));
$message = substr($message, 0, strlen($message) - 24);
$message = "Error: Term '" . $message . "' already exists. Please go back and correct this!";
}
echo error_message_with_hide($message, 0);
if ($currenttext == '') {
$sql = 'select count(*) as value from (select WoID from (' . $tbpref . 'words left JOIN ' . $tbpref . 'wordtags ON WoID = WtWoID) where (1=1) ' . $wh_lang . $wh_stat . $wh_query . ' group by WoID ' . $wh_tag . ') as dummy';
示例7: prepare_textdata_js
<script type="text/javascript">
//<![CDATA[
WBLINK1 = '<?php
echo $wb1;
?>
';
WBLINK2 = '<?php
echo $wb2;
?>
';
WBLINK3 = '<?php
echo $wb3;
?>
';
SOLUTION = <?php
echo prepare_textdata_js($testtype == 1 ? $nosent ? $trans : ' [' . $trans . '] ' : $save);
?>
;
OPENED = 0;
WID = <?php
echo $wid;
?>
;
$(document).ready( function() {
$(document).keydown(keydown_event_do_test_test);
$('.word').click(word_click_event_do_test_test);
});
//]]>
</script>
</p></div>
示例8: makeAudioPlayer
//.........這裏部分代碼省略.........
</div>
</div>
</td>
<td class="center bordermiddle"> </td>
<td class="center borderright" style="padding-right:10px;">
<?php
$currentplayerseconds = getSetting('currentplayerseconds');
if ($currentplayerseconds == '') {
$currentplayerseconds = 5;
}
?>
<select id="backtime" name="backtime" onchange="{do_ajax_save_setting('currentplayerseconds',document.getElementById('backtime').options[document.getElementById('backtime').selectedIndex].value);}"><?php
echo get_seconds_selectoptions($currentplayerseconds);
?>
</select><br />
<span id="backbutt" class="click"><img src="icn/arrow-circle-225-left.png" alt="Rewind n seconds" title="Rewind n seconds" /></span> <span id="forwbutt" class="click"><img src="icn/arrow-circle-315.png" alt="Forward n seconds" title="Forward n seconds" /></span>
<span id="playTime" class="hide"></span>
</td>
<td class="width45pc"> </td>
</tr>
<script type="text/javascript">
//<![CDATA[
function new_pos(p) {
$("#jquery_jplayer_1").jPlayer("playHead", p);
}
function click_single() {
$("#jquery_jplayer_1").unbind($.jPlayer.event.ended + ".jp-repeat");
$("#do-single").addClass('hide');
$("#do-repeat").removeClass('hide');
do_ajax_save_setting('currentplayerrepeatmode','0');
return false;
}
function click_repeat() {
$("#jquery_jplayer_1").bind($.jPlayer.event.ended + ".jp-repeat", function(event) {
$(this).jPlayer("play");
});
$("#do-repeat").addClass('hide');
$("#do-single").removeClass('hide');
do_ajax_save_setting('currentplayerrepeatmode','1');
return false;
}
function click_back() {
var t = parseInt($("#playTime").text(),10);
var b = parseInt($("#backtime").val(),10);
var nt = t - b;
if (nt < 0) nt = 0;
$("#jquery_jplayer_1").jPlayer("play", nt);
}
function click_forw() {
var t = parseInt($("#playTime").text(),10);
var b = parseInt($("#backtime").val(),10);
var nt = t + b;
$("#jquery_jplayer_1").jPlayer("play", nt);
}
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", { <?php
$audio = trim($audio);
if (strcasecmp(substr($audio, -4), '.mp3') == 0) {
echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} elseif (strcasecmp(substr($audio, -4), '.ogg') == 0) {
echo 'oga: ' . prepare_textdata_js(encodeURI($audio)) . ", " . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} elseif (strcasecmp(substr($audio, -4), '.wav') == 0) {
echo 'wav: ' . prepare_textdata_js(encodeURI($audio)) . ", " . 'mp3: ' . prepare_textdata_js(encodeURI($audio));
} else {
echo 'mp3: ' . prepare_textdata_js(encodeURI($audio));
}
?>
});
},
swfPath: "js",
noVolume: {ipad: /^no$/, iphone: /^no$/, ipod: /^no$/, android_pad: /^no$/, android_phone: /^no$/, blackberry: /^no$/, windows_ce: /^no$/, iemobile: /^no$/, webos: /^no$/, playbook: /^no$/}
});
$("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, function(event) {
$("#playTime").text(Math.floor(event.jPlayer.status.currentTime));
});
$("#backbutt").click(click_back);
$("#forwbutt").click(click_forw);
$("#do-single").click(click_single);
$("#do-repeat").click(click_repeat);
<?php
echo $repeatMode ? "click_repeat();\n" : '';
?>
});
//]]>
</script>
<?php
}
// if (isset($audio))
}
示例9: print_similar_terms
function print_similar_terms($lang_id, $compared_term)
{
// Get Term and translation of terms in termid array (calculated
// in function get_similar_terms(...)) as string for echo
global $tbpref;
$max_count = (int) getSettingWithDefault("set-similar-terms-count");
if ($max_count <= 0) {
return '';
}
if (trim($compared_term) == '') {
return ' ';
}
$compare = tohtml($compared_term);
$termarr = get_similar_terms($lang_id, $compared_term, $max_count, 0.33);
$rarr = array();
foreach ($termarr as $termid) {
$sql = "select WoText, WoTranslation, WoRomanization from " . $tbpref . "words where WoID = " . $termid;
$res = do_mysql_query($sql);
if ($record = mysql_fetch_assoc($res)) {
$term = tohtml($record["WoText"]);
if (stripos($compare, $term) !== FALSE) {
$term = '<span class="red3">' . $term . '</span>';
} else {
$term = str_replace($compare, '<span class="red3"><u>' . $compare . '</u></span>', $term);
}
$tra = $record["WoTranslation"];
if ($tra == "*") {
$tra = "???";
}
if (trim($record["WoRomanization"]) !== '') {
$romd = " [" . $record["WoRomanization"] . "]";
$rom = $record["WoRomanization"];
} else {
$romd = "";
$rom = "";
}
$rarr[] = '<img class="clickedit" src="icn/tick-button-small.png" title="Copy → Translation & Romanization Field(s)" onclick="setTransRoman(' . prepare_textdata_js($tra) . ',' . prepare_textdata_js($rom) . ');" /> ' . $term . tohtml($romd) . ' — ' . tohtml($tra) . '<br />';
}
mysql_free_result($res);
}
if (count($rarr) == 0) {
return "(none)";
} else {
return implode($rarr);
}
}
示例10: foreach
foreach ($data['tuc'] as &$value) {
$word = '';
if (isset($value['phrase'])) {
if (isset($value['phrase']['text'])) {
$word = $value['phrase']['text'];
}
} else {
if (isset($value['meanings'])) {
if (isset($value['meanings'][0]['text'])) {
$word = "(" . $value['meanings'][0]['text'] . ")";
}
}
}
if ($word != '') {
$word = trim(strip_tags($word));
echo '<span class="click" onclick="addTranslation(' . prepare_textdata_js($word) . ');"><img src="icn/tick-button.png" title="Copy" alt="Copy" /> ' . $word . '</span><br />' . "\n";
$i++;
}
}
echo "</p>";
if ($i) {
echo '<p> <br/>' . $i . ' translation' . ($i == 1 ? '' : 's') . ' retrieved via <a href="http://glosbe.com/a-api" target="_blank">Glosbe API</a>.</p>';
}
} else {
echo '<p> <br/>No translations found (' . tohtml($from) . '-' . tohtml($dest) . ').</p>';
}
} else {
echo '<p> <br/>Retrieval error (' . tohtml($from) . '-' . tohtml($dest) . '). Possible reason: There is a limit of Glosbe API calls that may be done from one IP address in a fixed period of time, to prevent from abuse.</p>';
}
}
}
示例11: make_tooltip
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var status = '<?php
echo $status;
?>
';
var title = make_tooltip(<?php
echo prepare_textdata_js($word);
?>
, <?php
echo prepare_textdata_js($trans);
?>
, <?php
echo prepare_textdata_js($roman);
?>
, status);
$('.word<?php
echo $wid;
?>
', context).removeClass('status98 status99 status1 status2 status3 status4 status5').addClass('status<?php
echo $status;
?>
').attr('data_status','<?php
echo $status;
?>
').attr('title',title);
$('#learnstatus', contexth).html('<?php
echo texttodocount2($tid);
?>
示例12: get20Sentences
function get20Sentences($lang, $wordlc, $jsctlname, $mode)
{
$r = '<p><b>Sentences in active texts with <i>' . tohtml($wordlc) . '</i></b></p><p>(Click on <img src="icn/tick-button.png" title="Choose" alt="Choose" /> to copy sentence into above term)</p>';
$sql = 'SELECT DISTINCT SeID, SeText FROM sentences, textitems WHERE TiTextLC = ' . convert_string_to_sqlsyntax($wordlc) . ' AND SeID = TiSeID AND SeLgID = ' . $lang . ' order by CHAR_LENGTH(SeText), SeText limit 0,20';
$res = mysql_query($sql);
if ($res == FALSE) {
die("Invalid Query: {$sql}");
}
$r .= '<p>';
$last = '';
while ($record = mysql_fetch_assoc($res)) {
if ($last != $record['SeText']) {
$sent = getSentence($record['SeID'], $wordlc, $mode);
$r .= '<span class="click" onclick="' . $jsctlname . '.value=' . prepare_textdata_js($sent[1]) . ';"><img src="icn/tick-button.png" title="Choose" alt="Choose" /></span> ' . $sent[0] . '<br />';
}
$last = $record['SeText'];
}
mysql_free_result($res);
$r .= '</p>';
return $r;
}