Class SpellCheckButton


200px The SpellCheckButton class adds a button to the page that, when clicked, causes spellchecking to start.

The SpellCheckButton class can render as a button , link or image using each of the SpellButton, SpellImageButton or SpellLink Methods.

Spell checking can be "In Situ" (with red wiggly underlines) or in a popup window by setting the CheckInSitu property.


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

150px

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

CheckGrammar

right

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

CheckInSitu

  • Tells the SpellCheckButton to spellcheck in the textarea context using red wiggle underlines and a context menu.
  • This is similar to As-You-Type behavior except that the document is only spell-checked when the users clicks the SpellButton.
  • This style of spellchecking only works for HTML textarea elements.
  • If set false - the SpellCheckButton will open a spellchecking dialog in a popup window instead.
    • (bool) [Default: false]

Fields

  • The Fields property tells the spellchecker which HTML elements such as inputs and text-areas to spell-check.
  • Fields are referenced by their id attribute.
  • Any element with a value or innerHTML attribute may be spell checked.
  • You can spell-check multiple controls using a comma delimited string ("field1,field2,field3") or array.
  • You can spell-check all Text-Areas, Inputs and HTML Editors by settings Fields to "ALL"
  • You can spell-check all non-disabled, editable fields by settings Fields to "ENABLED"
  • You can spell-check all Text-Areas by setting Fields to "TEXTAREAS"
  • You can spell-check all Inputs of type text by setting Fields to "TEXTINPUTS"
  • You can spell-check all Rich HTML (WYSIWYG) editors setting Fields to "EDITORS"
  • You can spell-check the contents of any iframe by setting Fields to "IFRAME:0", "IFRAME:1" ..based on the frames index within the documents Frames collection.
  • *(string) [Default: "ALL"]

FormToSubmit

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

150px

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

IgnoreNumeric

150px

  • 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

150px

  • 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 (USA), Espanol"
    • This allows more than 1 language to be checked at the same time for multi-lingual documents.
    • (string) [Default: "English (International)"]

UserInterfaceLanguage

150px

  • 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"]

ShowSummaryScreen

150px

  • Shows a summary of spell-checker statistics when the spelling window is complete.
  • When set false - the spellchecker window will always close its self when spell-checking is done.
    • (bool) [Default: true]

Setup Properties

Class

  • Applies a CSS class to your button
    • (string) [Default: ""]

CSSTheme

  • Selects a themes for your spellchecker's window/context menu.
  • The Custom Styles And Themes tutorial explains this in depth.
    • (string) [Default: "classic"]

Image

  • Sets the URL of an image used to render the SpellImageButton.
  • The URL is relative to the current PHP page unless a full path starting with a / is given.
  • If no value is set - the image chosen will be /phpspellcheck/themes/buttons/spellicon.gif

ImageRollOver

  • Sets the URL of an image used to render the SpellImageButton's rollover state.
  • The URL is relative to the current PHP page unless a full path starting with a / is given.
  • If no value is set - there will normally be no rollover effect.
    • However, if the Image property is also blank the rollover will default to /phpspellcheck/themes/buttons/spelliconover.gif
    • (string) [Default: ""]


MeaningProvider

  • URL used to provide the meanings and thesaurus of words is ShowMeanings is set to true.
  • {word} in the URL is replaced by the current word in the spellchecker suggestions box.

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"]

ShowMeanings

150px

  • Shows a "Lookup meaning..." link in the spellchecking window.
  • Also see MeaningProvider
    • (bool) [Default value: true]

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]

Style

  • Applies a CSS style attribute to your SpellCheckButton.
    • (string) [Default value: ""]

Text

right

  • Text for your spell check button.
  • If using an image button, this text will be used for the ALT hover help.
    • (string) [Default value: "Spell Check"] (translated in accordance with your UserInterfaceLanguage)

UndoLimit

  • Sets the maximum number or undo steps for the spell-checker at client.
    • (int) [Default value: 20]

WindowMode

  • If set to "modal" the spell-checker window will appear above all others and be tied to the parent page. The window will behave as a mode-less dialog where available and a modal dialog otherwise.
  • If set to "popup" the spellchecker window will pop-up in a new browser window,
    • (string) [Default value: "modal"]

Methods

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

SpellButton()

right

  • Returns a string for the (X)HTML used to render a spellcheck form button.
  • The buttons value text is set by the Text property.
    • arguments: none
    • returns: (string)

SpellImageButton()

right

  • Returns a string for the (X)HTML used to render a spellchecker image button.
  • The button image is set by the Image property.
  • The rollover image is set by the ImageRollOver property.
    • arguments: none
    • returns: (string)

SpellLink()

right

  • Returns a string for the (X)HTML used to render a spellchecker anchor link.
  • The link text is set by the Text property.
    • arguments: none
    • returns: (string)