From d3caf604c1be5ef9ef0e5109f79b48b74f5707d4 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 2 Jul 2005 09:15:51 +0000 Subject: [PATCH] Added hooks at various parser stages. Repaired neglected insertStripItem(). --- includes/Parser.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index d7128c488a..c9947f9684 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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; -- 2.20.1