mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
Move QuestyCaptcha to its own place
Bug: T88047 Change-Id: I8c8f97d49dc39445dbba9c12909b81898838a253
This commit is contained in:
parent
cad5bc9200
commit
2f0db346eb
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This is a backwards-compatibility shim, generated by:
|
||||
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
|
||||
*
|
||||
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
|
||||
* and the EXTENSION.i18n.php file only exists to provide compatibility with
|
||||
* older releases of MediaWiki. For more information about this migration, see:
|
||||
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
|
||||
*
|
||||
* This shim maintains compatibility back to MediaWiki 1.17.
|
||||
*/
|
||||
$messages = array();
|
||||
if ( !function_exists( 'wfJsonI18nShim0619ec35d45138ac' ) ) {
|
||||
function wfJsonI18nShim0619ec35d45138ac( $cache, $code, &$cachedData ) {
|
||||
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
|
||||
foreach ( $codeSequence as $csCode ) {
|
||||
$fileName = dirname( __FILE__ ) . "/i18n/questy/$csCode.json";
|
||||
if ( is_readable( $fileName ) ) {
|
||||
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
||||
foreach ( array_keys( $data ) as $key ) {
|
||||
if ( $key === '' || $key[0] === '@' ) {
|
||||
unset( $data[$key] );
|
||||
}
|
||||
}
|
||||
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
|
||||
}
|
||||
|
||||
$cachedData['deps'][] = new FileDependency( $fileName );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim0619ec35d45138ac';
|
||||
}
|
|
@ -1,48 +1,2 @@
|
|||
<?php
|
||||
/**
|
||||
* A question-based captcha plugin.
|
||||
*
|
||||
* Copyright (C) 2009 Benjamin Lees <emufarmers@gmail.com>
|
||||
* http://www.mediawiki.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
*/
|
||||
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/ConfirmEdit.php';
|
||||
$wgCaptchaClass = 'QuestyCaptcha';
|
||||
|
||||
global $wgCaptchaQuestions;
|
||||
$wgCaptchaQuestions = array();
|
||||
|
||||
/* Add your questions in LocalSettings.php using this format
|
||||
$wgCaptchaQuestions = array(
|
||||
'A question?' => 'An answer!',
|
||||
'What is the capital of France?' => 'Paris', //Answers are normalized to lowercase: Paris and paris are the same
|
||||
'What is this wiki's name?' => $wgSitename,
|
||||
'2 + 2 ?' => array( '4', 'four' ), //Questions may have many answers
|
||||
);
|
||||
*/
|
||||
|
||||
$wgMessagesDirs['QuestyCaptcha'] = __DIR__ . '/QuestyCaptcha/i18n';
|
||||
$wgExtensionMessagesFiles['QuestyCaptcha'] = __DIR__ . '/QuestyCaptcha.i18n.php';
|
||||
$wgAutoloadClasses['QuestyCaptcha'] = __DIR__ . '/QuestyCaptcha.class.php';
|
||||
require_once __DIR__ . "/QuestyCaptcha/QuestyCaptcha.php";
|
||||
|
|
47
QuestyCaptcha/QuestyCaptcha.php
Normal file
47
QuestyCaptcha/QuestyCaptcha.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* A question-based captcha plugin.
|
||||
*
|
||||
* Copyright (C) 2009 Benjamin Lees <emufarmers@gmail.com>
|
||||
* http://www.mediawiki.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
*/
|
||||
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once dirname( __DIR__ ) . '/ConfirmEdit.php';
|
||||
$wgCaptchaClass = 'QuestyCaptcha';
|
||||
|
||||
global $wgCaptchaQuestions;
|
||||
$wgCaptchaQuestions = array();
|
||||
|
||||
/* Add your questions in LocalSettings.php using this format
|
||||
$wgCaptchaQuestions = array(
|
||||
'A question?' => 'An answer!',
|
||||
'What is the capital of France?' => 'Paris', //Answers are normalized to lowercase: Paris and paris are the same
|
||||
'What is this wiki's name?' => $wgSitename,
|
||||
'2 + 2 ?' => array( '4', 'four' ), //Questions may have many answers
|
||||
);
|
||||
*/
|
||||
|
||||
$wgMessagesDirs['QuestyCaptcha'] = __DIR__ . '/i18n';
|
||||
$wgAutoloadClasses['QuestyCaptcha'] = __DIR__ . '/QuestyCaptcha.class.php';
|
|
@ -14,7 +14,7 @@ class QuestyCaptchaTest extends MediaWikiTestCase {
|
|||
$this->setMwGlobals( 'wgCaptchaQuestions', $config );
|
||||
$this->mergeMwGlobalArrayValue(
|
||||
'wgAutoloadClasses',
|
||||
array( 'QuestyCaptcha' => __DIR__ . '/../QuestyCaptcha.class.php' )
|
||||
array( 'QuestyCaptcha' => __DIR__ . '/../QuestyCaptcha/QuestyCaptcha.class.php' )
|
||||
);
|
||||
|
||||
$qc = new QuestyCaptcha();
|
||||
|
|
Loading…
Reference in a new issue