X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/a4e11ba3f0e84e4e594006370051cf10a5df2bfd..0ec7537c29deda6db4bfbc2703f7d2b52cccbbf1:/ReCaptcha.php diff --git a/ReCaptcha.php b/ReCaptcha.php index 36a74ed..a875527 100644 --- a/ReCaptcha.php +++ b/ReCaptcha.php @@ -10,10 +10,13 @@ * @licence MIT/X11 */ -if( !defined( 'MEDIAWIKI' ) ) { +if ( !defined( 'MEDIAWIKI' ) ) { exit; } +require_once dirname( __FILE__ ) . '/ConfirmEdit.php'; +$wgCaptchaClass = 'ReCaptcha'; + $wgExtensionMessagesFiles['ReCaptcha'] = dirname( __FILE__ ) . '/ReCaptcha.i18n.php'; require_once( 'recaptchalib.php' ); @@ -25,6 +28,13 @@ $wgReCaptchaPrivateKey = ''; $recaptcha_public_key = ''; $recaptcha_private_key = ''; +/** + * Sets the theme for ReCaptcha + * + * See http://code.google.com/apis/recaptcha/docs/customization.html + */ +$wgReCaptchaTheme = 'red'; + $wgExtensionFunctions[] = 'efReCaptcha'; /** @@ -62,9 +72,11 @@ class ReCaptcha extends SimpleCaptcha { * */ function getForm() { - global $wgReCaptchaPublicKey; - return " " . - recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error); + global $wgReCaptchaPublicKey, $wgReCaptchaTheme; + $useHttps = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ); + $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar( array( 'theme' => $wgReCaptchaTheme, 'tabindex' => 1 ) ); + + return Html::inlineScript( $js ) . recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps); } /**