/plugins/squirrelspell/sqspell_functions.php

Description

sqspell_functions.php

All SquirrelSpell-wide functions are in this file.

Includes
include_once (SM_PATH.'plugins/squirrelspell/setup.php') (line 29)

Workaround for including function squirrelspell_version() in SM 1.5 CVS, where plugins' setup.php is not included by default.

include_once (SM_PATH.'plugins/squirrelspell/sqspell_config.php') (line 23)

load plugin configuration

  • todo: allow storing configuration file in config/ directory
Variables
string $SQSPELL_VERSION (line 908)

SquirrelSpell version. Don't modify, since it identifies the format

of the user dictionary files and messing with this can do ugly stuff. :)

  • deprecated:
Functions
sqspell_check_version (line 817)

Used to check internal version of SquirrelSpell dictionary

  • return: true if stored dictionary version is $major.$minor or newer
  • since: 1.5.1 (sqspell 0.5)
boolean sqspell_check_version (integer $major, integer $minor)
  • integer $major: main version number
  • integer $minor: second version number
sqspell_ckMOD (line 800)

This function checks for security attacks. A $MOD variable is

provided in the QUERY_STRING and includes one of the files from the modules directory ($MOD.mod). See if someone is trying to get out of the modules directory by providing dots, unicode strings, or slashes.

  • return: since it bails out with an access error if needed.
void, sqspell_ckMOD (string $rMOD)
  • string $rMOD: the name of the module requested to include.
sqspell_crypto (line 313)

Encryption function used by plugin

This function does the encryption and decryption of the user dictionary. It is only available when PHP is compiled with mcrypt support (--with-mcrypt). See doc/CRYPTO for more information.

  • return: content, or "PANIC" if the process bails out.
encrypted/decrypted sqspell_crypto ($mode $mode, $ckey $ckey, $input $input)
  • $mode $mode: A string with either of the two recognized values: "encrypt" or "decrypt".
  • $ckey $ckey: The key to use for processing (the user's password in our case.
  • $input $input: Content to decrypt or encrypt, according to $mode.
sqspell_crypto_old (line 249)

Encryption function used by plugin (old format)

This function does the encryption and decryption of the user dictionary. It is only available when PHP is compiled with mcrypt support (--with-mcrypt). See doc/CRYPTO for more information.

  • return: content, or "PANIC" if the process bails out.
  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
encrypted/decrypted sqspell_crypto_old ($mode $mode, $ckey $ckey, $input $input)
  • $mode $mode: A string with either of the two recognized values: "encrypt" or "decrypt".
  • $ckey $ckey: The key to use for processing (the user's password in our case.
  • $input $input: Content to decrypt or encrypt, according to $mode.
sqspell_deleteWords (line 753)

Deletes user's dictionary

Function was modified in 1.5.1 (sqspell 0.5). Older function is suffixed with '_old'

void sqspell_deleteWords (string $lang)
  • string $lang: dictionary
sqspell_deleteWords_old (line 763)

Deletes user's dictionary when it is corrupted.

  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
void sqspell_deleteWords_old ()
sqspell_getLang (line 482)

Get user dictionary for selected language Function was modified in 1.5.1 (sqspell 0.5).

Older function is suffixed with '_old'

void sqspell_getLang (string $lang, array 1)
  • string $lang: language
  • array 1: words stored in selected language dictionary
sqspell_getLang_old (line 553)

Get user's dictionary (old format)

This function returns only user-defined dictionary words that correspond to the requested language.

  • return: list of words corresponding to the language requested.
  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
The sqspell_getLang_old ($words $words, $lang $lang)
  • $words $words: The contents of the user's ".words" file.
  • $lang $lang: Which language words to return, e.g. requesting "English" will return ONLY the words from user's English dictionary, disregarding any others.
sqspell_getSettings (line 394)

gets list of available dictionaries from user's prefs.

Function was modified in 1.5.1 (sqspell 0.5). Older function is suffixed with '_old'

  • return: list of dictionaries used by end user.
array sqspell_getSettings ()
sqspell_getSettings_old (line 436)

Get list of enabled languages.

Right now it just returns an array with the dictionaries available to the user for spell-checking. It will probably do more in the future, as features are added.

  • return: a strings array with dictionaries available to this user, e.g. {"English", "Spanish"}, etc.
  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
array sqspell_getSettings_old (string $words)
  • string $words: The contents of the user's ".words" file.
sqspell_getWords_old (line 585)

Saves user's dictionary (old format)

This function operates the user dictionary. If the format is clear-text, then it just reads the file and returns it. However, if the file is encrypted (well, "garbled"), then it tries to decrypt it, checks whether the decryption was successful, troubleshoots if not, then returns the clear-text dictionary to the app.

  • return: contents of the user's ".words" file, decrypted if necessary.
  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
the sqspell_getWords_old ()
sqspell_handle_crypt_panic (line 838)

Displays form that allows to enter different password for dictionary decryption.

If language is not set, function provides form to handle older dictionary files.

  • since: 1.5.1 (sqspell 0.5)
void sqspell_handle_crypt_panic ([string $lang = false])
  • string $lang: language
sqspell_makeDummy (line 782)

Creates an empty user dictionary for the sake of saving prefs or whatever.

  • return: template to use when storing the user dictionary.
  • deprecated:
The sqspell_makeDummy ()
sqspell_makePage (line 124)

This function is the GUI wrapper for the options page. SquirrelSpell uses it for creating all Options pages.

void sqspell_makePage (string $title, string $scriptsrc, string $body)
  • string $title: The title of the page to display
  • string $scriptsrc: This is used to link a file.js into the <script src="file.js"></script> format. This allows to separate javascript from the rest of the plugin and place it into the js/ directory.
  • string $body: The body of the message to display.
sqspell_makeWindow (line 191)

Function similar to the one above. This one is a general wrapper for the Squirrelspell pop-up window. It's called form nearly everywhere, except the check_me module, since that one is highly customized.

void sqspell_makeWindow (string $onload, string $title, string $scriptsrc, string $body)
  • string $onload: Used to indicate and pass the name of a js function to call in a <body onload="function()" for automatic onload script execution.
  • string $title: Title of the page.
  • string $scriptsrc: If defined, link this javascript source page into the document using <script src="file.js"> format.
  • string $body: The content to include.
sqspell_saveSettings (line 418)

Saves user's language preferences

  • since: 1.5.1 (sqspell 0.5)
void sqspell_saveSettings (array $langs)
  • array $langs: languages array (first key is default language)
sqspell_upgradeWordsFile (line 371)

This function transparently upgrades the 0.2 dictionary format to the 0.3 format, since user-defined languages have been added in 0.3 and the new format keeps user dictionaries selection in the file.

This function will be retired soon, as it's been a while since anyone has been using SquirrelSpell-0.2.

  • return: of the 0.3-style user dictionary.
  • deprecated:
Contents sqspell_upgradeWordsFile ($words_string $words_string)
  • $words_string $words_string: Contents of the 0.2-style user dictionary.
sqspell_writeWords (line 664)

Saves user's dictionary Function was replaced in 1.5.1 (sqspell 0.5).

Older function is suffixed with '_old'

void sqspell_writeWords (array $words, string $lang)
  • array $words: words that should be stored in dictionary
  • string $lang: language
sqspell_writeWords_old (line 701)

Writes user dictionary into the $username.words file, then changes mask to 0600. If encryption is needed -- does that, too.

  • deprecated:
  • since: 1.5.1 (sqspell 0.5)
void sqspell_writeWords_old ($words $words)
  • $words $words: The contents of the ".words" file to write.
squirrelspell_optpage_block_function (line 38)

Register option page block (internal function)

  • since: 1.5.1 (sqspell 0.5)
void squirrelspell_optpage_block_function ()
squirrelspell_setup_function (line 59)

This function adds a "Check Spelling" link to the "Compose" row during message composition (internal function).

  • since: 1.5.1 (sqspell 0.5)
void squirrelspell_setup_function ()
squirrelspell_upgrade_function (line 87)

Upgrade dictionaries (internal function)

Transparently upgrades user's dictionaries when message listing is loaded

  • since: 1.5.1 (sqspell 0.5)
void squirrelspell_upgrade_function ()

Documentation generated on Mon, 13 Jan 2020 04:23:34 +0100 by phpDocumentor 1.4.3