I have done some small changes to recaptcha 2.6 in order to make it generate valid HTML code in Wordpress (testet with WP 2.3). See also validator.w3.org.
This is for recaptcha-wordpress-2.6.zip Actually, I think I submitted the same code for the 2.5 version, but that never got implemented. Anyhow, here goes:
Thank you! I came looking for any threads on the invalid (X)HTML and
this is the first thing I found, fantastic. I hope that this does get
incorporated into the main trunk, since these were the only XHTML
errors I had on my site. Well, in my code - now if Google and Amazon
would stop putting garbage in their iframes...
Ah, I think I found an oversight. This patch makes the submit comment
button hidden all the time since the style is always in the header,
and not just displayed when there is no scripting. It seems this
would need a piece of script to dynamically un-hide the button so it
remains hidden when there is no scripting, but shows otherwise.
I did this in recaptcha.php, around line 51:
document.getElementById('recaptcha-submit-btn-area').appendChild
(sub);
document.getElementById('submit').tabIndex =
6;
> Ah, I think I found an oversight. This patch makes the submit comment > button hidden all the time since the style is always in the header, > and not just displayed when there is no scripting. It seems this > would need a piece of script to dynamically un-hide the button so it > remains hidden when there is no scripting, but shows otherwise.
> I did this in recaptcha.php, around line 51: > document.getElementById('recaptcha-submit-btn-area').appendChild > (sub); > document.getElementById('submit').tabIndex = > 6;
> Right after the existing tabIndex = 6 I added the line to toggle the > display on. That seems to behave like the default install, sans the > XHTML errors.
On Nov 21, 11:51 pm, "reCAPTCHA Support" <supp...@recaptcha.net>
wrote:
> It sounds like you need to patch the theme to make this version work. We've
> found that makes it much more difficult to install for users.
No, there is no patching in the theme - all the patches are in the
reCAPTCHA plugin. The plug-in produces invalid XHTML, with gronslet's
patch and my one additional change reCAPTCHA produces valid XHTML and
appears to function correctly. No patches to any other files are
required.
On Nov 27, 6:45 am, MegaZone <megaz...@gmail.com> wrote:
> On Nov 21, 11:51 pm, "reCAPTCHA Support" <supp...@recaptcha.net>
> wrote:
> > It sounds like you need to patch the theme to make this version work. We've
> > found that makes it much more difficult to install for users.
> No, there is no patching in the theme - all the patches are in the
> reCAPTCHA plugin. The plug-in produces invalid XHTML, with gronslet's
> patch and my one additional change reCAPTCHA producesvalidXHTML and
> appears to function correctly. No patches to any other files are
> required.
> -MZ
I just downloaded and installed reCAPTCHA Plugin for WordPress - v2.7
(http://code.google.com/p/recaptcha/downloads/detail?name=recaptcha- wordpress-2.7.zip&can=2&q=WP-Latest) which was uploaded 29 November
2007. The code seems to have changed, so it doesn't seem possible to
apply the above posted changes. Am I reading this correctly? Any
chance that it's possible to make 2.7 produce valid HTML?
The only issue now is that we have a <style> tag in the body. I'm a little bit skeptical about applying the patch as it has the potential to break some themes.
> On Nov 27, 6:45 am, MegaZone <megaz...@gmail.com> wrote: > > On Nov 21, 11:51 pm, "reCAPTCHA Support" <supp...@recaptcha.net> > > wrote:
> > > It sounds like you need to patch the theme to make this version work. > We've > > > found that makes it much more difficult to install for users.
> > No, there is no patching in the theme - all the patches are in the > > reCAPTCHA plugin. The plug-in produces invalid XHTML, with gronslet's > > patch and my one additional change reCAPTCHA producesvalidXHTML and > > appears to function correctly. No patches to any other files are > > required.
> > -MZ
> I just downloaded and installed reCAPTCHA Plugin for WordPress - v2.7 > (http://code.google.com/p/recaptcha/downloads/detail?name=recaptcha- > wordpress-2.7.zip&can=2&q=WP-Latest) which was uploaded 29 November > 2007. The code seems to have changed, so it doesn't seem possible to > apply the above posted changes. Am I reading this correctly? Any > chance that it's possible to make 2.7 produce valid HTML?
On Dec 11 2007, 7:33 pm, "reCAPTCHA Support" <supp...@recaptcha.net>
wrote:
> The only issue now is that we have a <style> tag in the body. I'm a little
> bit skeptical about applying the patch as it has the potential to break some
> themes.
So regarding my initial comment on invalid XHTML code, should I
interpret this as a WONTFIX resolution?
You are in fact right - the patch by me and MegaZone does introduce
some strange behaviour in firefox and IE. For the moment, the
following page will only show the footer in firefox, while it shows
perfectly fine in Konqueror and Opera. (In firefox ctrl-u will show
the complete, valid source code):
The reCAPTCHA team is not going to be developing XHTML fixes. However, we'll happily take a patch if:
- It's low risk - It doesn't require any additional work from users
About your blog, does it work if you use the non-modified version of the code? If it shows the bug with the unmodified version we'll be happy to take a look at it.
-Ben On 1/12/08, grons...@gmail.com <grons...@gmail.com> wrote:
> On Dec 11 2007, 7:33pm, "reCAPTCHA Support" <supp...@recaptcha.net> > wrote: > > The only issue now is that we have a <style> tag in the body. I'm a > little > > bit skeptical about applying the patch as it has the potential to break > some > > themes.
> So regarding my initial comment on invalid XHTML code, should I > interpret this as a WONTFIX resolution?
> You are in fact right - the patch by me and MegaZone does introduce > some strange behaviour in firefox and IE. For the moment, the > following page will only show the footer in firefox, while it shows > perfectly fine in Konqueror and Opera. (In firefox ctrl-u will show > the complete, valid source code):
On Jan 12, 10:25 pm, "reCAPTCHA Support" <supp...@recaptcha.net>
wrote:
> About your blog, does it work if you use the non-modified version of the
> code? If it shows the bug with the unmodified version we'll be happy to take
> a look at it.
The problem is still here, with the unmodified code (recaptcha.php and
recaptchalib.php).
I'll be happy to provide more info if needed.
Thanks for the great work so far :)
> On Jan 12, 10:25pm, "reCAPTCHA Support" <supp...@recaptcha.net> > wrote: > > About your blog, does it work if you use the non-modified version of the > > code? If it shows the bug with the unmodified version we'll be happy to > take > > a look at it.
> The problem is still here, with the unmodified code (recaptcha.php and > recaptchalib.php). > I'll be happy to provide more info if needed. > Thanks for the great work so far :)
Wow! Thanks - that solved the problem with firefox!
(What I did was to edit wp-dokuwiki.php and change "/>" to "></
script>")
So the problem with firefox was because recaptcha and wp-dokuwiki
didn't work that well togheter I assume.
Still invalid xhtml generated by recaptcha though. Any suggestions
from anyone is appreciated.
Thanks to the recaptcha team for the great work!
best regards,
MartinG
On Dec 11 2007, 1:10 pm, Brett <pace...@gmail.com> wrote:
> I just downloaded and installed reCAPTCHA Plugin for WordPress - v2.7
> (http://code.google.com/p/recaptcha/downloads/detail?name=recaptcha- > wordpress-2.7.zip&can=2&q=WP-Latest) which was uploaded 29 November
> 2007. The code seems to have changed, so it doesn't seem possible to
> apply the above posted changes. Am I reading this correctly? Any
> chance that it's possible to make 2.7 producevalidHTML?
I've redone the fixes for 2.7:
---START---
--- old-recaptcha.php-2.7 Tue Feb 5 19:40:41 2008
+++ recaptcha.php Tue Feb 5 20:03:00 2008
@@ -3,7 +3,7 @@
Plugin Name: reCAPTCHA
Plugin URI: http://recaptcha.net/plugins/wordpress Description: Integrates a reCAPTCHA with wordpress
-Version: 2.6
+Version: 2.7
Author: Ben Maurer & Mike Crawford
Email: supp...@recaptcha.net
Author URI: http://bmaurer.blogspot.com @@ -49,21 +49,32 @@
sub.parentNode.removeChild(sub);
document.getElementById('recaptcha-submit-btn-
area').appendChild (sub);
document.getElementById('submit').tabIndex =
6;
+
document.getElementById('submit').style.display = 'inline'; //
MegaZone added
if ( typeof _recaptcha_wordpress_savedcomment !
= 'undefined') {
+/*
+MegaZone added this function. This will insert the style to hide
the
+reCAPTCHA submit button in the header instead of the body, where it
is
+invalid XHTML. Since this disables the button even when scripting is
+turned on, there is a line of JavaScript inserted above which makes
the
+button visible when scripting is on.
+*/
+function recaptcha_wp_head () {
+ echo "<style type='text/css'>#submit { display: none; }</style>\n";
+}
I fixed the version number to be 2.7, as it should be. I also added a
space before the closing '/>' on some elements, as recommended for
browser compatibility. The main XHTML fix is moving the style to the
head instead of the body, and adding the associated JavaScript, et al,
to keep things working.
> On Dec 11 2007, 1:10 pm, Brett <pace...@gmail.com> wrote: > > I just downloaded and installed reCAPTCHA Plugin for WordPress - v2.7 > > (http://code.google.com/p/recaptcha/downloads/detail?name=recaptcha- > > wordpress-2.7.zip&can=2&q=WP-Latest) which was uploaded 29 November > > 2007. The code seems to have changed, so it doesn't seem possible to > > apply the above posted changes. Am I reading this correctly? Any > > chance that it's possible to make 2.7 producevalidHTML?
> +/* > +MegaZone added this function. This will insert the style to hide > the > +reCAPTCHA submit button in the header instead of the body, where it > is > +invalid XHTML. Since this disables the button even when scripting is > +turned on, there is a line of JavaScript inserted above which makes > the > +button visible when scripting is on. > +*/ > +function recaptcha_wp_head () { > + echo "<style type='text/css'>#submit { display: none; }</style>\n"; > +}
> I fixed the version number to be 2.7, as it should be. I also added a > space before the closing '/>' on some elements, as recommended for > browser compatibility. The main XHTML fix is moving the style to the > head instead of the body, and adding the associated JavaScript, et al, > to keep things working.
Honestly, I don't think that it's really worth going to the trouble of having a configurable option for this. This would mean we need to document it, etc -- all for the sole purpose of satisfying the w3c validator.
I'd be more willing to consider a patch that we could put in by default.
> On Feb 5, 8:19 pm, "reCAPTCHA Support" <supp...@recaptcha.net> wrote: > > Thanks for contributing this patch. I'm still worried about the risk for > JS > > errors, so I think I'm going to hold off committing this for now.
> Why not make it configurable - a config option to do it one way or the > other.
> If I can find some time I'll see if I can do that.