Followup 100813, use Xml::encodeJsVar and Html::inlineScript
authorJohn Du Hart <johnduhart@users.mediawiki.org>
Thu, 27 Oct 2011 11:34:34 +0000 (11:34 +0000)
committerJohn Du Hart <johnduhart@users.mediawiki.org>
Thu, 27 Oct 2011 11:34:34 +0000 (11:34 +0000)
ReCaptcha.php

index b7c3d27db74e8df7ed7ceb060cfa2299a4df5f14..a8755277fc6178cd7b7c837a9ed5fa566e14255f 100644 (file)
@@ -74,10 +74,9 @@ class ReCaptcha extends SimpleCaptcha {
        function getForm() {
                global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
                $useHttps = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );
        function getForm() {
                global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
                $useHttps = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );
-               $escapedTheme = Xml::escapeJsString( $wgReCaptchaTheme );
+               $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar( array( 'theme' => $wgReCaptchaTheme, 'tabindex' => 1  ) );
 
 
-               return "<script>var RecaptchaOptions = { theme : '$escapedTheme', tabindex : 1 }; </script> " .
-                       recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps);
+               return Html::inlineScript( $js ) . recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps);
        }
 
        /**
        }
 
        /**