+ /**
+ * Replace magic variables
+ * @access private
+ */
+ function variableSubstitution( $matches ) {
+ if ( !$this->mVariables ) {
+ $this->initialiseVariables();
+ }
+ $skip = false;
+ if ( $this->mOutputType == OT_WIKI ) {
+ # Do only magic variables prefixed by SUBST
+ $mwSubst =& MagicWord::get( MAG_SUBST );
+ if (!$mwSubst->matchStartAndRemove( $matches[1] ))
+ $skip = true;
+ # Note that if we don't substitute the variable below,
+ # we don't remove the {{subst:}} magic word, in case
+ # it is a template rather than a magic variable.
+ }
+ if ( !$skip && array_key_exists( $matches[1], $this->mVariables ) ) {
+ $text = $this->mVariables[$matches[1]];
+ $this->mOutput->mContainsOldMagic = true;
+ } else {
+ $text = $matches[0];
+ }
+ return $text;
+ }
+