Replace deprecated wfMsg* calls with Message class calls.
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Tue, 21 Aug 2012 17:23:53 +0000 (19:23 +0200)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Wed, 22 Aug 2012 19:04:12 +0000 (21:04 +0200)
Doing this in steps of roughly 100 changes per commit, so that it remains
reviewable.

Change-Id: Ie349afa5c809c887c787c7c04c49c9dd3478ccac

docs/hooks.txt
docs/memcached.txt
img_auth.php
includes/MessageBlobStore.php
includes/Metadata.php
includes/ProtectionForm.php
includes/Skin.php
includes/SkinLegacy.php
includes/SkinTemplate.php

index 2862d1b..ca46578 100644 (file)
@@ -763,11 +763,11 @@ $title: Title object for the title being linked to (may not be the same as
   $wgTitle, if the section is included from a template)
 $section: The designation of the section being pointed to, to be included in
   the link, like "&section=$section"
-$tooltip: The default tooltip.  Escape with htmlspecialchars() before using.
+$tooltip: The default tooltip.  Escape before using.
   By default, this is wrapped in the 'editsectionhint' message.
 &$result: The HTML to return, prefilled with the default plus whatever other
   changes earlier hooks have made
-$lang: The language code to use for the link in the wfMsg* functions
+$lang: The language code to use for the link in the wfMessage function
 
 'EditFilter': Perform checks on an edit
 $editor: Edit form (see includes/EditPage.php)
@@ -868,7 +868,7 @@ $title: Title being linked to
 $section: Section to link to
 $link: Default link
 &$result: Result (alter this to override the generated links)
-$lang: The language code to use for the link in the wfMsg* functions
+$lang: The language code to use for the link in the wfMessage function
 
 'EmailConfirmed': When checking that the user's email address is "confirmed"
 $user: User being checked
@@ -1283,7 +1283,7 @@ $param: Associative Array with the following additional options:
  - lim Integer Limit of items to show, default is 50
  - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
  - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty if set to true (default), "No matching items in log" is displayed if loglist is empty
- - msgKey Array If you want a nice box with a message, set this to the key of the message. First element is the message key, additional optional elements are parameters for the key that are processed with wfMsgExt and option 'parse'
+ - msgKey Array If you want a nice box with a message, set this to the key of the message. First element is the message key, additional optional elements are parameters for the key that are processed with wfMessage()->params()->parseAsBlock()
  - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset
  - wrap String Wrap the message in html (usually something like "&lt;div ...>$1&lt;/div>").
  - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
@@ -1592,7 +1592,7 @@ Return false and put the merged text into $text to override the default behavior
 'PreferencesGetLegend': Override the text used for the <legend> of a preferences section
 $form: the PreferencesForm object. This is a ContextSource as well
 $key: the section name
-&$legend: the legend text. Defaults to wfMsg( "prefs-$key" ) but may be overridden
+&$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may be overridden
 
 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
 AJAX search suggestions. Put results into &$results outparam and return false.
index f5384f9..3872edc 100644 (file)
@@ -138,7 +138,7 @@ Message Cache:
        key: $wgDBname:messages, $wgDBname:messages-hash, $wgDBname:messages-status
        ex: wikidb:messages, wikidb:messages-hash, wikidb:messages-status
        stores: an array where the keys are DB keys and the values are messages
-       set in: wfMsg(), Article::editUpdates() and Title::moveTo()
+       set in: wfMessage(), Article::editUpdates() and Title::moveTo()
        expriy: $wgMsgCacheExpiry
        cleared by: nothing
 
index d712589..74602f2 100644 (file)
@@ -148,13 +148,13 @@ function wfForbidden( $msg1, $msg2 ) {
        array_shift( $args );
        array_shift( $args );
 
-       $msgHdr = htmlspecialchars( wfMsg( $msg1 ) );
+       $msgHdr = wfMessage( $msg1 )->escaped();
        $detailMsgKey = $wgImgAuthDetails ? $msg2 : 'badaccess-group0';
-       $detailMsg = htmlspecialchars( wfMsg( $detailMsgKey, $args ) );
+       $detailMsg = wfMessage( $detailMsgKey, $args )->escaped();
 
        wfDebugLog( 'img_auth',
-               "wfForbidden Hdr:" . wfMsgExt( $msg1, array( 'language' => 'en' ) ). " Msg: ".
-               wfMsgExt( $msg2, array( 'language' => 'en' ), $args )
+               "wfForbidden Hdr:" . wfMessage( $msg1 )->inLanguage( 'en' )->text() . " Msg: ".
+               wfMessage( $msg2, $args )->inLanguage( 'en' )->text()
        );
 
        header( 'HTTP/1.0 403 Forbidden' );
index 23955ae..d112b25 100644 (file)
@@ -299,7 +299,7 @@ class MessageBlobStore {
         */
        private static function reencodeBlob( $blob, $key, $lang ) {
                $decoded = FormatJson::decode( $blob, true );
-               $decoded[$key] = wfMsgExt( $key, array( 'language' => $lang ) );
+               $decoded[$key] = wfMessage( $key )->inLanguage( $lang )->text();
 
                return FormatJson::encode( (object)$decoded );
        }
@@ -353,7 +353,7 @@ class MessageBlobStore {
                $messages = array();
 
                foreach ( $module->getMessages() as $key ) {
-                       $messages[$key] = wfMsgExt( $key, array( 'language' => $lang ) );
+                       $messages[$key] = wfMessage( $key )->inLanguage( $lang )->text();
                }
 
                return FormatJson::encode( (object)$messages );
index 229856d..0ca1539 100644 (file)
@@ -60,7 +60,7 @@ abstract class RdfMetaData {
                global $wgLanguageCode, $wgSitename;
 
                $this->element( 'title', $this->mArticle->getTitle()->getText() );
-               $this->pageOrString( 'publisher', wfMsg( 'aboutpage' ), $wgSitename );
+               $this->pageOrString( 'publisher', wfMessage( 'aboutpage' )->text(), $wgSitename );
                $this->element( 'language', $wgLanguageCode );
                $this->element( 'type', 'Text' );
                $this->element( 'format', 'text/html' );
@@ -117,14 +117,18 @@ abstract class RdfMetaData {
 
        protected function person( $name, User $user ) {
                if( $user->isAnon() ){
-                       $this->element( $name, wfMsgExt( 'anonymous', array( 'parsemag' ), 1 ) );
+                       $this->element( $name, wfMessage( 'anonymous' )->numParams( 1 )->text() );
                } else {
                        $real = $user->getRealName();
                        if( $real ) {
                                $this->element( $name, $real );
                        } else {
                                $userName = $user->getName();
-                               $this->pageOrString( $name, $user->getUserPage(), wfMsgExt( 'siteuser', 'parsemag', $userName, $userName ) );
+                               $this->pageOrString(
+                                       $name,
+                                       $user->getUserPage(),
+                                       wfMessage( 'siteuser', $userName, $userName )->text()
+                               );
                        }
                }
        }
index caedb63..ce0e36b 100644 (file)
@@ -265,7 +265,7 @@ class ProtectionForm {
                $reasonstr = $this->mReasonSelection;
                if ( $reasonstr != 'other' && $this->mReason != '' ) {
                        // Entry from drop down menu + additional comment
-                       $reasonstr .= wfMsgForContent( 'colon-separator' ) . $this->mReason;
+                       $reasonstr .= wfMessage( 'colon-separator' )->text() . $this->mReason;
                } elseif ( $reasonstr == 'other' ) {
                        $reasonstr = $this->mReason;
                }
@@ -336,8 +336,14 @@ class ProtectionForm {
        function buildForm() {
                global $wgUser, $wgLang, $wgOut;
 
-               $mProtectreasonother = Xml::label( wfMsg( 'protectcomment' ), 'wpProtectReasonSelection' );
-               $mProtectreason = Xml::label( wfMsg( 'protect-otherreason' ), 'mwProtect-reason' );
+               $mProtectreasonother = Xml::label(
+                       wfMessage( 'protectcomment' )->text(),
+                       'wpProtectReasonSelection'
+               );
+               $mProtectreason = Xml::label(
+                       wfMessage( 'protect-otherreason' )->text(),
+                       'mwProtect-reason'
+               );
 
                $out = '';
                if( !$this->disabled ) {
@@ -348,7 +354,7 @@ class ProtectionForm {
                }
 
                $out .= Xml::openElement( 'fieldset' ) .
-                       Xml::element( 'legend', null, wfMsg( 'protect-legend' ) ) .
+                       Xml::element( 'legend', null, wfMessage( 'protect-legend' )->text() ) .
                        Xml::openElement( 'table', array( 'id' => 'mwProtectSet' ) ) .
                        Xml::openElement( 'tbody' );
 
@@ -362,16 +368,22 @@ class ProtectionForm {
                                "<tr><td>" . $this->buildSelector( $action, $selected ) . "</td></tr><tr><td>";
 
                        $reasonDropDown = Xml::listDropDown( 'wpProtectReasonSelection',
-                               wfMsgForContent( 'protect-dropdown' ),
-                               wfMsgForContent( 'protect-otherreason-op' ),
+                               wfMessage( 'protect-dropdown' )->inContentLanguage()->text(),
+                               wfMessage( 'protect-otherreason-op' )->inContentLanguage()->text(),
                                $this->mReasonSelection,
                                'mwProtect-reason', 4 );
-                       $scExpiryOptions = wfMsgForContent( 'protect-expiry-options' );
+                       $scExpiryOptions = wfMessage( 'protect-expiry-options' )->inContentLanguage()->text();
 
                        $showProtectOptions = ($scExpiryOptions !== '-' && !$this->disabled);
 
-                       $mProtectexpiry = Xml::label( wfMsg( 'protectexpiry' ), "mwProtectExpirySelection-$action" );
-                       $mProtectother = Xml::label( wfMsg( 'protect-othertime' ), "mwProtect-$action-expires" );
+                       $mProtectexpiry = Xml::label(
+                               wfMessage( 'protectexpiry' )->text(),
+                               "mwProtectExpirySelection-$action"
+                       );
+                       $mProtectother = Xml::label(
+                               wfMessage( 'protect-othertime' )->text(),
+                               "mwProtect-$action-expires"
+                       );
 
                        $expiryFormOptions = '';
                        if ( $this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity' ) {
@@ -380,13 +392,16 @@ class ProtectionForm {
                                $t = $wgLang->time( $this->mExistingExpiry[$action], true );
                                $expiryFormOptions .=
                                        Xml::option(
-                                               wfMsg( 'protect-existing-expiry', $timestamp, $d, $t ),
+                                               wfMessage( 'protect-existing-expiry', $timestamp, $d, $t )->text(),
                                                'existing',
                                                $this->mExpirySelection[$action] == 'existing'
                                        ) . "\n";
                        }
 
-                       $expiryFormOptions .= Xml::option( wfMsg( 'protect-othertime-op' ), "othertime" ) . "\n";
+                       $expiryFormOptions .= Xml::option(
+                               wfMessage( 'protect-othertime-op' )->text(),
+                               "othertime"
+                       ) . "\n";
                        foreach( explode(',', $scExpiryOptions) as $option ) {
                                if ( strpos($option, ":") === false ) {
                                        $show = $value = $option;
@@ -444,8 +459,12 @@ class ProtectionForm {
                        $out .= '<tr>
                                        <td></td>
                                        <td class="mw-input">' .
-                                               Xml::checkLabel( wfMsg( 'protect-cascade' ), 'mwProtect-cascade', 'mwProtect-cascade',
-                                                       $this->mCascade, $this->disabledAttrib ) .
+                                               Xml::checkLabel(
+                                                       wfMessage( 'protect-cascade' )->text(),
+                                                       'mwProtect-cascade',
+                                                       'mwProtect-cascade',
+                                                       $this->mCascade, $this->disabledAttrib
+                                               ) .
                                        "</td>
                                </tr>\n";
                        $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
@@ -482,7 +501,7 @@ class ProtectionForm {
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( wfMsg( 'watchthis' ),
+                                               Xml::checkLabel( wfMessage( 'watchthis' )->text(),
                                                        'mwProtectWatch', 'mwProtectWatch',
                                                        $this->mTitle->userIsWatching() || $wgUser->getOption( 'watchdefault' ) ) .
                                        "</td>
@@ -492,7 +511,10 @@ class ProtectionForm {
                                <tr>
                                        <td></td>
                                        <td class='mw-submit'>" .
-                                               Xml::submitButton( wfMsg( 'confirm' ), array( 'id' => 'mw-Protect-submit' ) ) .
+                                               Xml::submitButton(
+                                                       wfMessage( 'confirm' )->text(),
+                                                       array( 'id' => 'mw-Protect-submit' )
+                                               ) .
                                        "</td>
                                </tr>\n";
                        $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
@@ -503,7 +525,7 @@ class ProtectionForm {
                        $title = Title::makeTitle( NS_MEDIAWIKI, 'Protect-dropdown' );
                        $link = Linker::link(
                                $title,
-                               wfMsgHtml( 'protect-edit-reasonlist' ),
+                               wfMessage( 'protect-edit-reasonlist' )->escaped(),
                                array(),
                                array( 'action' => 'edit' )
                        );
@@ -567,13 +589,13 @@ class ProtectionForm {
         */
        private function getOptionLabel( $permission ) {
                if( $permission == '' ) {
-                       return wfMsg( 'protect-default' );
+                       return wfMessage( 'protect-default' )->text();
                } else {
                        $msg = wfMessage( "protect-level-{$permission}" );
                        if( $msg->exists() ) {
                                return $msg->text();
                        }
-                       return wfMsg( 'protect-fallback', $permission );
+                       return wfMessage( 'protect-fallback', $permission )->text();
                }
        }
 
index 3db4cf9..5af6aec 100644 (file)
@@ -1103,7 +1103,7 @@ abstract class Skin extends ContextSource {
         * @return String
         */
        static function makeI18nUrl( $name, $urlaction = '' ) {
-               $title = Title::newFromText( wfMsgForContent( $name ) );
+               $title = Title::newFromText( wfMessage( $name )->inContentLanguage()->text() );
                self::checkTitle( $title, $name );
                return $title->getLocalURL( $urlaction );
        }
@@ -1235,7 +1235,7 @@ abstract class Skin extends ContextSource {
         * @param $message String
         */
        function addToSidebar( &$bar, $message ) {
-               $this->addToSidebarPlain( $bar, wfMsgForContentNoTrans( $message ) );
+               $this->addToSidebarPlain( $bar, wfMessage( $message )->inContentLanguage()->plain() );
        }
 
        /**
@@ -1361,8 +1361,8 @@ abstract class Skin extends ContextSource {
                                        $plural = true; // Default if we have a last seen revision: if unknown, use plural
                                        $latestRev = Revision::newFromTitle ($userTalkTitle);
                                        if ( $latestRev !== null ) {
-                                               // Singular if only 1 unseen revision, plural if several unseen revisions.\r
-                                               $plural = $latestRev->getParentId() !== $lastSeenRev->getId();\r
+                                               // Singular if only 1 unseen revision, plural if several unseen revisions.
+                                               $plural = $latestRev->getParentId() !== $lastSeenRev->getId();
                                                $nofAuthors = $userTalkTitle->countAuthorsBetween( $lastSeenRev, $latestRev, 10, 'include_new' );
                                        }
                                } else {
@@ -1547,13 +1547,17 @@ abstract class Skin extends ContextSource {
        public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) {
                // HTML generated here should probably have userlangattributes
                // added to it for LTR text on RTL pages
+
+               $lang = wfGetLangObj( $lang );
+
                $attribs = array();
                if ( !is_null( $tooltip ) ) {
                        # Bug 25462: undo double-escaping.
                        $tooltip = Sanitizer::decodeCharReferences( $tooltip );
-                       $attribs['title'] = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag', 'replaceafter' ), $tooltip );
+                       $attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
+                               ->inLanguage( $lang )->text();
                }
-               $link = Linker::link( $nt, wfMsgExt( 'editsection', array( 'language' => $lang ) ),
+               $link = Linker::link( $nt, wfMessage( 'editsection' )->inLanguage( $lang )->text(),
                        $attribs,
                        array( 'action' => 'edit', 'section' => $section ),
                        array( 'noclasses', 'known' )
@@ -1563,7 +1567,8 @@ abstract class Skin extends ContextSource {
                # we can rid of it someday.
                $attribs = '';
                if ( $tooltip ) {
-                       $attribs = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag', 'escape', 'replaceafter' ), $tooltip );
+                       $attribs = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
+                               ->inLanguage( $lang )->escaped();
                        $attribs = " title=\"$attribs\"";
                }
                $result = null;
@@ -1573,13 +1578,15 @@ abstract class Skin extends ContextSource {
                        # run, and even add them to hook-provided text.  (This is the main
                        # reason that the EditSectionLink hook is deprecated in favor of
                        # DoEditSectionLink: it can't change the brackets or the span.)
-                       $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $result );
+                       $result = wfMessage( 'editsection-brackets' )->rawParams( $result )
+                               ->inLanguage( $lang )->escaped();
                        return "<span class=\"editsection\">$result</span>";
                }
 
                # Add the brackets and the span, and *then* run the nice new hook, with
                # clean and non-redundant arguments.
-               $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $link );
+               $result = wfMessage( 'editsection-brackets' )->rawParams( $link )
+                       ->inLanguage( $lang )->escaped();
                $result = "<span class=\"editsection\">$result</span>";
 
                wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
index 4a1c699..aa6b22a 100644 (file)
@@ -182,12 +182,12 @@ class LegacyTemplate extends BaseTemplate {
                  . $this->getSkin()->escapeSearchLink() . "\">\n"
                  . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
                  . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
-                 . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
+                 . '<input type="submit" name="go" value="' . wfMessage( 'searcharticle' )->text() . '" />';
 
                if ( $wgUseTwoButtonsSearchForm ) {
-                       $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
+                       $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMessage( 'searchbutton' )->text() . "\" />\n";
                } else {
-                       $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
+                       $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMessage( 'powersearch-legend' )->text() . "</a>\n";
                }
 
                $s .= '</form>';
@@ -236,7 +236,7 @@ class LegacyTemplate extends BaseTemplate {
                }
 
                // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
-               return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
+               return implode( $s, wfMessage( 'pipe-separator' )->escaped() . "\n" );
        }
 
        /**
@@ -292,7 +292,7 @@ class LegacyTemplate extends BaseTemplate {
                if ( count( $s ) ) {
                        global $wgLang;
 
-                       $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
+                       $out = wfMessage( 'pipe-separator' )->escaped();
                        $out .= $wgLang->pipeList( $s );
                }
 
@@ -301,7 +301,7 @@ class LegacyTemplate extends BaseTemplate {
 
        function bottomLinks() {
                global $wgOut, $wgUser;
-               $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
+               $sep = wfMessage( 'pipe-separator' )->escaped() . "\n";
 
                $s = '';
                if ( $wgOut->isArticleRelated() ) {
@@ -373,7 +373,7 @@ class LegacyTemplate extends BaseTemplate {
                        return '';
                }
 
-               $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
+               $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text();
                $first = true;
 
                if ( $wgLang->isRTL() ) {
@@ -382,7 +382,7 @@ class LegacyTemplate extends BaseTemplate {
 
                foreach ( $a as $l ) {
                        if ( !$first ) {
-                               $s .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
+                               $s .= wfMessage( 'pipe-separator' )->escaped();
                        }
 
                        $first = false;
@@ -417,8 +417,9 @@ class LegacyTemplate extends BaseTemplate {
                                $obj->getTitle()->getPrefixedDBkey() );
                }
 
-               return Html::rawElement( 'form', array( 'id' => 'specialpages', 'method' => 'get',
-                       'action' => $wgScript ), $select->getHTML() . Xml::submitButton( wfMsg( 'go' ) ) );
+               return Html::rawElement( 'form',
+                       array( 'id' => 'specialpages', 'method' => 'get', 'action' => $wgScript ),
+                       $select->getHTML() . Xml::submitButton( wfMessage( 'go' )->text() ) );
        }
 
        function pageTitleLinks() {
@@ -459,8 +460,8 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
                        $s[] .= Linker::linkKnown(
-                                       $title,
-                                       wfMsg( 'currentrev' )
+                               $title,
+                               wfMessage( 'currentrev' )->text()
                        );
                }
 
@@ -470,18 +471,18 @@ class LegacyTemplate extends BaseTemplate {
                        if ( !$title->equals( $wgUser->getTalkPage() ) ) {
                                $tl = Linker::linkKnown(
                                        $wgUser->getTalkPage(),
-                                       wfMsgHtml( 'newmessageslink' ),
+                                       wfMessage( 'newmessageslink' )->escaped(),
                                        array(),
                                        array( 'redirect' => 'no' )
                                );
 
                                $dl = Linker::linkKnown(
                                        $wgUser->getTalkPage(),
-                                       wfMsgHtml( 'newmessagesdifflink' ),
+                                       wfMessage( 'newmessagesdifflink' )->escaped(),
                                        array(),
                                        array( 'diff' => 'cur' )
                                );
-                               $s[] = '<strong>' . wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
+                               $s[] = '<strong>' . wfMessage( 'youhavenewmessages', $tl, $dl )->text() . '</strong>';
                                # disable caching
                                $wgOut->setSquidMaxage( 0 );
                                $wgOut->enableClientCache( false );
@@ -514,7 +515,7 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( $sub == '' ) {
                        global $wgExtraSubtitle;
-                       $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
+                       $sub = wfMessage( 'tagline' )->parse() . $wgExtraSubtitle;
                }
 
                $subpages = $this->getSkin()->subPageSubtitle();
@@ -532,14 +533,15 @@ class LegacyTemplate extends BaseTemplate {
                if ( !$wgOut->isPrintable() ) {
                        $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
                                $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
-                       $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
+                       $s[] = "<a href=\"$printurl\" rel=\"alternate\">"
+                               . wfMessage( 'printableversion' )->text() . '</a>';
                }
 
                if ( $wgOut->isSyndicated() ) {
                        foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
                                $feedurl = htmlspecialchars( $link );
                                $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
-                                               . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
+                                               . " class=\"feedlink\">" . wfMessage( "feed-$format" )->escaped() . "</a>";
                        }
                }
                return $wgLang->pipeList( $s );
@@ -558,15 +560,15 @@ class LegacyTemplate extends BaseTemplate {
                global $wgOut;
 
                if ( !$wgOut->isArticleRelated() ) {
-                       $s = wfMsg( 'protectedpage' );
+                       $s = wfMessage( 'protectedpage' )->text();
                } else {
                        $title = $this->getSkin()->getTitle();
                        if ( $title->quickUserCan( 'edit' ) && $title->exists() ) {
-                               $t = wfMsg( 'editthispage' );
+                               $t = wfMessage( 'editthispage' )->text();
                        } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) {
-                               $t = wfMsg( 'create-this-page' );
+                               $t = wfMessage( 'create-this-page' )->text();
                        } else {
-                               $t = wfMsg( 'viewsource' );
+                               $t = wfMessage( 'viewsource' )->text();
                        }
 
                        $s = Linker::linkKnown(
@@ -587,7 +589,7 @@ class LegacyTemplate extends BaseTemplate {
                $title = $this->getSkin()->getTitle();
 
                if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
-                       $t = wfMsg( 'deletethispage' );
+                       $t = wfMessage( 'deletethispage' )->text();
 
                        $s = Linker::linkKnown(
                                $title,
@@ -610,10 +612,10 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
                        if ( $title->isProtected() ) {
-                               $text = wfMsg( 'unprotectthispage' );
+                               $text = wfMessage( 'unprotectthispage' )->text();
                                $query = array( 'action' => 'unprotect' );
                        } else {
-                               $text = wfMsg( 'protectthispage' );
+                               $text = wfMessage( 'protectthispage' )->text();
                                $query = array( 'action' => 'protect' );
                        }
 
@@ -639,14 +641,14 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( $wgOut->isArticleRelated() ) {
                        if ( $wgUser->isWatched( $title ) ) {
-                               $text = wfMsg( 'unwatchthispage' );
+                               $text = wfMessage( 'unwatchthispage' )->text();
                                $query = array(
                                        'action' => 'unwatch',
                                        'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
                                );
                                $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
                        } else {
-                               $text = wfMsg( 'watchthispage' );
+                               $text = wfMessage( 'watchthispage' )->text();
                                $query = array(
                                        'action' => 'watch',
                                        'token' => WatchAction::getWatchToken( $title, $wgUser ),
@@ -661,7 +663,7 @@ class LegacyTemplate extends BaseTemplate {
                                $query
                        );
                } else {
-                       $s = wfMsg( 'notanarticle' );
+                       $s = wfMessage( 'notanarticle' )->text();
                }
 
                return $s;
@@ -671,7 +673,7 @@ class LegacyTemplate extends BaseTemplate {
                if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
                        return Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Movepage' ),
-                               wfMsg( 'movethispage' ),
+                               wfMessage( 'movethispage' )->text(),
                                array(),
                                array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() )
                        );
@@ -684,7 +686,7 @@ class LegacyTemplate extends BaseTemplate {
        function historyLink() {
                return Linker::link(
                        $this->getSkin()->getTitle(),
-                       wfMsgHtml( 'history' ),
+                       wfMessage( 'history' )->escaped(),
                        array( 'rel' => 'archives' ),
                        array( 'action' => 'history' )
                );
@@ -693,21 +695,21 @@ class LegacyTemplate extends BaseTemplate {
        function whatLinksHere() {
                return Linker::linkKnown(
                        SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
-                       wfMsgHtml( 'whatlinkshere' )
+                       wfMessage( 'whatlinkshere' )->escaped()
                );
        }
 
        function userContribsLink() {
                return Linker::linkKnown(
                        SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
-                       wfMsgHtml( 'contributions' )
+                       wfMessage( 'contributions' )->escaped()
                );
        }
 
        function emailUserLink() {
                return Linker::linkKnown(
                        SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
-                       wfMsgHtml( 'emailuser' )
+                       wfMessage( 'emailuser' )->escaped()
                );
        }
 
@@ -719,7 +721,7 @@ class LegacyTemplate extends BaseTemplate {
                } else {
                        return Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
-                               wfMsgHtml( 'recentchangeslinked-toolbox' )
+                               wfMessage( 'recentchangeslinked-toolbox' )->escaped()
                        );
                }
        }
@@ -737,41 +739,41 @@ class LegacyTemplate extends BaseTemplate {
                        $link = $title->getSubjectPage();
                        switch( $link->getNamespace() ) {
                                case NS_MAIN:
-                                       $text = wfMsg( 'articlepage' );
+                                       $text = wfMessage( 'articlepage' );
                                        break;
                                case NS_USER:
-                                       $text = wfMsg( 'userpage' );
+                                       $text = wfMessage( 'userpage' );
                                        break;
                                case NS_PROJECT:
-                                       $text = wfMsg( 'projectpage' );
+                                       $text = wfMessage( 'projectpage' );
                                        break;
                                case NS_FILE:
-                                       $text = wfMsg( 'imagepage' );
+                                       $text = wfMessage( 'imagepage' );
                                        # Make link known if image exists, even if the desc. page doesn't.
                                        if ( wfFindFile( $link ) )
                                                $linkOptions[] = 'known';
                                        break;
                                case NS_MEDIAWIKI:
-                                       $text = wfMsg( 'mediawikipage' );
+                                       $text = wfMessage( 'mediawikipage' );
                                        break;
                                case NS_TEMPLATE:
-                                       $text = wfMsg( 'templatepage' );
+                                       $text = wfMessage( 'templatepage' );
                                        break;
                                case NS_HELP:
-                                       $text = wfMsg( 'viewhelppage' );
+                                       $text = wfMessage( 'viewhelppage' );
                                        break;
                                case NS_CATEGORY:
-                                       $text = wfMsg( 'categorypage' );
+                                       $text = wfMessage( 'categorypage' );
                                        break;
                                default:
-                                       $text = wfMsg( 'articlepage' );
+                                       $text = wfMessage( 'articlepage' );
                        }
                } else {
                        $link = $title->getTalkPage();
-                       $text = wfMsg( 'talkpage' );
+                       $text = wfMessage( 'talkpage' );
                }
 
-               $s = Linker::link( $link, $text, array(), array(), $linkOptions );
+               $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions );
 
                return $s;
        }
@@ -793,7 +795,7 @@ class LegacyTemplate extends BaseTemplate {
 
                return Linker::linkKnown(
                        $title,
-                       wfMsg( 'postcomment' ),
+                       wfMessage( 'postcomment' )->text(),
                        array(),
                        array(
                                'action' => 'edit',
@@ -807,11 +809,13 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( $wgUploadNavigationUrl ) {
                        # Using an empty class attribute to avoid automatic setting of "external" class
-                       return Linker::makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '' ) );
+                       return Linker::makeExternalLink( $wgUploadNavigationUrl,
+                               wfMessage( 'upload' )->escaped(),
+                               false, null, array( 'class' => '' ) );
                } else {
                        return Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Upload' ),
-                               wfMsgHtml( 'upload' )
+                               wfMessage( 'upload' )->escaped()
                        );
                }
        }
@@ -832,7 +836,7 @@ class LegacyTemplate extends BaseTemplate {
 
                                $ret .= "$name $talkLink";
                        } else {
-                               $ret .= wfMsg( 'notloggedin' );
+                               $ret .= wfMessage( 'notloggedin' )->text();
                        }
 
                        $query = array();
@@ -846,7 +850,7 @@ class LegacyTemplate extends BaseTemplate {
                                : 'login';
                        $ret .= "\n<br />" . Linker::link(
                                SpecialPage::getTitleFor( 'Userlogin' ),
-                               wfMsg( $loginlink ), array(), $query
+                               wfMessage( $loginlink )->text(), array(), $query
                        );
                } else {
                        $talkLink = Linker::link( $wgUser->getTalkPage(),
@@ -858,7 +862,7 @@ class LegacyTemplate extends BaseTemplate {
                        $ret .= " $talkLink<br />";
                        $ret .= $wgLang->pipeList( array(
                                Linker::link(
-                                       SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
+                                       SpecialPage::getTitleFor( 'Userlogout' ), wfMessage( 'logout' )->text(),
                                        array(), array( 'returnto' => $returnTo->getPrefixedDBkey() )
                                ),
                                Linker::specialLink( 'Preferences' ),
@@ -868,8 +872,8 @@ class LegacyTemplate extends BaseTemplate {
                $ret = $wgLang->pipeList( array(
                        $ret,
                        Linker::link(
-                               Title::newFromText( wfMsgForContent( 'helppage' ) ),
-                               wfMsg( 'help' )
+                               Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
+                               wfMessage( 'help' )->text()
                        ),
                ) );
 
index 3c5a263..ace339a 100644 (file)
@@ -40,7 +40,7 @@ class MediaWiki_I18N {
                // Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23
                $value = preg_replace( '/^string:/', '', $value );
 
-               $value = wfMsg( $value );
+               $value = wfMessage( $value )->text();
                // interpolate variables
                $m = array();
                while( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {