Added fname parameter to the query() call
[lhc/web/wiklou.git] / includes / parser / Preprocessor_Hash.php
index 9cb61e6..ec600c0 100644 (file)
@@ -1,5 +1,11 @@
 <?php
-
+/**
+ * Preprocessor using PHP arrays
+ *
+ * @file
+ * @ingroup Parser
+ */
 /**
  * Differences from DOM schema:
  *   * attribute nodes are children
@@ -674,7 +680,7 @@ class Preprocessor_Hash implements Preprocessor {
                
                // Cache
                if ($cacheable) {
-                       $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );;
+                       $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );
                        $wgMemc->set( $cacheKey, $cacheValue, 86400 );
                        wfProfileOut( __METHOD__.'-cache-miss' );
                        wfProfileOut( __METHOD__.'-cacheable' );
@@ -853,7 +859,6 @@ class PPFrame_Hash implements PPFrame {
                        $title = $this->title;
                }
                if ( $args !== false ) {
-                       $xpath = false;
                        if ( $args instanceof PPNode_Hash_Array ) {
                                $args = $args->value;
                        } elseif ( !is_array( $args ) ) {
@@ -882,11 +887,11 @@ class PPFrame_Hash implements PPFrame {
                        return $root;
                }
 
-               if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount )
+               if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() )
                {
                        return '<span class="error">Node-count limit exceeded</span>';
                }
-               if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) {
+               if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) {
                        return '<span class="error">Expansion depth limit exceeded</span>';
                }
                ++$expansionDepth;
@@ -942,7 +947,7 @@ class PPFrame_Hash implements PPFrame {
                                if ( $contextNode->name == 'template' ) {
                                        # Double-brace expansion
                                        $bits = $contextNode->splitTemplate();
-                                       if ( $flags & self::NO_TEMPLATES ) {
+                                       if ( $flags & PPFrame::NO_TEMPLATES ) {
                                                $newIterator = $this->virtualBracketedImplode( '{{', '|', '}}', $bits['title'], $bits['parts'] );
                                        } else {
                                                $ret = $this->parser->braceSubstitution( $bits, $this );
@@ -955,7 +960,7 @@ class PPFrame_Hash implements PPFrame {
                                } elseif ( $contextNode->name == 'tplarg' ) {
                                        # Triple-brace expansion
                                        $bits = $contextNode->splitTemplate();
-                                       if ( $flags & self::NO_ARGS ) {
+                                       if ( $flags & PPFrame::NO_ARGS ) {
                                                $newIterator = $this->virtualBracketedImplode( '{{{', '|', '}}}', $bits['title'], $bits['parts'] );
                                        } else {
                                                $ret = $this->parser->argSubstitution( $bits, $this );
@@ -970,13 +975,13 @@ class PPFrame_Hash implements PPFrame {
                                        # Remove it in HTML, pre+remove and STRIP_COMMENTS modes
                                        if ( $this->parser->ot['html']
                                                || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() )
-                                               || ( $flags & self::STRIP_COMMENTS ) )
+                                               || ( $flags & PPFrame::STRIP_COMMENTS ) )
                                        {
                                                $out .= '';
                                        }
                                        # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
                                        # Not in RECOVER_COMMENTS mode (extractSections) though
-                                       elseif ( $this->parser->ot['wiki'] && ! ( $flags & self::RECOVER_COMMENTS ) ) {
+                                       elseif ( $this->parser->ot['wiki'] && ! ( $flags & PPFrame::RECOVER_COMMENTS ) ) {
                                                $out .= $this->parser->insertStripItem( $contextNode->firstChild->value );
                                        }
                                        # Recover the literal comment in RECOVER_COMMENTS and pre+no-remove
@@ -988,7 +993,7 @@ class PPFrame_Hash implements PPFrame {
                                        # OT_WIKI will only respect <ignore> in substed templates.
                                        # The other output types respect it unless NO_IGNORE is set.
                                        # extractSections() sets NO_IGNORE and so never respects it.
-                                       if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & self::NO_IGNORE ) ) {
+                                       if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & PPFrame::NO_IGNORE ) ) {
                                                $out .= $contextNode->firstChild->value;
                                        } else {
                                                //$out .= '';
@@ -1285,7 +1290,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
                }
                if ( !isset( $this->numberedExpansionCache[$index] ) ) {
                        # No trimming for unnamed arguments
-                       $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], self::STRIP_COMMENTS );
+                       $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], PPFrame::STRIP_COMMENTS );
                }
                return $this->numberedExpansionCache[$index];
        }
@@ -1297,7 +1302,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
                if ( !isset( $this->namedExpansionCache[$name] ) ) {
                        # Trim named arguments post-expand, for backwards compatibility
                        $this->namedExpansionCache[$name] = trim(
-                               $this->parent->expand( $this->namedArgs[$name], self::STRIP_COMMENTS ) );
+                               $this->parent->expand( $this->namedArgs[$name], PPFrame::STRIP_COMMENTS ) );
                }
                return $this->namedExpansionCache[$name];
        }