$wgConfirmEditMessages = array();
$wgConfirmEditMessages['en'] = array(
- 'captcha-short' => "Your edit includes new URL links; as a protection against automated spam, you'll need to type in the words that appear in this image:<br />
-([[Special:Captcha/help|What is this?]])",
+ 'captcha-edit' => 'Your edit includes new external links. To help protect against automated
+ spam, please solve the simple sum below and enter the answer in the box ([[Special:Captcha/help|more info]]):',
+ 'captcha-createaccount' => 'To help protect against automated account creation, please solve the simple sum
+ below and enter the answer in the box ([[Special:Captcha/help|more info]]):',
+ 'captcha-createaccount-fail' => "Incorrect or missing confirmation code.",
'captchahelp-title' => 'Captcha help',
'captchahelp-text' => "Web sites that accept postings from the public, like this wiki, are often abused by spammers who use automated tools to post their links to many sites. While these spam links can be removed, they are a significant nuisance.
Unfortunately this may inconvenience users with limited vision or using text-based or speech-based browsers. At the moment we do not have an audio alternative available. Please contact the site administrators for assistance if this is unexpectedly preventing you from making legitimate posts.
Hit the 'back' button in your browser to return to the page editor.",
- 'captcha-createaccount' => "As a protection against automated spam, you'll need to type in the words that appear in this image to register an account:<br />
-([[Special:Captcha/help|What is this?]])",
- 'captcha-createaccount-fail' => "Incorrect or missing confirmation code.",
);
+
$wgConfirmEditMessages['af'] = array(
'captcha-short' => "U wysiging bevat nuwe webskakels. Neem kennis dat blote reklame van u werf, produk of besigheid as vandalisme beskou kan word. As beskerming teen outomatiese gemorsbydraes, sal u die woorde wat onder verskyn in die prentjie moet intik: <br />([[Spesiaal:Captcha/help|Wat is hierdie?]])",
'captchahelp-title' => 'Captcha-hulp',
function ceSetup() {
# Add messages
global $wgMessageCache, $wgConfirmEditMessages;
- foreach( $wgConfirmEditMessages as $key => $value ) {
- $wgMessageCache->addMessages( $wgConfirmEditMessages[$key], $key );
- }
+ foreach( $wgConfirmEditMessages as $lang => $messages )
+ $wgMessageCache->addMessages( $messages, $lang );
global $wgHooks, $wgCaptcha, $wgCaptchaClass, $wgSpecialPages;
$wgCaptcha = new $wgCaptchaClass();
* @param OutputPage $out
*/
function editCallback( &$out ) {
- $out->addWikiText( wfMsg( "captcha-short" ) );
+ $out->addWikiText( $this->getMessage( 'edit' ) );
$out->addHTML( $this->getForm() );
}
+ /**
+ * Show a message asking the user to enter a captcha on edit
+ * The result will be treated as wiki text
+ *
+ * @param $action Action being performed
+ * @return string
+ */
+ function getMessage( $action ) {
+ $name = 'captcha-' . $action;
+ $text = wfMsg( $name );
+ # Obtain a more tailored message, if possible, otherwise, fall back to
+ # the default for edits
+ return wfEmptyMsg( $name, $text ) ? wfMsg( 'captcha-edit' ) : $text;
+ }
+
/**
* Inject whazawhoo
* @fixme if multiple thingies insert a header, could break
if( $wgCaptchaTriggers['createaccount'] ) {
$template->set( 'header',
"<div class='captcha'>" .
- $wgOut->parse( wfMsg( 'captcha-createaccount' ) ) .
+ $wgOut->parse( $this->getMessage( 'createaccount' ) ) .
$this->getForm() .
"</div>\n" );
}
--- /dev/null
+<?php
+
+/**
+ * Internationalisation file for the FancyCaptcha plug-in
+ *
+ * @package MediaWiki
+ * @subpackage Extensions
+*/
+
+function efFancyCaptchaMessages() {
+ return array(
+
+/* English */
+'en' => array(
+'fancycaptcha-edit' => 'Your edit includes new external links. To help protect against automated
+spam, please enter the words that appear below in the box ([[Special:Captcha/help|more info]]):',
+'fancycaptcha-createaccount' => 'To help protect against automated account creation, please enter the words
+that appear below in the box ([[Special:Captcha/help|more info]]):',
+),
+
+ );
+}
+
+?>
global $wgCaptchaSecret;
$wgCaptchaSecret = "CHANGE_THIS_SECRET!";
+$wgExtensionFunctions[] = 'efFancyCaptcha';
+
+function efFancyCaptcha() {
+ global $wgMessageCache;
+ require_once( dirname( __FILE__ ) . '/FancyCaptcha.i18n.php' );
+ foreach( efFancyCaptchaMessages() as $lang => $messages )
+ $wgMessageCache->addMessages( $messages, $lang );
+}
class FancyCaptcha extends SimpleCaptcha {
/**
wfHttpError( 500, 'Internal Error', 'Requested bogus captcha image' );
return false;
}
+
+ /**
+ * Show a message asking the user to enter a captcha on edit
+ * The result will be treated as wiki text
+ *
+ * @param $action Action being performed
+ * @return string
+ */
+ function getMessage( $action ) {
+ $name = 'fancycaptcha-' . $action;
+ $text = wfMsg( $name );
+ # Obtain a more tailored message, if possible, otherwise, fall back to
+ # the default for edits
+ return wfEmptyMsg( $name, $text ) ? wfMsg( 'fancycaptcha-edit' ) : $text;
+ }
+
}
} # End invocation guard