34 public static function register( $parser ) {
37 # Syntax for arguments (see Parser::setFunctionHook):
38 # "name for lookup in localized magic words array",
40 # optional Parser::SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
41 # instead of {{#int:...}})
43 'ns',
'nse',
'urlencode',
'lcfirst',
'ucfirst',
'lc',
'uc',
44 'localurl',
'localurle',
'fullurl',
'fullurle',
'canonicalurl',
45 'canonicalurle',
'formatnum',
'grammar',
'gender',
'plural',
'bidi',
46 'numberofpages',
'numberofusers',
'numberofactiveusers',
47 'numberofarticles',
'numberoffiles',
'numberofadmins',
48 'numberingroup',
'numberofedits',
'language',
49 'padleft',
'padright',
'anchorencode',
'defaultsort',
'filepath',
50 'pagesincategory',
'pagesize',
'protectionlevel',
'protectionexpiry',
51 'namespacee',
'namespacenumber',
'talkspace',
'talkspacee',
52 'subjectspace',
'subjectspacee',
'pagename',
'pagenamee',
53 'fullpagename',
'fullpagenamee',
'rootpagename',
'rootpagenamee',
54 'basepagename',
'basepagenamee',
'subpagename',
'subpagenamee',
55 'talkpagename',
'talkpagenamee',
'subjectpagename',
56 'subjectpagenamee',
'pageid',
'revisionid',
'revisionday',
57 'revisionday2',
'revisionmonth',
'revisionmonth1',
'revisionyear',
58 'revisiontimestamp',
'revisionuser',
'cascadingsources',
60 foreach ( $noHashFunctions as $func ) {
61 $parser->setFunctionHook( $func, [ __CLASS__, $func ], Parser::SFH_NO_HASH );
64 $parser->setFunctionHook(
66 [ __CLASS__,
'mwnamespace' ],
69 $parser->setFunctionHook(
'int', [ __CLASS__,
'intFunction' ], Parser::SFH_NO_HASH );
70 $parser->setFunctionHook(
'special', [ __CLASS__,
'special' ] );
71 $parser->setFunctionHook(
'speciale', [ __CLASS__,
'speciale' ] );
72 $parser->setFunctionHook(
'tag', [ __CLASS__,
'tagObj' ], Parser::SFH_OBJECT_ARGS );
73 $parser->setFunctionHook(
'formatdate', [ __CLASS__,
'formatDate' ] );
76 $parser->setFunctionHook(
78 [ __CLASS__,
'displaytitle' ],
83 $parser->setFunctionHook(
85 [ __CLASS__,
'pagesinnamespace' ],
97 public static function intFunction( $parser, $part1 =
'', ...$params ) {
98 if ( strval( $part1 ) !==
'' ) {
100 ->inLanguage( $parser->getOptions()->getUserLangObj() );
101 return [ $message->plain(),
'noparse' => false ];
103 return [
'found' => false ];
114 public static function formatDate( $parser, $date, $defaultPref =
null ) {
115 $lang = $parser->getFunctionLang();
116 $df = MediaWikiServices::getInstance()->getDateFormatterFactory()->get(
$lang );
118 $date = trim( $date );
120 $pref = $parser->getOptions()->getDateFormat();
124 if ( $pref ==
'default' && $defaultPref ) {
125 $pref = $defaultPref;
128 $date = $df->reformat( $pref, $date, [
'match-whole' ] );
132 public static function ns( $parser, $part1 =
'' ) {
133 if ( intval( $part1 ) || $part1 ==
"0" ) {
134 $index = intval( $part1 );
136 $index = $parser->getContentLanguage()->getNsIndex( str_replace(
' ',
'_', $part1 ) );
138 if ( $index !==
false ) {
139 return $parser->getContentLanguage()->getFormattedNsText( $index );
141 return [
'found' => false ];
145 public static function nse( $parser, $part1 =
'' ) {
147 if ( is_string( $ret ) ) {
148 $ret =
wfUrlencode( str_replace(
' ',
'_', $ret ) );
165 public static function urlencode( $parser,
$s =
'', $arg =
null ) {
169 $parser->getMagicWordFactory()->newArray( [
'url_path',
'url_query',
'url_wiki' ] );
174 $func =
'wfUrlencode';
175 $s = str_replace(
' ',
'_',
$s );
180 $func =
'rawurlencode';
190 return $func( $parser->killMarkers(
$s ) );
194 return $parser->getContentLanguage()->lcfirst(
$s );
198 return $parser->getContentLanguage()->ucfirst(
$s );
206 public static function lc( $parser,
$s =
'' ) {
207 return $parser->markerSkipCallback(
$s, [ $parser->getContentLanguage(),
'lc' ] );
215 public static function uc( $parser,
$s =
'' ) {
216 return $parser->markerSkipCallback(
$s, [ $parser->getContentLanguage(),
'uc' ] );
219 public static function localurl( $parser,
$s =
'', $arg =
null ) {
223 public static function localurle( $parser,
$s =
'', $arg =
null ) {
225 if ( !is_string( $temp ) ) {
228 return htmlspecialchars( $temp );
232 public static function fullurl( $parser,
$s =
'', $arg =
null ) {
236 public static function fullurle( $parser,
$s =
'', $arg =
null ) {
238 if ( !is_string( $temp ) ) {
241 return htmlspecialchars( $temp );
251 if ( !is_string( $temp ) ) {
254 return htmlspecialchars( $temp );
260 # Due to order of execution of a lot of bits, the values might be encoded
261 # before arriving here; if that's true, then the title can't be created
262 # and the variable will fail. If we can't get a decent title from the first
263 # attempt, url-decode and try for a second.
264 if ( is_null(
$title ) ) {
265 $title = Title::newFromURL( urldecode(
$s ) );
267 if ( !is_null(
$title ) ) {
268 # Convert NS_MEDIA -> NS_FILE
272 if ( !is_null( $arg ) ) {
273 $text =
$title->$func( $arg );
279 return [
'found' => false ];
289 public static function formatnum( $parser, $num =
'', $arg =
null ) {
290 if ( self::matchAgainstMagicword( $parser->getMagicWordFactory(),
'rawsuffix', $arg ) ) {
291 $func = [ $parser->getFunctionLang(),
'parseFormattedNumber' ];
293 self::matchAgainstMagicword( $parser->getMagicWordFactory(),
'nocommafysuffix', $arg )
295 $func = [ $parser->getFunctionLang(),
'formatNumNoSeparators' ];
297 $func = [ $parser->getFunctionLang(),
'formatNum' ];
299 return $parser->markerSkipCallback( $num, $func );
308 public static function grammar( $parser, $case =
'', $word =
'' ) {
309 $word = $parser->killMarkers( $word );
310 return $parser->getFunctionLang()->convertGrammar( $word, $case );
319 public static function gender( $parser, $username, ...$forms ) {
321 if ( count( $forms ) === 0 ) {
323 } elseif ( count( $forms ) === 1 ) {
327 $username = trim( $username );
335 $username =
$title->getText();
340 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
342 $gender = $genderCache->getGenderOf( $user, __METHOD__ );
343 } elseif ( $username ===
'' && $parser->getOptions()->getInterfaceMessage() ) {
344 $gender = $genderCache->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
346 $ret = $parser->getFunctionLang()->gender( $gender, $forms );
356 public static function plural( $parser, $text =
'', ...$forms ) {
357 $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
358 settype( $text, ctype_digit( $text ) ?
'int' :
'float' );
359 return $parser->getFunctionLang()->convertPlural( $text, $forms );
367 public static function bidi( $parser, $text =
'' ) {
368 return $parser->getFunctionLang()->embedBidi( $text );
380 public static function displaytitle( $parser, $text =
'', $uarg =
'' ) {
385 $magicWords = $parser->getMagicWordFactory()->newArray(
386 [
'displaytitle_noerror',
'displaytitle_noreplace' ] );
391 $text = $parser->doQuotes( $text );
394 $text = $parser->killMarkers( $text );
398 $bad = [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'div',
'blockquote',
'ol',
'ul',
'li',
'hr',
399 'table',
'tr',
'th',
'td',
'dl',
'dd',
'caption',
'p',
'ruby',
'rb',
'rt',
'rtc',
'rp',
'br' ];
403 $htmlTagsCallback =
function ( &$params ) {
404 $decoded = Sanitizer::decodeTagAttributes( $params );
406 if ( isset( $decoded[
'style'] ) ) {
409 $decoded[
'style'] = Sanitizer::checkCss( $decoded[
'style'] );
411 if ( preg_match(
'/(display|user-select|visibility)\s*:/i', $decoded[
'style'] ) ) {
412 $decoded[
'style'] =
'/* attempt to bypass $wgRestrictDisplayTitle */';
416 $params = Sanitizer::safeEncodeTagAttributes( $decoded );
419 $htmlTagsCallback =
null;
425 $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
432 $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
437 &&
$title->equals( $parser->getTitle() ) )
439 $old = $parser->mOutput->getProperty(
'displaytitle' );
440 if ( $old ===
false || $arg !==
'displaytitle_noreplace' ) {
441 $parser->mOutput->setDisplayTitle( $text );
443 if ( $old !==
false && $old !== $text && !$arg ) {
444 $converter = $parser->getTargetLanguage()->getConverter();
445 return '<span class="error">' .
450 )->inContentLanguage()->text() .
456 $parser->getOutput()->addWarning(
462 $parser->addTrackingCategory(
'restricted-displaytitle-ignored' );
478 $value = trim( strval( $value ) );
479 if ( $value ===
'' ) {
482 $mwObject = $magicWordFactory->
get( $magicword );
483 return $mwObject->matchStartToEnd( $value );
498 if ( $raw !==
null && !$magicWordFactory ) {
499 $magicWordFactory = MediaWikiServices::getInstance()->getMagicWordFactory();
502 $raw !==
null && self::matchAgainstMagicword( $magicWordFactory,
'rawsuffix', $raw )
506 return $language->formatNum( $num );
534 $parser->getFunctionLang()
546 $parser->getFunctionLang()
554 $parser->getFunctionLang()
569 if ( is_null(
$t ) ) {
572 return str_replace(
'_',
' ',
$t->getNsText() );
577 if ( is_null(
$t ) ) {
585 if ( is_null(
$t ) ) {
588 return $t->getNamespace();
593 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
596 return str_replace(
'_',
' ',
$t->getTalkNsText() );
601 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
609 if ( is_null(
$t ) ) {
612 return str_replace(
'_',
' ',
$t->getSubjectNsText() );
617 if ( is_null(
$t ) ) {
632 if ( is_null(
$t ) ) {
640 if ( is_null(
$t ) ) {
648 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
656 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
664 if ( is_null(
$t ) ) {
672 if ( is_null(
$t ) ) {
680 if ( is_null(
$t ) ) {
688 if ( is_null(
$t ) ) {
696 if ( is_null(
$t ) ) {
704 if ( is_null(
$t ) ) {
712 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
720 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
728 if ( is_null(
$t ) ) {
736 if ( is_null(
$t ) ) {
752 public static function pagesincategory( $parser, $name =
'', $arg1 =
null, $arg2 =
null ) {
755 $magicWords = $parser->getMagicWordFactory()->newArray( [
756 'pagesincategory_all',
757 'pagesincategory_pages',
758 'pagesincategory_subcats',
759 'pagesincategory_files'
765 if ( self::matchAgainstMagicword( $parser->getMagicWordFactory(),
'rawsuffix', $arg1 ) ) {
775 $type =
'pagesincategory_all';
779 if ( !
$title ) { # invalid title
782 $parser->getContentLanguage()->findVariantLink( $name,
$title,
true );
785 $name =
$title->getDBkey();
787 if ( !isset(
$cache[$name] ) ) {
788 $category = Category::newFromTitle(
$title );
790 $allCount = $subcatCount = $fileCount = $pagesCount = 0;
791 if ( $parser->incrementExpensiveFunctionCount() ) {
794 $allCount = (int)$category->getPageCount();
795 $subcatCount = (int)$category->getSubcatCount();
796 $fileCount = (int)$category->getFileCount();
797 $pagesCount = $allCount - $subcatCount - $fileCount;
799 $cache[$name][
'pagesincategory_all'] = $allCount;
800 $cache[$name][
'pagesincategory_pages'] = $pagesCount;
801 $cache[$name][
'pagesincategory_subcats'] = $subcatCount;
802 $cache[$name][
'pagesincategory_files'] = $fileCount;
818 public static function pagesize( $parser, $page =
'', $raw =
null ) {
819 $title = Title::newFromText( $page );
821 if ( !is_object(
$title ) ) {
827 $length = $rev ? $rev->getSize() : 0;
828 if ( $length ===
null ) {
848 $titleObject = Title::newFromText(
$title ) ?? $parser->getTitle();
849 if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
850 $restrictions = $titleObject->getRestrictions( strtolower(
$type ) );
851 # Title::getRestrictions returns an array, its possible it may have
852 # multiple values in the future
853 return implode(
',', $restrictions );
871 $titleObject = Title::newFromText(
$title ) ?? $parser->getTitle();
872 if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
873 $expiry = $titleObject->getRestrictionExpiry( strtolower(
$type ) );
876 if ( $expiry ===
false ) {
891 public static function language( $parser, $code =
'', $inLanguage =
'' ) {
892 $code = strtolower( $code );
893 $inLanguage = strtolower( $inLanguage );
894 $lang = Language::fetchLanguageName( $code, $inLanguage );
895 return $lang !==
'' ?
$lang : LanguageCode::bcp47( $code );
907 public static function pad(
908 $parser, $string, $length, $padding =
'0', $direction = STR_PAD_RIGHT
910 $padding = $parser->killMarkers( $padding );
911 $lengthOfPadding = mb_strlen( $padding );
912 if ( $lengthOfPadding == 0 ) {
916 # The remaining length to add counts down to 0 as padding is added
917 $length = min( (
int)$length, 500 ) - mb_strlen( $string );
918 if ( $length <= 0 ) {
923 # $finalPadding is just $padding repeated enough times so that
924 # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length
926 while ( $length > 0 ) {
927 # If $length < $lengthofPadding, truncate $padding so we get the
928 # exact length desired.
929 $finalPadding .= mb_substr( $padding, 0, $length );
930 $length -= $lengthOfPadding;
933 if ( $direction == STR_PAD_LEFT ) {
934 return $finalPadding . $string;
936 return $string . $finalPadding;
940 public static function padleft( $parser, $string =
'', $length = 0, $padding =
'0' ) {
941 return self::pad( $parser, $string, $length, $padding, STR_PAD_LEFT );
944 public static function padright( $parser, $string =
'', $length = 0, $padding =
'0' ) {
945 return self::pad( $parser, $string, $length, $padding );
954 $text = $parser->killMarkers( $text );
955 $section = (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
956 return Sanitizer::safeEncodeAttribute( $section );
959 public static function special( $parser, $text ) {
960 list( $page, $subpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
961 resolveAlias( $text );
963 $title = SpecialPage::getTitleFor( $page, $subpage );
964 return $title->getPrefixedText();
972 public static function speciale( $parser, $text ) {
973 return wfUrlencode( str_replace(
' ',
'_', self::special( $parser, $text ) ) );
984 public static function defaultsort( $parser, $text, $uarg =
'' ) {
987 $magicWords = $parser->getMagicWordFactory()->newArray(
988 [
'defaultsort_noerror',
'defaultsort_noreplace' ] );
992 $text = trim( $text );
993 if ( strlen( $text ) == 0 ) {
996 $old = $parser->getCustomDefaultSort();
997 if ( $old ===
false || $arg !==
'defaultsort_noreplace' ) {
998 $parser->setDefaultSort( $text );
1001 if ( $old ===
false || $old == $text || $arg ) {
1004 $converter = $parser->getTargetLanguage()->getConverter();
1005 return '<span class="error">' .
1010 )->inContentLanguage()->text() .
1026 public static function filepath( $parser, $name =
'', $argA =
'', $argB =
'' ) {
1027 $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $name );
1029 if ( $argA ==
'nowiki' ) {
1032 $parsedWidthParam = Parser::parseWidthParam( $argB );
1035 $parsedWidthParam = Parser::parseWidthParam( $argA );
1036 $isNowiki = ( $argB ==
'nowiki' );
1040 $url =
$file->getFullUrl();
1043 if ( count( $parsedWidthParam ) ) {
1044 $mto =
$file->transform( $parsedWidthParam );
1046 if ( $mto && !$mto->isError() ) {
1052 return [ $url,
'nowiki' =>
true ];
1068 if ( !count(
$args ) ) {
1071 $tagName = strtolower( trim( $frame->expand( array_shift(
$args ) ) ) );
1073 if ( count(
$args ) ) {
1074 $inner = $frame->expand( array_shift(
$args ) );
1080 foreach (
$args as $arg ) {
1081 $bits = $arg->splitArg();
1082 if ( strval( $bits[
'index'] ) ===
'' ) {
1084 $value = trim( $frame->expand( $bits[
'value'] ) );
1085 if ( preg_match(
'/^(?:["\'](.+)["\']|""|\'\')$/s', $value, $m ) ) {
1086 $value = $m[1] ??
'';
1088 $attributes[$name] = $value;
1092 $stripList = $parser->getStripList();
1093 if ( !in_array( $tagName, $stripList ) ) {
1096 foreach ( $attributes as $name => $value ) {
1097 $attrText .=
' ' . htmlspecialchars( $name ) .
'="' . htmlspecialchars( $value ) .
'"';
1099 if ( $inner ===
null ) {
1100 return "<$tagName$attrText/>";
1102 return "<$tagName$attrText>$inner</$tagName>";
1108 'attributes' => $attributes,
1109 'close' =>
"</$tagName>",
1111 return $parser->extensionSubstitution( $params, $frame );
1134 $isSelfReferential =
$title->equals( $parser->getTitle() );
1135 if ( $isSelfReferential ) {
1139 $parserRevision = $parser->getRevisionObject();
1140 if ( $parserRevision && $parserRevision->isCurrent() ) {
1141 $revision = $parserRevision;
1142 wfDebug( __METHOD__ .
": used current revision, setting $vary" );
1146 $parserOutput = $parser->getOutput();
1149 !$parser->isCurrentRevisionOfTitleCached(
$title ) &&
1150 !$parser->incrementExpensiveFunctionCount()
1155 $revision = $parser->fetchCurrentRevisionOfTitle(
$title );
1157 $parserOutput->addTemplate(
1159 $revision ? $revision->getPage() : 0,
1160 $revision ? $revision->getId() : 0
1164 if ( $isSelfReferential ) {
1166 $parserOutput->setFlag( $vary );
1167 if ( $vary ===
'vary-revision-sha1' && $revision ) {
1168 $parserOutput->setRevisionUsedSha1Base36( $revision->getSha1() );
1186 } elseif ( !
$t->canExist() ||
$t->isExternal() ) {
1190 $parserOutput = $parser->getOutput();
1192 if (
$t->equals( $parser->getTitle() ) ) {
1195 $parserOutput->setFlag(
'vary-page-id' );
1196 $id = $parser->getTitle()->getArticleID();
1198 $parserOutput->setSpeculativePageIdUsed( $id );
1205 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
1206 $pdbk =
$t->getPrefixedDBkey();
1207 $id = $linkCache->getGoodLinkID( $pdbk );
1208 if ( $id != 0 || $linkCache->isBadLink( $pdbk ) ) {
1209 $parserOutput->addLink(
$t, $id );
1215 if ( $parser->incrementExpensiveFunctionCount() ) {
1216 $id =
$t->getArticleID();
1217 $parserOutput->addLink(
$t, $id );
1234 if ( is_null(
$t ) ) {
1239 return $rev ? $rev->getId() :
'';
1251 if ( is_null(
$t ) ) {
1256 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'j' ) :
'';
1268 if ( is_null(
$t ) ) {
1273 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'd' ) :
'';
1285 if ( is_null(
$t ) ) {
1290 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'm' ) :
'';
1302 if ( is_null(
$t ) ) {
1307 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'n' ) :
'';
1319 if ( is_null(
$t ) ) {
1324 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'Y' ) :
'';
1336 if ( is_null(
$t ) ) {
1341 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format(
'YmdHis' ) :
'';
1353 if ( is_null(
$t ) ) {
1358 return $rev ? $rev->getUserText() :
'';
1374 $titleObject = Title::newFromText(
$title ) ?? $parser->getTitle();
1375 if ( $titleObject->areCascadeProtectionSourcesLoaded()
1376 || $parser->incrementExpensiveFunctionCount()
1379 $sources = $titleObject->getCascadeProtectionSources();
1380 foreach ( $sources[0] as $sourceTitle ) {
1381 $names[] = $sourceTitle->getPrefixedText();
1383 return implode(
'|', $names );
$wgAllowDisplayTitle
Allow DISPLAYTITLE to change title display.
$wgRestrictDisplayTitle
For consistency, restrict DISPLAYTITLE to text that normalizes to the same canonical DB key.
$wgAllowSlowParserFunctions
Enable slow parser functions.
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,...
Various core parser functions, registered in Parser::firstCallInit()
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 pagesincategory( $parser, $name='', $arg1=null, $arg2=null)
Return the number of pages, files or subcats in the given category, or 0 if it's nonexistent.
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 getCachedRevisionObject( $parser, $title, $vary)
Fetched the current revision of the given title and return this.
static lc( $parser, $s='')
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 Note: fu...
static matchAgainstMagicword(MagicWordFactory $magicWordFactory, $magicword, $value)
Matches the given value against the value of given 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.
static numberingroup( $group)
Find the number of users in a given user group.
Represents a title within MediaWiki.
hasFragment()
Check if a Title fragment is set.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static getDefaultOption( $opt)
Get a given default option value.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!isset( $args[0])) $lang