(bug 13441) Allow Special:Recentchanges to show bots only
[lhc/web/wiklou.git] / includes / Preprocessor_Hash.php
index 1d6331b..ee3539a 100644 (file)
@@ -254,6 +254,7 @@ class Preprocessor_Hash implements Preprocessor {
                                        continue;
                                }
                                $name = $matches[1];
+                               $lowerName = strtolower( $name );
                                $attrStart = $i + strlen( $name ) + 1;
 
                                // Find end of tag
@@ -268,7 +269,7 @@ class Preprocessor_Hash implements Preprocessor {
                                }
 
                                // Handle ignored tags
-                               if ( in_array( $name, $ignoredTags ) ) {
+                               if ( in_array( $lowerName, $ignoredTags ) ) {
                                        $accum->addNodeWithText( 'ignore', substr( $text, $i, $tagEndPos - $i + 1 ) );
                                        $i = $tagEndPos + 1;
                                        continue;
@@ -296,7 +297,7 @@ class Preprocessor_Hash implements Preprocessor {
                                        }
                                }
                                // <includeonly> and <noinclude> just become <ignore> tags
-                               if ( in_array( $name, $ignoredElements ) ) {
+                               if ( in_array( $lowerName, $ignoredElements ) ) {
                                        $accum->addNodeWithText(  'ignore', substr( $text, $tagStartPos, $i - $tagStartPos ) );
                                        continue;
                                }
@@ -803,6 +804,10 @@ class PPFrame_Hash implements PPFrame {
                {
                        return '<span class="error">Node-count limit exceeded</span>';
                }
+               if ( $this->depth > $this->parser->mOptions->mMaxPPExpandDepth ) {
+                       return '<span class="error">Expansion depth limit exceeded</span>';
+               }
+               ++$this->depth;
 
                $outStack = array( '', '' );
                $iteratorStack = array( false, $root );
@@ -923,7 +928,7 @@ class PPFrame_Hash implements PPFrame {
                                                $titleText = $this->title->getPrefixedDBkey();
                                                $this->parser->mHeadings[] = array( $titleText, $bits['i'] );
                                                $serial = count( $this->parser->mHeadings ) - 1;
-                                               $marker = "{$this->parser->mUniqPrefix}-h-$serial-{$this->parser->mMarkerSuffix}";
+                                               $marker = "{$this->parser->mUniqPrefix}-h-$serial-" . Parser::MARKER_SUFFIX;
                                                $s = substr( $s, 0, $bits['level'] ) . $marker . substr( $s, $bits['level'] );
                                                $this->parser->mStripState->general->setPair( $marker, '' );
                                                $out .= $s;
@@ -955,6 +960,7 @@ class PPFrame_Hash implements PPFrame {
                                }
                        }
                }
+               --$this->depth;
                return $outStack[0];
        }
 
@@ -1265,8 +1271,10 @@ class PPNode_Hash_Tree implements PPNode {
        }
 
        /**
-        * Split an <arg> node into a three-element array: 
-        *    PPNode name, string index and PPNode value
+        * Split a <part> node into an associative array containing:
+        *    name          PPNode name
+        *    index         String index
+        *    value         PPNode value 
         */
        function splitArg() {
                $bits = array();
@@ -1322,7 +1330,7 @@ class PPNode_Hash_Tree implements PPNode {
        }
 
        /**
-        * Split a <h> node
+        * Split an <h> node
         */
        function splitHeading() {
                if ( $this->name !== 'h' ) {