Recent Topics

New spell check plugin that actually works

Started by on May 31, 2006 – Contents updated: May 31, 2006

May 31, 2006 06:48    

As EdB has [url=http://forums.b2evolution.net/viewtopic.php?t=6342]pointed out[/url], the spell check plugin that ships with b2evolution hasn't worked for a while. YaBBa, stk and I made one that actually works. And what's more, it works a whole lot better than the other one ever did, even at its best.

* AJAX-powered so that it works with no page reload (think gmail)
* Multiple languages: Dansk, Deutsch, English, Español, Français, Italiano, Nederlands, Polski, Português, Suomi and Svenska.
* Works for comments, too.
* GPL'd. Free as in beer and free as in speech.
* Works for 1.6-alpha and 1.8

This is based on [url=http://amix.dk/projects/?page_id=3]GoogieSpell[/url], written by Amir Salihefendic, which is based on the Google Spell check api. You can try out a demo at the link below and download it for your version of b2evolution. What are you waiting for, go get it:

[url=http://b2evo.astonishme.co.uk/index.php?title=google_spell_checker]Google Spell[/url] by AstonishMe

May 31, 2006 07:06

Sorry, there is no post to display...

May 31, 2006 07:37

John wrote:

Sorry, there is no post to display...

Sorted.

Just some minor technical difficulties. :oops: (If you were a member, you wouldn't have had a problem :| )

Thanks for letting us know. ;)

And I want to live where Danny lives, cause beer ain't free up here. 8|

Go OILERS Go!

May 31, 2006 08:29

Scott, I just visited the site and there are some browser issues, or else still some start up bugs.
Firefox 2.0.a3 ( which has Google Spell installed as default) just sits there while the throbber spins.
Opera 9 doesn't even show the spell checker button.
IE7b2 gives the same result as Firefox 2.0a3

I changed my FF User Agent to a lot of alternatives but to no avail...

So, it could be these bleeding edge browsers or it could be something else :)

May 31, 2006 08:42

John,

Just returned to leave you a note that the demo isn't functioning (we had to do a tad of hacking to allow the JS in the post, as a demo and I think that moving the post into another blog - to make it visible - has killed it). I tested BEFORE I moved the post and it was working, I swear. :|

If you want to try a bit of a demo now, I have it running in COMMENTS on a v1.6 install (and have had for about a month, with no reported issues). You can cut and paste a bunch of text into the textbox and spell check it, without ever pressing "send" ... if you do accidentally press send, I can always delete it ... so have a play.

You've got way newer browser versions than we test on, so that may be a factor (at least, I've not tested with IE7b or FF2 or O9).

I'm sure we'll get the demo sorted soon. (Thanks for your patience and letting us know about it).

May 31, 2006 09:32

The demo should now be cured ;)

¥

May 31, 2006 10:10

The demo should now be cured

Sure is :)
Apart from IE7b2 error popup

May 31, 2006 10:16

Cool, so can we add "tested in Firefox 2.0.a3, Opera 9 and IE7b2" to our list?

¥

*edit*
lol, what's the popup error?

May 31, 2006 10:25

IE7b2 "Error encountered - undefined!

You can only add Firefox

Opera 9 still doesn't show the CHeck Spelling button on the demo box, however it does show the controls on the comment preview, BUT...
there is no text in the Preview box, it does however SpellCheck within the Posting box..

Theres a little challenge :)

May 31, 2006 10:32

I'm pretty sure that the IE & Opera errors are specific to our blog and the demo.

I've temporarily disabled the demo, does that cure things?

The comment preview is just a toy I'm playing with, there's far more faults with it than just that ;)

¥

May 31, 2006 10:58

No error in IE7...
Opera9 , no spellcheck button on the demo but it does show the preview text however it still corrects the posting text in the Comments section.

May 31, 2006 11:18

ok, just re-enabled the demo (with a tad of a modification) and it should all be working now.

note : These problems are with the demo and not with the plugin itself.

¥

May 31, 2006 11:30

Got the IE7 Error Alert again
and Opera still doesn't see the Demo's SpellChecker link

Just goes to show that Firefox is a better browser :)

May 31, 2006 11:52

Man that site is slow.... has Scott got too much Mumbo Jumbo scripting, a bad host or simply a bad day?

Worked in FF2.0.a3, Opera9 but IE7b2 gave the same error alert and the throbber is still trobbing :)

May 31, 2006 11:56

lol, don't mention hosting to him, he's liable to burst a blood vessel :|

I think IE is balking at the onload function that we use ...... what the hell, it's a good reason why people should use a better browser huh? ;)

Thanks for all the testing, I'm sure Scott will update the post on the AstonishME to include the results :D

¥

May 31, 2006 16:59

SLOW ... HOST ? *pop*, argh . . 8| . . 8| . . [u]Must[/u] be those breeding hedge hog browsers :roll:

Urm ... I'll be happy to post the results, Sir ¥àŋķ
... just as soon as the AM! hosting company *cough cough* gets the mySQL server problem sorted. :-/

May 31, 2006 22:15

Looks like YaBBa finally wandered in from the pub and got his mysql server working.

May 31, 2006 22:27

Now there's a guy who's on top of things. ;)

May 31, 2006 22:45

lol, I'm blonde and run a windoze server, make allowances :p

¥

Jun 01, 2006 01:17

Works with Konqueror, except that a a single whitespace before a misspelled word gets removed, e.g. "This is fou bar" gets displayed as "This isfou bar".

I've tested the 1.8 version.

Instead of using SkinTag() for the skin/front office, you should use SkinBeginHtmlHead() and call there just $this->AdminEndHtmlHead($params), as it does the same (I'd use the full path [$plugins_url] in both cases).

Great plugin.

Jun 01, 2006 11:51

blueyed wrote:

Works with Konqueror, except that a a single whitespace before a misspelled word gets removed, e.g. "This is fou bar" gets displayed as "This isfou bar".

Is it a permanent removal? (ie/ if you choose a "correct spelling" is the whitespace missing from the original text when you finish spell checking?)

blueyed wrote:

Instead of using SkinTag() for the skin/front office, you should use SkinBeginHtmlHead() and call there just $this->AdminEndHtmlHead($params), as it does the same (I'd use the full path [$plugins_url] in both cases).

I'd totally forgotten about that event :p

There's a problem with using $plugins_url if you use (multi) subdomain blogs. If the javascript isn't loaded from the same subdomain as the page then you get "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open" so I've used <?php echo $Blog->siteurl.$plugins_subdir; ?>

I've uploaded the changed version [url=http://astonishme.co.uk/_googlespell.plugin.php.txt]here[/url] if you'd like to take a look. I haven't updated the zip yet, but will as soon as I know that these changes work.

¥

Jun 01, 2006 23:35

Is it a permanent removal? (ie/ if you choose a "correct spelling" is the whitespace missing from the original text when you finish spell checking?)

If I remember correctly, it was ok, at least after "resume editing".

Currently, after "Resume editing" it clears the whole text! This appears to be a bug introduced with Konqueror 3.5.3 where I've just updated to.. so the other problem may also "just" be a browser issue.

Remarks on the new plugin:
- change note for "enable_comments" setting
- enable it for comments by default?!
- "checker_location" _could_ be a default for a user setting, so each user could set it for him/herself (see the Smilies Plugin)

Looks good otherwise. I've not tested it though.

Jun 03, 2006 01:17

Thanks Yabba, stk, and personman. Works great in 1.6.

kudos to you all.

:lol:

Jun 05, 2006 17:54

¥åßßå wrote:

There's a problem with using $plugins_url if you use (multi) subdomain blogs. If the javascript isn't loaded from the same subdomain as the page then you get "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open" so I've used <?php echo $Blog->siteurl.$plugins_subdir; ?>

I've added a get_plugin_url() method to the Plugin class (Revision 1.56) that should take care of it.

I'll attach the updated plugin to this post.

There's still the "fatal error", which empties the textarea with Konqueror, after clicking on "Resume editing". This is most probably with the .js files and I've not taken a look at it.

Jun 06, 2006 10:20

Glad you like it MrDav ;)

Thanks Blueyed I'll merge that change with your other suggestions (user settings and removing the notes field ;) ) and update the original zip.

I've not taken much of a look at the js files other than to decide that if I did anything with them it'd be a total rewrite.

¥

Jun 18, 2006 19:19

Thanks for the good post on installing this alternative spell check to fix the borken one.

I have installed the plugin with out a hitch. However, when you click on it to check the spelling, it comes back and says there are no mis-spelled words. Trust me I made sure there were many mis-spelled.

Any Ideas anyone. I am on 1.6 Alpha.

Jun 18, 2006 20:31

Unforunately Google (in its infinite wisdom) has changed the spell check api to an https url.

You can amend the plugin to call the new url but it has problems with loooooooooong posts (like the waffling, fluffy Stk tends to make [hell why use 100 words when you can expand that to 3,000,000 words of drivle huh Scott? ;)])

To make it work with the new url you need to change the following lines in /plugins/googiespell_plugin.php/

(approx) line 102 :

 var googie1 = new GoogieSpell("<?php echo $baseurl.$plugins_subdir ?>googlespell_plugin/rsc/",
 "https://www.google.com/tbproxy/spell?lang=", "<?php echo T_('Check spelling') ?>",
 "<?php echo T_('Resume editing') ?>" );

and (approx) line 140 :

var googie1 = new GoogieSpell("<?php echo $Blog->siteurl.$plugins_subdir ?>googlespell_plugin/rsc/",
 "https://www.google.com/tbproxy/spell?lang=",
 "<?php echo T_('Check spelling') ?>",
 "<?php echo T_('Resume editing') ?>" );

We're currently working on a brand new spell checker that uses local dictionaries instead, but it's gonna take a smidge of work before it's released

¥

Jun 19, 2006 17:16

I just added an 's' in the xmlproxy.php file. It seems to be working again for me.

Jun 19, 2006 17:30

Yeah, unfortunately my host ( :roll: ) doesn't have ssl enabled ;)

¥

Jul 12, 2006 01:55

Ahhh heres the topic for this plugin.

For googlespell for comments;
Why don't you use the SkinBeginHtmlHead event instead of having the user need to manually hack up their skin to include the call plugin function... ?

Jul 12, 2006 03:13

We will. That event wasn't in the plugin api when we made this and we haven't had time to update it for the new release yet. Stay tuned.

Jul 13, 2006 16:04

blueyed wrote:

I've added a get_plugin_url() method to the Plugin class (Revision 1.56) that should take care of it.

Bluyed,
Did this change make it into 1.8-beta? I grepped for it and can't find it. I get an error when trying to use it in a plugin.

Actually, I'm not sure it would solve the problem I'm having. I'm working on another plugin that uses Ajax and it works fine when the url is http://www.brendoman.com/... (which is what the $baseurl is), but when I type http://brendoman.com in the address bar, the website loads, but clicking on the Ajax thing gives me that uncaught exception error.

I guess what would really be nice is a way to generate a relative path to the plugins directory. We can't assume that the stub file is in the same directory as index.php.

Anybody have ideas on this?

Jul 13, 2006 16:44

The exception is happening because the url does not match because of the www., but you probably know that.

'get_plugin_url()' why would that be a method instead of a variable. In most of my plugins i have url and dir variables.

And back to your problem you can fix this easily.

Here is a code sample that you should be able to change to do the trick;

$tempurl = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
if(strstr($tempurl,'blogs.balupton.com'))
	$baseurl = 'http://blogs.balupton.com/';
else if(strstr($tempurl,'localhost/DevSite'))
	$baseurl = 'http://localhost/DevSite/b2evolution/blogs/';
else if(strstr($tempurl,'localhost/PubSite'))
	$baseurl = 'http://localhost/PubSite/b2evolution/blogs/';
else if(strstr($tempurl,'balupton.com/blogs'))
	$baseurl = 'http://balupton.com/blogs';
else if(strstr($tempurl,'balupton.nghosting.org'))
	$baseurl = 'http://blogs.balupton.nghosting.org/';
else if(strstr($tempurl,'balupton.nghosting.info'))
	$baseurl = 'http://blogs.balupton.nghosting.info/';
else die("You are accessing this blog from a unknown location. - goto http://blogs.balupton.com instead.");
unset($tempurl);

Stick that in your _basic_config.php file, and change it appropriatly for whichever urls are being used.

Jul 13, 2006 16:52

I don't want to hard code my own url into it a plugin that I'm going to release to the public. I'm looking for a solution that will work for anyone who installs the plugin.

A little more testing has shown that Firefox is the only one that throws that error. IE and Opera just quietly halt the JS and execut the mouse click that the JS would have returned as false. So, my graceful degredation kicks in and the page reloads, but the same action is completed.

I guess I just need to make FF suppress that error and I'm good to go.

@your first question:
http://forums.b2evolution.net//viewtopic.php?p=37818#37818

Jul 13, 2006 17:13

You don't hardcode that into your plugin but your _basic_config.php file, where $baseurl is defined. - It's worked for me everytime.

But how do you plan on supressing that error in firefox? Firefox denies the permission because it is a security issue.

Jul 13, 2006 17:24

balupton wrote:

You don't hardcode that into your plugin but your _basic_config.php file, where $baseurl is defined. - It's worked for me everytime.

an enligtened Personperson (which I believe is the politically correct version of your name :|) wrote:

Like I said, I wish I had studied CS at university. For all I know the guy was just trying to make me feel better. But, he hired me.

Maybe he was experienced? ;)

¥

Jul 13, 2006 20:17

personman wrote:

blueyed wrote:

I've added a get_plugin_url() method to the Plugin class (Revision 1.56) that should take care of it.

Bluyed,
Did this change make it into 1.8-beta? I grepped for it and can't find it. I get an error when trying to use it in a plugin.

Actually, I'm not sure it would solve the problem I'm having. I'm working on another plugin that uses Ajax and it works fine when the url is http://www.brendoman.com/... (which is what the $baseurl is), but when I type http://brendoman.com in the address bar, the website loads, but clicking on the Ajax thing gives me that uncaught exception error.

I guess what would really be nice is a way to generate a relative path to the plugins directory. We can't assume that the stub file is in the same directory as index.php.

Anybody have ideas on this?

get_plugin_url() as it's now in HEAD (don't know about 1.8, sorry - if grep says "no" it's probably not there) should take of everything.

It's


	/**
	 * Get the absolute URL to the plugin's directory (trailing slash included).
	 *
	 * This is either below {@link $plugins_url}, if no Blog is set or we're in the
	 * backoffice, or the "plugins" directory below the Blog's URL root otherwise.
	 *
	 * @return string
	 */
	function get_plugin_url()
	{
		global $ReqHost, $Blog, $plugins_url, $plugins_path;

		if( isset($Blog) && ! is_admin_page() )
		{
			$base = $Blog->get('baseurl').'plugins/';
		}
		else
		{
			$base = $plugins_url;
		}

		if( strpos( $base, $ReqHost ) !== 0 )
		{ // the base url does not begin with the requested host:

			// Fix "http:" to "https:":
			if( strpos( $ReqHost, 'https:' ) === 0 && strpos( $base, 'http:' ) === 0 )
			{
				$base_fixed = 'https:'.substr( $base, 5 );

				if( strpos( $base_fixed, $ReqHost ) === 0 )
				{
					$base = $base_fixed;
				}
			}
		}

		// Append sub-path below $plugins_path, if any:
		$sub_path = preg_replace( ':^'.preg_quote($plugins_path, ':').':', '', dirname($this->classfile_path).'/' );

		return $base.$sub_path;
	}

Jul 14, 2006 04:10

1.8 beta B2Evo
I just installed this v1.8 Spell Checker plugin and it totally blanked out the Admin Plugins page.

More problems than Ned Kelly.

Closing down totally allowed me back into Admin and while it then showed Google SpellChecker was in the list of Plugins it was not installed and any actions once again blanked the page out.

Deleted for now.

Jul 14, 2006 04:13

Hmm, that version was made before the beta was released, so it needs to be updated. I'm using the plugin on my site running beta, so I know it can work. It's on my list of plugins that need to be updated and released. Watch for it.

Jul 14, 2006 04:16

Hi Danny, I just followed the version instructions at AstonishMe v18 for B2Evo 1.8

Jul 14, 2006 06:15

John,

The instructions were for a CVS version of 1.8, not the "summer beta" (as the last update, according to the download, was 12-jun-06, well before this recent release). We've not yet had time to fully digest the differences.

As you can imagine, with the release of summer beta, we're busier than a hill of ants after a rainstorm. Thanks for your patience. ;)

As a side note: shortly after we released the thing, Google changed the method by which the API fetches results (utilizing a secure server connection, for some unexplained, undocumented and unannounced reason - hey ... they're Google). Which underscores our dissatisfaction with this method: Despite the great interface, it (ultimately) relies on a 3rd party (Google) to work. Not good. (Not everyone has SSL support, not to mention curl/fsock connection differences).

We've got a superior, 100% local solution, in the works (though I don't recommend you hold your breath). Did I say we were busy? LOL. Though, to give you a taste ... think ... "custom dictionary and unlimited translation capabilities, in addition to swipe-and-check spell-checking and on-the-fly spelling suggestions."

Crap ... I did it ... VAPORWARE. :(

Hope this helps.

-stk

Jul 14, 2006 09:26

I've just updated the 1.8 zip file so if you grab the latest version then it should now work ;)

¥

Jul 14, 2006 21:17

In order to fix the https problem, I use a php proxy script from the original site. For anyone interested, you can check it out here:

http://orangoo.com/labs/uploads/sendReq.php

My thought is that instead of me pointing to this script for my installation, maybe the necessary code can be integrated into the plugin? It seems like this method will work for any server, but I haven't tested it. All I know is that with your default install, it failed, but after pointing it to that script, it worked perfectly.

This is just a suggestion/thought I had.

Jul 14, 2006 21:23

Kyle,
That method is integrated in the plugin. There's a file called xmlproxy.php in the plugin folder.

Danny

Jul 14, 2006 21:51

I'm not sure why, but that did not work for me. Instead of correcting my spelling, it just sits and spins forever. Maybe there is a setting I'm not doing right? The instructions on the website did not mention any other options. The way I can make it work is by setting the $url variable to

$url = "http://myserver.com/sendReq.php?lang=$lang"

I'm not sure why it doesn't work. I'm sorry I didn't realize it was integrated earlier, but thank you for your reply.

Jul 14, 2006 21:59

Ok, I figured out the problem. The xmlproxy.php that came in the package from http://b2evo.astonishme.co.uk/index.php?p=104 still used the regular http server on port 80. I updated the files to use the https server on port 443 and it worked perfectly. I'm not sure if this is something to do with my configuration, but I will upload my fixed copy of the file for anyone who wants to try it.

Jul 14, 2006 22:14

Ah, good catch. YaBBa, can you correct that in the zip file at AM?

Jul 14, 2006 22:19

:D I'm glad I can finally start giving back to the community!

Jul 14, 2006 23:54

Hey, I came up with a better fix for xmlproxy that modifies only one line and seems to work flawlessly. I would use this one, or just compare it with the other.

Jul 15, 2006 13:17

Ok, works for public comments just fine but I can't get it to show up for "back office" posting.

1.8 Beta....

Jul 15, 2006 13:40

lol, damn, it never rains but it pours :P

What are the settings for "Backoffice spell checker location" in admin > app settings > google plugin and admin > users/profile ?

¥

Jul 15, 2006 18:34

getting the same problem, the spell checker toolbar or button is no longer there in the back office.

Settings;
yes or no for comments, didn't change anything
Toolbar or action button, didn't change anything
goospel
95
never

all events enabled.

Jul 15, 2006 19:11

It looks like there is a problem recording the user settings in the database, I'm not really sure what causes it. I was able to get spelling working by manually updating the setting in the table to "toolbar." In order to really fix the problem of setting the values, I ended up just reinstalling b2evo to make sure I had a good copy of 1.8-beta. I have also noticed lately that firefox has been caching the b2evo pages and a refresh is sometimes necessary to get things looking right.

Jul 15, 2006 20:10

kf_man wrote:

It looks like there is a problem recording the user settings in the database

What do you mean? Does changing the "Backoffice spell checker location" option in your user profile not get saved into DB? (That would probably be a general, core problem then, which I'd like to fix of course)

Jul 15, 2006 20:21

I think I've found the bug you mean:
The plugin uses this as the usersetting's default value for "checker_location":


'defaultvalue' => $this->Settings->get('checker_location_default'),


but there's no "checker_location_default" setting! so the default is NULL!

Only, after a user has saved his profile once it gets saved as a valid usersetting due to the select box.

To fix this, replace the line mentioned above to:


	'defaultvalue' => $this->Settings->get('checker_location'),

Jul 15, 2006 20:44

btw: I've committed the Plugin::get_plugin_url() method to the v-1-8 branch, so it will be available in b2evo 1.8.1. I'm mentioning it, because you define/override it now yourself in the Plugin and should remove this to "receive" changes in the parent class.
To stay compatible with b2evo 1.8 I'd add a wrapper like:


function my_get_plugin_url()
{
  if( method_exists($this, 'get_plugin_url') )
  {
     return $this->get_plugin_url();
  }

  // insert a copy of Plugin::get_plugin_url() as of 1.8.1 here
}

Jul 16, 2006 05:08

personman, I've imported the plugin into the evocms-plugins' SVN.

Included should be all fixes, some small adjustments and an upgrade to the latest GoogieSpell javascript library.

I've also looked at the bug with Konqueror resetting the textarea after clicking "Resume editing" and reported it (http://bugs.kde.org/show_bug.cgi?id=120607) - just for the records.

Aug 04, 2006 16:46

I can't get Google Spell to find incorrect spelling even when I do it deliberately. It keeps reporting back that no errors were found. I just downloaded the latest version incase there had been any recent fixes, but still no dice. I don't think it's the SSL problem since the throbber stops after a second. Any clues???

<strong>This</strong> post is <em>mainely</em> in the Bradley Inactive category. It is also secondarliy in the Bradley and Inactive categores.

Aug 17, 2006 10:48

Sorry to distrub you all, but I'm just feel dizzy to dig out the final solution on Google Spell Check (GSC) from this thread... :'(

What I want to say is, because the official site for GSC is down and I cannot get the plug-in there, would anyone is kind enough to post the complete package and installation instruction of GSC plug-in again?

By doing so even a PC idiot like me can try-out such a great plug-in! :oops:

Many thanks in advance. :)

Dec 11, 2006 04:12

John will the spell checker work for 1.81-rc?

Jan 27, 2007 02:13

I'm having the same error as our friend above. I installed the latest version of the google spell check plug in, the checker appears inside my editor, but it doesn't detect any spell check errors... just tells me that "no spelling errors found."

Help!

Jan 30, 2007 19:41

In my case the GSP does not report anything back, but seem to get stuck in an enless loop trying to contact the Google API (?).

I did a fresh install to no avail. I also have problem with youtube plugin which invariably returns "No results found" on all searches.


Form is loading...

Build your own site! – This forum is powered by b2evolution CMS, a complete engine for your website.