From 2fabea7eea556aba6eda9b3385d9844123328482 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Tue, 24 Jul 2012 02:04:15 +0100 Subject: [PATCH] Use wfMessage instead of deprecated wfMsg* Or $this->msg in special pages. Change-Id: I774a89d646615053c8424050e42ad95601f92543 --- includes/Action.php | 2 +- includes/Article.php | 80 +++++++++++----------- includes/Block.php | 6 +- includes/CategoryViewer.php | 2 +- includes/ChangeTags.php | 4 +- includes/ChangesFeed.php | 2 +- includes/DefaultSettings.php | 14 ++-- includes/GlobalFunctions.php | 10 +-- includes/Html.php | 6 +- includes/ImageGallery.php | 2 +- includes/Licenses.php | 4 +- includes/OutputPage.php | 2 +- includes/Status.php | 20 +++--- includes/Xml.php | 10 +-- includes/actions/HistoryAction.php | 14 ++-- includes/api/ApiEditPage.php | 2 +- includes/api/ApiFeedContributions.php | 5 +- includes/api/ApiFeedWatchlist.php | 7 +- includes/api/ApiParse.php | 2 +- includes/db/DatabaseError.php | 2 +- includes/db/DatabaseSqlite.php | 2 +- includes/filerepo/file/File.php | 2 +- includes/installer/CliInstaller.php | 2 +- includes/installer/Ibm_db2Installer.php | 2 +- includes/installer/MysqlInstaller.php | 4 +- includes/installer/OracleInstaller.php | 4 +- includes/installer/PostgresInstaller.php | 2 +- includes/job/DoubleRedirectJob.php | 7 +- includes/media/GIF.php | 4 +- includes/media/PNG.php | 6 +- includes/search/SearchEngine.php | 4 +- includes/specials/SpecialEditWatchlist.php | 4 +- includes/specials/SpecialUndelete.php | 2 +- includes/specials/SpecialUpload.php | 79 ++++++++++----------- includes/specials/SpecialVersion.php | 76 ++++++++++---------- includes/upload/UploadBase.php | 2 +- languages/Language.php | 4 +- languages/LanguageConverter.php | 4 +- maintenance/cleanupSpam.php | 8 +-- maintenance/language/dumpMessages.php | 2 +- maintenance/moveBatch.php | 2 +- opensearch_desc.php | 2 +- skins/CologneBlue.php | 44 ++++++------ skins/Nostalgia.php | 6 +- skins/Standard.php | 28 ++++---- thumb.php | 17 ++--- 46 files changed, 256 insertions(+), 259 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index f4343d16a2..51922251c0 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -341,7 +341,7 @@ abstract class Action { * @return String */ protected function getDescription() { - return wfMsgHtml( strtolower( $this->getName() ) ); + return $this->msg( strtolower( $this->getName() ) )->escaped(); } /** diff --git a/includes/Article.php b/includes/Article.php index 237f0ce296..92b69919f6 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -245,7 +245,8 @@ class Article extends Page { $text = ''; } } else { - $text = wfMsgExt( $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' ); + $message = $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon'; + $text = wfMessage( $message )->text(); } wfProfileOut( __METHOD__ ); @@ -961,21 +962,20 @@ class Article extends Page { $token = $user->getEditToken( $rcid ); $outputPage->preventClickjacking(); + $link = Linker::linkKnown( + $this->getTitle(), + wfMessage( 'markaspatrolledtext' )->escaped(), + array(), + array( + 'action' => 'markpatrolled', + 'rcid' => $rcid, + 'token' => $token, + ) + ); + $outputPage->addHTML( "' ); } @@ -1148,18 +1148,18 @@ class Article extends Page { $tdtime, $revision->getUser() )->parse() . "" ); $lnk = $current - ? wfMsgHtml( 'currentrevisionlink' ) + ? wfMessage( 'currentrevisionlink' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'currentrevisionlink' ), + wfMessage( 'currentrevisionlink' )->escaped(), array(), $extraParams ); $curdiff = $current - ? wfMsgHtml( 'diff' ) + ? wfMessage( 'diff' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'diff' ), + wfMessage( 'diff' )->escaped(), array(), array( 'diff' => 'cur', @@ -1170,30 +1170,30 @@ class Article extends Page { $prevlink = $prev ? Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'previousrevision' ), + wfMessage( 'previousrevision' )->escaped(), array(), array( 'direction' => 'prev', 'oldid' => $oldid ) + $extraParams ) - : wfMsgHtml( 'previousrevision' ); + : wfMessage( 'previousrevision' )->escaped(); $prevdiff = $prev ? Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'diff' ), + wfMessage( 'diff' )->escaped(), array(), array( 'diff' => 'prev', 'oldid' => $oldid ) + $extraParams ) - : wfMsgHtml( 'diff' ); + : wfMessage( 'diff' )->escaped(); $nextlink = $current - ? wfMsgHtml( 'nextrevision' ) + ? wfMessage( 'nextrevision' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'nextrevision' ), + wfMessage( 'nextrevision' )->escaped(), array(), array( 'direction' => 'next', @@ -1201,10 +1201,10 @@ class Article extends Page { ) + $extraParams ); $nextdiff = $current - ? wfMsgHtml( 'diff' ) + ? wfMessage( 'diff' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMsgHtml( 'diff' ), + wfMessage( 'diff' )->escaped(), array(), array( 'diff' => 'next', @@ -1241,7 +1241,8 @@ class Article extends Page { $imageDir = $lang->getDir(); if ( $appendSubtitle ) { - $this->getContext()->getOutput()->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) ); + $out = $this->getContext()->getOutput(); + $out->appendSubtitle( wfMessage( 'redirectpagesub' )->escaped() ); } // the loop prepends the arrow image before the link, so the first case needs to be outside @@ -1347,7 +1348,8 @@ class Article extends Page { $reason = $deleteReason; } elseif ( $deleteReason != '' ) { // Entry from drop down menu + additional comment - $reason = $deleteReasonList . wfMsgForContent( 'colon-separator' ) . $deleteReason; + $colonseparator = wfMessage( 'colon-separator' )->inContentLanguage()->text(); + $reason = $deleteReasonList . $colonseparator . $deleteReason; } else { $reason = $deleteReasonList; } @@ -1382,9 +1384,9 @@ class Article extends Page { $revisions = $this->mTitle->estimateRevisionCount(); // @todo FIXME: i18n issue/patchwork message $this->getContext()->getOutput()->addHTML( '' . - wfMsgExt( 'historywarning', array( 'parseinline' ), $this->getContext()->getLanguage()->formatNum( $revisions ) ) . - wfMsgHtml( 'word-separator' ) . Linker::linkKnown( $title, - wfMsgHtml( 'history' ), + wfMessage( 'historywarning' )->numParams( $revisions )->parse() . + wfMessage( 'word-separator' )->plain() . Linker::linkKnown( $title, + wfMessage( 'history' )->escaped(), array( 'rel' => 'archives' ), array( 'action' => 'history' ) ) . '' @@ -1422,7 +1424,7 @@ class Article extends Page { $suppress = " " . - Xml::checkLabel( wfMsg( 'revdelete-suppress' ), + Xml::checkLabel( wfMessage( 'revdelete-suppress' )->text(), 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '4' ) ) . " "; @@ -1438,17 +1440,17 @@ class Article extends Page { Xml::openElement( 'table', array( 'id' => 'mw-deleteconfirm-table' ) ) . " " . - Xml::label( wfMsg( 'deletecomment' ), 'wpDeleteReasonList' ) . + Xml::label( wfMessage( 'deletecomment' )->text(), 'wpDeleteReasonList' ) . " " . Xml::listDropDown( 'wpDeleteReasonList', - wfMsgForContent( 'deletereason-dropdown' ), - wfMsgForContent( 'deletereasonotherlist' ), '', 'wpReasonDropDown', 1 ) . + wfMessage( 'deletereason-dropdown' )->inContentLanguage()->text(), + wfMessage( 'deletereasonotherlist' )->inContentLanguage()->text(), '', 'wpReasonDropDown', 1 ) . " " . - Xml::label( wfMsg( 'deleteotherreason' ), 'wpReason' ) . + Xml::label( wfMessage( 'deleteotherreason' )->text(), 'wpReason' ) . " " . Html::input( 'wpReason', $reason, 'text', array( @@ -1467,7 +1469,7 @@ class Article extends Page { " . - Xml::checkLabel( wfMsg( 'watchthis' ), + Xml::checkLabel( wfMessage( 'watchthis' )->text(), 'wpWatch', 'wpWatch', $checkWatch, array( 'tabindex' => '3' ) ) . " "; @@ -1478,7 +1480,7 @@ class Article extends Page { " . - Xml::submitButton( wfMsg( 'deletepage' ), + Xml::submitButton( wfMessage( 'deletepage' )->text(), array( 'name' => 'wpConfirmB', 'id' => 'wpConfirmB', 'tabindex' => '5' ) ) . " " . @@ -1491,7 +1493,7 @@ class Article extends Page { $title = Title::makeTitle( NS_MEDIAWIKI, 'Deletereason-dropdown' ); $link = Linker::link( $title, - wfMsgHtml( 'delete-edit-reasonlist' ), + wfMessage( 'delete-edit-reasonlist' )->escaped(), array(), array( 'action' => 'edit' ) ); diff --git a/includes/Block.php b/includes/Block.php index 301a45acd1..6e8f9f372a 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -613,7 +613,7 @@ class Block { $key = wfMemcKey( 'ipb', 'autoblock', 'whitelist' ); $lines = $wgMemc->get( $key ); if ( !$lines ) { - $lines = explode( "\n", wfMsgForContentNoTrans( 'autoblock_whitelist' ) ); + $lines = explode( "\n", wfMessage( 'autoblock_whitelist' )->inContentLanguage()->plain() ); $wgMemc->set( $key, $lines, 3600 * 24 ); } @@ -687,7 +687,7 @@ class Block { wfDebug( "Autoblocking {$this->getTarget()}@" . $autoblockIP . "\n" ); $autoblock->setTarget( $autoblockIP ); $autoblock->setBlocker( $this->getBlocker() ); - $autoblock->mReason = wfMsgForContent( 'autoblocker', $this->getTarget(), $this->mReason ); + $autoblock->mReason = wfMessage( 'autoblocker', $this->getTarget(), $this->mReason )->inContentLanguage()->text(); $timestamp = wfTimestampNow(); $autoblock->mTimestamp = $timestamp; $autoblock->mAuto = 1; @@ -1020,7 +1020,7 @@ class Block { $keys = array( 'infiniteblock', 'expiringblock' ); foreach ( $keys as $key ) { - $msg[$key] = wfMsgHtml( $key ); + $msg[$key] = wfMessage( $key )->escaped(); } } diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index ddd01eb5c2..4e4f311a0a 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -526,7 +526,7 @@ class CategoryViewer extends ContextSource { if ( $first && $char === $prevchar ) { # We're continuing a previous chunk at the top of a new # column, so add " cont." after the letter. - $ret .= ' ' . wfMsgHtml( 'listingcontinuesabbrev' ); + $ret .= ' ' . wfMessage( 'listingcontinuesabbrev' )->escaped(); } $ret .= "\n"; diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 34e9eba4aa..0ebc926fc9 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -227,7 +227,7 @@ class ChangeTags { if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) return $fullForm ? '' : array(); - $data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMsgExt( 'tag-filter', 'parseinline' ) ), + $data = array( Html::rawElement( 'label', array( 'for' => 'tagfilter' ), wfMessage( 'tag-filter' )->parse() ), Xml::input( 'tagfilter', 20, $selected, array( 'class' => 'mw-tagfilter-input' ) ) ); if ( !$fullForm ) { @@ -235,7 +235,7 @@ class ChangeTags { } $html = implode( ' ', $data ); - $html .= "\n" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'tag-filter-submit' ) ) ); + $html .= "\n" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMessage( 'tag-filter-submit' )->text() ) ); $html .= "\n" . Html::hidden( 'title', $title->getPrefixedText() ); $html = Xml::tags( 'form', array( 'action' => $title->getLocalURL(), 'class' => 'mw-tagfilter-form', 'method' => 'get' ), $html ); diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index 2954920327..ee4c2d647d 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -206,7 +206,7 @@ class ChangesFeed { FeedUtils::formatDiff( $obj ), $url, $obj->rc_timestamp, - ($obj->rc_deleted & Revision::DELETED_USER) ? wfMsgHtml('rev-deleted-user') : $obj->rc_user_text, + ( $obj->rc_deleted & Revision::DELETED_USER ) ? wfMessage( 'rev-deleted-user' )->escaped() : $obj->rc_user_text, $talkpage ); $feed->outItem( $item ); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a6244ed94e..807658d74e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2317,16 +2317,16 @@ $wgVariantArticlePath = false; $wgLoginLanguageSelector = false; /** - * When translating messages with wfMsg(), it is not always clear what should - * be considered UI messages and what should be content messages. + * When translating messages with wfMessage(), it is not always clear what + * should be considered UI messages and what should be content messages. * * For example, for the English Wikipedia, there should be only one 'mainpage', * so when getting the link for 'mainpage', we should treat it as site content - * and call wfMsgForContent(), but for rendering the text of the link, we call - * wfMsg(). The code behaves this way by default. However, sites like the - * Wikimedia Commons do offer different versions of 'mainpage' and the like for - * different languages. This array provides a way to override the default - * behavior. + * and call ->inContentLanguage()->text(), but for rendering the text of the + * link, we call ->text(). The code behaves this way by default. However, + * sites like the Wikimedia Commons do offer different versions of 'mainpage' + * and the like for different languages. This array provides a way to override + * the default behavior. * * @par Example: * To allow language-specific main page and community diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 010ac70242..c592c7ca92 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1906,13 +1906,7 @@ function wfFormatStackFrame( $frame ) { * @return String */ function wfShowingResults( $offset, $limit ) { - global $wgLang; - return wfMsgExt( - 'showingresults', - array( 'parseinline' ), - $wgLang->formatNum( $limit ), - $wgLang->formatNum( $offset + 1 ) - ); + return wfMessage( 'showingresults' )->numParams( $limit, $offset + 1 )->parse(); } /** @@ -3969,7 +3963,7 @@ function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) { $badImages = $badImageCache; } else { // cache miss if ( $blacklist === null ) { - $blacklist = wfMsgForContentNoTrans( 'bad_image_list' ); // site list + $blacklist = wfMessage( 'bad_image_list' )->inContentLanguage()->plain(); // site list } # Build the list now $badImages = array(); diff --git a/includes/Html.php b/includes/Html.php index 7fa98e1290..23fead7af8 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -749,7 +749,7 @@ class Html { if ( isset( $params['all'] ) ) { // add an option that would let the user select all namespaces. // Value is provided by user, the name shown is localized for the user. - $options[$params['all']] = wfMsg( 'namespacesall' ); + $options[$params['all']] = wfMessage( 'namespacesall' )->text(); } // Add all namespaces as options (in the content langauge) $options += $wgContLang->getFormattedNamespaces(); @@ -763,7 +763,7 @@ class Html { if ( $nsId === 0 ) { // For other namespaces use use the namespace prefix as label, but for // main we don't use "" but the user message descripting it (e.g. "(Main)" or "(Article)") - $nsName = wfMsg( 'blanknamespace' ); + $nsName = wfMessage( 'blanknamespace' )->text(); } $optionsHtml[] = Html::element( 'option', array( @@ -859,7 +859,7 @@ class Html { /** * Get HTML for an info box with an icon. * - * @param $text String: wikitext, get this with wfMsgNoTrans() + * @param $text String: wikitext, get this with wfMessage()->plain() * @param $icon String: icon name, file in skins/common/images * @param $alt String: alternate text for the icon * @param $class String: additional class name to add to the wrapper div diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index d391ead60e..91c3190fc3 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -339,7 +339,7 @@ class ImageGallery { if( $img ) { $fileSize = htmlspecialchars( $wgLang->formatSize( $img->getSize() ) ); } else { - $fileSize = wfMsgHtml( 'filemissing' ); + $fileSize = wfMessage( 'filemissing' )->escaped(); } $fileSize = "$fileSize
\n"; } else { diff --git a/includes/Licenses.php b/includes/Licenses.php index c498a57862..0cfb047081 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -52,7 +52,7 @@ class Licenses extends HTMLFormField { public function __construct( $params ) { parent::__construct( $params ); - $this->msg = empty( $params['licenses'] ) ? wfMsgForContent( 'licenses' ) : $params['licenses']; + $this->msg = empty( $params['licenses'] ) ? wfMessage( 'licenses' )->inContentLanguage()->plain() : $params['licenses']; $this->selected = null; $this->makeLicenses(); @@ -182,7 +182,7 @@ class Licenses extends HTMLFormField { public function getInputHTML( $value ) { $this->selected = $value; - $this->html = $this->outputOption( wfMsg( 'nolicense' ), '', + $this->html = $this->outputOption( wfMessage( 'nolicense' )->text(), '', (bool)$this->selected ? null : array( 'selected' => 'selected' ) ); $this->makeHtml( $this->getLicenses() ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a9c7d1464a..d170722a63 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3521,7 +3521,7 @@ $templates * Add a wikitext-formatted message to the output. * This is equivalent to: * - * $wgOut->addWikiText( wfMsgNoTrans( ... ) ) + * $wgOut->addWikiText( wfMessage( ... )->plain() ) */ public function addWikiMsg( /*...*/ ) { $args = func_get_args(); diff --git a/includes/Status.php b/includes/Status.php index a2df380924..29dc2f4f45 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -172,7 +172,7 @@ class Status { $params = $this->cleanParams( $item['params'] ); $xml = "<{$item['type']}>\n" . Xml::element( 'message', null, $item['message'] ) . "\n" . - Xml::element( 'text', null, wfMsg( $item['message'], $params ) ) ."\n"; + Xml::element( 'text', null, wfMessage( $item['message'], $params )->text() ) ."\n"; foreach ( $params as $param ) { $xml .= Xml::element( 'param', null, $param ); } @@ -214,17 +214,17 @@ class Status { if ( count( $this->errors ) == 1 ) { $s = $this->getWikiTextForError( $this->errors[0], $this->errors[0] ); if ( $shortContext ) { - $s = wfMsgNoTrans( $shortContext, $s ); + $s = wfMessage( $shortContext, $s )->plain(); } elseif ( $longContext ) { - $s = wfMsgNoTrans( $longContext, "* $s\n" ); + $s = wfMessage( $longContext, "* $s\n" )->plain(); } } else { $s = '* '. implode("\n* ", $this->getWikiTextArray( $this->errors ) ) . "\n"; if ( $longContext ) { - $s = wfMsgNoTrans( $longContext, $s ); + $s = wfMessage( $longContext, $s )->plain(); } elseif ( $shortContext ) { - $s = wfMsgNoTrans( $shortContext, "\n$s\n" ); + $s = wfMessage( $shortContext, "\n$s\n" )->plain(); } } return $s; @@ -242,15 +242,15 @@ class Status { protected function getWikiTextForError( $error ) { if ( is_array( $error ) ) { if ( isset( $error['message'] ) && isset( $error['params'] ) ) { - return wfMsgNoTrans( $error['message'], - array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) ); + return wfMessage( $error['message'], + array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) )->plain(); } else { $message = array_shift($error); - return wfMsgNoTrans( $message, - array_map( 'wfEscapeWikiText', $this->cleanParams( $error ) ) ); + return wfMessage( $message, + array_map( 'wfEscapeWikiText', $this->cleanParams( $error ) ) )->plain(); } } else { - return wfMsgNoTrans( $error ); + return wfMessage( $error )->plain(); } } diff --git a/includes/Xml.php b/includes/Xml.php index 505cb7f6bb..120312dd96 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -166,7 +166,7 @@ class Xml { if( is_null( $selected ) ) $selected = ''; if( !is_null( $allmonths ) ) - $options[] = self::option( wfMsg( 'monthsall' ), $allmonths, $selected === $allmonths ); + $options[] = self::option( wfMessage( 'monthsall' )->text(), $allmonths, $selected === $allmonths ); for( $i = 1; $i < 13; $i++ ) $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i ); return self::openElement( 'select', array( 'id' => $id, 'name' => 'month', 'class' => 'mw-month-selector' ) ) @@ -198,9 +198,9 @@ class Xml { } else { $encYear = ''; } - return Xml::label( wfMsg( 'year' ), 'year' ) . ' '. + return Xml::label( wfMessage( 'year' )->text(), 'year' ) . ' '. Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . ' '. - Xml::label( wfMsg( 'month' ), 'month' ) . ' '. + Xml::label( wfMessage( 'month' )->text(), 'month' ) . ' '. Xml::monthSelector( $encMonth, -1 ); } @@ -772,7 +772,7 @@ class Xml { foreach( $fields as $labelmsg => $input ) { $id = "mw-$labelmsg"; $form .= Xml::openElement( 'tr', array( 'id' => $id ) ); - $form .= Xml::tags( 'td', array('class' => 'mw-label'), wfMsgExt( $labelmsg, array('parseinline') ) ); + $form .= Xml::tags( 'td', array('class' => 'mw-label'), wfMessage( $labelmsg )->parse() ); $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' ); $form .= Xml::closeElement( 'tr' ); } @@ -780,7 +780,7 @@ class Xml { if( $submitLabel ) { $form .= Xml::openElement( 'tr' ); $form .= Xml::tags( 'td', array(), '' ); - $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMsg( $submitLabel ) ) . Xml::closeElement( 'td' ); + $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text() ) . Xml::closeElement( 'td' ); $form .= Xml::closeElement( 'tr' ); } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 1dacabc490..89aca98695 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -248,8 +248,8 @@ class HistoryAction extends FormlessAction { $feed = new $wgFeedClasses[$type]( $this->getTitle()->getPrefixedText() . ' - ' . - wfMsgForContent( 'history-feed-title' ), - wfMsgForContent( 'history-feed-description' ), + wfMessage( 'history-feed-title' )->inContentLanguage()->text(), + wfMessage( 'history-feed-description' )->inContentLanguage()->text(), $this->getTitle()->getFullUrl( 'action=history' ) ); @@ -275,8 +275,8 @@ class HistoryAction extends FormlessAction { function feedEmpty() { return new FeedItem( - wfMsgForContent( 'nohistory' ), - $this->getOutput()->parse( wfMsgForContent( 'history-feed-empty' ) ), + wfMessage( 'nohistory' )->inContentLanguage()->text(), + $this->getOutput()->parse( wfMessage( 'history-feed-empty' )->inContentLanguage()->text() ), $this->getTitle()->getFullUrl(), wfTimestamp( TS_MW ), '', @@ -304,15 +304,15 @@ class HistoryAction extends FormlessAction { ); if ( $rev->getComment() == '' ) { global $wgContLang; - $title = wfMsgForContent( 'history-feed-item-nocomment', + $title = wfMessage( 'history-feed-item-nocomment', $rev->getUserText(), $wgContLang->timeanddate( $rev->getTimestamp() ), $wgContLang->date( $rev->getTimestamp() ), - $wgContLang->time( $rev->getTimestamp() ) + $wgContLang->time( $rev->getTimestamp() )->inContentLanguage()->text() ); } else { $title = $rev->getUserText() . - wfMsgForContent( 'colon-separator' ) . + wfMessage( 'colon-separator' )->inContentLanguage()->text() . FeedItem::stripComment( $rev->getComment() ); } return new FeedItem( diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index e75c4ad7c5..3be4b00458 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -162,7 +162,7 @@ class ApiEditPage extends ApiBase { // If no summary was given and we only undid one rev, // use an autosummary if ( is_null( $params['summary'] ) && $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] ) { - $params['summary'] = wfMsgForContent( 'undo-summary', $params['undo'], $undoRev->getUserText() ); + $params['summary'] = wfMessage( 'undo-summary', $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text(); } } diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index d808075680..1cf760aea9 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -60,7 +60,7 @@ class ApiFeedContributions extends ApiBase { $this->dieUsage( 'Size difference is disabled in Miser Mode', 'sizediffdisabled' ); } - $msg = wfMsgForContent( 'Contributions' ); + $msg = wfMessage( 'Contributions' )->inContentLanguage()->text(); $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']'; $feedUrl = SpecialPage::getTitleFor( 'Contributions', $params['user'] )->getFullURL(); @@ -129,7 +129,8 @@ class ApiFeedContributions extends ApiBase { */ protected function feedItemDesc( $revision ) { if( $revision ) { - return '

' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) . + $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); + return '

' . htmlspecialchars( $revision->getUserText() ) . $msg . htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . "

\n
\n
" . nl2br( htmlspecialchars( $revision->getText() ) ) . "
"; diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 7f798354e4..6ccb02fe44 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -117,7 +117,7 @@ class ApiFeedWatchlist extends ApiBase { $feedItems[] = $this->createFeedItem( $info ); } - $msg = wfMsgForContent( 'watchlist' ); + $msg = wfMessage( 'watchlist' )->inContentLanguage()->text(); $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']'; $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); @@ -131,11 +131,12 @@ class ApiFeedWatchlist extends ApiBase { // Error results should not be cached $this->getMain()->setCacheMaxAge( 0 ); - $feedTitle = $wgSitename . ' - Error - ' . wfMsgForContent( 'watchlist' ) . ' [' . $wgLanguageCode . ']'; + $feedTitle = $wgSitename . ' - Error - ' . wfMessage( 'watchlist' )->inContentLanguage()->text() . ' [' . $wgLanguageCode . ']'; $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); $feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss'; - $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); + $msg = wfMessage( 'watchlist' )->inContentLanguage()->escaped(); + $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, $msg, $feedUrl ); if ( $e instanceof UsageException ) { $errorCode = $e->getCodeString(); diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index f64b3e5b61..8aac2f4780 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -413,7 +413,7 @@ class ApiParse extends ApiBase { return ''; } - $s = htmlspecialchars( wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' ) ); + $s = htmlspecialchars( wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text() ); $langs = array(); foreach ( $languages as $l ) { diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index 53341c32e4..a53a6747bb 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -318,7 +318,7 @@ class DBQueryError extends DBError { $fname = $this->fname; $error = $this->error; } - return wfMsg( $msg, $sql, $fname, $this->errno, $error ); + return wfMessage( $msg )->rawParams( $sql, $fname, $this->errno, $error )->text(); } else { return parent::getContentMessage( $html ); } diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 952b4974c4..cb3da1e71a 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -622,7 +622,7 @@ class DatabaseSqlite extends DatabaseBase { * @return string User-friendly database information */ public function getServerInfo() { - return wfMsg( self::getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() ); + return wfMessage( self::getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() )->text(); } /** diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index b18304078c..133a956859 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -804,7 +804,7 @@ abstract class File { return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); } else { return new MediaTransformError( 'thumbnail_error', - $params['width'], 0, wfMsg( 'thumbnail-dest-create' ) ); + $params['width'], 0, wfMessage( 'thumbnail-dest-create' )->text() ); } } diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 28b34a8fe7..38b4a82481 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -163,7 +163,7 @@ class CliInstaller extends Installer { protected function getMessageText( $params ) { $msg = array_shift( $params ); - $text = wfMsgExt( $msg, array( 'parseinline' ), $params ); + $text = wfMessage( $msg, $params )->parse(); $text = preg_replace( '/(.*?)<\/a>/', '$2 <$1>', $text ); return html_entity_decode( strip_tags( $text ), ENT_QUOTES ); diff --git a/includes/installer/Ibm_db2Installer.php b/includes/installer/Ibm_db2Installer.php index 76df7af478..ca9bdf4b1b 100644 --- a/includes/installer/Ibm_db2Installer.php +++ b/includes/installer/Ibm_db2Installer.php @@ -68,7 +68,7 @@ class Ibm_db2Installer extends DatabaseInstaller { $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . $this->getTextBox( 'wgDBport', 'config-db-port', array(), $this->parent->getHelpBox( 'config-db-port' ) ) . Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) . $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) . Html::closeElement( 'fieldset' ) . diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 5230c8132b..f66f15f24e 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -89,7 +89,7 @@ class MysqlInstaller extends DatabaseInstaller { return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-name-help' ) ) . $this->getTextBox( 'wgDBprefix', 'config-db-prefix', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-prefix-help' ) ) . Html::closeElement( 'fieldset' ) . @@ -351,7 +351,7 @@ class MysqlInstaller extends DatabaseInstaller { $s .= Xml::openElement( 'div', array( 'id' => 'dbMyisamWarning' )); - $s .= $this->parent->getWarningBox( wfMsg( 'config-mysql-myisam-dep' ) ); + $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() ); $s .= Xml::closeElement( 'div' ); if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) { diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 863a625f31..72ec800d55 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -62,12 +62,12 @@ class OracleInstaller extends DatabaseInstaller { return $this->getTextBox( 'wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox( 'config-db-host-oracle-help' ) ) . Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBprefix', 'config-db-prefix' ) . $this->getTextBox( '_OracleDefTS', 'config-oracle-def-ts' ) . $this->getTextBox( '_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox( 'config-db-oracle-help' ) ) . Html::closeElement( 'fieldset' ) . - $this->parent->getWarningBox( wfMsg( 'config-db-account-oracle-warn' ) ). + $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ). $this->getInstallUserBox(). $this->getWebUserBox(); } diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 641f6e330e..3ac2b3a8d2 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -60,7 +60,7 @@ class PostgresInstaller extends DatabaseInstaller { $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . $this->getTextBox( 'wgDBport', 'config-db-port' ) . Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) . + Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) . $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) . Html::closeElement( 'fieldset' ) . diff --git a/includes/job/DoubleRedirectJob.php b/includes/job/DoubleRedirectJob.php index b6f54ea551..5b86a9036c 100644 --- a/includes/job/DoubleRedirectJob.php +++ b/includes/job/DoubleRedirectJob.php @@ -141,8 +141,9 @@ class DoubleRedirectJob extends Job { $oldUser = $wgUser; $wgUser = $this->getUser(); $article = WikiPage::factory( $this->title ); - $reason = wfMsgForContent( 'double-redirect-fixed-' . $this->reason, - $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() ); + $reason = wfMessage( 'double-redirect-fixed-' . $this->reason, + $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() + )->inContentLanguage()->text(); $article->doEdit( $newText, $reason, EDIT_UPDATE | EDIT_SUPPRESS_RC, false, $this->getUser() ); $wgUser = $oldUser; @@ -194,7 +195,7 @@ class DoubleRedirectJob extends Job { */ function getUser() { if ( !self::$user ) { - self::$user = User::newFromName( wfMsgForContent( 'double-redirect-fixer' ), false ); + self::$user = User::newFromName( wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text(), false ); # FIXME: newFromName could return false on a badly configured wiki. if ( !self::$user->isLoggedIn() ) { self::$user->addToDatabase(); diff --git a/includes/media/GIF.php b/includes/media/GIF.php index 2ec523dcb3..028fbb002a 100644 --- a/includes/media/GIF.php +++ b/includes/media/GIF.php @@ -142,11 +142,11 @@ class GIFHandler extends BitmapHandler { $info[] = $original; if ( $metadata['looped'] ) { - $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' ); + $info[] = wfMessage( 'file-info-gif-looped' )->parse(); } if ( $metadata['frameCount'] > 1 ) { - $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] ); + $info[] = wfMessage( 'file-info-gif-frames' )->numParams( $metadata['frameCount'] )->parse(); } if ( $metadata['duration'] ) { diff --git a/includes/media/PNG.php b/includes/media/PNG.php index afc7d6a0dc..8289cd4e16 100644 --- a/includes/media/PNG.php +++ b/includes/media/PNG.php @@ -128,13 +128,13 @@ class PNGHandler extends BitmapHandler { $info[] = $original; if ( $metadata['loopCount'] == 0 ) { - $info[] = wfMsgExt( 'file-info-png-looped', 'parseinline' ); + $info[] = wfMessage( 'file-info-png-looped' )->parse(); } elseif ( $metadata['loopCount'] > 1 ) { - $info[] = wfMsgExt( 'file-info-png-repeat', 'parseinline', $metadata['loopCount'] ); + $info[] = wfMessage( 'file-info-png-repeat' )->numParams( $metadata['loopCount'] )->parse(); } if ( $metadata['frameCount'] > 0 ) { - $info[] = wfMsgExt( 'file-info-png-frames', 'parseinline', $metadata['frameCount'] ); + $info[] = wfMessage( 'file-info-png-frames' )->numParams( $metadata['frameCount'] )->parse(); } if ( $metadata['duration'] ) { diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index b95499f6bd..b50559224d 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -315,7 +315,7 @@ class SearchEngine { return $parsed; } - $allkeyword = wfMsgForContent( 'searchall' ) . ":"; + $allkeyword = wfMessage( 'searchall' )->inContentLanguage()->text() . ":"; if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) { $this->namespaces = null; $parsed = substr( $query, strlen( $allkeyword ) ); @@ -417,7 +417,7 @@ class SearchEngine { $formatted = array_map( array( $wgContLang, 'getFormattedNsText' ), $namespaces ); foreach ( $formatted as $key => $ns ) { if ( empty( $ns ) ) - $formatted[$key] = wfMsg( 'blanknamespace' ); + $formatted[$key] = wfMessage( 'blanknamespace' )->text(); } return $formatted; } diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index b20348d350..25a3e27b56 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -632,12 +632,12 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw' $tools[] = Linker::linkKnown( SpecialPage::getTitleFor( $arr[0], $arr[1] ), - wfMsgHtml( "watchlisttools-{$mode}" ) + wfMessage( "watchlisttools-{$mode}" )->escaped() ); } return Html::rawElement( 'span', array( 'class' => 'mw-watchlist-toollinks' ), - wfMsg( 'parentheses', $wgLang->pipeList( $tools ) ) ); + wfMessage( 'parentheses', $wgLang->pipeList( $tools ) )->text() ); } } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 578a9409d0..2b9b523cf9 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -374,7 +374,7 @@ class PageArchive { } if( trim( $comment ) != '' ) { - $reason .= wfMsgForContent( 'colon-separator' ) . $comment; + $reason .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment; } if ( $user === null ) { diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 3072408d3c..8cecd07b1e 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -235,7 +235,7 @@ class SpecialUpload extends SpecialPage { !$this->mTokenOk && !$this->mCancelUpload && ( $this->mUpload && $this->mUploadClicked ) ) { - $form->addPreText( wfMsgExt( 'session_fail_preview', 'parseinline' ) ); + $form->addPreText( $this->msg( 'session_fail_preview' )->parse() ); } # Give a notice if the user is uploading a file that has been deleted or moved @@ -261,10 +261,10 @@ class SpecialUpload extends SpecialPage { $form->addPreText( $message ); # Add footer to form - $uploadFooter = wfMessage( 'uploadfooter' ); + $uploadFooter = $this->msg( 'uploadfooter' ); if ( !$uploadFooter->isDisabled() ) { $form->addPostText( '\n" ); + . $uploadFooter->parseAsBlock() . "\n" ); } return $form; @@ -306,11 +306,11 @@ class SpecialUpload extends SpecialPage { */ protected function showRecoverableUploadError( $message ) { $sessionKey = $this->mUpload->stashSession(); - $message = '

' . wfMsgHtml( 'uploaderror' ) . "

\n" . + $message = '

' . $this->msg( 'uploaderror' )->escaped() . "

\n" . '
' . $message . "
\n"; $form = $this->getUploadForm( $message, $sessionKey ); - $form->setSubmitText( wfMsg( 'upload-tryagain' ) ); + $form->setSubmitText( $this->msg( 'upload-tryagain' )->escaped() ); $this->showUploadForm( $form ); } /** @@ -335,7 +335,7 @@ class SpecialUpload extends SpecialPage { $sessionKey = $this->mUpload->stashSession(); - $warningHtml = '

' . wfMsgHtml( 'uploadwarning' ) . "

\n" + $warningHtml = '

' . $this->msg( 'uploadwarning' )->escaped() . "

\n" . '