*/
function getMessage( $action ) {
$name = 'captcha-' . $action;
- $text = wfMsg( $name );
+ $text = wfMessage( $name )->text();
# Obtain a more tailored message, if possible, otherwise, fall back to
# the default for edits
- return wfEmptyMsg( $name, $text ) ? wfMsg( 'captcha-edit' ) : $text;
+ return wfMessage( $name, $text )->isDisabled() ? wfMessage( 'captcha-edit' )->text() : $text;
}
/**
if ( !$count ) {
$wgMemc->add( $key, 0, $wgCaptchaBadLoginExpiration );
}
- $count = $wgMemc->incr( $key );
+
+ $wgMemc->incr( $key );
}
return true;
}
}
/**
- * @param EditPage $editPage
- * @param string $newtext
- * @param string $section
+ * @param $editPage EditPage
+ * @param $newtext string
+ * @param $section string
+ * @param $merged bool
* @return bool true if the captcha should run
*/
function shouldCheck( &$editPage, $newtext, $section, $merged = false ) {
*/
function filterLink( $url ) {
global $wgCaptchaWhitelist;
- $source = wfMsgForContent( 'captcha-addurl-whitelist' );
+ $source = wfMessage( 'captcha-addurl-whitelist' )->inContentLanguage()->text();
- $whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source )
+ $whitelist = wfMessage( 'captcha-addurl-whitelist', $source )->isDisabled()
? false
: $this->buildRegexes( explode( "\n", $source ) );
/**
* Backend function for confirmEdit() and confirmEditAPI()
+ * @param $editPage EditPage
+ * @param $newtext string
+ * @param $section
+ * @param $merged bool
* @return bool false if the CAPTCHA is rejected, true otherwise
*/
private function doConfirmEdit( $editPage, $newtext, $section, $merged = false ) {
* A more efficient edit filter callback based on the text after section merging
* @param EditPage $editPage
* @param string $newtext
+ * @return bool
*/
function confirmEditMerged( $editPage, $newtext ) {
return $this->confirmEdit( $editPage, $newtext, false, true );
$this->trigger = "new account '" . $u->getName() . "'";
if ( !$this->passCaptcha() ) {
- $message = wfMsg( 'captcha-createaccount-fail' );
+ $message = wfMessage( 'captcha-createaccount-fail' )->text();
return false;
}
}
/**
* Hook for user login form submissions.
- * @param User $u
- * @param string $message
+ * @param $u User
+ * @param $pass
+ * @param $retval
* @return bool true to continue, false to abort user creation
*/
function confirmUserLogin( $u, $pass, &$retval ) {
if ( defined( 'MW_API' ) ) {
# API mode
# Asking for captchas in the API is really silly
- $error = wfMsg( 'captcha-disabledinapi' );
+ $error = wfMessage( 'captcha-disabledinapi' )->text();
return false;
}
$this->trigger = "{$wgUser->getName()} sending email";
if ( !$this->passCaptcha() ) {
- $error = wfMsg( 'captcha-sendemail-fail' );
+ $error = wfMessage( 'captcha-sendemail-fail' )->text();
return false;
}
}
/**
* Extract a list of all recognized HTTP links in the text.
- * @param string $text
+ * @param $editpage EditPage
+ * @param $text string
* @return array of strings
*/
function findLinks( &$editpage, $text ) {
*/
function showHelp() {
global $wgOut;
- $wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) );
- $wgOut->addWikiText( wfMsg( 'captchahelp-text' ) );
+ $wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() );
+ $wgOut->addWikiMsg( 'captchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) {
- $wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) );
+ $wgOut->addWikiMsg( 'captchahelp-cookies-needed' );
}
}
}
'<p>' .
Html::element( 'label', array(
'for' => 'wpCaptchaWord',
- ), parent::getMessage( 'label' ) . wfMsg( 'colon-separator' ) ) .
+ ), parent::getMessage( 'label' ) . wfMessage( 'colon-separator' )->text() ) .
Html::element( 'input', array(
'name' => 'wpCaptchaWord',
'id' => 'wpCaptchaWord',
/**
* Count the number of files in a directory.
+ * @param $dirname
* @return int
*/
function countFiles( $dirname ) {
*/
function getMessage( $action ) {
$name = 'fancycaptcha-' . $action;
- $text = wfMsg( $name );
+ $text = wfMessage( $name )->text();
# Obtain a more tailored message, if possible, otherwise, fall back to
# the default for edits
- return wfEmptyMsg( $name, $text ) ? wfMsg( 'fancycaptcha-edit' ) : $text;
+ return wfMessage( $name, $text )->isDisabled() ? wfMessage( 'fancycaptcha-edit' )->text() : $text;
}
/**
function getMessage( $action ) {
$name = 'questycaptcha-' . $action;
- $text = wfMsg( $name );
+ $text = wfMessage( $name )->text();
# Obtain a more tailored message, if possible, otherwise, fall back to
# the default for edits
- return wfEmptyMsg( $name, $text ) ? wfMsg( 'questycaptcha-edit' ) : $text;
+ return wfMessage( $name, $text )->isDisabled() ? wfMessage( 'questycaptcha-edit' )->text() : $text;
}
function showHelp() {
global $wgOut;
- $wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) );
- $wgOut->addWikiText( wfMsg( 'questycaptchahelp-text' ) );
+ $wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() );
+ $wgOut->addWikiMsg( 'questycaptchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) {
- $wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) );
+ $wgOut->addWikiMsg( 'captchahelp-cookies-needed' );
}
}
}