http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88727

Revision: 88727
Author:   ialex
Date:     2011-05-24 17:28:21 +0000 (Tue, 24 May 2011)
Log Message:
-----------
Simplify message existence checks by using wfMessage() instead of wfEmptyMsg()

Modified Paths:
--------------
    trunk/phase3/includes/HTMLForm.php
    trunk/phase3/includes/User.php

Modified: trunk/phase3/includes/HTMLForm.php
===================================================================
--- trunk/phase3/includes/HTMLForm.php  2011-05-24 17:02:26 UTC (rev 88726)
+++ trunk/phase3/includes/HTMLForm.php  2011-05-24 17:28:21 UTC (rev 88727)
@@ -973,23 +973,20 @@
                $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'];
                }

Modified: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php      2011-05-24 17:02:26 UTC (rev 88726)
+++ trunk/phase3/includes/User.php      2011-05-24 17:28:21 UTC (rev 88727)
@@ -3610,10 +3610,8 @@
         */
        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();
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to