MediaWiki  master
CoreMagicVariables Class Reference

Expansions of core magic variables, used by the parser. More...

Static Public Member Functions

static expand (Parser $parser, string $id, ConvertibleTimestamp $ts, NamespaceInfo $nsInfo, ServiceOptions $svcOptions, LoggerInterface $logger)
 Expand the magic variable given by $index. More...
 

Static Private Member Functions

static getRevisionTimestampSubstring (Parser $parser, LoggerInterface $logger, int $start, int $len, int $mtts, string $variable)
 
static makeTsLocal ( $svcOptions, $ts)
 Helper to convert a timestamp instance to local time. More...
 
static setOutputFlag (Parser $parser, LoggerInterface $logger, string $flag, string $reason)
 Helper method borrowed from Parser.php: sets the flag on the output but also does some debug logging. More...
 

Detailed Description

Expansions of core magic variables, used by the parser.

Access: internal

Definition at line 34 of file CoreMagicVariables.php.

Member Function Documentation

◆ expand()

static CoreMagicVariables::expand ( Parser  $parser,
string  $id,
ConvertibleTimestamp  $ts,
NamespaceInfo  $nsInfo,
ServiceOptions  $svcOptions,
LoggerInterface  $logger 
)
static

Expand the magic variable given by $index.

Access: internal
Parameters
Parser$parser
string$idThe name of the variable, and equivalently, the magic word ID which was used to match the variable
ConvertibleTimestamp$tsTimestamp to use when expanding magic variable
NamespaceInfo$nsInfoThe NamespaceInfo to use when expanding
ServiceOptions$svcOptionsService options for the parser
LoggerInterface$logger
Returns
string|null The expanded value, or null to indicate the given index wasn't a known magic variable.

Definition at line 51 of file CoreMagicVariables.php.

References $title, SiteStats\activeUsers(), SiteStats\articles(), CoreParserFunctions\cascadingsources(), SiteStats\edits(), MediaWiki\Config\ServiceOptions\get(), Parser\getContentLanguage(), Parser\getOptions(), Parser\getOutput(), Parser\getRevisionId(), Parser\getRevisionRecordObject(), Parser\getRevisionSize(), getRevisionTimestampSubstring(), Parser\getRevisionUser(), SpecialVersion\getVersion(), SiteStats\images(), NamespaceInfo\isSubject(), makeTsLocal(), SiteStats\numberingroup(), SiteStats\pages(), setOutputFlag(), SiteStats\users(), wfEscapeWikiText(), and wfUrlencode().

Referenced by Parser\expandMagicVariable().

◆ getRevisionTimestampSubstring()

static CoreMagicVariables::getRevisionTimestampSubstring ( Parser  $parser,
LoggerInterface  $logger,
int  $start,
int  $len,
int  $mtts,
string  $variable 
)
staticprivate
Parameters
Parser$parser
LoggerInterface$logger
int$start
int$len
int$mttsMax time-till-save; sets vary-revision-timestamp if result changes by then
string$variableParser variable name
Returns
string

Definition at line 348 of file CoreMagicVariables.php.

References Parser\getContentLanguage(), and wfTimestamp().

Referenced by expand().

◆ makeTsLocal()

static CoreMagicVariables::makeTsLocal (   $svcOptions,
  $ts 
)
staticprivate

Helper to convert a timestamp instance to local time.

See also
MWTimestamp::getLocalInstance()
Parameters
ServiceOptions$svcOptionsService options for the parser
ConvertibleTimestamp$tsTimestamp to convert
Returns
ConvertibleTimestamp

Definition at line 333 of file CoreMagicVariables.php.

References MediaWiki\Config\ServiceOptions\get().

Referenced by expand().

◆ setOutputFlag()

static CoreMagicVariables::setOutputFlag ( Parser  $parser,
LoggerInterface  $logger,
string  $flag,
string  $reason 
)
staticprivate

Helper method borrowed from Parser.php: sets the flag on the output but also does some debug logging.

Parameters
Parser$parser
LoggerInterface$logger
string$flag
string$reason

Definition at line 388 of file CoreMagicVariables.php.

Referenced by expand().


The documentation for this class was generated from the following file: