mExpr ) ) { if ( !class_exists( 'ExprParser' ) ) { require_once( dirname( __FILE__ ) . '/Expr.php' ); } $this->mExprParser = new ExprParser; } $result = $this->mExprParser->doExpression( $expr ); if ( $result === false ) { return wfMsg( 'expr_parse_error' ); } else { return $result; } } function ifHook( &$parser, $test = '', $then = '', $else = '' ) { $test = trim( $test ); if ( preg_match( '/ (.*?) # Before the operator (non-greedy, get the first operator not the last) (?setFunctionHook( 'expr', array( &$wgExtParserFunctions, 'exprHook' ) ); $wgParser->setFunctionHook( 'if', array( &$wgExtParserFunctions, 'ifHook' ) ) ; $wgMessageCache->addMessage( 'expr_parse_error', 'Invalid expression' ); } ?>