The Spell Checking helper provides some simple functions for use with third party spell checking libraries. Using Aspell on the server (which can be configured by using the setAspellPath() function below or setting the DIR_FILES_BIN_ASPELL constant.)
Loading the Helper
$sh = Loader::helper(‘spellchecker’);
Methods
$sh->enabled()
Returns true of spell checking is enabled.
$sh->setAspellPath($path)
Sets the path of the Aspell binary.
$sh->init()
Prints out the spellchecker CSS and JavaScript calls.
$response = $sh->findMisspellings($string)
Walks the $string for mispellings and highlights them with relevant span tags.
$json = $sh->getSuggestionPairsJSON()
After running findMispellings, this can return a JSON array of all suggestions.
Loading Conversation