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

Revision: 74170
Author:   siebrand
Date:     2010-10-02 22:36:34 +0000 (Sat, 02 Oct 2010)

Log Message:
-----------
* remove MediaWiki pre-1.8 compatibility and remove SprintfDateCompat.php
* bump version to 1.4.0
* run stylize.php

Modified Paths:
--------------
    trunk/extensions/ParserFunctions/COPYING
    trunk/extensions/ParserFunctions/Expr.php
    trunk/extensions/ParserFunctions/ParserFunctions.php
    trunk/extensions/ParserFunctions/ParserFunctions_body.php
    trunk/extensions/ParserFunctions/README
    trunk/extensions/ParserFunctions/testExpr.php

Removed Paths:
-------------
    trunk/extensions/ParserFunctions/SprintfDateCompat.php

Modified: trunk/extensions/ParserFunctions/COPYING
===================================================================
--- trunk/extensions/ParserFunctions/COPYING    2010-10-02 22:26:50 UTC (rev 
74169)
+++ trunk/extensions/ParserFunctions/COPYING    2010-10-02 22:36:34 UTC (rev 
74170)
@@ -1,4 +1,4 @@
-The ParserFunctions extension may be copied and redistributed under the GNU 
+The ParserFunctions extension may be copied and redistributed under the GNU
 General Public License.
 
 -------------------------------------------------------------------------------
@@ -281,4 +281,3 @@
 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
-

Modified: trunk/extensions/ParserFunctions/Expr.php
===================================================================
--- trunk/extensions/ParserFunctions/Expr.php   2010-10-02 22:26:50 UTC (rev 
74169)
+++ trunk/extensions/ParserFunctions/Expr.php   2010-10-02 22:36:34 UTC (rev 
74170)
@@ -47,7 +47,7 @@
 define( 'EXPR_PI', 36 );
 
 class ExprError extends Exception {
-       public function __construct($msg, $parameter = ''){
+       public function __construct( $msg, $parameter = '' ) {
                wfLoadExtensionMessages( 'ParserFunctions' );
                $this->message = '<strong class="error">' . wfMsgForContent( 
"pfunc_expr_$msg", htmlspecialchars( $parameter ) ) . '</strong>';
        }
@@ -173,7 +173,7 @@
 
                while ( $p < $end ) {
                        if ( count( $operands ) > $this->maxStackSize || count( 
$operators ) > $this->maxStackSize ) {
-                               throw new ExprError('stack_exhausted');
+                               throw new ExprError( 'stack_exhausted' );
                        }
                        $char = $expr[$p];
                        $char2 = substr( $expr, $p, 2 );
@@ -191,7 +191,7 @@
                        } elseif ( false !== strpos( EXPR_NUMBER_CLASS, $char ) 
) {
                                // Number
                                if ( $expecting != 'expression' ) {
-                                       throw new 
ExprError('unexpected_number');
+                                       throw new ExprError( 
'unexpected_number' );
                                }
 
                                // Find the rest of it
@@ -207,14 +207,14 @@
                                $remaining = substr( $expr, $p );
                                if ( !preg_match( '/^[A-Za-z]*/', $remaining, 
$matches ) ) {
                                        // This should be unreachable
-                                       throw new 
ExprError('preg_match_failure');
+                                       throw new ExprError( 
'preg_match_failure' );
                                }
                                $word = strtolower( $matches[0] );
                                $p += strlen( $word );
 
                                // Interpret the word
-                               if ( !isset( $this->words[$word] ) ){
-                                       throw new 
ExprError('unrecognised_word', $word);
+                               if ( !isset( $this->words[$word] ) ) {
+                                       throw new ExprError( 
'unrecognised_word', $word );
                                }
                                $op = $this->words[$word];
                                switch( $op ) {
@@ -223,7 +223,7 @@
                                        if ( $expecting != 'expression' ) {
                                                continue;
                                        }
-                                       $operands[] = exp(1);
+                                       $operands[] = exp( 1 );
                                        $expecting = 'operator';
                                        continue 2;
                                case EXPR_PI:
@@ -274,7 +274,7 @@
                        }
 
                        // Finally the single-character operators
-                       
+
                        elseif ( $char == '+' ) {
                                ++$p;
                                if ( $expecting == 'expression' ) {
@@ -309,7 +309,7 @@
                                ++$p;
                        } elseif ( $char == '(' )  {
                                if ( $expecting == 'operator' ) {
-                                       throw new 
ExprError('unexpected_operator', '(');
+                                       throw new ExprError( 
'unexpected_operator', '(' );
                                }
                                $operators[] = EXPR_OPEN;
                                ++$p;
@@ -324,7 +324,7 @@
                                if ( $lastOp ) {
                                        array_pop( $operators );
                                } else {
-                                       throw new 
ExprError('unexpected_closing_bracket');
+                                       throw new ExprError( 
'unexpected_closing_bracket' );
                                }
                                $expecting = 'operator';
                                ++$p;
@@ -342,12 +342,12 @@
                                $op = EXPR_GREATER;
                                ++$p;
                        } else {
-                               throw new ExprError('unrecognised_punctuation', 
UtfNormal::cleanUp( $char ));
+                               throw new ExprError( 
'unrecognised_punctuation', UtfNormal::cleanUp( $char ) );
                        }
 
                        // Binary operator processing
                        if ( $expecting == 'expression' ) {
-                               throw new ExprError('unexpected_operator', 
$name);
+                               throw new ExprError( 'unexpected_operator', 
$name );
                        }
 
                        // Shunting yard magic
@@ -364,7 +364,7 @@
                // Finish off the operator array
                while ( $op = array_pop( $operators ) ) {
                        if ( $op == EXPR_OPEN ) {
-                               throw new ExprError('unclosed_bracket');
+                               throw new ExprError( 'unclosed_bracket' );
                        }
                        $this->doOperation( $op, $operands );
                }
@@ -375,182 +375,182 @@
        function doOperation( $op, &$stack ) {
                switch ( $op ) {
                        case EXPR_NEGATIVE:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
                                $stack[] = -$arg;
                                break;
                        case EXPR_POSITIVE:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                break;
                        case EXPR_TIMES:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = $left * $right;
                                        break;
                        case EXPR_DIVIDE:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
-                               if ( $right == 0 ) throw new 
ExprError('division_by_zero', $this->names[$op]);
+                               if ( $right == 0 ) throw new ExprError( 
'division_by_zero', $this->names[$op] );
                                $stack[] = $left / $right;
                                break;
                        case EXPR_MOD:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
-                               if ( $right == 0 ) throw new 
ExprError('division_by_zero', $this->names[$op]);
+                               if ( $right == 0 ) throw new ExprError( 
'division_by_zero', $this->names[$op] );
                                $stack[] = $left % $right;
                                break;
                        case EXPR_PLUS:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = $left + $right;
                                break;
                        case EXPR_MINUS:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = $left - $right;
                                break;
                        case EXPR_AND:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left && $right ) ? 1 : 0;
                                break;
                        case EXPR_OR:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left || $right ) ? 1 : 0;
                                break;
                        case EXPR_EQUALITY:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left == $right ) ? 1 : 0;
                                break;
                        case EXPR_NOT:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = (!$arg) ? 1 : 0;
+                               $stack[] = ( !$arg ) ? 1 : 0;
                                break;
                        case EXPR_ROUND:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $digits = intval( array_pop( $stack ) );
                                $value = array_pop( $stack );
                                $stack[] = round( $value, $digits );
                                break;
                        case EXPR_LESS:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left < $right ) ? 1 : 0;
                                break;
                        case EXPR_GREATER:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left > $right ) ? 1 : 0;
                                break;
                        case EXPR_LESSEQ:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left <= $right ) ? 1 : 0;
                                break;
                        case EXPR_GREATEREQ:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left >= $right ) ? 1 : 0;
                                break;
                        case EXPR_NOTEQ:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
                                $stack[] = ( $left != $right ) ? 1 : 0;
                                break;
                        case EXPR_EXPONENT:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
-                               $stack[] = $left * pow(10,$right);
+                               $stack[] = $left * pow( 10, $right );
                                break;
                        case EXPR_SINE:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = sin($arg);
+                               $stack[] = sin( $arg );
                                break;
                        case EXPR_COSINE:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = cos($arg);
+                               $stack[] = cos( $arg );
                                break;
                        case EXPR_TANGENS:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = tan($arg);
+                               $stack[] = tan( $arg );
                                break;
                        case EXPR_ARCSINE:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               if ( $arg < -1 || $arg > 1 ) throw new 
ExprError('invalid_argument', $this->names[$op] );
-                               $stack[] = asin($arg);
+                               if ( $arg < -1 || $arg > 1 ) throw new 
ExprError( 'invalid_argument', $this->names[$op] );
+                               $stack[] = asin( $arg );
                                break;
                        case EXPR_ARCCOS:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               if ( $arg < -1 || $arg > 1 ) throw new 
ExprError('invalid_argument', $this->names[$op] );
-                               $stack[] = acos($arg);
+                               if ( $arg < -1 || $arg > 1 ) throw new 
ExprError( 'invalid_argument', $this->names[$op] );
+                               $stack[] = acos( $arg );
                                break;
                        case EXPR_ARCTAN:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = atan($arg);
+                               $stack[] = atan( $arg );
                                break;
                        case EXPR_EXP:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = exp($arg);
+                               $stack[] = exp( $arg );
                                break;
                        case EXPR_LN:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               if ( $arg <= 0 ) throw new 
ExprError('invalid_argument_ln', $this->names[$op]);
-                               $stack[] = log($arg);
+                               if ( $arg <= 0 ) throw new ExprError( 
'invalid_argument_ln', $this->names[$op] );
+                               $stack[] = log( $arg );
                                break;
                        case EXPR_ABS:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = abs($arg);
+                               $stack[] = abs( $arg );
                                break;
                        case EXPR_FLOOR:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = floor($arg);
+                               $stack[] = floor( $arg );
                                break;
                        case EXPR_TRUNC:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
                                $stack[] = (int)$arg;
                                break;
                        case EXPR_CEIL:
-                               if ( count( $stack ) < 1 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 1 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $arg = array_pop( $stack );
-                               $stack[] = ceil($arg);
+                               $stack[] = ceil( $arg );
                                break;
                        case EXPR_POW:
-                               if ( count( $stack ) < 2 ) throw new 
ExprError('missing_operand', $this->names[$op]);
+                               if ( count( $stack ) < 2 ) throw new ExprError( 
'missing_operand', $this->names[$op] );
                                $right = array_pop( $stack );
                                $left = array_pop( $stack );
-                               if ( false === ($stack[] = pow($left, $right)) 
) throw new ExprError('division_by_zero', $this->names[$op]);
+                               if ( false === ( $stack[] = pow( $left, $right 
) ) ) throw new ExprError( 'division_by_zero', $this->names[$op] );
                                break;
                        default:
                                // Should be impossible to reach here.
-                               throw new ExprError('unknown_error');
+                               throw new ExprError( 'unknown_error' );
                }
        }
 }

Modified: trunk/extensions/ParserFunctions/ParserFunctions.php
===================================================================
--- trunk/extensions/ParserFunctions/ParserFunctions.php        2010-10-02 
22:26:50 UTC (rev 74169)
+++ trunk/extensions/ParserFunctions/ParserFunctions.php        2010-10-02 
22:36:34 UTC (rev 74170)
@@ -4,9 +4,8 @@
        die( 'This file is a MediaWiki extension, it is not a valid entry 
point' );
 }
 
-
 /**
- * CONFIGURATION 
+ * CONFIGURATION
  * These variables may be overridden in LocalSettings.php after you include the
  * extension file.
  */
@@ -20,12 +19,12 @@
 /**
  * Enable string functions.
  *
- * Set this to true if you want your users to be able to implement their own 
- * parsers in the ugliest, most inefficient programming language known to man: 
+ * Set this to true if you want your users to be able to implement their own
+ * parsers in the ugliest, most inefficient programming language known to man:
  * MediaWiki wikitext with ParserFunctions.
  *
  * WARNING: enabling this may have an adverse impact on the sanity of your 
users.
- * An alternative, saner solution for embedding complex text processing in 
+ * An alternative, saner solution for embedding complex text processing in
  * MediaWiki templates can be found at: 
http://www.mediawiki.org/wiki/Extension:Lua
  */
 $wgPFEnableStringFunctions = false;
@@ -35,15 +34,15 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
        'name' => 'ParserFunctions',
-       'version' => '1.3.0',
+       'version' => '1.4.0',
        'url' => 'http://www.mediawiki.org/wiki/Extension:ParserFunctions',
-       'author' => array('Tim Starling', 'Robert Rohde', 'Ross McClure', 
'Juraj Simlovic'),
+       'author' => array( 'Tim Starling', 'Robert Rohde', 'Ross McClure', 
'Juraj Simlovic' ),
        'descriptionmsg' => 'pfunc_desc',
 );
 
-$wgAutoloadClasses['ExtParserFunctions'] = 
dirname(__FILE__).'/ParserFunctions_body.php';
-$wgExtensionMessagesFiles['ParserFunctions'] = dirname(__FILE__) . 
'/ParserFunctions.i18n.php';
-$wgExtensionMessagesFiles['ParserFunctionsMagic'] = dirname(__FILE__) . 
'/ParserFunctions.i18n.magic.php';
+$wgAutoloadClasses['ExtParserFunctions'] = dirname( __FILE__ ) . 
'/ParserFunctions_body.php';
+$wgExtensionMessagesFiles['ParserFunctions'] = dirname( __FILE__ ) . 
'/ParserFunctions.i18n.php';
+$wgExtensionMessagesFiles['ParserFunctionsMagic'] = dirname( __FILE__ ) . 
'/ParserFunctions.i18n.magic.php';
 
 $wgParserTestFiles[] = dirname( __FILE__ ) . "/funcsParserTests.txt";
 $wgParserTestFiles[] = dirname( __FILE__ ) . "/stringFunctionTests.txt";
@@ -91,7 +90,7 @@
                $parser->setFunctionHook( 'rel2abs', array( &$this, 'rel2abs' ) 
);
                $parser->setFunctionHook( 'titleparts', array( &$this, 
'titleparts' ) );
 
-               //String Functions
+               // String Functions
                if ( $wgPFEnableStringFunctions ) {
                        $parser->setFunctionHook( 'len',       array( &$this, 
'runLen'       ) );
                        $parser->setFunctionHook( 'pos',       array( &$this, 
'runPos'       ) );

Modified: trunk/extensions/ParserFunctions/ParserFunctions_body.php
===================================================================
--- trunk/extensions/ParserFunctions/ParserFunctions_body.php   2010-10-02 
22:26:50 UTC (rev 74169)
+++ trunk/extensions/ParserFunctions/ParserFunctions_body.php   2010-10-02 
22:36:34 UTC (rev 74170)
@@ -6,7 +6,7 @@
        var $mTimeChars = 0;
        var $mMaxTimeChars = 6000; # ~10 seconds
 
-       function clearState( $parser) {
+       function clearState( $parser ) {
                $this->mTimeChars = 0;
                $parser->pf_ifexist_breakdown = array();
                $parser->pf_markerRegex = null;
@@ -27,17 +27,17 @@
 
                // The first line represents Parser from release 1.12 forward.
                // subsequent lines are hacks to accomodate old Mediawiki 
versions.
-               if ( defined('Parser::MARKER_SUFFIX') )
+               if ( defined( 'Parser::MARKER_SUFFIX' ) )
                        $suffix = preg_quote( Parser::MARKER_SUFFIX, '/' );
-               elseif ( isset($parser->mMarkerSuffix) )
+               elseif ( isset( $parser->mMarkerSuffix ) )
                        $suffix = preg_quote( $parser->mMarkerSuffix, '/' );
-               elseif ( defined('MW_PARSER_VERSION') && 
+               elseif ( defined( 'MW_PARSER_VERSION' ) &&
                                strcmp( MW_PARSER_VERSION, '1.6.1' ) > 0 )
                        $suffix = "QINU\x07";
                else $suffix = 'QINU';
-               
-               $parser->pf_markerRegex = '/' .$prefix. '(?:(?!' .$suffix. 
').)*' . $suffix . '/us';
 
+               $parser->pf_markerRegex = '/' . $prefix . '(?:(?!' . $suffix . 
').)*' . $suffix . '/us';
+
                wfProfileOut( __METHOD__ );
                return $parser->pf_markerRegex;
        }
@@ -60,23 +60,23 @@
        function expr( $parser, $expr = '' ) {
                try {
                        return $this->getExprParser()->doExpression( $expr );
-               } catch(ExprError $e) {
+               } catch ( ExprError $e ) {
                        return $e->getMessage();
                }
        }
 
        function ifexpr( $parser, $expr = '', $then = '', $else = '' ) {
-               try{
+               try {
                        $ret = $this->getExprParser()->doExpression( $expr );
                        if ( is_numeric( $ret ) ) {
                                $ret = floatval( $ret );
                        }
-                       if( $ret ) {
+                       if ( $ret ) {
                                return $then;
                        } else {
                                return $else;
                        }
-               } catch (ExprError $e){
+               } catch ( ExprError $e ) {
                        return $e->getMessage();
                }
        }
@@ -152,12 +152,12 @@
        function switchHook( $parser /*,...*/ ) {
                $args = func_get_args();
                array_shift( $args );
-               $primary = trim(array_shift($args));
+               $primary = trim( array_shift( $args ) );
                $found = $defaultFound = false;
                $parts = null;
                $default = null;
                $mwDefault =& MagicWord::get( 'default' );
-               foreach( $args as $arg ) {
+               foreach ( $args as $arg ) {
                        $parts = array_map( 'trim', explode( '=', $arg, 2 ) );
                        if ( count( $parts ) == 2 ) {
                                # Found "="
@@ -179,7 +179,7 @@
                }
                # Default case
                # Check if the last item had no = sign, thus specifying the 
default case
-               if ( count( $parts ) == 1) {
+               if ( count( $parts ) == 1 ) {
                        return $parts[0];
                } elseif ( !is_null( $default ) ) {
                        return $default;
@@ -250,22 +250,22 @@
         */
        public function rel2abs( $parser , $to = '' , $from = '' ) {
 
-               $from = trim($from);
-               if( $from == '' ) {
+               $from = trim( $from );
+               if ( $from == '' ) {
                        $from = $parser->getTitle()->getPrefixedText();
                }
 
                $to = rtrim( $to , ' /' );
 
                // if we have an empty path, or just one containing a dot
-               if( $to == '' || $to == '.' ) {
+               if ( $to == '' || $to == '.' ) {
                        return $from;
                }
 
                // if the path isn't relative
-               if ( substr( $to , 0 , 1) != '/' &&
-                substr( $to , 0 , 2) != './' &&
-                substr( $to , 0 , 3) != '../' &&
+               if ( substr( $to , 0 , 1 ) != '/' &&
+                substr( $to , 0 , 2 ) != './' &&
+                substr( $to , 0 , 3 ) != '../' &&
                 $to != '..' )
                {
                        $from = '';
@@ -285,8 +285,8 @@
                $newExploded = array();
 
                foreach ( $exploded as $current ) {
-                       if( $current == '..' ) { // removing one level
-                               if( !count( $newExploded ) ){
+                       if ( $current == '..' ) { // removing one level
+                               if ( !count( $newExploded ) ) {
                                        // attempted to access a node above 
root node
                                        wfLoadExtensionMessages( 
'ParserFunctions' );
                                        return '<strong class="error">' . 
wfMsgForContent( 'pfunc_rel2abs_invalid_depth', $fullPath ) . '</strong>';
@@ -326,26 +326,26 @@
                $title = Title::newFromText( $titletext );
                $wgContLang->findVariantLink( $titletext, $title, true );
                if ( $title ) {
-                       if( $title->getNamespace() == NS_MEDIA ) {
+                       if ( $title->getNamespace() == NS_MEDIA ) {
                                /* If namespace is specified as NS_MEDIA, then 
we want to
                                 * check the physical file, not the 
"description" page.
                                 */
                                if ( !$this->incrementIfexistCount( $parser, 
$frame ) ) {
                                        return $else;
                                }
-                               $file = wfFindFile($title);
+                               $file = wfFindFile( $title );
                                if ( !$file ) {
                                        return $else;
                                }
-                               $parser->mOutput->addImage($file->getName());
+                               $parser->mOutput->addImage( $file->getName() );
                                return $file->exists() ? $then : $else;
-                       } elseif( $title->getNamespace() == NS_SPECIAL ) {
+                       } elseif ( $title->getNamespace() == NS_SPECIAL ) {
                                /* Don't bother with the count for special 
pages,
                                 * since their existence can be checked without
                                 * accessing the database.
                                 */
                                return SpecialPage::exists( $title->getDBkey() 
) ? $then : $else;
-                       } elseif( $title->isExternal() ) {
+                       } elseif ( $title->isExternal() ) {
                                /* Can't check the existence of pages on other 
sites,
                                 * so just return $else.  Makes a sort of 
sense, since
                                 * they don't exist _locally_.
@@ -392,16 +392,16 @@
                if ( isset( $this->mTimeCache[$format][$date][$local] ) ) {
                        return $this->mTimeCache[$format][$date][$local];
                }
-               
-               #compute the timestamp string $ts
-               #PHP >= 5.2 can handle dates before 1970 or after 2038 using 
the DateTime object
-               #PHP < 5.2 is limited to dates between 1970 and 2038
-               
+
+               # compute the timestamp string $ts
+               # PHP >= 5.2 can handle dates before 1970 or after 2038 using 
the DateTime object
+               # PHP < 5.2 is limited to dates between 1970 and 2038
+
                $invalidTime = false;
-               
-               if ( class_exists( 'DateTime' ) ) { #PHP >= 5.2
-                       # the DateTime constructor must be used because it 
throws exceptions 
-                       # when errors occur, whereas date_create appears to 
just output a warning 
+
+               if ( class_exists( 'DateTime' ) ) { # PHP >= 5.2
+                       # the DateTime constructor must be used because it 
throws exceptions
+                       # when errors occur, whereas date_create appears to 
just output a warning
                        # that can't really be detected from within the code
                        try {
                                # Determine timezone
@@ -427,16 +427,16 @@
 
                                # Generate timestamp
                                $ts = $dateObject->format( 'YmdHis' );
-                       } catch (Exception $ex) {
+                       } catch ( Exception $ex ) {
                                $invalidTime = true;
                        }
-               } else { #PHP < 5.2
+               } else { # PHP < 5.2
                        if ( $date !== '' ) {
                                $unix = @strtotime( $date );
                        } else {
                                $unix = time();
                        }
-                       
+
                        if ( $unix == -1 || $unix == false ) {
                                $invalidTime = true;
                        } else {
@@ -444,21 +444,21 @@
                                        # Use the time zone
                                        if ( isset( $wgLocaltimezone ) ) {
                                                $oldtz = getenv( 'TZ' );
-                                               putenv( 'TZ='.$wgLocaltimezone 
);
+                                               putenv( 'TZ=' . 
$wgLocaltimezone );
                                        }
                                        wfSuppressWarnings(); // E_STRICT 
system time bitching
                                        $ts = date( 'YmdHis', $unix );
                                        wfRestoreWarnings();
                                        if ( isset( $wgLocaltimezone ) ) {
-                                               putenv( 'TZ='.$oldtz );
+                                               putenv( 'TZ=' . $oldtz );
                                        }
                                } else {
                                        $ts = wfTimestamp( TS_MW, $unix );
                                }
                        }
                }
-               
-               #format the timestamp and return the result
+
+               # format the timestamp and return the result
                if ( $invalidTime ) {
                        wfLoadExtensionMessages( 'ParserFunctions' );
                        $result = '<strong class="error">' . wfMsgForContent( 
'pfunc_time_error' ) . '</strong>';
@@ -468,16 +468,7 @@
                                wfLoadExtensionMessages( 'ParserFunctions' );
                                return '<strong class="error">' . 
wfMsgForContent( 'pfunc_time_too_long' ) . '</strong>';
                        } else {
-                               
-                               if ( method_exists( $wgContLang, 'sprintfDate' 
) ) {
-                                       $result = $wgContLang->sprintfDate( 
$format, $ts );
-                               } else {
-                                       if ( !class_exists( 'SprintfDateCompat' 
) ) {
-                                               require( dirname( __FILE__ ) . 
'/SprintfDateCompat.php' );
-                                       }
-
-                                       $result = 
SprintfDateCompat::sprintfDate( $format, $ts );
-                               }
+                               $result = $wgContLang->sprintfDate( $format, 
$ts );
                        }
                }
                $this->mTimeCache[$format][$date][$local] = $result;
@@ -498,7 +489,7 @@
         * @param int $offset Offset starting at 1
         * @return string
         */
-       public function titleparts( $parser, $title = '', $parts = 0, $offset = 
0) {
+       public function titleparts( $parser, $title = '', $parts = 0, $offset = 
0 ) {
                $parts = intval( $parts );
                $offset = intval( $offset );
                $ntitle = Title::newFromText( $title );
@@ -531,17 +522,17 @@
        private function tooLongError() {
                global $wgPFStringLengthLimit, $wgContLang;
                wfLoadExtensionMessages( 'ParserFunctions' );
-               
-               return '<strong class="error">' . 
+
+               return '<strong class="error">' .
                        wfMsgExt( 'pfunc_string_too_long',
-                               array( 'escape', 'parsemag', 'content' ), 
+                               array( 'escape', 'parsemag', 'content' ),
                                $wgContLang->formatNum( $wgPFStringLengthLimit 
) ) .
                        '</strong>';
        }
 
        /**
         * {{#len:string}}
-        * 
+        *
         * Reports number of characters in string.
         */
        function runLen ( $parser, $inStr = '' ) {
@@ -567,17 +558,17 @@
 
                $inStr = $this->killMarkers( $parser, (string)$inStr );
                $inNeedle = $this->killMarkers( $parser, (string)$inNeedle );
-               
-               if( !$this->checkLength( $inStr ) || 
+
+               if ( !$this->checkLength( $inStr ) ||
                    !$this->checkLength( $inNeedle ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
 
-               if( $inNeedle == '' ) { $inNeedle = ' '; }
+               if ( $inNeedle == '' ) { $inNeedle = ' '; }
 
                $pos = mb_strpos( $inStr, $inNeedle, $inOffset );
-               if( $pos === false ) { $pos = ""; }
+               if ( $pos === false ) { $pos = ""; }
 
                wfProfileOut( __METHOD__ );
                return $pos;
@@ -596,17 +587,17 @@
 
                $inStr = $this->killMarkers( $parser, (string)$inStr );
                $inNeedle = $this->killMarkers( $parser, (string)$inNeedle );
-               
-               if( !$this->checkLength( $inStr ) || 
+
+               if ( !$this->checkLength( $inStr ) ||
                    !$this->checkLength( $inNeedle ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
 
-               if( $inNeedle == '' ) { $inNeedle = ' '; }
+               if ( $inNeedle == '' ) { $inNeedle = ' '; }
 
                $pos = mb_strrpos( $inStr, $inNeedle );
-               if( $pos === false ) { $pos = -1; }
+               if ( $pos === false ) { $pos = -1; }
 
                wfProfileOut( __METHOD__ );
                return $pos;
@@ -616,10 +607,10 @@
         * {{#sub: string | start | length }}
         *
         * Returns substring of "string" starting at "start" and having
-        * "length" characters. 
+        * "length" characters.
         *
         * Note: If length is zero, the rest of the input is returned.
-        * Note: A negative value for "start" operates from the end of the 
+        * Note: A negative value for "start" operates from the end of the
         *   "string".
         * Note: A negative value for "length" returns a string reduced in
         *   length by that amount.
@@ -629,19 +620,19 @@
 
                $inStr = $this->killMarkers( $parser, (string)$inStr );
 
-               if( !$this->checkLength( $inStr ) ) {
+               if ( !$this->checkLength( $inStr ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
-               
-               if ( intval($inLength) == 0 ) {
+
+               if ( intval( $inLength ) == 0 ) {
                        $result = mb_substr( $inStr, $inStart );
                } else {
                        $result = mb_substr( $inStr, $inStart, $inLength );
                }
 
                wfProfileOut( __METHOD__ );
-               return $result; 
+               return $result;
        }
 
        /**
@@ -657,18 +648,18 @@
                $inStr = $this->killMarkers( $parser, (string)$inStr );
                $inSubStr = $this->killMarkers( $parser, (string)$inSubStr );
 
-               if( !$this->checkLength( $inStr ) ||
+               if ( !$this->checkLength( $inStr ) ||
                    !$this->checkLength( $inSubStr ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
 
-               if( $inSubStr == '' ) { $inSubStr = ' '; }
-                       
+               if ( $inSubStr == '' ) { $inSubStr = ' '; }
+
                $result = mb_substr_count( $inStr, $inSubStr );
 
                wfProfileOut( __METHOD__ );
-               return $result; 
+               return $result;
        }
 
        /**
@@ -676,11 +667,11 @@
         *
         * Replaces each occurrence of "from" in "string" with "to".
         * At most "limit" replacements are performed.
-        * 
+        *
         * Note: Armored against replacements that would generate huge strings.
         * Note: If "from" is an empty string, single space is used instead.
         */
-       function runReplace( $parser, $inStr = '', 
+       function runReplace( $parser, $inStr = '',
                        $inReplaceFrom = '', $inReplaceTo = '', $inLimit = -1 ) 
{
                global $wgPFStringLengthLimit;
                wfProfileIn( __METHOD__ );
@@ -689,36 +680,36 @@
                $inReplaceFrom = $this->killMarkers( $parser, 
(string)$inReplaceFrom );
                $inReplaceTo = $this->killMarkers( $parser, 
(string)$inReplaceTo );
 
-               if( !$this->checkLength( $inStr ) ||
+               if ( !$this->checkLength( $inStr ) ||
                    !$this->checkLength( $inReplaceFrom ) ||
-                   !$this->checkLength( $inReplaceTo ) ) { 
+                   !$this->checkLength( $inReplaceTo ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
 
-               if( $inReplaceFrom == '' ) { $inReplaceFrom = ' '; }
+               if ( $inReplaceFrom == '' ) { $inReplaceFrom = ' '; }
 
                // Precompute limit to avoid generating enormous string:
                $diff = mb_strlen( $inReplaceTo ) - mb_strlen( $inReplaceFrom );
-               if( $diff > 0 ) {
+               if ( $diff > 0 ) {
                        $limit = ( ( $wgPFStringLengthLimit - mb_strlen( $inStr 
) ) / $diff ) + 1;
                } else {
                        $limit = -1;
                }
 
-               $inLimit = intval($inLimit);
-               if( $inLimit >= 0 ) {
-                       if( $limit > $inLimit || $limit == -1 ) { $limit = 
$inLimit; }
+               $inLimit = intval( $inLimit );
+               if ( $inLimit >= 0 ) {
+                       if ( $limit > $inLimit || $limit == -1 ) { $limit = 
$inLimit; }
                }
 
                // Use regex to allow limit and handle UTF-8 correctly.
                $inReplaceFrom = preg_quote( $inReplaceFrom, '/' );
                $inReplaceTo = StringUtils::escapeRegexReplacement( 
$inReplaceTo );
 
-               $result = preg_replace( '/' . $inReplaceFrom . '/u', 
-                                               $inReplaceTo, $inStr, $limit);
+               $result = preg_replace( '/' . $inReplaceFrom . '/u',
+                                               $inReplaceTo, $inStr, $limit );
 
-               if( !$this->checkLength( $result ) ) {
+               if ( !$this->checkLength( $result ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
@@ -744,22 +735,22 @@
                $inStr = $this->killMarkers( $parser, (string)$inStr );
                $inDiv = $this->killMarkers( $parser, (string)$inDiv );
 
-               if( $inDiv == '' ) { $inDiv = ' '; }
+               if ( $inDiv == '' ) { $inDiv = ' '; }
 
-               if( !$this->checkLength( $inStr ) ||
-                   !$this->checkLength( $inDiv ) ) { 
+               if ( !$this->checkLength( $inStr ) ||
+                   !$this->checkLength( $inDiv ) ) {
                        wfProfileOut( __METHOD__ );
                        return $this->tooLongError();
                }
 
                $inDiv = preg_quote( $inDiv, '/' );
-               
-               $matches = preg_split( '/'.$inDiv.'/u', $inStr, $inLim );
-               
-               if( $inPos >= 0 && isset( $matches[$inPos] ) ) {
+
+               $matches = preg_split( '/' . $inDiv . '/u', $inStr, $inLim );
+
+               if ( $inPos >= 0 && isset( $matches[$inPos] ) ) {
                        $result = $matches[$inPos];
-               } elseif ( $inPos < 0 && isset( $matches[count($matches) + 
$inPos] ) ) {
-                       $result = $matches[count($matches) + $inPos];
+               } elseif ( $inPos < 0 && isset( $matches[count( $matches ) + 
$inPos] ) ) {
+                       $result = $matches[count( $matches ) + $inPos];
                } else {
                        $result = '';
                }

Modified: trunk/extensions/ParserFunctions/README
===================================================================
--- trunk/extensions/ParserFunctions/README     2010-10-02 22:26:50 UTC (rev 
74169)
+++ trunk/extensions/ParserFunctions/README     2010-10-02 22:36:34 UTC (rev 
74170)
@@ -1,4 +1,4 @@
-ParserFunctions v1.1.1
+ParserFunctions v1.4.0
 
 1. Licensing
 2. How to install
@@ -18,4 +18,4 @@
 ParserFunctions ships with two tests
 - Parser tests. These get added to the main parser tests, see there for docs
 - Expression tests. These are designed to test the math-related functions
-  See testExpr.php
\ No newline at end of file
+  See testExpr.php

Deleted: trunk/extensions/ParserFunctions/SprintfDateCompat.php
===================================================================
--- trunk/extensions/ParserFunctions/SprintfDateCompat.php      2010-10-02 
22:26:50 UTC (rev 74169)
+++ trunk/extensions/ParserFunctions/SprintfDateCompat.php      2010-10-02 
22:36:34 UTC (rev 74170)
@@ -1,221 +0,0 @@
-<?php
-
-# sprintfDate support for MW<1.8 installations
-class SprintfDateCompat {
-
-       static function sprintfDate( $format, $ts ) {
-               global $wgContLang;
-
-               $s = '';
-               $raw = false;
-               $roman = false;
-               $unix = false;
-               $rawToggle = false;
-               for ( $p = 0; $p < strlen( $format ); $p++ ) {
-                       $num = false;
-                       $code = $format[$p];
-                       if ( $code == 'x' && $p < strlen( $format ) - 1 ) {
-                               $code .= $format[++$p];
-                       }
-
-                       switch ( $code ) {
-                               case 'xx':
-                                       $s .= 'x';
-                                       break;
-                               case 'xn':
-                                       $raw = true;
-                                       break;
-                               case 'xN':
-                                       $rawToggle = !$rawToggle;
-                                       break;
-                               case 'xr':
-                                       $roman = true;
-                                       break;
-                               case 'xg':
-                                       $s .= $wgContLang->getMonthNameGen( 
substr( $ts, 4, 2 ) );
-                                       break;
-                               case 'd':
-                                       $num = substr( $ts, 6, 2 );
-                                       break;
-                               case 'D':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       # Weekday abbreviations are not 
available in MW<1.8
-                                       #$s .= $this->getWeekdayAbbreviation( 
date( 'w', $unix ) + 1 );
-                                       $s .= date( 'D', $unix );
-                                       break;
-                               case 'j':
-                                       $num = intval( substr( $ts, 6, 2 ) );
-                                       break;
-                               case 'l':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $s .= $wgContLang->getWeekdayName( 
date( 'w', $unix ) + 1 );
-                                       break;
-                               case 'N':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $w = date( 'w', $unix );
-                                       $num = $w ? $w : 7;
-                                       break;
-                               case 'w':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'w', $unix );
-                                       break;
-                               case 'z':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'z', $unix );
-                                       break;
-                               case 'W':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'W', $unix );
-                                       break;
-                               case 'F':
-                                       $s .= $wgContLang->getMonthName( 
substr( $ts, 4, 2 ) );
-                                       break;
-                               case 'm':
-                                       $num = substr( $ts, 4, 2 );
-                                       break;
-                               case 'M':
-                                       $s .= 
$wgContLang->getMonthAbbreviation( substr( $ts, 4, 2 ) );
-                                       break;
-                               case 'n':
-                                       $num = intval( substr( $ts, 4, 2 ) );
-                                       break;
-                               case 't':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 't', $unix );
-                                       break;
-                               case 'L':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'L', $unix );
-                                       break;
-                               # 'o' is supported since PHP 5.1.0
-                               # return literal if not supported
-                               # TODO: emulation for pre 5.1.0 versions
-                               case 'o':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       if ( version_compare(PHP_VERSION, 
'5.1.0') === 1 )
-                                               $num = date( 'o', $unix );
-                                       else
-                                               $s .= 'o';
-                                       break;
-                               case 'Y':
-                                       $num = substr( $ts, 0, 4 );
-                                       break;
-                               case 'y':
-                                       $num = substr( $ts, 2, 2 );
-                                       break;
-                               case 'a':
-                                       $s .= intval( substr( $ts, 8, 2 ) ) < 
12 ? 'am' : 'pm';
-                                       break;
-                               case 'A':
-                                       $s .= intval( substr( $ts, 8, 2 ) ) < 
12 ? 'AM' : 'PM';
-                                       break;
-                               case 'g':
-                                       $h = substr( $ts, 8, 2 );
-                                       $num = $h % 12 ? $h % 12 : 12;
-                                       break;
-                               case 'G':
-                                       $num = intval( substr( $ts, 8, 2 ) );
-                                       break;
-                               case 'h':
-                                       $h = substr( $ts, 8, 2 );
-                                       $num = sprintf( '%02d', $h % 12 ? $h % 
12 : 12 );
-                                       break;
-                               case 'H':
-                                       $num = substr( $ts, 8, 2 );
-                                       break;
-                               case 'i':
-                                       $num = substr( $ts, 10, 2 );
-                                       break;
-                               case 's':
-                                       $num = substr( $ts, 12, 2 );
-                                       break;
-                               case 'c':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $s .= date( 'c', $unix );
-                                       break;
-                               case 'r':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $s .= date( 'r', $unix );
-                                       break;
-                               case 'U':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = $unix;
-                                       break;
-                               case 'B':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'B', $unix );
-                                       break;
-                               case 'S':
-                                       if ( !$unix ) $unix = wfTimestamp( 
TS_UNIX, $ts );
-                                       $num = date( 'S', $unix );
-                                       break;
-                               
-                               case '\\':
-                                       # Backslash escaping
-                                       if ( $p < strlen( $format ) - 1 ) {
-                                               $s .= $format[++$p];
-                                       } else {
-                                               $s .= '\\';
-                                       }
-                                       break;
-                               case '"':
-                                       # Quoted literal
-                                       if ( $p < strlen( $format ) - 1 ) {
-                                               $endQuote = strpos( $format, 
'"', $p + 1 );
-                                               if ( $endQuote === false ) {
-                                                       # No terminating quote, 
assume literal "
-                                                       $s .= '"';
-                                               } else {
-                                                       $s .= substr( $format, 
$p + 1, $endQuote - $p - 1 );
-                                                       $p = $endQuote;
-                                               }
-                                       } else {
-                                               # Quote at end of string, 
assume literal "
-                                               $s .= '"';
-                                       }
-                                       break;
-                               default:
-                                       $s .= $format[$p];
-                       }
-                       if ( $num !== false ) {
-                               if ( $rawToggle || $raw ) {
-                                       $s .= $num;
-                                       $raw = false;
-                               } elseif ( $roman ) {
-                                       $s .= self::romanNumeral( $num );
-                                       $roman = false;
-                               } else {
-                                       $s .= $wgContLang->formatNum( $num, 
true );
-                               }
-                               $num = false;
-                       }
-               }
-               return $s;
-       }
-
-       /**
-        * Roman number formatting up to 3000
-        */
-       static function romanNumeral( $num ) {
-               static $table = array(
-                       array( '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 
'VIII', 'IX', 'X' ),
-                       array( '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 
'LXXX', 'XC', 'C' ),
-                       array( '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 
'DCCC', 'CM', 'M' ),
-                       array( '', 'M', 'MM', 'MMM' )
-               );
-
-               $num = intval( $num );
-               if ( $num > 3000 || $num <= 0 ) {
-                       return $num;
-               }
-
-               $s = '';
-               for ( $pow10 = 1000, $i = 3; $i >= 0; $pow10 /= 10, $i-- ) {
-                       if ( $num >= $pow10 ) {
-                               $s .= $table[$i][floor($num / $pow10)];
-                       }
-                       $num = $num % $pow10;
-               }
-               return $s;
-       }
-}

Modified: trunk/extensions/ParserFunctions/testExpr.php
===================================================================
--- trunk/extensions/ParserFunctions/testExpr.php       2010-10-02 22:26:50 UTC 
(rev 74169)
+++ trunk/extensions/ParserFunctions/testExpr.php       2010-10-02 22:36:34 UTC 
(rev 74170)
@@ -1,30 +1,30 @@
 <?php
 
-require_once ( getenv('MW_INSTALL_PATH') !== false
-       ? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc"
+require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
+       ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
        : dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
 require( 'Expr.php' );
-       
+
 $tests = file( 'exprTests.txt' );
 
 $pass = $fail = 0;
 
 // Each test is on one line. The test must always evaluate to '1'.
 $parser = new ExprParser;
-foreach( $tests as $test ) {
-       $test = trim($test);
+foreach ( $tests as $test ) {
+       $test = trim( $test );
        if ( in_string( ';', $test ) )
-               list($input,$expected) = explode(';', $test);
+               list( $input, $expected ) = explode( ';', $test );
        else {
                $input = $test;
                $expected = 1;
        }
-       
-       $expected = trim($expected);
-       $input = trim($input);
 
+       $expected = trim( $expected );
+       $input = trim( $input );
+
        $result = $parser->doExpression( $input );
-       if ($result != $expected) {
+       if ( $result != $expected ) {
                print
                        "FAILING test -- $input
  gave a final result of $result, instead of $expected.\n";
@@ -35,4 +35,4 @@
        }
 }
 
-print "Passed $pass tests, failed $fail tests, out of a total of 
".($pass+$fail)."\n";
\ No newline at end of file
+print "Passed $pass tests, failed $fail tests, out of a total of " . ( $pass + 
$fail ) . "\n";
\ No newline at end of file



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

Reply via email to