# PHP global rebinding syntax is a bit weird, need to use the GLOBALS array
$GLOBALS['wgCurParser'] =& $this;
- if ( $this->mOutputType == OT_HTML || $this->mOutputType == OT_MSG ) {
- # Variable substitution
- $text = preg_replace_callback( "/{{([$titleChars]*?)}}/", 'wfVariableSubstitution', $text );
- }
-
if ( $this->mOutputType == OT_HTML ) {
# Argument substitution
$text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", 'wfArgSubstitution', $text );
return $text;
}
- function variableSubstitution( $matches ) {
- if ( !$this->mVariables ) {
- $this->initialiseVariables();
- }
- if ( array_key_exists( $matches[1], $this->mVariables ) ) {
- $text = $this->mVariables[$matches[1]];
- $this->mOutput->mContainsOldMagic = true;
- } else {
- $text = $matches[0];
- }
- return $text;
- }
-
# Split template arguments
function getTemplateArgs( $argsString ) {
if ( $argsString === '' ) {
return $wgCurParser->argSubstitution( $matches );
}
-function wfVariableSubstitution( $matches ) {
- global $wgCurParser;
- return $wgCurParser->variableSubstitution( $matches );
-}
-
/**
* Return the total number of articles
*/