Class SpellAsYouType


200px The SpellAsYouType provides inline - contextual spell-checking in your text-areas.

The SpellAsYouType allows you to automatically spellcheck HTML textareas "In Situ" with red wiggly underlines. The spelling is revalidated every time the user changes the field value or stops typing.

Due to our unique smart browser client - this process is typically low on band-with and server resources.


Key Properties

AddWordsToDictionary

  • Determines where words that users 'Add to Dictionary' will be stored.
    • "USER" saves to a local cookie in the user's browser cache - only 1 user is affected.
    • "SERVER" stores the words on a file on the server - all users share this central dictionary. To enable this feature you must edit "phpspellcheck/core/index.php and set $SaveToCentralDictionary = true; on line 10.
    • "NONE" disables the 'Add to Dictionary' feature and removed the button.
      • (String) [Default: "USER"]


CaseSensitive

  • Considers the CaSe of a word when spell checking.
    • (bool) [Default: true]

CheckGrammar

  • Considers basic structural grammar such as repeated words & Sentence case
    • (bool) [Default: true]

Fields

  • The Fields property tells the spellchecker which text areas spell-check.
  • Fields are referenced by their id attribute.
  • You can spell-check multiple controls using a comma delimited string ("field1,field2,field3") or array.
  • You can spell-check all Text-Areas by settings Fields to "ALL" or "TEXTAREAS"
  • You can spell-check all non-disabled, editable fields by settings Fields to "ENABLED"
  • *(string) [Default: "ALL"]

ID (Read Only)

  • The JavaScript ID of the LiveSpellInstance created to implement your SpellCheckButton.
  • Useful for integration with the JavaScript API
    • (string) Example value: "PHPLiveSpell_1"

IgnoreAllCaps

  • ignores FULLY CAPITALIZED WORDS, which are often abbreviations.
    • (bool) [Default: true]

IgnoreNumeric

  • Instructs the spell-checker to ignore words containing numbers such as "#BTS787" or "8Ball".
  • The spellchecker is always aware of XML and HTML markup, URLs and e-mail addresses - and will remain so even if IgnoreNumeric is set false
    • (bool) [Default: true]


Installation Path

  • Path to the PHPSpellCheck installation directory.
  • This is normally "/phpspellcheck/" within your website.
    • (string) [Default:"/phpspellcheck/"]

Language

right

  • Language instructs the spell-checker which Dictionary to use.
  • Dictionaries must be downloaded and installed to your DictionariyPath directory - normally "/phpspellcheck/dictionaries"
  • Many international dictionaries are available as well as Medical, Scientific and Legal Dictionaries.
  • Multiple dictionaries may be specified in a comma separated format
    • E.g. "English (International), Francias"
    • This allows more than 1 language to be checked at the same time for multi-lingual documents.
    • (string) [Default: "English (International)"]

UserInterfaceLanguage

100px

  • Sets the User Interface Language which automatically translates the spell checker context menus, buttons and text.
  • This allows you to deploy the speller UI globally
    • (string) [Default: "en"]

Setup Properties

Delay

  • Sets the wait period in milliseconds between the user finishing typing and the spelling validation request being sent to the server.
  • Higher numbers reduce user performance, but make fewer requests on the web server.
    • (int) [Default value: 888]

SettingsFile

  • Select the PHP Settings File that will be used by spellchecker.
  • This allows you to control the spellchecker's behavior at a low level - including custom dictionaries from SQL, Arrays ,Text Files or URLS.
    • (string) [Default value: "default-settings"]

Strict

  • Disallows a user from ignoring Banned Words and Enforced Corrections
  • Useful as a "legal checker" and where tightly enforced restriction of profanity or inappropriate abbreviations is necessary.
    • (bool) [Default value: true]

Methods

Activate()

  • Returns a string for the (X)HTML used to render the As-You-Type provider to the web page.
    • returns (string) of the HTML to be echoed to the page to enable the As-You-Type provider .

HideButton (buttonId)

  • Allows you to Hide a UI button from the users spelling context menu and the spelling window dialog.
    • arguments (string) buttonId
    • returns: null