|
Learning with Texts - Fork 2.4.0-fork
Learn foreign languages with texts
|
Core utility functions that do not require a complete session. More...
Namespaces | |
| namespace | Lwt |
Functions | |
| get_version () | |
| get_version_number () | |
| tohtml ($s) | |
| showRequest () | |
| get_execution_time () | |
| get_setting_data () | |
| remove_spaces ($s, $remove) | |
| get_mecab_path ($mecab_args='') | |
| find_latin_sentence_end ($matches, $noSentenceEnd) | |
| my_die ($text) | |
| quickMenu () | |
| pageend () | |
| echodebug ($var, $text) | |
| get_statuses () | |
| str_replace_first ($needle, $replace, $haystack) | |
| annotation_to_json ($ann) | |
| getreq ($s) | |
| getsess ($s) | |
| url_base () | |
| make_score_random_insert_update ($type) | |
| getsqlscoreformula ($method) | |
Core utility functions that do not require a complete session.
| annotation_to_json | ( | $ann | ) |
Convert annotations in a JSON format.
| string | $ann | Annotations. |
| echodebug | ( | $var, | |
| $text | |||
| ) |
Debug function only.
| mixed | $var | A printable variable to debug |
| string | $text | Echoed text in HTML page |
@global bool $debug This functions doesn't do anything is $debug is false.
| find_latin_sentence_end | ( | $matches, | |
| $noSentenceEnd | |||
| ) |
Find end-of-sentence characters in a sentence using latin alphabet.
| string[] | $matches | All the matches from a capturing regex |
| string | $noSentenceEnd | If different from '', can declare that a string a not the end of a sentence. |
| get_execution_time | ( | ) |
Get the time since the last call
| get_mecab_path | ( | $mecab_args = '' | ) |
Returns path to the MeCab application. MeCab can split Japanese text word by word
| string | $mecab_args | Arguments to add |
| get_setting_data | ( | ) |
Reload $setting_data if necessary
| get_statuses | ( | ) |
Return an associative array of all possible statuses
| get_version | ( | ) |
Return LWT version for humans
Version is hardcoded in this function. For instance 1.6.31 (October 03 2016)
@global bool $debug If true adds a red "DEBUG"
| get_version_number | ( | ) |
Return a machine readable version number.
| getreq | ( | $s | ) |
Get a request when possible. Otherwise, return an empty string.
| string | $s | Request key |
| getsess | ( | $s | ) |
Get a session variable when possible. Otherwise, return an empty string.
| string | $s | Session variable key |
| getsqlscoreformula | ( | $method | ) |
SQL formula for computing score.
| int | $method | Score for tomorrow (2), the day after it (3) or never (any value). |
@psalm-return ' GREATEST(-125, CASE WHEN WoStatus > 5 THEN 100 WHEN WoStatus = 1 THEN ROUND(-7 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 2 THEN ROUND(6.9 - 3.5 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 3 THEN ROUND(20 - 2.3 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 4 THEN ROUND(46.4 - 1.75 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 5 THEN ROUND(100 - 1.4 * DATEDIFF(NOW(),WoStatusChanged)) END)'|' GREATEST(-125, CASE WHEN WoStatus > 5 THEN 100 WHEN WoStatus = 1 THEN ROUND(-7 -7 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 2 THEN ROUND(3.4 - 3.5 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 3 THEN ROUND(17.7 - 2.3 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 4 THEN ROUND(44.65 - 1.75 * DATEDIFF(NOW(),WoStatusChanged)) WHEN WoStatus = 5 THEN ROUND(98.6 - 1.4 * DATEDIFF(NOW(),WoStatusChanged)) END)'|'0'
| make_score_random_insert_update | ( | $type | ) |
Make a random score for a new word.
| 'iv'|'id'|'u'|string | $type Type of insertion |
| my_die | ( | $text | ) |
Make the script crash and prints an error message
| string | $text | Error text to output |
| pageend | ( | ) |
Add a closing body tag.
@global bool $debug Show the requests if true @global float $dspltime Total execution time since the PHP session started
| quickMenu | ( | ) |
Display the main menu of navigation as a dropdown
| remove_spaces | ( | $s, | |
| $remove | |||
| ) |
Remove all spaces from a string.
| string | $s | Input string |
| string | $remove | Do not do anything if empty |
| showRequest | ( | ) |
Echo debugging informations.
| str_replace_first | ( | $needle, | |
| $replace, | |||
| $haystack | |||
| ) |
Replace the first occurence of $needle in $haystack by $replace
| string | $needle | Text to replace |
| string | $replace | Text to replace by |
| string | $haystack | Input string |
| tohtml | ( | $s | ) |
Escape special HTML characters.
| string | $s | String to escape. |
| url_base | ( | ) |
Get the base URL of the application