LWT_API_RELEASE_DATE
public
string
LWT_API_RELEASE_DATE
= "2023-12-29"
Date of the last released change of the LWT API.
public
string
LWT_API_RELEASE_DATE
= "2023-12-29"
Date of the last released change of the LWT API.
public
string
LWT_API_VERSION
= "0.1.1"
Version of this current LWT API.
public
array<string|int, string>
LWT_CSS_FILES
= array('src/css/css_charts.css', 'src/css/feed_wizard.css', 'src/css/gallery.css', 'src/css/jplayer.css', 'src/css/jquery-ui.css', 'src/css/jquery.tagit.css', 'src/css/styles.css')
LWT_CSS_FILES All the paths of CSS files to be minified.
public
array<string|int, string>
LWT_JS_FILES
= array('src/js/audio_controller.js', 'src/js/third_party/countuptimer.js', 'src/js/jq_feedwizard.js', 'src/js/text_events.js', 'src/js/jq_pgm.js', 'src/js/overlib_interface.js', 'src/js/pgm.js', 'src/js/translation_api.js', 'src/js/unloadformcheck.js', 'src/js/third_party/sorttable.js', 'src/js/user_interactions.js')
LWT_JS_FILES All the paths of JS files to be minified.
public
array<string|int, mixed>
LWT_LANGUAGES_ARRAY
= array("Afrikaans" => array("af", "af", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Arabic" => array("ar", "ar", \true, "\\x{610}-\\x{614}\\x{621}-\\x{65F}" . "\\x{671}-\\x{6D3}\\x{6DE}-\\x{6FF}", ".!?:;\\x{061B}\\x{061F}", \false, \false, \true), "Belarusian" => array("be", "be", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Bulgarian" => array("bg", "bg", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Catalan" => array("ca", "ca", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Chinese (Simplified)" => array("zh", "zh-CN", \true, "\\x{4E00}-\\x{9FFF}\\x{F900}-\\x{FAFF}", ".!?:;。!?:;", \true, \true, \false), "Chinese (Traditional)" => array("zh", "zh-TW", \true, "\\x{4E00}-\\x{9FFF}\\x{F900}-\\x{FAFF}" . "\\x{3100}-\\x{312F}", ".!?:;。!?:;", \true, \true, \false), "Croatian" => array("hr", "hr", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Czech" => array("cs", "cs", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Danish" => array("da", "da", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Dutch" => array("nl", "nl", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "English" => array("en", "en", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Esperanto" => array("eo", "eo", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Estonian" => array("et", "et", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Finnish" => array("fi", "fi", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "French" => array("fr", "fr", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "German" => array("de", "de", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Greek (Modern)" => array("el", "el", \false, "\\x{0370}-\\x{03FF}\\x{1F00}-\\x{1FFF}", ".!?:;", \false, \false, \false), "Hebrew" => array("he", "iw", \true, "\\x{0590}-\\x{05FF}", ".!?:;", \false, \false, \true), "Hungarian" => array("hu", "hu", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Italian" => array("it", "it", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Japanese" => array("ja", "ja", \true, "\\x{4E00}-\\x{9FFF}\\x{F900}-\\x{FAFF}\\x{3040}-\\x{30FF}\\x{31F0}-\\x{31FF}", ".!?:;。!?:;", \true, \true, \false), "Korean" => array("ko", "ko", \true, "\\x{4E00}-\\x{9FFF}\\x{F900}-\\x{FAFF}\\x{1100}-\\x{11FF}" . "\\x{3130}-\\x{318F}\\x{AC00}-\\x{D7A0}", ".!?:;。!?:;", \false, \false, \false), "Latin" => array("la", "la", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Latvian" => array("lv", "lv", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Lithuanian" => array("lt", "lt", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Macedonian" => array("mk", "mk", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Norwegian Bokmål" => array("nb", "no", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Polish" => array("pl", "pl", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Portuguese" => array("pt", "pt", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Romanian" => array("ro", "ro", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Russian" => array("ru", "ru", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Serbian" => array("sr", "sr", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Slovak" => array("sk", "sk", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Spanish" => array("es", "es", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Swedish" => array("sv", "sv", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Thai" => array("th", "th", \true, "\\x{0E00}-\\x{0E7F}", ".!?:;", \false, \false, \false), "Turkish" => array("tr", "tr", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false), "Ukrainian" => array("uk", "uk", \false, "\\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ", ".!?:;", \false, \false, \false))
LWT_LANG_DEFS Associative array for all the supported languages
"Name" => ("glosbeIso", "googleIso", biggerFont, "wordCharRegExp", "sentSplRegExp", makeCharacterWord, removeSpaces, rightToLeft)
public
string|null
YT_API_KEY
= null
YT_API_KEY Text from YouTube API key
You can change the key here.
Make the SQL query for all words in the text.
all_words_wellknown_get_words(int $txid) : mysqli_result|true
Text id
SQL query.
For each word, add the word to the database.
all_words_wellknown_process_word(int $status, string $term, string $termlc, int $langid) : array<string|int, mixed>
New word status
Word to mark
Same as $term, but in lowercase.
Language ID
[int, string] Number of rows edited and a javascript query.
Main processing loop to mark all words of a text with a new status.
all_words_wellknown_main_loop(int $txid, int $status) : array<string|int, mixed>
Text ID
New status to apply to all words.
[int, string] Number of edited words, and JavaScript query to change their display
Display the number of edited words.
all_words_wellknown_count_terms(int $status, int $count) : void
New status
Number of edited words.
Execute JavaScript to change the display of all words.
all_words_wellknown_javascript(int $txid, string $javascript) : void
Text ID
JavaScript-formatted string.
Make the main content of the page for all well-known words.
all_words_wellknown_content(int $txid, int $status) : void
Text ID
New status to apply to words.
Make a full HTML page for all well-known words.
all_words_wellknown_full(int $txid, int $status) : void
Text ID
New status to apply to words.
bulk_save_terms(mixed $terms, mixed $tid, mixed $cleanUp) : void
bulk_do_content(mixed $tid, mixed $sl, mixed $tl, mixed $pos) : void
Return the term corresponding to the ID.
get_term(string $wid) : string
ID of the word
A word
Edit the word from the database.
delete_word_from_database(string $wid) : string
ID of the word to delete
Some edit message, number of affected rows or error message
Do the JavaScript action for changing display of the word.
delete_word_javascript(string $wid, int $tid) : void
ID of the word to delete
Text ID
Make the HTML content of the page when deleting a word.
delete_word_page_content(int $tid, string $wid, string $term, string $m1) : void
Text ID
ID of the word to delete
The deleted word
Some edit message, number of affected rows or error message
Complete workflow for deleting a word.
do_delete_word(int $textid, string $wordid) : void
It edits the database, show the success message and do JavaScript action to change its display.
ID of the affected text
ID of the word to delete
Make the page content to display printed texts on mobile.
do_mobile_display_impr_text(int $textid, string $audio) : void
Text ID
Media URI
Make the main page content to display printed texts for desktop.
do_desktop_display_impr_text(int $textid, string $audio) : void
Text ID
Media URI
Do the page to display printed text.
do_display_impr_text_page(int $textid) : void
Text ID
Return the useful data for the header part of a printed text.
do_diplay_impr_text_header_data(int $textid) : array{0: string, 1: string, 2: string}
Text ID
Text title, text audio and source URI
Echo JavaScript area containing behaviors to show/hide translations and annotations.
do_diplay_impr_text_header_js() : void
Make the header content to display a printed text.
do_diplay_impr_text_header_content(string $title, int $textid, string $audio, string $sourceURI) : void
Text title
Text ID
Audio URI
Text source link
Main function to generate a complete header for a specific text.
do_diplay_impr_text_header_main(int $textid) : void
Text ID.
Return the annotatino of a text.
get_annotated_text(int $textid) : string
Text ID
Text annotations
Get settings for this text.
get_display_impr_text_text_data(int $textid) : array{0: int, 1: bool}
Text ID
Text size, and if this text is rigth-to-left.
Prepare JavaScript interactions for the text content.
do_diplay_impr_text_text_js() : void
Make the main content for a printed text.
do_diplay_impr_text_text_area(string $ann, string $textsize, bool $rtlScript) : void
Annotations separated b tabulations "\t"
Text size
True if this text is right-to-left
Parse the annotations (translation/romanization) and return them.
get_word_annotations(array<string|int, string> $vals) : array{0: string, 1: string}
Annotations values
Translation and romanization.
Display a single word item.
do_display_impr_text_text_word(string $item, string $textsize) : void
Word item, values separated by a tabulation.
Text size
Main function to do a complete printed text text content.
do_display_impr_text_text_main([int|null $textid = null ]) : void
Text ID, we will use page request if not provided.
Find the L2 language name.
get_l2_language_name() : string
Language name
Find the appropiate property to add to the test.
get_test_property() : string
It uses requests provided to the page.
Some URL property
Make the content of the mobile page.
do_test_mobile_page_content(string $property) : void
URL property
Make the mobile test page.
do_test_mobile_page([string $property = null ]) : void
Unnused, null by default
Make the desktop test page
do_test_desktop_page([string $property = null ]) : void
Unnused, null by default
Start the test page.
do_test_page(string $p) : void
Unnused.
Main function to try to start a test page.
try_start_test(mixed $p) : void
If unsifficiant arguments are provided to the page, the page will be redirected to edit_texts.php.
Set useful data for the test using SQL query.
get_sql_test_data(string &$title, string &$p) : string
Title to be overwritten
Property URL to be overwritten
SQL query to use
Set useful data for the test using language.
get_lang_test_data(string &$title, string &$p) : string
Title to be overwritten
Property URL to be overwritten
SQL query to use
Set useful data for the test using text.
get_text_test_data(string &$title, string &$p) : string
Title to be overwritten
Property URL to be overwritten
SQL query to use
Return the words count for this test.
get_test_counts(string $testsql) : array{0: string, 1: string}
SQL query for this test.
Total words due and total words learning
Make the header row for tests.
do_test_header_row(mixed $_p) : void
URL property to use (unnused), will be removed in LWT 3.0.0
Prepare JavaScript content for the header.
do_test_header_js() : void
Make the header content for tests.
do_test_header_content(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Page title
URL property to use
Number of words due for today
Total number of words.
L2 language name
Set useful data for the test.
get_test_data(string &$title, string &$p) : array{0: string, 1: string}
Title to be overwritten
Property URL to be overwritten
Total words due and total words learning
Do the header for test page.
do_test_header_page(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Page title
URL property to use
Number of words due for today
Total number of words.
L2 Language name
Use requests passed to the page to start it.
start_test_header_page([string $language = 'L2' ]) : void
L2 language name
Set sql request for the word test.
get_test_table_sql() : string
SQL request string
do_test_table_language_settings(mixed $testsql) : array<string|int, float|int|null|string>|false|null
get_test_table_settings() : array<string|int, int>
do_test_table_javascript() : void
do_test_table_settings(mixed $settings) : void
do_test_table_header() : void
do_test_table_table_content(mixed $lang_record, mixed $testsql) : void
do_test_table_row(mixed $record, mixed $regexword, mixed $textsize, mixed $span1, mixed $span2) : void
do_test_table() : void
Get the SQL string to perform tests.
do_test_get_identifier(int|null $selection, string|null $sess_testsql, int|null $lang, int|null $text) : array<string|int, int|array<string|int, int>|string>
Test is of type selection
SQL string for test
Test is of type language, for the language $lang ID
Testing text with ID $text
Test identifier as an array(key, value)
Get the SQL string to perform tests.
do_test_get_test_sql(int|null $selection, string|null $sess_testsql, int|null $lang, int|null $text) : string
Test is of type selection
SQL string for test
Test is of type language, for the language $lang ID
Testing text with ID $text
SQL projection (selection) string
Get the test type clamped between 1 and 5 (included)
do_test_get_test_type(int $testtype) : int
Initial test type value
Clamped $testtype
Set sql request for the word test.
get_test_sql() : string
SQL request string
Give the test type.
get_test_type() : int<1, 5>
Test type between 1 and 5 (included)
Prepare the css code for tests.
do_test_test_css() : void
Return the number of test due for tomorrow.
do_test_get_tomorrow_tests_count(string $testsql) : int
Test selection string
Tomorrow tests
Output a message for a finished test, with the number of tests for tomorrow.
do_test_test_finished(string $testsql, int $totaltests[, bool $ajax = false ]) : void
Query used to select words.
Total number of tests.
AJAX mode, content will not be displayed.
Get a sentence containing the word.
do_test_test_sentence(int $wid, mixed $lang, string $wordlc) : array<string|int, int|null|string>
The sentence should contain at least 70% of known words.
The word to test.
ID of the language, will be removed in PHP 3.0.0
Word in lowercase
Sentence with escaped word and 1.
Return the test relative to a word.
do_test_get_term_test(array<string|int, mixed> $wo_record, string $sent, int $testtype, bool|int $nosent, string $regexword) : array<string|int, string>
Query from the database regarding a word.
Sentence containing the word.
Type of test
1 or true if you want to hide sentences.
Regex to select the desired word.
HTML-escaped and raw text sentences (or word)
Echo the test relative to a word.
print_term_test(array<string|int, mixed> $wo_record, string $sent, int $testtype, int $nosent, string $regexword) : string
Query from the database regarding a word.
Sentence containing the word.
Type of test
1 if you want to hide sentences.
Regex to select the desired word.
HTML-escaped and raw text sentences (or word)
Find the next word to test.
do_test_get_word(string $testsql) : array<string|int, float|int|null|string>
Test selection string
Empty array
Get the solution to a test.
get_test_solution(int $testtype, array<string|int, mixed> $wo_record, bool $nosent, string $wo_text) : string
Test type between 1 and 5
Word record element
Test is in word mode
Word text
Solution to display.
Preforms the HTML of the test area, to update through AJAX.
do_test_prepare_ajax_test_area(string $selector, array<string|int, mixed>|int $selection, int $count, int $testtype) : int
On which set to run the test.
ID of the elements of the set to use.
Number of tests left.
Type of test (words, sentences, etc...).
Number of tests left to do.
Preforms the HTML of the test area.
prepare_test_area(string $testsql, int $totaltests, int $count, int $testtype) : int
SQL query of for the words that should be tested.
Total number of tests to do.
Number of tests left.
Type of test.
Number of tests left to do.
Prepare JavaScript code globals so that you can click on words.
do_test_test_interaction_globals(string $wb1, string $wb2, string $wb3, int $lg_id) : void
URL of the first dictionary.
URL of the secondary dictionary.
URL of the google translate dictionary.
Language ID (since 2.10.0-fork)
Prepare JavaScript code so that you can click on words.
do_test_test_javascript_clickable(array<string|int, mixed> $wo_record, string $solution) : void
Word record. Associative array with keys 'WoID', 'WoTranslation'.
Solution to the test (as HTML)
Prepare JavaScript code so that you can click on words.
do_test_test_javascript_interaction(array<string|int, mixed> $wo_record, string $wb1, string $wb2, string $wb3, int $testtype, int $nosent, string $save) : void
Word record. Associative array with keys 'WoID', 'WoTranslation'.
URL of the first dictionary.
URL of the secondary dictionary.
URL of the google translate dictionary.
Type of test
1 to use single word instead of sentence.
Word or sentence to use for the test
Get the data and echoes the footer.
prepare_test_footer(int $notyettested) : void
Number of words left to be tested.
Echoes HTML code for the footer of a words test page.
do_test_footer(int $notyettested, int $wrong, int $correct) : void
Number of words left to be tested
Number of failed tests
Number of correct answers.
Prepare JavaScript code for interacting between the different frames.
do_test_test_javascript(int $count) : void
Total number of tests that were done today
Do the main content of a test page.
do_test_test_content() : void
Do the main content of a test page.
do_test_test_content_ajax(string $selector, array<string|int, mixed>|int $selection) : void
Type of test to run
Items to run the test on
Get text ID (if possible).
get_text_id() : int|null
Text ID if first looked at int the 'text' parameter. If not found, then look at 'start'.
Text ID or null
Echo the page content for the mobile version of do_text.
do_text_mobile_content(int $textid[, mixed $audio = null ]) : void
Text ID
Audio URI, unnused, null by default
Echo the page content for the desktop version of do_text.
do_text_desktop_content(int $textid[, mixed $audio = null ]) : void
Text ID
Audio URI, unnused, null by default
Echo the text page.
do_text_page(mixed $textid) : void
Get the text and language data associated with the text.
getData(string|int $textid) : array<string|int, float|int|null|string>|false|null
ID of the text
LgName, TxLgID, TxText, TxTitle, TxAudioURI, TxSourceURI, TxAudioPosition for the text.
Print the main title row.
do_header_row(int $textid, string $langid) : void
Text ID
Language ID to navigate between texts of same language
Print the title of the text.
do_title(string $title, string $sourceURI) : void
Title of the text
URL of the text (if any)
Prepare user settings for this text.
do_settings(string|int $textid) : void
Text ID
Prints javascript data and function to read text in your browser.
browser_tts(string $text, string $languageName) : void
Text to read
Full name of the language (i. e.: "English")
Save the position of the audio reading for a text.
save_audio_position(string|int $textid) : void
ID of the text
Main function for displaying header. It will print HTML content.
do_text_header_content(string|int $textid[, bool $only_body = true ]) : void
ID of the required text
If true, only show the inner body. If false, create a complete HTML document.
Get the record for this text in the database.
get_text_data(string|int $textid) : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
ID of the text
Record corresponding to this text.
Get the record for this text in the database.
getTextData(string $textid) : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
ID of the text
Record corresponding to this text.
Return the settings relative to this language.
get_language_settings(int $langid) : Lg}|false|null
Language ID as defined in the database.
Record corresponding to this language.
Return the settings relative to this language.
getLanguagesSettings(int $langid) : array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null
Language ID as defined in the database.
Record corresponding to this language.
Print the output when the word is a term (word or multi-word).
echo_term(int $actcode, int $showAll, string $spanid, mixed $hidetag, int $currcharcount, array<string, string> $record[, array<string|int, mixed> &$exprs = array() ]) : void
Action code, number of words forming the term (> 1 for multiword)
Show all words or not
ID for this span element
Current number of characters
Various data
Current expressions
Print the output when the word is a term.
echoTerm(int $actcode, int $showAll, int $hideuntil, string $spanid, mixed $hidetag, int $currcharcount, array<string, string> $record) : int
Action code, > 1 for multiword
Show all words or not
Unused
ID for this span element
Current number of characters
Various data
Process each word (can be punction, term, etc...). Caused laggy texts, replaced by wordParser.
wordProcessor(array<string|int, string> $record, 0|1 $showAll, int $currcharcount) : int
Record information
Show all words or not
Current number of caracters
New number of caracters
Check if a new sentence SPAN should be started.
sentence_parser(int $sid, int $old_sid) : int
Sentence ID
Old sentence ID
Sentence ID
Check if a new sentence SPAN should be started.
sentenceParser(int $sid, int $old_sid) : int
Sentence ID
Old sentence ID
Sentence ID
Process each text item (can be punction, term, etc...)
item_parser(array<string|int, mixed> $record, 0|1 $showAll, int $currcharcount, bool $hide[, array<string|int, mixed> &$exprs = array() ]) : void
Text item information
Show all words or not
Current number of caracters
Should some item be hidden, depends on $showAll
Current expressions
Process each text item (can be punction, term, etc...)
word_parser(array<string|int, string> $record, 0|1 $showAll, int $currcharcount, int $hideuntil) : int
Record information
Show all words or not
Current number of caracters
Should the value be hidden or not
New value for $hideuntil
Process each word (can be punction, term, etc...)
wordParser(array<string|int, string> $record, 0|1 $showAll, int $currcharcount, int $hideuntil) : int
Record information
Show all words or not
Current number of caracters
Should the value be hidden or not
New value for $hideuntil
Get all words and start the iterate over them.
main_word_loop(string $textid, 0|1 $showAll) : void
ID of the text
Show all words or not
Get all words and start the iterate over them.
mainWordLoop(string $textid, 0|1 $showAll) : void
ID of the text
Show all words or not
Prepare style for showing word status. Write a now STYLE object
do_text_text_style(int $showLearning, int<1, 4> $mode_trans, int $textsize, mixed $ann_exists) : void
1 to show learning translations
Annotation position
Text font size
Prepare style for showing word status. Write a now STYLE object
prepareStyle(int $showLearning, int<1, 4> $mode_trans, int $textsize, mixed $ann_exists) : void
1 to show learning translations
Annotation position
Text font size
Print JavaScript-formatted content.
do_text_text_javascript(mixed $var_array) : void
Print JavaScript-formatted content.
do_text_javascript(mixed $var_array) : void
Main function for displaying sentences. It will print HTML content.
do_text_text_content(string|int $textid[, bool $only_body = true ]) : void
ID of the requiered text
If true, only show the inner body. If false, create a complete HTML document.
Prepare a JavaScript code that checks for duplicate names in languages.
edit_languages_alert_duplicate() : void
Refresh sentence and text items from a specific language.
edit_languages_refresh(int $lid) : string
Language ID
Number of sentences and textitems refreshed
Delete a language.
edit_languages_delete(int $lid) : string
Language ID
Info on the number of languages deleted
Save a new language to the database.
edit_languages_op_save() : string
Success or error message
Edit an existing text in the database.
edit_languages_op_change(int $lid) : string
Language ID
Number of texts updated and items reparsed.
Load a language object based in language ID.
load_language(int $lgid) : Language
Language ID, if 0 load empty data.
Created object
edit_languages_displayThirdPartyVoiceAPI() : void
Create the form for a language.
edit_language_form(Language $language) : void
Language object
Returns a dropdown menu of the different languages.
get_wizard_selectoptions(string $currentnativelanguage) : string
Default language
Display a form to create a new language.
edit_languages_new() : void
Display a form to edit an existing language.
edit_languages_change(int $lid) : void
Language ID
Display the standard page of saved languages.
edit_languages_display(string $message) : void
An information message to display.
Display a variation of the edit_language page.
edit_languages_do_page() : void
Export term data as a JSON dictionnary.
export_term_js_dict(mixed $term) : string
JSON dictionnary.
Use the superglobals to load a new Term object.
edit_mword_prepare_term() : Term
Check if the lowercase version is a good one.
The loaded data.
Do a server operation for multiwords.
edit_mword_do_operation(mixed $term) : void
Insert a multi-word to the database.
edit_mword_do_insert(Term $term) : string
Multi-word to be inserted.
"Terms saved: n"
Update a multi-word.
edit_mword_do_update(Term $term, int $newstatus) : string
Multi-word to be inserted.
New multi-word status
"Terms updated: n"
Make the main display for editing new multi-word.
edit_mword_new(string $text, int $tid, int $ord, int $len) : void
Original group of words.
Text ID
Text order
Number of words in the multi-word.
Make the main display for editing existing multi-word.
edit_mword_update(int $wid, int $tid, int $ord) : void
Term ID
Text ID
Text order
Display a form for the insertion of a new multi-word.
edit_mword_display_new(Term $term, int $tid, int $ord, int $len) : void
Multi-word to insert.
Text ID
Text order
Number of words in the multi-word.
Display an updating form for a multi-word.
edit_mword_display_change(Term $term, int $tid, int $ord) : void
Multi-word to being modified.
Text ID
Text order
Create the multi-word frame.
edit_mword_page() : void
Get the value of $wh_query.
edit_texts_get_wh_query(string $currentquery, string $currentquerymode, string $currentregexmode) : string
Current database query
Content for $wh_query.
Return the value for $wh_tag.
edit_texts_get_wh_tag(string|int $currentlang) : string
Current language ID
Content for $wh_tag.
When a mark action is in use, do the action.
edit_texts_mark_action(string $markaction, array<string|int, mixed> $marked, string $actiondata) : array<string|int, null|string>
Type of action
Texts marked.
Values to insert to the database
Number of rows edited, the second element is always null.
Delete an existing text.
edit_texts_delete(string|int $txid) : string
Text ID
Texts, sentences, and text items deleted.
Archive a text.
edit_texts_archive(int $txid) : string
text ID
Number of archives saved, texts deleted, sentences deleted, text items deleted.
Do an operation on texts.
edit_texts_do_operation(string $op, mixed $message1, int|bool $no_pagestart) : string
Operation name
Unnused
If you don't want a page
Edition message (number of rows edited)
Display the main form for text creation and edition.
edit_texts_form(Text $text, bool $annotated) : void
Text object to edit
True if this text has annotations
Create a window to make a new text in the target language.
edit_texts_new(int $lid) : void
Language ID
Create the main window to edit an existing text.
edit_texts_change(int $txid) : void
Text ID
Do the filters form for texts display.
edit_texts_filters_form(string $currentlang, int $recno, int $currentpage, int $pages) : void
Current language ID
Current page number
Total number of pages
Make links to navigate to other pages if necessary.
edit_texts_other_pages(int $recno) : void
Record number
Display the content of a table row for text edition.
edit_texts_show_text_row(array<string|int, mixed> $txrecord, string $currentlang, array{: int<0, 5>|98|99, : array{: string, : string}} $statuses) : void
Various information about the text should contain 'TxID' at least.
Current language ID
List of statuses WITH unknown words (status 0)
Main form for displaying multiple texts.
edit_texts_texts_form(string $currentlang, string $showCounts, string $sql, int $recno) : void
Current language ID
Number of items to show, put into a string
SQL string to execute
Record number
Main display for the edit text functionality.
edit_texts_display(string $message) : void
Message to display.
Main function for displaying the edit_texts page.
edit_texts_do_page() : void
Add the translation for a new term.
add_new_term_transl(string $text, int $lang, string $data) : array<string|int, int|string>|string
Associated text
Language ID
Translation
[new word ID, lowercase $text] if success, error message otherwise
Edit the translation for an existing term.
edit_term_transl(int $wid, string $new_trans) : string
Word ID
New translation
WoTextLC, lowercase version of the word
Edit term translation if it exists.
do_ajax_check_update_translation(int $wid, string $new_trans) : string
Word ID
New translation
Term in lower case, or error message if term does not exist
Add or edit a term translation.
do_ajax_add_term_transl(int $wid, string $data) : string
Word ID
Translation
Database alteration message
Check if mecab is installed and accessible under the 'mecab' alias.
check_mecab_accessibility() : void
Check if string 'test' is consistently recognized as a word.
check_standard_regex(mixed $regex) : void
Make the actual query to check the regex.
do_ajax_check_regexp(string $regex) : void
Regex to test
Force a term to get a new status.
set_word_status(string|int $wid, string|int $status) : string
ID of the word to edit
New status to set
Number of affected rows or error message
Check the consistency of the new status.
get_new_status(int $oldstatus, bool $up) : int<1, 5>|98|99
Old status
True if status should incremented, false if decrementation needed
New status in the good number range.
Save the new word status to the database, return the controls.
update_word_status(int $wid, int $currstatus) : string|null
Word ID
Current status in the good value range.
HTML-formatted string with plus/minus controls if a success.
Do a word status change.
ajax_increment_term_status(int $wid, bool $up) : string
Word ID
Should the status be incremeted or decremented
HTML-formatted string for increments
Do a word status change and print the result.
do_ajax_chg_term_status(int $wid, bool $up) : void
Word ID
Should the status be incremeted or decremented
Get the file path using theme.
do_ajax_get_theme(string $filepath) : string
Standard file path.
Relative filepath using theme.
Get the list of feeds.
get_feeds_list(array<string|int, array<string|int, string>> $feed, mixed $nfid) : array{0: int, 1: int}
A feed
Number of imported feeds and number of duplicated feeds.
Update the feeds database and echo a result message.
print_feed_result(int $imported_feed, int $nif, string $nfname, int $nfid, string $nfoptions) : void
Number of imported feeds
Number of duplicated feeds
News feed name
News feed ID
News feed options
Main function to execute an AJAX query echoing feeds.
do_ajax_load_feed(string $nfname, int $nfid, string $nfsourceuri, string $nfoptions) : string
Newsfeed name
News feed ID
News feed source
News feed options
Message if an error occured, '' otherwise
Save data from printed text.
save_impr_text_data(int $textid, int $line, string $val) : string
Text ID
Line number to save
Proposed new annotation for the term
Error message, or "OK" if success.
Save a printed text.
do_ajax_save_impr_text(int $textid, string $elem, mixed $data) : string
Text ID
Element to edit
JSON data
Success string
Save a text with improved annotations.
save_impr_text(int $textid, string $elem, mixed $data) : array<string|int, string>
Text ID
Element to select
Data element
Result as array, with answer on "error" or "success"
Save a setting.
do_ajax_save_setting(string $key, mixed $value) : void
Setting key
Setting value
Save the reading position of the text.
save_text_position(int $textid, int $position) : void
Text ID
Position in text to save
Save the audio position in the text.
save_audio_position(int $textid, int $audioposition) : void
Text ID
Audio position
limit_current_page(mixed $currentpage, mixed $recno, mixed $maxperpage) : mixed
Prepare the page to display imported terms.
imported_terms_header(int $recno, int $currentpage, string $last_update[, int $maxperpage = 100 ]) : void
Record number
Current page
Last update
Maximum number of terms per page
Prepare the page to display imported terms.
get_imported_terms(int $recno, int $currentpage, string $last_update) : string
Record number
Current page
Last update
SQL-formatted query to limit the number of results
select_imported_terms(mixed $last_update, mixed $offset, mixed $max_terms) : array<string|int, array<string|int, float|int|null|string>>
Show the imported terms.
show_imported_terms(string $last_update, string $limit, mixed $rtl) : void
Last update
SQL-formatted query to limit the number of results
Show the imported terms.
do_ajax_show_imported_terms(string $last_update, int $currentpage, int $recno, bool $rtl) : void
Last update
Current number of the page
Number of record
True if this language is right-to-left
Return the list of imported terms of pages information.
imported_terms_list(string $last_update, int $currentpage, int $recno) : array<string|int, array<string|int, int|mixed>|mixed>
Terms import time
Current page number
Number of imported terms
Return the sentences associated to this word.
do_ajax_show_sentences(int $langid, int $wid, string $word, string $ctl) : string
Language ID
Word ID
Word translation
Path for the textarea of the sentence of the word being edited.
Return the terms similar to a word.
do_ajax_show_similar_terms(int $langid, string $word) : string
Language ID
Word to be looked at
A list of similar terms
Change the current working directory and find media path
do_ajax_update_media_select() : string
Media path
Do the word count for a specific text.
do_ajax_word_counts(string $textid) : void
Text IDs seperated by comma
Do a SQL query to the database.
do_mysqli_query(string $sql) : mysqli_result|true
It is a wrapper for mysqli_query function.
Query using SQL syntax
Run a SQL query, you can specify its behavior and error message.
runsql(string $sql, string $m[, bool $sqlerrdie = true ]) : string
MySQL query
Success phrase to prepend to the number of affected rows
To die on errors (default = TRUE)
Error message if failure, or the number of affected rows
Return the record "value" in the first line of the database if found.
get_first_value(string $sql) : float|int|string|null
MySQL query
Any returned value from the database.
Replace Windows line return ("\r\n") by Linux ones ("\n").
prepare_textdata(string $s) : string
Input string
Adapted string.
prepare_textdata_js(mixed $s) : string
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax(string $data) : string
Input string
Properly escaped and trimmed string. "NULL" if the input string is empty.
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax_nonull(string $data) : string
Input string
Properly escaped and trimmed string
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax_notrim_nonull(string $data) : string
Input string
Properly escaped string
convert_regexp_to_sqlsyntax(mixed $input) : string
Validate a language ID
validateLang(string $currentlang) : string
Language ID to validate
'' if the language is not valid, $currentlang otherwise
Validate a text ID
validateText(string $currenttext) : string
Text ID to validate
validateTag(mixed $currenttag, mixed $currentlang) : mixed
validateArchTextTag(mixed $currenttag, mixed $currentlang) : mixed
validateTextTag(mixed $currenttag, mixed $currentlang) : mixed
Convert a setting to 0 or 1
getSettingZeroOrOne(string $key, string|int $dft) : int
The input value
Default value to use, should be convertible to string
Get a setting from the database. It can also check for its validity.
getSetting(string $key) : string
Setting key. If $key is 'currentlanguage' or 'currenttext', we validate language/text.
$val Value in the database if found, or an empty string
Get the settings value for a specific key. Return a default value when possible
getSettingWithDefault(string $key) : string
Settings key
Requested setting, or default value, or ''
Save the setting identified by a key with a specific value.
saveSetting(string $k, mixed $v) : string
Setting key
Setting value, will get converted to string
Success message (starts by "OK: "), or error message
Check if the _lwtgeneral table exists, create it if not.
LWTTableCheck() : void
LWTTableSet(mixed $key, mixed $val) : void
LWTTableGet(mixed $key) : string
Adjust the auto-incrementation in the database.
adjust_autoincr(mixed $table, mixed $key) : void
Optimize the database.
optimizedb() : void
Update the word count for Japanese language (using MeCab only).
update_japanese_word_count(int $japid) : void
Japanese language ID
Initiate the number of words in terms for all languages.
init_word_count() : void
Only terms with a word count set to 0 are changed.
Initiate the number of words in terms for all languages
set_word_count() : void
Only terms with a word count set to 0 are changed.
Parse a Japanese text using MeCab and add it to the database.
parse_japanese_text(string $text, int $id) : null|array<string|int, string>
Text to parse.
Text ID. If $id = -1 print results, if $id = -2 return splitted texts
Splitted sentence if $id = -2
Insert a processed text in the data in pure SQL way.
save_processed_text_with_sql(string $text, int $id) : void
Preprocessed text to insert
Text ID
Parse a text using the default tools. It is a not-japanese text.
parse_standard_text(string $text, int $id, int $lid) : null|array<string|int, string>
Text to parse
Text ID. If $id == -2, only split the text.
Language ID.
If $id == -2 return a splitted version of the text.
Pre-parse the input text before a definitive parsing by a specialized parser.
prepare_text_parsing(string $text, int $id, int $lid) : null|array<string|int, string>
Text to parse
Text ID
Language ID
If $id = -2 return a splitted version of the text
Echo the sentences in a text. Prepare JS data for words and word count.
check_text_valid(int $lid) : void
Language ID
Append sentences and text items in the database.
registerSentencesTextItems(int $tid, int $lid, bool $hasmultiword) : void
ID of text from which insert data
ID of the language of the text
Set to true to insert multi-words as well.
Append sentences and text items in the database.
update_default_values(int $id, int $lid, string $_sql) : void
New default text ID
New default language ID
Unnused since 2.10.0. Will be removed in 3.0.0.
Display statistics about a text.
displayTextStatistics(int $lid, bool $rtlScript, bool $multiwords) : void
Language ID
true if language is right-to-left
Display if text has multi-words
Check a text and display statistics about it.
check_text(string $sql, bool $rtlScript, array<string|int, int> $wl) : void
true if language is right-to-left
Words lengths
Check a language that contains expressions.
checkExpressions(array<string|int, int> $wl) : void
All the different expression length in the language.
Check a language that contains expressions.
check_text_with_expressions(int $id, int $lid, array<string|int, int> $wl, int $wl_max, string $mw_sql) : string
Text ID
Language ID
Word length
Maximum word length
SQL-formatted string
SQL-formatted query string
Parse the input text.
splitCheckText(string $text, string|int $lid, int $id) : null|array<string|int, string>
Text to parse
Language ID (LgID from languages table)
References whether the text is new to the database $id = -1 => Check, return protocol $id = -2 => Only return sentence array $id = TextID => Split: insert sentences/textitems entries in DB
The sentence array if $id = -2
Reparse all texts in order.
reparse_all_texts() : void
Update the database if it is using an outdate version.
update_database(string $dbname) : void
Name of the database
Add a prefix to table in a SQL query string.
prefixSQLQuery(string $sql_line, string $prefix) : mixed
SQL string to prefix.
Prefix to add
Check and/or update the database.
check_update_db(mixed $debug, mixed $tbpref, mixed $dbname) : void
Make the connection to the database.
connect_to_database(string $server, string $userid, string $passwd, string $dbname[, string $socket = "" ]) : mysqli
Server name
Database user ID
User password
Database name
Database socket
Connection to the database
Get the prefixes for the database.
getDatabasePrefix(mixed $dbconnection) : array<string|int, mixed>
Is $tbpref set in connect.inc.php? Take it and $fixed_tbpref=1. If not: $fixed_tbpref=0. Is it set in table "_lwtgeneral"? Take it. If not: Use $tbpref = '' (no prefix, old/standard behaviour).
Table prefix, and if table prefix should be fixed
Get the prefixes for the database.
get_database_prefixes(string|null &$tbpref) : 0|1
Is $tbpref set in connect.inc.php? Take it and $fixed_tbpref=1. If not: $fixed_tbpref=0. Is it set in table "_lwtgeneral"? Take it. If not: Use $tbpref = '' (no prefix, old/standard behaviour).
Temporary database table prefix
Table Prefix is fixed, no changes possible.
load_feeds(mixed $currentfeed) : void
write_rss_to_db(mixed $texts) : string
print_last_feed_update(mixed $diff) : void
get_nf_option(mixed $str, mixed $option) : null|string|array<string|int, string>
get_links_from_new_feed(mixed $NfSourceURI) : array<string|int, array<string|int, false|null|string>|null|string>|false
get_links_from_rss(mixed $NfSourceURI, mixed $NfArticleSection) : array<string|int, array<string|int, false|null|string>>|false
get_text_from_rsslink(mixed $feed_data, mixed $NfArticleSection, mixed $NfFilterTags[, mixed $NfCharset = null ]) : array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|string
Return false. Before 2.2.1, return true if we should use mobile mode.
is_mobile() : bool
Mobile mode shoud be activated or not
Echo frameset content for a mobile page.
do_frameset_mobile_page_content(string $frame_h_uri, string $frame_l_uri, bool $right_frames) : void
URI for the frame-h-2 iframe.
URI for the frame-l-2 iframe.
Create or not a space for right frames.
Echo the CSS content for mobile frameset page.
do_frameset_mobile_css() : void
Echo the JS code for the mobile version of a frameset page.
do_frameset_mobile_js([string|null $audio = null ]) : void
Audio URI
Return navigation arrows to previous and next texts.
getPreviousAndNextTextLinks(int $textid, string $url, bool $onlyann, string $add) : string
ID of the current text
Base URL to append before $textid
Restrict to annotated texts only
Some content to add before the output
Arrows to previous and next texts.
Return an HTML formatted logo of the application.
echo_lwt_logo() : void
Return all different database prefixes that are in use.
getprefixes() : array<string|int, string>
A list of prefixes.
Return the list of media files found in folder, recursively.
media_paths_search(string $dir) : array<string|int, array<string|int, mixed>>
Directory to search into.
All paths found (matching files and folders) in "paths" and folders in "folders".
Return the paths for all media files.
get_media_paths() : array<string|int, mixed>
Paths of media files, in the form array<string, string>
Get the different options to display as acceptable media files.
selectmediapathoptions(string $dir) : string
Directory containing files
HTML-formatted OPTION tags
Select the path for a media (audio or video).
selectmediapath(string $f) : string
HTML field name for media string in form. Will be used as this.form.[$f] in JS.
HTML-formatted string for media selection
get_seconds_selectoptions(mixed $v) : string
get_playbackrate_selectoptions(mixed $v) : string
remove_soft_hyphens(mixed $str) : string|array<string|int, string>
replace_supp_unicode_planes_char(mixed $s) : null|string|array<string|int, string>
makeCounterWithTotal(mixed $max, mixed $num) : string
encodeURI(mixed $url) : string
Echo the path of a file using the theme directory. Echo the base file name of file is not found
print_file_path(string $filename) : void
Filename
Get the path of a file using the theme directory
get_file_path(string $filename) : string
Filename
File path if it exists, otherwise the filename
get_sepas() : mixed
get_first_sepa() : mixed
Prepare options for mobile.
get_mobile_display_mode_selectoptions("0"|"1"|"2" $v) : string
Current mobile type
get_sentence_count_selectoptions(mixed $v) : string
get_words_to_do_buttons_selectoptions(mixed $v) : string
get_regex_selectoptions(mixed $v) : string
get_tooltip_selectoptions(mixed $v) : string
get_themes_selectoptions(mixed $v) : string
Get a session value and update it if necessary.
processSessParam(string $reqkey, string $sesskey, string|int $default, bool $isnum) : string|int
If in $_REQUEST, update the session with $_REQUEST[$reqkey]
Field of the session to get or update
Default value to return
If true, convert the result to an int
The required data unless $isnum is specified
Get a database value and update it if necessary.
processDBParam(string $reqkey, string $dbkey, string $default, bool $isnum) : string|int
If in $_REQUEST, update the database with $_REQUEST[$reqkey]
Field of the database to get or update
Default value to return
If true, convert the result to an int
The string data unless $isnum is specified
getWordTagList(mixed $wid[, mixed $before = ' ' ][, mixed $brack = 1 ][, mixed $tohtml = 1 ]) : string
Return the last inserted ID in the database
get_last_key() : int
If $value is true, return an HTML-style checked attribute.
get_checked(mixed $value) : string
Some value that can be evaluated as a boolean
' checked="checked" ' if value is true, '' otherwise
Return an HTML attribute if $value is equal to $selval.
get_selected(mixed $value, mixed $selval) : string
''|' selected="selected" ' Depending if inputs are equal
Create a projection operator do perform word test.
do_test_test_get_projection(string $key, array<string|int, mixed>|int $value) : string
Type of test.
Object to select.
SQL projection necessary
Prepare the SQL when the text is a selection.
do_test_test_from_selection(mixed $selection_type, string $selection_data) : string
Comma separated ID of elements to test.
SQL formatted string suitable to projection (inserted in a "FROM ")
Make the plus and minus controls in a test table for a word.
make_status_controls_test_table(int $score, int $status, int $wordid) : string
Score associated to this word
Status for this word
Word ID
the HTML-formatted string to use
Return options as HTML code to insert in a language select.
get_languages_selectoptions(string|int|null $v, string $dt) : string
Selected language ID
Default value to display
get_languagessize_selectoptions(mixed $v) : string
get_wordstatus_radiooptions(mixed $v) : string
get_wordstatus_selectoptions(mixed $v, mixed $all, mixed $not9899[, mixed $off = true ]) : string
get_annotation_position_selectoptions(mixed $v) : string
get_hts_selectoptions(mixed $current_setting) : string
get_paging_selectoptions(mixed $currentpage, mixed $pages) : string
get_wordssort_selectoptions(mixed $v) : string
get_tagsort_selectoptions(mixed $v) : string
get_textssort_selectoptions(mixed $v) : string
get_andor_selectoptions(mixed $v) : string
get_set_status_option(mixed $n[, mixed $suffix = "" ]) : string
get_status_name(mixed $n) : string
get_status_abbr(mixed $n) : string
get_colored_status_msg(mixed $n) : string
get_multiplewordsactions_selectoptions() : string
get_multipletagsactions_selectoptions() : string
get_allwordsactions_selectoptions() : string
get_alltagsactions_selectoptions() : string
get_multipletextactions_selectoptions() : string
get_multiplearchivedtextactions_selectoptions() : string
get_texts_selectoptions(mixed $lang, mixed $v) : string
Makes HTML content for a text of style "Page 1 of 3".
makePager(mixed $currentpage, mixed $pages, mixed $script, mixed $formname) : void
makeStatusCondition(mixed $fieldname, mixed $statusrange) : string
checkStatusRange(mixed $currstatus, mixed $statusrange) : bool
Adds HTML attributes to create a filter over words learning status.
makeStatusClassFilter(int<0, 5>|98|99|599 $status) : string
Word learning status 599 is a special status combining 5 and 99 statuses. 0 return an empty string
CSS class filter to exclude $status
Replace $status in $array by -1
makeStatusClassFilterHelper(int $status, array<string|int, int> &$array) : void
A value in $array
Any array of values
Create and verify a dictionary URL link
createTheDictLink(string $u, string $t) : string
Case 1: url without any ### or lwt_term: append UTF-8-term Case 2: url with one ### or lwt_term: substitute UTF-8-term Case 3: url with two (###|lwt_term)enc###: unsupported encoding changed, abandonned since 2.6.0-fork
Dictionary URL. It may contain 'lwt_term' that will get parsed
Text that substite the 'lwt_term'
Dictionary link formatted
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin(int $lang, string $word, string $sentctljs, bool $openfirst) : string
Language ID
True if we should open right frames with translation first
HTML-formatted interface
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStr(string $url, string $txt) : string
An URL, starting with a "*" is deprecated.
Clickable text to display
HTML-formatted string
makeOpenDictStrJS(mixed $url) : string
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStrDynSent(string $url, string $sentctljs, string $txt) : string
A string containing at least a URL
Clickable text to display
Clickable text to display
HTML-formatted string
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin2(int $lang, string $sentctljs, string $wordctljs) : string
Language ID
HTML formatted interface
makeDictLinks(mixed $lang, mixed $wordctljs) : string
createDictLinksInEditWin3(mixed $lang, mixed $sentctljs, mixed $wordctljs) : string
Return checked attribute if $val is in array $_REQUEST[$name]
checkTest(mixed $val, string $name) : string
Value to look for, needle
Key of request haystack.
' ' of ' checked="checked" ' if the qttribute should be checked.
strToHex(mixed $string) : string
Escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165)
strToClassName(string $string) : string
String to escape
anki_export(mixed $sql) : never
tsv_export(mixed $sql) : never
flexible_export(mixed $sql) : never
mask_term_in_sentence_v2(mixed $s) : string
Replace all white space characters by a simple space ' '.
repl_tab_nl(string $s) : string
The output string is also trimmed.
String to parse
String with only simple whitespaces.
mask_term_in_sentence(mixed $s, mixed $regexword) : string
Return statistics about a list of text ID.
return_textwordcount(string $texts_id) : array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>>
It is useful for unknown percent with this fork.
The echo is an output array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int} Total number of words, number of expression, statistics, total unique, number of unique expressions, unique statistics
Texts ID separated by comma
Statistics under the form of an array
Compute and echo word statistics about a list of text ID.
textwordcount(string $textID) : void
It is useful for unknown percent with this fork.
The echo is an output array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int} Total number of words, number of expression, statistics, total unique, number of unique expressions, unique statistics
Text IDs separated by comma
Return the number of words left to do in this text.
todo_words_count(int $textid) : int
Text ID
Number of words
Prepare HTML interactions for the words left to do in this text.
todo_words_content(int $textid) : string
Text ID
HTML result
Prepare HTML interactions for the words left to do in this text.
texttodocount2(string|int $textid) : string
Text ID
HTML result
Return a SQL string to find sentences containing a word.
sentences_containing_word_lc_query(string $wordlc, int $lid) : string
Word to look for in lowercase
Language ID
Query in SQL format
Perform a SQL query to find sentences containing a word.
sentences_from_word(int|null $wid, string $wordlc, int $lid[, int $limit = -1 ]) : mysqli_result|true
Word ID or mode
Word to look for in lowercase
Language ID
Maximum number of sentences to return
Query
Format the sentence(s) $seid containing $wordlc highlighting $wordlc.
getSentence(int $seid, string $wordlc, int $mode) : array<string|int, string>
Sentence ID
Term text in lower case
[0]=html, word in bold, [1]=text, word in }
Return sentences containing a word.
sentences_with_word(int $lang, string $wordlc, int|null $wid[, int|null $mode = 0 ][, int $limit = 20 ]) : array<string|int, array<string|int, string>>
Language ID
Word to look for in lowercase
Word ID
Sentences to get:
Maximum number of sentences to return
Array of sentences found
Prepare the area to for examples sentences of a word.
example_sentences_area(mixed $lang, mixed $termlc, mixed $selector, mixed $wid) : void
Show 20 sentences containg $wordlc.
get20Sentences(int $lang, string $wordlc, int|null $wid, string $jsctlname, int $mode) : string
Language ID
Term in lower case.
Word ID
Path for the textarea of the sentence of the word being edited.
HTML-formatted string of which elements are candidate sentences to use.
Return a dictionary of languages name - id
get_languages() : array<string, int>
Get language name from its ID
getLanguage(string|int $lid) : string
Language ID
Language name
Try to get language code from its ID
getLanguageCode(int $lg_id, array<string|int, mixed> $languages_table) : string
Language ID
Table of languages, usually LWT_LANGUAGES_ARRAY
If found, two-letter code (e. g. BCP 47) or four-letters for the langugae. '' otherwise.
Return a right-to-left direction indication in HTML if language is right-to-left.
getScriptDirectionTag(string|int|null $lid) : string
Language ID
' dir="rtl" '|''
Find all occurences of an expression using MeCab.
findMecabExpression(string $text, string|int $lid) : array<string|int, array<string|int, int|string>>
Text to insert
Language ID
Each found multi-word details
Insert an expression to the database using MeCab.
insert_expression_from_mecab(string $text, string|int $lid, string|int $wid, int $len) : array<string|int, array<string|int, string>>
Text to insert
Language ID
Word ID
Number of words in the expression
Append text and values to insert to the database
Insert an expression to the database using MeCab.
insertExpressionFromMeCab(string $textlc, string $lid, string $wid, int $len, int $mode) : array{: string[], : string[]}
Text to insert in lower case
Language ID
Word ID
Number of words in the expression
If equal to 0, add data in the output
Append text and SQL array.
Find all occurences of an expression, do not use parsers like MeCab.
findStandardExpression(string $textlc, string|int $lid) : array<string|int, array<string|int, int|null|string>>
Text to insert in lower case
Language ID
Each inserted mutli-word details
Insert an expression without using a tool like MeCab.
insert_standard_expression(string $textlc, string|int $lid, string|int $wid, int $len, mixed $mode) : array<string|int, array<string|int, null|string>>
Text to insert in lower case
Language ID
Word ID
Number of words in the expression
Unnused
Append text, empty and sentence id
Prepare a JavaScript dialog to insert a new expression. Use elements in global JavaScript scope.
new_expression_interactable(mixed $hex, mixed $appendtext, mixed $sid, mixed $len) : void
Prepare a JavaScript dialog to insert a new expression.
new_expression_interactable2(string $hex, array<string|int, string> $appendtext, int $wid, int $len) : void
Lowercase text, formatted version of the text.
Text to append
Term ID
Words count.
Prepare a JavaScript dialog to insert a new expression.
newMultiWordInteractable(string $hex, array<string|int, array<string|int, string>> $multiwords, int $wid, int $len) : void
Lowercase text, formatted version of the text.
Multi-words to happen, format [textid][position][text]
Term ID
Words count.
Alter the database to add a new word
insertExpressions(string $textlc, string|int $lid, mixed $wid, int $len, int $mode) : null|string
Text in lower case
Language ID
Number of words in the expression
Function mode
If $mode == 2 return values to insert in textitems2, nothing otherwise.
Restore the database from a file.
restore_file(resource $handle, string $title) : string
Backup file handle
File title
Human-readable status message
Uses provided annotations, and annotations from database to update annotations.
recreate_save_ann(int $textid, string $oldann) : string
Id of the text on which to update annotations
Old annotations
Updated annotations for this text.
Create new annotations for a text.
create_ann(int $textid) : string
Id of the text to create annotations for
Annotations for the text
create_save_ann(mixed $textid) : string
Truncate the database, remove all data belonging by the current user.
truncateUserDatabase() : void
Keep settings.
process_term(mixed $nonterm, mixed $term, mixed $trans, mixed $wordid, mixed $line) : string
get_first_translation(mixed $trans) : string
get_annotation_link(mixed $textid) : string
Like trim, but in place (modify variable)
trim_value(string &$value) : void
Value to be trimmed
Parses text be read by an automatic audio player.
phoneticReading(string $text, string $lgid) : string
Some non-phonetic alphabet will need this, currently only Japanese is supported, using MeCab.
Text to be converted
Language ID
Parsed text in a phonetic format.
Parses text be read by an automatic audio player.
phonetic_reading(string $text, string $lang) : string
Some non-phonetic alphabet will need this, currently only Japanese is supported, using MeCab.
Text to be converted
Language code (usually BCP 47 or ISO 639-1)
Parsed text in a phonetic format.
Refresh a text.
refreshText(mixed $word, mixed $tid) : string
Create an HTML media player, audio or video.
makeMediaPlayer(string $path[, int $offset = 0 ]) : void
URL or local file path
Offset from the beginning of the video
Create an embed video player
makeVideoPlayer(string $path[, int $offset = 0 ]) : void
URL or local file path
Offset from the beginning of the video
Create an HTML audio player.
makeAudioPlayer(string $audio[, int $offset = 0 ]) : void
Audio URL
Offset from the beginning of the video
Echo a HEAD tag for using with frames
framesetheader(string $title) : void
Title to use
Write a page header and start writing its body.
pagestart(string $title, bool $close) : void
Title of the page
Set to true if you are closing the header
Start a standard page with a complete header and a non-closed body.
pagestart_nobody(string $title[, string $addcss = '' ]) : void
Title of the page
Some CSS to be embed in a style tag
letterPairs(mixed $str) : array<string|int, string>
wordLetterPairs(mixed $str) : array<string|int, string>
Similarity ranking of two UTF-8 strings $str1 and $str2
getSimilarityRanking(mixed $str1, mixed $str2) : float
Source http://www.catalysoft.com/articles/StrikeAMatch.html Source http://stackoverflow.com/questions/653157
SimilarityRanking
For a language $lang_id and a term $compared_term (UTF-8).
get_similar_terms(int $lang_id, string $compared_term, int $max_count, float $min_ranking) : array<string|int, int>
If string is already in database, it will be excluded in results.
Language ID
Term to compare with
Maximum number of terms to display
For terms to match
All $max_count wordids with a similarity ranking > $min_ranking, sorted decending
Prepare a field with a similar term to copy.
format_term(int $termid, string $compare) : string
Initial term ID
Similar term to copy.
HTNL-formatted string with the similar term displayed.
Get Term and translation of terms in termid array (calculated in function get_similar_terms(...)) as string for echo
print_similar_terms(int $lang_id, string $compared_term) : string
Language ID
Similar term we compare to
Print a row for similar terms if the feature is enabled.
print_similar_terms_tabrow() : void
Starts or not the error reporting.
set_error_reporting(int $dsplerrors) : void
not 0: start error reporting for ALL errors 0: don't report
Set configuration values as script limit time and such.
set_configuration_options() : void
..
Start the session and checks for its sanity.
start_session() : void
Launch a new session for WordPress.
start_session_main() : void
Return the list of all tags.
get_tags([int $refresh = 0 ]) : array<string|int, string>
If true, refresh all tags for session
All tags
Return the list of all text tags.
get_texttags([int $refresh = 0 ]) : array<string|int, string>
If true, refresh all text tags for session
All text tags
getTextTitle(mixed $textid) : string
get_tag_selectoptions(mixed $v, mixed $l) : string
get_texttag_selectoptions(mixed $v, mixed $l) : string
get_txtag_selectoptions(mixed $l, mixed $v) : string
get_archivedtexttag_selectoptions(mixed $v, mixed $l) : string
Save the tags for words.
saveWordTags(mixed $wid) : void
Save the tags for texts.
saveTextTags(mixed $tid) : void
Save the tags for archived texts.
saveArchivedTextTags(mixed $tid) : void
getWordTags(mixed $wid) : string
Return a HTML-formatted list of the text tags.
getTextTags(int $tid) : string
Text ID. Can be below 1 to create an empty list.
UL list of text tags
Return a HTML-formatted list of the text tags for an archived text.
getArchivedTextTags(int $tid) : string
Text ID. Can be below 1 to create an empty list.
UL list of text tags
addtaglist(mixed $item, mixed $list) : string
addarchtexttaglist(mixed $item, mixed $list) : string
addtexttaglist(mixed $item, mixed $list) : string
removetaglist(mixed $item, mixed $list) : string
removearchtexttaglist(mixed $item, mixed $list) : string
removetexttaglist(mixed $item, mixed $list) : string
Echo an error page if connect.inc.php was not found.
no_connectinc_error_page() : void
Prepare the different SPAN opening tags
get_span_groups() : array<string|int, string>
3 different span levels
Display the current text options.
do_current_text_info(mixed $textid) : void
Echo a select element to switch between languages.
do_language_selectable(mixed $langid) : void
When on a WordPress server, make a logout button
wordpress_logout_link() : void
Return a lot of different server state variables.
get_server_data() : array<string|int, false|float|string|array<string|int, string>>
{0: string, 1: float, 2: string[], 3: string, 4: string, 5: string} Table prefix, database size, server software, apache version, PHP version, MySQL version
Load the content of warnings for visual display.
index_load_warnings() : void
Display the main body of the page.
index_do_main_page() : void
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
ID of the text
Position of the word in the text.
A word
Edit the database to add the word.
insert_word_ignore_to_database(mixed $textid, string $word) : int
Word to add
Word ID
Make the ignored word as no longer marked.
do_javascript_action(string $word, string|int $wid, string $hex, string|int $textid) : void
New ignored word
New ignored word ID
Hexadecimal version of the lowercase word.
ID of the text.
Echoes a complete HTML page, with JavaScript content.
show_page_insert_word_ignore(string $word, string|int $wid, string $hex, string|int $textid) : void
New well-known word
New well-known word ID
Hexadecimal version of the lowercase word.
ID of the text.
Main function to insert a new word with display and JS action.
do_insert_word_ignore(string $textid, string $textpos) : void
ID of the text
Position of the word in the text.
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
ID of the text
Position of the word in the text.
A word
Edit the database to add the word.
insert_word_wellknown_to_database(mixed $textid, string $word) : int
Word to add
Word ID
Make the well-known word as no longer marked.
insert_word_wellknown_javascript(string $word, string|int $wid, string $hex, string|int $textid) : void
New well-known word
New well-known word ID
Hexadecimal version of the lowercase word.
ID of the text.
Echoes a complete HTML page, with JavaScript content.
show_page_insert_word_wellknown(string $word, string|int $wid, string $hex, string|int $textid) : void
New well-known word
New well-known word ID
Hexadecimal version of the lowercase word.
ID of the text.
Main function to insert a new word with display and JS action.
do_insert_word_wellknown(string $textid, string $textpos) : void
ID of the text
Position of the word in the text.
Restore demo database from file.
restore_demo_db() : string
Status message
Display the check page before a long text import.
long_text_check(int $max_input_vars) : void
Maximale bytes size for the text.
Save a long text to the database.
long_text_save() : void
Display the main page for a long tex import.
long_text_display(int $max_input_vars) : void
Maximal number of bytes for the text.
Do the main page for the long text import.
long_text_do_page() : void
output_text(mixed $saveterm, mixed $saverom, mixed $savetrans, mixed $savetags, mixed $show_rom, mixed $show_trans, mixed $show_tags, mixed $annplcmnt) : void
Returns a dropdown menu of the different languages
get_wizard_selectoptions(mixed $v) : string
Echo the page HTML content when setting word status.
do_set_test_status_html(int $status, int $oldstatus, int $newscore, int $oldscore) : void
New learning status for the word
Previous learning status
New score for the word
Previous score
Increment the session progress in learning new words.
set_test_status_change_progress(int $stchange) : array<string|int, int>
-1, 0, or 1 if status is rising or not
Tests data
Make the JavaScript action for setting a word status.
do_set_test_status_javascript(int $wid, int $status, int $stchange[, mixed $tests_status = array() ][, mixed $ajax = false ]) : void
Word ID
New learning status for the word
-1, 0, or 1 if status is rising or not
Make the page content of the word status page.
do_set_test_status_content(int $wid, int $status, int $oldstatus, int $stchange[, mixed $ajax = false ]) : void
Word ID
New learning status for the word
Previous learning status
-1, 0, or 1 if status is rising or not
Start the word status set page.
start_set_text_status() : void
Save text mode settings.
text_mode_save_settings(int $showAll, int $showLearning) : int
Whether all word should be shown
Whether to show translation of learning words
If show learning were previously true (1) or false (0)
Do the JavaScript action to change the display of translations.
text_annotations_mode_javascript(int $showLearning, int $oldShowLearning) : void
Whether to show translation of learning words
If show learning was previously true (1) or false (0)
Do the main page content when chaning display of translations.
text_mode_page_content(int $showAll, int $showLearning, int $oldShowLearning) : void
Whether all word should be shown
Whether to show translation of learning words
If show learning was previously true (1) or false (0)
Complete workflow for changing text mode.
change_text_mode(int $textid, int $showAll, int $showLearning) : void
It edits the settings in the database, show the success message and do JavaScript action to change its display.
ID of the current text
Whether all word should be shown
Whether to show translation of learning words
Get various data for the word corresponding to the ID.
get_word_data(string $wid) : array{0: string, 1: string, 2: string}
ID of the word
The word in plain text, his translation and his romanization
Sent an AJAX request to change a word satus.
set_word_status_ajax(string $wid, string $status) : void
ID of the word status to change
New status to set
Edit the term status in the database.
set_word_status_database(string $wid, string $status) : string
ID of the word to update
New status to set
Some edit message, number of affected rows or error message
Do the JavaScript action for changing display of the word.
set_word_status_javascript(string $tid, string $wid, string $status, string $word, string $trans, string $roman) : void
Text ID
ID of the word that changed status, unnused
New status, unnused
Word in plain text
Translation of the word
Romanization of the word
Echo the HTML content of the page.
set_word_status_display_page(string $tid, string $wid, string $status, string $word, string $trans, string $roman) : void
Text ID
ID of the word that changed status
New status
Word in plain text
Translation of the word
Romanization of the word
Complete workflow for updating a word.
do_set_word_status(string $textid, string $wordid, string $status) : void
It edits the database, show the success message and do JavaScript action to change its display.
ID of the affected text
ID of the word to update
New status for this word
Convert a markdown file to HTML and return the result.
markdown_converter(string $file_path) : string
Full path for the file to use, including extension.
An HTML-formatted string
Prepapre the integration of a Markdown file into info.html.
markdown_integration(string $file_path) : void
Headers are incremented by one level. File name become an ID.
Full path for the file to use, including extension (should be ".md")
Minify a JavaScript file and outputs the result to js/
minifyJS(string $path, string $outputPath) : string
Input file path with extension.
Output file path with extension
Minified content
Minify a JavaScript file and outputs the result to css/
minifyCSS(string $path, string $outputPath) : string
Input file path with extension.
Output file path with extension
Minified content
Minify all JavaScript files
minifyAllJS() : string
Minified code
Minify all Cascading-Style Sheet (CSS) files
minifyAllCSS() : void
Regenerate a single theme.
regenerateSingleTheme(string $parent_folder, string $theme_folder) : void
Path to the parent folder (I. E. src/themes/)
Name of the theme folder
Find and regenerate all themes. CSS is minified while other files are copied.
regenerateThemes() : void
Nested folders are ignored.
One-do-all command to minify all your JS, CSS, and regenerate themes.
minify_everything() : void
Save a database prefix.
start_save_prefix(string $pref) : void
Database prefix to save.
Do a short page to edit the database prefix.
start_do_page() : void
user_logging() : mixed
Two-letter language code from from language name (e. g. : "English" = > "en" ).
get_language_code(string $language) : string
Language name, for instance "English"
Two-letter language name
Return the language ID from a two-letter language code or a BCP 47 tag.
language_id_from_code(string $code) : int
If two languages have the same country name, only thte first one will be returned.
Two letters, or four letters separated with caret ("fr" or "en-US").
Language ID if found, -1 otherwise.
String to population a SELECT tag.
tts_language_options() : string
HTML-formatted string.
Prepare a from for all the TTS settings.
tts_settings_form() : void
Prepare a demo for TTS.
tts_demo() : void
Prepare the JavaScript content for text-to-speech.
tts_js() : void
Make only a partial, embedable page for text-to-speech settings.
tts_settings_minimal_page() : void
Make the complete HTML page for text-to-speech settings.
tts_settings_full_page(string $message) : void
A message to display when page loads.
Save the text-to-speech settings as cookies.
tts_save_settings(array<string|int, mixed> $form) : void
Inputs from the main form.
Get the CSV from a string.
my_str_getcsv(string $input) : array<string|int, null|string>|false|null
Input string.
upload_words_import_simple(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status) : void
upload_words_import_complete(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status, mixed $overwrite) : void
upload_words_handle_multiwords(mixed $lang, mixed $last_update) : void
Import terms to the database.
upload_words_import_terms(array<string|int, mixed> $fields, string $tabs, bool $file_upl, array<int, string> $col, int $lang) : string
Fields indexes
Columns separator
If the input text is an uploaded file
Columns names
Language ID
Last word update timestamp
display_imported_terms(mixed $last_update, mixed $rtl) : void
Import term tags only to the database.
upload_words_import_tags(array<string|int, mixed> $fields, string $tabs, bool $file_upl) : void
Fields indexes
Columns separator
If the input text is an uploaded file
Import terms of tags to the database.
upload_words_import() : void
Display the main for adding new words.
upload_words_display() : void