Replace deprecated wfMsg* calls with Message class calls.
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Sun, 19 Aug 2012 23:05:20 +0000 (01:05 +0200)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Mon, 20 Aug 2012 20:52:17 +0000 (22:52 +0200)
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d

18 files changed:
includes/logging/LogFormatter.php
includes/logging/LogPage.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/FormatMetadata.php
includes/media/MediaHandler.php
includes/media/MediaTransformOutput.php
includes/media/SVG.php
includes/parser/CoreParserFunctions.php
includes/parser/Parser.php
includes/parser/StripState.php
includes/templates/Usercreate.php
includes/templates/Userlogin.php
includes/upload/UploadBase.php
languages/Language.php
maintenance/backupTextPass.inc
resources/mediawiki/mediawiki.js
tests/phpunit/includes/ExtraParserTest.php

index 8d2219a..7586bb6 100644 (file)
@@ -171,7 +171,7 @@ class LogFormatter {
                        if ( $actionComment == '' ) {
                                $actionComment = $comment;
                        } else {
-                               $actionComment .= wfMsgForContent( 'colon-separator' ) . $comment;
+                               $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
                        }
                }
 
@@ -191,7 +191,6 @@ class LogFormatter {
                $entry = $this->entry;
                $parameters = $entry->getParameters();
                // @see LogPage::actionText()
-               $msgOpts = array( 'parsemag', 'escape', 'replaceafter', 'content' );
                // Text of title the action is aimed at.
                $target = $entry->getTarget()->getPrefixedText() ;
                $text = null;
@@ -200,11 +199,13 @@ class LogFormatter {
                                switch( $entry->getSubtype() ) {
                                        case 'move':
                                                $movesource =  $parameters['4::target'];
-                                               $text = wfMsgExt( '1movedto2', $msgOpts, $target, $movesource );
+                                               $text = wfMessage( '1movedto2' )
+                                                       ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
                                                break;
                                        case 'move_redir':
                                                $movesource =  $parameters['4::target'];
-                                               $text = wfMsgExt( '1movedto2_redir', $msgOpts, $target, $movesource );
+                                               $text = wfMessage( '1movedto2_redir' )
+                                                       ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
                                                break;
                                        case 'move-noredirect':
                                                break;
@@ -216,10 +217,12 @@ class LogFormatter {
                        case 'delete':
                                switch( $entry->getSubtype() ) {
                                        case 'delete':
-                                               $text = wfMsgExt( 'deletedarticle', $msgOpts, $target );
+                                               $text = wfMessage( 'deletedarticle' )
+                                                       ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        case 'restore':
-                                               $text = wfMsgExt( 'undeletedarticle', $msgOpts, $target );
+                                               $text = wfMessage( 'undeletedarticle' )
+                                                       ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        //case 'revision': // Revision deletion
                                        //case 'event': // Log deletion
@@ -233,8 +236,10 @@ class LogFormatter {
                                // Create a diff link to the patrolled revision
                                if ( $entry->getSubtype() === 'patrol' ) {
                                        $diffLink = htmlspecialchars(
-                                               wfMsgForContent( 'patrol-log-diff', $parameters['4::curid'] ) );
-                                       $text = wfMsgForContent( 'patrol-log-line', $diffLink, "[[$target]]", "" );
+                                               wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
+                                                       ->inContentLanguage()->text() );
+                                       $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
+                                               ->inContentLanguage()->text();
                                } else {
                                        // broken??
                                }
@@ -243,14 +248,17 @@ class LogFormatter {
                        case 'protect':
                                switch( $entry->getSubtype() ) {
                                case 'protect':
-                                       $text = wfMsgExt( 'protectedarticle', $msgOpts, $target . ' ' . $parameters[0] );
-                                               break;
+                                       $text = wfMessage( 'protectedarticle' )
+                                               ->rawParams( $target . ' ' . $parameters[0] )->inContentLanguage()->escaped();
+                                       break;
                                case 'unprotect':
-                                       $text = wfMsgExt( 'unprotectedarticle', $msgOpts, $target );
-                                               break;
+                                       $text = wfMessage( 'unprotectedarticle' )
+                                               ->rawParams( $target )->inContentLanguage()->escaped();
+                                       break;
                                case 'modify':
-                                       $text = wfMsgExt( 'modifiedarticleprotection', $msgOpts, $target . ' ' . $parameters[0] );
-                                               break;
+                                       $text = wfMessage( 'modifiedarticleprotection' )
+                                               ->rawParams( $target . ' ' . $parameters[0] )->inContentLanguage()->escaped();
+                                       break;
                                }
                                break;
 
@@ -258,13 +266,16 @@ class LogFormatter {
                                switch( $entry->getSubtype() ) {
                                        case 'newusers':
                                        case 'create':
-                                               $text = wfMsgExt( 'newuserlog-create-entry', $msgOpts /* no params */ );
+                                               $text = wfMessage( 'newuserlog-create-entry' )
+                                                       ->inContentLanguage()->escaped();
                                                break;
                                        case 'create2':
-                                               $text = wfMsgExt( 'newuserlog-create2-entry', $msgOpts, $target );
+                                               $text = wfMessage( 'newuserlog-create2-entry' )
+                                                       ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        case 'autocreate':
-                                               $text = wfMsgExt( 'newuserlog-autocreate-entry', $msgOpts /* no params */ );
+                                               $text = wfMessage( 'newuserlog-autocreate-entry' )
+                                                       ->inContentLanguage()->escaped();
                                                break;
                                }
                                break;
@@ -272,10 +283,12 @@ class LogFormatter {
                        case 'upload':
                                switch( $entry->getSubtype() ) {
                                        case 'upload':
-                                               $text = wfMsgExt( 'uploadedimage', $msgOpts, $target );
+                                               $text = wfMessage( 'uploadedimage' )
+                                                       ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        case 'overwrite':
-                                               $text = wfMsgExt( 'overwroteimage', $msgOpts, $target );
+                                               $text = wfMessage( 'overwroteimage' )
+                                                       ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                }
                                break;
index 2521ae8..d96a5ea 100644 (file)
@@ -133,7 +133,8 @@ class LogPage {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
-                               $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment;
+                               $rcComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() .
+                                       $this->comment;
                        }
                }
 
@@ -152,7 +153,8 @@ class LogPage {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
-                               $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment;
+                               $rcComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() .
+                                       $this->comment;
                        }
                }
 
@@ -197,7 +199,7 @@ class LogPage {
                global $wgLogNames;
 
                if( isset( $wgLogNames[$type] ) ) {
-                       return str_replace( '_', ' ', wfMsg( $wgLogNames[$type] ) );
+                       return str_replace( '_', ' ', wfMessage( $wgLogNames[$type] )->text() );
                } else {
                        // Bogus log types? Perhaps an extension was removed.
                        return $type;
@@ -214,7 +216,7 @@ class LogPage {
         */
        public static function logHeader( $type ) {
                global $wgLogHeaders;
-               return wfMsgExt( $wgLogHeaders[$type], array( 'parseinline' ) );
+               return wfMessage( $wgLogHeaders[$type] )->parse();
        }
 
        /**
@@ -247,12 +249,12 @@ class LogPage {
 
                if( isset( $wgLogActions[$key] ) ) {
                        if( is_null( $title ) ) {
-                               $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'language' => $langObj ) );
+                               $rv = wfMessage( $wgLogActions[$key] )->inLanguage( $langObj )->escaped();
                        } else {
                                $titleLink = self::getTitleLink( $type, $langObjOrNull, $title, $params );
 
                                if( preg_match( '/^rights\/(rights|autopromote)/', $key ) ) {
-                                       $rightsnone = wfMsgExt( 'rightsnone', array( 'parsemag', 'language' => $langObj ) );
+                                       $rightsnone = wfMessage( 'rightsnone' )->inLanguage( $langObj )->text();
 
                                        if( $skin ) {
                                                $username = $title->getText();
@@ -275,7 +277,7 @@ class LogPage {
                                }
 
                                if( count( $params ) == 0 ) {
-                                       $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'replaceafter', 'language' => $langObj ), $titleLink );
+                                       $rv = wfMessage( $wgLogActions[$key] )->rawParams( $titleLink )->inLanguage( $langObj )->escaped();
                                } else {
                                        $details = '';
                                        array_unshift( $params, $titleLink );
@@ -302,11 +304,11 @@ class LogPage {
 
                                                // Cascading flag...
                                                if( $params[2] ) {
-                                                       $details .= ' [' . wfMsgExt( 'protect-summary-cascade', array( 'parsemag', 'language' => $langObj ) ) . ']';
+                                                       $details .= ' [' . wfMessage( 'protect-summary-cascade' )->inLanguage( $langObj )->text() . ']';
                                                }
                                        }
 
-                                       $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'replaceafter', 'language' => $langObj ), $params ) . $details;
+                                       $rv = wfMessage( $wgLogActions[$key] )->rawParams( $params )->inLanguage( $langObj )->escaped() . $details;
                                }
                        }
                } else {
@@ -442,7 +444,7 @@ class LogPage {
         * @param $action String: one of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
         * @param $target Title object
         * @param $comment String: description associated
-        * @param $params Array: parameters passed later to wfMsg.* functions
+        * @param $params Array: parameters passed later to wfMessage function
         * @param $doer User object: the user doing the action
         *
         * @return int log_id of the inserted log entry
index 0f30c6f..8a4b943 100644 (file)
@@ -524,7 +524,7 @@ class BitmapHandler extends ImageHandler {
                if ( !isset( $typemap[$params['mimeType']] ) ) {
                        $err = 'Image type not supported';
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_image-type' );
+                       $errMsg = wfMessage( 'thumbnail_image-type' )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
                list( $loader, $colorStyle, $saveType ) = $typemap[$params['mimeType']];
@@ -532,14 +532,14 @@ class BitmapHandler extends ImageHandler {
                if ( !function_exists( $loader ) ) {
                        $err = "Incomplete GD library configuration: missing function $loader";
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_gd-library', $loader );
+                       $errMsg = wfMessage( 'thumbnail_gd-library', $loader )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
                if ( !file_exists( $params['srcPath'] ) ) {
                        $err = "File seems to be missing: {$params['srcPath']}";
                        wfDebug( "$err\n" );
-                       $errMsg = wfMsg( 'thumbnail_image-missing', $params['srcPath'] );
+                       $errMsg = wfMessage( 'thumbnail_image-missing', $params['srcPath'] )->text();
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
index 7ee93a1..ea4888a 100644 (file)
@@ -138,7 +138,7 @@ class DjVuHandler extends ImageHandler {
                        $width = isset( $params['width'] ) ? $params['width'] : 0;
                        $height = isset( $params['height'] ) ? $params['height'] : 0;
                        return new MediaTransformError( 'thumbnail_error', $width, $height,
-                               wfMsg( 'djvu_no_xml' ) );
+                               wfMessage( 'djvu_no_xml' )->text() );
                }
 
                if ( !$this->normaliseParams( $image, $params ) ) {
@@ -148,7 +148,12 @@ class DjVuHandler extends ImageHandler {
                $height = $params['height'];
                $page = $params['page'];
                if ( $page > $this->pageCount( $image ) ) {
-                       return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'djvu_page_error' ) );
+                       return new MediaTransformError(
+                               'thumbnail_error',
+                               $width,
+                               $height,
+                               wfMessage( 'djvu_page_error' )->text()
+                       );
                }
 
                if ( $flags & self::TRANSFORM_LATER ) {
@@ -156,7 +161,12 @@ class DjVuHandler extends ImageHandler {
                }
 
                if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
-                       return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'thumbnail_dest_directory' ) );
+                       return new MediaTransformError(
+                               'thumbnail_error',
+                               $width,
+                               $height,
+                               wfMessage( 'thumbnail_dest_directory' )->text()
+                       );
                }
 
                $srcPath = $image->getLocalRefPath();
index 0ae9a05..35305d1 100644 (file)
@@ -233,7 +233,7 @@ class FormatMetadata {
                                case 'dc-date':
                                case 'DateTimeMetadata':
                                        if ( $val == '0000:00:00 00:00:00' || $val == '    :  :     :  :  ' ) {
-                                               $val = wfMsg( 'exif-unknowndate' );
+                                               $val = wfMessage( 'exif-unknowndate' )->text();
                                        } elseif ( preg_match( '/^(?:\d{4}):(?:\d\d):(?:\d\d) (?:\d\d):(?:\d\d):(?:\d\d)$/D', $val ) ) {
                                                // Full date.
                                                $time = wfTimestamp( TS_MW, $val );
@@ -591,7 +591,7 @@ class FormatMetadata {
                                case 'Software':
                                        if ( is_array( $val ) ) {
                                                //if its a software, version array.
-                                               $val = wfMsg( 'exif-software-version-value', $val[0], $val[1] );
+                                               $val = wfMessage( 'exif-software-version-value', $val[0], $val[1] )->text();
                                        } else {
                                                $val = self::msg( $tag, '', $val );
                                        }
@@ -599,8 +599,8 @@ class FormatMetadata {
 
                                case 'ExposureTime':
                                        // Show the pretty fraction as well as decimal version
-                                       $val = wfMsg( 'exif-exposuretime-format',
-                                               self::formatFraction( $val ), self::formatNum( $val ) );
+                                       $val = wfMessage( 'exif-exposuretime-format',
+                                               self::formatFraction( $val ), self::formatNum( $val ) )->text();
                                        break;
                                case 'ISOSpeedRatings':
                                        // If its = 65535 that means its at the
@@ -613,13 +613,13 @@ class FormatMetadata {
                                        }
                                        break;
                                case 'FNumber':
-                                       $val = wfMsg( 'exif-fnumber-format',
-                                               self::formatNum( $val ) );
+                                       $val = wfMessage( 'exif-fnumber-format',
+                                               self::formatNum( $val ) )->text();
                                        break;
 
                                case 'FocalLength': case 'FocalLengthIn35mmFilm':
-                                       $val = wfMsg( 'exif-focallength-format',
-                                               self::formatNum( $val ) );
+                                       $val = wfMessage( 'exif-focallength-format',
+                                               self::formatNum( $val ) )->text();
                                        break;
 
                                case 'MaxApertureValue':
@@ -633,10 +633,10 @@ class FormatMetadata {
                                        if ( is_numeric( $val ) ) {
                                                $fNumber = pow( 2, $val / 2 );
                                                if ( $fNumber !== false ) {
-                                                       $val = wfMsg( 'exif-maxaperturevalue-value',
+                                                       $val = wfMessage( 'exif-maxaperturevalue-value',
                                                                self::formatNum( $val ),
                                                                self::formatNum( $fNumber, 2 )
-                                                       );
+                                                       )->text();
                                                }
                                        }
                                        break;
@@ -696,7 +696,7 @@ class FormatMetadata {
                                case 'PixelYDimension':
                                case 'ImageWidth':
                                case 'ImageLength':
-                                       $val = self::formatNum( $val ) . ' ' . wfMsg( 'unit-pixel' );
+                                       $val = self::formatNum( $val ) . ' ' . wfMessage( 'unit-pixel' )->text();
                                        break;
 
                                // Do not transform fields with pure text.
@@ -958,12 +958,12 @@ class FormatMetadata {
 
                if ( $lang === false ) {
                        if ( $noHtml ) {
-                               return wfMsg( 'metadata-langitem-default',
-                                       $wrappedValue ) . "\n\n";
+                               return wfMessage( 'metadata-langitem-default',
+                                       $wrappedValue )->text() . "\n\n";
                        } /* else */
                        return '<li class="mw-metadata-lang-default">'
-                               . wfMsg( 'metadata-langitem-default',
-                                       $wrappedValue )
+                               . wfMessage( 'metadata-langitem-default',
+                                       $wrappedValue )->text()
                                . "</li>\n";
                }
 
@@ -981,8 +981,8 @@ class FormatMetadata {
                // else we have a language specified
 
                if ( $noHtml ) {
-                       return '*' . wfMsg( 'metadata-langitem',
-                               $wrappedValue, $langName, $lang );
+                       return '*' . wfMessage( 'metadata-langitem',
+                               $wrappedValue, $langName, $lang )->text();
                } /* else: */
 
                $item = '<li class="mw-metadata-lang-code-'
@@ -991,8 +991,8 @@ class FormatMetadata {
                        $item .= ' mw-metadata-lang-default';
                }
                $item .= '" lang="' . $lang . '">';
-               $item .= wfMsg( 'metadata-langitem',
-                       $wrappedValue, $langName, $lang );
+               $item .= wfMessage( 'metadata-langitem',
+                       $wrappedValue, $langName, $lang )->text();
                $item .= "</li>\n";
                return $item;
        }
@@ -1006,14 +1006,14 @@ class FormatMetadata {
         * @param $val String: the value of the tag
         * @param $arg String: an argument to pass ($1)
         * @param $arg2 String: a 2nd argument to pass ($2)
-        * @return string A wfMsg of "exif-$tag-$val" in lower case
+        * @return string A wfMessage of "exif-$tag-$val" in lower case
         */
        static function msg( $tag, $val, $arg = null, $arg2 = null ) {
                global $wgContLang;
 
                if ($val === '')
                        $val = 'value';
-               return wfMsg( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 );
+               return wfMessage( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
        }
 
        /**
@@ -1214,7 +1214,7 @@ class FormatMetadata {
                $min = self::formatNum( $min );
                $sec = self::formatNum( $sec );
 
-               return wfMsg( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord );
+               return wfMessage( 'exif-coordinate-format', $deg, $min, $sec, $ref, $coord )->text();
        }
 
        /**
@@ -1335,9 +1335,9 @@ class FormatMetadata {
                                        . htmlspecialchars( $vals['CiUrlWork'] )
                                        . '</span>';
                        }
-                       return wfMsg( 'exif-contact-value', $email, $url,
+                       return wfMessage( 'exif-contact-value', $email, $url,
                                $street, $city, $region, $postal, $country,
-                               $tel );
+                               $tel )->text();
                }
        }
 }
index e883b7f..ab8fb06 100644 (file)
@@ -372,7 +372,7 @@ abstract class MediaHandler {
         */
        function visibleMetadataFields() {
                $fields = array();
-               $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
+               $lines = explode( "\n", wfMessage( 'metadata-fields' )->inContentLanguage()->text() );
                foreach( $lines as $line ) {
                        $matches = array();
                        if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
index 00d12bb..80766bb 100644 (file)
@@ -359,6 +359,6 @@ class TransformParameterError extends MediaTransformError {
                parent::__construct( 'thumbnail_error',
                        max( isset( $params['width']  ) ? $params['width']  : 0, 120 ),
                        max( isset( $params['height'] ) ? $params['height'] : 0, 120 ),
-                       wfMsg( 'thumbnail_invalid_params' ) );
+                       wfMessage( 'thumbnail_invalid_params' )->text() );
        }
 }
index 9846c71..cfefeb2 100644 (file)
@@ -115,7 +115,7 @@ class SvgHandler extends ImageHandler {
 
                if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
                        return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
-                               wfMsg( 'thumbnail_dest_directory' ) );
+                               wfMessage( 'thumbnail_dest_directory' )->text() );
                }
 
                $srcPath = $image->getLocalRefPath();
@@ -219,10 +219,8 @@ class SvgHandler extends ImageHandler {
         */
        function getLongDesc( $file ) {
                global $wgLang;
-               return wfMsgExt( 'svg-long-desc', 'parseinline',
-                       $wgLang->formatNum( $file->getWidth() ),
-                       $wgLang->formatNum( $file->getHeight() ),
-                       $wgLang->formatSize( $file->getSize() ) );
+               return wfMessage( 'svg-long-desc' )->numParams( $file->getWidth(), $file->getHeight() )
+                       ->params( $wgLang->formatSize( $file->getSize() ) )->parse();
        }
 
        function getMetadata( $file, $filename ) {
index 8db5ac9..4c6a22f 100644 (file)
@@ -747,7 +747,7 @@ class CoreParserFunctions {
                        $title = SpecialPage::getTitleFor( $page, $subpage );
                        return $title->getPrefixedText();
                } else {
-                       return wfMsgForContent( 'nosuchspecialpage' );
+                       return wfMessage( 'nosuchspecialpage' )->inContentLanguage()->text();
                }
        }
 
@@ -782,9 +782,7 @@ class CoreParserFunctions {
                        return '';
                } else {
                        return( '<span class="error">' .
-                               wfMsgForContent( 'duplicate-defaultsort',
-                                                htmlspecialchars( $old ),
-                                                htmlspecialchars( $text ) ) .
+                               wfMessage( 'duplicate-defaultsort', $old, $text )->inContentLanguage()->escaped() .
                                '</span>' );
                }
        }
@@ -844,7 +842,7 @@ class CoreParserFunctions {
                $stripList = $parser->getStripList();
                if ( !in_array( $tagName, $stripList ) ) {
                        return '<span class="error">' .
-                               wfMsgForContent( 'unknown_extension_tag', $tagName ) .
+                               wfMessage( 'unknown_extension_tag', $tagName )->inContentLanguage()->text() .
                                '</span>';
                }
 
index b351290..f3c978c 100644 (file)
@@ -1230,7 +1230,7 @@ class Parser {
                                throw new MWException( __METHOD__.': unrecognised match type "' .
                                        substr( $m[0], 0, 20 ) . '"' );
                        }
-                       $url = wfMsgForContent( $urlmsg, $id );
+                       $url = wfMessage( $urlmsg, $id )->inContentLanguage()->text();
                        return Linker::makeExternalLink( $url, "{$keyword} {$id}", true, $CssClass );
                } elseif ( isset( $m[5] ) && $m[5] !== '' ) {
                        # ISBN
@@ -1684,7 +1684,7 @@ class Parser {
                }
                if ( !$text && $this->mOptions->getEnableImageWhitelist()
                         && preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
-                       $whitelist = explode( "\n", wfMsgForContent( 'external_image_whitelist' ) );
+                       $whitelist = explode( "\n", wfMessage( 'external_image_whitelist' )->inContentLanguage()->text() );
                        foreach ( $whitelist as $entry ) {
                                # Sanitize the regex fragment, make it case-insensitive, ignore blank entries/comments
                                if ( strpos( $entry, '#' ) === 0 || $entry === '' ) {
@@ -1749,7 +1749,7 @@ class Parser {
                if ( $useLinkPrefixExtension ) {
                        # Match the end of a line for a word that's not followed by whitespace,
                        # e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched
-                       $e2 = wfMsgForContent( 'linkprefix' );
+                       $e2 = wfMessage( 'linkprefix' )->inContentLanguage()->text();
                }
 
                if ( is_null( $this->mTitle ) ) {
@@ -3085,7 +3085,8 @@ class Parser {
         */
        function limitationWarn( $limitationType, $current = null, $max = null) {
                # does no harm if $current and $max are present but are unnecessary for the message
-               $warning = wfMsgExt( "$limitationType-warning", array( 'parsemag', 'escape' ), $current, $max );
+               $warning = wfMessage( "$limitationType-warning" )->numParams( $current, $max )
+                       ->inContentLanguage()->escaped();
                $this->mOutput->addWarning( $warning );
                $this->addTrackingCategory( "$limitationType-category" );
        }
@@ -3290,7 +3291,8 @@ class Parser {
                                if ( $frame->depth >= $limit ) {
                                        $found = true;
                                        $text = '<span class="error">'
-                                               . wfMsgForContent( 'parser-template-recursion-depth-warning', $limit )
+                                               . wfMessage( 'parser-template-recursion-depth-warning' )
+                                                       ->numParams( $limit )->inContentLanguage()->text()
                                                . '</span>';
                                }
                        }
@@ -3370,7 +3372,9 @@ class Parser {
                        # This has to be done after redirect resolution to avoid infinite loops via redirects
                        if ( !$frame->loopCheck( $title ) ) {
                                $found = true;
-                               $text = '<span class="error">' . wfMsgForContent( 'parser-template-loop-warning', $titleText ) . '</span>';
+                               $text = '<span class="error">'
+                                       . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
+                                       . '</span>';
                                wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
                        }
                        wfProfileOut( __METHOD__ . '-loadtpl' );
@@ -3660,13 +3664,13 @@ class Parser {
                global $wgEnableScaryTranscluding;
 
                if ( !$wgEnableScaryTranscluding ) {
-                       return wfMsgForContent('scarytranscludedisabled');
+                       return wfMessage('scarytranscludedisabled')->inContentLanguage()->text();
                }
 
                $url = $title->getFullUrl( "action=$action" );
 
                if ( strlen( $url ) > 255 ) {
-                       return wfMsgForContent( 'scarytranscludetoolong' );
+                       return wfMessage( 'scarytranscludetoolong' )->inContentLanguage()->text();
                }
                return $this->fetchScaryTemplateMaybeFromCache( $url );
        }
@@ -3687,7 +3691,7 @@ class Parser {
 
                $text = Http::get( $url );
                if ( !$text ) {
-                       return wfMsgForContent( 'scarytranscludefailed', $url );
+                       return wfMessage( 'scarytranscludefailed', $url )->inContentLanguage()->text();
                }
 
                $dbw = wfGetDB( DB_MASTER );
@@ -4412,7 +4416,7 @@ class Parser {
                $text = $this->replaceVariables( $text );
 
                # This works almost by chance, as the replaceVariables are done before the getUserSig(),
-               # which may corrupt this parser instance via its wfMsgExt( parsemag ) call-
+               # which may corrupt this parser instance via its wfMessage()->text() call-
 
                # Signatures
                $sigText = $this->getUserSig( $user );
index b08aa14..ad95d5f 100644 (file)
@@ -134,11 +134,14 @@ class StripState {
                $marker = $m[1];
                if ( isset( $this->data[$this->tempType][$marker] ) ) {
                        if ( isset( $this->circularRefGuard[$marker] ) ) {
-                               return '<span class="error">' . wfMsgForContent( 'parser-unstrip-loop-warning' ) . '</span>';
+                               return '<span class="error">'
+                                       . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
+                                       . '</span>';
                        }
                        if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
                                return '<span class="error">' . 
-                                       wfMsgForContent( 'parser-unstrip-recursion-limit', self::UNSTRIP_RECURSION_LIMIT ) . 
+                                       wfMessage( 'parser-unstrip-recursion-limit' )
+                                               ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
                                        '</span>';
                        }
                        $this->circularRefGuard[$marker] = true;
index b22c144..98727f1 100644 (file)
@@ -169,9 +169,10 @@ class UsercreateTemplate extends QuickTemplate {
                        <td></td>
                        <td class="mw-input">
                                <?php
-                               global $wgCookieExpiration, $wgLang;
+                               global $wgCookieExpiration;
+                               $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
                                echo Xml::checkLabel(
-                                       wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
+                                       wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
                                        'wpRemember',
                                        'wpRemember',
                                        $this->data['remember'],
index 5a2c633..a3f6a38 100644 (file)
@@ -108,9 +108,10 @@ class UserloginTemplate extends QuickTemplate {
                        <td></td>
                        <td class="mw-input">
                                <?php
-                               global $wgCookieExpiration, $wgLang;
+                               global $wgCookieExpiration;
+                               $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
                                echo Xml::checkLabel(
-                                       wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
+                                       wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
                                        'wpRemember',
                                        'wpRemember',
                                        $this->data['remember'],
@@ -126,7 +127,7 @@ class UserloginTemplate extends QuickTemplate {
                        <td class="mw-input">
                        <?php
                        echo Xml::checkLabel(
-                               wfMsg( 'securelogin-stick-https' ),
+                               wfMessage( 'securelogin-stick-https' )->text(),
                                'wpStickHTTPS',
                                'wpStickHTTPS',
                                $this->data['stickHTTPS'],
@@ -140,7 +141,7 @@ class UserloginTemplate extends QuickTemplate {
                        <td></td>
                        <td class="mw-submit">
                                <?php
-               echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array(
+               echo Html::input( 'wpLoginAttempt', wfMessage( 'login' )->text(), 'submit', array(
                        'id' => 'wpLoginAttempt',
                        'tabindex' => '9'
                ) );
@@ -153,10 +154,14 @@ class UserloginTemplate extends QuickTemplate {
                                );
                        } elseif( $this->data['resetlink'] === null ) {
                                echo '&#160;';
-                               echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array(
-                                       'id' => 'wpMailmypassword',
-                                       'tabindex' => '10'
-                               ) );
+                               echo Html::input(
+                                       'wpMailmypassword',
+                                       wfMessage( 'mailmypassword' )->text(),
+                                       'submit', array(
+                                               'id' => 'wpMailmypassword',
+                                               'tabindex' => '10'
+                                       )
+                               );
                        }
                } ?>
 
index 6ef3be2..d40b53d 100644 (file)
@@ -1227,7 +1227,7 @@ abstract class UploadBase {
 
                        if ( $wgAntivirusRequired ) {
                                wfProfileOut( __METHOD__ );
-                               return wfMsg( 'virus-scanfailed', array( $exitCode ) );
+                               return wfMessage( 'virus-scanfailed', array( $exitCode ) )->text();
                        } else {
                                wfProfileOut( __METHOD__ );
                                return null;
index 06f4073..ae66d7c 100644 (file)
@@ -3032,10 +3032,7 @@ class Language {
         */
        function commaList( array $list ) {
                return implode(
-                       wfMsgExt(
-                               'comma-separator',
-                               array( 'parsemag', 'escapenoentities', 'language' => $this )
-                       ),
+                       wfMessage( 'comma-separator' )->inLanguage( $this )->escaped(),
                        $list
                );
        }
@@ -3048,10 +3045,7 @@ class Language {
         */
        function semicolonList( array $list ) {
                return implode(
-                       wfMsgExt(
-                               'semicolon-separator',
-                               array( 'parsemag', 'escapenoentities', 'language' => $this )
-                       ),
+                       wfMessage( 'semicolon-separator' )->inLanguage( $this )->escaped(),
                        $list
                );
        }
@@ -3063,10 +3057,7 @@ class Language {
         */
        function pipeList( array $list ) {
                return implode(
-                       wfMsgExt(
-                               'pipe-separator',
-                               array( 'escapenoentities', 'language' => $this )
-                       ),
+                       wfMessage( 'pipe-separator' )->inLanguage( $this )->escaped(),
                        $list
                );
        }
@@ -3091,7 +3082,7 @@ class Language {
        function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
                # Use the localized ellipsis character
                if ( $ellipsis == '...' ) {
-                       $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) );
+                       $ellipsis = wfMessage( 'ellipsis' )->inLanguage( $this )->escaped();
                }
                # Check if there is no need to truncate
                if ( $length == 0 ) {
@@ -3189,7 +3180,7 @@ class Language {
        function truncateHtml( $text, $length, $ellipsis = '...' ) {
                # Use the localized ellipsis character
                if ( $ellipsis == '...' ) {
-                       $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) );
+                       $ellipsis = wfMessage( 'ellipsis' )->inLanguage( $this )->escaped();
                }
                # Check if there is clearly no need to truncate
                if ( $length <= 0 ) {
@@ -4116,7 +4107,7 @@ class Language {
                $dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) .
                        $this->getDirMark();
                $details = $details ? $dirmark . $this->getMessageFromDB( 'word-separator' ) .
-                       wfMsgExt( 'parentheses', array( 'escape', 'replaceafter', 'language' => $this ), $details ) : '';
+                       wfMessage( 'parentheses' )->rawParams( $details )->inLanguage( $this )->escaped() : '';
                return $page . $details;
        }
 
index ec395eb..3ca3025 100644 (file)
@@ -354,12 +354,12 @@ class TextPassDumper extends BackupDumper {
                                wfDebug( "TextDumpPass::readDump encountered XML parsing error\n" );
 
                                $byte = xml_get_current_byte_index( $parser );
-                               $msg = wfMsgHtml( 'xml-error-string',
+                               $msg = wfMessage( 'xml-error-string',
                                        'XML import parse failure',
                                        xml_get_current_line_number( $parser ),
                                        xml_get_current_column_number( $parser ),
                                        $byte . ( is_null( $chunk ) ? null : ( '; "' . substr( $chunk, $byte -$offset, 16 ) . '"' ) ),
-                                       xml_error_string( xml_get_error_code( $parser ) ) );
+                                       xml_error_string( xml_get_error_code( $parser ) ) )->escaped();
 
                                xml_parser_free( $parser );
 
index e0c65e8..f0e464d 100644 (file)
@@ -307,7 +307,7 @@ var mw = ( function ( $, undefined ) {
                },
 
                /**
-                * Gets a message string, similar to wfMsg()
+                * Gets a message string, similar to wfMessage()
                 *
                 * @param key string Key of message to get
                 * @param parameters mixed First argument in a list of variadic arguments,
index a9088cb..0413b5a 100644 (file)
@@ -146,7 +146,7 @@ class ExtraParserTest extends MediaWikiTestCase {
         */
        function testTrackingCategory() {
                $title = Title::newFromText( __FUNCTION__ );
-               $catName =  wfMsgForContent( 'broken-file-category' );
+               $catName =  wfMessage( 'broken-file-category' )->inContentLanguage()->text();
                $cat = Title::makeTitleSafe( NS_CATEGORY, $catName );
                $expected = array( $cat->getDBkey() );
                $parserOutput = $this->parser->parse( "[[file:nonexistent]]" , $title, $this->options );