56 ConvertibleTimestamp $ts,
59 LoggerInterface $logger
61 $pageLang = $parser->getFunctionLang();
70 return $pageLang->formatNumNoSeparators( $ts->format(
'm' ) );
72 return $pageLang->formatNumNoSeparators( $ts->format(
'n' ) );
73 case 'currentmonthname':
74 return $pageLang->getMonthName( (
int)$ts->format(
'n' ) );
75 case 'currentmonthnamegen':
76 return $pageLang->getMonthNameGen( (
int)$ts->format(
'n' ) );
77 case 'currentmonthabbrev':
78 return $pageLang->getMonthAbbreviation( (
int)$ts->format(
'n' ) );
80 return $pageLang->formatNumNoSeparators( $ts->format(
'j' ) );
82 return $pageLang->formatNumNoSeparators( $ts->format(
'd' ) );
84 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'm' ) );
86 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'n' ) );
87 case 'localmonthname':
88 return $pageLang->getMonthName( (
int)self::makeTsLocal( $svcOptions, $ts )->format(
'n' ) );
89 case 'localmonthnamegen':
90 return $pageLang->getMonthNameGen( (
int)self::makeTsLocal( $svcOptions, $ts )->format(
'n' ) );
91 case 'localmonthabbrev':
92 return $pageLang->getMonthAbbreviation( (
int)self::makeTsLocal( $svcOptions, $ts )->format(
'n' ) );
94 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'j' ) );
96 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'd' ) );
103 case 'fullpagenamee':
111 case 'rootpagenamee':
119 case 'basepagenamee':
126 if (
$title->canHaveTalkPage() ) {
127 $talkPage =
$title->getTalkPage();
131 case 'talkpagenamee':
132 if (
$title->canHaveTalkPage() ) {
133 $talkPage =
$title->getTalkPage();
137 case 'subjectpagename':
138 $subjPage =
$title->getSubjectPage();
140 case 'subjectpagenamee':
141 $subjPage =
$title->getSubjectPage();
146 self::setOutputFlag( $parser, $logger, ParserOutputFlags::VARY_PAGE_ID,
'{{PAGEID}} used' );
147 $value =
$title->getArticleID();
149 $value = $parser->
getOptions()->getSpeculativePageId();
151 $parser->
getOutput()->setSpeculativePageIdUsed( $value );
154 return (
string)$value;
156 $namespace =
$title->getNamespace();
158 $svcOptions->
get( MainConfigNames::MiserMode ) &&
159 !$parser->
getOptions()->getInterfaceMessage() &&
171 ParserOutputFlags::VARY_REVISION_EXISTS,
172 '{{REVISIONID}} used'
179 self::setOutputFlag( $parser, $logger, ParserOutputFlags::VARY_REVISION_ID,
'{{REVISIONID}} used' );
181 if ( $value === 0 ) {
183 $value = $rev ? $rev->getId() : $value;
186 $value = $parser->
getOptions()->getSpeculativeRevId();
188 $parser->
getOutput()->setSpeculativeRevIdUsed( $value );
191 return (
string)$value;
194 return strval( (
int)self::getRevisionTimestampSubstring(
195 $parser, $logger, 6, 2, self::MAX_TTS, $id
198 return self::getRevisionTimestampSubstring(
199 $parser, $logger, 6, 2, self::MAX_TTS, $id
201 case 'revisionmonth':
202 return self::getRevisionTimestampSubstring(
203 $parser, $logger, 4, 2, self::MAX_TTS, $id
205 case 'revisionmonth1':
206 return strval( (
int)self::getRevisionTimestampSubstring(
207 $parser, $logger, 4, 2, self::MAX_TTS, $id
210 return self::getRevisionTimestampSubstring(
211 $parser, $logger, 0, 4, self::MAX_TTS, $id
213 case 'revisiontimestamp':
214 return self::getRevisionTimestampSubstring(
215 $parser, $logger, 0, 14, self::MAX_TTS, $id
220 self::setOutputFlag( $parser, $logger, ParserOutputFlags::VARY_USER,
'{{REVISIONUSER}} used' );
228 return str_replace(
'_',
' ',
232 case 'namespacenumber':
233 return (
string)
$title->getNamespace();
235 return $title->canHaveTalkPage()
236 ? str_replace(
'_',
' ',
$title->getTalkNsText() )
239 return $title->canHaveTalkPage()
243 return str_replace(
'_',
' ',
$title->getSubjectNsText() );
244 case 'subjectspacee':
246 case 'currentdayname':
247 return $pageLang->getWeekdayName( (
int)$ts->format(
'w' ) + 1 );
249 return $pageLang->formatNumNoSeparators( $ts->format(
'Y' ) );
251 return $pageLang->time( $ts->getTimestamp( TS_MW ),
false,
false );
253 return $pageLang->formatNumNoSeparators( $ts->format(
'H' ) );
257 return $pageLang->formatNum( (
int)$ts->format(
'W' ) );
259 return $pageLang->formatNum( $ts->format(
'w' ) );
261 return $pageLang->getWeekdayName(
262 (
int)self::makeTsLocal( $svcOptions, $ts )->format(
'w' ) + 1
265 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'Y' ) );
267 return $pageLang->time(
268 self::makeTsLocal( $svcOptions, $ts )->format(
'YmdHis' ),
273 return $pageLang->formatNumNoSeparators( self::makeTsLocal( $svcOptions, $ts )->format(
'H' ) );
277 return $pageLang->formatNum( (
int)self::makeTsLocal( $svcOptions, $ts )->format(
'W' ) );
279 return $pageLang->formatNum( self::makeTsLocal( $svcOptions, $ts )->format(
'w' ) );
280 case 'numberofarticles':
282 case 'numberoffiles':
284 case 'numberofusers':
286 case 'numberofactiveusers':
288 case 'numberofpages':
290 case 'numberofadmins':
292 case 'numberofedits':
294 case 'currenttimestamp':
295 return $ts->getTimestamp( TS_MW );
296 case 'localtimestamp':
297 return self::makeTsLocal( $svcOptions, $ts )->format(
'YmdHis' );
298 case 'currentversion':
301 return (
string)$svcOptions->
get( MainConfigNames::ArticlePath );
303 return (
string)$svcOptions->
get( MainConfigNames::Sitename );
305 return (
string)$svcOptions->
get( MainConfigNames::Server );
307 return (
string)$svcOptions->
get( MainConfigNames::ServerName );
309 return (
string)$svcOptions->
get( MainConfigNames::ScriptPath );
311 return (
string)$svcOptions->
get( MainConfigNames::StylePath );
312 case 'directionmark':
313 return $pageLang->getDirMark();
314 case 'contentlanguage':
317 return $pageLang->getCode();
318 case 'cascadingsources':
319 return CoreParserFunctions::cascadingsources( $parser );