Got rid of the $shallowFlags/$deepFlags split -- seemed like a good idea at the time...
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 1 Dec 2007 07:13:31 +0000 (07:13 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 1 Dec 2007 07:13:31 +0000 (07:13 +0000)
includes/Parser.php

index 372b95d..a51b09c 100644 (file)
@@ -3032,7 +3032,7 @@ class Parser
 
                $dom = $this->preprocessToDom( $text );
                $flags = $argsOnly ? PPFrame::NO_TEMPLATES : 0;
-               $text = $frame->expand( $dom, 0, $flags );
+               $text = $frame->expand( $dom, $flags );
 
                wfProfileOut( $fname );
                return $text;
@@ -3336,7 +3336,7 @@ class Parser
                                # Just replace the arguments, not any double-brace items
                                # This is used for rendered interwiki transclusion
                                if ( $isDOM ) {
-                                       $text = $newFrame->expand( $text, 0, PPFrame::NO_TEMPLATES );
+                                       $text = $newFrame->expand( $text, PPFrame::NO_TEMPLATES );
                                } else {
                                        $text = $this->replaceVariables( $text, $newFrame, true );
                                }
@@ -3344,7 +3344,7 @@ class Parser
                                $text = $frame->expand( $text );
                        }
                } elseif ( $isDOM ) {
-                       $text = $frame->expand( $text, 0, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
+                       $text = $frame->expand( $text, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
                }
 
                # Prune lower levels off the recursion check path
@@ -4972,7 +4972,7 @@ class Parser
                                        $curIndex++;
                                }
                                if ( $mode == 'replace' ) {
-                                       $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+                                       $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
                                }
                                $node = $node->nextSibling;
                        }
@@ -5000,7 +5000,7 @@ class Parser
                                }
                        }
                        if ( $mode == 'get' ) {
-                               $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+                               $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
                        }
                        $node = $node->nextSibling;
                } while ( $node );
@@ -5012,7 +5012,7 @@ class Parser
                        // stripped by the editor, so we need both newlines to restore the paragraph gap
                        $outText .= $newText . "\n\n";
                        while ( $node ) {
-                               $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+                               $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
                                $node = $node->nextSibling;
                        }
                }
@@ -5283,7 +5283,7 @@ class PPFrame {
         * using the current context
         * @param $root the node
         */
-       function expand( $root, $shallowFlags = 0, $deepFlags = 0 ) {
+       function expand( $root, $flags = 0 ) {
                if ( is_string( $root ) ) {
                        return $root;
                }
@@ -5293,17 +5293,16 @@ class PPFrame {
                {
                        return $this->parser->insertStripItem( '<!-- node-count limit exceeded -->' );
                }
-               $flags = $shallowFlags | $deepFlags;
 
                if ( is_array( $root ) ) {
                        $s = '';
                        foreach ( $root as $node ) {
-                               $s .= $this->expand( $node, 0, $deepFlags );
+                               $s .= $this->expand( $node, $flags );
                        }
                } elseif ( $root instanceof DOMNodeList ) {
                        $s = '';
                        foreach ( $root as $node ) {
-                               $s .= $this->expand( $node, 0, $deepFlags );
+                               $s .= $this->expand( $node, $flags );
                        }
                } elseif ( $root instanceof DOMNode ) {
                        if ( $root->nodeType == XML_TEXT_NODE ) {
@@ -5315,7 +5314,7 @@ class PPFrame {
                                $title = $titles->item( 0 );
                                $parts = $xpath->query( 'part', $root );
                                if ( $flags & self::NO_TEMPLATES ) {
-                                       $s = '{{' . $this->implodeWithFlags( '|', 0, $deepFlags, $title, $parts ) . '}}';
+                                       $s = '{{' . $this->implodeWithFlags( '|', $flags, $title, $parts ) . '}}';
                                } else {
                                        $lineStart = $root->getAttribute( 'lineStart' );
                                        $params = array( 
@@ -5332,7 +5331,7 @@ class PPFrame {
                                $title = $titles->item( 0 );
                                $parts = $xpath->query( 'part', $root );
                                if ( $flags & self::NO_ARGS || $this->parser->ot['msg'] ) {
-                                       $s = '{{{' . $this->implode( '|', 0, $deepFlags, $title, $parts ) . '}}}';
+                                       $s = '{{{' . $this->implode( '|', $flags, $title, $parts ) . '}}}';
                                } else {
                                        $params = array( 'title' => $title, 'parts' => $parts, 'text' => 'FIXME' );
                                        $s = $this->parser->argSubstitution( $params, $this );
@@ -5353,7 +5352,7 @@ class PPFrame {
                                $s = $this->parser->extensionSubstitution( $params, $this );
                        } elseif ( $root->nodeName == 'h' ) {
                                # Heading
-                               $s = $this->expand( $root->childNodes, 0, $deepFlags );
+                               $s = $this->expand( $root->childNodes, $flags );
 
                                if ( $this->parser->ot['html'] ) {
                                        # Insert heading index marker
@@ -5387,7 +5386,7 @@ class PPFrame {
                                        if ( $node->nodeType == XML_TEXT_NODE ) {
                                                $s .= $node->nodeValue;
                                        } elseif ( $node->nodeType == XML_ELEMENT_NODE ) {
-                                               $s .= $this->expand( $node, 0, $deepFlags );
+                                               $s .= $this->expand( $node, $flags );
                                        }
                                }
                        }
@@ -5397,8 +5396,8 @@ class PPFrame {
                return $s;
        }
 
-       function implodeWithFlags( $sep, $shallowFlags, $deepFlags /*, ... */ ) {
-               $args = array_slice( func_get_args(), 3 );
+       function implodeWithFlags( $sep, $flags /*, ... */ ) {
+               $args = array_slice( func_get_args(), 2 );
 
                $first = true;
                $s = '';
@@ -5412,7 +5411,7 @@ class PPFrame {
                                } else {
                                        $s .= $sep;
                                }
-                               $s .= $this->expand( $node, $shallowFlags, $deepFlags );
+                               $s .= $this->expand( $node, $flags );
                        }
                }
                return $s;
@@ -5420,7 +5419,7 @@ class PPFrame {
 
        function implode( $sep /*, ... */ ) {
                $args = func_get_args();
-               $args = array_merge( array_slice( $args, 0, 1 ), array( 0, 0 ), array_slice( $args, 1 ) );
+               $args = array_merge( array_slice( $args, 0, 1 ), array( 0 ), array_slice( $args, 1 ) );
                return call_user_func_array( array( $this, 'implodeWithFlags' ), $args );
        }