Spelling Checker plugin for WordPressSpelling Checker plugin for WordPress

IMPORTANT NOTE FOR WORDPRESS 2.0 USERS

This plugin doesn’t play well in WordPress 2.0. I’m well aware of this. Some day I may update it but it is nowhere near the top of my priority list. Support questions for 2.0 installations will not make it out of moderation.

[image]

UPDATED: 06/23/05, 10:00AM EST

What is it?

The Spelling Checker plug-in for WordPress provides a built-in facility for spelling checks on posts from within the administration pages as well as spelling checks on comments via simple calls added to your templates. It requires no changes to the WordPress code-base to use, you merely drop it in to the plug-ins folder and enable it in the interface. This version has been tested on WordPress 1.5.1.2.

[image]

Requirements

This plugin requires WordPress version 1.5 or later running on a Unix host with an appropriate aspell Unix executable available.

How do I install it?

Please note, these instructions have changed slightly! If you’re upgrading, make sure to read carefully.

The easiest way to install the plugin is to use the One-Click Install option of the WordPress Plugin Manager Otherwise, download the zip file and follow the “README\_INSTALL.txt” direction, or the tarball, copy it to your “wp-content/” folder in your WordPress installation, then execute “tar xvzf spell-plugin.tar.gz”. Note that you should chmod the PHP files to 755. The plugin must be enabled from the plugins page, then you must visit the Spell Checker options page at least once before the plugin will be finally enabled. Follow the appropriate link in the Spell Checker entry of the Plugins page.

How do I use it?

On the “Write Post” page there should be a new button called “Check Spelling”. Click it. You will get a new window that performs the spelling checking. Note that you must have Javascript enabled for this to work. You must also have the “aspell” executable on your hosting machine for this to work as that is the spelling service provider used.

If I like it…

Please note, if you find this or any of my plugins useful and feel the need to express your appreciation, I accept donations with a difference. Click the banner below to learn more.

How do I enable people to spell check their comments?

Adding the ability for your readers to check the spelling of their comment text has never been easier, though it may reduce your enjoyment of their inadvertently incorrect spellings. Simply modify your comments template to call the following function somewhere within it (this inserts the necessary Javascript for opening the spelling checker window):

<?php spell_insert_headers();?>

For default WordPress installations, you need no parameters. If for whatever reason your textarea is a different id than the default “comment” id, you can specify that id as a parameter to this call, for example:

<?php spell_insert_headers("differentcommentid");?>

Now, the only thing left to do is insert the following code where you want the “Check Spelling” button to appear:

<?php spell_insert_comment_button();?>

For more flexibility you can specify the following parameters to this function:

$button_class - If so desired, you can apply a class specifier to the resulting button. Leaving this as the default causes no class to be specified. For instance, to specify a class of “buttonclass”, simply specify “buttonclass” as the first parameter to the function. $tabindex - To enhance usability, you can specify a tabindex to include in the button declaration. If undeclared, no tabindex is specified. Note that if you don’t wish to specify a class you must pass an empty string ('’) as the first parameter. As an example to specify a tabindex of 4 with no class, call the function as follows:
<?php spell_insert_comment_button( '', "4" );?>

For more flexibility you can add words to the dictionary so that they are not marked as misspelled. By default only people who are registered users of your blog and are logged in and have a user level greater than 8 can add words to the dictionary. This is a security feature so that people can’t add nonsense to your dictionary. People who do not meet these requirements will simply not have an “Add” button on the form. You can modify this behavior with the from the Spell Checker options administration page.

Special thanks

This code is merely a mild reworking of the Speller Pages project on Source Forge to work within the confines of the WordPress plug-in framework. All credit for the actual spelling checker goes to them. The method of getting the functionality into the interface without code changes was inspired by the RunPHP plugin. Options administration inspired by Spam Karma.

FAQ

Q. I get an error when try to check the spelling and it says something like “The required field ‘name’ is missing.” What do I do? A. That indicates that the language setting you have selected — it defaults to en_US — is not appropriate for your aspell installation. Just going by eyeballing statistics, my first suggestion would be to try setting the language to “english” (don’t copy the quotes, just the word) and if that still causes problems, cut it back to “en”. If neither work ask you hosting provider for the appropriate setting for their aspell installation.

Q. I get blank windows in the spelling checker box. Why? A. It’s likely you either don’t have the ‘aspell’ executable or the path to it is not correctly configured. To find out, get a shell to your host and perform a “which aspell”. If it tells you there is no such thing install it if possible. If it provides a path (something like ‘/usr/local/bin/aspell’) then open the Spell Checker options administration page and make sure the path matches. When you first install the plugin, this is precisely how the plugin determines the location of the aspell executable.

Q. I get errors in Internet Explorer that say something like “Error: Object expected” on Line 44. A. This is another case of an aspell path problem. See the previous question for details.

Q. I don’t get a button. Instead it says something about “safe_mode”. A. Servers that run PHP in safe_mode sometimes do not allow execution of executables in certain ways. Unfortunately, this plugin requires the execution of the aspell executable to do its work. Until the author figures out a way around it, there is no support for hosts that run PHP in safe_mode. Sorry. The current version checks for safe_mode and refuses to even try to run, just to save some support questions.

Q. I don’t see an “Add” button on my checker! A. By default you must be logged in to your WordPress installation and the user you log in as must have a user level of 8 before you see an “Add” button. You can modify this behavior with the from the Spell Checker options administration page.

Q. My “Add” button grays out and changes to “Adding…” when I add a word and then never comes back. Q. I get a failure when adding a word to the dictionary. A. Something is probably not configured correctly for your particular “aspell” installation. I gave a best first approximation of the command to add words to dictionaries, but aspell has many versions and may have a different set of parameters for you. First, check in the “wp-content/spell-plugin/” directory for a file called “add_failed.out”. It should have some data for you. Try to determine what happened and perhaps experiment with your aspell installation and determine the correct parameters.

Q. It doesn’t work! I get the “Spell check in progress…” indication in the popup window, but then just a blank page. A. This is a permissions problem with the personal dictionary. Open the Spell Checker options administration page and change the location of the personal dictionary to be a place where the Apache web server can write. Note that to specify, for instance, your home directory, you must provide the full path to that directory, as the web server generally runs under a different user id.

Q. I get failures (of various kinds) when trying to add a word to the dictionary and I’m running WordPress 1.2.1. A. If you leave the options at the default — especially the security option that users must be logged in to the blog in order to add words — you will likely fail to add words in WordPress 1.2.1. This is a problem with a relative path in the wp-admin/auth.php file that the plugin uses to log you in. To fix, I highly recommend you upgrade to 1.2.2 as soon as possible.

If all else fails and you never wind up with an aspell personal dictionary (by default created at “wp-content/plugins/spell/aspell.personal”) or you determine that your version of aspell doesn’t support creation or merging of personal dictionaries — yes, this does happen — there’s one last thing to try. Open the Spell Checker options administration page and enable the “Enable manual personal dictionary handling for broken aspell installations” option. This will turn on some functionality that will circumvent the aspell personal dictionary creation and merging functions and handle that inside the plugin.

I have a problem!

Sorry. Please post any bug reports here. There are currently 457 comments about this plugin.

Version History

Version 1.18 06/23/05

Finally dropping the “beta” moniker since it’s been out for 7 months. Added support for words with apostrophes in them to be added to personal dictionary.

Beta 1.17 03/14/05

Spell Check button now appears in the correct place on the Edit Comments page. Requires WordPress 1.5.1 nightly build for correct placement, but is no worse than 1.16 if you’re running straight 1.5 Strayhorn.

Beta 1.16 02/21/05

Fix to make the previous fix work. Imagine elaborate sighing.

Beta 1.15 02/15/05

Fix for working in WordPress installations in which the siteurl and the WordPress installation URL do not match in 1.5.

Beta 1.14 02/14/05

Made a change required for plugin to work correctly in 1.5 Gamma nightlies following a certain auth change. I love those.

Beta 1.13 02/06/05

Another adjustment of the same nature.

Beta 1.12 02/05/05

Minor fix to help those with PHP installations that have open\_basedir defined and where open\_basedir doesn’t include the directory where the aspell executable is located.

Beta 1.11 1/24/05

Spell checking now available for the WordPress posting bookmarklet. A single link for configuration following One-Click installs (redirect for 1.3/1.5 users). Beefed up the checking for the aspell executable. If we don’t have a valid executable, don’t enable the plugin. Will hopefully ease support problems at least.

Beta 1.1 1/20/05

New configuration screen to ease configuration and maintenance of the personal dictionary. Support for WordPress Plugin Manager and One-Click installs.

Alpha 0.9 12/16/04

Manual creation and merging of personal dictionaries to correct problems seen in certain broken aspell installs.

Alpha 0.8 12/15/04

Minor update for improved feedback on adding words.

Alpha 0.7 12/15/04

Added support for adding words to the user dictionary from the checker form. Now spell check your static pages in WordPress 1.3. Improved path derivation to hopefully solve the rest of the problems people were having.

Alpha 0.6 12/13/04

Added support for checking the spelling in comments. Inspiration by Shelley.

Alpha 0.5 12/11/04

Made this plugin compatible with the HTMLArea WYSIWYG editor plugin. Note that in order for the spelling checker to function correctly with HTMLArea, you must switch to tag mode before checking spelling. You may switch back once checking is complete. Failure to do so will surely confuse you.

Alpha 0.4 12/10/04

To try to correct personal dictionary problems, now we actually create the personal dictionary from a word list before first use. Added check for PHP safe\_mode. If safe\_mode is on we don’t even attempt to run.

Alpha 0.3 12/10/04

Corrected problem that affected some people using ssh\_cgiwrap (wrapper munged the $\_SERVER[”SCRIPT\_NAME”] variable). Added support for personal dictionary usage and added some XHTML tags so that they won’t be marked as misspelled. Started framework for future “add to dictionary” functionality. I have a dream.

Alpha 0.2 12/09/04

“Check Spelling” button located in correct place in Simple panel. Was located at the bottom of the page for Simple and in the appropriate location in Advanced. Hopefully improved handling of WordPress installations in subdirectories. Support for Ryan Meyers’ WP Plugin Update Detect project. With Ryan’s project installed you can automatically detect updates to this plugin.

Alpha 0.1 12/08/04

Initial release
Digg!


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser