From 92dfa87364564e951fc89ee43cf8d9cc312a00f3 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 24 May 2011 17:28:21 +0000 Subject: [PATCH] Simplify message existence checks by using wfMessage() instead of wfEmptyMsg() --- includes/HTMLForm.php | 19 ++++++++----------- includes/User.php | 6 ++---- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 44669df8b5..ea6fe0569b 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -973,23 +973,20 @@ abstract class HTMLFormField { $helptext = null; if ( isset( $this->mParams['help-message'] ) ) { - $msg = $this->mParams['help-message']; - $helptext = wfMsgExt( $msg, 'parseinline' ); - if ( wfEmptyMsg( $msg ) ) { - # Never mind - $helptext = null; + $msg = wfMessage( $this->mParams['help-message'] ); + if ( $msg->exists() ) { + $helptext = $msg->parse(); } } elseif ( isset( $this->mParams['help-messages'] ) ) { # help-message can be passed a message key (string) or an array containing # a message key and additional parameters. This makes it impossible to pass # an array of message key - foreach( $this->mParams['help-messages'] as $msg ) { - $candidate = wfMsgExt( $msg, 'parseinline' ); - if( wfEmptyMsg( $msg ) ) { - $candidate = null; + foreach( $this->mParams['help-messages'] as $name ) { + $msg = wfMessage( $name ); + if( $msg->exists() ) { + $helptext .= $msg->parse(); // append message } - $helptext .= $candidate; // append message - } + } } elseif ( isset( $this->mParams['help'] ) ) { $helptext = $this->mParams['help']; } diff --git a/includes/User.php b/includes/User.php index 186072c306..20946f5696 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3610,10 +3610,8 @@ class User { */ static function getRightDescription( $right ) { $key = "right-$right"; - $name = wfMsg( $key ); - return $name == '' || wfEmptyMsg( $key ) - ? $right - : $name; + $msg = wfMessage( $key ); + return $msg->isBlank() ? $right : $msg->text(); } /** -- 2.20.1