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
-
Return values
mysqli_result|true
—
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
-
-
$term
: string
-
-
$termlc
: string
-
Same as $term, but in lowercase.
-
$langid
: int
-
-
since
-
2.5.3-fork
Do not crash when echoing an error
-
since
-
2.5.3-fork
Do not crash when a word is already registred to the database
-
psalm-return
-
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
-
-
$status
: int
-
New status to apply to all words.
-
since
-
2.5.3-fork
Use 'let' instead of 'var' in returned JS
-
psalm-return
-
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
-
-
$count
: int
-
-
since
-
2.5.3-fork
Improved messages (more clear, and can handle singular/plural)
all_words_wellknown_javascript()
Execute JavaScript to change the display of all words.
all_words_wellknown_javascript(int $txid, string $javascript) : void
Parameters
-
$txid
: int
-
-
$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
-
-
$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
-
-
$status
: int
-
New status to apply to words.
bulk_save_terms()
bulk_save_terms(mixed $terms, mixed $tid, mixed $cleanUp) : void
Parameters
-
$terms
: mixed
-
-
$tid
: mixed
-
-
$cleanUp
: mixed
-
bulk_do_content()
bulk_do_content(mixed $tid, mixed $sl, mixed $tl, mixed $pos) : void
Parameters
-
$tid
: mixed
-
-
$sl
: mixed
-
-
$tl
: mixed
-
-
$pos
: mixed
-
get_term()
Return the term corresponding to the ID.
get_term(string $wid) : string
Parameters
-
$wid
: string
-
-
global
-
delete_word_from_database()
Edit the word from the database.
delete_word_from_database(string $wid) : string
Parameters
-
$wid
: string
-
-
global
-
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
-
-
$tid
: int
-
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
-
-
$wid
: string
-
-
$term
: string
-
-
$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
-
-
$wordid
: string
-
-
since
-
2.0.4-fork
do_mobile_display_impr_text()
Make the page content to display printed texts on mobile.
do_mobile_display_impr_text(int $textid, string $audio) : void
Parameters
-
$textid
: int
-
-
$audio
: string
-
-
deprecated
-
-
since
-
2.2.0
This function should not longer be used, and should cause issues. Use
do_desktop_display_impr_text instead.
do_desktop_display_impr_text()
Make the main page content to display printed texts for desktop.
do_desktop_display_impr_text(int $textid, string $audio) : void
Parameters
-
$textid
: int
-
-
$audio
: string
-
do_display_impr_text_page()
Do the page to display printed text.
do_display_impr_text_page(int $textid) : void
Parameters
-
$textid
: int
-
-
global
-
string $tbpref Database table prefix
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
-
-
global
-
string $tbpref Database table prefix.
Return values
array{0: string, 1: string, 2: string}
—
Text title,
text audio and source URI
Echo JavaScript area containing behaviors to show/hide
translations and annotations.
do_diplay_impr_text_header_js() : void
Make the header content to display a printed text.
do_diplay_impr_text_header_content(string $title, int $textid, string $audio, string $sourceURI) : void
Parameters
-
$title
: string
-
-
$textid
: int
-
-
$audio
: string
-
-
$sourceURI
: string
-
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
-
get_annotated_text()
Return the annotatino of a text.
get_annotated_text(int $textid) : string
Parameters
-
$textid
: int
-
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
-
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
-
-
$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>
-
-
global
-
string $tbpref Database table prefix.
Return values
array{0: string, 1: string}
—
Translation and romanization.
do_display_impr_text_text_word()
Display a single word item.
do_display_impr_text_text_word(string $item, string $textsize) : void
Parameters
-
$item
: string
-
Word item, values separated by a tabulation.
-
$textsize
: string
-
do_display_impr_text_text_main()
Main function to do a complete printed text text content.
do_display_impr_text_text_main([int|null $textid = null ]) : void
Parameters
-
$textid
: int|null
= null
-
Text ID, we will use page request if not provided.
get_l2_language_name()
Find the L2 language name.
get_l2_language_name() : string
-
global
-
string $tbpref Database table prefix
get_test_property()
Find the appropiate property to add to the test.
get_test_property() : string
It uses requests provided to the page.
do_test_mobile_page_content()
Make the content of the mobile page.
do_test_mobile_page_content(string $property) : void
Parameters
-
$property
: string
-
-
deprecated
-
Use do_frameset_mobile_page_content instead
do_test_mobile_page()
Make the mobile test page.
do_test_mobile_page([string $property = null ]) : void
Parameters
-
$property
: string
= null
-
-
since
-
2.6.0-fork
Function rewrote and no longer deprecated
do_test_desktop_page()
Make the desktop test page
do_test_desktop_page([string $property = null ]) : void
Parameters
-
$property
: string
= null
-
do_test_page()
Start the test page.
do_test_page(string $p) : void
Parameters
-
$p
: string
-
-
since
-
2.2.1
The $mobile parameter is no longer required.
-
since
-
2.6.0
Mobile interface is back and self-set.
-
since
-
2.7.0
Adds a CSS rule to auto-enlarge the body.
try_start_test()
Main function to try to start a test page.
try_start_test(mixed $p) : void
If unsifficiant arguments are provided to
the page, the page will be redirected to
edit_texts.php.
Parameters
-
$p
: mixed
-
get_sql_test_data()
Set useful data for the test using SQL query.
get_sql_test_data(string &$title, string &$p) : string
Parameters
-
$title
: string
-
-
$p
: string
-
Property URL to be overwritten
-
global
-
string $tbpref Database table prefix
get_lang_test_data()
Set useful data for the test using language.
get_lang_test_data(string &$title, string &$p) : string
Parameters
-
$title
: string
-
-
$p
: string
-
Property URL to be overwritten
-
global
-
string $tbpref Database table prefix
get_text_test_data()
Set useful data for the test using text.
get_text_test_data(string &$title, string &$p) : string
Parameters
-
$title
: string
-
-
$p
: string
-
Property URL to be overwritten
-
global
-
string $tbpref Database table prefix
get_test_counts()
Return the words count for this test.
get_test_counts(string $testsql) : array{0: string, 1: string}
Parameters
-
$testsql
: string
-
Return values
array{0: string, 1: string}
—
Total words due and total words learning
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
Prepare JavaScript content for the header.
do_test_header_js() : void
Make the header content for tests.
do_test_header_content(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Parameters
-
$title
: string
-
-
$p
: string
-
-
$totalcountdue
: string
-
Number of words due for today
-
$totalcount
: string
-
-
$language
: string
-
get_test_data()
Set useful data for the test.
get_test_data(string &$title, string &$p) : array{0: string, 1: string}
Parameters
-
$title
: string
-
-
$p
: string
-
Property URL to be overwritten
Return values
array{0: string, 1: string}
—
Total words due and total words learning
Do the header for test page.
do_test_header_page(string $title, string $p, string $totalcountdue, string $totalcount, string $language) : void
Parameters
-
$title
: string
-
-
$p
: string
-
-
$totalcountdue
: string
-
Number of words due for today
-
$totalcount
: string
-
-
$language
: string
-
Use requests passed to the page to start it.
start_test_header_page([string $language = 'L2' ]) : void
Parameters
-
$language
: string
= 'L2'
-
get_test_table_sql()
Set sql request for the word test.
get_test_table_sql() : string
-
global
-
string $tbpref Table prefix
do_test_table_language_settings()
do_test_table_language_settings(mixed $testsql) : array<string|int, float|int|null|string>|false|null
Parameters
-
$testsql
: mixed
-
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array<string|int, float|int|null|string>|false|null
get_test_table_settings()
get_test_table_settings() : array<string|int, int>
-
psalm-return
-
list{0|1, 0|1, 0|1, 0|1, 0|1, 0|1}
Return values
array<string|int, int>
do_test_table_javascript()
do_test_table_javascript() : void
do_test_table_settings()
do_test_table_settings(mixed $settings) : void
Parameters
-
$settings
: mixed
-
do_test_table_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
-
-
$lang
: int|null
-
Test is of type language, for the language $lang ID
-
$text
: int|null
-
Testing text with ID $text
-
psalm-return
-
list{string, int|non-empty-list|string}
Return values
array<string|int, int|array<string|int, int>|string>
—
Test identifier as an array(key, value)
do_test_get_test_sql()
Get the SQL string to perform tests.
do_test_get_test_sql(bool|null $selection, string|null $sess_testsql, int|null $lang, int|null $text) : string
Parameters
-
$selection
: bool|null
-
Test is of type selection
-
$sess_testsql
: string|null
-
-
$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(mixed $testtype) : int
Parameters
-
$testtype
: mixed
-
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
-
global
-
-
deprecated
-
2.9.0-fork
Use do_test_get_sql instead
get_test_type()
Give the test type.
get_test_type() : int<1, 5>
-
deprecated
-
2.9.0-fork
Use do_test_get_test_type instead.
Return values
int<1, 5>
—
Test type between 1 and 5 (included)
do_test_test_css()
Prepare the css code for tests.
do_test_test_css() : void
-
deprecated
-
2.6.0-fork
Do not use this function since it was causing wrong
display. Will be removed in 3.0.0.
do_test_get_tomorrow_tests_count()
Return the number of test due for tomorrow.
do_test_get_tomorrow_tests_count(string $testsql) : int
Parameters
-
$testsql
: string
-
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
-
-
$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
-
-
$lang
: mixed
-
ID of the language, will be removed in PHP 3.0.0
-
$wordlc
: string
-
-
global
-
string $tbpref Table prefix
-
global
-
int $debug Echo the passage number if 1.
-
since
-
2.5.3-fork
Properly return sentences with at least 70% of known words.
Previously, it was supposed to be 100%, but buggy.
-
psalm-return
-
Return values
array<string|int, int|null|string>
—
Sentence with escaped word and not a 0 if sentence was found.
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
-
-
$nosent
: bool|int
-
1 or true if you want to hide sentences.
-
$regexword
: string
-
Regex to select the desired word.
-
psalm-return
-
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
-
-
$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
-
-
psalm-return
-
array<string, float|int|null|string>
Return values
array<string|int, float|int|null|string>
—
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>
-
-
$nosent
: bool
-
-
$wo_text
: string
-
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
-
-
$selection
: array<string|int, mixed>|int
-
Items to run the test on.
-
$count
: int
-
-
$testtype
: int
-
-
global
-
string $tbpref Table prefix
-
global
-
int $debug Show the SQL query used if 1.
-
psalm-return
-
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
-
-
$testtype
: int
-
-
global
-
string $tbpref Table prefix
-
global
-
int $debug Show the SQL query used if 1.
-
psalm-return
-
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) : void
Parameters
-
$wb1
: string
-
URL of the first dictionary.
-
$wb2
: string
-
URL of the secondary dictionary.
-
$wb3
: string
-
URL of the google translate dictionary.
-
global
-
string $tbpref Database table prefix
-
global
-
string $angDefs Languages definition array
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, mixed $solution) : void
Parameters
-
$wo_record
: array<string|int, mixed>
-
Word record. Associative array with keys 'WoID',
'WoTranslation'.
-
$solution
: mixed
-
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
-
-
$nosent
: int
-
1 to use single word instead of sentence.
-
$save
: string
-
Word or sentence to use for the test
-
global
-
string $tbpref Database table prefix
-
global
-
string $angDefs Languages definition array
Get the data and echoes the footer.
prepare_test_footer(int $notyettested) : void
Parameters
-
$notyettested
: int
-
Number of words left to be tested.
Echoes HTML code for the footer of a words test page.
do_test_footer(int $notyettested, int $wrong, int $correct) : void
Parameters
-
$notyettested
: int
-
Number of words left to be tested
-
$wrong
: int
-
-
$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
-
global
-
int $debug Show debug informations
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
-
-
$selection
: array<string|int, mixed>|int
-
-
global
-
int $debug Show debug informations
get_text_id()
Get text ID (if possible).
get_text_id() : int|null
Text ID if first looked at int the 'text' parameter. If not found, then look at 'start'.
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
-
-
$audio
: mixed
= null
-
Audio URI, unnused, null by default
-
since
-
2.2.1
It also calls do_frameset_mobile_css and do_frameset_mobile_js
-
since
-
2.6.0-fork
Rewrote to match the desktop version (between 2.2.1 and 2.6.0)
do_text_desktop_content()
Echo the page content for the desktop version of do_text.
do_text_desktop_content(int $textid[, mixed $audio = null ]) : void
Parameters
-
$textid
: int
-
-
$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
-
-
since
-
2.2.1
The $mobile parameter is no longer required.
-
since
-
2.7.0
Adds a CSS rule to auto-enlarge the body.
getData()
Get the text and language data associated with the text.
getData(string|int $textid) : array<string|int, float|int|null|string>|false|null
Parameters
-
$textid
: string|int
-
-
global
-
string $tbpref Table name prefix
-
since
-
2.0.3-fork
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array<string|int, float|int|null|string>|false|null
—
LgName, TxLgID, TxText, TxTitle, TxAudioURI, TxSourceURI, TxAudioPosition for the text.
Print the main title row.
do_header_row(int $textid, string $langid) : void
Parameters
-
$textid
: int
-
-
$langid
: string
-
Language ID to navigate between
texts of same language
-
since
-
2.0.4-fork
do_title()
Print the title of the text.
do_title(string $title, string $sourceURI) : void
Parameters
-
$title
: string
-
-
$sourceURI
: string
-
-
since
-
2.0.4-fork
do_settings()
Prepare user settings for this text.
do_settings(string|int $textid) : void
Parameters
-
$textid
: string|int
-
-
since
-
2.0.4-fork
browser_tts()
Prints javascript data and function to read text
in your browser.
browser_tts(string $text, string $languageName) : void
Parameters
-
$text
: string
-
-
$languageName
: string
-
Full name of the language (i. e.: "English")
-
global
-
-
since
-
2.0.3-fork
-
since
-
2.9.1-fork
Function may work even when the language name was manually changed.
save_audio_position()
Save the position of the audio reading for a text.
save_audio_position(string|int $textid) : void
Parameters
-
$textid
: string|int
-
-
since
-
2.0.4-fork
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
-
-
$only_body
: bool
= true
-
If true, only show the inner body. If false, create a
complete HTML document.
-
since
-
2.0.3-fork
get_text_data()
Get the record for this text in the database.
get_text_data(string|int $textid) : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
Parameters
-
$textid
: string|int
-
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
—
Record corresponding to this text.
getTextData()
Get the record for this text in the database.
getTextData(string $textid) : array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
Parameters
-
$textid
: string
-
-
global
-
string $tbpref Table name prefix
-
deprecated
-
Use get_text_data instead.
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array{TxLgID: int, TxTitle: string, TxAnnotatedText: string, TxPosition: int}|false|null
—
Record corresponding to this text.
get_language_settings()
Return the settings relative to this language.
get_language_settings(int $langid) : 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.
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null
—
Record corresponding to this language.
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.
-
global
-
string $tbpref Table name prefix
-
deprecated
-
Use get_language_settings instead.
-
psalm-return
-
array<string, float|int|null|string>|false|null
Return values
array{LgName: string, LgDict1URI: string, LgDict2URI: string, LgGoogleTranslateURI: string, LgTextSize: int, LgRemoveSpaces: int, LgRightToLeft: int}|false|null
—
Record corresponding to this language.
echo_term()
Print the output when the word is a term (word or multi-word).
echo_term(int $actcode, int $showAll, string $spanid, mixed $hidetag, int $currcharcount, array<string, string> $record[, array<string|int, mixed> &$exprs = array() ]) : void
Parameters
-
$actcode
: int
-
Action code, number of words forming
the term (> 1 for multiword)
-
$showAll
: int
-
-
$spanid
: string
-
-
$hidetag
: mixed
-
-
$currcharcount
: int
-
Current number of characters
-
$record
: array<string, string>
-
-
$exprs
: array<string|int, mixed>
= array()
-
-
since
-
2.8.0-fork
Takes a new argument $exprs
echoTerm()
Print the output when the word is a term.
echoTerm(int $actcode, int $showAll, int $hideuntil, string $spanid, mixed $hidetag, int $currcharcount, array<string, string> $record) : int
Parameters
-
$actcode
: int
-
Action code, > 1 for multiword
-
$showAll
: int
-
-
$hideuntil
: int
-
-
$spanid
: string
-
-
$hidetag
: mixed
-
-
$currcharcount
: int
-
Current number of characters
-
$record
: array<string, string>
-
-
since
-
2.2.1
Return 0 instead of a new value for $hideuntil
-
deprecated
-
wordProcessor()
Process each word (can be punction, term, etc...). Caused laggy texts, replaced by wordParser.
wordProcessor(array<string|int, string> $record, 0|1 $showAll, int $currcharcount) : int
Parameters
-
$record
: array<string|int, string>
-
-
$showAll
: 0|1
-
-
$currcharcount
: int
-
Current number of caracters
-
deprecated
-
Use sentenceParser and wordParser instead.
sentence_parser()
Check if a new sentence SPAN should be started.
sentence_parser(int $sid, int $old_sid) : int
Parameters
-
$sid
: int
-
-
$old_sid
: int
-
sentenceParser()
Check if a new sentence SPAN should be started.
sentenceParser(int $sid, int $old_sid) : int
Parameters
-
$sid
: int
-
-
$old_sid
: int
-
-
deprecated
-
Use sentence_parser instead.
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>
-
-
$showAll
: 0|1
-
-
$currcharcount
: int
-
Current number of caracters
-
$hide
: bool
-
Should some item be hidden, depends on $showAll
-
$exprs
: array<string|int, mixed>
= array()
-
-
since
-
2.5.0-fork
-
since
-
2.8.0-fork
Take a new optional arguent $exprs
word_parser()
Process each text item (can be punction, term, etc...)
word_parser(array<string|int, string> $record, 0|1 $showAll, int $currcharcount, int $hideuntil) : int
Parameters
-
$record
: array<string|int, string>
-
-
$showAll
: 0|1
-
-
$currcharcount
: int
-
Current number of caracters
-
$hideuntil
: int
-
Should the value be hidden or not
-
deprecated
-
Use item_parser instead (since 2.5.0-fork).
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>
-
-
$showAll
: 0|1
-
-
$currcharcount
: int
-
Current number of caracters
-
$hideuntil
: int
-
Should the value be hidden or not
-
deprecated
-
main_word_loop()
Get all words and start the iterate over them.
main_word_loop(string $textid, 0|1 $showAll) : void
Parameters
-
$textid
: string
-
-
$showAll
: 0|1
-
-
global
-
string $tbpref Table name prefix
mainWordLoop()
Get all words and start the iterate over them.
mainWordLoop(string $textid, 0|1 $showAll) : void
Parameters
-
$textid
: string
-
-
$showAll
: 0|1
-
-
global
-
string $tbpref Table name prefix
-
deprecated
-
Use main_word_loop instead.
do_text_text_style()
Prepare style for showing word status. Write a now STYLE object
do_text_text_style(int $showLearning, int<1, 4> $mode_trans, int $textsize, mixed $ann_exists) : void
Parameters
-
$showLearning
: int
-
1 to show learning translations
-
$mode_trans
: int<1, 4>
-
-
$textsize
: int
-
-
$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>
-
-
$textsize
: int
-
-
$ann_exists
: mixed
-
-
deprecated
-
Use do_text_text_style instead.
do_text_text_javascript()
Print JavaScript-formatted content.
do_text_text_javascript(mixed $var_array) : void
Parameters
-
$var_array
: mixed
-
do_text_javascript()
Print JavaScript-formatted content.
do_text_javascript(mixed $var_array) : void
Parameters
-
$var_array
: mixed
-
-
deprecated
-
Use do_text_text_javascript instead.
do_text_text_content()
Main function for displaying sentences. It will print HTML content.
do_text_text_content(string|int $textid[, bool $only_body = true ]) : void
Parameters
-
$textid
: string|int
-
-
$only_body
: bool
= true
-
If true, only show the inner body. If false, create a complete HTML document.
edit_languages_alert_duplicate()
Prepare a JavaScript code that checks for duplicate names in languages.
edit_languages_alert_duplicate() : void
edit_languages_refresh()
Refresh sentence and text items from a specific language.
edit_languages_refresh(int $lid) : string
Parameters
-
$lid
: int
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Number of sentences and textitems refreshed
edit_languages_delete()
Delete a language.
edit_languages_delete(int $lid) : string
Parameters
-
$lid
: int
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Info on the number of languages deleted
edit_languages_op_save()
Save a new language to the database.
edit_languages_op_save() : string
-
global
-
string $tbpref Database table prefix
edit_languages_op_change()
Edit an existing text in the database.
edit_languages_op_change(int $lid) : string
Parameters
-
$lid
: int
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Number of texts updated and items reparsed.
load_language()
Load a language object based in language ID.
load_language(int $lgid) : Language
Parameters
-
$lgid
: int
-
Language ID, if 0 load empty data.
-
global
-
Create the form for a language.
edit_language_form(Language $language) : void
Parameters
-
$language
: Language
-
get_wizard_selectoptions()
Returns a dropdown menu of the different languages.
get_wizard_selectoptions(string $currentnativelanguage) : string
Parameters
-
$currentnativelanguage
: string
-
edit_languages_new()
Display a form to create a new language.
edit_languages_new() : void
edit_languages_change()
Display a form to edit an existing language.
edit_languages_change(int $lid) : void
Parameters
-
$lid
: int
-
-
global
-
edit_languages_display()
Display the standard page of saved languages.
edit_languages_display(string $message) : void
Parameters
-
$message
: string
-
An information message to display.
-
global
-
-
global
-
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
-
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.
-
since
-
2.5.2-fork
The created term has the attribute "wordcount" assigned
(instead of the wrong "word_count").
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.
-
global
-
string $tbpref Database table prefix.
-
since
-
2.5.2-fork
Use the "wordcount" attribute of $term instead of the
wrong word_count.
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
-
-
global
-
string $tbpref Database table prefix.
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
-
-
$tid
: int
-
-
$ord
: int
-
-
$len
: int
-
Number of words in the multi-word.
-
global
-
string $tbpref Database table prefix.
edit_mword_update()
Make the main display for editing existing multi-word.
edit_mword_update(int $wid, int $tid, int $ord) : void
Parameters
-
$wid
: int
-
-
$tid
: int
-
-
$ord
: int
-
-
global
-
string $tbpref Database table prefix.
edit_mword_display_new()
Display a form for the insertion of a new multi-word.
edit_mword_display_new(Term $term, int $tid, int $ord, int $len) : void
Parameters
-
$term
: Term
-
-
$tid
: int
-
-
$ord
: int
-
-
$len
: int
-
Number of words in the multi-word.
-
global
-
string $tbpref Database table prefix.
edit_mword_display_change()
Display an updating form for a multi-word.
edit_mword_display_change(Term $term, int $tid, int $ord) : void
Parameters
-
$term
: Term
-
Multi-word to being modified.
-
$tid
: int
-
-
$ord
: int
-
-
global
-
string $tbpref Database table prefix.
edit_mword_page()
Create the multi-word frame.
edit_mword_page() : void
-
global
-
string $tbpref Database table prefix.
edit_texts_get_wh_query()
Get the value of $wh_query.
edit_texts_get_wh_query(string $currentquery, string $currentquerymode, string $currentregexmode) : string
Parameters
-
$currentquery
: string
-
-
$currentquerymode
: string
-
-
$currentregexmode
: string
-
edit_texts_get_wh_tag()
Return the value for $wh_tag.
edit_texts_get_wh_tag(string|int $currentlang) : string
Parameters
-
$currentlang
: string|int
-
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
-
-
$marked
: array<string|int, mixed>
-
-
$actiondata
: string
-
Values to insert to the database
-
global
-
string $tbpref Database table prefix
-
since
-
2.4.1-fork
The second return field is always null
-
psalm-return
-
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
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Texts, sentences, and text items deleted.
edit_texts_archive()
Archive a text.
edit_texts_archive(int $txid) : string
Parameters
-
$txid
: int
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Number of archives saved, texts deleted, sentences deleted, text items deleted.
edit_texts_do_operation()
Do an operation on texts.
edit_texts_do_operation(string $op, mixed $message1, int|bool $no_pagestart) : string
Parameters
-
$op
: string
-
-
$message1
: mixed
-
-
$no_pagestart
: int|bool
-
-
global
-
string $tbpref Database table prefix
-
since
-
2.4.1-fork
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
-
-
$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
-
-
global
-
edit_texts_change()
Create the main window to edit an existing text.
edit_texts_change(int $txid) : void
Parameters
-
$txid
: int
-
-
global
-
string $tbpref Database table prefix
edit_texts_filters_form()
Do the filters form for texts display.
edit_texts_filters_form(string $currentlang, int $recno, int $currentpage, int $pages) : void
Parameters
-
$currentlang
: string
-
-
$recno
: int
-
-
$currentpage
: int
-
-
$pages
: int
-
edit_texts_other_pages()
Make links to navigate to other pages if necessary.
edit_texts_other_pages(int $recno) : void
Parameters
-
$recno
: int
-
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
-
-
$statuses
: array{: int<0, 5>|98|99, : array{: string, : string}}
-
List of statuses WITH unknown words (status 0)
-
since
-
2.6.0-fork
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
-
-
$showCounts
: string
-
Number of items to show, put into a string
-
$sql
: string
-
-
$recno
: int
-
-
global
-
int $debug Display debug information.
edit_texts_display()
Main display for the edit text functionality.
edit_texts_display(string $message) : void
Parameters
-
$message
: string
-
-
global
-
string $tbpref Database table prefix
-
global
-
int $debug Debug mode active or not
edit_texts_do_page()
Main function for displaying the edit_texts page.
edit_texts_do_page() : void
add_new_term_transl()
Add the translation for a new term.
add_new_term_transl(string $text, int $lang, string $data) : array<string|int, int|string>|string
Parameters
-
$text
: string
-
-
$lang
: int
-
-
$data
: string
-
-
global
-
string $tbpref Database table prefix
-
since
-
2.9.0
Error messages are much more explicit
-
since
-
2.9.0
-
psalm-return
-
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
-
-
$new_trans
: string
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
WoTextLC, lowercase version of the word
do_ajax_check_update_translation()
Edit term translation if it exists.
do_ajax_check_update_translation(int $wid, string $new_trans) : string
Parameters
-
$wid
: int
-
-
$new_trans
: string
-
-
global
-
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
-
-
$data
: string
-
-
deprecated
-
Deprecated in 2.9.0 in favor to the REST API.
Return values
string
—
Database alteration message
check_mecab_accessibility()
Check if mecab is installed and accessible under the 'mecab' alias.
check_mecab_accessibility() : void
check_standard_regex()
Check if string 'test' is consistently recognized as a word.
check_standard_regex(mixed $regex) : void
Parameters
-
$regex
: mixed
-
do_ajax_check_regexp()
Make the actual query to check the regex.
do_ajax_check_regexp(string $regex) : void
Parameters
-
$regex
: string
-
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
-
-
$status
: string|int
-
-
global
-
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
-
-
$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
-
-
$currstatus
: int
-
Current status in the good value range.
-
global
-
string $tbpref Database table prefix
Return values
string|null
—
HTML-formatted string with plus/minus controls if a success.
ajax_increment_term_status()
Do a word status change.
ajax_increment_term_status(int $wid, bool $up) : string
Parameters
-
$wid
: int
-
-
$up
: bool
-
Should the status be incremeted or decremented
-
global
-
string $tbpref Database table prefix.
-
todo
-
2.9.0 Dirty PHP implementation, needs further refactoring
Return values
string
—
HTML-formatted string for increments
do_ajax_chg_term_status()
Do a word status change and print the result.
do_ajax_chg_term_status(int $wid, bool $up) : void
Parameters
-
$wid
: int
-
-
$up
: bool
-
Should the status be incremeted or decremented
-
global
-
string $tbpref Database table prefix.
-
see
-
ajax_increment_term_status
Return values instead of printing.
do_ajax_get_theme()
Get the file path using theme.
do_ajax_get_theme(string $filepath) : string
Parameters
-
$filepath
: string
-
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>>
-
-
$nfid
: mixed
-
-
global
-
string $tbpref Database table prefix
Return values
array{0: int, 1: int}
—
Number of imported feeds and number of duplicated feeds.
print_feed_result()
Update the feeds database and echo a result message.
print_feed_result(int $imported_feed, int $nif, string $nfname, int $nfid, string $nfoptions) : void
Parameters
-
$imported_feed
: int
-
-
$nif
: int
-
Number of duplicated feeds
-
$nfname
: string
-
-
$nfid
: int
-
-
$nfoptions
: string
-
-
global
-
string $tbpref Database table prefix
do_ajax_load_feed()
Main function to execute an AJAX query echoing feeds.
do_ajax_load_feed(string $nfname, int $nfid, string $nfsourceuri, string $nfoptions) : string
Parameters
-
$nfname
: string
-
-
$nfid
: int
-
-
$nfsourceuri
: string
-
-
$nfoptions
: string
-
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
-
-
$line
: int
-
-
$val
: string
-
Proposed new annotation for the term
-
global
-
string $tbpref Database table prefix.
Return values
string
—
Error message, or "OK" if success.
do_ajax_save_impr_text()
Save a printed text.
do_ajax_save_impr_text(int $textid, string $elem, mixed $data) : string
Parameters
-
$textid
: int
-
-
$elem
: string
-
-
$data
: mixed
-
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
-
-
$elem
: string
-
-
$data
: mixed
-
-
psalm-return
-
array{error?: string, success?: 'OK'}
Return values
array<string|int, string>
—
Result as array, with answer on "error" or "success"
do_ajax_save_setting()
Save a setting.
do_ajax_save_setting(string $key, mixed $value) : void
Parameters
-
$key
: string
-
-
$value
: mixed
-
save_text_position()
Save the reading position of the text.
save_text_position(int $textid, int $position) : void
Parameters
-
$textid
: int
-
-
$position
: int
-
-
global
-
string $tbpref Database table prefix
save_audio_position()
Save the audio position in the text.
save_audio_position(int $textid, int $audioposition) : void
Parameters
-
$textid
: int
-
-
$audioposition
: int
-
-
global
-
string $tbpref Database table prefix
limit_current_page()
limit_current_page(mixed $currentpage, mixed $recno, mixed $maxperpage) : mixed
Parameters
-
$currentpage
: mixed
-
-
$recno
: mixed
-
-
$maxperpage
: mixed
-
Prepare the page to display imported terms.
imported_terms_header(int $recno, int $currentpage, string $last_update[, int $maxperpage = 100 ]) : void
Parameters
-
$recno
: int
-
-
$currentpage
: int
-
-
$last_update
: string
-
-
$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
-
-
$currentpage
: int
-
-
$last_update
: string
-
-
deprecated
-
2.9.0
Use imported_terms_header instead
Return values
string
—
SQL-formatted query to limit the number of results
select_imported_terms()
select_imported_terms(mixed $last_update, mixed $offset, mixed $max_terms) : array<string|int, array<string|int, float|int|null|string>>
Parameters
-
$last_update
: mixed
-
-
$offset
: mixed
-
-
$max_terms
: mixed
-
-
psalm-return
-
list<list<float|int|null|string>>
Return values
array<string|int, array<string|int, float|int|null|string>>
show_imported_terms()
Show the imported terms.
show_imported_terms(string $last_update, string $limit, mixed $rtl) : void
Parameters
-
$last_update
: string
-
-
$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
-
-
$currentpage
: int
-
Current number of the page
-
$recno
: int
-
-
$rtl
: bool
-
True if this language is right-to-left
-
deprecated
-
2.9.0
Use the AJAX API instead.
imported_terms_list()
Return the list of imported terms of pages information.
imported_terms_list(string $last_update, int $currentpage, int $recno) : array<string|int, array<string|int, int|mixed>|mixed>
Parameters
-
$last_update
: string
-
-
$currentpage
: int
-
-
$recno
: int
-
-
psalm-return
-
array{navigation: array{current_page: mixed, total_pages: int}, terms: mixed}
Return values
array<string|int, array<string|int, int|mixed>|mixed>
do_ajax_show_sentences()
Return the sentences associated to this word.
do_ajax_show_sentences(int $langid, int $wid, string $word, string $ctl) : string
Parameters
-
$langid
: int
-
-
$wid
: int
-
-
$word
: string
-
-
$ctl
: string
-
Path for the textarea of the sentence of the word being
edited.
-
deprecated
-
2.9.0
Use the REST API instead.
do_ajax_show_similar_terms()
Return the terms similar to a word.
do_ajax_show_similar_terms(int $langid, string $word) : string
Parameters
-
$langid
: int
-
-
$word
: string
-
Change the current working directory and find media path
do_ajax_update_media_select() : string
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
-
deprecated
-
2.9.0
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
-
-
global
-
mysqli $DBCONNECTION Connection to the database
Return values
mysqli_result|true
runsql()
Run a SQL query, you can specify its behavior and error message.
runsql(string $sql, string $m[, bool $sqlerrdie = true ]) : string
Parameters
-
$sql
: string
-
-
$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
-
-
since
-
2.6.0-fork
Officially return numeric types.
Return values
float|int|string|null
—
Any returned value from the database.
prepare_textdata()
Replace Windows line return ("\r\n") by Linux ones ("\n").
prepare_textdata(string $s) : string
Parameters
-
$s
: string
-
prepare_textdata_js()
prepare_textdata_js(mixed $s) : string
Parameters
-
$s
: mixed
-
convert_string_to_sqlsyntax()
Prepares a string to be properly recognized as a string by SQL.
convert_string_to_sqlsyntax(string $data) : string
Parameters
-
$data
: string
-
-
global
-
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
-
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
-
convert_regexp_to_sqlsyntax()
convert_regexp_to_sqlsyntax(mixed $input) : string
Parameters
-
$input
: mixed
-
validateLang()
Validate a language ID
validateLang(string $currentlang) : string
Parameters
-
$currentlang
: string
-
-
global
-
string $tbpref Table name prefix
Return values
string
—
'' if the language is not valid, $currentlang otherwise
validateText()
Validate a text ID
validateText(string $currenttext) : string
Parameters
-
$currenttext
: string
-
-
global
-
string '' if the text is not valid, $currenttext otherwise
-
global
-
string $tbpref Table name prefix
validateTag()
validateTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
-
$currenttag
: mixed
-
-
$currentlang
: mixed
-
validateArchTextTag()
validateArchTextTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
-
$currenttag
: mixed
-
-
$currentlang
: mixed
-
validateTextTag()
validateTextTag(mixed $currenttag, mixed $currentlang) : mixed
Parameters
-
$currenttag
: mixed
-
-
$currentlang
: mixed
-
getSettingZeroOrOne()
Convert a setting to 0 or 1
getSettingZeroOrOne(string $key, string|int $dft) : int
Parameters
-
$key
: string
-
-
$dft
: string|int
-
Default value to use, should be convertible to string
-
psalm-return
-
getSetting()
Get a setting from the database. It can also check for its validity.
getSetting(string $key) : string
Parameters
-
$key
: string
-
Setting key. If $key is 'currentlanguage' or
'currenttext', we validate language/text.
-
global
-
string $tbpref Table name prefix
Return values
string
—
$val Value in the database if found, or an empty string
getSettingWithDefault()
Get the settings value for a specific key. Return a default value when possible
getSettingWithDefault(string $key) : string
Parameters
-
$key
: string
-
-
global
-
string $tbpref Table name prefix
Return values
string
—
Requested setting, or default value, or ''
saveSetting()
Save the setting identified by a key with a specific value.
saveSetting(string $k, mixed $v) : string
Parameters
-
$k
: string
-
-
$v
: mixed
-
Setting value, will get converted to string
-
global
-
string $tbpref Table name prefix
-
since
-
2.9.0
Success message starts by "OK: "
Return values
string
—
Success message (starts by "OK: "), or error message
LWTTableCheck()
Check if the _lwtgeneral table exists, create it if not.
LWTTableCheck() : void
LWTTableSet()
LWTTableSet(mixed $key, mixed $val) : void
Parameters
-
$key
: mixed
-
-
$val
: mixed
-
LWTTableGet()
LWTTableGet(mixed $key) : string
Parameters
-
$key
: mixed
-
adjust_autoincr()
Adjust the auto-incrementation in the database.
adjust_autoincr(mixed $table, mixed $key) : void
Parameters
-
$table
: mixed
-
-
$key
: mixed
-
-
global
-
string $tbpref Database table prefix
optimizedb()
Optimize the database.
optimizedb() : void
-
global
-
string $trbpref Table prefix
update_japanese_word_count()
Update the word count for Japanese language (using MeCab only).
update_japanese_word_count(int $japid) : void
Parameters
-
$japid
: int
-
-
global
-
string $tbpref Database table prefix.
init_word_count()
Initiate the number of words in terms for all languages.
init_word_count() : void
Only terms with a word count set to 0 are changed.
-
global
-
string $tbpref Database table prefix
set_word_count()
Initiate the number of words in terms for all languages
set_word_count() : void
Only terms with a word count set to 0 are changed.
-
global
-
string $tbpref Database table prefix
-
deprecated
-
Use init_word_count: same effect, but more logical name. Will be
removed in version 3.0.0.
parse_japanese_text()
Parse a Japanese text using MeCab and add it to the database.
parse_japanese_text(string $text, int $id) : null|array<string|int, string>
Parameters
-
$text
: string
-
-
$id
: int
-
Text ID. If $id = -1 print results,
if $id = -2 return splitted texts
-
since
-
2.5.1-fork
Works even if LOAD DATA LOCAL INFILE operator is disabled.
-
since
-
2.6.0-fork
Use PHP instead of SQL, slower but works better.
-
global
-
string $tbpref Database table prefix
-
psalm-return
-
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
-
-
global
-
string $tbpref Database table prefix
parse_standard_text()
Parse a text using the default tools. It is a not-japanese text.
parse_standard_text(string $text, int $id, int $lid) : null|array<string|int, string>
Parameters
-
$text
: string
-
-
$id
: int
-
Text ID. If $id == -2, only split the text.
-
$lid
: int
-
-
since
-
2.5.1-fork
Works even if LOAD DATA LOCAL INFILE operator is disabled.
-
global
-
string $tbpref Database table prefix
-
psalm-return
-
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
-
-
$id
: int
-
-
$lid
: int
-
-
global
-
string $tbpref Database table prefix
-
psalm-return
-
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
-
-
global
-
string $tbpref Database table prefix
update_default_values()
Change the default values for default language, default text, etc.
update_default_values(int $id, int $lid, string $sql) : void
Parameters
-
$id
: int
-
-
$lid
: int
-
-
$sql
: string
-
-
global
-
string $tbpref Database table prefix
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>
-
check_text_with_expressions()
Check a text 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
-
-
$lid
: int
-
-
$wl
: array<string|int, int>
-
-
$wl_max
: int
-
-
$mw_sql
: string
-
-
global
-
string $tbpref Database table prefix
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
-
-
$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
-
global
-
string $tbpref Database table prefix
-
psalm-return
-
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
-
global
-
string $tbpref Database table prefix
update_database()
Update the database if it is using an outdate version.
update_database(string $dbname) : void
Parameters
-
$dbname
: string
-
-
global
-
string $tbpref Database table prefix
-
global
-
0|1 $debug Output debug messages.
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
-
-
global
-
mysqli $DBCONNECTION Connection to the database
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
-
-
$userid
: string
-
-
$passwd
: string
-
-
$dbname
: string
-
-
$socket
: string
= ""
-
-
psalm-suppress
-
-
since
-
2.6.0-fork
Use mysqli_init and mysql_real_connect instead of deprecated mysql_connect
-
since
-
2.6.0-fork
Tries to allow local infiles for the connection.
-
since
-
2.9.0
Can accept a $socket as an optional argument
Return values
mysqli
—
Connection to the database
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
Return values
0|1
—
Table Prefix is fixed, no changes possible
is_mobile()
Return false. Before 2.2.1, return true if we should use mobile mode.
is_mobile() : bool
-
since
-
2.2.1
You should not use this function since mobiledetect is no longer used.
-
since
-
2.6.0-fork
No longer deprecated and use no external library.
Return values
bool
—
Mobile mode shoud be activated or not
do_frameset_mobile_page_content()
Echo frameset content for a mobile page.
do_frameset_mobile_page_content(string $frame_h_uri, string $frame_l_uri, bool $right_frames) : void
Parameters
-
$frame_h_uri
: string
-
URI for the frame-h-2 iframe.
-
$frame_l_uri
: string
-
URI for the frame-l-2 iframe.
-
$right_frames
: bool
-
Create or not a space for right frames.
-
deprecated
-
Since 2.2.1-fork, Do not use frames
do_frameset_mobile_css()
Echo the CSS content for mobile frameset page.
do_frameset_mobile_css() : void
-
deprecated
-
Since 2.6.0-fork, the display for mobile changed, making this code
useless
do_frameset_mobile_js()
Echo the JS code for the mobile version of a frameset page.
do_frameset_mobile_js([string|null $audio = null ]) : void
Parameters
-
$audio
: string|null
= null
-
-
deprecated
-
Since 2.2.1-fork, we do no longer use frameset
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
-
global
-
string $tbpref Table name prefix
Return values
array<string|int, string>
—
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
-
global
-
string $tbpref Table name prefix
Return values
array<string|int, string>
—
getTextTitle()
getTextTitle(mixed $textid) : string
Parameters
-
$textid
: mixed
-
get_tag_selectoptions()
get_tag_selectoptions(mixed $v, mixed $l) : string
Parameters
-
$v
: mixed
-
-
$l
: mixed
-
get_texttag_selectoptions()
get_texttag_selectoptions(mixed $v, mixed $l) : string
Parameters
-
$v
: mixed
-
-
$l
: mixed
-
get_txtag_selectoptions()
get_txtag_selectoptions(mixed $l, mixed $v) : string
Parameters
-
$l
: mixed
-
-
$v
: mixed
-
get_archivedtexttag_selectoptions()
get_archivedtexttag_selectoptions(mixed $v, mixed $l) : string
Parameters
-
$v
: mixed
-
-
$l
: mixed
-
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
-
-
global
-
string $tbpref Database table prefix.
saveArchivedTextTags()
Save the tags for archived texts.
saveArchivedTextTags(mixed $tid) : void
Parameters
-
$tid
: mixed
-
-
global
-
string $tbpref Databse table prefix.
getWordTags(mixed $wid) : string
Parameters
-
$wid
: mixed
-
getTextTags()
Return a HTML-formatted list of the text tags.
getTextTags(int $tid) : string
Parameters
-
$tid
: int
-
Text ID. Can be below 1 to create an empty list.
-
global
-
string $tbpref Database table prefix
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.
-
global
-
string $tbpref Database table prefix
addtaglist()
addtaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
addarchtexttaglist()
addarchtexttaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
addtexttaglist()
addtexttaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
removetaglist()
removetaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
removearchtexttaglist()
removearchtexttaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
removetexttaglist()
removetexttaglist(mixed $item, mixed $list) : string
Parameters
-
$item
: mixed
-
-
$list
: mixed
-
load_feeds()
load_feeds(mixed $currentfeed) : void
Parameters
-
$currentfeed
: mixed
-
write_rss_to_db(mixed $texts) : string
Parameters
-
$texts
: mixed
-
print_last_feed_update()
print_last_feed_update(mixed $diff) : void
Parameters
-
$diff
: mixed
-
get_nf_option()
get_nf_option(mixed $str, mixed $option) : null|string|array<string|int, string>
Parameters
-
$str
: mixed
-
-
$option
: mixed
-
-
psalm-return
-
array<string, string>|null|string
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
-
-
psalm-return
-
array{feed_title: null|string,...}|false
Return values
array<string|int, array<string|int, false|null|string>|null|string>|false
get_links_from_rss(mixed $NfSourceURI, mixed $NfArticleSection) : array<string|int, array<string|int, false|null|string>>|false
Parameters
-
$NfSourceURI
: mixed
-
-
$NfArticleSection
: mixed
-
-
psalm-return
-
false|list<array{title: null|string, desc: null|string, link: string, date: string, text?: false|string, audio: string}>
Return values
array<string|int, array<string|int, false|null|string>>|false
get_text_from_rsslink(mixed $feed_data, mixed $NfArticleSection, mixed $NfFilterTags[, mixed $NfCharset = null ]) : array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|string
Parameters
-
$feed_data
: mixed
-
-
$NfArticleSection
: mixed
-
-
$NfFilterTags
: mixed
-
-
$NfCharset
: mixed
= null
-
-
psalm-return
-
array<array{TxTitle: mixed, TxAudioURI: mixed|null, TxText: string, TxSourceURI: mixed|string, message?: string, link?: list{mixed,...}}>|null|string
Return values
array<string|int, array<string|int, array<string|int, mixed>|mixed|null|string>>|null|string
getPreviousAndNextTextLinks()
Return navigation arrows to previous and next texts.
getPreviousAndNextTextLinks(int $textid, string $url, bool $onlyann, string $add) : string
Parameters
-
$textid
: int
-
-
$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
-
since
-
2.7.0
Do no longer indicate database prefix in logo
getprefixes()
Return all different database prefixes that are in use.
getprefixes() : array<string|int, string>
-
psalm-return
-
Return values
array<string|int, string>
—
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.
-
psalm-return
-
array{paths: array, folders: array}
Return values
array<string|int, array<string|int, mixed>>
—
All paths found (matching files and folders) in "paths" and folders in "folders".
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>
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
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
-
get_playbackrate_selectoptions()
get_playbackrate_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
remove_soft_hyphens()
remove_soft_hyphens(mixed $str) : string|array<string|int, string>
Parameters
-
$str
: mixed
-
-
psalm-return
-
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
-
-
psalm-return
-
Return values
null|string|array<string|int, string>
makeCounterWithTotal()
makeCounterWithTotal(mixed $max, mixed $num) : string
Parameters
-
$max
: mixed
-
-
$num
: mixed
-
encodeURI()
encodeURI(mixed $url) : string
Parameters
-
$url
: mixed
-
print_file_path()
Echo the path of a file using the theme directory. Echo the base file name of
file is not found
print_file_path(string $filename) : void
Parameters
-
$filename
: string
-
get_file_path()
Get the path of a file using the theme directory
get_file_path(string $filename) : string
Parameters
-
$filename
: string
-
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"
-
get_sentence_count_selectoptions()
get_sentence_count_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_words_to_do_buttons_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_regex_selectoptions()
get_regex_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_tooltip_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_themes_selectoptions()
get_themes_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
processSessParam()
Get a session value and update it if necessary.
processSessParam(string $reqkey, string $sesskey, string|int $default, bool $isnum) : string|int
Parameters
-
$reqkey
: string
-
If in $_REQUEST, update the session with $_REQUEST[$reqkey]
-
$sesskey
: string
-
Field of the session to get or update
-
$default
: string|int
-
-
$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
-
-
$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
-
get_last_key()
Return the last inserted ID in the database
get_last_key() : int
-
since
-
2.6.0-fork
Officially returns a int in documentation, as it was the case
get_checked()
If $value is true, return an HTML-style checked attribute.
get_checked(mixed $value) : string
Parameters
-
$value
: mixed
-
Some value that can be evaluated as a boolean
-
psalm-return
-
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
-
-
psalm-return
-
' selected="selected" '|''
Return values
string
—
''|' selected="selected" ' Depending if inputs are equal
do_test_test_get_projection()
Create a projection operator do perform word test.
do_test_test_get_projection(string $key, array<string|int, mixed>|int $value) : string
Parameters
-
$key
: string
-
Type of test.
- 'words': selection from words
- 'texts': selection from texts
- 'lang': selection from language
- 'text': selection from single text
-
$value
: array<string|int, mixed>|int
-
-
global
-
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
-
-
$wordid
: int
-
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
-
-
$dt
: string
-
get_languagessize_selectoptions()
get_languagessize_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_wordstatus_radiooptions()
get_wordstatus_radiooptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_wordstatus_selectoptions()
get_wordstatus_selectoptions(mixed $v, mixed $all, mixed $not9899[, mixed $off = true ]) : string
Parameters
-
$v
: mixed
-
-
$all
: mixed
-
-
$not9899
: mixed
-
-
$off
: mixed
= true
-
get_annotation_position_selectoptions()
get_annotation_position_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_paging_selectoptions()
get_paging_selectoptions(mixed $currentpage, mixed $pages) : string
Parameters
-
$currentpage
: mixed
-
-
$pages
: mixed
-
get_wordssort_selectoptions()
get_wordssort_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_tagsort_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_textssort_selectoptions()
get_textssort_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_andor_selectoptions()
get_andor_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
get_set_status_option()
get_set_status_option(mixed $n[, mixed $suffix = "" ]) : string
Parameters
-
$n
: mixed
-
-
$suffix
: mixed
= ""
-
get_status_name()
get_status_name(mixed $n) : string
Parameters
-
$n
: mixed
-
get_status_abbr()
get_status_abbr(mixed $n) : string
Parameters
-
$n
: mixed
-
get_colored_status_msg()
get_colored_status_msg(mixed $n) : string
Parameters
-
$n
: mixed
-
get_multiplewordsactions_selectoptions()
get_multiplewordsactions_selectoptions() : string
get_multipletagsactions_selectoptions() : string
get_allwordsactions_selectoptions()
get_allwordsactions_selectoptions() : string
get_alltagsactions_selectoptions() : string
get_multipletextactions_selectoptions()
get_multipletextactions_selectoptions() : string
get_multiplearchivedtextactions_selectoptions()
get_multiplearchivedtextactions_selectoptions() : string
get_texts_selectoptions()
get_texts_selectoptions(mixed $lang, mixed $v) : string
Parameters
-
$lang
: mixed
-
-
$v
: mixed
-
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
-
checkStatusRange()
checkStatusRange(mixed $currstatus, mixed $statusrange) : bool
Parameters
-
$currstatus
: mixed
-
-
$statusrange
: mixed
-
makeStatusClassFilter()
Adds HTML attributes to create a filter over words learning status.
makeStatusClassFilter(int<0, 5>|98|99|599 $status) : string
Parameters
-
$status
: int<0, 5>|98|99|599
-
Word learning status
599 is a special status
combining 5 and 99 statuses.
0 return an empty string
Return values
string
—
CSS class filter to exclude $status
makeStatusClassFilterHelper()
Replace $status in $array by -1
makeStatusClassFilterHelper(int $status, array<string|int, int> &$array) : void
Parameters
-
$status
: int
-
-
$array
: array<string|int, int>
-
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'
-
since
-
2.7.0-fork
It is recommended to use "lwt_term" instead of "###"
Return values
string
—
Dictionary link formatted
createDictLinksInEditWin()
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin(int $lang, string $word, string $sentctljs, bool $openfirst) : string
Parameters
-
$lang
: int
-
-
$word
: string
-
-
$sentctljs
: string
-
-
$openfirst
: bool
-
True if we should open right frames with translation
first
-
global
-
string $tbpref Database table prefix
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
makeOpenDictStrJS()
makeOpenDictStrJS(mixed $url) : string
Parameters
-
$url
: mixed
-
makeOpenDictStrDynSent()
Create a dictionnary open URL from an pseudo-URL
makeOpenDictStrDynSent(string $url, string $sentctljs, string $txt) : string
Parameters
-
$url
: string
-
A string containing at least a URL
- If it contains the query "lwt_popup", open in Popup
- Starts with a '*': open in pop-up window (deprecated)
- Otherwise open in iframe
-
$sentctljs
: string
-
Clickable text to display
-
$txt
: string
-
Clickable text to display
-
since
-
2.7.0-fork
Supports LibreTranslate, using other string that proper URL is
deprecated.
createDictLinksInEditWin2()
Returns dictionnary links formatted as HTML.
createDictLinksInEditWin2(int $lang, string $sentctljs, string $wordctljs) : string
Parameters
-
$lang
: int
-
-
$sentctljs
: string
-
-
$wordctljs
: string
-
-
global
-
string $tbpref Database table prefix
makeDictLinks()
makeDictLinks(mixed $lang, mixed $wordctljs) : string
Parameters
-
$lang
: mixed
-
-
$wordctljs
: mixed
-
createDictLinksInEditWin3()
createDictLinksInEditWin3(mixed $lang, mixed $sentctljs, mixed $wordctljs) : string
Parameters
-
$lang
: mixed
-
-
$sentctljs
: mixed
-
-
$wordctljs
: mixed
-
checkTest()
Return checked attribute if $val is in array $_REQUEST[$name]
checkTest(mixed $val, string $name) : string
Parameters
-
$val
: mixed
-
Value to look for, needle
-
$name
: string
-
-
psalm-return
-
' '|' checked="checked" '
Return values
string
—
' ' of ' checked="checked" ' if the qttribute should be checked.
strToHex()
strToHex(mixed $string) : string
Parameters
-
$string
: mixed
-
strToClassName()
Escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165)
strToClassName(string $string) : string
Parameters
-
$string
: string
-
anki_export()
anki_export(mixed $sql) : never
Parameters
-
$sql
: mixed
-
tsv_export()
tsv_export(mixed $sql) : never
Parameters
-
$sql
: mixed
-
flexible_export()
flexible_export(mixed $sql) : never
Parameters
-
$sql
: mixed
-
mask_term_in_sentence_v2()
mask_term_in_sentence_v2(mixed $s) : string
Parameters
-
$s
: mixed
-
repl_tab_nl()
Replace all white space characters by a simple space ' '.
repl_tab_nl(string $s) : string
The output string is also trimmed.
Parameters
-
$s
: string
-
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_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
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
array{total: array<float|int|string, float|int|null|string>, expr: array<float|int|string, float|int|null|string>, stat: array<float|int|string, array<float|int|string, float|int|null|string>>, totalu: array<float|int|string, float|int|null|string>, expru: array<float|int|string, float|int|null|string>, statu: array<float|int|string, array<float|int|string, float|int|null|string>>}
Return values
array<string|int, array<string|int, array<string|int, float|int|null|string>|float|int|null|string>>
—
Statistics under the form of an array
textwordcount()
Compute and echo word statistics about a list of text ID.
textwordcount(string $textID) : void
It is useful for unknown percent with this fork.
The echo is an output array{0: int, 1: int, 2: int,
3: int, 4: int, 5: int}
Total number of words, number of expression, statistics, total unique,
number of unique expressions, unique statistics
Parameters
-
$textID
: string
-
Text IDs separated by comma
-
global
-
string $tbpref Table name prefix
-
deprecated
-
2.9.0
Use return_textwordcount instead.
texttodocount()
texttodocount(mixed $text) : string
Parameters
-
$text
: mixed
-
texttodocount2()
Return the number of words left to do in this text.
texttodocount2(string|int $textid) : string
Parameters
-
$textid
: string|int
-
-
global
-
string $tbpref Database table prefix
-
since
-
2.7.0-fork
Adapted to use LibreTranslate dictionary as well.
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
-
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
-
-
$limit
: int
= -1
-
Maximum number of sentences to return
Return values
mysqli_result|true
—
getSentence()
Format the sentence(s) $seid containing $wordlc highlighting $wordlc.
getSentence(int $seid, string $wordlc, int $mode) : array<string|int, string>
Parameters
-
$seid
: int
-
-
$wordlc
: string
-
-
$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
-
global
-
string $tbpref Database table prefix.
-
psalm-return
-
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
-
-
$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
-
psalm-return
-
list{0?: array{0: string, 1: string},...}
Return values
array<string|int, array<string|int, string>>
—
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
-
-
$wordlc
: string
-
-
$wid
: int|null
-
-
$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
-
global
-
string $tbpref Database table prefix
Return values
string
—
HTML-formatted string of which elements are candidate sentences to use.
get_languages()
Return a dictionary of languages name - id
get_languages() : array<string, int>
Return values
array<string, int>
getLanguage()
Get language name from its ID
getLanguage(string|int $lid) : string
Parameters
-
$lid
: string|int
-
-
global
-
string $tbpref Table name prefix
getLanguageCode()
Try to get language code from its ID
getLanguageCode(int $lg_id, array<string|int, mixed> $languages_table) : string
Parameters
-
$lg_id
: int
-
-
$languages_table
: array<string|int, mixed>
-
Table of languages, usually LWT_LANGUAGES_ARRAY
-
global
-
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
-
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
-
-
$lid
: string|int
-
-
$wid
: string|int
-
-
$len
: int
-
Number of words in the expression
-
since
-
2.5.0-fork
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
list{array<int, string>, list{0?: string,...}}
Return values
array<string|int, array<string|int, string>>
—
Append text and values to insert to the database
insertExpressionFromMeCab()
Insert an expression to the database using MeCab.
insertExpressionFromMeCab(string $textlc, string $lid, string $wid, int $len, int $mode) : array{: string[], : string[]}
Parameters
-
$textlc
: string
-
Text to insert in lower case
-
$lid
: string
-
-
$wid
: string
-
-
$len
: int
-
Number of words in the expression
-
$mode
: int
-
If equal to 0, add data in the output
-
since
-
2.5.0-fork
Function deprecated.
$mode is unnused, data are always returned.
The second return argument is always empty array.
-
deprecated
-
Use insert_expression_from_mecab instead.
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
array{0: array<int, string>, 1: list}
Return values
array{: string[], : string[]}
—
Append text and SQL array.
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
-
-
$wid
: string|int
-
-
$len
: int
-
Number of words in the expression
-
$mode
: mixed
-
-
since
-
2.5.0-fork
Mode is unnused and data are always added to the output.
-
since
-
2.5.2-fork
Fixed multi-words insertion for languages using no space
-
global
-
string $tbpref Table name prefix
-
psalm-return
-
list{array<int, null|string>, array<never, never>, list{0?: string,...}}
Return values
array<string|int, array<string|int, null|string>>
—
Append text, empty and sentence id
new_expression_interactable()
Prepare a JavaScript dialog to insert a new expression. Use elements in
global JavaScript scope.
new_expression_interactable(mixed $hex, mixed $appendtext, mixed $sid, mixed $len) : void
Parameters
-
$hex
: mixed
-
-
$appendtext
: mixed
-
-
$sid
: mixed
-
-
$len
: mixed
-
-
deprecated
-
Use new_expression_interactable2 instead. The new function does not
use global JS variables.
new_expression_interactable2()
Prepare a JavaScript dialog to insert a new expression.
new_expression_interactable2(string $hex, array<string|int, string> $appendtext, int $wid, int $len) : void
Parameters
-
$hex
: string
-
Lowercase text, formatted version of the text.
-
$appendtext
: array<string|int, string>
-
-
$wid
: int
-
-
$len
: int
-
-
global
-
string $tbpref Database table prefix.
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
-
-
$lid
: string|int
-
-
$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
-
global
-
string $tbpref Table name prefix
Return values
null|string
—
If $mode == 2 return values to insert in textitems2, nothing otherwise.
restore_file()
Restore the database from a file.
restore_file(resource $handle, string $title) : string
Parameters
-
$handle
: resource
-
-
$title
: string
-
-
global
-
string $trbpref Database table prefix
-
global
-
-
global
-
string $dbname Database name
-
since
-
2.0.3-fork
-
since
-
2.5.3-fork
-
since
-
2.7.0-fork
$handle should be for an uncompressed file.
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
-
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
-
since
-
2.9.0
Annotations "position" change, they are now equal to Ti2Order
it was shifted by one index before.
insert_prefix_in_sql()
insert_prefix_in_sql(mixed $sql_line) : mixed
Parameters
-
$sql_line
: mixed
-
create_save_ann()
create_save_ann(mixed $textid) : string
Parameters
-
$textid
: mixed
-
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
-
get_first_translation()
get_first_translation(mixed $trans) : string
Parameters
-
$trans
: mixed
-
get_annotation_link()
get_annotation_link(mixed $textid) : string
Parameters
-
$textid
: mixed
-
trim_value()
Like trim, but in place (modify variable)
trim_value(string &$value) : void
Parameters
-
$value
: string
-
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
-
-
$lang
: string
-
Language code (usually BCP 47 or ISO 639-1)
-
since
-
2.9.0
Any language starting by "ja" or "jp" is considered phonetic.
Return values
string
—
Parsed text in a phonetic format.
refreshText()
Refresh a text.
refreshText(mixed $word, mixed $tid) : string
Parameters
-
$word
: mixed
-
-
$tid
: mixed
-
-
deprecated
-
No longer used, incompatible with new database system.
-
since
-
1.6.25-fork
Not compatible with the database
Create an HTML media player, audio or video.
makeMediaPlayer(string $path[, int $offset = 0 ]) : void
Parameters
-
$path
: string
-
-
$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
-
-
$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
-
-
$offset
: int
= 0
-
Offset from the beginning of the video
Echo a HEAD tag for using with frames
framesetheader(string $title) : void
Parameters
-
$title
: string
-
pagestart()
Write a page header and start writing its body.
pagestart(string $title, bool $close) : void
Parameters
-
$title
: string
-
-
$close
: bool
-
Set to true if you are closing the header
-
since
-
2.7.0
Show no text near the logo, page title enclosed in H1
-
global
-
bool $debug Show a DEBUG span if true
pagestart_nobody()
Start a standard page with a complete header and a non-closed body.
pagestart_nobody(string $title[, string $addcss = '' ]) : void
Parameters
-
$title
: string
-
-
$addcss
: string
= ''
-
Some CSS to be embed in a style tag
-
global
-
string $tbpref The database table prefix if true
-
global
-
int $debug Show the requests if true
letterPairs()
letterPairs(mixed $str) : array<string|int, string>
Parameters
-
$str
: mixed
-
-
psalm-return
-
array<0|positive-int, string>
Return values
array<string|int, string>
wordLetterPairs()
wordLetterPairs(mixed $str) : array<string|int, string>
Parameters
-
$str
: mixed
-
-
psalm-return
-
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
-
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
-
-
$compared_term
: string
-
-
$max_count
: int
-
Maximum number of terms to display
-
$min_ranking
: float
-
-
psalm-return
-
Return values
array<string|int, int>
—
All $max_count wordids with a similarity ranking > $min_ranking,
sorted decending
Prepare a field with a similar term to copy.
format_term(int $termid, string $compare) : string
Parameters
-
$termid
: int
-
-
$compare
: string
-
-
global
-
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
-
-
$compared_term
: string
-
Similar term we compare to
print_similar_terms_tabrow()
Print a row for similar terms if the feature is enabled.
print_similar_terms_tabrow() : void
set_error_reporting()
Starts or not the error reporting.
set_error_reporting(int $dsplerrors) : void
Parameters
-
$dsplerrors
: int
-
not 0: start error reporting for ALL errors
0: don't report
set_configuration_options()
Set configuration values as script limit time and such.
set_configuration_options() : void
start_session()
Start the session and checks for its sanity.
start_session() : void
start_session_main()
Launch a new session for WordPress.
start_session_main() : void
no_connectinc_error_page()
Echo an error page if connect.inc.php was not found.
no_connectinc_error_page() : void
-
since
-
2.7.0-fork
Now display a link to the connect.ing.php creation wizard,
return void instead of dying.
get_span_groups()
Prepare the different SPAN opening tags
get_span_groups() : array<string|int, string>
-
global
-
string $tbpref Database table prefix
-
global
-
string $fixed_tbpref Fixed database table prefix
-
psalm-return
-
list{''|'', string, ''|''}
Return values
array<string|int, string>
—
do_current_text_info()
Display the current text options.
do_current_text_info(mixed $textid) : void
Parameters
-
$textid
: mixed
-
-
global
-
string $tbpref Database table prefix
do_language_selectable()
Echo a select element to switch between languages.
do_language_selectable(mixed $langid) : void
Parameters
-
$langid
: mixed
-
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>>
-
deprecated
-
Use get_server_data_table, will be removed in 3.0.0.
-
psalm-return
-
list{string, float, non-empty-list, string, false|string, string}
-
global
-
string $tbpref Database table prefix
-
global
-
string $dbname Database name
Return values
array<string|int, false|float|string|array<string|int, string>>
—
{0: string, 1: float, 2: string[], 3: string, 4: string, 5: string}
Table prefix, database size, server software, apache version, PHP version, MySQL
version
index_load_warnings()
Load the content of warnings for visual display.
index_load_warnings() : void
index_do_main_page()
Display the main body of the page.
index_do_main_page() : void
-
global
-
string $tbpref Database table prefix
-
global
-
int $debug Debug mode enabled
get_word()
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
Parameters
-
$textid
: string
-
-
$textpos
: string
-
Position of the word in the text.
-
global
-
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
-
-
global
-
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
-
-
$wid
: string|int
-
-
$hex
: string
-
Hexadecimal version of the lowercase word.
-
$textid
: string|int
-
-
global
-
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
-
-
$wid
: string|int
-
-
$hex
: string
-
Hexadecimal version of the lowercase word.
-
$textid
: string|int
-
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
-
-
$textpos
: string
-
Position of the word in the text.
-
since
-
2.0.4-fork
get_word()
Return the word at a specific position in a text.
get_word(string $textid, string $textpos) : string
Parameters
-
$textid
: string
-
-
$textpos
: string
-
Position of the word in the text.
-
global
-
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
-
-
global
-
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
-
-
$wid
: string|int
-
-
$hex
: string
-
Hexadecimal version of the lowercase word.
-
$textid
: string|int
-
-
global
-
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
-
-
$wid
: string|int
-
-
$hex
: string
-
Hexadecimal version of the lowercase word.
-
$textid
: string|int
-
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
-
-
$textpos
: string
-
Position of the word in the text.
-
since
-
2.0.4-fork
restore_demo_db()
Restore demo database from file.
restore_demo_db() : string
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
-
global
-
string $tppref Database table prefix.
long_text_display()
Display the main page for a long tex import.
long_text_display(int $max_input_vars) : void
Parameters
-
$max_input_vars
: int
-
Maximal number of bytes for the text.
-
global
-
long_text_do_page()
Do the main page for the long text import.
long_text_do_page() : void
output_text()
output_text(mixed $saveterm, mixed $saverom, mixed $savetrans, mixed $savetags, mixed $show_rom, mixed $show_trans, mixed $show_tags, mixed $annplcmnt) : void
Parameters
-
$saveterm
: mixed
-
-
$saverom
: mixed
-
-
$savetrans
: mixed
-
-
$savetags
: mixed
-
-
$show_rom
: mixed
-
-
$show_trans
: mixed
-
-
$show_tags
: mixed
-
-
$annplcmnt
: mixed
-
get_wizard_selectoptions()
Returns a dropdown menu of the different languages
get_wizard_selectoptions(mixed $v) : string
Parameters
-
$v
: mixed
-
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
-
-
$newscore
: int
-
-
$oldscore
: int
-
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
-
psalm-return
-
array{total: int, wrong: int, correct: int, nottested: int}
Return values
array<string|int, int>
—
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
-
-
$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
-
-
$status
: int
-
New learning status for the word
-
$oldstatus
: int
-
-
$stchange
: int
-
-1, 0, or 1 if status is rising or not
-
$ajax
: mixed
= false
-
-
global
-
string $tbpref Database table prefix
start_set_text_status()
Start the word status set page.
start_set_text_status() : void
-
global
-
string $tbpref Database table prefix
text_mode_save_settings()
Save text mode settings.
text_mode_save_settings(int $showAll, int $showLearning) : int
Parameters
-
$showAll
: int
-
Whether all word should be shown
-
$showLearning
: int
-
Whether to show translation of learning words
-
psalm-return
-
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
-
-
$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
-
-
global
-
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
-
set_word_status_database()
Edit the term status in the database.
set_word_status_database(string $wid, string $status) : string
Parameters
-
$wid
: string
-
-
$status
: string
-
-
global
-
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
-
-
$wid
: string
-
ID of the word that changed status
-
$status
: string
-
-
$word
: string
-
-
$trans
: string
-
-
$roman
: string
-
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
-
-
$wid
: string
-
ID of the word that changed status
-
$status
: string
-
-
$word
: string
-
-
$trans
: string
-
-
$roman
: string
-
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
-
-
$wordid
: string
-
-
$status
: string
-
-
since
-
2.0.4-fork
markdown_converter()
Convert a markdown file to HTML and return the result.
markdown_converter(string $file_path) : string
Parameters
-
$file_path
: string
-
Full path for the file to use, including extension.
markdown_integration()
Prepapre the integration of a Markdown file into info.html.
markdown_integration(string $file_path) : void
Headers are incremented by one level. File name become an ID.
Parameters
-
$file_path
: string
-
Full path for the file to use, including extension (should be ".md")
minifyJS()
Minify a JavaScript file and outputs the result to js/
minifyJS(string $path, string $outputPath) : string
Parameters
-
$path
: string
-
Input file path with extension.
-
$outputPath
: string
-
Output file path with extension
-
since
-
2.2.2-fork
Relative paths in the returned content is the same as the saved content.
minifyCSS()
Minify a JavaScript file and outputs the result to css/
minifyCSS(string $path, string $outputPath) : string
Parameters
-
$path
: string
-
Input file path with extension.
-
$outputPath
: string
-
Output file path with extension
-
since
-
2.2.2-fork
Relative paths in the returned content is the same as the saved content.
minifyAllJS()
Minify all JavaScript files
minifyAllJS() : string
-
since
-
2.0.3-fork
-
since
-
2.3.0-fork
JS code is "combined" above being minified: only one file is outputted.
minifyAllCSS()
Minify all Cascading-Style Sheet (CSS) files
minifyAllCSS() : void
-
since
-
2.0.3-fork
regenerateSingleTheme()
Regenerate a single theme.
regenerateSingleTheme(string $parent_folder, string $theme_folder) : void
Parameters
-
$parent_folder
: string
-
Path to the parent folder (I. E. src/themes/)
-
$theme_folder
: string
-
regenerateThemes()
Find and regenerate all themes. CSS is minified while other files are copied.
regenerateThemes() : void
Nested folders are ignored.
minify_everything()
One-do-all command to minify all your JS, CSS, and regenerate themes.
minify_everything() : void
start_save_prefix()
Save a database prefix.
start_save_prefix(string $pref) : void
Parameters
-
$pref
: string
-
start_do_page()
Do a short page to edit the database prefix.
start_do_page() : void
-
global
-
string $tbpref Database table prefix
-
global
-
int $fixed_tbpref If the table prefix is fixed and cannot be changed
get_language_code()
Two-letter language code from from language name (e. g. : "English" = > "en" ).
get_language_code(string $language) : string
Parameters
-
$language
: string
-
Language name, for instance "English"
-
ðeprecated
-
Since 2.9.1-fork, use getLanguageCode
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
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, embadable page for text-to-speech settings.
tts_settings_minimal_page() : void
tts_settings_full_page()
Make the complete HTML page for text-to-speech settings.
tts_settings_full_page(string $message) : void
Parameters
-
$message
: string
-
A message to display when page loads.
tts_save_settings()
Save the text-to-speech settings as cookies.
tts_save_settings(array<string|int, mixed> $form) : void
Parameters
-
$form
: array<string|int, mixed>
-
Inputs from the main form.
my_str_getcsv()
Get the CSV from a string.
my_str_getcsv(string $input) : array<string|int, null|string>|false|null
Parameters
-
$input
: string
-
-
psalm-return
-
false|non-empty-list<null|string>|null
-
deprecated
-
2.9.0
This function is no longer used and will be removed
Return values
array<string|int, null|string>|false|null
upload_words_import_simple()
upload_words_import_simple(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status) : void
Parameters
-
$lang
: mixed
-
-
$fields
: mixed
-
-
$columns
: mixed
-
-
$tabs
: mixed
-
-
$file_name
: mixed
-
-
$status
: mixed
-
upload_words_import_complete()
upload_words_import_complete(mixed $lang, mixed $fields, mixed $columns, mixed $tabs, mixed $file_name, mixed $status, mixed $overwrite) : void
Parameters
-
$lang
: mixed
-
-
$fields
: mixed
-
-
$columns
: mixed
-
-
$tabs
: mixed
-
-
$file_name
: mixed
-
-
$status
: mixed
-
-
$overwrite
: mixed
-
upload_words_handle_multiwords()
upload_words_handle_multiwords(mixed $lang, mixed $last_update) : void
Parameters
-
$lang
: mixed
-
-
$last_update
: mixed
-
upload_words_import_terms()
Import terms to the database.
upload_words_import_terms(array<string|int, mixed> $fields, string $tabs, bool $file_upl, array<int, string> $col, int $lang) : string
Parameters
-
$fields
: array<string|int, mixed>
-
-
$tabs
: string
-
-
$file_upl
: bool
-
If the input text is an uploaded file
-
$col
: array<int, string>
-
-
$lang
: int
-
-
global
-
string $tbpref Database table prefix
Return values
string
—
Last word update timestamp
display_imported_terms()
display_imported_terms(mixed $last_update, mixed $rtl) : void
Parameters
-
$last_update
: mixed
-
-
$rtl
: mixed
-
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>
-
-
$tabs
: string
-
-
$file_upl
: bool
-
If the input text is an uploaded file
-
global
-
string $tbpref Database table prefix
upload_words_import()
Import terms of tags to the database.
upload_words_import() : void
-
global
-
string $tbpref Database table prefix
upload_words_display()
Display the main for adding new words.
upload_words_display() : void