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