Lwt
Table of Contents
Packages
Classes
- Database_Connection
- A connection to database stored as an object.
- GoogleTranslate
- Wrapper class to get translation.
- 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_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.
- send_response() : never
- Send JSON response and exit.
- endpoint_exits() : string
- Check if an API endpoint exists.
- rest_api_version() : array<string|int, string>
- Return the API version.
- media_files() : array<string|int, string>
- List the audio and video files in the media folder.
- readingConfiguration() : array<string|int, mixed>
- The way text should be read
- get_phonetic_reading() : array<string|int, string>
- Get the phonetic reading of a word based on it's language.
- get_word_test_ajax() : array<string|int, int|mixed|string>
- Retun the next word to test as JSON
- word_test_ajax() : array<string|int, mixed>
- Return the next word to test.
- tomorrow_test_count() : array<string|int, mixed>
- Return the number of reviews for tomorrow by using the suplied query.
- get_theme_path() : array<string|int, mixed>
- Get the file path using theme.
- get_texts_statistics() : array<string|int, mixed>
- Return statistics about a group of text.
- sentences_with_registred_term() : array<string|int, mixed>
- Sentences containing an input word.
- sentences_with_new_term() : array<string|int, mixed>
- Return the example sentences containing an input word.
- similar_terms() : array<string|int, mixed>
- Get terms similar to a given term.
- imported_terms() : array<string|int, mixed>
- Return the list of imported terms.
- term_translations() : array<string|int, mixed>
- Translations for a term to choose an annotation.
- unknown_get_action_type() : array<string|int, mixed>
- Error message when the provided action_type does not match anything known.
- save_setting() : array<string|int, string>
- Save a setting to the database.
- set_annotation() : array<string|int, string>
- Save the annotation for a term.
- set_audio_position() : array<string|int, string>
- Set audio position.
- set_text_position() : array<string|int, string>
- Set text reading position.
- increment_term_status() : array<string|int, string>
- Change the status of a term by one unit.
- set_term_status() : array<string|int, int|string>
- Set the status of a term.
- update_translation() : array<string|int, string>
- Edit the translation of an existing term.
- add_translation() : array<string|int, int|string>
- Create the translation for a new term.
- unknown_post_action_type() : array<string|int, string>
- Notify of an error on POST method.
- request_handler() : never
- Main handler for any provided request, while answer the result.
- bulk_save_terms() : void
- bulk_do_content() : void
- do_operation() : void
- Do the check text operation.
- display_form() : void
- Display the main form for the check text page.
- writeToFile() : void
- Save the connection to the file connect.inc.php.
- doOperation() : void
- Execute operation.
- displayForm() : void
- Generate a form to edit the connection.
- editConnection() : void
- Display the main form, filled with data from an existing connection file.
- createNewConnection() : void
- Display the main form blank.
- 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.
- dummy_function_1() : array<string|int, mixed>
- check_errors() : void
- dummy_function_2() : void
- do_page() : void
- 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.
- display_new_feed() : void
- edit_feed() : void
- multi_load_feed() : void
- display_main_page() : void
- 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.
- insert_new_word() : array<string|int, int|string>
- Insert a new word to the database
- edit_term() : array{0: string, 1: string}
- Edit an existing term.
- lowercase_term_not_equal() : void
- Use this function if the lowercase version of the word does not correspond.
- change_term_display() : void
- Echoes a JavaScript element, that will edit terms diplay
- edit_word_do_operation() : void
- edit_word_do_form() : void
- do_content() : void
- feed_wizard_insert_uri() : void
- feed_wizard_select_text() : void
- feed_wizard_filter_text() : void
- feed_wizard_edit_options() : void
- translate_sentence() : void
- Translate a single sentence using Google Translate.
- translate_term() : void
- Translate input text using Google Translate.
- translate_text() : void
- Translate input text using Google Translate.
- do_content() : void
- Translate input text using Google Translate.
- 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.
- make_trans() : string
- Make the translations choices for a term.
- get_translations() : array<string|int, string>
- Find the possible translations for a term.
- get_term_translations() : array<string|int, array<string|int, mixed>|int|null|string>
- Gather useful data to edit a term annotation on a specific text.
- edit_term_interaction() : string
- Prepare the HTML content for the interaction with a term
- edit_term_form() : string
- Full form for terms edition in a given text.
- make_form() : array<string|int, string>
- Prepare the form for printed text.
- do_ajax_edit_impr_text() : void
- Do the AJAX modification for editing a printed text.
- 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
- regenGoogleTimeToken() : array<string|int, int>|null
- Generate a new token for Google.
- getGoogleTimeToken() : array<string|int, int>|null
- Get the time token to use for Google, generating a new one if necessary.
- 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.
- get_parameters() : array<string|int, string>
- Return the parameters from the URL.
- unset_settings() : void
- Unset all session settings, and set current text to default.
- save() : void
- Save settings and go to a 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
- do_form_fragment() : void
- do_js() : void
- 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.
- edit_mode_display() : void
- print_mode_display() : void
- do_content() : void
- output_text() : void
- get_wizard_selectoptions() : string
- Returns a dropdown menu of the different languages
- get_server_data_table() : array<string|int, false|float|string>
- Return a lot of different server state variables.
- display_content() : void
- Display the main content for the page.
- 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.
- 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.
- translator_url() : null|string
- display_page() : void
- 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_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
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
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
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.
send_response()
Send JSON response and exit.
send_response([int $status = 200 ][, mixed $data = null ]) : never
Parameters
- $status : int = 200
-
Status code to display
- $data : mixed = null
-
Any data to return
Return values
neverendpoint_exits()
Check if an API endpoint exists.
endpoint_exits(string $method, mixed $requestUri) : string
Parameters
- $method : string
-
Method name (e.g. 'GET' or 'POST')
- $requestUri : mixed
Return values
string —The first matching endpoint
rest_api_version()
Return the API version.
rest_api_version(array<string|int, mixed> $get_req) : array<string|int, string>
Parameters
- $get_req : array<string|int, mixed>
-
GET request, unnused
Tags
Return values
array<string|int, string> —JSON-encoded version
media_files()
List the audio and video files in the media folder.
media_files(array<string|int, mixed> $get_req) : array<string|int, string>
Parameters
- $get_req : array<string|int, mixed>
-
Unnused
Return values
array<string|int, string> —Path of media files
readingConfiguration()
The way text should be read
readingConfiguration(mixed $get_req) : array<string|int, mixed>
Parameters
- $get_req : mixed
Return values
array<string|int, mixed>get_phonetic_reading()
Get the phonetic reading of a word based on it's language.
get_phonetic_reading(array<string|int, mixed> $get_req) : array<string|int, string>
Parameters
- $get_req : array<string|int, mixed>
-
Array with the fields "text" and "lang" (short language name)
Tags
Return values
array<string|int, string> —JSON-encoded result
get_word_test_ajax()
Retun the next word to test as JSON
get_word_test_ajax(string $testsql, bool $word_mode, int $lgid, string $wordregex, int $testtype) : array<string|int, int|mixed|string>
Parameters
- $testsql : string
-
SQL projection query
- $word_mode : bool
-
Test is in word mode
- $lgid : int
-
Language ID
- $wordregex : string
-
Word selection regular expression
- $testtype : int
-
Test type
Tags
Return values
array<string|int, int|mixed|string> —Next word formatted as an array.
word_test_ajax()
Return the next word to test.
word_test_ajax(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Array with the fields { test_key: string, selection: string, word_mode: bool, lg_id: int, word_regex: string, type: int }
Return values
array<string|int, mixed> —Next word formatted as JSON.
tomorrow_test_count()
Return the number of reviews for tomorrow by using the suplied query.
tomorrow_test_count(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Array with the fields "test_key" and "selection"
Tags
Return values
array<string|int, mixed> —JSON-encoded result
get_theme_path()
Get the file path using theme.
get_theme_path(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with field "path", relative filepath using theme.
Tags
Return values
array<string|int, mixed> —JSON-encoded result
get_texts_statistics()
Return statistics about a group of text.
get_texts_statistics(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with field "texts_id", texts ID.
Return values
array<string|int, mixed>sentences_with_registred_term()
Sentences containing an input word.
sentences_with_registred_term(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with fields "lg_id", "word_lc" and "word_id".
Return values
array<string|int, mixed>sentences_with_new_term()
Return the example sentences containing an input word.
sentences_with_new_term(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with fields "lg_id" and "advanced_search" (optional).
Return values
array<string|int, mixed>similar_terms()
Get terms similar to a given term.
similar_terms(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with fields "lg_id" and "term".
Tags
Return values
array<string|int, mixed> —Similar terms in HTML format.
imported_terms()
Return the list of imported terms.
imported_terms(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with fields "last_update", "page" and "count".
Return values
array<string|int, mixed>term_translations()
Translations for a term to choose an annotation.
term_translations(array<string|int, mixed> $get_req) : array<string|int, mixed>
Parameters
- $get_req : array<string|int, mixed>
-
Get request with fields "text_id" and "term_lc".
Return values
array<string|int, mixed>unknown_get_action_type()
Error message when the provided action_type does not match anything known.
unknown_get_action_type(mixed $get_req[, bool $action_exists = false ]) : array<string|int, mixed>
Parameters
- $get_req : mixed
- $action_exists : bool = false
-
Set to true if the action is recognized but not the action_type
Tags
Return values
array<string|int, mixed> —JSON-encoded error message.
save_setting()
Save a setting to the database.
save_setting(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "key" (setting name) and "value"
Tags
Return values
array<string|int, string> —Setting save status
set_annotation()
Save the annotation for a term.
set_annotation(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Post request with keys "text_id", "elem" and "data".
Tags
Return values
array<string|int, string> —JSON-encoded result
set_audio_position()
Set audio position.
set_audio_position(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "text_id" (int) and "position"
Tags
Return values
array<string|int, string> —Success message
set_text_position()
Set text reading position.
set_text_position(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "text_id" (int) and "position"
Tags
Return values
array<string|int, string> —Success message
increment_term_status()
Change the status of a term by one unit.
increment_term_status(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "term_id" (int) and "status_up" (1 or 0)
Tags
Return values
array<string|int, string> —Status message
set_term_status()
Set the status of a term.
set_term_status(array<string|int, mixed> $post_req) : array<string|int, int|string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "term_id" (int) and "status" (0-5|98|99)
Tags
Return values
array<string|int, int|string>update_translation()
Edit the translation of an existing term.
update_translation(array<string|int, mixed> $post_req) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "term_id" (int) and "translation".
Tags
Return values
array<string|int, string> —Term in lower case, or "" if term does not exist
add_translation()
Create the translation for a new term.
add_translation(array<string|int, mixed> $post_req) : array<string|int, int|string>
Parameters
- $post_req : array<string|int, mixed>
-
Array with the fields "term_text", "lg_id" (int) and "translation".
Tags
Return values
array<string|int, int|string> —Error message in case of failure, lowercase term otherwise
unknown_post_action_type()
Notify of an error on POST method.
unknown_post_action_type(array<string|int, mixed> $post_req[, bool $action_exists = false ]) : array<string|int, string>
Parameters
- $post_req : array<string|int, mixed>
-
POST request used
- $action_exists : bool = false
-
Set to true if the action is recognized but not the action_type
Tags
Return values
array<string|int, string> —JSON-encoded error message
request_handler()
Main handler for any provided request, while answer the result.
request_handler(string $method, mixed $requestUri, array<string|int, mixed>|null $post_param) : never
Parameters
- $method : string
-
Method name (e.g. 'GET' or 'POST')
- $requestUri : mixed
- $post_param : array<string|int, mixed>|null
-
Post arguments, usually equal to $_POST
Return values
neverbulk_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
do_operation()
Do the check text operation.
do_operation(string $text, int $lgid) : void
Parameters
- $text : string
-
Text to check.
- $lgid : int
-
Language ID.
display_form()
Display the main form for the check text page.
display_form() : void
Tags
writeToFile()
Save the connection to the file connect.inc.php.
writeToFile(Database_Connection $conn) : void
Parameters
- $conn : Database_Connection
-
Connection object.
doOperation()
Execute operation.
doOperation(string $op) : void
Parameters
- $op : string
-
Operation to execute.
displayForm()
Generate a form to edit the connection.
displayForm(Database_Connection $conn[, string|null $error_message = null ]) : void
Parameters
- $conn : Database_Connection
-
Database connection object
- $error_message : string|null = null
-
Error message to display
editConnection()
Display the main form, filled with data from an existing connection file.
editConnection() : void
createNewConnection()
Display the main form blank.
createNewConnection() : void
get_term()
Return the term corresponding to the ID.
get_term(string $wid) : string
Parameters
- $wid : string
-
ID of the word
Tags
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
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
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
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
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
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
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.
dummy_function_1()
dummy_function_1() : array<string|int, mixed>
Return values
array<string|int, mixed>check_errors()
check_errors(mixed $message) : void
Parameters
- $message : mixed
dummy_function_2()
dummy_function_2(mixed $currentlang, mixed $currentfeed) : void
Parameters
- $currentlang : mixed
- $currentfeed : mixed
do_page()
do_page() : void
get_l2_language_name()
Find the L2 language name.
get_l2_language_name() : string
Tags
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
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
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
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
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
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
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
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
Return values
array<string|int, float|int|null|string>|false|nullget_test_table_settings()
get_test_table_settings() : array<string|int, int>
Tags
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_header()
do_test_table_header() : void
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_table()
do_test_table() : void
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
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
Return values
string —SQL request string
get_test_type()
Give the test type.
get_test_type() : int<1, 5>
Tags
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
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
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
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
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
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
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
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
prepare_test_footer()
Get the data and echoes the footer.
prepare_test_footer(int $notyettested) : void
Parameters
- $notyettested : int
-
Number of words left to be tested.
do_test_footer()
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
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
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
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
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
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
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
do_settings()
Prepare user settings for this text.
do_settings(string|int $textid) : void
Parameters
- $textid : string|int
-
Text ID
Tags
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
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
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
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
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
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
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
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
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
Return values
intwordProcessor()
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
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
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
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
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
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
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
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
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
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.
display_new_feed()
display_new_feed(mixed $currentlang) : void
Parameters
- $currentlang : mixed
edit_feed()
edit_feed(mixed $currentfeed) : void
Parameters
- $currentfeed : mixed
multi_load_feed()
multi_load_feed(mixed $currentlang) : void
Parameters
- $currentlang : mixed
display_main_page()
display_main_page(mixed $currentlang, mixed $currentquery, mixed $currentpage, mixed $currentsort, mixed $wh_query) : void
Parameters
- $currentlang : mixed
- $currentquery : mixed
- $currentpage : mixed
- $currentsort : mixed
- $wh_query : mixed
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
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
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
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
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
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
stringedit_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
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
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
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
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
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
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
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
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
edit_mword_page()
Create the multi-word frame.
edit_mword_page() : void
Tags
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
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
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
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
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
edit_texts_change()
Create the main window to edit an existing text.
edit_texts_change(int $txid) : void
Parameters
- $txid : int
-
Text ID
Tags
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
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
edit_texts_display()
Main display for the edit text functionality.
edit_texts_display(string $message) : void
Parameters
- $message : string
-
Message to display.
Tags
edit_texts_do_page()
Main function for displaying the edit_texts page.
edit_texts_do_page() : void
insert_new_word()
Insert a new word to the database
insert_new_word(string $textlc, string $translation) : array<string|int, int|string>
Parameters
- $textlc : string
-
The word to insert, in lowercase
- $translation : string
-
Translation of this term
Tags
Return values
array<string|int, int|string> —Word id, and then an insertion message
edit_term()
Edit an existing term.
edit_term(string $translation) : array{0: string, 1: string}
Parameters
- $translation : string
-
New translation for this term
Return values
array{0: string, 1: string} —Word id, and then an insertion message
lowercase_term_not_equal()
Use this function if the lowercase version of the word does not correspond.
lowercase_term_not_equal(string $textlc) : void
It will echo an error message.
Parameters
- $textlc : string
-
The lowercase version of the word we want.
change_term_display()
Echoes a JavaScript element, that will edit terms diplay
change_term_display(mixed $wid, mixed $translation, mixed $hex) : void
Parameters
- $wid : mixed
- $translation : mixed
- $hex : mixed
edit_word_do_operation()
edit_word_do_operation(mixed $translation, mixed $fromAnn) : void
Parameters
- $translation : mixed
- $fromAnn : mixed
edit_word_do_form()
edit_word_do_form(mixed $wid, mixed $text_id, mixed $ord, mixed $fromAnn) : void
Parameters
- $wid : mixed
- $text_id : mixed
- $ord : mixed
- $fromAnn : mixed
do_content()
do_content() : void
feed_wizard_insert_uri()
feed_wizard_insert_uri() : void
feed_wizard_select_text()
feed_wizard_select_text() : void
feed_wizard_filter_text()
feed_wizard_filter_text() : void
feed_wizard_edit_options()
feed_wizard_edit_options() : void
translate_sentence()
Translate a single sentence using Google Translate.
translate_sentence(string $text, string $translation) : void
Parameters
- $text : string
-
Text to translate
- $translation : string
-
Sentence translation
translate_term()
Translate input text using Google Translate.
translate_term(string $text, array<string|int, mixed> $file, string $sl, string $tl) : void
Parameters
- $text : string
-
Text to translate
- $file : array<string|int, mixed>
-
Array of translated terms
- $sl : string
-
Source language (e. g. "es")
- $tl : string
-
Target language (e. g. "en")
translate_text()
Translate input text using Google Translate.
translate_text(string $text, string $sl, string $tl, bool $sentence_mode) : void
Parameters
- $text : string
-
Text to translate
- $sl : string
-
Source language (e. g. "es")
- $tl : string
-
Target language (e. g. "en")
- $sentence_mode : bool
-
Set to true for full sentence translation
do_content()
Translate input text using Google Translate.
do_content(string $text) : void
Parameters
- $text : string
-
Text to translate
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
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
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
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
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
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
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
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
make_trans()
Make the translations choices for a term.
make_trans(int $i, int|null $wid, string $trans, string $word, int $lang) : string
Parameters
- $i : int
-
Word unique index in the form
- $wid : int|null
-
Word ID or null
- $trans : string
-
Current translation set for the term, may be empty
- $word : string
-
Term text
- $lang : int
-
Language ID
Return values
string —HTML-formatted string
get_translations()
Find the possible translations for a term.
get_translations(int $word_id) : array<string|int, string>
Parameters
- $word_id : int
-
Term ID
Tags
Return values
array<string|int, string> —Return the possible translations.
get_term_translations()
Gather useful data to edit a term annotation on a specific text.
get_term_translations(string $wordlc, int $textid) : array<string|int, array<string|int, mixed>|int|null|string>
Parameters
- $wordlc : string
-
Term in lower case
- $textid : int
-
Text ID
Tags
Return values
array<string|int, array<string|int, mixed>|int|null|string> —Return the useful data to edit a term annotation on a specific text.
edit_term_interaction()
Prepare the HTML content for the interaction with a term
edit_term_interaction(string $wordlc, int $textid) : string
Parameters
- $wordlc : string
-
Term in lower case
- $textid : int
-
Text ID
Tags
Return values
string —JS string of the different fields of the term
edit_term_form()
Full form for terms edition in a given text.
edit_term_form(int $textid) : string
Parameters
- $textid : int
-
Text ID.
Return values
string —HTML table for all terms
make_form()
Prepare the form for printed text.
make_form(int $textid, string $wordlc) : array<string|int, string>
Parameters
- $textid : int
-
Text ID
- $wordlc : string
-
Lowercase word
Tags
Return values
array<string|int, string> —HTML output and JS output
do_ajax_edit_impr_text()
Do the AJAX modification for editing a printed text.
do_ajax_edit_impr_text(int $textid, string $wordlc) : void
Parameters
- $textid : int
-
Text ID
- $wordlc : string
-
Word lowercase. Can be left empty.
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
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
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
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
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
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
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
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
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
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
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
Return values
stringdo_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
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
Return values
mysqli_result|truerunsql()
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
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
stringconvert_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
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
stringvalidateLang()
Validate a language ID
validateLang(string $currentlang) : string
Parameters
- $currentlang : string
-
Language ID to validate
Tags
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
Return values
stringvalidateTag()
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
Return values
intgetSetting()
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
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
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
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
stringadjust_autoincr()
Adjust the auto-incrementation in the database.
adjust_autoincr(mixed $table, mixed $key) : void
Parameters
- $table : mixed
- $key : mixed
Tags
optimizedb()
Optimize the database.
optimizedb() : void
Tags
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
stringprint_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
Return values
null|string|array<string|int, string>get_links_from_new_feed()
get_links_from_new_feed(mixed $NfSourceURI) : array<string|int, array<string|int, false|null|string>|null|string>|false
Parameters
- $NfSourceURI : mixed
Tags
Return values
array<string|int, array<string|int, false|null|string>|null|string>|falseget_links_from_rss()
get_links_from_rss(mixed $NfSourceURI, mixed $NfArticleSection) : array<string|int, array<string|int, false|null|string>>|false
Parameters
- $NfSourceURI : mixed
- $NfArticleSection : mixed
Tags
Return values
array<string|int, array<string|int, false|null|string>>|falseget_text_from_rsslink()
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
Return values
array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|stringregenGoogleTimeToken()
Generate a new token for Google.
regenGoogleTimeToken() : array<string|int, int>|null
Tags
Return values
array<string|int, int>|nullgetGoogleTimeToken()
Get the time token to use for Google, generating a new one if necessary.
getGoogleTimeToken() : array<string|int, int>|null
Tags
Return values
array<string|int, int>|nullis_mobile()
Return false. Before 2.2.1, return true if we should use mobile mode.
is_mobile() : bool
Tags
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
do_frameset_mobile_css()
Echo the CSS content for mobile frameset page.
do_frameset_mobile_css() : void
Tags
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
get_parameters()
Return the parameters from the URL.
get_parameters() : array<string|int, string>
Tags
Return values
array<string|int, string> —Setting key, setting value and target URL
unset_settings()
Unset all session settings, and set current text to default.
unset_settings() : void
save()
Save settings and go to a page.
save(string $k, string $v) : void
Parameters
- $k : string
-
Setting key
- $v : string
-
Setting value
getPreviousAndNextTextLinks()
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.
echo_lwt_logo()
Return an HTML formatted logo of the application.
echo_lwt_logo() : void
Tags
getprefixes()
Return all different database prefixes that are in use.
getprefixes() : array<string|int, string>
Tags
Return values
array<string|int, string> —A list of prefixes.
media_paths_search()
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
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
stringget_playbackrate_selectoptions()
get_playbackrate_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringremove_soft_hyphens()
remove_soft_hyphens(mixed $str) : string|array<string|int, string>
Parameters
- $str : mixed
Tags
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
Return values
null|string|array<string|int, string>makeCounterWithTotal()
makeCounterWithTotal(mixed $max, mixed $num) : string
Parameters
- $max : mixed
- $num : mixed
Return values
stringencodeURI()
encodeURI(mixed $url) : string
Parameters
- $url : mixed
Return values
stringprint_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_sepas()
get_sepas() : mixed
get_first_sepa()
get_first_sepa() : mixed
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
stringget_sentence_count_selectoptions()
get_sentence_count_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_words_to_do_buttons_selectoptions()
get_words_to_do_buttons_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_regex_selectoptions()
get_regex_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_tooltip_selectoptions()
get_tooltip_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_themes_selectoptions()
get_themes_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringprocessSessParam()
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
stringget_last_key()
Return the last inserted ID in the database
get_last_key() : int
Tags
Return values
intget_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
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
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
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
stringget_languagessize_selectoptions()
get_languagessize_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_wordstatus_radiooptions()
get_wordstatus_radiooptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_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
stringget_annotation_position_selectoptions()
get_annotation_position_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_hts_selectoptions()
get_hts_selectoptions(mixed $current_setting) : string
Parameters
- $current_setting : mixed
Return values
stringget_paging_selectoptions()
get_paging_selectoptions(mixed $currentpage, mixed $pages) : string
Parameters
- $currentpage : mixed
- $pages : mixed
Return values
stringget_wordssort_selectoptions()
get_wordssort_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_tagsort_selectoptions()
get_tagsort_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_textssort_selectoptions()
get_textssort_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_andor_selectoptions()
get_andor_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_set_status_option()
get_set_status_option(mixed $n[, mixed $suffix = "" ]) : string
Parameters
- $n : mixed
- $suffix : mixed = ""
Return values
stringget_status_name()
get_status_name(mixed $n) : string
Parameters
- $n : mixed
Return values
stringget_status_abbr()
get_status_abbr(mixed $n) : string
Parameters
- $n : mixed
Return values
stringget_colored_status_msg()
get_colored_status_msg(mixed $n) : string
Parameters
- $n : mixed
Return values
stringget_multiplewordsactions_selectoptions()
get_multiplewordsactions_selectoptions() : string
Return values
stringget_multipletagsactions_selectoptions()
get_multipletagsactions_selectoptions() : string
Return values
stringget_allwordsactions_selectoptions()
get_allwordsactions_selectoptions() : string
Return values
stringget_alltagsactions_selectoptions()
get_alltagsactions_selectoptions() : string
Return values
stringget_multipletextactions_selectoptions()
get_multipletextactions_selectoptions() : string
Return values
stringget_multiplearchivedtextactions_selectoptions()
get_multiplearchivedtextactions_selectoptions() : string
Return values
stringget_texts_selectoptions()
get_texts_selectoptions(mixed $lang, mixed $v) : string
Parameters
- $lang : mixed
- $v : mixed
Return values
stringmakePager()
Makes HTML content for a text of style "Page 1 of 3".
makePager(mixed $currentpage, mixed $pages, mixed $script, mixed $formname) : void
Parameters
- $currentpage : mixed
- $pages : mixed
- $script : mixed
- $formname : mixed
makeStatusCondition()
makeStatusCondition(mixed $fieldname, mixed $statusrange) : string
Parameters
- $fieldname : mixed
- $statusrange : mixed
Return values
stringcheckStatusRange()
checkStatusRange(mixed $currstatus, mixed $statusrange) : bool
Parameters
- $currstatus : mixed
- $statusrange : mixed
Return values
boolmakeStatusClassFilter()
Adds HTML attributes to create a filter over words learning status.
makeStatusClassFilter(int<0, 5>|98|99|599 $status) : string
Parameters
- $status : int<0, 5>|98|99|599
-
Word learning status 599 is a special status combining 5 and 99 statuses. 0 return an empty string
Return values
string —CSS class filter to exclude $status
makeStatusClassFilterHelper()
Replace $status in $array by -1
makeStatusClassFilterHelper(int $status, array<string|int, int> &$array) : void
Parameters
- $status : int
-
A value in $array
- $array : array<string|int, int>
-
Any array of values
createTheDictLink()
Create and verify a dictionary URL link
createTheDictLink(string $u, string $t) : string
Case 1: url without any ### or lwt_term: append UTF-8-term Case 2: url with one ### or lwt_term: substitute UTF-8-term Case 3: url with two (###|lwt_term)enc###: unsupported encoding changed, abandonned since 2.6.0-fork
Parameters
- $u : string
-
Dictionary URL. It may contain 'lwt_term' that will get parsed
- $t : string
-
Text that substite the 'lwt_term'
Tags
Return values
string —Dictionary link formatted
createDictLinksInEditWin()
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin(int $lang, string $word, string $sentctljs, bool $openfirst) : string
Parameters
- $lang : int
-
Language ID
- $word : string
- $sentctljs : string
- $openfirst : bool
-
True if we should open right frames with translation first
Tags
Return values
string —HTML-formatted interface
makeOpenDictStr()
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStr(string $url, string $txt) : string
Parameters
- $url : string
-
An URL, starting with a "*" is deprecated.
- If it contains a "popup" query, open in new window
- Otherwise open in iframe
- $txt : string
-
Clickable text to display
Return values
string —HTML-formatted string
makeOpenDictStrJS()
makeOpenDictStrJS(mixed $url) : string
Parameters
- $url : mixed
Return values
stringmakeOpenDictStrDynSent()
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStrDynSent(string $url, string $sentctljs, string $txt) : string
Parameters
- $url : string
-
A string containing at least a URL
- If it contains the query "lwt_popup", open in Popup
- Starts with a '*': open in pop-up window (deprecated)
- Otherwise open in iframe
- $sentctljs : string
-
Clickable text to display
- $txt : string
-
Clickable text to display
Tags
Return values
string —HTML-formatted string
createDictLinksInEditWin2()
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin2(int $lang, string $sentctljs, string $wordctljs) : string
Parameters
- $lang : int
-
Language ID
- $sentctljs : string
- $wordctljs : string
Tags
Return values
string —HTML formatted interface
makeDictLinks()
makeDictLinks(mixed $lang, mixed $wordctljs) : string
Parameters
- $lang : mixed
- $wordctljs : mixed
Return values
stringcreateDictLinksInEditWin3()
createDictLinksInEditWin3(mixed $lang, mixed $sentctljs, mixed $wordctljs) : string
Parameters
- $lang : mixed
- $sentctljs : mixed
- $wordctljs : mixed
Return values
stringcheckTest()
Return checked attribute if $val is in array $_REQUEST[$name]
checkTest(mixed $val, string $name) : string
Parameters
- $val : mixed
-
Value to look for, needle
- $name : string
-
Key of request haystack.
Tags
Return values
string —' ' of ' checked="checked" ' if the qttribute should be checked.
strToHex()
strToHex(mixed $string) : string
Parameters
- $string : mixed
Return values
stringstrToClassName()
Escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165)
strToClassName(string $string) : string
Parameters
- $string : string
-
String to escape
Return values
stringanki_export()
anki_export(mixed $sql) : never
Parameters
- $sql : mixed
Return values
nevertsv_export()
tsv_export(mixed $sql) : never
Parameters
- $sql : mixed
Return values
neverflexible_export()
flexible_export(mixed $sql) : never
Parameters
- $sql : mixed
Return values
nevermask_term_in_sentence_v2()
mask_term_in_sentence_v2(mixed $s) : string
Parameters
- $s : mixed
Return values
stringrepl_tab_nl()
Replace all white space characters by a simple space ' '.
repl_tab_nl(string $s) : string
The output string is also trimmed.
Parameters
- $s : string
-
String to parse
Return values
string —String with only simple whitespaces.
mask_term_in_sentence()
mask_term_in_sentence(mixed $s, mixed $regexword) : string
Parameters
- $s : mixed
- $regexword : mixed
Return values
stringreturn_textwordcount()
Return statistics about a list of text ID.
return_textwordcount(string $texts_id) : array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>>
It is useful for unknown percent with this fork.
The echo is an output array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int} Total number of words, number of expression, statistics, total unique, number of unique expressions, unique statistics
Parameters
- $texts_id : string
-
Texts ID separated by comma
Tags
Return values
array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>> —Statistics under the form of an array
textwordcount()
Compute and echo word statistics about a list of text ID.
textwordcount(string $textID) : void
It is useful for unknown percent with this fork.
The echo is an output array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int} Total number of words, number of expression, statistics, total unique, number of unique expressions, unique statistics
Parameters
- $textID : string
-
Text IDs separated by comma
Tags
todo_words_count()
Return the number of words left to do in this text.
todo_words_count(int $textid) : int
Parameters
- $textid : int
-
Text ID
Tags
Return values
int —Number of words
todo_words_content()
Prepare HTML interactions for the words left to do in this text.
todo_words_content(int $textid) : string
Parameters
- $textid : int
-
Text ID
Tags
Return values
string —HTML result
texttodocount2()
Prepare HTML interactions for the words left to do in this text.
texttodocount2(string|int $textid) : string
Parameters
- $textid : string|int
-
Text ID
Tags
Return values
string —HTML result
sentences_containing_word_lc_query()
Return a SQL string to find sentences containing a word.
sentences_containing_word_lc_query(string $wordlc, int $lid) : string
Parameters
- $wordlc : string
-
Word to look for in lowercase
- $lid : int
-
Language ID
Return values
string —Query in SQL format
sentences_from_word()
Perform a SQL query to find sentences containing a word.
sentences_from_word(int|null $wid, string $wordlc, int $lid[, int $limit = -1 ]) : mysqli_result|true
Parameters
- $wid : int|null
-
Word ID or mode
- null: use $wordlc instead, simple search
- -1: use $wordlc with a more complex search
- 0 or above: sentences containing $wid
- $wordlc : string
-
Word to look for in lowercase
- $lid : int
-
Language ID
- $limit : int = -1
-
Maximum number of sentences to return
Return values
mysqli_result|true —Query
getSentence()
Format the sentence(s) $seid containing $wordlc highlighting $wordlc.
getSentence(int $seid, string $wordlc, int $mode) : array<string|int, string>
Parameters
- $seid : int
-
Sentence ID
- $wordlc : string
-
Term text in lower case
- $mode : int
-
- Up to 1: return only the current sentence
- Above 1: return previous sentence and current sentence
- Above 2: return previous, current and next sentence
Tags
Return values
array<string|int, string> —[0]=html, word in bold, [1]=text, word in }
sentences_with_word()
Return sentences containing a word.
sentences_with_word(int $lang, string $wordlc, int|null $wid[, int|null $mode = 0 ][, int $limit = 20 ]) : array<string|int, array<string|int, string>>
Parameters
- $lang : int
-
Language ID
- $wordlc : string
-
Word to look for in lowercase
- $wid : int|null
-
Word ID
- null: use $wordlc instead, simple search
- -1: use $wordlc with a more complex search
- 0 or above: find sentences containing $wid
- $mode : int|null = 0
-
Sentences to get:
- Up to 1 is 1 sentence,
- 2 is previous and current sentence,
- 3 is previous, current and next one
- $limit : int = 20
-
Maximum number of sentences to return
Tags
Return values
array<string|int, array<string|int, string>> —Array of sentences found
example_sentences_area()
Prepare the area to for examples sentences of a word.
example_sentences_area(mixed $lang, mixed $termlc, mixed $selector, mixed $wid) : void
Parameters
- $lang : mixed
- $termlc : mixed
- $selector : mixed
- $wid : mixed
get20Sentences()
Show 20 sentences containg $wordlc.
get20Sentences(int $lang, string $wordlc, int|null $wid, string $jsctlname, int $mode) : string
Parameters
- $lang : int
-
Language ID
- $wordlc : string
-
Term in lower case.
- $wid : int|null
-
Word ID
- $jsctlname : string
-
Path for the textarea of the sentence of the word being edited.
- $mode : int
-
- Up to 1: return only the current sentence
- Above 1: return previous and current sentence
- Above 2: return previous, current and next sentence
Tags
Return values
string —HTML-formatted string of which elements are candidate sentences to use.
get_languages()
Return a dictionary of languages name - id
get_languages() : array<string, int>
Return values
array<string, int>getLanguage()
Get language name from its ID
getLanguage(string|int $lid) : string
Parameters
- $lid : string|int
-
Language ID
Tags
Return values
string —Language name
getLanguageCode()
Try to get language code from its ID
getLanguageCode(int $lg_id, array<string|int, mixed> $languages_table) : string
Parameters
- $lg_id : int
-
Language ID
- $languages_table : array<string|int, mixed>
-
Table of languages, usually LWT_LANGUAGES_ARRAY
Tags
Return values
string —If found, two-letter code (e. g. BCP 47) or four-letters for the langugae. '' otherwise.
getScriptDirectionTag()
Return a right-to-left direction indication in HTML if language is right-to-left.
getScriptDirectionTag(string|int|null $lid) : string
Parameters
- $lid : string|int|null
-
Language ID
Return values
string —' dir="rtl" '|''
findMecabExpression()
Find all occurences of an expression using MeCab.
findMecabExpression(string $text, string|int $lid) : array<string|int, array<string|int, int|string>>
Parameters
- $text : string
-
Text to insert
- $lid : string|int
-
Language ID
Tags
Return values
array<string|int, array<string|int, int|string>> —Each found multi-word details
insert_expression_from_mecab()
Insert an expression to the database using MeCab.
insert_expression_from_mecab(string $text, string|int $lid, string|int $wid, int $len) : array<string|int, array<string|int, string>>
Parameters
- $text : string
-
Text to insert
- $lid : string|int
-
Language ID
- $wid : string|int
-
Word ID
- $len : int
-
Number of words in the expression
Tags
Return values
array<string|int, array<string|int, string>> —Append text and values to insert to the database
insertExpressionFromMeCab()
Insert an expression to the database using MeCab.
insertExpressionFromMeCab(string $textlc, string $lid, string $wid, int $len, int $mode) : array{: string[], : string[]}
Parameters
- $textlc : string
-
Text to insert in lower case
- $lid : string
-
Language ID
- $wid : string
-
Word ID
- $len : int
-
Number of words in the expression
- $mode : int
-
If equal to 0, add data in the output
Tags
Return values
array{: string[], : string[]} —Append text and SQL array.
findStandardExpression()
Find all occurences of an expression, do not use parsers like MeCab.
findStandardExpression(string $textlc, string|int $lid) : array<string|int, array<string|int, int|null|string>>
Parameters
- $textlc : string
-
Text to insert in lower case
- $lid : string|int
-
Language ID
Tags
Return values
array<string|int, array<string|int, int|null|string>> —Each inserted mutli-word details
insert_standard_expression()
Insert an expression without using a tool like MeCab.
insert_standard_expression(string $textlc, string|int $lid, string|int $wid, int $len, mixed $mode) : array<string|int, array<string|int, null|string>>
Parameters
- $textlc : string
-
Text to insert in lower case
- $lid : string|int
-
Language ID
- $wid : string|int
-
Word ID
- $len : int
-
Number of words in the expression
- $mode : mixed
-
Unnused
Tags
Return values
array<string|int, array<string|int, null|string>> —Append text, empty and sentence id
new_expression_interactable()
Prepare a JavaScript dialog to insert a new expression. Use elements in global JavaScript scope.
new_expression_interactable(mixed $hex, mixed $appendtext, mixed $sid, mixed $len) : void
Parameters
- $hex : mixed
- $appendtext : mixed
- $sid : mixed
- $len : mixed
Tags
new_expression_interactable2()
Prepare a JavaScript dialog to insert a new expression.
new_expression_interactable2(string $hex, array<string|int, string> $appendtext, int $wid, int $len) : void
Parameters
- $hex : string
-
Lowercase text, formatted version of the text.
- $appendtext : array<string|int, string>
-
Text to append
- $wid : int
-
Term ID
- $len : int
-
Words count.
Tags
newMultiWordInteractable()
Prepare a JavaScript dialog to insert a new expression.
newMultiWordInteractable(string $hex, array<string|int, array<string|int, string>> $multiwords, int $wid, int $len) : void
Parameters
- $hex : string
-
Lowercase text, formatted version of the text.
- $multiwords : array<string|int, array<string|int, string>>
-
Multi-words to happen, format [textid][position][text]
- $wid : int
-
Term ID
- $len : int
-
Words count.
Tags
insertExpressions()
Alter the database to add a new word
insertExpressions(string $textlc, string|int $lid, mixed $wid, int $len, int $mode) : null|string
Parameters
- $textlc : string
-
Text in lower case
- $lid : string|int
-
Language ID
- $wid : mixed
- $len : int
-
Number of words in the expression
- $mode : int
-
Function mode
- 0: Default mode, do nothing special
- 1: Runs an expresion inserter interactable
- 2: Return the sql output
Tags
Return values
null|string —If $mode == 2 return values to insert in textitems2, nothing otherwise.
restore_file()
Restore the database from a file.
restore_file(resource $handle, string $title) : string
Parameters
- $handle : resource
-
Backup file handle
- $title : string
-
File title
Tags
Return values
string —Human-readable status message
recreate_save_ann()
Uses provided annotations, and annotations from database to update annotations.
recreate_save_ann(int $textid, string $oldann) : string
Parameters
- $textid : int
-
Id of the text on which to update annotations
- $oldann : string
-
Old annotations
Return values
string —Updated annotations for this text.
create_ann()
Create new annotations for a text.
create_ann(int $textid) : string
Parameters
- $textid : int
-
Id of the text to create annotations for
Tags
Return values
string —Annotations for the text
create_save_ann()
create_save_ann(mixed $textid) : string
Parameters
- $textid : mixed
Return values
stringtruncateUserDatabase()
Truncate the database, remove all data belonging by the current user.
truncateUserDatabase() : void
Keep settings.
Tags
process_term()
process_term(mixed $nonterm, mixed $term, mixed $trans, mixed $wordid, mixed $line) : string
Parameters
- $nonterm : mixed
- $term : mixed
- $trans : mixed
- $wordid : mixed
- $line : mixed
Return values
stringget_first_translation()
get_first_translation(mixed $trans) : string
Parameters
- $trans : mixed
Return values
stringget_annotation_link()
get_annotation_link(mixed $textid) : string
Parameters
- $textid : mixed
Return values
stringtrim_value()
Like trim, but in place (modify variable)
trim_value(string &$value) : void
Parameters
- $value : string
-
Value to be trimmed
phoneticReading()
Parses text be read by an automatic audio player.
phoneticReading(string $text, string $lgid) : string
Some non-phonetic alphabet will need this, currently only Japanese is supported, using MeCab.
Parameters
- $text : string
-
Text to be converted
- $lgid : string
-
Language ID
Return values
string —Parsed text in a phonetic format.
phonetic_reading()
Parses text be read by an automatic audio player.
phonetic_reading(string $text, string $lang) : string
Some non-phonetic alphabet will need this, currently only Japanese is supported, using MeCab.
Parameters
- $text : string
-
Text to be converted
- $lang : string
-
Language code (usually BCP 47 or ISO 639-1)
Tags
Return values
string —Parsed text in a phonetic format.
refreshText()
Refresh a text.
refreshText(mixed $word, mixed $tid) : string
Parameters
- $word : mixed
- $tid : mixed
Tags
Return values
stringmakeMediaPlayer()
Create an HTML media player, audio or video.
makeMediaPlayer(string $path[, int $offset = 0 ]) : void
Parameters
- $path : string
-
URL or local file path
- $offset : int = 0
-
Offset from the beginning of the video
makeVideoPlayer()
Create an embed video player
makeVideoPlayer(string $path[, int $offset = 0 ]) : void
Parameters
- $path : string
-
URL or local file path
- $offset : int = 0
-
Offset from the beginning of the video
makeAudioPlayer()
Create an HTML audio player.
makeAudioPlayer(string $audio[, int $offset = 0 ]) : void
Parameters
- $audio : string
-
Audio URL
- $offset : int = 0
-
Offset from the beginning of the video
framesetheader()
Echo a HEAD tag for using with frames
framesetheader(string $title) : void
Parameters
- $title : string
-
Title to use
pagestart()
Write a page header and start writing its body.
pagestart(string $title, bool $close) : void
Parameters
- $title : string
-
Title of the page
- $close : bool
-
Set to true if you are closing the header
Tags
pagestart_nobody()
Start a standard page with a complete header and a non-closed body.
pagestart_nobody(string $title[, string $addcss = '' ]) : void
Parameters
- $title : string
-
Title of the page
- $addcss : string = ''
-
Some CSS to be embed in a style tag
Tags
letterPairs()
letterPairs(mixed $str) : array<string|int, string>
Parameters
- $str : mixed
Tags
Return values
array<string|int, string>wordLetterPairs()
wordLetterPairs(mixed $str) : array<string|int, string>
Parameters
- $str : mixed
Tags
Return values
array<string|int, string>getSimilarityRanking()
Similarity ranking of two UTF-8 strings $str1 and $str2
getSimilarityRanking(mixed $str1, mixed $str2) : float
Source http://www.catalysoft.com/articles/StrikeAMatch.html Source http://stackoverflow.com/questions/653157
Parameters
- $str1 : mixed
- $str2 : mixed
Return values
float —SimilarityRanking
get_similar_terms()
For a language $lang_id and a term $compared_term (UTF-8).
get_similar_terms(int $lang_id, string $compared_term, int $max_count, float $min_ranking) : array<string|int, int>
If string is already in database, it will be excluded in results.
Parameters
- $lang_id : int
-
Language ID
- $compared_term : string
-
Term to compare with
- $max_count : int
-
Maximum number of terms to display
- $min_ranking : float
-
For terms to match
Tags
Return values
array<string|int, int> —All $max_count wordids with a similarity ranking > $min_ranking, sorted decending
format_term()
Prepare a field with a similar term to copy.
format_term(int $termid, string $compare) : string
Parameters
- $termid : int
-
Initial term ID
- $compare : string
-
Similar term to copy.
Tags
Return values
string —HTNL-formatted string with the similar term displayed.
print_similar_terms()
Get Term and translation of terms in termid array (calculated in function get_similar_terms(...)) as string for echo
print_similar_terms(int $lang_id, string $compared_term) : string
Parameters
- $lang_id : int
-
Language ID
- $compared_term : string
-
Similar term we compare to
Return values
stringprint_similar_terms_tabrow()
Print a row for similar terms if the feature is enabled.
print_similar_terms_tabrow() : void
set_error_reporting()
Starts or not the error reporting.
set_error_reporting(int $dsplerrors) : void
Parameters
- $dsplerrors : int
-
not 0: start error reporting for ALL errors 0: don't report
set_configuration_options()
Set configuration values as script limit time and such.
set_configuration_options() : void
..
start_session()
Start the session and checks for its sanity.
start_session() : void
start_session_main()
Launch a new session for WordPress.
start_session_main() : void
get_tags()
Return the list of all tags.
get_tags([int $refresh = 0 ]) : array<string|int, string>
Parameters
- $refresh : int = 0
-
If true, refresh all tags for session
Tags
Return values
array<string|int, string> —All tags
get_texttags()
Return the list of all text tags.
get_texttags([int $refresh = 0 ]) : array<string|int, string>
Parameters
- $refresh : int = 0
-
If true, refresh all text tags for session
Tags
Return values
array<string|int, string> —All text tags
getTextTitle()
getTextTitle(mixed $textid) : string
Parameters
- $textid : mixed
Return values
stringget_tag_selectoptions()
get_tag_selectoptions(mixed $v, mixed $l) : string
Parameters
- $v : mixed
- $l : mixed
Return values
stringget_texttag_selectoptions()
get_texttag_selectoptions(mixed $v, mixed $l) : string
Parameters
- $v : mixed
- $l : mixed
Return values
stringget_txtag_selectoptions()
get_txtag_selectoptions(mixed $l, mixed $v) : string
Parameters
- $l : mixed
- $v : mixed
Return values
stringget_archivedtexttag_selectoptions()
get_archivedtexttag_selectoptions(mixed $v, mixed $l) : string
Parameters
- $v : mixed
- $l : mixed
Return values
stringsaveWordTags()
Save the tags for words.
saveWordTags(mixed $wid) : void
Parameters
- $wid : mixed
saveTextTags()
Save the tags for texts.
saveTextTags(mixed $tid) : void
Parameters
- $tid : mixed
Tags
saveArchivedTextTags()
Save the tags for archived texts.
saveArchivedTextTags(mixed $tid) : void
Parameters
- $tid : mixed
Tags
getWordTags()
getWordTags(mixed $wid) : string
Parameters
- $wid : mixed
Return values
stringgetTextTags()
Return a HTML-formatted list of the text tags.
getTextTags(int $tid) : string
Parameters
- $tid : int
-
Text ID. Can be below 1 to create an empty list.
Tags
Return values
string —UL list of text tags
getArchivedTextTags()
Return a HTML-formatted list of the text tags for an archived text.
getArchivedTextTags(int $tid) : string
Parameters
- $tid : int
-
Text ID. Can be below 1 to create an empty list.
Tags
Return values
string —UL list of text tags
addtaglist()
addtaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringaddarchtexttaglist()
addarchtexttaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringaddtexttaglist()
addtexttaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringremovetaglist()
removetaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringremovearchtexttaglist()
removearchtexttaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringremovetexttaglist()
removetexttaglist(mixed $item, mixed $list) : string
Parameters
- $item : mixed
- $list : mixed
Return values
stringdo_form_fragment()
do_form_fragment() : void
do_js()
do_js() : void
no_connectinc_error_page()
Echo an error page if connect.inc.php was not found.
no_connectinc_error_page() : void
Tags
get_span_groups()
Prepare the different SPAN opening tags
get_span_groups() : array<string|int, string>
Tags
Return values
array<string|int, string> —3 different span levels
do_current_text_info()
Display the current text options.
do_current_text_info(mixed $textid) : void
Parameters
- $textid : mixed
Tags
do_language_selectable()
Echo a select element to switch between languages.
do_language_selectable(mixed $langid) : void
Parameters
- $langid : mixed
wordpress_logout_link()
When on a WordPress server, make a logout button
wordpress_logout_link() : void
get_server_data()
Return a lot of different server state variables.
get_server_data() : array<string|int, false|float|string|array<string|int, string>>
Tags
Return values
array<string|int, false|float|string|array<string|int, string>> —{0: string, 1: float, 2: string[], 3: string, 4: string, 5: string} Table prefix, database size, server software, apache version, PHP version, MySQL version
index_load_warnings()
Load the content of warnings for visual display.
index_load_warnings() : void
index_do_main_page()
Display the main body of the page.
index_do_main_page() : void
Tags
get_word()
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
Parameters
- $textid : string
-
ID of the text
- $textpos : string
-
Position of the word in the text.
Tags
Return values
string —A word
insert_word_ignore_to_database()
Edit the database to add the word.
insert_word_ignore_to_database(mixed $textid, string $word) : int
Parameters
- $textid : mixed
- $word : string
-
Word to add
Tags
Return values
int —Word ID
do_javascript_action()
Make the ignored word as no longer marked.
do_javascript_action(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
- $word : string
-
New ignored word
- $wid : string|int
-
New ignored word ID
- $hex : string
-
Hexadecimal version of the lowercase word.
- $textid : string|int
-
ID of the text.
Tags
show_page_insert_word_ignore()
Echoes a complete HTML page, with JavaScript content.
show_page_insert_word_ignore(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
- $word : string
-
New well-known word
- $wid : string|int
-
New well-known word ID
- $hex : string
-
Hexadecimal version of the lowercase word.
- $textid : string|int
-
ID of the text.
do_insert_word_ignore()
Main function to insert a new word with display and JS action.
do_insert_word_ignore(string $textid, string $textpos) : void
Parameters
- $textid : string
-
ID of the text
- $textpos : string
-
Position of the word in the text.
Tags
get_word()
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
Parameters
- $textid : string
-
ID of the text
- $textpos : string
-
Position of the word in the text.
Tags
Return values
string —A word
insert_word_wellknown_to_database()
Edit the database to add the word.
insert_word_wellknown_to_database(mixed $textid, string $word) : int
Parameters
- $textid : mixed
- $word : string
-
Word to add
Tags
Return values
int —Word ID
insert_word_wellknown_javascript()
Make the well-known word as no longer marked.
insert_word_wellknown_javascript(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
- $word : string
-
New well-known word
- $wid : string|int
-
New well-known word ID
- $hex : string
-
Hexadecimal version of the lowercase word.
- $textid : string|int
-
ID of the text.
Tags
show_page_insert_word_wellknown()
Echoes a complete HTML page, with JavaScript content.
show_page_insert_word_wellknown(string $word, string|int $wid, string $hex, string|int $textid) : void
Parameters
- $word : string
-
New well-known word
- $wid : string|int
-
New well-known word ID
- $hex : string
-
Hexadecimal version of the lowercase word.
- $textid : string|int
-
ID of the text.
do_insert_word_wellknown()
Main function to insert a new word with display and JS action.
do_insert_word_wellknown(string $textid, string $textpos) : void
Parameters
- $textid : string
-
ID of the text
- $textpos : string
-
Position of the word in the text.
Tags
restore_demo_db()
Restore demo database from file.
restore_demo_db() : string
Return values
string —Status message
long_text_check()
Display the check page before a long text import.
long_text_check(int $max_input_vars) : void
Parameters
- $max_input_vars : int
-
Maximale bytes size for the text.
long_text_save()
Save a long text to the database.
long_text_save() : void
Tags
long_text_display()
Display the main page for a long tex import.
long_text_display(int $max_input_vars) : void
Parameters
- $max_input_vars : int
-
Maximal number of bytes for the text.
Tags
long_text_do_page()
Do the main page for the long text import.
long_text_do_page() : void
edit_mode_display()
edit_mode_display(mixed $textid, mixed $ann_exists) : void
Parameters
- $textid : mixed
- $ann_exists : mixed
print_mode_display()
print_mode_display(mixed $textid, mixed $langid, mixed $audio, mixed $ann, mixed $title) : void
Parameters
- $textid : mixed
- $langid : mixed
- $audio : mixed
- $ann : mixed
- $title : mixed
do_content()
do_content() : void
output_text()
output_text(mixed $saveterm, mixed $saverom, mixed $savetrans, mixed $savetags, mixed $show_rom, mixed $show_trans, mixed $show_tags, mixed $annplcmnt) : void
Parameters
- $saveterm : mixed
- $saverom : mixed
- $savetrans : mixed
- $savetags : mixed
- $show_rom : mixed
- $show_trans : mixed
- $show_tags : mixed
- $annplcmnt : mixed
get_wizard_selectoptions()
Returns a dropdown menu of the different languages
get_wizard_selectoptions(mixed $v) : string
Parameters
- $v : mixed
Return values
stringget_server_data_table()
Return a lot of different server state variables.
get_server_data_table() : array<string|int, false|float|string>
Tags
Return values
array<string|int, false|float|string> —{"db_prefix": string, "db_size": float, "server_soft": string[], "apache": string, "php": string, "mysql": string} Table prefix, database size, server software, apache version, PHP version, MySQL version
display_content()
Display the main content for the page.
display_content() : void
do_set_test_status_html()
Echo the page HTML content when setting word status.
do_set_test_status_html(int $status, int $oldstatus, int $newscore, int $oldscore) : void
Parameters
- $status : int
-
New learning status for the word
- $oldstatus : int
-
Previous learning status
- $newscore : int
-
New score for the word
- $oldscore : int
-
Previous score
set_test_status_change_progress()
Increment the session progress in learning new words.
set_test_status_change_progress(int $stchange) : array<string|int, int>
Parameters
- $stchange : int
-
-1, 0, or 1 if status is rising or not
Tags
Return values
array<string|int, int> —Tests data
do_set_test_status_javascript()
Make the JavaScript action for setting a word status.
do_set_test_status_javascript(int $wid, int $status, int $stchange[, mixed $tests_status = array() ][, mixed $ajax = false ]) : void
Parameters
- $wid : int
-
Word ID
- $status : int
-
New learning status for the word
- $stchange : int
-
-1, 0, or 1 if status is rising or not
- $tests_status : mixed = array()
- $ajax : mixed = false
do_set_test_status_content()
Make the page content of the word status page.
do_set_test_status_content(int $wid, int $status, int $oldstatus, int $stchange[, mixed $ajax = false ]) : void
Parameters
- $wid : int
-
Word ID
- $status : int
-
New learning status for the word
- $oldstatus : int
-
Previous learning status
- $stchange : int
-
-1, 0, or 1 if status is rising or not
- $ajax : mixed = false
Tags
start_set_text_status()
Start the word status set page.
start_set_text_status() : void
Tags
text_mode_save_settings()
Save text mode settings.
text_mode_save_settings(int $showAll, int $showLearning) : int
Parameters
- $showAll : int
-
Whether all word should be shown
- $showLearning : int
-
Whether to show translation of learning words
Tags
Return values
int —If show learning were previously true (1) or false (0)
text_annotations_mode_javascript()
Do the JavaScript action to change the display of translations.
text_annotations_mode_javascript(int $showLearning, int $oldShowLearning) : void
Parameters
- $showLearning : int
-
Whether to show translation of learning words
- $oldShowLearning : int
-
If show learning was previously true (1) or false (0)
text_mode_page_content()
Do the main page content when chaning display of translations.
text_mode_page_content(int $showAll, int $showLearning, int $oldShowLearning) : void
Parameters
- $showAll : int
-
Whether all word should be shown
- $showLearning : int
-
Whether to show translation of learning words
- $oldShowLearning : int
-
If show learning was previously true (1) or false (0)
change_text_mode()
Complete workflow for changing text mode.
change_text_mode(int $textid, int $showAll, int $showLearning) : void
It edits the settings in the database, show the success message and do JavaScript action to change its display.
Parameters
- $textid : int
-
ID of the current text
- $showAll : int
-
Whether all word should be shown
- $showLearning : int
-
Whether to show translation of learning words
get_word_data()
Get various data for the word corresponding to the ID.
get_word_data(string $wid) : array{0: string, 1: string, 2: string}
Parameters
- $wid : string
-
ID of the word
Tags
Return values
array{0: string, 1: string, 2: string} —The word in plain text, his translation and his romanization
set_word_status_ajax()
Sent an AJAX request to change a word satus.
set_word_status_ajax(string $wid, string $status) : void
Parameters
- $wid : string
-
ID of the word status to change
- $status : string
-
New status to set
set_word_status_database()
Edit the term status in the database.
set_word_status_database(string $wid, string $status) : string
Parameters
- $wid : string
-
ID of the word to update
- $status : string
-
New status to set
Tags
Return values
string —Some edit message, number of affected rows or error message
set_word_status_javascript()
Do the JavaScript action for changing display of the word.
set_word_status_javascript(string $tid, string $wid, string $status, string $word, string $trans, string $roman) : void
Parameters
- $tid : string
-
Text ID
- $wid : string
-
ID of the word that changed status, unnused
- $status : string
-
New status, unnused
- $word : string
-
Word in plain text
- $trans : string
-
Translation of the word
- $roman : string
-
Romanization of the word
set_word_status_display_page()
Echo the HTML content of the page.
set_word_status_display_page(string $tid, string $wid, string $status, string $word, string $trans, string $roman) : void
Parameters
- $tid : string
-
Text ID
- $wid : string
-
ID of the word that changed status
- $status : string
-
New status
- $word : string
-
Word in plain text
- $trans : string
-
Translation of the word
- $roman : string
-
Romanization of the word
do_set_word_status()
Complete workflow for updating a word.
do_set_word_status(string $textid, string $wordid, string $status) : void
It edits the database, show the success message and do JavaScript action to change its display.
Parameters
- $textid : string
-
ID of the affected text
- $wordid : string
-
ID of the word to update
- $status : string
-
New status for this word
Tags
start_save_prefix()
Save a database prefix.
start_save_prefix(string $pref) : void
Parameters
- $pref : string
-
Database prefix to save.
start_do_page()
Do a short page to edit the database prefix.
start_do_page() : void
Tags
user_logging()
user_logging() : mixed
get_language_code()
Two-letter language code from from language name (e. g. : "English" = > "en" ).
get_language_code(string $language) : string
Parameters
- $language : string
-
Language name, for instance "English"
Tags
Return values
string —Two-letter language name
language_id_from_code()
Return the language ID from a two-letter language code or a BCP 47 tag.
language_id_from_code(string $code) : int
If two languages have the same country name, only thte first one will be returned.
Parameters
- $code : string
-
Two letters, or four letters separated with caret ("fr" or "en-US").
Return values
int —Language ID if found, -1 otherwise.
tts_language_options()
String to population a SELECT tag.
tts_language_options() : string
Return values
string —HTML-formatted string.
tts_settings_form()
Prepare a from for all the TTS settings.
tts_settings_form() : void
tts_demo()
Prepare a demo for TTS.
tts_demo() : void
tts_js()
Prepare the JavaScript content for text-to-speech.
tts_js() : void
tts_settings_minimal_page()
Make only a partial, embedable page for text-to-speech settings.
tts_settings_minimal_page() : void
tts_settings_full_page()
Make the complete HTML page for text-to-speech settings.
tts_settings_full_page(string $message) : void
Parameters
- $message : string
-
A message to display when page loads.
tts_save_settings()
Save the text-to-speech settings as cookies.
tts_save_settings(array<string|int, mixed> $form) : void
Parameters
- $form : array<string|int, mixed>
-
Inputs from the main form.
translator_url()
translator_url(mixed $term, mixed $order) : null|string
Parameters
- $term : mixed
- $order : mixed
Return values
null|stringdisplay_page()
display_page(mixed $type, mixed $term, mixed $order) : void
Parameters
- $type : mixed
- $term : mixed
- $order : mixed
my_str_getcsv()
Get the CSV from a string.
my_str_getcsv(string $input) : array<string|int, null|string>|false|null
Parameters
- $input : string
-
Input string.
Tags
Return values
array<string|int, null|string>|false|nullupload_words_import_simple()
upload_words_import_simple(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status) : void
Parameters
- $lang : mixed
- $fields : mixed
- $columns : mixed
- $tabs : mixed
- $file_name : mixed
- $status : mixed
upload_words_import_complete()
upload_words_import_complete(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status, mixed $overwrite) : void
Parameters
- $lang : mixed
- $fields : mixed
- $columns : mixed
- $tabs : mixed
- $file_name : mixed
- $status : mixed
- $overwrite : mixed
upload_words_handle_multiwords()
upload_words_handle_multiwords(mixed $lang, mixed $last_update) : void
Parameters
- $lang : mixed
- $last_update : mixed
upload_words_import_terms()
Import terms to the database.
upload_words_import_terms(array<string|int, mixed> $fields, string $tabs, bool $file_upl, array<int, string> $col, int $lang) : string
Parameters
- $fields : array<string|int, mixed>
-
Fields indexes
- $tabs : string
-
Columns separator
- $file_upl : bool
-
If the input text is an uploaded file
- $col : array<int, string>
-
Columns names
- $lang : int
-
Language ID
Tags
Return values
string —Last word update timestamp
display_imported_terms()
display_imported_terms(mixed $last_update, mixed $rtl) : void
Parameters
- $last_update : mixed
- $rtl : mixed
upload_words_import_tags()
Import term tags only to the database.
upload_words_import_tags(array<string|int, mixed> $fields, string $tabs, bool $file_upl) : void
Parameters
- $fields : array<string|int, mixed>
-
Fields indexes
- $tabs : string
-
Columns separator
- $file_upl : bool
-
If the input text is an uploaded file
Tags
upload_words_import()
Import terms of tags to the database.
upload_words_import() : void
Tags
upload_words_display()
Display the main for adding new words.
upload_words_display() : void