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

Revision: 72288
Author:   jeroendedauw
Date:     2010-09-03 15:03:31 +0000 (Fri, 03 Sep 2010)

Log Message:
-----------
Changes for 0.4 - small fix for default tag params 

Modified Paths:
--------------
    trunk/extensions/Validator/Validator.i18n.php
    trunk/extensions/Validator/includes/ParserHook.php
    trunk/extensions/Validator/includes/Validator.php

Modified: trunk/extensions/Validator/Validator.i18n.php
===================================================================
--- trunk/extensions/Validator/Validator.i18n.php       2010-09-03 14:51:33 UTC 
(rev 72287)
+++ trunk/extensions/Validator/Validator.i18n.php       2010-09-03 15:03:31 UTC 
(rev 72288)
@@ -42,7 +42,7 @@
        'validator_list_omitted' => 'The {{PLURAL:$2|value|values}} $1 
{{PLURAL:$2|has|have}} been omitted.',
 
        // Criteria errors for single values & lists
-       'validator_error_accepts_only' => 'Parameter $1 only accepts 
{{PLURAL:$3|this value|these values}}: $2.',
+       'validator_error_accepts_only' => 'The value "$4" is not valid for 
parameter $1. It only accepts {{PLURAL:$3|this value|these values}}: $2.',
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/Validator/includes/ParserHook.php
===================================================================
--- trunk/extensions/Validator/includes/ParserHook.php  2010-09-03 14:51:33 UTC 
(rev 72287)
+++ trunk/extensions/Validator/includes/ParserHook.php  2010-09-03 15:03:31 UTC 
(rev 72288)
@@ -13,8 +13,18 @@
  */
 abstract class ParserHook {
        
+       /**
+        * @since 0.4
+        * 
+        * @var Validator
+        */     
        protected $validator;
        
+       /**
+        * @since 0.4
+        * 
+        * @var Parser
+        */
        protected $parser;
        
        /**
@@ -94,9 +104,9 @@
                $this->parser = $parser;
                
                $defaultParam = array_shift( $this->getDefaultParameters() );
-               
+
                // If there is a first default parameter, set the tag contents 
as it's value.
-               if ( !is_null( $defaultParam ) ) {
+               if ( !is_null( $defaultParam ) && !is_null( $input ) ) {
                        $args[$defaultParam] = $input;
                }
                

Modified: trunk/extensions/Validator/includes/Validator.php
===================================================================
--- trunk/extensions/Validator/includes/Validator.php   2010-09-03 14:51:33 UTC 
(rev 72287)
+++ trunk/extensions/Validator/includes/Validator.php   2010-09-03 15:03:31 UTC 
(rev 72288)
@@ -866,7 +866,7 @@
                                        break;
                                case 'in_array' :
                                        $itemsText = $wgLang->listToText( $args 
);
-                                       $message = wfMsgExt( 
'validator_error_accepts_only', array( 'parsemag' ), $paramName, $itemsText, 
count( $args ) );
+                                       $message = wfMsgExt( 
'validator_error_accepts_only', array( 'parsemag' ), $paramName, $itemsText, 
count( $args ), $paramValue );
                                        break;
                                case 'invalid' : default :
                                        $message = wfMsgExt( 
'validator_list_error_invalid_argument', array( 'parsemag' ), $paramName );
@@ -903,7 +903,7 @@
                                        break;
                                case 'in_array' :
                                        $itemsText = $wgLang->listToText( $args 
);
-                                       $message = wfMsgExt( 
'validator_error_accepts_only', array( 'parsemag' ), $paramName, $itemsText, 
count( $args ) );
+                                       $message = wfMsgExt( 
'validator_error_accepts_only', array( 'parsemag' ), $paramName, $itemsText, 
count( $args ), $paramValue );
                                        break;
                                case 'invalid' : default :
                                        $message = wfMsgExt( 
'validator_error_invalid_argument', array( 'parsemag' ), '<b>' . 
htmlspecialchars( $paramValue ) . '</b>', $paramName );



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

Reply via email to