From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/parser/Preprocessor_Hash.php | 37 ++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'includes/parser/Preprocessor_Hash.php') diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index b5775243..62028291 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -758,6 +758,7 @@ class PPFrame_Hash implements PPFrame { /** * Recursion depth of this frame, top = 0 + * Note that this is NOT the same as expansion depth in expand() */ var $depth; @@ -810,6 +811,7 @@ class PPFrame_Hash implements PPFrame { } function expand( $root, $flags = 0 ) { + static $expansionDepth = 0; if ( is_string( $root ) ) { return $root; } @@ -818,10 +820,10 @@ class PPFrame_Hash implements PPFrame { { return 'Node-count limit exceeded'; } - if ( $this->depth > $this->parser->mOptions->mMaxPPExpandDepth ) { + if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) { return 'Expansion depth limit exceeded'; } - ++$this->depth; + ++$expansionDepth; $outStack = array( '', '' ); $iteratorStack = array( false, $root ); @@ -974,7 +976,7 @@ class PPFrame_Hash implements PPFrame { } } } - --$this->depth; + --$expansionDepth; return $outStack[0]; } @@ -1173,6 +1175,32 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { return !count( $this->numberedArgs ) && !count( $this->namedArgs ); } + function getArguments() { + $arguments = array(); + foreach ( array_merge( + array_keys($this->numberedArgs), + array_keys($this->namedArgs)) as $key ) { + $arguments[$key] = $this->getArgument($key); + } + return $arguments; + } + + function getNumberedArguments() { + $arguments = array(); + foreach ( array_keys($this->numberedArgs) as $key ) { + $arguments[$key] = $this->getArgument($key); + } + return $arguments; + } + + function getNamedArguments() { + $arguments = array(); + foreach ( array_keys($this->namedArgs) as $key ) { + $arguments[$key] = $this->getArgument($key); + } + return $arguments; + } + function getNumberedArgument( $index ) { if ( !isset( $this->numberedArgs[$index] ) ) { return false; @@ -1246,6 +1274,9 @@ class PPCustomFrame_Hash extends PPFrame_Hash { } function getArgument( $index ) { + if ( !isset( $this->args[$index] ) ) { + return false; + } return $this->args[$index]; } } -- cgit v1.2.3-54-g00ecf