r29877 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r29876 | r29877 (on ViewVC) | r29878 >
Date:01:06, 17 January 2008
Author:tstarling
Status:ok
Tags:
Comment:#ifexist: If the "else" parameter is missing, use the "test" parameter instead. This allows error-free text to be passed through with abbreviated syntax. Splarka's suggestion.
Modified paths:

Diff [purge]

Index: trunk/extensions/ParserFunctions/ParserFunctions.php
===================================================================
--- trunk/extensions/ParserFunctions/ParserFunctions.php	(revision 29876)
+++ trunk/extensions/ParserFunctions/ParserFunctions.php	(revision 29877)
@@ -108,9 +108,11 @@
 		}
 	}
 
-	function iferror( &$parser, $test = '', $then = '', $else = '' ) {
+	function iferror( &$parser, $test = '', $then = '', $else = false ) {
 		if ( preg_match( '/<(strong|span) class="error"/', $test ) ) {
 			return $then;
+		} elseif ( $else === false ) {
+			return $test;
 		} else {
 			return $else;
 		}
Views
Toolbox