From 8d4913ec4dea6397bd6bd6a6a9f56d0fabcaf667 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Aug 2012 20:48:38 +0200 Subject: [PATCH] Replace deprecated wfMsg* calls with Message class calls. Change-Id: Ifa80db1d81b9b9d1a5adfcac06a9ed14203c100e --- includes/Article.php | 17 +-- includes/ChangesList.php | 4 +- includes/EditPage.php | 153 ++++++++++++++------------ includes/specials/SpecialUndelete.php | 13 +-- includes/specials/SpecialUpload.php | 39 +++---- 5 files changed, 116 insertions(+), 110 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 92b69919f6..5a8bbeb2dc 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -351,7 +351,7 @@ class Article extends Page { # Pre-fill content with error message so that if something # fails we'll have something telling us what we intended. - $this->mContent = wfMsgNoTrans( 'missing-revision', $oldid ); + $this->mContent = wfMessage( 'missing-revision', $oldid )->plain(); if ( $oldid ) { # $this->mRevision might already be fetched by getOldIDFromRequest() @@ -1041,16 +1041,16 @@ class Article extends Page { # Show error message $oldid = $this->getOldID(); if ( $oldid ) { - $text = wfMsgNoTrans( 'missing-revision', $oldid ); + $text = wfMessage( 'missing-revision', $oldid )->plain(); } elseif ( $this->getTitle()->getNamespace() === NS_MEDIAWIKI ) { // Use the default message text $text = $this->getTitle()->getDefaultMessageText(); } elseif ( $this->getTitle()->quickUserCan( 'create', $this->getContext()->getUser() ) && $this->getTitle()->quickUserCan( 'edit', $this->getContext()->getUser() ) ) { - $text = wfMsgNoTrans( 'noarticletext' ); + $text = wfMessage( 'noarticletext' )->plain(); } else { - $text = wfMsgNoTrans( 'noarticletext-nopermission' ); + $text = wfMessage( 'noarticletext-nopermission' )->plain(); } $text = "
\n$text\n
"; @@ -1218,8 +1218,9 @@ class Article extends Page { } $outputPage->addSubtitle( "
" . $cdel . - wfMsgExt( 'revision-nav', array( 'escapenoentities', 'parsemag', 'replaceafter' ), - $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "
" ); + wfMessage( 'revision-nav' )->rawParams( + $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff + )->escaped() . "" ); } /** @@ -1436,7 +1437,7 @@ class Article extends Page { $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=delete' ), 'id' => 'deleteconfirm' ) ) . Xml::openElement( 'fieldset', array( 'id' => 'mw-delete-table' ) ) . - Xml::tags( 'legend', null, wfMsgExt( 'delete-legend', array( 'parsemag', 'escapenoentities' ) ) ) . + Xml::tags( 'legend', null, wfMessage( 'delete-legend' )->escaped() ) . Xml::openElement( 'table', array( 'id' => 'mw-deleteconfirm-table' ) ) . " " . @@ -1524,7 +1525,7 @@ class Article extends Page { $outputPage->setPageTitle( wfMessage( 'actioncomplete' ) ); $outputPage->setRobotPolicy( 'noindex,nofollow' ); - $loglink = '[[Special:Log/delete|' . wfMsgNoTrans( 'deletionlog' ) . ']]'; + $loglink = '[[Special:Log/delete|' . wfMessage( 'deletionlog' )->text() . ']]'; $outputPage->addWikiMsg( 'deletedtext', wfEscapeWikiText( $deleted ), $loglink ); $outputPage->returnToMain( false ); diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 51a371862a..8cca4bb620 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -163,8 +163,8 @@ class ChangesList extends ContextSource { 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ), ); foreach( $messages as &$value ) { - $value[0] = wfMsgExt( $value[0], 'escapenoentities' ); - $value[1] = wfMsgExt( $value[1], 'escapenoentities' ); + $value[0] = wfMessage( $value[0] )->escaped(); + $value[1] = wfMessage( $value[1] )->escaped(); } } diff --git a/includes/EditPage.php b/includes/EditPage.php index 90135df480..b958f1766e 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -836,11 +836,12 @@ class EditPage { # If we just undid one rev, use an autosummary $firstrev = $oldrev->getNext(); if ( $firstrev && $firstrev->getId() == $undo ) { - $undoSummary = wfMsgForContent( 'undo-summary', $undo, $undorev->getUserText() ); + $undoSummary = wfMessage( 'undo-summary', $undo, $undorev->getUserText() )->inContentLanguage()->text(); if ( $this->summary === '' ) { $this->summary = $undoSummary; } else { - $this->summary = $undoSummary . wfMsgForContent( 'colon-separator' ) . $this->summary; + $this->summary = $undoSummary . wfMessage( 'colon-separator' ) + ->inContentLanguage()->text() . $this->summary; } $this->undidRev = $undo; } @@ -855,7 +856,7 @@ class EditPage { $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}"; $this->editFormPageTop .= $wgOut->parse( "
" . - wfMsgNoTrans( 'undo-' . $undoMsg ) . '
', true, /* interface */true ); + wfMessage( 'undo-' . $undoMsg )->plain() . '', true, /* interface */true ); } if ( $text === false ) { @@ -1243,7 +1244,8 @@ class EditPage { if ( $this->section == 'new' ) { if ( $this->sectiontitle !== '' ) { // Insert the section title above the content. - $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->sectiontitle ) . "\n\n" . $text; + $text = wfMessage( 'newsectionheaderdefaultlevel', $this->sectiontitle ) + ->inContentLanguage()->text() . "\n\n" . $text; // Jump to the new section $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle ); @@ -1253,18 +1255,21 @@ class EditPage { // passed. if ( $this->summary === '' ) { $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSectionTitle ); + $this->summary = wfMessage( 'newsectionsummary', $cleanSectionTitle ) + ->inContentLanguage()->text(); } } elseif ( $this->summary !== '' ) { // Insert the section title above the content. - $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text; + $text = wfMessage( 'newsectionheaderdefaultlevel', $this->summary ) + ->inContentLanguage()->text() . "\n\n" . $text; // Jump to the new section $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); // Create a link to the new section from the edit summary. $cleanSummary = $wgParser->stripSectionName( $this->summary ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSummary ); + $this->summary = wfMessage( 'newsectionsummary', $cleanSummary ) + ->inContentLanguage()->text(); } } @@ -1394,14 +1399,16 @@ class EditPage { // passed. if ( $this->summary === '' ) { $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSectionTitle ); + $this->summary = wfMessage( 'newsectionsummary', $cleanSectionTitle ) + ->inContentLanguage()->text(); } } elseif ( $this->summary !== '' ) { $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); # This is a new section, so create a link to the new section # in the revision summary. $cleanSummary = $wgParser->stripSectionName( $this->summary ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSummary ); + $this->summary = wfMessage( 'newsectionsummary', $cleanSummary ) + ->inContentLanguage()->text(); } } elseif ( $this->section != '' ) { # Try to get a section anchor from the section source, redirect to edited section if header found @@ -1813,8 +1820,8 @@ class EditPage { : 'confirmrecreate'; $wgOut->addHTML( '
' . - wfMsgExt( $key, 'parseinline', $username, "$comment" ) . - Xml::checkLabel( wfMsg( 'recreate' ), 'wpRecreate', 'wpRecreate', false, + wfMessage( $key, $username, "$comment" )->parse() . + Xml::checkLabel( wfMessage( 'recreate' )->text(), 'wpRecreate', 'wpRecreate', false, array( 'title' => Linker::titleAttrib( 'recreate' ), 'tabindex' => 1, 'id' => 'wpRecreate' ) ) . '
' @@ -2158,7 +2165,7 @@ class EditPage { } } $summary = $wgContLang->recodeForEdit( $summary ); - $labelText = wfMsgExt( $isSubjectPreview ? 'subject' : 'summary', 'parseinline' ); + $labelText = wfMessage( $isSubjectPreview ? 'subject' : 'summary' )->parse(); list( $label, $input ) = $this->getSummaryInput( $summary, $labelText, array( 'class' => $summaryClass ), array() ); $wgOut->addHTML( "{$label} {$input}" ); } @@ -2177,11 +2184,12 @@ class EditPage { global $wgParser; if ( $isSubjectPreview ) - $summary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $summary ) ); + $summary = wfMessage( 'newsectionsummary', $wgParser->stripSectionName( $summary ) ) + ->inContentLanguage()->text(); $message = $isSubjectPreview ? 'subject-preview' : 'summary-preview'; - $summary = wfMsgExt( $message, 'parseinline' ) . Linker::commentBlock( $summary, $this->mTitle, $isSubjectPreview ); + $summary = wfMessage( $message )->parse() . Linker::commentBlock( $summary, $this->mTitle, $isSubjectPreview ); return Xml::tags( 'div', array( 'class' => 'mw-summary-preview' ), $summary ); } @@ -2377,8 +2385,8 @@ HTML $newtext = $wgParser->preSaveTransform( $newtext, $this->mTitle, $wgUser, $popts ); if ( $oldtext !== false || $newtext != '' ) { - $oldtitle = wfMsgExt( $oldtitlemsg, array( 'parseinline' ) ); - $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); + $oldtitle = wfMessage( $oldtitlemsg )->parse(); + $newtitle = wfMessage( 'yourtext' )->parse(); $de = new DifferenceEngine( $this->mArticle->getContext() ); $de->setText( $oldtext, $newtext ); @@ -2430,11 +2438,11 @@ HTML global $wgRightsText; if ( $wgRightsText ) { $copywarnMsg = array( 'copyrightwarning', - '[[' . wfMsgForContent( 'copyrightpage' ) . ']]', + '[[' . wfMessage( 'copyrightpage' )->inContentLanguage()->text() . ']]', $wgRightsText ); } else { $copywarnMsg = array( 'copyrightwarning2', - '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' ); + '[[' . wfMessage( 'copyrightpage' )->inContentLanguage()->text() . ']]' ); } // Allow for site and per-namespace customization of contribution/copyright notice. wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) ); @@ -2460,12 +2468,12 @@ HTML $cancel = $this->getCancelLink(); if ( $cancel !== '' ) { - $cancel .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); + $cancel .= wfMessage( 'pipe-separator' )->text(); } - $edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ) ); + $edithelpurl = Skin::makeInternalOrExternalUrl( wfMessage( 'edithelppage' )->inContentLanguage()->text() ); $edithelp = '' . - htmlspecialchars( wfMsg( 'edithelp' ) ) . ' ' . - htmlspecialchars( wfMsg( 'newwindow' ) ); + wfMessage( 'edithelp' )->escaped() . ' ' . + wfMessage( 'newwindow' )->escaped(); $wgOut->addHTML( " {$cancel}{$edithelp}\n" ); $wgOut->addHTML( "\n\n" ); } @@ -2482,7 +2490,10 @@ HTML $de = new DifferenceEngine( $this->mArticle->getContext() ); $de->setText( $this->textbox2, $this->textbox1 ); - $de->showDiff( wfMsgExt( 'yourtext', 'parseinline' ), wfMsg( 'storedversion' ) ); + $de->showDiff( + wfMessage( 'yourtext' )->parse(), + wfMessage( 'storedversion' )->text() + ); $wgOut->wrapWikiMsg( '

$1

', "yourtext" ); $this->showTextbox2(); @@ -2500,7 +2511,7 @@ HTML return Linker::linkKnown( $this->getContextTitle(), - wfMsgExt( 'cancel', array( 'parseinline' ) ), + wfMessage( 'cancel' )->parse(), array( 'id' => 'mw-editform-cancel' ), $cancelParams ); @@ -2570,9 +2581,9 @@ HTML // Quick paranoid permission checks... if ( is_object( $data ) ) { if ( $data->log_deleted & LogPage::DELETED_USER ) - $data->user_name = wfMsgHtml( 'rev-deleted-user' ); + $data->user_name = wfMessage( 'rev-deleted-user' )->escaped(); if ( $data->log_deleted & LogPage::DELETED_COMMENT ) - $data->log_comment = wfMsgHtml( 'rev-deleted-comment' ); + $data->log_comment = wfMessage( 'rev-deleted-comment' )->escaped(); } return $data; } @@ -2595,7 +2606,7 @@ HTML // string, which happens when you initially edit // a category page, due to automatic preview-on-open. $parsedNote = $wgOut->parse( "
" . - wfMsg( 'session_fail_preview_html' ) . "
", true, /* interface */true ); + wfMessage( 'session_fail_preview_html' )->text() . "", true, /* interface */true ); } wfProfileOut( __METHOD__ ); return $parsedNote; @@ -2603,15 +2614,15 @@ HTML if ( $this->mTriedSave && !$this->mTokenOk ) { if ( $this->mTokenOkExceptSuffix ) { - $note = wfMsg( 'token_suffix_mismatch' ); + $note = wfMessage( 'token_suffix_mismatch' )->text(); } else { - $note = wfMsg( 'session_fail_preview' ); + $note = wfMessage( 'session_fail_preview' )->text(); } } elseif ( $this->incompleteForm ) { - $note = wfMsg( 'edit_form_incomplete' ); + $note = wfMessage( 'edit_form_incomplete' )->text(); } else { - $note = wfMsg( 'previewnote' ) . - ' [[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . wfMsg( 'continue-editing' ) . ']]'; + $note = wfMessage( 'previewnote' ) . + ' [[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . wfMessage( 'continue-editing' )->text() . ']]'; } $parserOptions = ParserOptions::newFromUser( $wgUser ); @@ -2635,10 +2646,10 @@ HTML $class = 'mw-code'; if ( $level ) { if ( preg_match( "/\\.css$/", $this->mTitle->getText() ) ) { - $previewtext = "
\n" . wfMsg( "{$level}csspreview" ) . "\n
"; + $previewtext = "
\n" . wfMessage( "{$level}csspreview" )->text() . "\n
"; $class .= " mw-css"; } elseif ( preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { - $previewtext = "
\n" . wfMsg( "{$level}jspreview" ) . "\n
"; + $previewtext = "
\n" . wfMessage( "{$level}jspreview" )->text() . "\n
"; $class .= " mw-js"; } else { throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' ); @@ -2656,7 +2667,7 @@ HTML # If we're adding a comment, we need to show the # summary as the headline if ( $this->section == "new" && $this->summary != "" ) { - $toparse = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $toparse; + $toparse = wfMessage( 'newsectionheaderdefaultlevel', $this->summary )->inContentLanguage()->text() . "\n\n" . $toparse; } wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) ); @@ -2682,13 +2693,13 @@ HTML } if ( $this->isConflict ) { - $conflict = '

' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "

\n"; + $conflict = '

' . wfMessage( 'previewconflict' )->escaped() . "

\n"; } else { $conflict = '
'; } $previewhead = "
\n" . - '

' . htmlspecialchars( wfMsg( 'preview' ) ) . "

" . + '

' . wfMessage( 'preview' )->escaped() . "

" . $wgOut->parse( $note, true, /* interface */true ) . $conflict . "
\n"; $pageLang = $this->mTitle->getPageLanguage(); @@ -2752,8 +2763,8 @@ HTML 'id' => 'mw-editbutton-bold', 'open' => '\'\'\'', 'close' => '\'\'\'', - 'sample' => wfMsg( 'bold_sample' ), - 'tip' => wfMsg( 'bold_tip' ), + 'sample' => wfMessage( 'bold_sample' )->text(), + 'tip' => wfMessage( 'bold_tip' )->text(), 'key' => 'B' ), array( @@ -2761,8 +2772,8 @@ HTML 'id' => 'mw-editbutton-italic', 'open' => '\'\'', 'close' => '\'\'', - 'sample' => wfMsg( 'italic_sample' ), - 'tip' => wfMsg( 'italic_tip' ), + 'sample' => wfMessage( 'italic_sample' )->text(), + 'tip' => wfMessage( 'italic_tip' )->text(), 'key' => 'I' ), array( @@ -2770,8 +2781,8 @@ HTML 'id' => 'mw-editbutton-link', 'open' => '[[', 'close' => ']]', - 'sample' => wfMsg( 'link_sample' ), - 'tip' => wfMsg( 'link_tip' ), + 'sample' => wfMessage( 'link_sample' )->text(), + 'tip' => wfMessage( 'link_tip' )->text(), 'key' => 'L' ), array( @@ -2779,8 +2790,8 @@ HTML 'id' => 'mw-editbutton-extlink', 'open' => '[', 'close' => ']', - 'sample' => wfMsg( 'extlink_sample' ), - 'tip' => wfMsg( 'extlink_tip' ), + 'sample' => wfMessage( 'extlink_sample' )->text(), + 'tip' => wfMessage( 'extlink_tip' )->text(), 'key' => 'X' ), array( @@ -2788,8 +2799,8 @@ HTML 'id' => 'mw-editbutton-headline', 'open' => "\n== ", 'close' => " ==\n", - 'sample' => wfMsg( 'headline_sample' ), - 'tip' => wfMsg( 'headline_tip' ), + 'sample' => wfMessage( 'headline_sample' )->text(), + 'tip' => wfMessage( 'headline_tip' )->text(), 'key' => 'H' ), $imagesAvailable ? array( @@ -2797,8 +2808,8 @@ HTML 'id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':', 'close' => ']]', - 'sample' => wfMsg( 'image_sample' ), - 'tip' => wfMsg( 'image_tip' ), + 'sample' => wfMessage( 'image_sample' )->text(), + 'tip' => wfMessage( 'image_tip' )->text(), 'key' => 'D', ) : false, $imagesAvailable ? array( @@ -2806,8 +2817,8 @@ HTML 'id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':', 'close' => ']]', - 'sample' => wfMsg( 'media_sample' ), - 'tip' => wfMsg( 'media_tip' ), + 'sample' => wfMessage( 'media_sample' )->text(), + 'tip' => wfMessage( 'media_tip' )->text(), 'key' => 'M' ) : false, $wgUseTeX ? array( @@ -2815,8 +2826,8 @@ HTML 'id' => 'mw-editbutton-math', 'open' => "", 'close' => "", - 'sample' => wfMsg( 'math_sample' ), - 'tip' => wfMsg( 'math_tip' ), + 'sample' => wfMessage( 'math_sample' )->text(), + 'tip' => wfMessage( 'math_tip' )->text(), 'key' => 'C' ) : false, array( @@ -2824,8 +2835,8 @@ HTML 'id' => 'mw-editbutton-nowiki', 'open' => "", 'close' => "", - 'sample' => wfMsg( 'nowiki_sample' ), - 'tip' => wfMsg( 'nowiki_tip' ), + 'sample' => wfMessage( 'nowiki_sample' )->text(), + 'tip' => wfMessage( 'nowiki_tip' )->text(), 'key' => 'N' ), array( @@ -2834,7 +2845,7 @@ HTML 'open' => '--~~~~', 'close' => '', 'sample' => '', - 'tip' => wfMsg( 'sig_tip' ), + 'tip' => wfMessage( 'sig_tip' )->text(), 'key' => 'Y' ), array( @@ -2843,7 +2854,7 @@ HTML 'open' => "\n----\n", 'close' => '', 'sample' => '', - 'tip' => wfMsg( 'hr_tip' ), + 'tip' => wfMessage( 'hr_tip' )->text(), 'key' => 'R' ) ); @@ -2904,11 +2915,11 @@ HTML // don't show the minor edit checkbox if it's a new page or section if ( !$this->isNew ) { $checkboxes['minor'] = ''; - $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) ); + $minorLabel = wfMessage( 'minoredit' )->parse(); if ( $wgUser->isAllowed( 'minoredit' ) ) { $attribs = array( 'tabindex' => ++$tabindex, - 'accesskey' => wfMsg( 'accesskey-minoredit' ), + 'accesskey' => wfMessage( 'accesskey-minoredit' )->text(), 'id' => 'wpMinoredit', ); $checkboxes['minor'] = @@ -2919,12 +2930,12 @@ HTML } } - $watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) ); + $watchLabel = wfMessage( 'watchthis' )->parse(); $checkboxes['watch'] = ''; if ( $wgUser->isLoggedIn() ) { $attribs = array( 'tabindex' => ++$tabindex, - 'accesskey' => wfMsg( 'accesskey-watch' ), + 'accesskey' => wfMessage( 'accesskey-watch' )->text(), 'id' => 'wpWatchthis', ); $checkboxes['watch'] = @@ -2953,9 +2964,9 @@ HTML 'name' => 'wpSave', 'type' => 'submit', 'tabindex' => ++$tabindex, - 'value' => wfMsg( 'savearticle' ), - 'accesskey' => wfMsg( 'accesskey-save' ), - 'title' => wfMsg( 'tooltip-save' ) . ' [' . wfMsg( 'accesskey-save' ) . ']', + 'value' => wfMessage( 'savearticle' )->text(), + 'accesskey' => wfMessage( 'accesskey-save' )->text(), + 'title' => wfMessage( 'tooltip-save' )->text() . ' [' . wfMessage( 'accesskey-save' )->text() . ']', ); $buttons['save'] = Xml::element( 'input', $temp, '' ); @@ -2965,9 +2976,9 @@ HTML 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => $tabindex, - 'value' => wfMsg( 'showpreview' ), - 'accesskey' => wfMsg( 'accesskey-preview' ), - 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']', + 'value' => wfMessage( 'showpreview' )->text(), + 'accesskey' => wfMessage( 'accesskey-preview' )->text(), + 'title' => wfMessage( 'tooltip-preview' )->text() . ' [' . wfMessage( 'accesskey-preview' )->text() . ']', ); $buttons['preview'] = Xml::element( 'input', $temp, '' ); $buttons['live'] = ''; @@ -2977,9 +2988,9 @@ HTML 'name' => 'wpDiff', 'type' => 'submit', 'tabindex' => ++$tabindex, - 'value' => wfMsg( 'showdiff' ), - 'accesskey' => wfMsg( 'accesskey-diff' ), - 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']', + 'value' => wfMessage( 'showdiff' )->text(), + 'accesskey' => wfMessage( 'accesskey-diff' )->text(), + 'title' => wfMessage( 'tooltip-diff' )->text() . ' [' . wfMessage( 'accesskey-diff' )->text() . ']', ); $buttons['diff'] = Xml::element( 'input', $temp, '' ); @@ -3060,7 +3071,7 @@ HTML $wgOut->prepareErrorPage( wfMessage( 'nosuchsectiontitle' ) ); - $res = wfMsgExt( 'nosuchsectiontext', 'parse', $this->section ); + $res = wfMessage( 'nosuchsectiontext', $this->section )->parseAsBlock(); wfRunHooks( 'EditPageNoSuchSection', array( &$this, &$res ) ); $wgOut->addHTML( $res ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 2b9b523cf9..b1555c6dee 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -359,15 +359,14 @@ class PageArchive { // Touch the log! if( $textRestored && $filesRestored ) { - $reason = wfMsgExt( 'undeletedrevisions-files', array( 'content', 'parsemag' ), - $wgContLang->formatNum( $textRestored ), - $wgContLang->formatNum( $filesRestored ) ); + $reason = wfMessage( 'undeletedrevisions-files' ) + ->numParams( $textRestored, $filesRestored )->inContentLanguage()->text(); } elseif( $textRestored ) { - $reason = wfMsgExt( 'undeletedrevisions', array( 'content', 'parsemag' ), - $wgContLang->formatNum( $textRestored ) ); + $reason = wfMessage( 'undeletedrevisions' )->numParams( $textRestored ) + ->inContentLanguage()->text(); } elseif( $filesRestored ) { - $reason = wfMsgExt( 'undeletedfiles', array( 'content', 'parsemag' ), - $wgContLang->formatNum( $filesRestored ) ); + $reason = wfMessage( 'undeletedfiles' )->numParams( $filesRestored ) + ->inContentLanguage()->text(); } else { wfDebug( "Undelete: nothing undeleted...\n" ); return false; diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 8cecd07b1e..d1a9b160c9 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -255,7 +255,7 @@ class SpecialUpload extends SpecialPage { # Add text to form $form->addPreText( '
' . - wfMsgExt( 'uploadtext', 'parse', array( $this->mDesiredDestName ) ) . + $this->msg( 'uploadtext', array( $this->mDesiredDestName ) )->parseAsBlock() . '
' ); # Add upload error message $form->addPreText( $message ); @@ -280,14 +280,12 @@ class SpecialUpload extends SpecialPage { if( $title instanceof Title ) { $count = $title->isDeleted(); if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) { - $link = wfMsgExt( - $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted', - array( 'parse', 'replaceafter' ), - Linker::linkKnown( - SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ), - wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $count ) - ) + $restorelink = Linker::linkKnown( + SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ), + $this->msg( 'restorelink' )->numParams( $count )->escaped() ); + $link = $this->msg( $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted' ) + ->rawParams( $restorelink )->parseAsBlock(); $this->getOutput()->addHTML( "
{$link}
" ); } } @@ -357,7 +355,7 @@ class SpecialUpload extends SpecialPage { $warningHtml .= $msg; } $warningHtml .= "\n"; - $warningHtml .= wfMsgExt( 'uploadwarning-text', 'parse' ); + $warningHtml .= $this->msg( 'uploadwarning-text' )->parseAsBlock(); $form = $this->getUploadForm( $warningHtml, $sessionKey, /* $hideIgnoreWarning */ true ); $form->setSubmitText( $this->msg( 'upload-tryagain' )->text() ); @@ -668,7 +666,7 @@ class SpecialUpload extends SpecialPage { 'page' => $filename ) ); - $warning = wfMsgExt( 'filewasdeleted', array( 'parse', 'replaceafter' ), $llink ); + $warning = wfMessage( 'filewasdeleted' )->rawParams( $llink )->parseAsBlock(); } return $warning; @@ -714,9 +712,8 @@ class SpecialUpload extends SpecialPage { } $msg .= ''; return '
  • ' . - wfMsgExt( 'file-exists-duplicate', array( 'parse' ), count( $dupes ) ) . - $wgOut->parse( $msg ) . - "
  • \n"; + wfMessage( 'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() . + $wgOut->parse( $msg ) . "\n"; } else { return ''; } @@ -840,10 +837,9 @@ class UploadForm extends HTMLForm { 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, - 'help' => wfMsgExt( 'upload-maxfilesize', - array( 'parseinline', 'escapenoentities' ), + 'help' => $this->msg( 'upload-maxfilesize', $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] ) - ) . ' ' . $this->msg( 'upload_source_file' )->escaped(), + )->parse() . ' ' . $this->msg( 'upload_source_file' )->escaped(), 'checked' => $selectedSourceType == 'file', ); if ( $canUploadByUrl ) { @@ -855,10 +851,9 @@ class UploadForm extends HTMLForm { 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, - 'help' => wfMsgExt( 'upload-maxfilesize', - array( 'parseinline', 'escapenoentities' ), + 'help' => $this->msg( 'upload-maxfilesize', $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['url'] ) - ) . ' ' . $this->msg( 'upload_source_url' )->escaped(), + )->parse() . ' ' . $this->msg( 'upload_source_url' )->escaped(), 'checked' => $selectedSourceType == 'url', ); } @@ -889,16 +884,16 @@ class UploadForm extends HTMLForm { # Everything not permitted is banned $extensionsList = '
    ' . - wfMsgExt( 'upload-permitted', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) . + $this->msg( 'upload-permitted', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) )->parseAsBlock() . "
    \n"; } else { # We have to list both preferred and prohibited $extensionsList = '
    ' . - wfMsgExt( 'upload-preferred', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) . + $this->msg( 'upload-preferred', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) )->parseAsBlock() . "
    \n" . '
    ' . - wfMsgExt( 'upload-prohibited', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileBlacklist ) ) . + $this->msg( 'upload-prohibited', $this->getContext()->getLanguage()->commaList( $wgFileBlacklist ) )->parseAsBlock() . "
    \n"; } } else { -- 2.20.1