From dc727507ead33a9c83f7d53a3541ec05048453c9 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 21 May 2015 19:08:12 +0200 Subject: [PATCH] Move ReCaptcha to it's own place Bug: T88047 Change-Id: I6cdb9ac1d21c84fc9b01cd90b9cba4aa3db1eccc --- ReCaptcha.i18n.php | 35 ---------- ReCaptcha.php | 64 +------------------ .../ReCaptcha.class.php | 0 ReCaptcha/ReCaptcha.php | 63 ++++++++++++++++++ .../recaptchalib.php | 0 5 files changed, 64 insertions(+), 98 deletions(-) delete mode 100644 ReCaptcha.i18n.php rename ReCaptcha.class.php => ReCaptcha/ReCaptcha.class.php (100%) create mode 100644 ReCaptcha/ReCaptcha.php rename recaptchalib.php => ReCaptcha/recaptchalib.php (100%) diff --git a/ReCaptcha.i18n.php b/ReCaptcha.i18n.php deleted file mode 100644 index 82ad11d25..000000000 --- a/ReCaptcha.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net - * @licence MIT/X11 - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - exit; -} - -require_once __DIR__ . '/ConfirmEdit.php'; -$wgCaptchaClass = 'ReCaptcha'; - -$wgMessagesDirs['ReCaptcha'] = __DIR__ . '/ReCaptcha/i18n'; -$wgExtensionMessagesFiles['ReCaptcha'] = __DIR__ . '/ReCaptcha.i18n.php'; - -$wgAutoloadClasses['ReCaptcha'] = __DIR__ . '/ReCaptcha.class.php'; - -require_once( 'recaptchalib.php' ); - -// Set these in LocalSettings.php -$wgReCaptchaPublicKey = ''; -$wgReCaptchaPrivateKey = ''; -// For backwards compatibility -$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'; - -/** - * Make sure the keys are defined. - */ -function efReCaptcha() { - global $wgReCaptchaPublicKey, $wgReCaptchaPrivateKey; - global $recaptcha_public_key, $recaptcha_private_key; - global $wgServerName; - - // Backwards compatibility - if ( $wgReCaptchaPublicKey == '' ) { - $wgReCaptchaPublicKey = $recaptcha_public_key; - } - if ( $wgReCaptchaPrivateKey == '' ) { - $wgReCaptchaPrivateKey = $recaptcha_private_key; - } - - if ( $wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '' ) { - die ( 'You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' . - "use the reCAPTCHA plugin. You can sign up for a key here." ); - } -} +require_once __DIR__ . "/ReCaptcha/ReCaptcha.php"; diff --git a/ReCaptcha.class.php b/ReCaptcha/ReCaptcha.class.php similarity index 100% rename from ReCaptcha.class.php rename to ReCaptcha/ReCaptcha.class.php diff --git a/ReCaptcha/ReCaptcha.php b/ReCaptcha/ReCaptcha.php new file mode 100644 index 000000000..fa854c755 --- /dev/null +++ b/ReCaptcha/ReCaptcha.php @@ -0,0 +1,63 @@ + + * @copyright Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net + * @licence MIT/X11 + */ + +if ( !defined( 'MEDIAWIKI' ) ) { + exit; +} + +require_once dirname( __DIR__ ) . '/ConfirmEdit.php'; +$wgCaptchaClass = 'ReCaptcha'; + +$wgMessagesDirs['ReCaptcha'] = __DIR__ . '/i18n'; + +$wgAutoloadClasses['ReCaptcha'] = __DIR__ . '/ReCaptcha.class.php'; + +require_once( 'recaptchalib.php' ); + +// Set these in LocalSettings.php +$wgReCaptchaPublicKey = ''; +$wgReCaptchaPrivateKey = ''; +// For backwards compatibility +$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'; + +/** + * Make sure the keys are defined. + */ +function efReCaptcha() { + global $wgReCaptchaPublicKey, $wgReCaptchaPrivateKey; + global $recaptcha_public_key, $recaptcha_private_key; + global $wgServerName; + + // Backwards compatibility + if ( $wgReCaptchaPublicKey == '' ) { + $wgReCaptchaPublicKey = $recaptcha_public_key; + } + if ( $wgReCaptchaPrivateKey == '' ) { + $wgReCaptchaPrivateKey = $recaptcha_private_key; + } + + if ( $wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '' ) { + die ( 'You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' . + "use the reCAPTCHA plugin. You can sign up for a key here." ); + } +} diff --git a/recaptchalib.php b/ReCaptcha/recaptchalib.php similarity index 100% rename from recaptchalib.php rename to ReCaptcha/recaptchalib.php