static function onParserGetVariableValueSwitch(Parser &$parser, &$cache, &$magicWordId, &$ret, $frame = null) { if ($frame === null) { // unsupported MW version return true; } switch ($magicWordId) { /** THIS **/ case 'this': $ret = ParserFunThis::pfObj_this($parser, $frame, null); break; /** CALLER **/ /** CALLER **/ case 'caller': $ret = ParserFunCaller::getCallerVar($frame); break; } return true; }
/** * Returns a string, exactly like '{{CALLER}}' as variable would return it. * * @param PPFrame $frame * * @return string */ static function getCallerVar(PPFrame $frame) { $siteFrame = ParserFunCaller::getFrameStackItem($frame, 1); return $siteFrame !== null ? self::createSiteList(array($siteFrame), false) : ''; }