From 2997fd763766a739b09fc31730e4f4a4711a6c4e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 11 Sep 2006 12:22:35 +0000 Subject: [PATCH] * (bug 7064) Replace hard-coded empty message checks with wfEmptyMsg calls --- RELEASE-NOTES | 1 + includes/GlobalFunctions.php | 6 +++--- includes/RawPage.php | 2 +- includes/SkinTemplate.php | 4 ++-- includes/SpecialAllmessages.php | 2 +- includes/SpecialUserlogin.php | 2 +- includes/User.php | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5699aca4dc..4007b7d8cd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -192,6 +192,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7252) Use dvipng support in texvc math rastrization. dvipng is required if texvc is rebuilt. * (bug 7279) Use wfBaseName in place of basename() in more places * Clear newtalk marker on diff links with explicit current revision number +* (bug 7064) Replace hard-coded empty message checks with wfEmptyMsg calls == Languages updated == diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0de411a697..fcbe817ec3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -430,12 +430,12 @@ function wfMsgReal( $key, $args, $useDB = true, $forContent=false, $transform = function wfMsgWeirdKey ( $key ) { $subsource = str_replace ( ' ' , '_' , $key ) ; $source = wfMsgForContentNoTrans( $subsource ) ; - if ( $source == "<{$subsource}>" ) { + if ( wfEmptyMsg( $subsource, $source) ) { # Try again with first char lower case $subsource = strtolower ( substr ( $subsource , 0 , 1 ) ) . substr ( $subsource , 1 ) ; $source = wfMsgForContentNoTrans( $subsource ) ; } - if ( $source == "<{$subsource}>" ) { + if ( wfEmptyMsg( $subsource, $source ) ) { # Didn't work either, return blank text $source = "" ; } @@ -1423,7 +1423,7 @@ function wfGetCachedNotice( $name ) { $needParse = false; $notice = wfMsgForContent( $name ); - if( $notice == '<'. $name . ';>' || $notice == '-' ) { + if( wfEmptyMsg( $name, $notice ) || $notice == '-' ) { wfProfileOut( $fname ); return( false ); } diff --git a/includes/RawPage.php b/includes/RawPage.php index f5e74e70e5..480c0328ad 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -157,7 +157,7 @@ class RawPage { $key = $this->mTitle->getDBkey(); $text = wfMsgForContentNoTrans( $key ); # If the message doesn't exist, return a blank - if( $text == '<' . $key . '>' ) + if( wfEmptyMsg( $key, $text ) ) $text = ''; $found = true; } else { diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index eddcc02dce..5a02b77642 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -571,7 +571,7 @@ class SkinTemplate extends Skin { } $text = wfMsg( $message ); - if ( $text == "<$message>" ) { + if ( wfEmptyMsg( $message, $text ) ) { global $wgContLang; $text = $wgContLang->getFormattedNsText( Namespace::getSubject( $title->getNamespace() ) ); } @@ -1014,7 +1014,7 @@ class SkinTemplate extends Skin { // by checking for default message content $msgKey = ucfirst($this->skinname).'.js'; $userJS = wfMsgForContent($msgKey); - if ('<'.$msgKey.'>' != $userJS) { + if ( !wfEmptyMsg( $msgKey, $userJS ) ) { $s .= $userJS; } diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index 994adc6c84..f5e16cfd0f 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -80,7 +80,7 @@ function makePhp($messages) { // $comment = ''; //} continue; - } elseif ($m['msg'] == '<'.$key.'>'){ + } elseif ( wfEmptyMsg( $key, $m['msg'] ) ) { $m['msg'] = ''; $comment = ' #empty'; } else { diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 53fc94c494..65b66e36ea 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -686,7 +686,7 @@ class LoginForm { */ function makeLanguageSelector() { $msg = wfMsgForContent( 'loginlanguagelinks' ); - if( $msg != '' && $msg != '<loginlanguagelinks>' ) { + if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) { $langs = explode( "\n", $msg ); $links = array(); foreach( $langs as $lang ) { diff --git a/includes/User.php b/includes/User.php index 05380d4ccf..5757ff6c90 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2021,7 +2021,7 @@ class User { static function getGroupName( $group ) { $key = "group-$group"; $name = wfMsg( $key ); - if( $name == '' || $name == "<$key>" ) { + if( $name == '' || wfEmptyMsg( $key, $name ) ) { return $group; } else { return $name; @@ -2036,7 +2036,7 @@ class User { static function getGroupMember( $group ) { $key = "group-$group-member"; $name = wfMsg( $key ); - if( $name == '' || $name == "<$key>" ) { + if( $name == '' || wfEmptyMsg( $key, $name ) ) { return $group; } else { return $name; -- 2.20.1