From 39ab3cfc9ff796125d73878a6214bef99e104895 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Fri, 14 Jan 2011 10:51:05 +0000 Subject: [PATCH] Implement Message::isBlank and Message::isDisabled. And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods. --- includes/Article.php | 6 ++---- includes/ChangeTags.php | 7 ++----- includes/EditPage.php | 17 ++++++++-------- includes/GlobalFunctions.php | 5 +++-- includes/ImagePage.php | 6 +++--- includes/Interwiki.php | 10 ++++------ includes/Licenses.php | 4 ++-- includes/LogPage.php | 10 ++++------ includes/Message.php | 18 +++++++++++++++++ includes/Preferences.php | 7 +++---- includes/ProtectionForm.php | 17 +++++++--------- includes/RawPage.php | 6 ++---- includes/SpecialPage.php | 10 +++++----- includes/User.php | 20 +++++++------------ includes/filerepo/FileRepo.php | 6 +----- includes/parser/Parser.php | 6 +++--- includes/specials/SpecialContributions.php | 3 +-- .../specials/SpecialDeletedContributions.php | 4 +--- includes/specials/SpecialListgrouprights.php | 18 ++++++----------- includes/specials/SpecialStatistics.php | 14 ++++++------- includes/specials/SpecialTags.php | 4 ++-- includes/specials/SpecialUpload.php | 6 +++--- includes/specials/SpecialUserlogin.php | 6 +++--- includes/upload/UploadBase.php | 6 +++--- 24 files changed, 100 insertions(+), 116 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index b898549c03..adea10cd91 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1270,8 +1270,7 @@ class Article { global $wgOut; if ( $this->mTitle->isTalkPage() ) { - $msg = wfMsgNoTrans( 'talkpageheader' ); - if ( $msg !== '-' && !wfEmptyMsg( 'talkpageheader', $msg ) ) { + if ( !wfMessage( 'talkpageheader' )->isDisabled() ) { $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'talkpageheader' ) ); } } @@ -3843,8 +3842,7 @@ class Article { # Show user links if allowed to see them. If hidden, then show them only if requested... $userlinks = $sk->revUserTools( $revision, !$unhide ); - $m = wfMsg( 'revision-info-current' ); - $infomsg = $current && !wfEmptyMsg( 'revision-info-current', $m ) && $m != '-' + $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled() ? 'revision-info-current' : 'revision-info'; diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 4a1ad801b4..b893d30a70 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -28,11 +28,8 @@ class ChangeTags { } static function tagDescription( $tag ) { - $msg = wfMsgExt( "tag-$tag", 'parseinline' ); - if ( wfEmptyMsg( "tag-$tag", $msg ) ) { - return htmlspecialchars( $tag ); - } - return $msg; + $msg = wfMessage( "tag-$tag" ); + return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag ); } ## Basic utility method to add tags to a particular change, given its rc_id, rev_id and/or log_id. diff --git a/includes/EditPage.php b/includes/EditPage.php index bf5c2bff36..775c5b61eb 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -390,16 +390,18 @@ class EditPage { # Optional notices on a per-namespace and per-page basis $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); - if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) { - $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) ); + $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage(); + if ( !$editnotice_ns_message->empty() ) { + $wgOut->addWikiText( $editnotice_ns_msg->plain() ) ); } if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) { $parts = explode( '/', $this->mTitle->getDBkey() ); $editnotice_base = $editnotice_ns; while ( count( $parts ) > 0 ) { $editnotice_base .= '-'.array_shift( $parts ); - if ( !wfEmptyMsg( $editnotice_base, wfMsgForContent( $editnotice_base ) ) ) { - $wgOut->addWikiText( wfMsgForContent( $editnotice_base ) ); + $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage(); + if ( !$editnotice_base_msg->exists() ) { + $wgOut->addWikiText( $editnotice_base_msg->plain() ); } } } @@ -1483,9 +1485,7 @@ HTML $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ) ); } else { - $msg = 'longpage-hint'; - $text = wfMsg( $msg ); - if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) { + if( !wfMessage('longpage-hint')->isDisabled() ) { $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'longpage-hint', $wgLang->formatSize( strlen( $this->textbox1 ) ), strlen( $this->textbox1 ) ) ); @@ -1741,8 +1741,7 @@ HTML protected function showTosSummary() { $msg = 'editpage-tos-summary'; wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) ); - $text = wfMsg( $msg ); - if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) { + if( !wfMessage( $msg )->isDisabled() ) { global $wgOut; $wgOut->addHTML( '
' ); $wgOut->addWikiMsgArray( $msg, array() ); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1eef74bde5..d6d6a16765 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2004,11 +2004,12 @@ function wfGetCachedNotice( $name ) { return false; } } else { - $notice = wfMsgForContentNoTrans( $name ); - if( wfEmptyMsg( $name, $notice ) || $notice == '-' ) { + $msg = wfMessage( $name )->inContentLanguage(); + if( $msg->isDisabled() ) { wfProfileOut( $fname ); return( false ); } + $notice = $msg->plain(); } // Use the extra hash appender to let eg SSL variants separately cache. diff --git a/includes/ImagePage.php b/includes/ImagePage.php index bfae00b826..bf903b760b 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -120,9 +120,9 @@ class ImagePage extends Article { # Show shared description, if needed if ( $this->mExtraDescription ) { - $fol = wfMsgNoTrans( 'shareddescriptionfollows' ); - if ( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) { - $wgOut->addWikiText( $fol ); + $fol = wfMessage( 'shareddescriptionfollows' ); + if ( !$fol->isDisabled() ) { + $wgOut->addWikiText( $fol->plain() ); } $wgOut->addHTML( '
' . $this->mExtraDescription . "
\n" ); } diff --git a/includes/Interwiki.php b/includes/Interwiki.php index 5a3b655643..84f268662c 100644 --- a/includes/Interwiki.php +++ b/includes/Interwiki.php @@ -248,9 +248,8 @@ class Interwiki { * @return String */ public function getName() { - $key = 'interwiki-name-' . $this->mPrefix; - $msg = wfMsgForContent( $key ); - return wfEmptyMsg( $key, $msg ) ? '' : $msg; + $msg = wfMessage( 'interwiki-name-' . $this->mPrefix )->inContentLanguage(); + return !$msg->exists() ? '' : $msg; } /** @@ -259,8 +258,7 @@ class Interwiki { * @return String */ public function getDescription() { - $key = 'interwiki-desc-' . $this->mPrefix; - $msg = wfMsgForContent( $key ); - return wfEmptyMsg( $key, $msg ) ? '' : $msg; + $msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage(); + return !$msg->exists() ? '' : $msg; } } diff --git a/includes/Licenses.php b/includes/Licenses.php index 45944c7352..abf23acbef 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -111,8 +111,8 @@ class Licenses extends HTMLFormField { } protected function msg( $str ) { - $out = wfMsg( $str ); - return wfEmptyMsg( $str, $out ) ? $str : $out; + $msg = wfMessage( $str ); + return $msg->exists() ? $msg->text() : $str; } /**#@-*/ diff --git a/includes/LogPage.php b/includes/LogPage.php index fcd553e2fa..8c47665a02 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -514,13 +514,11 @@ class LogPage { public static function formatBlockFlag( $flag, $forContent = false ) { static $messages = array(); if( !isset( $messages[$flag] ) ) { - $k = 'block-log-flags-' . $flag; - if( $forContent ) { - $msg = wfMsgForContent( $k ); - } else { - $msg = wfMsg( $k ); + $msg = wfMessage( 'block-log-flags-' . $flag ); + if ( $forContent ) { + $msg = $msg->inContentLanguage(); } - $messages[$flag] = htmlspecialchars( wfEmptyMsg( $k, $msg ) ? $flag : $msg ); + $messages[$flag] = htmlspecialchars( !$msg->exists() ? $flag : $msg ); } return $messages[$flag]; } diff --git a/includes/Message.php b/includes/Message.php index 4b44ca5f96..4e2e153db6 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -308,6 +308,24 @@ class Message { return $this->fetchMessage() !== false; } + /** + * Check whether a message does not exist, or is an empty string + * @return Bool: true if is is and false if not + */ + public function isBlank() { + $message = $this->fetchMessage(); + return $message === false || $message == ''; + } + + /** + * Check whether a message does not exist, is an empty string, or is "-" + * @return Bool: true if is is and false if not + */ + public function isDisabled() { + $message = $this->fetchMessage(); + return $message === false || $message == '' || $message == '-'; + } + public static function rawParam( $value ) { return array( 'raw' => $value ); } diff --git a/includes/Preferences.php b/includes/Preferences.php index 8cf1f44d4b..9eb7d89269 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1013,10 +1013,9 @@ class Preferences { # Sort by UI skin name. First though need to update validSkinNames as sometimes # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). foreach ( $validSkinNames as $skinkey => &$skinname ) { - $msgName = "skinname-{$skinkey}"; - $localisedSkinName = wfMsg( $msgName ); - if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) { - $skinname = htmlspecialchars( $localisedSkinName ); + $msg = wfMessage( "skinname-{$skinkey}" ); + if ( $msg->exists() ) { + $skinname = htmlspecialchars( $msg->text() ); } } asort( $validSkinNames ); diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 2d95d80195..9fb13375fb 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -351,13 +351,10 @@ class ProtectionForm { foreach( $this->mRestrictions as $action => $selected ) { /* Not all languages have V_x <-> N_x relation */ - $msg = wfMsg( 'restriction-' . $action ); - if( wfEmptyMsg( 'restriction-' . $action, $msg ) ) { - $msg = $action; - } + $msg = wfMessage( 'restriction-' . $action ); $out .= "". Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, $msg ) . + Xml::element( 'legend', null, $msg->exists() ? $action : $msg->text() ) . Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) . "" . $this->buildSelector( $action, $selected ) . ""; @@ -565,11 +562,11 @@ class ProtectionForm { if( $permission == '' ) { return wfMsg( 'protect-default' ); } else { - $key = "protect-level-{$permission}"; - $msg = wfMsg( $key ); - if( wfEmptyMsg( $key, $msg ) ) - $msg = wfMsg( 'protect-fallback', $permission ); - return $msg; + $msg = wfMessage( "protect-level-{$permission}" ); + if( !$msg->exists() ) { + return $msg->text(); + } + return wfMsg( 'protect-fallback', $permission ); } } diff --git a/includes/RawPage.php b/includes/RawPage.php index 1c99e5f0b6..a4d5400920 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -189,11 +189,9 @@ class RawPage { // If it's a MediaWiki message we can just hit the message cache if( $this->mUseMessageCache && $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { $key = $this->mTitle->getDBkey(); - $text = wfMsgForContentNoTrans( $key ); + $msg = wfMessage( $key )->inContentLanguage(); # If the message doesn't exist, return a blank - if( wfEmptyMsg( $key, $text ) ) { - $text = ''; - } + $text = !$msg->exists() ? '' : $msg->plain(); $found = true; } else { // Get it from the DB diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 558296a679..e985f2b3da 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -341,9 +341,10 @@ class SpecialPage { if( isset($specialPageGroupsCache[$page->mName]) ) { return $specialPageGroupsCache[$page->mName]; } - $group = wfMsg('specialpages-specialpagegroup-'.strtolower($page->mName)); - if( $group == '' - || wfEmptyMsg('specialpages-specialpagegroup-'.strtolower($page->mName), $group ) ) { + $msg = wfMessage('specialpages-specialpagegroup-'.strtolower($page->mName)); + if ( !$msg->isBlank() ) { + $group = $msg->text(); + } else { $group = isset($wgSpecialPageGroups[$page->mName]) ? $wgSpecialPageGroups[$page->mName] : '-'; @@ -882,8 +883,7 @@ class SpecialPage { } else { $msg = $summaryMessageKey; } - $out = wfMsgNoTrans( $msg ); - if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() ) { + if ( !wfMessage( $msg )->isBlank() and ! $this->including() ) { $wgOut->wrapWikiMsg( "
\n$1\n
", $msg ); } diff --git a/includes/User.php b/includes/User.php index 40a41ed4f8..1e972a4d23 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3181,11 +3181,8 @@ class User { * @return String Localized descriptive group name */ static function getGroupName( $group ) { - $key = "group-$group"; - $name = wfMsg( $key ); - return $name == '' || wfEmptyMsg( $key, $name ) - ? $group - : $name; + $msg = wfMessage( "group-$group" ); + return $msg->isBlank() ? $group : $msg->text(); } /** @@ -3195,11 +3192,8 @@ class User { * @return String Localized name for group member */ static function getGroupMember( $group ) { - $key = "group-$group-member"; - $name = wfMsg( $key ); - return $name == '' || wfEmptyMsg( $key, $name ) - ? $group - : $name; + $msg = wfMessage( "group-$group-member" ); + return $msg->isBlank() ? $group : $msg->text(); } /** @@ -3251,9 +3245,9 @@ class User { * @return Title|Bool Title of the page if it exists, false otherwise */ static function getGroupPage( $group ) { - $page = wfMsgForContent( 'grouppage-' . $group ); - if( !wfEmptyMsg( 'grouppage-' . $group, $page ) ) { - $title = Title::newFromText( $page ); + $msg = wfMessage( 'grouppage-' . $group )->inContentLanguage(); + if( !$msg->exists() ) { + $title = Title::newFromText( $msg->text() ); if( is_object( $title ) ) return $title; } diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 6fd7790025..a3931f2c2f 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -657,11 +657,7 @@ abstract class FileRepo { return null; } // 'shared-repo-name-wikimediacommons' is used when $wgUseInstantCommons = true - $repoName = wfMsg( 'shared-repo-name-' . $this->name ); - if ( !wfEmptyMsg( 'shared-repo-name-' . $this->name, $repoName ) ) { - return $repoName; - } - return wfMsg( 'shared-repo' ); + return wfMessageFallback( 'shared-repo-name-' . $this->name, 'shared-repo' )->text(); } /** diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index a14255b6d3..5212920e81 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3355,12 +3355,12 @@ class Parser { $text = $rev->getText(); } elseif ( $title->getNamespace() == NS_MEDIAWIKI ) { global $wgContLang; - $message = $wgContLang->lcfirst( $title->getText() ); - $text = wfMsgForContentNoTrans( $message ); - if ( wfEmptyMsg( $message, $text ) ) { + $message = wfMessage( $wgContLang->lcfirst( $title->getText() ) )->inContentLanguage(); + if ( !$message->exists() ) { $text = false; break; } + $text = $message->plain(); } else { break; } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 2db53ca60b..ea4d26d3fb 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -161,8 +161,7 @@ class SpecialContributions extends SpecialPage { } } - $text = wfMsgNoTrans( $message, $target ); - if( !wfEmptyMsg( $message, $text ) && $text != '-' ) { + if( !wfMessage( $message, $target )->isDisabled() ) { $wgOut->wrapWikiMsg( "", array( $message, $target ) ); diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 92e225864b..0e2215f47a 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -340,9 +340,7 @@ class DeletedContributionsPage extends SpecialPage { ? 'sp-contributions-footer-anon' : 'sp-contributions-footer'; - - $text = wfMsgNoTrans( $message, $target ); - if( !wfEmptyMsg( $message, $text ) && $text != '-' ) { + if( !wfMessage( $message )->isDisabled() ) { $wgOut->wrapWikiMsg( "", array( $message, $target ) ); } } diff --git a/includes/specials/SpecialListgrouprights.php b/includes/specials/SpecialListgrouprights.php index 910ffd0829..e351729d58 100644 --- a/includes/specials/SpecialListgrouprights.php +++ b/includes/specials/SpecialListgrouprights.php @@ -78,19 +78,13 @@ class SpecialListGroupRights extends SpecialPage { ? 'all' : $group; - $msg = wfMsg( 'group-' . $groupname ); - if ( wfEmptyMsg( 'group-' . $groupname, $msg ) || $msg == '' ) { - $groupnameLocalized = $groupname; - } else { - $groupnameLocalized = $msg; - } + $msg = wfMessage( 'group-' . $groupname ); + $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname; - $msg = wfMsgForContent( 'grouppage-' . $groupname ); - if ( wfEmptyMsg( 'grouppage-' . $groupname, $msg ) || $msg == '' ) { - $grouppageLocalized = MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname; - } else { - $grouppageLocalized = $msg; - } + $msg = wfMessage( 'grouppage-' . $groupname )->inContentLanguage(); + $grouppageLocalized = !$msg->isBlank() ? + $msg->text() : + MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname; if( $group == '*' ) { // Do not make a link for the generic * group diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index b0d0246e37..733b48d2bd 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -98,9 +98,9 @@ class SpecialStatistics extends SpecialPage { $text .= Xml::closeElement( 'table' ); # Customizable footer - $footer = wfMsgExt( 'statistics-footer', array('parseinline') ); - if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' ) { - $text .= "\n" . $footer; + $footer = wfMessage( 'statistics-footer' ); + if ( !$footer->isBlank() ) { + $text .= "\n" . $footer->parse(); } $wgOut->addHTML( $text ); @@ -117,11 +117,11 @@ class SpecialStatistics extends SpecialPage { */ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) { if( $descMsg ) { - $descriptionText = wfMsgExt( $descMsg, array( 'parseinline' ), $descMsgParam ); - if ( !wfEmptyMsg( $descMsg, $descriptionText ) ) { - $descriptionText = " ($descriptionText)"; + $msg = wfMessage( $descMsg, $descMsgParam ); + if ( $msg->exists() ) { + $descriptionText = $msg->parse(); $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'), - $descriptionText ); + " ($descriptionText)" ); } } return diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index 164565cdb1..cd15b217db 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -82,8 +82,8 @@ class SpecialTags extends SpecialPage { $disp .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')'; $newRow .= Xml::tags( 'td', null, $disp ); - $desc = wfMsgExt( "tag-$tag-description", 'parseinline' ); - $desc = wfEmptyMsg( "tag-$tag-description", $desc ) ? '' : $desc; + $msg = wfMessage( "tag-$tag-description" ); + $desc = !$msg->exists() ? '' : $msg->parse(); $desc .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')'; $newRow .= Xml::tags( 'td', null, $desc ); diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 7021ef6651..3dd13dc6b6 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -285,10 +285,10 @@ class SpecialUpload extends SpecialPage { $form->addPreText( $message ); # Add footer to form - $uploadFooter = wfMsgNoTrans( 'uploadfooter' ); - if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) ) { + $uploadFooter = wfMessage( 'uploadfooter' ); + if ( !$uploadFooter->isDisabled() ) { $form->addPostText( '\n" ); + . $wgOut->parse( $uploadFooter->plain() ) . "
\n" ); } return $form; diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index bd8e7cae07..26b9c940ff 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -1186,9 +1186,9 @@ class LoginForm extends SpecialPage { function makeLanguageSelector() { global $wgLang; - $msg = wfMsgForContent( 'loginlanguagelinks' ); - if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) { - $langs = explode( "\n", $msg ); + $msg = wfMessage( 'loginlanguagelinks' )->inContentLanguage(); + if( !$msg->isBlank() ) { + $langs = explode( "\n", $msg->text() ); $links = array(); foreach( $langs as $lang ) { $lang = trim( $lang, '* ' ); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index dd108adf47..86da818fd7 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -1179,9 +1179,9 @@ abstract class UploadBase { */ public static function getFilenamePrefixBlacklist() { $blacklist = array(); - $message = wfMsgForContent( 'filename-prefix-blacklist' ); - if( $message && !( wfEmptyMsg( 'filename-prefix-blacklist', $message ) || $message == '-' ) ) { - $lines = explode( "\n", $message ); + $message = wfMessage( 'filename-prefix-blacklist' )->inContentLanguage(); + if( !$message->isDisabled() ) { + $lines = explode( "\n", $message->plain() ); foreach( $lines as $line ) { // Remove comment lines $comment = substr( trim( $line ), 0, 1 ); -- 2.20.1