30use Wikimedia\RemexHtml\Tokenizer\Attributes;
31use Wikimedia\RemexHtml\Tokenizer\PlainAttributes;
44 MainConfigNames::AllowDisplayTitle,
45 MainConfigNames::AllowSlowParserFunctions,
57 $options->assertRequiredOptions( self::REGISTER_OPTIONS );
58 $allowDisplayTitle = $options->get( MainConfigNames::AllowDisplayTitle );
59 $allowSlowParserFunctions = $options->get( MainConfigNames::AllowSlowParserFunctions );
61 # Syntax for arguments (see Parser::setFunctionHook):
62 # "name for lookup in localized magic words array",
64 # optional Parser::SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
65 # instead of {{#int:...}})
67 'ns',
'nse',
'urlencode',
'lcfirst',
'ucfirst',
'lc',
'uc',
68 'localurl',
'localurle',
'fullurl',
'fullurle',
'canonicalurl',
69 'canonicalurle',
'formatnum',
'grammar',
'gender',
'plural',
'bidi',
70 'numberofpages',
'numberofusers',
'numberofactiveusers',
71 'numberofarticles',
'numberoffiles',
'numberofadmins',
72 'numberingroup',
'numberofedits',
'language',
73 'padleft',
'padright',
'anchorencode',
'defaultsort',
'filepath',
74 'pagesincategory',
'pagesize',
'protectionlevel',
'protectionexpiry',
76 'namespacee',
'namespacenumber',
'talkspace',
'talkspacee',
77 'subjectspace',
'subjectspacee',
'pagename',
'pagenamee',
78 'fullpagename',
'fullpagenamee',
'rootpagename',
'rootpagenamee',
79 'basepagename',
'basepagenamee',
'subpagename',
'subpagenamee',
80 'talkpagename',
'talkpagenamee',
'subjectpagename',
81 'subjectpagenamee',
'pageid',
'revisionid',
'revisionday',
82 'revisionday2',
'revisionmonth',
'revisionmonth1',
'revisionyear',
83 'revisiontimestamp',
'revisionuser',
'cascadingsources',
85 foreach ( $noHashFunctions as $func ) {
95 if ( $allowDisplayTitle ) {
98 [ __CLASS__,
'displaytitle' ],
102 if ( $allowSlowParserFunctions ) {
105 [ __CLASS__,
'pagesinnamespace' ],
117 public static function intFunction( $parser, $part1 =
'', ...$params ) {
118 if ( strval( $part1 ) !==
'' ) {
120 ->inLanguage( $parser->
getOptions()->getUserLangObj() );
121 return [ $message->plain(),
'noparse' => false ];
123 return [
'found' => false ];
134 public static function formatDate( $parser, $date, $defaultPref =
null ) {
136 $df = MediaWikiServices::getInstance()->getDateFormatterFactory()->get(
$lang );
138 $date = trim( $date );
140 $pref = $parser->
getOptions()->getDateFormat();
144 if ( $pref ==
'default' && $defaultPref ) {
145 $pref = $defaultPref;
148 $date = $df->reformat( $pref, $date, [
'match-whole' ] );
152 public static function ns( $parser, $part1 =
'' ) {
153 if ( intval( $part1 ) || $part1 ==
"0" ) {
154 $index = intval( $part1 );
156 $index = $parser->
getContentLanguage()->getNsIndex( str_replace(
' ',
'_', $part1 ) );
158 if ( $index !==
false ) {
161 return [
'found' => false ];
165 public static function nse( $parser, $part1 =
'' ) {
166 $ret = self::ns( $parser, $part1 );
167 if ( is_string( $ret ) ) {
168 $ret =
wfUrlencode( str_replace(
' ',
'_', $ret ) );
185 public static function urlencode( $parser,
$s =
'', $arg =
null ) {
191 switch (
$magicWords->matchStartToEnd( $arg ??
'' ) ) {
194 $func =
'wfUrlencode';
195 $s = str_replace(
' ',
'_',
$s );
200 $func =
'rawurlencode';
226 public static function lc( $parser,
$s =
'' ) {
235 public static function uc( $parser,
$s =
'' ) {
239 public static function localurl( $parser,
$s =
'', $arg =
null ) {
240 return self::urlFunction(
'getLocalURL',
$s, $arg );
243 public static function localurle( $parser,
$s =
'', $arg =
null ) {
244 $temp = self::urlFunction(
'getLocalURL',
$s, $arg );
245 if ( !is_string( $temp ) ) {
248 return htmlspecialchars( $temp, ENT_COMPAT );
252 public static function fullurl( $parser,
$s =
'', $arg =
null ) {
253 return self::urlFunction(
'getFullURL',
$s, $arg );
256 public static function fullurle( $parser,
$s =
'', $arg =
null ) {
257 $temp = self::urlFunction(
'getFullURL',
$s, $arg );
258 if ( !is_string( $temp ) ) {
261 return htmlspecialchars( $temp, ENT_COMPAT );
266 return self::urlFunction(
'getCanonicalURL',
$s, $arg );
270 $temp = self::urlFunction(
'getCanonicalURL',
$s, $arg );
271 if ( !is_string( $temp ) ) {
274 return htmlspecialchars( $temp, ENT_COMPAT );
280 # Due to order of execution of a lot of bits, the values might be encoded
281 # before arriving here; if that's true, then the title can't be created
282 # and the variable will fail. If we can't get a decent title from the first
283 # attempt, url-decode and try for a second.
285 $title = Title::newFromURL( urldecode(
$s ) );
288 # Convert NS_MEDIA -> NS_FILE
292 if ( $arg !==
null ) {
293 $text =
$title->$func( $arg );
299 return [
'found' => false ];
309 public static function formatnum( $parser, $num =
'', $arg =
null ) {
316 $func = self::getLegacyFormatNum( $parser, $func );
319 $func = self::getLegacyFormatNum( $parser, $func );
330 private static function getLegacyFormatNum( $parser, $callback ) {
335 return static function ( $number ) use ( $parser, $callback ) {
336 $validNumberRe =
'(-(?=[\d\.]))?(\d+|(?=\.\d))(\.\d*)?([Ee][-+]?\d+)?';
338 !is_numeric( $number ) &&
339 $number !== (string)NAN &&
340 $number !== (
string)INF &&
341 $number !== (string)-INF
346 return preg_replace_callback(
"/{$validNumberRe}/",
static function ( $m ) use ( $callback ) {
347 return call_user_func( $callback, $m[0] );
350 return call_user_func( $callback, $number );
360 public static function grammar( $parser, $case =
'', $word =
'' ) {
371 public static function gender( $parser, $username, ...$forms ) {
373 if ( count( $forms ) === 0 ) {
375 } elseif ( count( $forms ) === 1 ) {
379 $username = trim( $username );
381 $userOptionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup();
382 $gender = $userOptionsLookup->getDefaultOption(
'gender' );
388 $username =
$title->getText();
393 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
395 $gender = $genderCache->getGenderOf( $user, __METHOD__ );
396 } elseif ( $username ===
'' && $parser->
getOptions()->getInterfaceMessage() ) {
397 $gender = $genderCache->getGenderOf( $parser->
getOptions()->getUserIdentity(), __METHOD__ );
409 public static function plural( $parser, $text =
'', ...$forms ) {
411 settype( $text, ctype_digit( $text ) ?
'int' :
'float' );
421 public static function bidi( $parser, $text =
'' ) {
434 public static function displaytitle( $parser, $text =
'', $uarg =
'' ) {
435 $restrictDisplayTitle = MediaWikiServices::getInstance()->getMainConfig()
436 ->get( MainConfigNames::RestrictDisplayTitle );
441 [
'displaytitle_noerror',
'displaytitle_noreplace' ] );
454 $bad = [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'div',
'blockquote',
'ol',
'ul',
'li',
'hr',
455 'table',
'tr',
'th',
'td',
'dl',
'dd',
'caption',
'p',
'ruby',
'rb',
'rt',
'rtc',
'rp',
'br' ];
458 if ( $restrictDisplayTitle ) {
461 $htmlTagsCallback =
static function ( Attributes $attr ): Attributes {
462 $decoded = $attr->getValues();
464 if ( isset( $decoded[
'style'] ) ) {
467 $decoded[
'style'] = Sanitizer::checkCss( $decoded[
'style'] );
469 if ( preg_match(
'/(display|user-select|visibility)\s*:/i', $decoded[
'style'] ) ) {
470 $decoded[
'style'] =
'/* attempt to bypass $wgRestrictDisplayTitle */';
474 return new PlainAttributes( $decoded );
477 $htmlTagsCallback =
null;
483 $text = Sanitizer::removeSomeTags( $text, [
484 'attrCallback' => $htmlTagsCallback,
485 'removeTags' => $bad,
487 $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
489 $filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text );
491 if ( !$restrictDisplayTitle ||
496 $old = $parser->
getOutput()->getPageProperty(
'displaytitle' );
497 if ( $old ===
null || $arg !==
'displaytitle_noreplace' ) {
498 $parser->
getOutput()->setDisplayTitle( $text );
500 if ( $old !==
null && $old !== $text && !$arg ) {
503 return '<span class="error">' .
508 )->inContentLanguage()->text() .
515 'restricted-displaytitle',
532 private static function matchAgainstMagicword(
535 $value = trim( strval( $value ) );
536 if ( $value ===
'' ) {
539 $mwObject = $magicWordFactory->
get( $magicword );
540 return $mwObject->matchStartToEnd( $value );
555 if ( $raw !==
null ) {
556 if ( !$magicWordFactory ) {
557 $magicWordFactory = MediaWikiServices::getInstance()->getMagicWordFactory();
559 if ( self::matchAgainstMagicword( $magicWordFactory,
'rawsuffix', $raw ) ) {
563 return $language->formatNum( $num );
587 return self::formatRaw(
599 return self::formatRaw(
607 return self::formatRaw(
622 public static function namespace( $parser,
$title = null ) {
627 return str_replace(
'_',
' ',
$t->getNsText() );
642 return self::namespace( $parser,
$title );
658 return $t->getNamespace();
663 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
666 return str_replace(
'_',
' ',
$t->getTalkNsText() );
671 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
682 return str_replace(
'_',
' ',
$t->getSubjectNsText() );
718 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
726 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
782 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
790 if (
$t ===
null || !
$t->canHaveTalkPage() ) {
822 public static function pagesincategory( $parser, $name =
'', $arg1 =
'', $arg2 =
'' ) {
826 'pagesincategory_all',
827 'pagesincategory_pages',
828 'pagesincategory_subcats',
829 'pagesincategory_files'
845 $type =
'pagesincategory_all';
849 if ( !
$title ) { # invalid title
852 $languageConverter = MediaWikiServices::getInstance()
853 ->getLanguageConverterFactory()
855 $languageConverter->findVariantLink( $name,
$title,
true );
858 $name =
$title->getDBkey();
860 if ( !isset(
$cache[$name] ) ) {
861 $category = Category::newFromTitle(
$title );
863 $allCount = $subcatCount = $fileCount = $pageCount = 0;
865 $allCount = $category->getMemberCount();
866 $subcatCount = $category->getSubcatCount();
867 $fileCount = $category->getFileCount();
868 $pageCount = $category->getPageCount( Category::COUNT_CONTENT_PAGES );
870 $cache[$name][
'pagesincategory_all'] = $allCount;
871 $cache[$name][
'pagesincategory_pages'] = $pageCount;
872 $cache[$name][
'pagesincategory_subcats'] = $subcatCount;
873 $cache[$name][
'pagesincategory_files'] = $fileCount;
889 public static function pagesize( $parser, $page =
'', $raw =
null ) {
890 $title = Title::newFromText( $page );
892 if ( !is_object(
$title ) ) {
897 $rev = self::getCachedRevisionObject( $parser,
$title, ParserOutputFlags::VARY_REVISION_SHA1 );
898 $length = $rev ? $rev->getSize() : 0;
899 if ( $length ===
null ) {
919 $titleObject = Title::newFromText(
$title ) ?? $parser->
getTitle();
920 $restrictionStore = MediaWikiServices::getInstance()->getRestrictionStore();
922 $restrictions = $restrictionStore->getRestrictions( $titleObject, strtolower(
$type ) );
923 # RestrictionStore::getRestrictions returns an array, its possible it may have
924 # multiple values in the future
925 return implode(
',', $restrictions );
943 $titleObject = Title::newFromText(
$title ) ?? $parser->
getTitle();
944 $restrictionStore = MediaWikiServices::getInstance()->getRestrictionStore();
946 $expiry = $restrictionStore->getRestrictionExpiry( $titleObject, strtolower(
$type ) );
949 if ( $expiry ===
null ) {
964 public static function language( $parser, $code =
'', $inLanguage =
'' ) {
965 $code = strtolower( $code );
966 $inLanguage = strtolower( $inLanguage );
967 $lang = MediaWikiServices::getInstance()
968 ->getLanguageNameUtils()
969 ->getLanguageName( $code, $inLanguage );
970 return $lang !==
'' ?
$lang : LanguageCode::bcp47( $code );
982 public static function pad(
983 $parser, $string, $length, $padding =
'0', $direction = STR_PAD_RIGHT
986 $lengthOfPadding = mb_strlen( $padding );
987 if ( $lengthOfPadding == 0 ) {
991 # The remaining length to add counts down to 0 as padding is added
992 $length = min( (
int)$length, 500 ) - mb_strlen( $string );
993 if ( $length <= 0 ) {
998 # $finalPadding is just $padding repeated enough times so that
999 # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length
1001 while ( $length > 0 ) {
1002 # If $length < $lengthofPadding, truncate $padding so we get the
1003 # exact length desired.
1004 $finalPadding .= mb_substr( $padding, 0, $length );
1005 $length -= $lengthOfPadding;
1008 if ( $direction == STR_PAD_LEFT ) {
1009 return $finalPadding . $string;
1011 return $string . $finalPadding;
1015 public static function padleft( $parser, $string =
'', $length = 0, $padding =
'0' ) {
1016 return self::pad( $parser, $string, $length, $padding, STR_PAD_LEFT );
1019 public static function padright( $parser, $string =
'', $length = 0, $padding =
'0' ) {
1020 return self::pad( $parser, $string, $length, $padding );
1031 return Sanitizer::safeEncodeAttribute( $section );
1034 public static function special( $parser, $text ) {
1035 list( $page, $subpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
1036 resolveAlias( $text );
1039 return $title->getPrefixedText();
1043 return $title ?
$title->getPrefixedText() : self::special( $parser,
'Badtitle' );
1048 return wfUrlencode( str_replace(
' ',
'_', self::special( $parser, $text ) ) );
1063 [
'defaultsort_noerror',
'defaultsort_noreplace' ] );
1067 $text = trim( $text );
1068 if ( strlen( $text ) == 0 ) {
1071 $old = $parser->
getOutput()->getPageProperty(
'defaultsort' );
1072 if ( $old ===
null || $arg !==
'defaultsort_noreplace' ) {
1073 $parser->
getOutput()->setPageProperty(
'defaultsort', $text );
1076 if ( $old ===
null || $old == $text || $arg ) {
1080 return '<span class="error">' .
1085 )->inContentLanguage()->text() .
1101 public static function filepath( $parser, $name =
'', $argA =
'', $argB =
'' ) {
1102 $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $name );
1104 if ( $argA ==
'nowiki' ) {
1111 $isNowiki = ( $argB ==
'nowiki' );
1115 $url =
$file->getFullUrl();
1118 if ( count( $parsedWidthParam ) ) {
1119 $mto =
$file->transform( $parsedWidthParam );
1121 if ( $mto && !$mto->isError() ) {
1127 return [ $url,
'nowiki' =>
true ];
1143 if ( !count(
$args ) ) {
1146 $tagName = strtolower( trim( $frame->expand( array_shift(
$args ) ) ) );
1149 if ( count(
$args ) ) {
1150 $inner = $frame->expand( array_shift(
$args ), $processNowiki );
1156 foreach (
$args as $arg ) {
1157 $bits = $arg->splitArg();
1158 if ( strval( $bits[
'index'] ) ===
'' ) {
1159 $name = trim( $frame->expand( $bits[
'name'], PPFrame::STRIP_COMMENTS ) );
1160 $value = trim( $frame->expand( $bits[
'value'] ) );
1161 if ( preg_match(
'/^(?:["\'](.+)["\']|""|\'\')$/s', $value, $m ) ) {
1162 $value = $m[1] ??
'';
1164 $attributes[$name] = $value;
1169 if ( !in_array( $tagName, $stripList ) ) {
1172 foreach ( $attributes as $name => $value ) {
1173 $attrText .=
' ' . htmlspecialchars( $name ) .
1174 '="' . htmlspecialchars( $value, ENT_COMPAT ) .
'"';
1176 if ( $inner ===
null ) {
1177 return "<$tagName$attrText/>";
1179 return "<$tagName$attrText>$inner</$tagName>";
1185 'attributes' => $attributes,
1186 'close' =>
"</$tagName>",
1204 private static function getCachedRevisionObject( $parser,
$title, $vary ) {
1209 $revisionRecord =
null;
1212 if ( $isSelfReferential ) {
1217 if ( $parserRevisionRecord && $parserRevisionRecord->isCurrent() ) {
1218 $revisionRecord = $parserRevisionRecord;
1223 if ( !$revisionRecord ) {
1232 if ( !$revisionRecord ) {
1234 $revisionRecord =
null;
1237 $parserOutput->addTemplate(
1239 $revisionRecord ? $revisionRecord->getPageId() : 0,
1240 $revisionRecord ? $revisionRecord->getId() : 0
1244 if ( $isSelfReferential ) {
1245 wfDebug( __METHOD__ .
": used current revision, setting $vary" );
1247 $parserOutput->setOutputFlag( $vary );
1248 if ( $vary === ParserOutputFlags::VARY_REVISION_SHA1 && $revisionRecord ) {
1250 $sha1 = $revisionRecord->getSha1();
1254 $parserOutput->setRevisionUsedSha1Base36( $sha1 );
1258 return $revisionRecord;
1272 } elseif ( !
$t->canExist() ||
$t->isExternal() ) {
1281 $parserOutput->setOutputFlag( ParserOutputFlags::VARY_PAGE_ID );
1282 $id = $parser->
getTitle()->getArticleID();
1284 $parserOutput->setSpeculativePageIdUsed( $id );
1291 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
1292 $pdbk =
$t->getPrefixedDBkey();
1293 $id = $linkCache->getGoodLinkID( $pdbk );
1294 if ( $id != 0 || $linkCache->isBadLink( $pdbk ) ) {
1295 $parserOutput->addLink(
$t, $id );
1302 $id =
$t->getArticleID();
1303 $parserOutput->addLink(
$t, $id );
1320 if (
$t ===
null ) {
1324 $services = MediaWikiServices::getInstance();
1327 $services->getMainConfig()->get( MainConfigNames::MiserMode ) &&
1328 !$parser->
getOptions()->getInterfaceMessage() &&
1330 $services->getNamespaceInfo()->isSubject(
$t->getNamespace() )
1337 $parser->
getOutput()->setOutputFlag( ParserOutputFlags::VARY_REVISION_EXISTS );
1342 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_ID );
1343 return $rev ? $rev->getId() :
'';
1355 if (
$t ===
null ) {
1359 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1360 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'j' ) :
'';
1372 if (
$t ===
null ) {
1376 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1377 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'd' ) :
'';
1389 if (
$t ===
null ) {
1393 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1394 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'm' ) :
'';
1406 if (
$t ===
null ) {
1410 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1411 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'n' ) :
'';
1423 if (
$t ===
null ) {
1427 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1428 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'Y' ) :
'';
1440 if (
$t ===
null ) {
1444 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_REVISION_TIMESTAMP );
1445 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'YmdHis' ) :
'';
1457 if (
$t ===
null ) {
1461 $rev = self::getCachedRevisionObject( $parser,
$t, ParserOutputFlags::VARY_USER );
1462 if ( $rev ===
null ) {
1465 $user = $rev->getUser();
1466 return $user ? $user->getName() :
'';
1482 $titleObject = Title::newFromText(
$title ) ?? $parser->
getTitle();
1483 $restrictionStore = MediaWikiServices::getInstance()->getRestrictionStore();
1484 if ( $restrictionStore->areCascadeProtectionSourcesLoaded( $titleObject )
1488 $sources = $restrictionStore->getCascadeProtectionSources( $titleObject );
1489 $titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
1490 foreach ( $sources[0] as $sourcePageIdentity ) {
1491 $names[] = $titleFormatter->getPrefixedText( $sourcePageIdentity );
1493 return implode(
'|', $names );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
$magicWords
@phpcs-require-sorted-array
Various core parser functions, registered in every Parser.
static language( $parser, $code='', $inLanguage='')
Gives language names.
static numberingroup( $parser, $name='', $raw=null)
static rootpagename( $parser, $title=null)
static localurl( $parser, $s='', $arg=null)
static formatnum( $parser, $num='', $arg=null)
static ns( $parser, $part1='')
static protectionexpiry( $parser, $type='', $title='')
Returns the requested protection expiry for the current page.
static pagenamee( $parser, $title=null)
static padleft( $parser, $string='', $length=0, $padding='0')
static fullurle( $parser, $s='', $arg=null)
static revisionmonth( $parser, $title=null)
Get the month with leading zeros from the last revision of a specified page.
static fullpagename( $parser, $title=null)
static revisionid( $parser, $title=null)
Get the id from the last revision of a specified page.
static pagesinnamespace( $parser, $namespace=0, $raw=null)
static numberofusers( $parser, $raw=null)
static special( $parser, $text)
static nse( $parser, $part1='')
static pagesize( $parser, $page='', $raw=null)
Return the size of the given page, or 0 if it's nonexistent.
static canonicalurl( $parser, $s='', $arg=null)
static basepagenamee( $parser, $title=null)
static subjectspacee( $parser, $title=null)
static numberofedits( $parser, $raw=null)
static numberoffiles( $parser, $raw=null)
static ucfirst( $parser, $s='')
static basepagename( $parser, $title=null)
static gender( $parser, $username,... $forms)
static numberofpages( $parser, $raw=null)
static lcfirst( $parser, $s='')
static urlFunction( $func, $s='', $arg=null)
static plural( $parser, $text='',... $forms)
static formatRaw( $num, $raw, $language, MagicWordFactory $magicWordFactory=null)
Formats a number according to a language.
static talkspacee( $parser, $title=null)
static bidi( $parser, $text='')
static revisionuser( $parser, $title=null)
Get the user from the last revision of a specified page.
static anchorencode( $parser, $text)
static subjectpagenamee( $parser, $title=null)
static namespacee( $parser, $title=null)
static subjectpagename( $parser, $title=null)
static filepath( $parser, $name='', $argA='', $argB='')
Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}} or {{...
static padright( $parser, $string='', $length=0, $padding='0')
static pad( $parser, $string, $length, $padding='0', $direction=STR_PAD_RIGHT)
Unicode-safe str_pad with the restriction that $length is forced to be <= 500.
static canonicalurle( $parser, $s='', $arg=null)
static cascadingsources( $parser, $title='')
Returns the sources of any cascading protection acting on a specified page.
static numberofactiveusers( $parser, $raw=null)
static displaytitle( $parser, $text='', $uarg='')
Override the title of the page when viewed, provided we've been given a title which will normalise to...
static pageid( $parser, $title=null)
Get the pageid of a specified page.
static formatDate( $parser, $date, $defaultPref=null)
static urlencode( $parser, $s='', $arg=null)
urlencodes a string according to one of three patterns: (T24474)
static grammar( $parser, $case='', $word='')
static subpagenamee( $parser, $title=null)
static tagObj( $parser, $frame, $args)
Parser function to extension tag adaptor.
static revisionmonth1( $parser, $title=null)
Get the month from the last revision of a specified page.
static rootpagenamee( $parser, $title=null)
static protectionlevel( $parser, $type='', $title='')
Returns the requested protection level for the current page.
static namespacenumber( $parser, $title=null)
static revisionday( $parser, $title=null)
Get the day from the last revision of a specified page.
static subjectspace( $parser, $title=null)
static lc( $parser, $s='')
static pagesincategory( $parser, $name='', $arg1='', $arg2='')
Return the number of pages, files or subcats in the given category, or 0 if it's nonexistent.
static talkpagename( $parser, $title=null)
static fullurl( $parser, $s='', $arg=null)
static mwnamespace( $parser, $title=null)
Given a title, return the namespace name that would be given by the corresponding magic word.
static pagename( $parser, $title=null)
Functions to get and normalize pagenames, corresponding to the magic words of the same names.
static intFunction( $parser, $part1='',... $params)
static numberofadmins( $parser, $raw=null)
static numberofarticles( $parser, $raw=null)
static revisionyear( $parser, $title=null)
Get the year from the last revision of a specified page.
static revisionday2( $parser, $title=null)
Get the day with leading zeros from the last revision of a specified page.
static uc( $parser, $s='')
static talkpagenamee( $parser, $title=null)
static revisiontimestamp( $parser, $title=null)
Get the timestamp from the last revision of a specified page.
static subpagename( $parser, $title=null)
static localurle( $parser, $s='', $arg=null)
static defaultsort( $parser, $text, $uarg='')
static fullpagenamee( $parser, $title=null)
static talkspace( $parser, $title=null)
static speciale( $parser, $text)
A factory that stores information about MagicWords, and creates them on demand with caching.
get( $id)
Factory: creates an object representing an ID.
A class containing constants representing the names of configuration variables.
static plaintextParam( $plaintext)
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
addTrackingCategory( $msg)
getMagicWordFactory()
Get the MagicWordFactory that this Parser is using.
isCurrentRevisionOfTitleCached(LinkTarget $link)
extensionSubstitution(array $params, PPFrame $frame, bool $processNowiki=false)
Return the text to be used for a given extension tag.
tagNeedsNowikiStrippedInTagPF(string $lowerTagName)
fetchCurrentRevisionRecordOfTitle(LinkTarget $link)
Fetch the current revision of a given title as a RevisionRecord.
setFunctionHook( $id, callable $callback, $flags=0)
Create a function, e.g.
getFunctionLang()
Get a language object for use in parser functions such as {{FORMATNUM:}}.
getStripList()
Get a list of strippable XML-like elements.
getTargetLanguageConverter()
Shorthand for getting a Language Converter for Target language.
getContentLanguage()
Get the content language that this Parser is using.
guessSectionNameFromWikiText( $text)
Try to guess the section anchor name based on a wikitext fragment presumably extracted from a heading...
getRevisionId()
Get the ID of the revision we are parsing.
static parseWidthParam( $value, $parseHeight=true)
Parsed a width param of imagelink like 300px or 200x300px.
doQuotes( $text)
Helper function for handleAllQuotes()
incrementExpensiveFunctionCount()
markerSkipCallback( $s, callable $callback)
Call a callback function on all regions of the given text that are not inside strip markers,...
killMarkers( $text)
Remove any strip markers found in the given text.
getRevisionRecordObject()
Get the revision record object for $this->mRevisionId.
static numberingroup( $group)
Find the number of users in a given user group.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a title within MediaWiki.
hasFragment()
Check if a Title fragment is set.
static newFromName( $name, $validate='valid')
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!isset( $args[0])) $lang