Added hooks at various parser stages. Repaired neglected insertStripItem().
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 2 Jul 2005 09:15:51 +0000 (09:15 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 2 Jul 2005 09:15:51 +0000 (09:15 +0000)
includes/Parser.php

index d7128c4..c9947f9 100644 (file)
@@ -183,11 +183,13 @@ class Parser
                //$text = $this->strip( $text, $this->mStripState );
                // VOODOO MAGIC FIX! Sometimes the above segfaults in PHP5.
                $x =& $this->mStripState;
+               
+               wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) );
                $text = $this->strip( $text, $x );
+               wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) );
 
                $text = $this->internalParse( $text );
 
-               
                $text = $this->unstrip( $text, $this->mStripState );
                
                # Clean up special characters, only run once, next-to-last before doBlockLevels
@@ -214,6 +216,8 @@ class Parser
                $this->mOutput->setTitleText($wgContLang->getParsedTitle());
 
                $text = $this->unstripNoWiki( $text, $this->mStripState );
+
+               wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) );
                
                $text = Sanitizer::normalizeCharReferences( $text );
                global $wgUseTidy;
@@ -221,6 +225,8 @@ class Parser
                        $text = Parser::tidy($text);
                }
 
+               wfRunHooks( 'ParserAfterTidy', array( &$this, &$text ) );
+
                $this->mOutput->setText( $text );
                wfProfileOut( $fname );
                return $this->mOutput;
@@ -510,7 +516,9 @@ class Parser
                          'html' => array(),
                          'nowiki' => array(),
                          'math' => array(),
-                         'pre' => array()
+                         'pre' => array(),
+                         'comment' => array(),
+                         'gallery' => array(),
                        );
                }
                $state['item'][$rnd] = $text;