Simple use case (PHP 5.3+) that will work show the expand text passed to a <preprocess> tag:
$wgHooks['ParserFirstCallInit'][] = function( $parser ) {
$parser->setHook( 'preprocess', function( $text, $attr, $parser, $frame ) {
return $parser->recursivePreprocess( $text, $frame );
} );
return true;
};
return $text;
}
+ /**
+ * Recursive parser entry point that can be called from an extension tag
+ * hook.
+ *
+ * @param $text String: text to be expanded
+ * @param $frame PPFrame: The frame to use for expanding any template variables
+ * @return String
+ */
+ public function recursivePreprocess( $text, $frame = false ) {
+ wfProfileIn( __METHOD__ );
+ $text = $this->replaceVariables( $text, $frame );
+ $text = $this->mStripState->unstripBoth( $text );
+ wfProfileOut( __METHOD__ );
+ return $text;
+ }
+
/**
* Process the wikitext for the ?preload= feature. (bug 5210)
*