Documentation

Documentation

Table of Contents

Packages

Lwt

Namespaces

SaveSetting
Lwt

Classes

Language
A language represented as an object.
Term
A term (word or mutli-word) represented as an object.
Text
A text represented as an object.
FlattedString
Flatted
DatabaseConnectTest
KernelUtilityTest
SessionUtilityTest
MarkdownConverterTest

Constants

LWT_API_RELEASE_DATE  = "2023-12-29"
LWT_API_VERSION  = "0.1.1"
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_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_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))
YT_API_KEY  = null

Functions

all_words_wellknown_get_words()  : mysqli_result|true
Make the SQL query for all words in the text.
all_words_wellknown_process_word()  : array<string|int, mixed>
For each word, add the word to the database.
all_words_wellknown_main_loop()  : array<string|int, mixed>
Main processing loop to mark all words of a text with a new status.
all_words_wellknown_count_terms()  : void
Display the number of edited words.
all_words_wellknown_javascript()  : void
Execute JavaScript to change the display of all words.
all_words_wellknown_content()  : void
Make the main content of the page for all well-known words.
all_words_wellknown_full()  : void
Make a full HTML page for all well-known words.
bulk_save_terms()  : void
bulk_do_content()  : void
get_term()  : string
Return the term corresponding to the ID.
delete_word_from_database()  : string
Edit the word from the database.
delete_word_javascript()  : void
Do the JavaScript action for changing display of the word.
delete_word_page_content()  : void
Make the HTML content of the page when deleting a word.
do_delete_word()  : void
Complete workflow for deleting a word.
do_mobile_display_impr_text()  : void
Make the page content to display printed texts on mobile.
do_desktop_display_impr_text()  : void
Make the main page content to display printed texts for desktop.
do_display_impr_text_page()  : void
Do the page to display printed text.
do_diplay_impr_text_header_data()  : array{0: string, 1: string, 2: string}
Return the useful data for the header part of a printed text.
do_diplay_impr_text_header_js()  : void
Echo JavaScript area containing behaviors to show/hide translations and annotations.
do_diplay_impr_text_header_content()  : void
Make the header content to display a printed text.
do_diplay_impr_text_header_main()  : void
Main function to generate a complete header for a specific text.
get_annotated_text()  : string
Return the annotatino of a text.
get_display_impr_text_text_data()  : array{0: int, 1: bool}
Get settings for this text.
do_diplay_impr_text_text_js()  : void
Prepare JavaScript interactions for the text content.
do_diplay_impr_text_text_area()  : void
Make the main content for a printed text.
get_word_annotations()  : array{0: string, 1: string}
Parse the annotations (translation/romanization) and return them.
do_display_impr_text_text_word()  : void
Display a single word item.
do_display_impr_text_text_main()  : void
Main function to do a complete printed text text content.
get_l2_language_name()  : string
Find the L2 language name.
get_test_property()  : string
Find the appropiate property to add to the test.
do_test_mobile_page_content()  : void
Make the content of the mobile page.
do_test_mobile_page()  : void
Make the mobile test page.
do_test_desktop_page()  : void
Make the desktop test page
do_test_page()  : void
Start the test page.
try_start_test()  : void
Main function to try to start a test page.
get_sql_test_data()  : string
Set useful data for the test using SQL query.
get_lang_test_data()  : string
Set useful data for the test using language.
get_text_test_data()  : string
Set useful data for the test using text.
get_test_counts()  : array{0: string, 1: string}
Return the words count for this test.
do_test_header_row()  : void
Make the header row for tests.
do_test_header_js()  : void
Prepare JavaScript content for the header.
do_test_header_content()  : void
Make the header content for tests.
get_test_data()  : array{0: string, 1: string}
Set useful data for the test.
do_test_header_page()  : void
Do the header for test page.
start_test_header_page()  : void
Use requests passed to the page to start it.
get_test_table_sql()  : string
Set sql request for the word test.
do_test_table_language_settings()  : 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()  : void
do_test_table_header()  : void
do_test_table_table_content()  : void
do_test_table_row()  : void
do_test_table()  : void
do_test_get_identifier()  : array<string|int, int|array<string|int, int>|string>
Get the SQL string to perform tests.
do_test_get_test_sql()  : string
Get the SQL string to perform tests.
do_test_get_test_type()  : int
Get the test type clamped between 1 and 5 (included)
get_test_sql()  : string
Set sql request for the word test.
get_test_type()  : int<1, 5>
Give the test type.
do_test_test_css()  : void
Prepare the css code for tests.
do_test_get_tomorrow_tests_count()  : int
Return the number of test due for tomorrow.
do_test_test_finished()  : void
Output a message for a finished test, with the number of tests for tomorrow.
do_test_test_sentence()  : array<string|int, int|null|string>
Get a sentence containing the word.
do_test_get_term_test()  : array<string|int, string>
Return the test relative to a word.
print_term_test()  : string
Echo the test relative to a word.
do_test_get_word()  : array<string|int, float|int|null|string>
Find the next word to test.
get_test_solution()  : string
Get the solution to a test.
do_test_prepare_ajax_test_area()  : int
Preforms the HTML of the test area, to update through AJAX.
prepare_test_area()  : int
Preforms the HTML of the test area.
do_test_test_interaction_globals()  : void
Prepare JavaScript code globals so that you can click on words.
do_test_test_javascript_clickable()  : void
Prepare JavaScript code so that you can click on words.
do_test_test_javascript_interaction()  : void
Prepare JavaScript code so that you can click on words.
prepare_test_footer()  : void
Get the data and echoes the footer.
do_test_footer()  : void
Echoes HTML code for the footer of a words test page.
do_test_test_javascript()  : void
Prepare JavaScript code for interacting between the different frames.
do_test_test_content()  : void
Do the main content of a test page.
do_test_test_content_ajax()  : void
Do the main content of a test page.
get_text_id()  : int|null
Get text ID (if possible).
do_text_mobile_content()  : void
Echo the page content for the mobile version of do_text.
do_text_desktop_content()  : void
Echo the page content for the desktop version of do_text.
do_text_page()  : void
Echo the text page.
getData()  : array<string|int, float|int|null|string>|false|null
Get the text and language data associated with the text.
do_header_row()  : void
Print the main title row.
do_title()  : void
Print the title of the text.
do_settings()  : void
Prepare user settings for this text.
browser_tts()  : void
Prints javascript data and function to read text in your browser.
save_audio_position()  : void
Save the position of the audio reading for a text.
do_text_header_content()  : void
Main function for displaying header. It will print HTML content.
get_text_data()  : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
Get the record for this text in the database.
getTextData()  : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
Get the record for this text in the database.
get_language_settings()  : Lg}|false|null
Return the settings relative to this language.
getLanguagesSettings()  : array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null
Return the settings relative to this language.
echo_term()  : void
Print the output when the word is a term (word or multi-word).
echoTerm()  : int
Print the output when the word is a term.
wordProcessor()  : int
Process each word (can be punction, term, etc...). Caused laggy texts, replaced by wordParser.
sentence_parser()  : int
Check if a new sentence SPAN should be started.
sentenceParser()  : int
Check if a new sentence SPAN should be started.
item_parser()  : void
Process each text item (can be punction, term, etc...)
word_parser()  : int
Process each text item (can be punction, term, etc...)
wordParser()  : int
Process each word (can be punction, term, etc...)
main_word_loop()  : void
Get all words and start the iterate over them.
mainWordLoop()  : void
Get all words and start the iterate over them.
do_text_text_style()  : void
Prepare style for showing word status. Write a now STYLE object
prepareStyle()  : void
Prepare style for showing word status. Write a now STYLE object
do_text_text_javascript()  : void
Print JavaScript-formatted content.
do_text_javascript()  : void
Print JavaScript-formatted content.
do_text_text_content()  : void
Main function for displaying sentences. It will print HTML content.
edit_languages_alert_duplicate()  : void
Prepare a JavaScript code that checks for duplicate names in languages.
edit_languages_refresh()  : string
Refresh sentence and text items from a specific language.
edit_languages_delete()  : string
Delete a language.
edit_languages_op_save()  : string
Save a new language to the database.
edit_languages_op_change()  : string
Edit an existing text in the database.
load_language()  : Language
Load a language object based in language ID.
edit_languages_displayThirdPartyVoiceAPI()  : void
edit_language_form()  : void
Create the form for a language.
get_wizard_selectoptions()  : string
Returns a dropdown menu of the different languages.
edit_languages_new()  : void
Display a form to create a new language.
edit_languages_change()  : void
Display a form to edit an existing language.
edit_languages_display()  : void
Display the standard page of saved languages.
edit_languages_do_page()  : void
Display a variation of the edit_language page.
export_term_js_dict()  : string
Export term data as a JSON dictionnary.
edit_mword_prepare_term()  : Term
Use the superglobals to load a new Term object.
edit_mword_do_operation()  : void
Do a server operation for multiwords.
edit_mword_do_insert()  : string
Insert a multi-word to the database.
edit_mword_do_update()  : string
Update a multi-word.
edit_mword_new()  : void
Make the main display for editing new multi-word.
edit_mword_update()  : void
Make the main display for editing existing multi-word.
edit_mword_display_new()  : void
Display a form for the insertion of a new multi-word.
edit_mword_display_change()  : void
Display an updating form for a multi-word.
edit_mword_page()  : void
Create the multi-word frame.
edit_texts_get_wh_query()  : string
Get the value of $wh_query.
edit_texts_get_wh_tag()  : string
Return the value for $wh_tag.
edit_texts_mark_action()  : array<string|int, null|string>
When a mark action is in use, do the action.
edit_texts_delete()  : string
Delete an existing text.
edit_texts_archive()  : string
Archive a text.
edit_texts_do_operation()  : string
Do an operation on texts.
edit_texts_form()  : void
Display the main form for text creation and edition.
edit_texts_new()  : void
Create a window to make a new text in the target language.
edit_texts_change()  : void
Create the main window to edit an existing text.
edit_texts_filters_form()  : void
Do the filters form for texts display.
edit_texts_other_pages()  : void
Make links to navigate to other pages if necessary.
edit_texts_show_text_row()  : void
Display the content of a table row for text edition.
edit_texts_texts_form()  : void
Main form for displaying multiple texts.
edit_texts_display()  : void
Main display for the edit text functionality.
edit_texts_do_page()  : void
Main function for displaying the edit_texts page.
add_new_term_transl()  : array<string|int, int|string>|string
Add the translation for a new term.
edit_term_transl()  : string
Edit the translation for an existing term.
do_ajax_check_update_translation()  : string
Edit term translation if it exists.
do_ajax_add_term_transl()  : string
Add or edit a term translation.
check_mecab_accessibility()  : void
Check if mecab is installed and accessible under the 'mecab' alias.
check_standard_regex()  : void
Check if string 'test' is consistently recognized as a word.
do_ajax_check_regexp()  : void
Make the actual query to check the regex.
set_word_status()  : string
Force a term to get a new status.
get_new_status()  : int<1, 5>|98|99
Check the consistency of the new status.
update_word_status()  : string|null
Save the new word status to the database, return the controls.
ajax_increment_term_status()  : string
Do a word status change.
do_ajax_chg_term_status()  : void
Do a word status change and print the result.
do_ajax_get_theme()  : string
Get the file path using theme.
get_feeds_list()  : array{0: int, 1: int}
Get the list of feeds.
print_feed_result()  : void
Update the feeds database and echo a result message.
do_ajax_load_feed()  : string
Main function to execute an AJAX query echoing feeds.
save_impr_text_data()  : string
Save data from printed text.
do_ajax_save_impr_text()  : string
Save a printed text.
save_impr_text()  : array<string|int, string>
Save a text with improved annotations.
do_ajax_save_setting()  : void
Save a setting.
save_text_position()  : void
Save the reading position of the text.
save_audio_position()  : void
Save the audio position in the text.
limit_current_page()  : mixed
imported_terms_header()  : void
Prepare the page to display imported terms.
get_imported_terms()  : string
Prepare the page to display imported terms.
select_imported_terms()  : array<string|int, array<string|int, float|int|null|string>>
show_imported_terms()  : void
Show the imported terms.
do_ajax_show_imported_terms()  : void
Show the imported terms.
imported_terms_list()  : array<string|int, array<string|int, int|mixed>|mixed>
Return the list of imported terms of pages information.
do_ajax_show_sentences()  : string
Return the sentences associated to this word.
do_ajax_show_similar_terms()  : string
Return the terms similar to a word.
do_ajax_update_media_select()  : string
Change the current working directory and find media path
do_ajax_word_counts()  : void
Do the word count for a specific text.
do_mysqli_query()  : mysqli_result|true
Do a SQL query to the database.
runsql()  : string
Run a SQL query, you can specify its behavior and error message.
get_first_value()  : float|int|string|null
Return the record "value" in the first line of the database if found.
prepare_textdata()  : string
Replace Windows line return ("\r\n") by Linux ones ("\n").
prepare_textdata_js()  : string
convert_string_to_sqlsyntax()  : string
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax_nonull()  : string
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax_notrim_nonull()  : string
Prepares a string to be properly recognized as a string by SQL.
convert_regexp_to_sqlsyntax()  : string
validateLang()  : string
Validate a language ID
validateText()  : string
Validate a text ID
validateTag()  : mixed
validateArchTextTag()  : mixed
validateTextTag()  : mixed
getSettingZeroOrOne()  : int
Convert a setting to 0 or 1
getSetting()  : string
Get a setting from the database. It can also check for its validity.
getSettingWithDefault()  : string
Get the settings value for a specific key. Return a default value when possible
saveSetting()  : string
Save the setting identified by a key with a specific value.
LWTTableCheck()  : void
Check if the _lwtgeneral table exists, create it if not.
LWTTableSet()  : void
LWTTableGet()  : string
adjust_autoincr()  : void
Adjust the auto-incrementation in the database.
optimizedb()  : void
Optimize the database.
update_japanese_word_count()  : void
Update the word count for Japanese language (using MeCab only).
init_word_count()  : void
Initiate the number of words in terms for all languages.
set_word_count()  : void
Initiate the number of words in terms for all languages
parse_japanese_text()  : null|array<string|int, string>
Parse a Japanese text using MeCab and add it to the database.
save_processed_text_with_sql()  : void
Insert a processed text in the data in pure SQL way.
parse_standard_text()  : null|array<string|int, string>
Parse a text using the default tools. It is a not-japanese text.
prepare_text_parsing()  : null|array<string|int, string>
Pre-parse the input text before a definitive parsing by a specialized parser.
check_text_valid()  : void
Echo the sentences in a text. Prepare JS data for words and word count.
registerSentencesTextItems()  : void
Append sentences and text items in the database.
update_default_values()  : void
Append sentences and text items in the database.
displayTextStatistics()  : void
Display statistics about a text.
check_text()  : void
Check a text and display statistics about it.
checkExpressions()  : void
Check a language that contains expressions.
check_text_with_expressions()  : string
Check a language that contains expressions.
splitCheckText()  : null|array<string|int, string>
Parse the input text.
reparse_all_texts()  : void
Reparse all texts in order.
update_database()  : void
Update the database if it is using an outdate version.
prefixSQLQuery()  : mixed
Add a prefix to table in a SQL query string.
check_update_db()  : void
Check and/or update the database.
connect_to_database()  : mysqli
Make the connection to the database.
getDatabasePrefix()  : array<string|int, mixed>
Get the prefixes for the database.
get_database_prefixes()  : 0|1
Get the prefixes for the database.
load_feeds()  : void
write_rss_to_db()  : string
print_last_feed_update()  : void
get_nf_option()  : null|string|array<string|int, string>
get_links_from_new_feed()  : array<string|int, array<string|int, false|null|string>|null|string>|false
get_links_from_rss()  : array<string|int, array<string|int, false|null|string>>|false
get_text_from_rsslink()  : array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|string
is_mobile()  : bool
Return false. Before 2.2.1, return true if we should use mobile mode.
do_frameset_mobile_page_content()  : void
Echo frameset content for a mobile page.
do_frameset_mobile_css()  : void
Echo the CSS content for mobile frameset page.
do_frameset_mobile_js()  : void
Echo the JS code for the mobile version of a frameset page.
getPreviousAndNextTextLinks()  : string
Return navigation arrows to previous and next texts.
echo_lwt_logo()  : void
Return an HTML formatted logo of the application.
getprefixes()  : array<string|int, string>
Return all different database prefixes that are in use.
media_paths_search()  : array<string|int, array<string|int, mixed>>
Return the list of media files found in folder, recursively.
get_media_paths()  : array<string|int, mixed>
Return the paths for all media files.
selectmediapathoptions()  : string
Get the different options to display as acceptable media files.
selectmediapath()  : string
Select the path for a media (audio or video).
get_seconds_selectoptions()  : string
get_playbackrate_selectoptions()  : string
remove_soft_hyphens()  : string|array<string|int, string>
replace_supp_unicode_planes_char()  : null|string|array<string|int, string>
makeCounterWithTotal()  : string
encodeURI()  : string
print_file_path()  : void
Echo the path of a file using the theme directory. Echo the base file name of file is not found
get_file_path()  : string
Get the path of a file using the theme directory
get_sepas()  : mixed
get_first_sepa()  : mixed
get_mobile_display_mode_selectoptions()  : string
Prepare options for mobile.
get_sentence_count_selectoptions()  : string
get_words_to_do_buttons_selectoptions()  : string
get_regex_selectoptions()  : string
get_tooltip_selectoptions()  : string
get_themes_selectoptions()  : string
processSessParam()  : string|int
Get a session value and update it if necessary.
processDBParam()  : string|int
Get a database value and update it if necessary.
getWordTagList()  : string
get_last_key()  : int
Return the last inserted ID in the database
get_checked()  : string
If $value is true, return an HTML-style checked attribute.
get_selected()  : string
Return an HTML attribute if $value is equal to $selval.
do_test_test_get_projection()  : string
Create a projection operator do perform word test.
do_test_test_from_selection()  : string
Prepare the SQL when the text is a selection.
make_status_controls_test_table()  : string
Make the plus and minus controls in a test table for a word.
get_languages_selectoptions()  : string
Return options as HTML code to insert in a language select.
get_languagessize_selectoptions()  : string
get_wordstatus_radiooptions()  : string
get_wordstatus_selectoptions()  : string
get_annotation_position_selectoptions()  : string
get_hts_selectoptions()  : string
get_paging_selectoptions()  : string
get_wordssort_selectoptions()  : string
get_tagsort_selectoptions()  : string
get_textssort_selectoptions()  : string
get_andor_selectoptions()  : string
get_set_status_option()  : string
get_status_name()  : string
get_status_abbr()  : string
get_colored_status_msg()  : 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()  : string
makePager()  : void
Makes HTML content for a text of style "Page 1 of 3".
makeStatusCondition()  : string
checkStatusRange()  : bool
makeStatusClassFilter()  : string
Adds HTML attributes to create a filter over words learning status.
makeStatusClassFilterHelper()  : void
Replace $status in $array by -1
createTheDictLink()  : string
Create and verify a dictionary URL link
createDictLinksInEditWin()  : string
Returns dictionnary links formatted as HTML.
makeOpenDictStr()  : string
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStrJS()  : string
makeOpenDictStrDynSent()  : string
Create a dictionnary open URL from an pseudo-URL
createDictLinksInEditWin2()  : string
Returns dictionnary links formatted as HTML.
makeDictLinks()  : string
createDictLinksInEditWin3()  : string
checkTest()  : string
Return checked attribute if $val is in array $_REQUEST[$name]
strToHex()  : string
strToClassName()  : string
Escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165)
anki_export()  : never
tsv_export()  : never
flexible_export()  : never
mask_term_in_sentence_v2()  : string
repl_tab_nl()  : string
Replace all white space characters by a simple space ' '.
mask_term_in_sentence()  : string
return_textwordcount()  : array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>>
Return statistics about a list of text ID.
textwordcount()  : void
Compute and echo word statistics about a list of text ID.
todo_words_count()  : int
Return the number of words left to do in this text.
todo_words_content()  : string
Prepare HTML interactions for the words left to do in this text.
texttodocount2()  : string
Prepare HTML interactions for the words left to do in this text.
sentences_containing_word_lc_query()  : string
Return a SQL string to find sentences containing a word.
sentences_from_word()  : mysqli_result|true
Perform a SQL query to find sentences containing a word.
getSentence()  : array<string|int, string>
Format the sentence(s) $seid containing $wordlc highlighting $wordlc.
sentences_with_word()  : array<string|int, array<string|int, string>>
Return sentences containing a word.
example_sentences_area()  : void
Prepare the area to for examples sentences of a word.
get20Sentences()  : string
Show 20 sentences containg $wordlc.
get_languages()  : array<string, int>
Return a dictionary of languages name - id
getLanguage()  : string
Get language name from its ID
getLanguageCode()  : string
Try to get language code from its ID
getScriptDirectionTag()  : string
Return a right-to-left direction indication in HTML if language is right-to-left.
findMecabExpression()  : array<string|int, array<string|int, int|string>>
Find all occurences of an expression using MeCab.
insert_expression_from_mecab()  : array<string|int, array<string|int, string>>
Insert an expression to the database using MeCab.
insertExpressionFromMeCab()  : array{: string[], : string[]}
Insert an expression to the database using MeCab.
findStandardExpression()  : array<string|int, array<string|int, int|null|string>>
Find all occurences of an expression, do not use parsers like MeCab.
insert_standard_expression()  : array<string|int, array<string|int, null|string>>
Insert an expression without using a tool like MeCab.
new_expression_interactable()  : void
Prepare a JavaScript dialog to insert a new expression. Use elements in global JavaScript scope.
new_expression_interactable2()  : void
Prepare a JavaScript dialog to insert a new expression.
newMultiWordInteractable()  : void
Prepare a JavaScript dialog to insert a new expression.
insertExpressions()  : null|string
Alter the database to add a new word
restore_file()  : string
Restore the database from a file.
recreate_save_ann()  : string
Uses provided annotations, and annotations from database to update annotations.
create_ann()  : string
Create new annotations for a text.
create_save_ann()  : string
truncateUserDatabase()  : void
Truncate the database, remove all data belonging by the current user.
process_term()  : string
get_first_translation()  : string
get_annotation_link()  : string
trim_value()  : void
Like trim, but in place (modify variable)
phoneticReading()  : string
Parses text be read by an automatic audio player.
phonetic_reading()  : string
Parses text be read by an automatic audio player.
refreshText()  : string
Refresh a text.
makeMediaPlayer()  : void
Create an HTML media player, audio or video.
makeVideoPlayer()  : void
Create an embed video player
makeAudioPlayer()  : void
Create an HTML audio player.
framesetheader()  : void
Echo a HEAD tag for using with frames
pagestart()  : void
Write a page header and start writing its body.
pagestart_nobody()  : void
Start a standard page with a complete header and a non-closed body.
letterPairs()  : array<string|int, string>
wordLetterPairs()  : array<string|int, string>
getSimilarityRanking()  : float
Similarity ranking of two UTF-8 strings $str1 and $str2
get_similar_terms()  : array<string|int, int>
For a language $lang_id and a term $compared_term (UTF-8).
format_term()  : string
Prepare a field with a similar term to copy.
print_similar_terms()  : string
Get Term and translation of terms in termid array (calculated in function get_similar_terms(...)) as string for echo
print_similar_terms_tabrow()  : void
Print a row for similar terms if the feature is enabled.
set_error_reporting()  : void
Starts or not the error reporting.
set_configuration_options()  : void
Set configuration values as script limit time and such.
start_session()  : void
Start the session and checks for its sanity.
start_session_main()  : void
Launch a new session for WordPress.
get_tags()  : array<string|int, string>
Return the list of all tags.
get_texttags()  : array<string|int, string>
Return the list of all text tags.
getTextTitle()  : string
get_tag_selectoptions()  : string
get_texttag_selectoptions()  : string
get_txtag_selectoptions()  : string
get_archivedtexttag_selectoptions()  : string
saveWordTags()  : void
Save the tags for words.
saveTextTags()  : void
Save the tags for texts.
saveArchivedTextTags()  : void
Save the tags for archived texts.
getWordTags()  : string
getTextTags()  : string
Return a HTML-formatted list of the text tags.
getArchivedTextTags()  : string
Return a HTML-formatted list of the text tags for an archived text.
addtaglist()  : string
addarchtexttaglist()  : string
addtexttaglist()  : string
removetaglist()  : string
removearchtexttaglist()  : string
removetexttaglist()  : string
no_connectinc_error_page()  : void
Echo an error page if connect.inc.php was not found.
get_span_groups()  : array<string|int, string>
Prepare the different SPAN opening tags
do_current_text_info()  : void
Display the current text options.
do_language_selectable()  : void
Echo a select element to switch between languages.
wordpress_logout_link()  : void
When on a WordPress server, make a logout button
get_server_data()  : array<string|int, false|float|string|array<string|int, string>>
Return a lot of different server state variables.
index_load_warnings()  : void
Load the content of warnings for visual display.
index_do_main_page()  : void
Display the main body of the page.
get_word()  : string
Return the word at a specific position in a text.
insert_word_ignore_to_database()  : int
Edit the database to add the word.
do_javascript_action()  : void
Make the ignored word as no longer marked.
show_page_insert_word_ignore()  : void
Echoes a complete HTML page, with JavaScript content.
do_insert_word_ignore()  : void
Main function to insert a new word with display and JS action.
get_word()  : string
Return the word at a specific position in a text.
insert_word_wellknown_to_database()  : int
Edit the database to add the word.
insert_word_wellknown_javascript()  : void
Make the well-known word as no longer marked.
show_page_insert_word_wellknown()  : void
Echoes a complete HTML page, with JavaScript content.
do_insert_word_wellknown()  : void
Main function to insert a new word with display and JS action.
restore_demo_db()  : string
Restore demo database from file.
long_text_check()  : void
Display the check page before a long text import.
long_text_save()  : void
Save a long text to the database.
long_text_display()  : void
Display the main page for a long tex import.
long_text_do_page()  : void
Do the main page for the long text import.
output_text()  : void
get_wizard_selectoptions()  : string
Returns a dropdown menu of the different languages
do_set_test_status_html()  : void
Echo the page HTML content when setting word status.
set_test_status_change_progress()  : array<string|int, int>
Increment the session progress in learning new words.
do_set_test_status_javascript()  : void
Make the JavaScript action for setting a word status.
do_set_test_status_content()  : void
Make the page content of the word status page.
start_set_text_status()  : void
Start the word status set page.
text_mode_save_settings()  : int
Save text mode settings.
text_annotations_mode_javascript()  : void
Do the JavaScript action to change the display of translations.
text_mode_page_content()  : void
Do the main page content when chaning display of translations.
change_text_mode()  : void
Complete workflow for changing text mode.
get_word_data()  : array{0: string, 1: string, 2: string}
Get various data for the word corresponding to the ID.
set_word_status_ajax()  : void
Sent an AJAX request to change a word satus.
set_word_status_database()  : string
Edit the term status in the database.
set_word_status_javascript()  : void
Do the JavaScript action for changing display of the word.
set_word_status_display_page()  : void
Echo the HTML content of the page.
do_set_word_status()  : void
Complete workflow for updating a word.
markdown_converter()  : string
Convert a markdown file to HTML and return the result.
markdown_integration()  : void
Prepapre the integration of a Markdown file into info.html.
minifyJS()  : string
Minify a JavaScript file and outputs the result to js/
minifyCSS()  : string
Minify a JavaScript file and outputs the result to css/
minifyAllJS()  : string
Minify all JavaScript files
minifyAllCSS()  : void
Minify all Cascading-Style Sheet (CSS) files
regenerateSingleTheme()  : void
Regenerate a single theme.
regenerateThemes()  : void
Find and regenerate all themes. CSS is minified while other files are copied.
minify_everything()  : void
One-do-all command to minify all your JS, CSS, and regenerate themes.
start_save_prefix()  : void
Save a database prefix.
start_do_page()  : void
Do a short page to edit the database prefix.
user_logging()  : mixed
get_language_code()  : string
Two-letter language code from from language name (e. g. : "English" = > "en" ).
language_id_from_code()  : int
Return the language ID from a two-letter language code or a BCP 47 tag.
tts_language_options()  : string
String to population a SELECT tag.
tts_settings_form()  : void
Prepare a from for all the TTS settings.
tts_demo()  : void
Prepare a demo for TTS.
tts_js()  : void
Prepare the JavaScript content for text-to-speech.
tts_settings_minimal_page()  : void
Make only a partial, embedable page for text-to-speech settings.
tts_settings_full_page()  : void
Make the complete HTML page for text-to-speech settings.
tts_save_settings()  : void
Save the text-to-speech settings as cookies.
my_str_getcsv()  : array<string|int, null|string>|false|null
Get the CSV from a string.
upload_words_import_simple()  : void
upload_words_import_complete()  : void
upload_words_handle_multiwords()  : void
upload_words_import_terms()  : string
Import terms to the database.
display_imported_terms()  : void
upload_words_import_tags()  : void
Import term tags only to the database.
upload_words_import()  : void
Import terms of tags to the database.
upload_words_display()  : void
Display the main for adding new words.

Constants

LWT_API_RELEASE_DATE

public string LWT_API_RELEASE_DATE = "2023-12-29"

Date of the last released change of the LWT API.

LWT_API_VERSION

public string LWT_API_VERSION = "0.1.1"

Version of this current LWT API.

LWT_CSS_FILES

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.

LWT_JS_FILES

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.

Tags
since
2.10.0-fork

Adds src/js/overlib_interface.js and src/js/text_events.js

LWT_LANGUAGES_ARRAY

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)

YT_API_KEY

public string|null YT_API_KEY = null

YT_API_KEY Text from YouTube API key

You can change the key here.

Functions

all_words_wellknown_get_words()

Make the SQL query for all words in the text.

all_words_wellknown_get_words(int $txid) : mysqli_result|true
Parameters
$txid : int

Text id

Return values
mysqli_result|true

SQL query.

all_words_wellknown_process_word()

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>
Parameters
$status : int

New word status

$term : string

Word to mark

$termlc : string

Same as $term, but in lowercase.

$langid : int

Language ID

Tags
since
2.5.3-fork

Do not crash when echoing an error

since
2.5.3-fork

Do not crash when a word is already registred to the database

psalm-return

list{int, string}

Return values
array<string|int, mixed>

[int, string] Number of rows edited and a javascript query.

all_words_wellknown_main_loop()

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>
Parameters
$txid : int

Text ID

$status : int

New status to apply to all words.

Tags
since
2.5.3-fork

Use 'let' instead of 'var' in returned JS

psalm-return

list{int, string}

Return values
array<string|int, mixed>

[int, string] Number of edited words, and JavaScript query to change their display

all_words_wellknown_count_terms()

Display the number of edited words.

all_words_wellknown_count_terms(int $status, int $count) : void
Parameters
$status : int

New status

$count : int

Number of edited words.

Tags
since
2.5.3-fork

Improved messages (more clear, and can handle singular/plural)

all_words_wellknown_javascript()

Execute JavaScript to change the display of all words.

all_words_wellknown_javascript(int $txid, string $javascript) : void
Parameters
$txid : int

Text ID

$javascript : string

JavaScript-formatted string.

all_words_wellknown_content()

Make the main content of the page for all well-known words.

all_words_wellknown_content(int $txid, int $status) : void
Parameters
$txid : int

Text ID

$status : int

New status to apply to words.

all_words_wellknown_full()

Make a full HTML page for all well-known words.

all_words_wellknown_full(int $txid, int $status) : void
Parameters
$txid : int

Text ID

$status : int

New status to apply to words.

bulk_save_terms()

bulk_save_terms(mixed $terms, mixed $tid, mixed $cleanUp) : void
Parameters
$terms : mixed
$tid : mixed
$cleanUp : mixed

bulk_do_content()

bulk_do_content(mixed $tid, mixed $sl, mixed $tl, mixed $pos) : void
Parameters
$tid : mixed
$sl : mixed
$tl : mixed
$pos : mixed

get_term()

Return the term corresponding to the ID.

get_term(string $wid) : string
Parameters
$wid : string

ID of the word

Tags
global

string $tbpref

Return values
string

A word

delete_word_from_database()

Edit the word from the database.

delete_word_from_database(string $wid) : string
Parameters
$wid : string

ID of the word to delete

Tags
global

string $tbpref

Return values
string

Some edit message, number of affected rows or error message

delete_word_javascript()

Do the JavaScript action for changing display of the word.

delete_word_javascript(string $wid, int $tid) : void
Parameters
$wid : string

ID of the word to delete

$tid : int

Text ID

delete_word_page_content()

Make the HTML content of the page when deleting a word.

delete_word_page_content(int $tid, string $wid, string $term, string $m1) : void
Parameters
$tid : int

Text ID

$wid : string

ID of the word to delete

$term : string

The deleted word

$m1 : string

Some edit message, number of affected rows or error message

do_delete_word()

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.

Parameters
$textid : int

ID of the affected text

$wordid : string

ID of the word to delete

Tags
since
2.0.4-fork

do_mobile_display_impr_text()

Make the page content to display printed texts on mobile.

do_mobile_display_impr_text(int $textid, string $audio) : void
Parameters
$textid : int

Text ID

$audio : string

Media URI

Tags
deprecated
since
2.2.0

This function should not longer be used, and should cause issues. Use do_desktop_display_impr_text instead.

do_desktop_display_impr_text()

Make the main page content to display printed texts for desktop.

do_desktop_display_impr_text(int $textid, string $audio) : void
Parameters
$textid : int

Text ID

$audio : string

Media URI

do_display_impr_text_page()

Do the page to display printed text.

do_display_impr_text_page(int $textid) : void
Parameters
$textid : int

Text ID

Tags
global

string $tbpref Database table prefix

do_diplay_impr_text_header_data()

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}
Parameters
$textid : int

Text ID

Tags
global

string $tbpref Database table prefix.

Return values
array{0: string, 1: string, 2: string}

Text title, text audio and source URI

do_diplay_impr_text_header_js()

Echo JavaScript area containing behaviors to show/hide translations and annotations.

do_diplay_impr_text_header_js() : void

do_diplay_impr_text_header_content()

Make the header content to display a printed text.

do_diplay_impr_text_header_content(string $title, int $textid, string $audio, string $sourceURI) : void
Parameters
$title : string

Text title

$textid : int

Text ID

$audio : string

Audio URI

$sourceURI : string

Text source link

do_diplay_impr_text_header_main()

Main function to generate a complete header for a specific text.

do_diplay_impr_text_header_main(int $textid) : void
Parameters
$textid : int

Text ID.

get_annotated_text()

Return the annotatino of a text.

get_annotated_text(int $textid) : string
Parameters
$textid : int

Text ID

Return values
string

Text annotations

get_display_impr_text_text_data()

Get settings for this text.

get_display_impr_text_text_data(int $textid) : array{0: int, 1: bool}
Parameters
$textid : int

Text ID

Return values
array{0: int, 1: bool}

Text size, and if this text is rigth-to-left.

do_diplay_impr_text_text_js()

Prepare JavaScript interactions for the text content.

do_diplay_impr_text_text_js() : void

do_diplay_impr_text_text_area()

Make the main content for a printed text.

do_diplay_impr_text_text_area(string $ann, string $textsize, bool $rtlScript) : void
Parameters
$ann : string

Annotations separated b tabulations "\t"

$textsize : string

Text size

$rtlScript : bool

True if this text is right-to-left

get_word_annotations()

Parse the annotations (translation/romanization) and return them.

get_word_annotations(array<string|int, string> $vals) : array{0: string, 1: string}
Parameters
$vals : array<string|int, string>

Annotations values

Tags
global

string $tbpref Database table prefix.

Return values
array{0: string, 1: string}

Translation and romanization.

do_display_impr_text_text_word()

Display a single word item.

do_display_impr_text_text_word(string $item, string $textsize) : void
Parameters
$item : string

Word item, values separated by a tabulation.

$textsize : string

Text size

do_display_impr_text_text_main()

Main function to do a complete printed text text content.

do_display_impr_text_text_main([int|null $textid = null ]) : void
Parameters
$textid : int|null = null

Text ID, we will use page request if not provided.

get_l2_language_name()

Find the L2 language name.

get_l2_language_name() : string
Tags
global

string $tbpref Database table prefix

Return values
string

Language name

get_test_property()

Find the appropiate property to add to the test.

get_test_property() : string

It uses requests provided to the page.

Return values
string

Some URL property

do_test_mobile_page_content()

Make the content of the mobile page.

do_test_mobile_page_content(string $property) : void
Parameters
$property : string

URL property

Tags
deprecated

Use do_frameset_mobile_page_content instead

do_test_mobile_page()

Make the mobile test page.

do_test_mobile_page([string $property = null ]) : void
Parameters
$property : string = null

Unnused, null by default

Tags
since
2.6.0-fork

Function rewrote and no longer deprecated

do_test_desktop_page()

Make the desktop test page

do_test_desktop_page([string $property = null ]) : void
Parameters
$property : string = null

Unnused, null by default

do_test_page()

Start the test page.

do_test_page(string $p) : void
Parameters
$p : string

Unnused.

Tags
since
2.2.1

The $mobile parameter is no longer required.

since
2.6.0

Mobile interface is back and self-set.

since
2.7.0

Adds a CSS rule to auto-enlarge the body.

try_start_test()

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.

Parameters
$p : mixed

get_sql_test_data()

Set useful data for the test using SQL query.

get_sql_test_data(string &$title, string &$p) : string
Parameters
$title : string

Title to be overwritten

$p : string

Property URL to be overwritten

Tags
global

string $tbpref Database table prefix

Return values
string

SQL query to use

get_lang_test_data()

Set useful data for the test using language.

get_lang_test_data(string &$title, string &$p) : string
Parameters
$title : string

Title to be overwritten

$p : string

Property URL to be overwritten

Tags
global

string $tbpref Database table prefix

Return values
string

SQL query to use

get_text_test_data()

Set useful data for the test using text.

get_text_test_data(string &$title, string &$p) : string
Parameters
$title : string

Title to be overwritten

$p : string

Property URL to be overwritten

Tags
global

string $tbpref Database table prefix

Return values
string

SQL query to use

get_test_counts()

Return the words count for this test.

get_test_counts(string $testsql) : array{0: string, 1: string}
Parameters
$testsql : string

SQL query for this test.

Return values
array{0: string, 1: string}

Total words due and total words learning

do_test_header_row()

Make the header row for tests.

do_test_header_row(mixed $_p) : void
Parameters
$_p : mixed

URL property to use (unnused), will be removed in LWT 3.0.0

do_test_header_js()

Prepare JavaScript content for the header.

do_test_header_js() : void

do_test_header_content()

Make the header content for tests.

do_test_header_content(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Parameters
$title : string

Page title

$p : string

URL property to use

$totalcountdue : string

Number of words due for today

$totalcount : string

Total number of words.

$language : string

L2 language name

get_test_data()

Set useful data for the test.

get_test_data(string &$title, string &$p) : array{0: string, 1: string}
Parameters
$title : string

Title to be overwritten

$p : string

Property URL to be overwritten

Return values
array{0: string, 1: string}

Total words due and total words learning

do_test_header_page()

Do the header for test page.

do_test_header_page(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Parameters
$title : string

Page title

$p : string

URL property to use

$totalcountdue : string

Number of words due for today

$totalcount : string

Total number of words.

$language : string

L2 Language name

start_test_header_page()

Use requests passed to the page to start it.

start_test_header_page([string $language = 'L2' ]) : void
Parameters
$language : string = 'L2'

L2 language name

get_test_table_sql()

Set sql request for the word test.

get_test_table_sql() : string
Tags
global

string $tbpref Table prefix

Return values
string

SQL request string

do_test_table_language_settings()

do_test_table_language_settings(mixed $testsql) : array<string|int, float|int|null|string>|false|null
Parameters
$testsql : mixed
Tags
psalm-return

array<string, float|int|null|string>|false|null

Return values
array<string|int, float|int|null|string>|false|null

get_test_table_settings()

get_test_table_settings() : array<string|int, int>
Tags
psalm-return

list{0|1, 0|1, 0|1, 0|1, 0|1, 0|1}

Return values
array<string|int, int>

do_test_table_javascript()

do_test_table_javascript() : void

do_test_table_settings()

do_test_table_settings(mixed $settings) : void
Parameters
$settings : mixed

do_test_table_table_content()

do_test_table_table_content(mixed $lang_record, mixed $testsql) : void
Parameters
$lang_record : mixed
$testsql : mixed

do_test_table_row()

do_test_table_row(mixed $record, mixed $regexword, mixed $textsize, mixed $span1, mixed $span2) : void
Parameters
$record : mixed
$regexword : mixed
$textsize : mixed
$span1 : mixed
$span2 : mixed

do_test_get_identifier()

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>
Parameters
$selection : int|null

Test is of type selection

$sess_testsql : string|null

SQL string for test

$lang : int|null

Test is of type language, for the language $lang ID

$text : int|null

Testing text with ID $text

Tags
psalm-return

list{string, int|non-empty-list|string}

Return values
array<string|int, int|array<string|int, int>|string>

Test identifier as an array(key, value)

do_test_get_test_sql()

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
Parameters
$selection : int|null

Test is of type selection

$sess_testsql : string|null

SQL string for test

$lang : int|null

Test is of type language, for the language $lang ID

$text : int|null

Testing text with ID $text

Return values
string

SQL projection (selection) string

do_test_get_test_type()

Get the test type clamped between 1 and 5 (included)

do_test_get_test_type(int $testtype) : int
Parameters
$testtype : int

Initial test type value

Return values
int

Clamped $testtype

  • 1: Test type is ..[L2]..
  • 2: Test type is ..[L1]..
  • 3: Test type is ..[..]..
  • 4: Test type is [L2]
  • 5: Test type is [L1]

get_test_sql()

Set sql request for the word test.

get_test_sql() : string
Tags
global

string $tbpref

deprecated
2.9.0-fork

Use do_test_get_sql instead

Return values
string

SQL request string

get_test_type()

Give the test type.

get_test_type() : int<1, 5>
Tags
deprecated
2.9.0-fork

Use do_test_get_test_type instead.

Return values
int<1, 5>

Test type between 1 and 5 (included)

do_test_test_css()

Prepare the css code for tests.

do_test_test_css() : void
Tags
deprecated
2.6.0-fork

Do not use this function since it was causing wrong display. Will be removed in 3.0.0.

do_test_get_tomorrow_tests_count()

Return the number of test due for tomorrow.

do_test_get_tomorrow_tests_count(string $testsql) : int
Parameters
$testsql : string

Test selection string

Return values
int

Tomorrow tests

do_test_test_finished()

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
Parameters
$testsql : string

Query used to select words.

$totaltests : int

Total number of tests.

$ajax : bool = false

AJAX mode, content will not be displayed.

do_test_test_sentence()

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.

Parameters
$wid : int

The word to test.

$lang : mixed

ID of the language, will be removed in PHP 3.0.0

$wordlc : string

Word in lowercase

Tags
global

string $tbpref Table prefix

since
2.5.3-fork

Properly return sentences with at least 70% of known words. Previously, it was supposed to be 100%, but buggy.

since
2.10.0-fork

Always return a sentence, even the 70% known words ratio is not matched

psalm-return

list{null|string, 0|1}

Return values
array<string|int, int|null|string>

Sentence with escaped word and 1.

do_test_get_term_test()

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>
Parameters
$wo_record : array<string|int, mixed>

Query from the database regarding a word.

$sent : string

Sentence containing the word.

$testtype : int

Type of test

$nosent : bool|int

1 or true if you want to hide sentences.

$regexword : string

Regex to select the desired word.

Tags
psalm-return

list{string, string}

Return values
array<string|int, string>

HTML-escaped and raw text sentences (or word)

print_term_test()

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
Parameters
$wo_record : array<string|int, mixed>

Query from the database regarding a word.

$sent : string

Sentence containing the word.

$testtype : int

Type of test

$nosent : int

1 if you want to hide sentences.

$regexword : string

Regex to select the desired word.

Return values
string

HTML-escaped and raw text sentences (or word)

do_test_get_word()

Find the next word to test.

do_test_get_word(string $testsql) : array<string|int, float|int|null|string>
Parameters
$testsql : string

Test selection string

Tags
psalm-return

array<string, float|int|null|string>

Return values
array<string|int, float|int|null|string>

Empty array

get_test_solution()

Get the solution to a test.

get_test_solution(int $testtype, array<string|int, mixed> $wo_record, bool $nosent, string $wo_text) : string
Parameters
$testtype : int

Test type between 1 and 5

$wo_record : array<string|int, mixed>

Word record element

$nosent : bool

Test is in word mode

$wo_text : string

Word text

Return values
string

Solution to display.

do_test_prepare_ajax_test_area()

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
Parameters
$selector : string

On which set to run the test.

$selection : array<string|int, mixed>|int

ID of the elements of the set to use.

$count : int

Number of tests left.

$testtype : int

Type of test (words, sentences, etc...).

Tags
global

string $tbpref Table prefix

global

int $debug Show the SQL query used if 1.

psalm-return

int<0, max>

Return values
int

Number of tests left to do.

prepare_test_area()

Preforms the HTML of the test area.

prepare_test_area(string $testsql, int $totaltests, int $count, int $testtype) : int
Parameters
$testsql : string

SQL query of for the words that should be tested.

$totaltests : int

Total number of tests to do.

$count : int

Number of tests left.

$testtype : int

Type of test.

Tags
global

string $tbpref Table prefix

global

int $debug Show the SQL query used if 1.

psalm-return

int<0, max>

Return values
int

Number of tests left to do.

do_test_test_interaction_globals()

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
Parameters
$wb1 : string

URL of the first dictionary.

$wb2 : string

URL of the secondary dictionary.

$wb3 : string

URL of the google translate dictionary.

$lg_id : int

Language ID (since 2.10.0-fork)

Tags
since
2.10.0-fork

Takes a language ID as the fourth argument

do_test_test_javascript_clickable()

Prepare JavaScript code so that you can click on words.

do_test_test_javascript_clickable(array<string|int, mixed> $wo_record, string $solution) : void
Parameters
$wo_record : array<string|int, mixed>

Word record. Associative array with keys 'WoID', 'WoTranslation'.

$solution : string

Solution to the test (as HTML)

do_test_test_javascript_interaction()

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
Parameters
$wo_record : array<string|int, mixed>

Word record. Associative array with keys 'WoID', 'WoTranslation'.

$wb1 : string

URL of the first dictionary.

$wb2 : string

URL of the secondary dictionary.

$wb3 : string

URL of the google translate dictionary.

$testtype : int

Type of test

$nosent : int

1 to use single word instead of sentence.

$save : string

Word or sentence to use for the test

Tags
global

string $tbpref Database table prefix

global

string $angDefs Languages definition array

Get the data and echoes the footer.

prepare_test_footer(int $notyettested) : void
Parameters
$notyettested : int

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
Parameters
$notyettested : int

Number of words left to be tested

$wrong : int

Number of failed tests

$correct : int

Number of correct answers.

do_test_test_javascript()

Prepare JavaScript code for interacting between the different frames.

do_test_test_javascript(int $count) : void
Parameters
$count : int

Total number of tests that were done today

do_test_test_content()

Do the main content of a test page.

do_test_test_content() : void
Tags
global

int $debug Show debug informations

deprecated

Since 2.10.0-fork, use do_test_test_content_ajax instead

do_test_test_content_ajax()

Do the main content of a test page.

do_test_test_content_ajax(string $selector, array<string|int, mixed>|int $selection) : void
Parameters
$selector : string

Type of test to run

$selection : array<string|int, mixed>|int

Items to run the test on

Tags
global

int $debug Show debug informations

get_text_id()

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'.

Return values
int|null

Text ID or null

do_text_mobile_content()

Echo the page content for the mobile version of do_text.

do_text_mobile_content(int $textid[, mixed $audio = null ]) : void
Parameters
$textid : int

Text ID

$audio : mixed = null

Audio URI, unnused, null by default

Tags
since
2.2.1

It also calls do_frameset_mobile_css and do_frameset_mobile_js

since
2.6.0-fork

Rewrote to match the desktop version (between 2.2.1 and 2.6.0)

do_text_desktop_content()

Echo the page content for the desktop version of do_text.

do_text_desktop_content(int $textid[, mixed $audio = null ]) : void
Parameters
$textid : int

Text ID

$audio : mixed = null

Audio URI, unnused, null by default

do_text_page()

Echo the text page.

do_text_page(mixed $textid) : void
Parameters
$textid : mixed
Tags
since
2.2.1

The $mobile parameter is no longer required.

since
2.7.0

Adds a CSS rule to auto-enlarge the body.

getData()

Get the text and language data associated with the text.

getData(string|int $textid) : array<string|int, float|int|null|string>|false|null
Parameters
$textid : string|int

ID of the text

Tags
global

string $tbpref Table name prefix

since
2.0.3-fork
psalm-return

array<string, float|int|null|string>|false|null

Return values
array<string|int, float|int|null|string>|false|null

LgName, TxLgID, TxText, TxTitle, TxAudioURI, TxSourceURI, TxAudioPosition for the text.

do_header_row()

Print the main title row.

do_header_row(int $textid, string $langid) : void
Parameters
$textid : int

Text ID

$langid : string

Language ID to navigate between texts of same language

Tags
since
2.0.4-fork

do_title()

Print the title of the text.

do_title(string $title, string $sourceURI) : void
Parameters
$title : string

Title of the text

$sourceURI : string

URL of the text (if any)

Tags
since
2.0.4-fork

do_settings()

Prepare user settings for this text.

do_settings(string|int $textid) : void
Parameters
$textid : string|int

Text ID

Tags
since
2.0.4-fork

browser_tts()

Prints javascript data and function to read text in your browser.

browser_tts(string $text, string $languageName) : void
Parameters
$text : string

Text to read

$languageName : string

Full name of the language (i. e.: "English")

Tags
global

string $tbpref

since
2.0.3-fork
since
2.9.1-fork

Function may work even when the language name was manually changed.

save_audio_position()

Save the position of the audio reading for a text.

save_audio_position(string|int $textid) : void
Parameters
$textid : string|int

ID of the text

Tags
since
2.0.4-fork

do_text_header_content()

Main function for displaying header. It will print HTML content.

do_text_header_content(string|int $textid[, bool $only_body = true ]) : void
Parameters
$textid : string|int

ID of the required text

$only_body : bool = true

If true, only show the inner body. If false, create a complete HTML document.

Tags
since
2.0.3-fork

get_text_data()

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
Parameters
$textid : string|int

ID of the text

Tags
global

string $tbpref Table name prefix

psalm-return

array<string, float|int|null|string>|false|null

Return values
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null

Record corresponding to this text.

getTextData()

Get the record for this text in the database.

getTextData(string $textid) : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
Parameters
$textid : string

ID of the text

Tags
global

string $tbpref Table name prefix

deprecated

Use get_text_data instead.

psalm-return

array<string, float|int|null|string>|false|null

Return values
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null

Record corresponding to this text.

get_language_settings()

Return the settings relative to this language.

get_language_settings(int $langid) : Lg}|false|null
Parameters
$langid : int

Language ID as defined in the database.

Tags
global

string $tbpref Table name prefix

psalm-return

array<string, float|int|null|string>|false|null

Return values
Lg}|false|null

Record corresponding to this language.

getLanguagesSettings()

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
Parameters
$langid : int

Language ID as defined in the database.

Tags
global

string $tbpref Table name prefix

deprecated

Use get_language_settings instead.

psalm-return

array<string, float|int|null|string>|false|null

Return values
array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null

Record corresponding to this language.

echo_term()

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
Parameters
$actcode : int

Action code, number of words forming the term (> 1 for multiword)

$showAll : int

Show all words or not

$spanid : string

ID for this span element

$hidetag : mixed
$currcharcount : int

Current number of characters

$record : array<string, string>

Various data

$exprs : array<string|int, mixed> = array()

Current expressions

Tags
since
2.8.0-fork

Takes a new argument $exprs

echoTerm()

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
Parameters
$actcode : int

Action code, > 1 for multiword

$showAll : int

Show all words or not

$hideuntil : int

Unused

$spanid : string

ID for this span element

$hidetag : mixed
$currcharcount : int

Current number of characters

$record : array<string, string>

Various data

Tags
since
2.2.1

Return 0 instead of a new value for $hideuntil

deprecated

Use echo_term instead.

Return values
int

wordProcessor()

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
Parameters
$record : array<string|int, string>

Record information

$showAll : 0|1

Show all words or not

$currcharcount : int

Current number of caracters

Tags
deprecated

Use sentenceParser and wordParser instead.

Return values
int

New number of caracters

sentence_parser()

Check if a new sentence SPAN should be started.

sentence_parser(int $sid, int $old_sid) : int
Parameters
$sid : int

Sentence ID

$old_sid : int

Old sentence ID

Return values
int

Sentence ID

sentenceParser()

Check if a new sentence SPAN should be started.

sentenceParser(int $sid, int $old_sid) : int
Parameters
$sid : int

Sentence ID

$old_sid : int

Old sentence ID

Tags
deprecated

Use sentence_parser instead.

Return values
int

Sentence ID

item_parser()

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
Parameters
$record : array<string|int, mixed>

Text item information

$showAll : 0|1

Show all words or not

$currcharcount : int

Current number of caracters

$hide : bool

Should some item be hidden, depends on $showAll

$exprs : array<string|int, mixed> = array()

Current expressions

Tags
since
2.5.0-fork
since
2.8.0-fork

Take a new optional arguent $exprs

word_parser()

Process each text item (can be punction, term, etc...)

word_parser(array<string|int, string> $record, 0|1 $showAll, int $currcharcount, int $hideuntil) : int
Parameters
$record : array<string|int, string>

Record information

$showAll : 0|1

Show all words or not

$currcharcount : int

Current number of caracters

$hideuntil : int

Should the value be hidden or not

Tags
deprecated

Use item_parser instead (since 2.5.0-fork).

Return values
int

New value for $hideuntil

wordParser()

Process each word (can be punction, term, etc...)

wordParser(array<string|int, string> $record, 0|1 $showAll, int $currcharcount, int $hideuntil) : int
Parameters
$record : array<string|int, string>

Record information

$showAll : 0|1

Show all words or not

$currcharcount : int

Current number of caracters

$hideuntil : int

Should the value be hidden or not

Tags
deprecated

Use word_parser instead.

Return values
int

New value for $hideuntil

main_word_loop()

Get all words and start the iterate over them.

main_word_loop(string $textid, 0|1 $showAll) : void
Parameters
$textid : string

ID of the text

$showAll : 0|1

Show all words or not

Tags
global

string $tbpref Table name prefix

mainWordLoop()

Get all words and start the iterate over them.

mainWordLoop(string $textid, 0|1 $showAll) : void
Parameters
$textid : string

ID of the text

$showAll : 0|1

Show all words or not

Tags
global

string $tbpref Table name prefix

deprecated

Use main_word_loop instead.

do_text_text_style()

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
Parameters
$showLearning : int

1 to show learning translations

$mode_trans : int<1, 4>

Annotation position

$textsize : int

Text font size

$ann_exists : mixed

prepareStyle()

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
Parameters
$showLearning : int

1 to show learning translations

$mode_trans : int<1, 4>

Annotation position

$textsize : int

Text font size

$ann_exists : mixed
Tags
deprecated

Use do_text_text_style instead.

do_text_text_javascript()

Print JavaScript-formatted content.

do_text_text_javascript(mixed $var_array) : void
Parameters
$var_array : mixed

do_text_javascript()

Print JavaScript-formatted content.

do_text_javascript(mixed $var_array) : void
Parameters
$var_array : mixed
Tags
deprecated

Use do_text_text_javascript instead.

do_text_text_content()

Main function for displaying sentences. It will print HTML content.

do_text_text_content(string|int $textid[, bool $only_body = true ]) : void
Parameters
$textid : string|int

ID of the requiered text

$only_body : bool = true

If true, only show the inner body. If false, create a complete HTML document.

edit_languages_alert_duplicate()

Prepare a JavaScript code that checks for duplicate names in languages.

edit_languages_alert_duplicate() : void

edit_languages_refresh()

Refresh sentence and text items from a specific language.

edit_languages_refresh(int $lid) : string
Parameters
$lid : int

Language ID

Tags
global

string $tbpref Database table prefix

Return values
string

Number of sentences and textitems refreshed

edit_languages_delete()

Delete a language.

edit_languages_delete(int $lid) : string
Parameters
$lid : int

Language ID

Tags
global

string $tbpref Database table prefix

Return values
string

Info on the number of languages deleted

edit_languages_op_save()

Save a new language to the database.

edit_languages_op_save() : string
Tags
global

string $tbpref Database table prefix

Return values
string

Success or error message

edit_languages_op_change()

Edit an existing text in the database.

edit_languages_op_change(int $lid) : string
Parameters
$lid : int

Language ID

Tags
global

string $tbpref Database table prefix

Return values
string

Number of texts updated and items reparsed.

load_language()

Load a language object based in language ID.

load_language(int $lgid) : Language
Parameters
$lgid : int

Language ID, if 0 load empty data.

Tags
global

string $tbpref

Return values
Language

Created object

edit_languages_displayThirdPartyVoiceAPI()

edit_languages_displayThirdPartyVoiceAPI() : void

edit_language_form()

Create the form for a language.

edit_language_form(Language $language) : void
Parameters
$language : Language

Language object

get_wizard_selectoptions()

Returns a dropdown menu of the different languages.

get_wizard_selectoptions(string $currentnativelanguage) : string
Parameters
$currentnativelanguage : string

Default language

Return values
string

edit_languages_new()

Display a form to create a new language.

edit_languages_new() : void

edit_languages_change()

Display a form to edit an existing language.

edit_languages_change(int $lid) : void
Parameters
$lid : int

Language ID

Tags
global

string $tbpref

edit_languages_display()

Display the standard page of saved languages.

edit_languages_display(string $message) : void
Parameters
$message : string

An information message to display.

Tags
global

string $tbpref

global

int $debug

edit_languages_do_page()

Display a variation of the edit_language page.

edit_languages_do_page() : void

export_term_js_dict()

Export term data as a JSON dictionnary.

export_term_js_dict(mixed $term) : string
Parameters
$term : mixed
Return values
string

JSON dictionnary.

edit_mword_prepare_term()

Use the superglobals to load a new Term object.

edit_mword_prepare_term() : Term

Check if the lowercase version is a good one.

Tags
since
2.5.2-fork

The created term has the attribute "wordcount" assigned (instead of the wrong "word_count").

Return values
Term

The loaded data.

edit_mword_do_operation()

Do a server operation for multiwords.

edit_mword_do_operation(mixed $term) : void
Parameters
$term : mixed

edit_mword_do_insert()

Insert a multi-word to the database.

edit_mword_do_insert(Term $term) : string
Parameters
$term : Term

Multi-word to be inserted.

Tags
global

string $tbpref Database table prefix.

since
2.5.2-fork

Use the "wordcount" attribute of $term instead of the wrong word_count.

Return values
string

"Terms saved: n"

edit_mword_do_update()

Update a multi-word.

edit_mword_do_update(Term $term, int $newstatus) : string
Parameters
$term : Term

Multi-word to be inserted.

$newstatus : int

New multi-word status

Tags
global

string $tbpref Database table prefix.

Return values
string

"Terms updated: n"

edit_mword_new()

Make the main display for editing new multi-word.

edit_mword_new(string $text, int $tid, int $ord, int $len) : void
Parameters
$text : string

Original group of words.

$tid : int

Text ID

$ord : int

Text order

$len : int

Number of words in the multi-word.

Tags
global

string $tbpref Database table prefix.

edit_mword_update()

Make the main display for editing existing multi-word.

edit_mword_update(int $wid, int $tid, int $ord) : void
Parameters
$wid : int

Term ID

$tid : int

Text ID

$ord : int

Text order

Tags
global

string $tbpref Database table prefix.

edit_mword_display_new()

Display a form for the insertion of a new multi-word.

edit_mword_display_new(Term $term, int $tid, int $ord, int $len) : void
Parameters
$term : Term

Multi-word to insert.

$tid : int

Text ID

$ord : int

Text order

$len : int

Number of words in the multi-word.

Tags
global

string $tbpref Database table prefix.

edit_mword_display_change()

Display an updating form for a multi-word.

edit_mword_display_change(Term $term, int $tid, int $ord) : void
Parameters
$term : Term

Multi-word to being modified.

$tid : int

Text ID

$ord : int

Text order

Tags
global

string $tbpref Database table prefix.

edit_mword_page()

Create the multi-word frame.

edit_mword_page() : void
Tags
global

string $tbpref Database table prefix.

edit_texts_get_wh_query()

Get the value of $wh_query.

edit_texts_get_wh_query(string $currentquery, string $currentquerymode, string $currentregexmode) : string
Parameters
$currentquery : string

Current database query

$currentquerymode : string
$currentregexmode : string
Return values
string

Content for $wh_query.

edit_texts_get_wh_tag()

Return the value for $wh_tag.

edit_texts_get_wh_tag(string|int $currentlang) : string
Parameters
$currentlang : string|int

Current language ID

Return values
string

Content for $wh_tag.

edit_texts_mark_action()

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>
Parameters
$markaction : string

Type of action

$marked : array<string|int, mixed>

Texts marked.

$actiondata : string

Values to insert to the database

Tags
global

string $tbpref Database table prefix

since
2.4.1-fork

The second return field is always null

psalm-return

list{string, null}

Return values
array<string|int, null|string>

Number of rows edited, the second element is always null.

edit_texts_delete()

Delete an existing text.

edit_texts_delete(string|int $txid) : string
Parameters
$txid : string|int

Text ID

Tags
global

string $tbpref Database table prefix

Return values
string

Texts, sentences, and text items deleted.

edit_texts_archive()

Archive a text.

edit_texts_archive(int $txid) : string
Parameters
$txid : int

text ID

Tags
global

string $tbpref Database table prefix

Return values
string

Number of archives saved, texts deleted, sentences deleted, text items deleted.

edit_texts_do_operation()

Do an operation on texts.

edit_texts_do_operation(string $op, mixed $message1, int|bool $no_pagestart) : string
Parameters
$op : string

Operation name

$message1 : mixed

Unnused

$no_pagestart : int|bool

If you don't want a page

Tags
global

string $tbpref Database table prefix

since
2.4.1-fork

$message1 is unnused

Return values
string

Edition message (number of rows edited)

edit_texts_form()

Display the main form for text creation and edition.

edit_texts_form(Text $text, bool $annotated) : void
Parameters
$text : Text

Text object to edit

$annotated : bool

True if this text has annotations

edit_texts_new()

Create a window to make a new text in the target language.

edit_texts_new(int $lid) : void
Parameters
$lid : int

Language ID

Tags
global

string $tbpref

edit_texts_change()

Create the main window to edit an existing text.

edit_texts_change(int $txid) : void
Parameters
$txid : int

Text ID

Tags
global

string $tbpref Database table prefix

edit_texts_filters_form()

Do the filters form for texts display.

edit_texts_filters_form(string $currentlang, int $recno, int $currentpage, int $pages) : void
Parameters
$currentlang : string

Current language ID

$recno : int
$currentpage : int

Current page number

$pages : int

Total number of pages

edit_texts_other_pages()

Make links to navigate to other pages if necessary.

edit_texts_other_pages(int $recno) : void
Parameters
$recno : int

Record number

edit_texts_show_text_row()

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
Parameters
$txrecord : array<string|int, mixed>

Various information about the text should contain 'TxID' at least.

$currentlang : string

Current language ID

$statuses : array{: int<0, 5>|98|99, : array{: string, : string}}

List of statuses WITH unknown words (status 0)

Tags
since
2.6.0-fork

Audio was never shown

edit_texts_texts_form()

Main form for displaying multiple texts.

edit_texts_texts_form(string $currentlang, string $showCounts, string $sql, int $recno) : void
Parameters
$currentlang : string

Current language ID

$showCounts : string

Number of items to show, put into a string

$sql : string

SQL string to execute

$recno : int

Record number

Tags
global

int $debug Display debug information.

edit_texts_display()

Main display for the edit text functionality.

edit_texts_display(string $message) : void
Parameters
$message : string

Message to display.

Tags
global

string $tbpref Database table prefix

global

int $debug Debug mode active or not

edit_texts_do_page()

Main function for displaying the edit_texts page.

edit_texts_do_page() : void

add_new_term_transl()

Add the translation for a new term.

add_new_term_transl(string $text, int $lang, string $data) : array<string|int, int|string>|string
Parameters
$text : string

Associated text

$lang : int

Language ID

$data : string

Translation

Tags
global

string $tbpref Database table prefix

since
2.9.0

Error messages are much more explicit

since
2.9.0

Return an array

psalm-return

list{int, string}|string

Return values
array<string|int, int|string>|string

[new word ID, lowercase $text] if success, error message otherwise

edit_term_transl()

Edit the translation for an existing term.

edit_term_transl(int $wid, string $new_trans) : string
Parameters
$wid : int

Word ID

$new_trans : string

New translation

Tags
global

string $tbpref Database table prefix

Return values
string

WoTextLC, lowercase version of the word

do_ajax_check_update_translation()

Edit term translation if it exists.

do_ajax_check_update_translation(int $wid, string $new_trans) : string
Parameters
$wid : int

Word ID

$new_trans : string

New translation

Tags
global

string $tbpref

Return values
string

Term in lower case, or error message if term does not exist

do_ajax_add_term_transl()

Add or edit a term translation.

do_ajax_add_term_transl(int $wid, string $data) : string
Parameters
$wid : int

Word ID

$data : string

Translation

Tags
deprecated

Deprecated in 2.9.0 in favor to the REST API.

Return values
string

Database alteration message

check_mecab_accessibility()

Check if mecab is installed and accessible under the 'mecab' alias.

check_mecab_accessibility() : void

check_standard_regex()

Check if string 'test' is consistently recognized as a word.

check_standard_regex(mixed $regex) : void
Parameters
$regex : mixed

do_ajax_check_regexp()

Make the actual query to check the regex.

do_ajax_check_regexp(string $regex) : void
Parameters
$regex : string

Regex to test

set_word_status()

Force a term to get a new status.

set_word_status(string|int $wid, string|int $status) : string
Parameters
$wid : string|int

ID of the word to edit

$status : string|int

New status to set

Tags
global

string $tbpref

Return values
string

Number of affected rows or error message

get_new_status()

Check the consistency of the new status.

get_new_status(int $oldstatus, bool $up) : int<1, 5>|98|99
Parameters
$oldstatus : int

Old status

$up : bool

True if status should incremented, false if decrementation needed

Return values
int<1, 5>|98|99

New status in the good number range.

update_word_status()

Save the new word status to the database, return the controls.

update_word_status(int $wid, int $currstatus) : string|null
Parameters
$wid : int

Word ID

$currstatus : int

Current status in the good value range.

Tags
global

string $tbpref Database table prefix

Return values
string|null

HTML-formatted string with plus/minus controls if a success.

ajax_increment_term_status()

Do a word status change.

ajax_increment_term_status(int $wid, bool $up) : string
Parameters
$wid : int

Word ID

$up : bool

Should the status be incremeted or decremented

Tags
global

string $tbpref Database table prefix.

todo

2.9.0 Dirty PHP implementation, needs further refactoring

Return values
string

HTML-formatted string for increments

do_ajax_chg_term_status()

Do a word status change and print the result.

do_ajax_chg_term_status(int $wid, bool $up) : void
Parameters
$wid : int

Word ID

$up : bool

Should the status be incremeted or decremented

Tags
global

string $tbpref Database table prefix.

see
ajax_increment_term_status

Return values instead of printing.

do_ajax_get_theme()

Get the file path using theme.

do_ajax_get_theme(string $filepath) : string
Parameters
$filepath : string

Standard file path.

Return values
string

Relative filepath using theme.

get_feeds_list()

Get the list of feeds.

get_feeds_list(array<string|int, array<string|int, string>> $feed, mixed $nfid) : array{0: int, 1: int}
Parameters
$feed : array<string|int, array<string|int, string>>

A feed

$nfid : mixed
Tags
global

string $tbpref Database table prefix

Return values
array{0: int, 1: int}

Number of imported feeds and number of duplicated feeds.

print_feed_result()

Update the feeds database and echo a result message.

print_feed_result(int $imported_feed, int $nif, string $nfname, int $nfid, string $nfoptions) : void
Parameters
$imported_feed : int

Number of imported feeds

$nif : int

Number of duplicated feeds

$nfname : string

News feed name

$nfid : int

News feed ID

$nfoptions : string

News feed options

Tags
global

string $tbpref Database table prefix

do_ajax_load_feed()

Main function to execute an AJAX query echoing feeds.

do_ajax_load_feed(string $nfname, int $nfid, string $nfsourceuri, string $nfoptions) : string
Parameters
$nfname : string

Newsfeed name

$nfid : int

News feed ID

$nfsourceuri : string

News feed source

$nfoptions : string

News feed options

Return values
string

Message if an error occured, '' otherwise

save_impr_text_data()

Save data from printed text.

save_impr_text_data(int $textid, int $line, string $val) : string
Parameters
$textid : int

Text ID

$line : int

Line number to save

$val : string

Proposed new annotation for the term

Tags
global

string $tbpref Database table prefix.

Return values
string

Error message, or "OK" if success.

do_ajax_save_impr_text()

Save a printed text.

do_ajax_save_impr_text(int $textid, string $elem, mixed $data) : string
Parameters
$textid : int

Text ID

$elem : string

Element to edit

$data : mixed

JSON data

Return values
string

Success string

save_impr_text()

Save a text with improved annotations.

save_impr_text(int $textid, string $elem, mixed $data) : array<string|int, string>
Parameters
$textid : int

Text ID

$elem : string

Element to select

$data : mixed

Data element

Tags
psalm-return

array{error?: string, success?: 'OK'}

Return values
array<string|int, string>

Result as array, with answer on "error" or "success"

do_ajax_save_setting()

Save a setting.

do_ajax_save_setting(string $key, mixed $value) : void
Parameters
$key : string

Setting key

$value : mixed

Setting value

save_text_position()

Save the reading position of the text.

save_text_position(int $textid, int $position) : void
Parameters
$textid : int

Text ID

$position : int

Position in text to save

Tags
global

string $tbpref Database table prefix

save_audio_position()

Save the audio position in the text.

save_audio_position(int $textid, int $audioposition) : void
Parameters
$textid : int

Text ID

$audioposition : int

Audio position

Tags
global

string $tbpref Database table prefix

limit_current_page()

limit_current_page(mixed $currentpage, mixed $recno, mixed $maxperpage) : mixed
Parameters
$currentpage : mixed
$recno : mixed
$maxperpage : mixed

imported_terms_header()

Prepare the page to display imported terms.

imported_terms_header(int $recno, int $currentpage, string $last_update[, int $maxperpage = 100 ]) : void
Parameters
$recno : int

Record number

$currentpage : int

Current page

$last_update : string

Last update

$maxperpage : int = 100

Maximum number of terms per page

get_imported_terms()

Prepare the page to display imported terms.

get_imported_terms(int $recno, int $currentpage, string $last_update) : string
Parameters
$recno : int

Record number

$currentpage : int

Current page

$last_update : string

Last update

Tags
deprecated
2.9.0

Use imported_terms_header instead

Return values
string

SQL-formatted query to limit the number of results

select_imported_terms()

select_imported_terms(mixed $last_update, mixed $offset, mixed $max_terms) : array<string|int, array<string|int, float|int|null|string>>
Parameters
$last_update : mixed
$offset : mixed
$max_terms : mixed
Tags
psalm-return

list<list<float|int|null|string>>

Return values
array<string|int, array<string|int, float|int|null|string>>

show_imported_terms()

Show the imported terms.

show_imported_terms(string $last_update, string $limit, mixed $rtl) : void
Parameters
$last_update : string

Last update

$limit : string

SQL-formatted query to limit the number of results

$rtl : mixed

do_ajax_show_imported_terms()

Show the imported terms.

do_ajax_show_imported_terms(string $last_update, int $currentpage, int $recno, bool $rtl) : void
Parameters
$last_update : string

Last update

$currentpage : int

Current number of the page

$recno : int

Number of record

$rtl : bool

True if this language is right-to-left

Tags
deprecated
2.9.0

Use the AJAX API instead.

imported_terms_list()

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>
Parameters
$last_update : string

Terms import time

$currentpage : int

Current page number

$recno : int

Number of imported terms

Tags
psalm-return

array{navigation: array{current_page: mixed, total_pages: int}, terms: mixed}

Return values
array<string|int, array<string|int, int|mixed>|mixed>

do_ajax_show_sentences()

Return the sentences associated to this word.

do_ajax_show_sentences(int $langid, int $wid, string $word, string $ctl) : string
Parameters
$langid : int

Language ID

$wid : int

Word ID

$word : string

Word translation

$ctl : string

Path for the textarea of the sentence of the word being edited.

Tags
deprecated
2.9.0

Use the REST API instead.

Return values
string

do_ajax_show_similar_terms()

Return the terms similar to a word.

do_ajax_show_similar_terms(int $langid, string $word) : string
Parameters
$langid : int

Language ID

$word : string

Word to be looked at

Return values
string

A list of similar terms

do_ajax_update_media_select()

Change the current working directory and find media path

do_ajax_update_media_select() : string
Return values
string

Media path

do_ajax_word_counts()

Do the word count for a specific text.

do_ajax_word_counts(string $textid) : void
Parameters
$textid : string

Text IDs seperated by comma

Tags
deprecated
2.9.0

Use the REST API instead

do_mysqli_query()

Do a SQL query to the database.

do_mysqli_query(string $sql) : mysqli_result|true

It is a wrapper for mysqli_query function.

Parameters
$sql : string

Query using SQL syntax

Tags
global

mysqli $DBCONNECTION Connection to the database

Return values
mysqli_result|true

runsql()

Run a SQL query, you can specify its behavior and error message.

runsql(string $sql, string $m[, bool $sqlerrdie = true ]) : string
Parameters
$sql : string

MySQL query

$m : string

Success phrase to prepend to the number of affected rows

$sqlerrdie : bool = true

To die on errors (default = TRUE)

Return values
string

Error message if failure, or the number of affected rows

get_first_value()

Return the record "value" in the first line of the database if found.

get_first_value(string $sql) : float|int|string|null
Parameters
$sql : string

MySQL query

Tags
since
2.6.0-fork

Officially return numeric types.

Return values
float|int|string|null

Any returned value from the database.

prepare_textdata()

Replace Windows line return ("\r\n") by Linux ones ("\n").

prepare_textdata(string $s) : string
Parameters
$s : string

Input string

Return values
string

Adapted string.

prepare_textdata_js()

prepare_textdata_js(mixed $s) : string
Parameters
$s : mixed
Return values
string

convert_string_to_sqlsyntax()

Prepares a string to be properly recognized as a string by SQL.

convert_string_to_sqlsyntax(string $data) : string
Parameters
$data : string

Input string

Tags
global

$DBDONNECTION

Return values
string

Properly escaped and trimmed string. "NULL" if the input string is empty.

convert_string_to_sqlsyntax_nonull()

Prepares a string to be properly recognized as a string by SQL.

convert_string_to_sqlsyntax_nonull(string $data) : string
Parameters
$data : string

Input string

Return values
string

Properly escaped and trimmed string

convert_string_to_sqlsyntax_notrim_nonull()

Prepares a string to be properly recognized as a string by SQL.

convert_string_to_sqlsyntax_notrim_nonull(string $data) : string
Parameters
$data : string

Input string

Return values
string

Properly escaped string

convert_regexp_to_sqlsyntax()

convert_regexp_to_sqlsyntax(mixed $input) : string
Parameters
$input : mixed
Return values
string

validateLang()

Validate a language ID

validateLang(string $currentlang) : string
Parameters
$currentlang : string

Language ID to validate

Tags
global

string $tbpref Table name prefix

Return values
string

'' if the language is not valid, $currentlang otherwise

validateText()

Validate a text ID

validateText(string $currenttext) : string
Parameters
$currenttext : string

Text ID to validate

Tags
global

string '' if the text is not valid, $currenttext otherwise

global

string $tbpref Table name prefix

Return values
string

validateTag()

validateTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
$currenttag : mixed
$currentlang : mixed

validateArchTextTag()

validateArchTextTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
$currenttag : mixed
$currentlang : mixed

validateTextTag()

validateTextTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
$currenttag : mixed
$currentlang : mixed

getSettingZeroOrOne()

Convert a setting to 0 or 1

getSettingZeroOrOne(string $key, string|int $dft) : int
Parameters
$key : string

The input value

$dft : string|int

Default value to use, should be convertible to string

Tags
psalm-return

0|1

Return values
int

getSetting()

Get a setting from the database. It can also check for its validity.

getSetting(string $key) : string
Parameters
$key : string

Setting key. If $key is 'currentlanguage' or 'currenttext', we validate language/text.

Tags
global

string $tbpref Table name prefix

Return values
string

$val Value in the database if found, or an empty string

getSettingWithDefault()

Get the settings value for a specific key. Return a default value when possible

getSettingWithDefault(string $key) : string
Parameters
$key : string

Settings key

Tags
global

string $tbpref Table name prefix

Return values
string

Requested setting, or default value, or ''

saveSetting()

Save the setting identified by a key with a specific value.

saveSetting(string $k, mixed $v) : string
Parameters
$k : string

Setting key

$v : mixed

Setting value, will get converted to string

Tags
global

string $tbpref Table name prefix

since
2.9.0

Success message starts by "OK: "

Return values
string

Success message (starts by "OK: "), or error message

LWTTableCheck()

Check if the _lwtgeneral table exists, create it if not.

LWTTableCheck() : void

LWTTableSet()

LWTTableSet(mixed $key, mixed $val) : void
Parameters
$key : mixed
$val : mixed

LWTTableGet()

LWTTableGet(mixed $key) : string
Parameters
$key : mixed
Return values
string

adjust_autoincr()

Adjust the auto-incrementation in the database.

adjust_autoincr(mixed $table, mixed $key) : void
Parameters
$table : mixed
$key : mixed
Tags
global

string $tbpref Database table prefix

optimizedb()

Optimize the database.

optimizedb() : void
Tags
global

string $trbpref Table prefix

update_japanese_word_count()

Update the word count for Japanese language (using MeCab only).

update_japanese_word_count(int $japid) : void
Parameters
$japid : int

Japanese language ID

Tags
global

string $tbpref Database table prefix.

init_word_count()

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.

Tags
global

string $tbpref Database table prefix

set_word_count()

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.

Tags
global

string $tbpref Database table prefix

deprecated

Use init_word_count: same effect, but more logical name. Will be removed in version 3.0.0.

parse_japanese_text()

Parse a Japanese text using MeCab and add it to the database.

parse_japanese_text(string $text, int $id) : null|array<string|int, string>
Parameters
$text : string

Text to parse.

$id : int

Text ID. If $id = -1 print results, if $id = -2 return splitted texts

Tags
since
2.5.1-fork

Works even if LOAD DATA LOCAL INFILE operator is disabled.

since
2.6.0-fork

Use PHP instead of SQL, slower but works better.

global

string $tbpref Database table prefix

psalm-return

non-empty-list|null

Return values
null|array<string|int, string>

Splitted sentence if $id = -2

save_processed_text_with_sql()

Insert a processed text in the data in pure SQL way.

save_processed_text_with_sql(string $text, int $id) : void
Parameters
$text : string

Preprocessed text to insert

$id : int

Text ID

Tags
global

string $tbpref Database table prefix

parse_standard_text()

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>
Parameters
$text : string

Text to parse

$id : int

Text ID. If $id == -2, only split the text.

$lid : int

Language ID.

Tags
since
2.5.1-fork

Works even if LOAD DATA LOCAL INFILE operator is disabled.

global

string $tbpref Database table prefix

psalm-return

non-empty-list|null

Return values
null|array<string|int, string>

If $id == -2 return a splitted version of the text.

prepare_text_parsing()

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>
Parameters
$text : string

Text to parse

$id : int

Text ID

$lid : int

Language ID

Tags
global

string $tbpref Database table prefix

psalm-return

non-empty-list|null

Return values
null|array<string|int, string>

If $id = -2 return a splitted version of the text

check_text_valid()

Echo the sentences in a text. Prepare JS data for words and word count.

check_text_valid(int $lid) : void
Parameters
$lid : int

Language ID

Tags
global

string $tbpref Database table prefix

registerSentencesTextItems()

Append sentences and text items in the database.

registerSentencesTextItems(int $tid, int $lid, bool $hasmultiword) : void
Parameters
$tid : int

ID of text from which insert data

$lid : int

ID of the language of the text

$hasmultiword : bool

Set to true to insert multi-words as well.

Tags
global

string $tbpref Database table prefix

update_default_values()

Append sentences and text items in the database.

update_default_values(int $id, int $lid, string $_sql) : void
Parameters
$id : int

New default text ID

$lid : int

New default language ID

$_sql : string

Unnused since 2.10.0. Will be removed in 3.0.0.

Tags
global

string $tbpref Database table prefix

deprecated

Since 2.10.0, use registerSentencesTextItems instead

displayTextStatistics()

Display statistics about a text.

displayTextStatistics(int $lid, bool $rtlScript, bool $multiwords) : void
Parameters
$lid : int

Language ID

$rtlScript : bool

true if language is right-to-left

$multiwords : bool

Display if text has multi-words

Tags
global

$tbpref

check_text()

Check a text and display statistics about it.

check_text(string $sql, bool $rtlScript, array<string|int, int> $wl) : void
Parameters
$sql : string
$rtlScript : bool

true if language is right-to-left

$wl : array<string|int, int>

Words lengths

Tags
deprecated

Use displayTextStatistics instead. Will be removed in 3.0.0.

checkExpressions()

Check a language that contains expressions.

checkExpressions(array<string|int, int> $wl) : void
Parameters
$wl : array<string|int, int>

All the different expression length in the language.

Tags
global

string $tbpref Database table prefix

check_text_with_expressions()

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
Parameters
$id : int

Text ID

$lid : int

Language ID

$wl : array<string|int, int>

Word length

$wl_max : int

Maximum word length

$mw_sql : string

SQL-formatted string

Tags
global

string $tbpref Database table prefix

deprecated

Since 2.10.0-fork use checkExpressions. It does not modify SQL globals.

Return values
string

SQL-formatted query string

splitCheckText()

Parse the input text.

splitCheckText(string $text, string|int $lid, int $id) : null|array<string|int, string>
Parameters
$text : string

Text to parse

$lid : string|int

Language ID (LgID from languages table)

$id : int

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

Tags
global

string $tbpref Database table prefix

psalm-return

non-empty-list|null

Return values
null|array<string|int, string>

The sentence array if $id = -2

reparse_all_texts()

Reparse all texts in order.

reparse_all_texts() : void
Tags
global

string $tbpref Database table prefix

update_database()

Update the database if it is using an outdate version.

update_database(string $dbname) : void
Parameters
$dbname : string

Name of the database

Tags
global

string $tbpref Database table prefix

global

0|1 $debug Output debug messages.

since
2.10.0-fork

Migrations are defined thourgh SQL, and not directly here

prefixSQLQuery()

Add a prefix to table in a SQL query string.

prefixSQLQuery(string $sql_line, string $prefix) : mixed
Parameters
$sql_line : string

SQL string to prefix.

$prefix : string

Prefix to add

check_update_db()

Check and/or update the database.

check_update_db(mixed $debug, mixed $tbpref, mixed $dbname) : void
Parameters
$debug : mixed
$tbpref : mixed
$dbname : mixed
Tags
global

mysqli $DBCONNECTION Connection to the database.

since
2.10.0

Use confiduration files instead of containing all the data.

connect_to_database()

Make the connection to the database.

connect_to_database(string $server, string $userid, string $passwd, string $dbname[, string $socket = "" ]) : mysqli
Parameters
$server : string

Server name

$userid : string

Database user ID

$passwd : string

User password

$dbname : string

Database name

$socket : string = ""

Database socket

Tags
psalm-suppress

UndefinedDocblockClass

since
2.6.0-fork

Use mysqli_init and mysql_real_connect instead of deprecated mysql_connect

since
2.6.0-fork

Tries to allow local infiles for the connection.

since
2.9.0

Can accept a $socket as an optional argument

Return values
mysqli

Connection to the database

getDatabasePrefix()

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).

Parameters
$dbconnection : mixed
Return values
array<string|int, mixed>

Table prefix, and if table prefix should be fixed

get_database_prefixes()

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).

Parameters
$tbpref : string|null

Temporary database table prefix

Tags
deprecated

Since 2.10.0-fork, use getDatabasePrefix instead

Return values
0|1

Table Prefix is fixed, no changes possible.

load_feeds()

load_feeds(mixed $currentfeed) : void
Parameters
$currentfeed : mixed

write_rss_to_db()

write_rss_to_db(mixed $texts) : string
Parameters
$texts : mixed
Return values
string

print_last_feed_update()

print_last_feed_update(mixed $diff) : void
Parameters
$diff : mixed

get_nf_option()

get_nf_option(mixed $str, mixed $option) : null|string|array<string|int, string>
Parameters
$str : mixed
$option : mixed
Tags
psalm-return

array<string, string>|null|string

Return values
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
Parameters
$NfSourceURI : mixed
Tags
psalm-return

array{feed_title: null|string,...}|false

Return values
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
Parameters
$NfSourceURI : mixed
$NfArticleSection : mixed
Tags
psalm-return

false|list<array{title: null|string, desc: null|string, link: string, date: string, text?: false|string, audio: string}>

Return values
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
Parameters
$feed_data : mixed
$NfArticleSection : mixed
$NfFilterTags : mixed
$NfCharset : mixed = null
Tags
psalm-return

array<array{TxTitle: mixed, TxAudioURI: mixed|null, TxText: string, TxSourceURI: mixed|string, message?: string, link?: list{mixed,...}}>|null|string

Return values
array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|string

is_mobile()

Return false. Before 2.2.1, return true if we should use mobile mode.

is_mobile() : bool
Tags
since
2.2.1

You should not use this function since mobiledetect is no longer used.

since
2.6.0-fork

No longer deprecated and use no external library.

Return values
bool

Mobile mode shoud be activated or not

do_frameset_mobile_page_content()

Echo frameset content for a mobile page.

do_frameset_mobile_page_content(string $frame_h_uri, string $frame_l_uri, bool $right_frames) : void
Parameters
$frame_h_uri : string

URI for the frame-h-2 iframe.

$frame_l_uri : string

URI for the frame-l-2 iframe.

$right_frames : bool

Create or not a space for right frames.

Tags
deprecated

Since 2.2.1-fork, Do not use frames

do_frameset_mobile_css()

Echo the CSS content for mobile frameset page.

do_frameset_mobile_css() : void
Tags
deprecated

Since 2.6.0-fork, the display for mobile changed, making this code useless

do_frameset_mobile_js()

Echo the JS code for the mobile version of a frameset page.

do_frameset_mobile_js([string|null $audio = null ]) : void
Parameters
$audio : string|null = null

Audio URI

Tags
deprecated

Since 2.2.1-fork, we do no longer use frameset

Return navigation arrows to previous and next texts.

getPreviousAndNextTextLinks(int $textid, string $url, bool $onlyann, string $add) : string
Parameters
$textid : int

ID of the current text

$url : string

Base URL to append before $textid

$onlyann : bool

Restrict to annotated texts only

$add : string

Some content to add before the output

Return values
string

Arrows to previous and next texts.

Return an HTML formatted logo of the application.

echo_lwt_logo() : void
Tags
since
2.7.0

Do no longer indicate database prefix in logo

getprefixes()

Return all different database prefixes that are in use.

getprefixes() : array<string|int, string>
Tags
psalm-return

list

Return values
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>>
Parameters
$dir : string

Directory to search into.

Tags
psalm-return

array{paths: array, folders: array}

Return values
array<string|int, array<string|int, mixed>>

All paths found (matching files and folders) in "paths" and folders in "folders".

get_media_paths()

Return the paths for all media files.

get_media_paths() : array<string|int, mixed>
Return values
array<string|int, mixed>

Paths of media files, in the form array<string, string>

selectmediapathoptions()

Get the different options to display as acceptable media files.

selectmediapathoptions(string $dir) : string
Parameters
$dir : string

Directory containing files

Return values
string

HTML-formatted OPTION tags

selectmediapath()

Select the path for a media (audio or video).

selectmediapath(string $f) : string
Parameters
$f : string

HTML field name for media string in form. Will be used as this.form.[$f] in JS.

Return values
string

HTML-formatted string for media selection

get_seconds_selectoptions()

get_seconds_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_playbackrate_selectoptions()

get_playbackrate_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

remove_soft_hyphens()

remove_soft_hyphens(mixed $str) : string|array<string|int, string>
Parameters
$str : mixed
Tags
psalm-return

array|string

Return values
string|array<string|int, string>

replace_supp_unicode_planes_char()

replace_supp_unicode_planes_char(mixed $s) : null|string|array<string|int, string>
Parameters
$s : mixed
Tags
psalm-return

array|null|string

Return values
null|string|array<string|int, string>

makeCounterWithTotal()

makeCounterWithTotal(mixed $max, mixed $num) : string
Parameters
$max : mixed
$num : mixed
Return values
string

encodeURI()

encodeURI(mixed $url) : string
Parameters
$url : mixed
Return values
string

print_file_path()

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
Parameters
$filename : string

Filename

get_file_path()

Get the path of a file using the theme directory

get_file_path(string $filename) : string
Parameters
$filename : string

Filename

Return values
string

File path if it exists, otherwise the filename

get_mobile_display_mode_selectoptions()

Prepare options for mobile.

get_mobile_display_mode_selectoptions("0"|"1"|"2" $v) : string
Parameters
$v : "0"|"1"|"2"

Current mobile type

Return values
string

get_sentence_count_selectoptions()

get_sentence_count_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_words_to_do_buttons_selectoptions()

get_words_to_do_buttons_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_regex_selectoptions()

get_regex_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_tooltip_selectoptions()

get_tooltip_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_themes_selectoptions()

get_themes_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

processSessParam()

Get a session value and update it if necessary.

processSessParam(string $reqkey, string $sesskey, string|int $default, bool $isnum) : string|int
Parameters
$reqkey : string

If in $_REQUEST, update the session with $_REQUEST[$reqkey]

$sesskey : string

Field of the session to get or update

$default : string|int

Default value to return

$isnum : bool

If true, convert the result to an int

Return values
string|int

The required data unless $isnum is specified

processDBParam()

Get a database value and update it if necessary.

processDBParam(string $reqkey, string $dbkey, string $default, bool $isnum) : string|int
Parameters
$reqkey : string

If in $_REQUEST, update the database with $_REQUEST[$reqkey]

$dbkey : string

Field of the database to get or update

$default : string

Default value to return

$isnum : bool

If true, convert the result to an int

Return values
string|int

The string data unless $isnum is specified

getWordTagList()

getWordTagList(mixed $wid[, mixed $before = ' ' ][, mixed $brack = 1 ][, mixed $tohtml = 1 ]) : string
Parameters
$wid : mixed
$before : mixed = ' '
$brack : mixed = 1
$tohtml : mixed = 1
Return values
string

get_last_key()

Return the last inserted ID in the database

get_last_key() : int
Tags
since
2.6.0-fork

Officially returns a int in documentation, as it was the case

Return values
int

get_checked()

If $value is true, return an HTML-style checked attribute.

get_checked(mixed $value) : string
Parameters
$value : mixed

Some value that can be evaluated as a boolean

Tags
psalm-return

' checked="checked" '|''

Return values
string

' checked="checked" ' if value is true, '' otherwise

get_selected()

Return an HTML attribute if $value is equal to $selval.

get_selected(mixed $value, mixed $selval) : string
Parameters
$value : mixed
$selval : mixed
Tags
psalm-return

' selected="selected" '|''

Return values
string

''|' selected="selected" ' Depending if inputs are equal

do_test_test_get_projection()

Create a projection operator do perform word test.

do_test_test_get_projection(string $key, array<string|int, mixed>|int $value) : string
Parameters
$key : string

Type of test.

  • 'words': selection from words
  • 'texts': selection from texts
  • 'lang': selection from language
  • 'text': selection from single text
$value : array<string|int, mixed>|int

Object to select.

Tags
global

string $tbpref

Return values
string

SQL projection necessary

do_test_test_from_selection()

Prepare the SQL when the text is a selection.

do_test_test_from_selection(mixed $selection_type, string $selection_data) : string
Parameters
$selection_type : mixed
$selection_data : string

Comma separated ID of elements to test.

Return values
string

SQL formatted string suitable to projection (inserted in a "FROM ")

make_status_controls_test_table()

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
Parameters
$score : int

Score associated to this word

$status : int

Status for this word

$wordid : int

Word ID

Return values
string

the HTML-formatted string to use

get_languages_selectoptions()

Return options as HTML code to insert in a language select.

get_languages_selectoptions(string|int|null $v, string $dt) : string
Parameters
$v : string|int|null

Selected language ID

$dt : string

Default value to display

Return values
string

get_languagessize_selectoptions()

get_languagessize_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_wordstatus_radiooptions()

get_wordstatus_radiooptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_wordstatus_selectoptions()

get_wordstatus_selectoptions(mixed $v, mixed $all, mixed $not9899[, mixed $off = true ]) : string
Parameters
$v : mixed
$all : mixed
$not9899 : mixed
$off : mixed = true
Return values
string

get_annotation_position_selectoptions()

get_annotation_position_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_hts_selectoptions()

get_hts_selectoptions(mixed $current_setting) : string
Parameters
$current_setting : mixed
Return values
string

get_paging_selectoptions()

get_paging_selectoptions(mixed $currentpage, mixed $pages) : string
Parameters
$currentpage : mixed
$pages : mixed
Return values
string

get_wordssort_selectoptions()

get_wordssort_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_tagsort_selectoptions()

get_tagsort_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_textssort_selectoptions()

get_textssort_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_andor_selectoptions()

get_andor_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

get_set_status_option()

get_set_status_option(mixed $n[, mixed $suffix = "" ]) : string
Parameters
$n : mixed
$suffix : mixed = ""
Return values
string

get_status_name()

get_status_name(mixed $n) : string
Parameters
$n : mixed
Return values
string

get_status_abbr()

get_status_abbr(mixed $n) : string
Parameters
$n : mixed
Return values
string

get_colored_status_msg()

get_colored_status_msg(mixed $n) : string
Parameters
$n : mixed
Return values
string

get_multiplewordsactions_selectoptions()

get_multiplewordsactions_selectoptions() : string
Return values
string

get_multipletagsactions_selectoptions()

get_multipletagsactions_selectoptions() : string
Return values
string

get_allwordsactions_selectoptions()

get_allwordsactions_selectoptions() : string
Return values
string

get_alltagsactions_selectoptions()

get_alltagsactions_selectoptions() : string
Return values
string

get_multipletextactions_selectoptions()

get_multipletextactions_selectoptions() : string
Return values
string

get_multiplearchivedtextactions_selectoptions()

get_multiplearchivedtextactions_selectoptions() : string
Return values
string

get_texts_selectoptions()

get_texts_selectoptions(mixed $lang, mixed $v) : string
Parameters
$lang : mixed
$v : mixed
Return values
string

makePager()

Makes HTML content for a text of style "Page 1 of 3".

makePager(mixed $currentpage, mixed $pages, mixed $script, mixed $formname) : void
Parameters
$currentpage : mixed
$pages : mixed
$script : mixed
$formname : mixed

makeStatusCondition()

makeStatusCondition(mixed $fieldname, mixed $statusrange) : string
Parameters
$fieldname : mixed
$statusrange : mixed
Return values
string

checkStatusRange()

checkStatusRange(mixed $currstatus, mixed $statusrange) : bool
Parameters
$currstatus : mixed
$statusrange : mixed
Return values
bool

makeStatusClassFilter()

Adds HTML attributes to create a filter over words learning status.

makeStatusClassFilter(int<0, 5>|98|99|599 $status) : string
Parameters
$status : int<0, 5>|98|99|599

Word learning status 599 is a special status combining 5 and 99 statuses. 0 return an empty string

Return values
string

CSS class filter to exclude $status

makeStatusClassFilterHelper()

Replace $status in $array by -1

makeStatusClassFilterHelper(int $status, array<string|int, int> &$array) : void
Parameters
$status : int

A value in $array

$array : array<string|int, int>

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

Parameters
$u : string

Dictionary URL. It may contain 'lwt_term' that will get parsed

$t : string

Text that substite the 'lwt_term'

Tags
since
2.7.0-fork

It is recommended to use "lwt_term" instead of "###"

Return values
string

Dictionary link formatted

createDictLinksInEditWin()

Returns dictionnary links formatted as HTML.

createDictLinksInEditWin(int $lang, string $word, string $sentctljs, bool $openfirst) : string
Parameters
$lang : int

Language ID

$word : string
$sentctljs : string
$openfirst : bool

True if we should open right frames with translation first

Tags
global

string $tbpref Database table prefix

Return values
string

HTML-formatted interface

makeOpenDictStr()

Create a dictionnary open URL from an pseudo-URL

makeOpenDictStr(string $url, string $txt) : string
Parameters
$url : string

An URL, starting with a "*" is deprecated.

  • If it contains a "popup" query, open in new window
  • Otherwise open in iframe
$txt : string

Clickable text to display

Return values
string

HTML-formatted string

makeOpenDictStrJS()

makeOpenDictStrJS(mixed $url) : string
Parameters
$url : mixed
Return values
string

makeOpenDictStrDynSent()

Create a dictionnary open URL from an pseudo-URL

makeOpenDictStrDynSent(string $url, string $sentctljs, string $txt) : string
Parameters
$url : string

A string containing at least a URL

  • If it contains the query "lwt_popup", open in Popup
  • Starts with a '*': open in pop-up window (deprecated)
  • Otherwise open in iframe
$sentctljs : string

Clickable text to display

$txt : string

Clickable text to display

Tags
since
2.7.0-fork

Supports LibreTranslate, using other string that proper URL is deprecated.

Return values
string

HTML-formatted string

createDictLinksInEditWin2()

Returns dictionnary links formatted as HTML.

createDictLinksInEditWin2(int $lang, string $sentctljs, string $wordctljs) : string
Parameters
$lang : int

Language ID

$sentctljs : string
$wordctljs : string
Tags
global

string $tbpref Database table prefix

Return values
string

HTML formatted interface

makeDictLinks(mixed $lang, mixed $wordctljs) : string
Parameters
$lang : mixed
$wordctljs : mixed
Return values
string

createDictLinksInEditWin3()

createDictLinksInEditWin3(mixed $lang, mixed $sentctljs, mixed $wordctljs) : string
Parameters
$lang : mixed
$sentctljs : mixed
$wordctljs : mixed
Return values
string

checkTest()

Return checked attribute if $val is in array $_REQUEST[$name]

checkTest(mixed $val, string $name) : string
Parameters
$val : mixed

Value to look for, needle

$name : string

Key of request haystack.

Tags
psalm-return

' '|' checked="checked" '

Return values
string

' ' of ' checked="checked" ' if the qttribute should be checked.

strToHex()

strToHex(mixed $string) : string
Parameters
$string : mixed
Return values
string

strToClassName()

Escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165)

strToClassName(string $string) : string
Parameters
$string : string

String to escape

Return values
string

anki_export()

anki_export(mixed $sql) : never
Parameters
$sql : mixed
Return values
never

tsv_export()

tsv_export(mixed $sql) : never
Parameters
$sql : mixed
Return values
never

flexible_export()

flexible_export(mixed $sql) : never
Parameters
$sql : mixed
Return values
never

mask_term_in_sentence_v2()

mask_term_in_sentence_v2(mixed $s) : string
Parameters
$s : mixed
Return values
string

repl_tab_nl()

Replace all white space characters by a simple space ' '.

repl_tab_nl(string $s) : string

The output string is also trimmed.

Parameters
$s : string

String to parse

Return values
string

String with only simple whitespaces.

mask_term_in_sentence()

mask_term_in_sentence(mixed $s, mixed $regexword) : string
Parameters
$s : mixed
$regexword : mixed
Return values
string

return_textwordcount()

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

Parameters
$texts_id : string

Texts ID separated by comma

Tags
global

string $tbpref Table name prefix

psalm-return

array{total: array<float|int|string, float|int|null|string>, expr: array<float|int|string, float|int|null|string>, stat: array<float|int|string, array<float|int|string, float|int|null|string>>, totalu: array<float|int|string, float|int|null|string>, expru: array<float|int|string, float|int|null|string>, statu: array<float|int|string, array<float|int|string, float|int|null|string>>}

Return values
array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>>

Statistics under the form of an array

textwordcount()

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

Parameters
$textID : string

Text IDs separated by comma

Tags
global

string $tbpref Table name prefix

deprecated
2.9.0

Use return_textwordcount instead.

todo_words_count()

Return the number of words left to do in this text.

todo_words_count(int $textid) : int
Parameters
$textid : int

Text ID

Tags
global

string $tbpref

Return values
int

Number of words

todo_words_content()

Prepare HTML interactions for the words left to do in this text.

todo_words_content(int $textid) : string
Parameters
$textid : int

Text ID

Tags
global

string $tbpref

since
2.7.0-fork

Adapted to use LibreTranslate dictionary as well.

Return values
string

HTML result

texttodocount2()

Prepare HTML interactions for the words left to do in this text.

texttodocount2(string|int $textid) : string
Parameters
$textid : string|int

Text ID

Tags
since
2.7.0-fork

Adapted to use LibreTranslate dictionary as well.

deprecated

Since 2.10.0, use todo_words_content instead

Return values
string

HTML result

sentences_containing_word_lc_query()

Return a SQL string to find sentences containing a word.

sentences_containing_word_lc_query(string $wordlc, int $lid) : string
Parameters
$wordlc : string

Word to look for in lowercase

$lid : int

Language ID

Return values
string

Query in SQL format

sentences_from_word()

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
Parameters
$wid : int|null

Word ID or mode

  • null: use $wordlc instead, simple search
  • -1: use $wordlc with a more complex search
  • 0 or above: sentences containing $wid
$wordlc : string

Word to look for in lowercase

$lid : int

Language ID

$limit : int = -1

Maximum number of sentences to return

Return values
mysqli_result|true

Query

getSentence()

Format the sentence(s) $seid containing $wordlc highlighting $wordlc.

getSentence(int $seid, string $wordlc, int $mode) : array<string|int, string>
Parameters
$seid : int

Sentence ID

$wordlc : string

Term text in lower case

$mode : int
  • Up to 1: return only the current sentence
  • Above 1: return previous sentence and current sentence
  • Above 2: return previous, current and next sentence
Tags
global

string $tbpref Database table prefix.

psalm-return

list{string, string}

Return values
array<string|int, string>

[0]=html, word in bold, [1]=text, word in }

sentences_with_word()

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>>
Parameters
$lang : int

Language ID

$wordlc : string

Word to look for in lowercase

$wid : int|null

Word ID

  • null: use $wordlc instead, simple search
  • -1: use $wordlc with a more complex search
  • 0 or above: find sentences containing $wid
$mode : int|null = 0

Sentences to get:

  • Up to 1 is 1 sentence,
  • 2 is previous and current sentence,
  • 3 is previous, current and next one
$limit : int = 20

Maximum number of sentences to return

Tags
psalm-return

list{0?: array{0: string, 1: string},...}

Return values
array<string|int, array<string|int, string>>

Array of sentences found

example_sentences_area()

Prepare the area to for examples sentences of a word.

example_sentences_area(mixed $lang, mixed $termlc, mixed $selector, mixed $wid) : void
Parameters
$lang : mixed
$termlc : mixed
$selector : mixed
$wid : mixed

get20Sentences()

Show 20 sentences containg $wordlc.

get20Sentences(int $lang, string $wordlc, int|null $wid, string $jsctlname, int $mode) : string
Parameters
$lang : int

Language ID

$wordlc : string

Term in lower case.

$wid : int|null

Word ID

$jsctlname : string

Path for the textarea of the sentence of the word being edited.

$mode : int
  • Up to 1: return only the current sentence
  • Above 1: return previous and current sentence
  • Above 2: return previous, current and next sentence
Tags
global

string $tbpref Database table prefix

Return values
string

HTML-formatted string of which elements are candidate sentences to use.

get_languages()

Return a dictionary of languages name - id

get_languages() : array<string, int>
Return values
array<string, int>

getLanguage()

Get language name from its ID

getLanguage(string|int $lid) : string
Parameters
$lid : string|int

Language ID

Tags
global

string $tbpref Table name prefix

Return values
string

Language name

getLanguageCode()

Try to get language code from its ID

getLanguageCode(int $lg_id, array<string|int, mixed> $languages_table) : string
Parameters
$lg_id : int

Language ID

$languages_table : array<string|int, mixed>

Table of languages, usually LWT_LANGUAGES_ARRAY

Tags
global

string $tbpref

Return values
string

If found, two-letter code (e. g. BCP 47) or four-letters for the langugae. '' otherwise.

getScriptDirectionTag()

Return a right-to-left direction indication in HTML if language is right-to-left.

getScriptDirectionTag(string|int|null $lid) : string
Parameters
$lid : string|int|null

Language ID

Return values
string

' dir="rtl" '|''

findMecabExpression()

Find all occurences of an expression using MeCab.

findMecabExpression(string $text, string|int $lid) : array<string|int, array<string|int, int|string>>
Parameters
$text : string

Text to insert

$lid : string|int

Language ID

Tags
global

string $tbpref Table name prefix

psalm-return

list{0?: array{SeID: int, TxID: int, position: int, term: string},...}

Return values
array<string|int, array<string|int, int|string>>

Each found multi-word details

insert_expression_from_mecab()

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>>
Parameters
$text : string

Text to insert

$lid : string|int

Language ID

$wid : string|int

Word ID

$len : int

Number of words in the expression

Tags
since
2.5.0-fork

Function added.

deprecated

Since 2.10.0 Use insertMecabExpression

global

string $tbpref Table name prefix

psalm-return

list{array<int, string>, list{0?: string,...}}

Return values
array<string|int, array<string|int, string>>

Append text and values to insert to the database

insertExpressionFromMeCab()

Insert an expression to the database using MeCab.

insertExpressionFromMeCab(string $textlc, string $lid, string $wid, int $len, int $mode) : array{: string[], : string[]}
Parameters
$textlc : string

Text to insert in lower case

$lid : string

Language ID

$wid : string

Word ID

$len : int

Number of words in the expression

$mode : int

If equal to 0, add data in the output

Tags
since
2.5.0-fork

Function deprecated. $mode is unnused, data are always returned. The second return argument is always empty array.

deprecated

Use insertMecabExpression instead.

global

string $tbpref Table name prefix

psalm-return

array{0: array<int, string>, 1: list}

Return values
array{: string[], : string[]}

Append text and SQL array.

findStandardExpression()

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>>
Parameters
$textlc : string

Text to insert in lower case

$lid : string|int

Language ID

Tags
global

string $tbpref Table name prefix

psalm-return

list{0?: array{SeID: int, SeTxID: int, position: int, term: null|string, term_display: null|string},...}

Return values
array<string|int, array<string|int, int|null|string>>

Each inserted mutli-word details

insert_standard_expression()

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>>
Parameters
$textlc : string

Text to insert in lower case

$lid : string|int

Language ID

$wid : string|int

Word ID

$len : int

Number of words in the expression

$mode : mixed

Unnused

Tags
since
2.5.0-fork

Mode is unnused and data are always added to the output.

since
2.5.2-fork

Fixed multi-words insertion for languages using no space.

deprecated

Since 2.10.0-fork, use insertStandardExpression

psalm-return

list{array<int, null|string>, array<never, never>, list{0?: string,...}}

Return values
array<string|int, array<string|int, null|string>>

Append text, empty and sentence id

new_expression_interactable()

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
Parameters
$hex : mixed
$appendtext : mixed
$sid : mixed
$len : mixed
Tags
deprecated

Use newMultiWordInteractable instead. The new function does not use global JS variables.

new_expression_interactable2()

Prepare a JavaScript dialog to insert a new expression.

new_expression_interactable2(string $hex, array<string|int, string> $appendtext, int $wid, int $len) : void
Parameters
$hex : string

Lowercase text, formatted version of the text.

$appendtext : array<string|int, string>

Text to append

$wid : int

Term ID

$len : int

Words count.

Tags
global

string $tbpref Database table prefix.

since
2.10.0-fork

Fixes a bug inserting wrong title in tooltip

newMultiWordInteractable()

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
Parameters
$hex : string

Lowercase text, formatted version of the text.

$multiwords : array<string|int, array<string|int, string>>

Multi-words to happen, format [textid][position][text]

$wid : int

Term ID

$len : int

Words count.

Tags
global

string $tbpref Database table prefix.

since
2.10.0-fork

Fixes a bug inserting wrong title in tooltip

insertExpressions()

Alter the database to add a new word

insertExpressions(string $textlc, string|int $lid, mixed $wid, int $len, int $mode) : null|string
Parameters
$textlc : string

Text in lower case

$lid : string|int

Language ID

$wid : mixed
$len : int

Number of words in the expression

$mode : int

Function mode

  • 0: Default mode, do nothing special
  • 1: Runs an expresion inserter interactable
  • 2: Return the sql output
Tags
global

string $tbpref Table name prefix

Return values
null|string

If $mode == 2 return values to insert in textitems2, nothing otherwise.

restore_file()

Restore the database from a file.

restore_file(resource $handle, string $title) : string
Parameters
$handle : resource

Backup file handle

$title : string

File title

Tags
global

string $trbpref Database table prefix

global

int $debug Debug status

global

string $dbname Database name

since
2.0.3-fork

Function was broken

since
2.5.3-fork

Function repaired

since
2.7.0-fork

$handle should be an uncompressed file.

since
2.9.1-fork

It can read SQL with more or less than one instruction a line

Return values
string

Human-readable status message

recreate_save_ann()

Uses provided annotations, and annotations from database to update annotations.

recreate_save_ann(int $textid, string $oldann) : string
Parameters
$textid : int

Id of the text on which to update annotations

$oldann : string

Old annotations

Return values
string

Updated annotations for this text.

create_ann()

Create new annotations for a text.

create_ann(int $textid) : string
Parameters
$textid : int

Id of the text to create annotations for

Tags
since
2.9.0

Annotations "position" change, they are now equal to Ti2Order it was shifted by one index before.

Return values
string

Annotations for the text

create_save_ann()

create_save_ann(mixed $textid) : string
Parameters
$textid : mixed
Return values
string

truncateUserDatabase()

Truncate the database, remove all data belonging by the current user.

truncateUserDatabase() : void

Keep settings.

Tags
global

$tbpref

process_term()

process_term(mixed $nonterm, mixed $term, mixed $trans, mixed $wordid, mixed $line) : string
Parameters
$nonterm : mixed
$term : mixed
$trans : mixed
$wordid : mixed
$line : mixed
Return values
string

get_first_translation()

get_first_translation(mixed $trans) : string
Parameters
$trans : mixed
Return values
string
get_annotation_link(mixed $textid) : string
Parameters
$textid : mixed
Return values
string

trim_value()

Like trim, but in place (modify variable)

trim_value(string &$value) : void
Parameters
$value : string

Value to be trimmed

phoneticReading()

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.

Parameters
$text : string

Text to be converted

$lgid : string

Language ID

Return values
string

Parsed text in a phonetic format.

phonetic_reading()

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.

Parameters
$text : string

Text to be converted

$lang : string

Language code (usually BCP 47 or ISO 639-1)

Tags
since
2.9.0

Any language starting by "ja" or "jp" is considered phonetic.

Return values
string

Parsed text in a phonetic format.

refreshText()

Refresh a text.

refreshText(mixed $word, mixed $tid) : string
Parameters
$word : mixed
$tid : mixed
Tags
deprecated

No longer used, incompatible with new database system.

since
1.6.25-fork

Not compatible with the database

Return values
string

makeMediaPlayer()

Create an HTML media player, audio or video.

makeMediaPlayer(string $path[, int $offset = 0 ]) : void
Parameters
$path : string

URL or local file path

$offset : int = 0

Offset from the beginning of the video

makeVideoPlayer()

Create an embed video player

makeVideoPlayer(string $path[, int $offset = 0 ]) : void
Parameters
$path : string

URL or local file path

$offset : int = 0

Offset from the beginning of the video

makeAudioPlayer()

Create an HTML audio player.

makeAudioPlayer(string $audio[, int $offset = 0 ]) : void
Parameters
$audio : string

Audio URL

$offset : int = 0

Offset from the beginning of the video

framesetheader()

Echo a HEAD tag for using with frames

framesetheader(string $title) : void
Parameters
$title : string

Title to use

pagestart()

Write a page header and start writing its body.

pagestart(string $title, bool $close) : void
Parameters
$title : string

Title of the page

$close : bool

Set to true if you are closing the header

Tags
since
2.7.0

Show no text near the logo, page title enclosed in H1

global

bool $debug Show a DEBUG span if true

pagestart_nobody()

Start a standard page with a complete header and a non-closed body.

pagestart_nobody(string $title[, string $addcss = '' ]) : void
Parameters
$title : string

Title of the page

$addcss : string = ''

Some CSS to be embed in a style tag

Tags
global

string $tbpref The database table prefix if true

global

int $debug Show the requests if true

letterPairs()

letterPairs(mixed $str) : array<string|int, string>
Parameters
$str : mixed
Tags
psalm-return

array<0|positive-int, string>

Return values
array<string|int, string>

wordLetterPairs()

wordLetterPairs(mixed $str) : array<string|int, string>
Parameters
$str : mixed
Tags
psalm-return

list

Return values
array<string|int, string>

getSimilarityRanking()

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

Parameters
$str1 : mixed
$str2 : mixed
Return values
float

SimilarityRanking

get_similar_terms()

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.

Parameters
$lang_id : int

Language ID

$compared_term : string

Term to compare with

$max_count : int

Maximum number of terms to display

$min_ranking : float

For terms to match

Tags
psalm-return

array<positive-int, int>

Return values
array<string|int, int>

All $max_count wordids with a similarity ranking > $min_ranking, sorted decending

format_term()

Prepare a field with a similar term to copy.

format_term(int $termid, string $compare) : string
Parameters
$termid : int

Initial term ID

$compare : string

Similar term to copy.

Tags
global

string $tbpref

Return values
string

HTNL-formatted string with the similar term displayed.

print_similar_terms()

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
Parameters
$lang_id : int

Language ID

$compared_term : string

Similar term we compare to

Return values
string

print_similar_terms_tabrow()

Print a row for similar terms if the feature is enabled.

print_similar_terms_tabrow() : void

set_error_reporting()

Starts or not the error reporting.

set_error_reporting(int $dsplerrors) : void
Parameters
$dsplerrors : int

not 0: start error reporting for ALL errors 0: don't report

set_configuration_options()

Set configuration values as script limit time and such.

set_configuration_options() : void

..

start_session()

Start the session and checks for its sanity.

start_session() : void

start_session_main()

Launch a new session for WordPress.

start_session_main() : void

get_tags()

Return the list of all tags.

get_tags([int $refresh = 0 ]) : array<string|int, string>
Parameters
$refresh : int = 0

If true, refresh all tags for session

Tags
global

string $tbpref Table name prefix

Return values
array<string|int, string>

All tags

get_texttags()

Return the list of all text tags.

get_texttags([int $refresh = 0 ]) : array<string|int, string>
Parameters
$refresh : int = 0

If true, refresh all text tags for session

Tags
global

string $tbpref Table name prefix

Return values
array<string|int, string>

All text tags

getTextTitle()

getTextTitle(mixed $textid) : string
Parameters
$textid : mixed
Return values
string

get_tag_selectoptions()

get_tag_selectoptions(mixed $v, mixed $l) : string
Parameters
$v : mixed
$l : mixed
Return values
string

get_texttag_selectoptions()

get_texttag_selectoptions(mixed $v, mixed $l) : string
Parameters
$v : mixed
$l : mixed
Return values
string

get_txtag_selectoptions()

get_txtag_selectoptions(mixed $l, mixed $v) : string
Parameters
$l : mixed
$v : mixed
Return values
string

get_archivedtexttag_selectoptions()

get_archivedtexttag_selectoptions(mixed $v, mixed $l) : string
Parameters
$v : mixed
$l : mixed
Return values
string

saveWordTags()

Save the tags for words.

saveWordTags(mixed $wid) : void
Parameters
$wid : mixed

saveTextTags()

Save the tags for texts.

saveTextTags(mixed $tid) : void
Parameters
$tid : mixed
Tags
global

string $tbpref Database table prefix.

saveArchivedTextTags()

Save the tags for archived texts.

saveArchivedTextTags(mixed $tid) : void
Parameters
$tid : mixed
Tags
global

string $tbpref Databse table prefix.

getWordTags()

getWordTags(mixed $wid) : string
Parameters
$wid : mixed
Return values
string

getTextTags()

Return a HTML-formatted list of the text tags.

getTextTags(int $tid) : string
Parameters
$tid : int

Text ID. Can be below 1 to create an empty list.

Tags
global

string $tbpref Database table prefix

Return values
string

UL list of text tags

getArchivedTextTags()

Return a HTML-formatted list of the text tags for an archived text.

getArchivedTextTags(int $tid) : string
Parameters
$tid : int

Text ID. Can be below 1 to create an empty list.

Tags
global

string $tbpref Database table prefix

Return values
string

UL list of text tags

addtaglist()

addtaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

addarchtexttaglist()

addarchtexttaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

addtexttaglist()

addtexttaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

removetaglist()

removetaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

removearchtexttaglist()

removearchtexttaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

removetexttaglist()

removetexttaglist(mixed $item, mixed $list) : string
Parameters
$item : mixed
$list : mixed
Return values
string

no_connectinc_error_page()

Echo an error page if connect.inc.php was not found.

no_connectinc_error_page() : void
Tags
since
2.7.0-fork

Now display a link to the connect.ing.php creation wizard, return void instead of dying.

get_span_groups()

Prepare the different SPAN opening tags

get_span_groups() : array<string|int, string>
Tags
global

string $tbpref Database table prefix

global

string $fixed_tbpref Fixed database table prefix

psalm-return

list{''|'', string, ''|''}

Return values
array<string|int, string>

3 different span levels

do_current_text_info()

Display the current text options.

do_current_text_info(mixed $textid) : void
Parameters
$textid : mixed
Tags
global

string $tbpref Database table prefix

do_language_selectable()

Echo a select element to switch between languages.

do_language_selectable(mixed $langid) : void
Parameters
$langid : mixed

When on a WordPress server, make a logout button

wordpress_logout_link() : void

get_server_data()

Return a lot of different server state variables.

get_server_data() : array<string|int, false|float|string|array<string|int, string>>
Tags
deprecated

Use get_server_data_table, will be removed in 3.0.0.

psalm-return

list{string, float, non-empty-list, string, false|string, string}

global

string $tbpref Database table prefix

global

string $dbname Database name

Return values
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

index_load_warnings()

Load the content of warnings for visual display.

index_load_warnings() : void

index_do_main_page()

Display the main body of the page.

index_do_main_page() : void
Tags
global

string $tbpref Database table prefix

global

int $debug Debug mode enabled

get_word()

Return the word at a specific position in a text.

get_word(string $textid, string $textpos) : string
Parameters
$textid : string

ID of the text

$textpos : string

Position of the word in the text.

Tags
global

string $tbpref

Return values
string

A word

insert_word_ignore_to_database()

Edit the database to add the word.

insert_word_ignore_to_database(mixed $textid, string $word) : int
Parameters
$textid : mixed
$word : string

Word to add

Tags
global

string $tbpref

Return values
int

Word ID

do_javascript_action()

Make the ignored word as no longer marked.

do_javascript_action(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
$word : string

New ignored word

$wid : string|int

New ignored word ID

$hex : string

Hexadecimal version of the lowercase word.

$textid : string|int

ID of the text.

Tags
global

string $tbpref

show_page_insert_word_ignore()

Echoes a complete HTML page, with JavaScript content.

show_page_insert_word_ignore(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
$word : string

New well-known word

$wid : string|int

New well-known word ID

$hex : string

Hexadecimal version of the lowercase word.

$textid : string|int

ID of the text.

do_insert_word_ignore()

Main function to insert a new word with display and JS action.

do_insert_word_ignore(string $textid, string $textpos) : void
Parameters
$textid : string

ID of the text

$textpos : string

Position of the word in the text.

Tags
since
2.0.4-fork

get_word()

Return the word at a specific position in a text.

get_word(string $textid, string $textpos) : string
Parameters
$textid : string

ID of the text

$textpos : string

Position of the word in the text.

Tags
global

string $tbpref

Return values
string

A word

insert_word_wellknown_to_database()

Edit the database to add the word.

insert_word_wellknown_to_database(mixed $textid, string $word) : int
Parameters
$textid : mixed
$word : string

Word to add

Tags
global

string $tbpref

Return values
int

Word ID

insert_word_wellknown_javascript()

Make the well-known word as no longer marked.

insert_word_wellknown_javascript(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
$word : string

New well-known word

$wid : string|int

New well-known word ID

$hex : string

Hexadecimal version of the lowercase word.

$textid : string|int

ID of the text.

Tags
global

string $tbpref

show_page_insert_word_wellknown()

Echoes a complete HTML page, with JavaScript content.

show_page_insert_word_wellknown(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
$word : string

New well-known word

$wid : string|int

New well-known word ID

$hex : string

Hexadecimal version of the lowercase word.

$textid : string|int

ID of the text.

do_insert_word_wellknown()

Main function to insert a new word with display and JS action.

do_insert_word_wellknown(string $textid, string $textpos) : void
Parameters
$textid : string

ID of the text

$textpos : string

Position of the word in the text.

Tags
since
2.0.4-fork

restore_demo_db()

Restore demo database from file.

restore_demo_db() : string
Return values
string

Status message

long_text_check()

Display the check page before a long text import.

long_text_check(int $max_input_vars) : void
Parameters
$max_input_vars : int

Maximale bytes size for the text.

long_text_save()

Save a long text to the database.

long_text_save() : void
Tags
global

string $tppref Database table prefix.

long_text_display()

Display the main page for a long tex import.

long_text_display(int $max_input_vars) : void
Parameters
$max_input_vars : int

Maximal number of bytes for the text.

Tags
global

$tbpref

long_text_do_page()

Do the main page for the long text import.

long_text_do_page() : void

output_text()

output_text(mixed $saveterm, mixed $saverom, mixed $savetrans, mixed $savetags, mixed $show_rom, mixed $show_trans, mixed $show_tags, mixed $annplcmnt) : void
Parameters
$saveterm : mixed
$saverom : mixed
$savetrans : mixed
$savetags : mixed
$show_rom : mixed
$show_trans : mixed
$show_tags : mixed
$annplcmnt : mixed

get_wizard_selectoptions()

Returns a dropdown menu of the different languages

get_wizard_selectoptions(mixed $v) : string
Parameters
$v : mixed
Return values
string

do_set_test_status_html()

Echo the page HTML content when setting word status.

do_set_test_status_html(int $status, int $oldstatus, int $newscore, int $oldscore) : void
Parameters
$status : int

New learning status for the word

$oldstatus : int

Previous learning status

$newscore : int

New score for the word

$oldscore : int

Previous score

set_test_status_change_progress()

Increment the session progress in learning new words.

set_test_status_change_progress(int $stchange) : array<string|int, int>
Parameters
$stchange : int

-1, 0, or 1 if status is rising or not

Tags
psalm-return

array{total: int, wrong: int, correct: int, nottested: int}

Return values
array<string|int, int>

Tests data

do_set_test_status_javascript()

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
Parameters
$wid : int

Word ID

$status : int

New learning status for the word

$stchange : int

-1, 0, or 1 if status is rising or not

$tests_status : mixed = array()
$ajax : mixed = false

do_set_test_status_content()

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
Parameters
$wid : int

Word ID

$status : int

New learning status for the word

$oldstatus : int

Previous learning status

$stchange : int

-1, 0, or 1 if status is rising or not

$ajax : mixed = false
Tags
global

string $tbpref Database table prefix

start_set_text_status()

Start the word status set page.

start_set_text_status() : void
Tags
global

string $tbpref Database table prefix

text_mode_save_settings()

Save text mode settings.

text_mode_save_settings(int $showAll, int $showLearning) : int
Parameters
$showAll : int

Whether all word should be shown

$showLearning : int

Whether to show translation of learning words

Tags
psalm-return

0|1

Return values
int

If show learning were previously true (1) or false (0)

text_annotations_mode_javascript()

Do the JavaScript action to change the display of translations.

text_annotations_mode_javascript(int $showLearning, int $oldShowLearning) : void
Parameters
$showLearning : int

Whether to show translation of learning words

$oldShowLearning : int

If show learning was previously true (1) or false (0)

text_mode_page_content()

Do the main page content when chaning display of translations.

text_mode_page_content(int $showAll, int $showLearning, int $oldShowLearning) : void
Parameters
$showAll : int

Whether all word should be shown

$showLearning : int

Whether to show translation of learning words

$oldShowLearning : int

If show learning was previously true (1) or false (0)

change_text_mode()

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.

Parameters
$textid : int

ID of the current text

$showAll : int

Whether all word should be shown

$showLearning : int

Whether to show translation of learning words

get_word_data()

Get various data for the word corresponding to the ID.

get_word_data(string $wid) : array{0: string, 1: string, 2: string}
Parameters
$wid : string

ID of the word

Tags
global

string $tbpref

Return values
array{0: string, 1: string, 2: string}

The word in plain text, his translation and his romanization

set_word_status_ajax()

Sent an AJAX request to change a word satus.

set_word_status_ajax(string $wid, string $status) : void
Parameters
$wid : string

ID of the word status to change

$status : string

New status to set

set_word_status_database()

Edit the term status in the database.

set_word_status_database(string $wid, string $status) : string
Parameters
$wid : string

ID of the word to update

$status : string

New status to set

Tags
global

string $tbpref

Return values
string

Some edit message, number of affected rows or error message

set_word_status_javascript()

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
Parameters
$tid : string

Text ID

$wid : string

ID of the word that changed status, unnused

$status : string

New status, unnused

$word : string

Word in plain text

$trans : string

Translation of the word

$roman : string

Romanization of the word

set_word_status_display_page()

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
Parameters
$tid : string

Text ID

$wid : string

ID of the word that changed status

$status : string

New status

$word : string

Word in plain text

$trans : string

Translation of the word

$roman : string

Romanization of the word

do_set_word_status()

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.

Parameters
$textid : string

ID of the affected text

$wordid : string

ID of the word to update

$status : string

New status for this word

Tags
since
2.0.4-fork

markdown_converter()

Convert a markdown file to HTML and return the result.

markdown_converter(string $file_path) : string
Parameters
$file_path : string

Full path for the file to use, including extension.

Return values
string

An HTML-formatted string

markdown_integration()

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.

Parameters
$file_path : string

Full path for the file to use, including extension (should be ".md")

minifyJS()

Minify a JavaScript file and outputs the result to js/

minifyJS(string $path, string $outputPath) : string
Parameters
$path : string

Input file path with extension.

$outputPath : string

Output file path with extension

Tags
since
2.2.2-fork

Relative paths in the returned content is the same as the saved content.

Return values
string

Minified content

minifyCSS()

Minify a JavaScript file and outputs the result to css/

minifyCSS(string $path, string $outputPath) : string
Parameters
$path : string

Input file path with extension.

$outputPath : string

Output file path with extension

Tags
since
2.2.2-fork

Relative paths in the returned content is the same as the saved content.

Return values
string

Minified content

minifyAllJS()

Minify all JavaScript files

minifyAllJS() : string
Tags
since
2.0.3-fork
since
2.3.0-fork

JS code is "combined" above being minified: only one file is outputted.

Return values
string

Minified code

minifyAllCSS()

Minify all Cascading-Style Sheet (CSS) files

minifyAllCSS() : void
Tags
since
2.0.3-fork

regenerateSingleTheme()

Regenerate a single theme.

regenerateSingleTheme(string $parent_folder, string $theme_folder) : void
Parameters
$parent_folder : string

Path to the parent folder (I. E. src/themes/)

$theme_folder : string

Name of the theme folder

regenerateThemes()

Find and regenerate all themes. CSS is minified while other files are copied.

regenerateThemes() : void

Nested folders are ignored.

minify_everything()

One-do-all command to minify all your JS, CSS, and regenerate themes.

minify_everything() : void

start_save_prefix()

Save a database prefix.

start_save_prefix(string $pref) : void
Parameters
$pref : string

Database prefix to save.

start_do_page()

Do a short page to edit the database prefix.

start_do_page() : void
Tags
global

string $tbpref Database table prefix

global

int $fixed_tbpref If the table prefix is fixed and cannot be changed

get_language_code()

Two-letter language code from from language name (e. g. : "English" = > "en" ).

get_language_code(string $language) : string
Parameters
$language : string

Language name, for instance "English"

Tags
ðeprecated

Since 2.9.1-fork, use getLanguageCode

Return values
string

Two-letter language name

language_id_from_code()

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.

Parameters
$code : string

Two letters, or four letters separated with caret ("fr" or "en-US").

Return values
int

Language ID if found, -1 otherwise.

tts_language_options()

String to population a SELECT tag.

tts_language_options() : string
Return values
string

HTML-formatted string.

tts_settings_minimal_page()

Make only a partial, embedable page for text-to-speech settings.

tts_settings_minimal_page() : void

tts_settings_full_page()

Make the complete HTML page for text-to-speech settings.

tts_settings_full_page(string $message) : void
Parameters
$message : string

A message to display when page loads.

tts_save_settings()

Save the text-to-speech settings as cookies.

tts_save_settings(array<string|int, mixed> $form) : void
Parameters
$form : array<string|int, mixed>

Inputs from the main form.

my_str_getcsv()

Get the CSV from a string.

my_str_getcsv(string $input) : array<string|int, null|string>|false|null
Parameters
$input : string

Input string.

Tags
psalm-return

false|non-empty-list<null|string>|null

deprecated
2.9.0

This function is no longer used and will be removed

Return values
array<string|int, null|string>|false|null

upload_words_import_simple()

upload_words_import_simple(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status) : void
Parameters
$lang : mixed
$fields : mixed
$columns : mixed
$tabs : mixed
$file_name : mixed
$status : mixed

upload_words_import_complete()

upload_words_import_complete(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status, mixed $overwrite) : void
Parameters
$lang : mixed
$fields : mixed
$columns : mixed
$tabs : mixed
$file_name : mixed
$status : mixed
$overwrite : mixed

upload_words_handle_multiwords()

upload_words_handle_multiwords(mixed $lang, mixed $last_update) : void
Parameters
$lang : mixed
$last_update : mixed

upload_words_import_terms()

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
Parameters
$fields : array<string|int, mixed>

Fields indexes

$tabs : string

Columns separator

$file_upl : bool

If the input text is an uploaded file

$col : array<int, string>

Columns names

$lang : int

Language ID

Tags
global

string $tbpref Database table prefix

Return values
string

Last word update timestamp

display_imported_terms()

display_imported_terms(mixed $last_update, mixed $rtl) : void
Parameters
$last_update : mixed
$rtl : mixed

upload_words_import_tags()

Import term tags only to the database.

upload_words_import_tags(array<string|int, mixed> $fields, string $tabs, bool $file_upl) : void
Parameters
$fields : array<string|int, mixed>

Fields indexes

$tabs : string

Columns separator

$file_upl : bool

If the input text is an uploaded file

Tags
global

string $tbpref Database table prefix

upload_words_import()

Import terms of tags to the database.

upload_words_import() : void
Tags
global

string $tbpref Database table prefix

upload_words_display()

Display the main for adding new words.

upload_words_display() : void

Search results