From: Siebrand Mazeland Date: Sun, 19 Aug 2012 23:05:20 +0000 (+0200) Subject: Replace deprecated wfMsg* calls with Message class calls. X-Git-Tag: 1.31.0-rc.0~22659^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=4e1ccf02676ce97c4ec34e1b35b99ab2e0430529;p=lhc%2Fweb%2Fwiklou.git Replace deprecated wfMsg* calls with Message class calls. Doing this in steps of roughly 100 changes per commit, so that it remains reviewable. Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d --- diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 8d2219a026..7586bb6548 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -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; diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index 2521ae871d..d96a5ea51a 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -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 diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 0f30c6f047..8a4b943271 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -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 ); } diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 7ee93a1de7..ea4888a9c5 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -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(); diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 0ae9a05a3f..35305d1776 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -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 '
  • ' - . wfMsg( 'metadata-langitem-default', - $wrappedValue ) + . wfMessage( 'metadata-langitem-default', + $wrappedValue )->text() . "
  • \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 = '
  • '; - $item .= wfMsg( 'metadata-langitem', - $wrappedValue, $langName, $lang ); + $item .= wfMessage( 'metadata-langitem', + $wrappedValue, $langName, $lang )->text(); $item .= "
  • \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'] ) . ''; } - return wfMsg( 'exif-contact-value', $email, $url, + return wfMessage( 'exif-contact-value', $email, $url, $street, $city, $region, $postal, $country, - $tel ); + $tel )->text(); } } } diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index e883b7f8ec..ab8fb0664d 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -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 ) ) { diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index 00d12bb29f..80766bb3b9 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -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() ); } } diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 9846c71da9..cfefeb2975 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -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 ) { diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 8db5ac9f43..4c6a22f740 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -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( '' . - wfMsgForContent( 'duplicate-defaultsort', - htmlspecialchars( $old ), - htmlspecialchars( $text ) ) . + wfMessage( 'duplicate-defaultsort', $old, $text )->inContentLanguage()->escaped() . '' ); } } @@ -844,7 +842,7 @@ class CoreParserFunctions { $stripList = $parser->getStripList(); if ( !in_array( $tagName, $stripList ) ) { return '' . - wfMsgForContent( 'unknown_extension_tag', $tagName ) . + wfMessage( 'unknown_extension_tag', $tagName )->inContentLanguage()->text() . ''; } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index b3512908bd..f3c978c48d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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 = '' - . wfMsgForContent( 'parser-template-recursion-depth-warning', $limit ) + . wfMessage( 'parser-template-recursion-depth-warning' ) + ->numParams( $limit )->inContentLanguage()->text() . ''; } } @@ -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 = '' . wfMsgForContent( 'parser-template-loop-warning', $titleText ) . ''; + $text = '' + . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text() + . ''; 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 ); diff --git a/includes/parser/StripState.php b/includes/parser/StripState.php index b08aa148fe..ad95d5f76a 100644 --- a/includes/parser/StripState.php +++ b/includes/parser/StripState.php @@ -134,11 +134,14 @@ class StripState { $marker = $m[1]; if ( isset( $this->data[$this->tempType][$marker] ) ) { if ( isset( $this->circularRefGuard[$marker] ) ) { - return '' . wfMsgForContent( 'parser-unstrip-loop-warning' ) . ''; + return '' + . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text() + . ''; } if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) { return '' . - wfMsgForContent( 'parser-unstrip-recursion-limit', self::UNSTRIP_RECURSION_LIMIT ) . + wfMessage( 'parser-unstrip-recursion-limit' ) + ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() . ''; } $this->circularRefGuard[$marker] = true; diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index b22c144f4e..98727f1706 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -169,9 +169,10 @@ class UsercreateTemplate extends QuickTemplate { formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(), 'wpRemember', 'wpRemember', $this->data['remember'], diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 5a2c633900..a3f6a38bc6 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -108,9 +108,10 @@ class UserloginTemplate extends QuickTemplate { formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ), + wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(), 'wpRemember', 'wpRemember', $this->data['remember'], @@ -126,7 +127,7 @@ class UserloginTemplate extends QuickTemplate { text(), 'wpStickHTTPS', 'wpStickHTTPS', $this->data['stickHTTPS'], @@ -140,7 +141,7 @@ class UserloginTemplate extends QuickTemplate { text(), 'submit', array( 'id' => 'wpLoginAttempt', 'tabindex' => '9' ) ); @@ -153,10 +154,14 @@ class UserloginTemplate extends QuickTemplate { ); } elseif( $this->data['resetlink'] === null ) { echo ' '; - 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' + ) + ); } } ?> diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 6ef3be2414..d40b53d3a1 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -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; diff --git a/languages/Language.php b/languages/Language.php index 06f4073400..ae66d7c84c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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; } diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index ec395eb0ed..3ca30258a7 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -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 ); diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index e0c65e80f0..f0e464dd65 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -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, diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index a9088cb236..0413b5a2e6 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -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 );