<exclude name="MediaWiki.Commenting.MissingCovers.MissingCovers" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
- <exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
<exclude name="MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
public function msg( $key ) {
$args = func_get_args();
+ // phpcs:ignore MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage
return wfMessage( ...$args )->setContext( $this );
}
}
}
if ( in_array( $type, [ 'asc', 'desc' ] ) ) {
- $attrs['title'] = wfMessage( $type == 'asc' ? 'sort-ascending' : 'sort-descending' )->text();
+ $attrs['title'] = $this->msg( $type == 'asc' ? 'sort-ascending' : 'sort-descending' )->text();
}
if ( $type ) {
$t = $embed . implode( "{$pop}{$embed}", $allCats['normal'] ) . $pop;
$msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped();
- $linkPage = wfMessage( 'pagecategorieslink' )->inContentLanguage()->text();
+ $linkPage = $this->msg( 'pagecategorieslink' )->inContentLanguage()->text();
$title = Title::newFromText( $linkPage );
$link = $title ? Linker::link( $title, $msg ) : $msg;
$s .= '<div id="mw-normal-catlinks" class="mw-normal-catlinks">' .
* @param string $message
*/
public function addToSidebar( &$bar, $message ) {
- $this->addToSidebarPlain( $bar, wfMessage( $message )->inContentLanguage()->plain() );
+ $this->addToSidebarPlain( $bar, $this->msg( $message )->inContentLanguage()->plain() );
}
/**
$attribs = [];
if ( !is_null( $tooltip ) ) {
- $attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
+ $attribs['title'] = $this->msg( 'editsectionhint' )->rawParams( $tooltip )
->inLanguage( $lang )->text();
}
$links = [
'editsection' => [
- 'text' => wfMessage( 'editsection' )->inLanguage( $lang )->escaped(),
+ 'text' => $this->msg( 'editsection' )->inLanguage( $lang )->escaped(),
'targetTitle' => $nt,
'attribs' => $attribs,
'query' => [ 'action' => 'edit', 'section' => $section ],
$result .= implode(
'<span class="mw-editsection-divider">'
- . wfMessage( 'pipe-separator' )->inLanguage( $lang )->escaped()
+ . $this->msg( 'pipe-separator' )->inLanguage( $lang )->escaped()
. '</span>',
$linksHtml
);
$form->addPreText(
Html::openElement( 'dl' )
- . Html::element( 'dt', [], wfMessage( 'credentialsform-provider' )->text() )
+ . Html::element( 'dt', [], $this->msg( 'credentialsform-provider' )->text() )
. Html::element( 'dd', [], $info['provider'] )
- . Html::element( 'dt', [], wfMessage( 'credentialsform-account' )->text() )
+ . Html::element( 'dt', [], $this->msg( 'credentialsform-account' )->text() )
. Html::element( 'dd', [], $info['account'] )
. Html::closeElement( 'dl' )
);
$dateRangeSelection = Html::rawElement(
'div',
[],
- Xml::label( wfMessage( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
+ Xml::label( $this->msg( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
new DateInputWidget( [
'infusable' => true,
'id' => 'mw-date-start',
'value' => $this->opts['start'],
'longDisplayFormat' => true,
] ) . '<br>' .
- Xml::label( wfMessage( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
+ Xml::label( $this->msg( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
new DateInputWidget( [
'infusable' => true,
'id' => 'mw-date-end',
* SPF and bounce problems with some mailers (see below).
*/
$mailFrom = new MailAddress( $config->get( 'PasswordSender' ),
- wfMessage( 'emailsender' )->inContentLanguage()->text() );
+ $context->msg( 'emailsender' )->inContentLanguage()->text() );
$replyTo = $from;
} else {
/**
if ( $config->get( 'UserEmailUseReplyTo' ) ) {
$mailFrom = new MailAddress(
$config->get( 'PasswordSender' ),
- wfMessage( 'emailsender' )->inContentLanguage()->text()
+ $context->msg( 'emailsender' )->inContentLanguage()->text()
);
$replyTo = $ccFrom;
} else {
if ( !$this->isActionAllowed( $this->authAction ) ) {
if ( $this->authAction === AuthManager::ACTION_LINK ) {
// looks like no linking provider is installed or willing to take this user
- $titleMessage = wfMessage( 'cannotlink-no-provider-title' );
- $errorMessage = wfMessage( 'cannotlink-no-provider' );
+ $titleMessage = $this->msg( 'cannotlink-no-provider-title' );
+ $errorMessage = $this->msg( 'cannotlink-no-provider' );
throw new ErrorPageError( $titleMessage, $errorMessage );
} else {
// user probably back-button-navigated into an auth session that no longer exists
}
$status = StatusValue::newGood();
- $status->warning( wfMessage( 'unlinkaccounts-success' ) );
+ $status->warning( $this->msg( 'unlinkaccounts-success' ) );
$this->loadAuth( $subPage, null, true ); // update requests so the unlinked one doesn't show up
// Reset sessions - if the user unlinked an account because it was compromised,
$this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file
$commentDefault = '';
- $commentMsg = wfMessage( 'upload-default-description' )->inContentLanguage();
+ $commentMsg = $this->msg( 'upload-default-description' )->inContentLanguage();
if ( !$this->mForReUpload && !$commentMsg->isDisabled() ) {
$commentDefault = $commentMsg->plain();
}
} elseif ( $warning == 'no-change' ) {
$file = $args;
$filename = $file->getTitle()->getPrefixedText();
- $msg = "\t<li>" . wfMessage( 'fileexists-no-change', $filename )->parse() . "</li>\n";
+ $msg = "\t<li>" . $this->msg( 'fileexists-no-change', $filename )->parse() . "</li>\n";
} elseif ( $warning == 'duplicate-version' ) {
$file = $args[0];
$count = count( $args );
$filename = $file->getTitle()->getPrefixedText();
- $message = wfMessage( 'fileexists-duplicate-version' )
+ $message = $this->msg( 'fileexists-duplicate-version' )
->params( $filename )
->numParams( $count );
$msg = "\t<li>" . $message->parse() . "</li>\n";
$ltitle = SpecialPage::getTitleFor( 'Log' );
$llink = $linkRenderer->makeKnownLink(
$ltitle,
- wfMessage( 'deletionlog' )->text(),
+ $this->msg( 'deletionlog' )->text(),
[],
[
'type' => 'delete',
'page' => Title::makeTitle( NS_FILE, $args )->getPrefixedText(),
]
);
- $msg = "\t<li>" . wfMessage( 'filewasdeleted' )->rawParams( $llink )->parse() . "</li>\n";
+ $msg = "\t<li>" . $this->msg( 'filewasdeleted' )->rawParams( $llink )->parse() . "</li>\n";
} elseif ( $warning == 'duplicate' ) {
$msg = $this->getDupeWarning( $args );
} elseif ( $warning == 'duplicate-archive' ) {
if ( $type !== 'file' && $type !== 'thumb' ) {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-unknown-type', $type )
+ $this->msg( 'uploadstash-bad-path-unknown-type', $type )
);
}
$fileName = strtok( '/' );
$srcNamePos = strrpos( $thumbPart, $fileName );
if ( $srcNamePos === false || $srcNamePos < 1 ) {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-unrecognized-thumb-name' )
+ $this->msg( 'uploadstash-bad-path-unrecognized-thumb-name' )
);
}
$paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
return [ 'file' => $file, 'type' => $type, 'params' => $params ];
} else {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
+ $this->msg( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
);
}
}
$thumbnailImage = $file->transform( $params, $flags );
if ( !$thumbnailImage ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-thumb' )
+ $this->msg( 'uploadstash-file-not-found-no-thumb' )
);
}
// we should have just generated it locally
if ( !$thumbnailImage->getStoragePath() ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-local-path' )
+ $this->msg( 'uploadstash-file-not-found-no-local-path' )
);
}
$this->stash->repo, $thumbnailImage->getStoragePath(), false );
if ( !$thumbFile ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-object' )
+ $this->msg( 'uploadstash-file-not-found-no-object' )
);
}
if ( !$status->isOK() ) {
$errors = $status->getErrorsArray();
throw new UploadStashFileNotFoundException(
- wfMessage(
+ $this->msg(
'uploadstash-file-not-found-no-remote-thumb',
print_r( $errors, 1 ),
$scalerThumbUrl
$contentType = $req->getResponseHeader( "content-type" );
if ( !$contentType ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-missing-content-type' )
+ $this->msg( 'uploadstash-file-not-found-missing-content-type' )
);
}
private function outputLocalFile( File $file ) {
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException(
- wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
+ $this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
);
}
$size = strlen( $content );
if ( $size > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException(
- wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
+ $this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
);
}
// Cancel output buffering and gzipping if set
if ( $thumb ) {
return $thumb->toHtml( [ 'desc-link' => true ] );
} else {
- return wfMessage( 'thumbnail_error', '' )->escaped();
+ return $this->msg( 'thumbnail_error', '' )->escaped();
}
} else {
return htmlspecialchars( $value );