From: Alexandre Emsenhuber Date: Tue, 24 May 2011 17:28:21 +0000 (+0000) Subject: Simplify message existence checks by using wfMessage() instead of wfEmptyMsg() X-Git-Tag: 1.31.0-rc.0~29974 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=92dfa87364564e951fc89ee43cf8d9cc312a00f3;p=lhc%2Fweb%2Fwiklou.git Simplify message existence checks by using wfMessage() instead of wfEmptyMsg() --- 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(); } /**