MediaWiki master
MediaWiki\Parser\CoreParserFunctions Class Reference

Various core parser functions, registered in every Parser. More...

Static Public Member Functions

static anchorencode ( $parser, $text)
 
static basepagename ( $parser, $title=null)
 
static basepagenamee ( $parser, $title=null)
 
static bcp47 (Parser $parser, string $code='')
 Gives the BCP-47 code for a language given the mediawiki internal language code.
 
static bidi ( $parser, $text='')
 
static canonicalurl ( $parser, $s='', $arg=null)
 
static canonicalurle ( $parser, $s='', $arg=null)
 
static cascadingsources ( $parser, $title='')
 Returns the sources of any cascading protection acting on a specified page.
 
static categorysort ( $parser, $text='')
 Set the default ordering used when listing the members of a category.
 
static contentmodel (Parser $parser, ?string $format=null, ?string $title=null)
 
static defaultsort ( $parser, $text, $uarg='')
 
static dir (Parser $parser, string $code='', string $arg='')
 Gives direction of script of a language given a language code.
 
static displaytitle ( $parser, $text='', $uarg='')
 Override the title of the page when viewed, provided we've been given a title which will normalise to the canonical title.
 
static filepath ( $parser, $name='', $argA='', $argB='')
 Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}} or {{filepath|300px}}, {{filepath|200x300px}}, {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}}.
 
static formal (Parser $parser, string ... $forms)
 
static formatDate ( $parser, $date, $defaultPref=null)
 
static formatnum ( $parser, $num='', $arg1='', $arg2='')
 
static formatRaw ( $num, $raw, $language, ?MagicWordFactory $magicWordFactory=null)
 Formats a number according to a language.
 
static fullpagename ( $parser, $title=null)
 
static fullpagenamee ( $parser, $title=null)
 
static fullurl ( $parser, $s='', $arg=null)
 
static fullurle ( $parser, $s='', $arg=null)
 
static gender ( $parser, $username,... $forms)
 
static grammar ( $parser, $case='', $word='')
 
static interlanguagelink ( $parser, $prefix='', $title='', $linkText=null)
 
static interwikilink ( $parser, $prefix='', $title='', $linkText=null)
 
static intFunction ( $parser, $part1='',... $params)
 
static isbn ( $parser, $isbn='')
 
static language ( $parser, $code='', $inLanguage='')
 Gives language names.
 
static lc ( $parser, $s='')
 
static lcfirst ( $parser, $s='')
 
static localurl ( $parser, $s='', $arg=null)
 
static localurle ( $parser, $s='', $arg=null)
 
static namespacee ( $parser, $title=null)
 
static namespacenumber ( $parser, $title=null)
 
static ns ( $parser, $part1='')
 
static nse ( $parser, $part1='')
 
static numberingroup ( $parser, $name='', $raw=null)
 
static numberofactiveusers ( $parser, $raw=null)
 
static numberofadmins ( $parser, $raw=null)
 
static numberofarticles ( $parser, $raw=null)
 
static numberofedits ( $parser, $raw=null)
 
static numberoffiles ( $parser, $raw=null)
 
static numberofpages ( $parser, $raw=null)
 
static numberofusers ( $parser, $raw=null)
 
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 padleft ( $parser, $string='', $length='0', $padding='0')
 
static padright ( $parser, $string='', $length='0', $padding='0')
 
static pageid ( $parser, $title=null)
 Get the pageid of a specified page.
 
static pagename ( $parser, $title=null)
 Functions to get and normalize pagenames, corresponding to the magic words of the same names.
 
static pagenamee ( $parser, $title=null)
 
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 pagesinnamespace ( $parser, $namespace='0', $raw=null)
 
static pagesize ( $parser, $page='', $raw=null)
 Return the size of the given page, or 0 if it's nonexistent.
 
static plural ( $parser, $text='',... $forms)
 
static protectionexpiry ( $parser, $type='', $title='')
 Returns the requested protection expiry for the current page.
 
static protectionlevel ( $parser, $type='', $title='')
 Returns the requested protection level for the current page.
 
static register (Parser $parser, ServiceOptions $options)
 
static revisionday ( $parser, $title=null)
 Get the day 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 revisionid ( $parser, $title=null)
 Get the id from the last revision of a specified page.
 
static revisionmonth ( $parser, $title=null)
 Get the month with leading zeros from the last revision of a specified page.
 
static revisionmonth1 ( $parser, $title=null)
 Get the month from the last revision of a specified page.
 
static revisiontimestamp ( $parser, $title=null)
 Get the timestamp from the last revision of a specified page.
 
static revisionuser ( $parser, $title=null)
 Get the user from the last revision of a specified page.
 
static revisionyear ( $parser, $title=null)
 Get the year from the last revision of a specified page.
 
static rootpagename ( $parser, $title=null)
 
static rootpagenamee ( $parser, $title=null)
 
static special ( $parser, $text)
 
static speciale ( $parser, $text)
 
static subjectpagename ( $parser, $title=null)
 
static subjectpagenamee ( $parser, $title=null)
 
static subjectspace ( $parser, $title=null)
 
static subjectspacee ( $parser, $title=null)
 
static subpagename ( $parser, $title=null)
 
static subpagenamee ( $parser, $title=null)
 
static tagObj ( $parser, $frame, $args)
 Parser function to extension tag adaptor.
 
static talkpagename ( $parser, $title=null)
 
static talkpagenamee ( $parser, $title=null)
 
static talkspace ( $parser, $title=null)
 
static talkspacee ( $parser, $title=null)
 
static uc ( $parser, $s='')
 
static ucfirst ( $parser, $s='')
 
static urlencode ( $parser, $s='', $arg=null)
 urlencodes a string according to one of three patterns: (T24474)
 
static urlFunction ( $func, $s='', $arg=null)
 

Public Attributes

const REGISTER_OPTIONS
 

Detailed Description

Various core parser functions, registered in every Parser.

Definition at line 38 of file CoreParserFunctions.php.

Member Function Documentation

◆ anchorencode()

static MediaWiki\Parser\CoreParserFunctions::anchorencode ( $parser,
$text )
static
Parameters
Parser$parser
string$text
Returns
string

Definition at line 1383 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\guessSectionNameFromWikiText(), and MediaWiki\Parser\Parser\killMarkers().

◆ basepagename()

static MediaWiki\Parser\CoreParserFunctions::basepagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1024 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ basepagenamee()

static MediaWiki\Parser\CoreParserFunctions::basepagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1037 of file CoreParserFunctions.php.

References wfEscapeWikiText(), and wfUrlencode().

◆ bcp47()

static MediaWiki\Parser\CoreParserFunctions::bcp47 ( Parser $parser,
string $code = '' )
static

Gives the BCP-47 code for a language given the mediawiki internal language code.

Parameters
Parser$parser
string$codea language code. If missing, the parser target language will be used.
Returns
string the corresponding BCP-47 code

Definition at line 1306 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ bidi()

static MediaWiki\Parser\CoreParserFunctions::bidi ( $parser,
$text = '' )
static
Parameters
Parser$parser
string$text
Returns
string

Definition at line 544 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ canonicalurl()

static MediaWiki\Parser\CoreParserFunctions::canonicalurl ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 351 of file CoreParserFunctions.php.

◆ canonicalurle()

static MediaWiki\Parser\CoreParserFunctions::canonicalurle ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 361 of file CoreParserFunctions.php.

◆ cascadingsources()

static MediaWiki\Parser\CoreParserFunctions::cascadingsources ( $parser,
$title = '' )
static

Returns the sources of any cascading protection acting on a specified page.

Pages will not return their own title unless they transclude themselves. This is an expensive parser function and can't be called too many times per page, unless cascading protection sources for the page have already been loaded.

Parameters
Parser$parser
?string$title
Returns
string
Since
1.23

Definition at line 2000 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTitle(), and MediaWiki\Parser\Parser\incrementExpensiveFunctionCount().

◆ categorysort()

static MediaWiki\Parser\CoreParserFunctions::categorysort ( $parser,
$text = '' )
static

Set the default ordering used when listing the members of a category.

Usage: {{CATEGORYSORT:TIMESTAMP}} or {{CATEGORYSORT:RTIMESTAMP}} on a category page. TIMESTAMP orders members by the time they were added to the category, oldest first; RTIMESTAMP does the same with the most recently added members first. Readers can still override this with the 'cldsort' and 'cldorder' request parameters.

Since
1.47
Parameters
Parser$parser
string$textThe sort mode, either "TIMESTAMP" or "RTIMESTAMP" (in en)
Returns
string

Definition at line 1471 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getTargetLanguageConverter(), MediaWiki\Parser\Parser\msg(), and wfEscapeWikiText().

◆ contentmodel()

static MediaWiki\Parser\CoreParserFunctions::contentmodel ( Parser $parser,
?string $format = null,
?string $title = null )
static
Parameters
Parser$parser
?string$format
?string$title
Returns
string
Since
1.45

Definition at line 2024 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\getTargetLanguage(), MediaWiki\Parser\Parser\incrementExpensiveFunctionCount(), and wfEscapeWikiText().

◆ defaultsort()

static MediaWiki\Parser\CoreParserFunctions::defaultsort ( $parser,
$text,
$uarg = '' )
static
Parameters
Parser$parser
string$textThe sortkey to use
string$uargEither "noreplace" or "noerror" (in en) both suppress errors, and noreplace does nothing if a default sortkey already exists.
Returns
string

Definition at line 1426 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getTargetLanguageConverter(), MediaWiki\Parser\Parser\msg(), and wfEscapeWikiText().

◆ dir()

static MediaWiki\Parser\CoreParserFunctions::dir ( Parser $parser,
string $code = '',
string $arg = '' )
static

Gives direction of script of a language given a language code.

Parameters
Parser$parser
string$codea language code. If missing, the parser target language will be used.
string$argIf this optional argument matches the language_option_bcp47 magic word, the language code will be treated as a BCP-47 code.
Returns
string 'rtl' if the language code is recognized as right-to-left, otherwise returns 'ltr'

Definition at line 1272 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ displaytitle()

◆ filepath()

static MediaWiki\Parser\CoreParserFunctions::filepath ( $parser,
$name = '',
$argA = '',
$argB = '' )
static

Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}} or {{filepath|300px}}, {{filepath|200x300px}}, {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}}.

Parameters
Parser$parser
string$name
string$argA
string$argB
Returns
array|string

Definition at line 1509 of file CoreParserFunctions.php.

References $url, MediaWiki\Parser\Parser\parseWidthParam(), and PROTO_RELATIVE.

◆ formal()

static MediaWiki\Parser\CoreParserFunctions::formal ( Parser $parser,
string ... $forms )
static

Definition at line 534 of file CoreParserFunctions.php.

◆ formatDate()

static MediaWiki\Parser\CoreParserFunctions::formatDate ( $parser,
$date,
$defaultPref = null )
static
Parameters
Parser$parser
string$date
string | null$defaultPref
Returns
string

Definition at line 170 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Parser\Parser\getOptions(), and MediaWiki\Parser\Parser\getTargetLanguage().

◆ formatnum()

static MediaWiki\Parser\CoreParserFunctions::formatnum ( $parser,
$num = '',
$arg1 = '',
$arg2 = '' )
static
Parameters
Parser$parser
string$num
string$arg1
string$arg2
Returns
string

Definition at line 405 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\getTargetLanguage(), and MediaWiki\Parser\Parser\markerSkipCallback().

◆ formatRaw()

static MediaWiki\Parser\CoreParserFunctions::formatRaw ( $num,
$raw,
$language,
?MagicWordFactory $magicWordFactory = null )
static

Formats a number according to a language.

Parameters
int | float$num
?string$raw
Language$language
MagicWordFactory | null$magicWordFactoryTo evaluate $raw
Returns
string

Definition at line 692 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ fullpagename()

static MediaWiki\Parser\CoreParserFunctions::fullpagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 946 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ fullpagenamee()

static MediaWiki\Parser\CoreParserFunctions::fullpagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 959 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ fullurl()

static MediaWiki\Parser\CoreParserFunctions::fullurl ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 326 of file CoreParserFunctions.php.

◆ fullurle()

static MediaWiki\Parser\CoreParserFunctions::fullurle ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 336 of file CoreParserFunctions.php.

◆ gender()

static MediaWiki\Parser\CoreParserFunctions::gender ( $parser,
$username,
$forms )
static
Parameters
Parser$parser
string$username
string...$forms What to output for each gender
Returns
string

Definition at line 489 of file CoreParserFunctions.php.

References MediaWiki\User\Options\UserOptionsLookup\getDefaultOption(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Parser\Parser\getOptions(), MediaWiki\Parser\Parser\getTargetLanguage(), and NS_USER.

◆ grammar()

static MediaWiki\Parser\CoreParserFunctions::grammar ( $parser,
$case = '',
$word = '' )
static
Parameters
Parser$parser
string$case
string$word
Returns
string

Definition at line 478 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage(), and MediaWiki\Parser\Parser\killMarkers().

◆ interlanguagelink()

static MediaWiki\Parser\CoreParserFunctions::interlanguagelink ( $parser,
$prefix = '',
$title = '',
$linkText = null )
static
Parameters
Parser$parser
string$prefix
string$title
string | null$linkText
Returns
array|string

Definition at line 2141 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getOutput().

◆ interwikilink()

static MediaWiki\Parser\CoreParserFunctions::interwikilink ( $parser,
$prefix = '',
$title = '',
$linkText = null )
static
Parameters
Parser$parser
string$prefix
string$title
string | null$linkText
Returns
array|string

Definition at line 2101 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getOutput(), and MediaWiki\Parser\Parser\recursiveTagParseFully().

◆ intFunction()

static MediaWiki\Parser\CoreParserFunctions::intFunction ( $parser,
$part1 = '',
$params )
static
Parameters
Parser$parser
string$part1Message key
string...$params To pass to wfMessage()
Returns
array

Definition at line 153 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getOptions(), and wfMessage().

◆ isbn()

static MediaWiki\Parser\CoreParserFunctions::isbn ( $parser,
$isbn = '' )
static
Parameters
Parser$parser
string$isbn
Returns
array

Definition at line 2062 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getLinkRenderer(), and MediaWiki\Parser\Parser\getOutput().

◆ language()

static MediaWiki\Parser\CoreParserFunctions::language ( $parser,
$code = '',
$inLanguage = '' )
static

Gives language names.

Parameters
Parser$parser
string$codeLanguage code (of which to get name)
string$inLanguageLanguage code (in which to get name); if missing or empty, the language's autonym will be returned.
Returns
string

Definition at line 1248 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Parser\Parser\getTargetLanguage().

◆ lc()

static MediaWiki\Parser\CoreParserFunctions::lc ( $parser,
$s = '' )
static
Parameters
Parser$parser
string$s
Returns
string

Definition at line 282 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getContentLanguage(), and MediaWiki\Parser\Parser\markerSkipCallback().

◆ lcfirst()

static MediaWiki\Parser\CoreParserFunctions::lcfirst ( $parser,
$s = '' )
static
Parameters
Parser$parser
string$s
Returns
array|string

Definition at line 264 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getContentLanguage().

◆ localurl()

static MediaWiki\Parser\CoreParserFunctions::localurl ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 301 of file CoreParserFunctions.php.

◆ localurle()

static MediaWiki\Parser\CoreParserFunctions::localurle ( $parser,
$s = '',
$arg = null )
static
Parameters
Parser$parser
string$s
string | null$arg
Returns
array|string

Definition at line 311 of file CoreParserFunctions.php.

◆ namespacee()

static MediaWiki\Parser\CoreParserFunctions::namespacee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 840 of file CoreParserFunctions.php.

References wfUrlencode().

◆ namespacenumber()

static MediaWiki\Parser\CoreParserFunctions::namespacenumber ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 853 of file CoreParserFunctions.php.

◆ ns()

static MediaWiki\Parser\CoreParserFunctions::ns ( $parser,
$part1 = '' )
static
Parameters
Parser$parser
string$part1
Returns
array|string

Definition at line 193 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getContentLanguage().

◆ nse()

static MediaWiki\Parser\CoreParserFunctions::nse ( $parser,
$part1 = '' )
static
Parameters
Parser$parser
string$part1
Returns
array|string

Definition at line 211 of file CoreParserFunctions.php.

References wfUrlencode().

◆ numberingroup()

static MediaWiki\Parser\CoreParserFunctions::numberingroup ( $parser,
$name = '',
$raw = null )
static
Parameters
Parser$parser
string$name
string | null$raw
Returns
array|string

Definition at line 793 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofactiveusers()

static MediaWiki\Parser\CoreParserFunctions::numberofactiveusers ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 729 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofadmins()

static MediaWiki\Parser\CoreParserFunctions::numberofadmins ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 756 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofarticles()

static MediaWiki\Parser\CoreParserFunctions::numberofarticles ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 738 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofedits()

static MediaWiki\Parser\CoreParserFunctions::numberofedits ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 769 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberoffiles()

static MediaWiki\Parser\CoreParserFunctions::numberoffiles ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 747 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofpages()

static MediaWiki\Parser\CoreParserFunctions::numberofpages ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 711 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ numberofusers()

static MediaWiki\Parser\CoreParserFunctions::numberofusers ( $parser,
$raw = null )
static
Parameters
Parser$parser
string | null$raw
Returns
array|string

Definition at line 720 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ pad()

static MediaWiki\Parser\CoreParserFunctions::pad ( $parser,
$string,
$length,
$padding = '0',
$direction = STR_PAD_RIGHT )
static

Unicode-safe str_pad with the restriction that $length is forced to be <= 500.

Parameters
Parser$parser
string$string
string$length
string$padding
int$direction
Returns
string

Definition at line 1323 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\killMarkers().

◆ padleft()

static MediaWiki\Parser\CoreParserFunctions::padleft ( $parser,
$string = '',
$length = '0',
$padding = '0' )
static
Parameters
Parser$parser
string$string
string$length
string$padding
Returns
string

Definition at line 1363 of file CoreParserFunctions.php.

◆ padright()

static MediaWiki\Parser\CoreParserFunctions::padright ( $parser,
$string = '',
$length = '0',
$padding = '0' )
static
Parameters
Parser$parser
string$string
string$length
string$padding
Returns
string

Definition at line 1374 of file CoreParserFunctions.php.

◆ pageid()

static MediaWiki\Parser\CoreParserFunctions::pageid ( $parser,
$title = null )
static

Get the pageid of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the pageid from
Returns
int|null|string
Since
1.23

Definition at line 1710 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getTitle(), and MediaWiki\Parser\Parser\incrementExpensiveFunctionCount().

◆ pagename()

static MediaWiki\Parser\CoreParserFunctions::pagename ( $parser,
$title = null )
static

Functions to get and normalize pagenames, corresponding to the magic words of the same names.

Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 920 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ pagenamee()

static MediaWiki\Parser\CoreParserFunctions::pagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 933 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ pagesincategory()

static MediaWiki\Parser\CoreParserFunctions::pagesincategory ( $parser,
$name = '',
$arg1 = '',
$arg2 = '' )
static

Return the number of pages, files or subcats in the given category, or 0 if it's nonexistent.

This is an expensive parser function and can't be called too many times per page.

Parameters
Parser$parser
string$name
string$arg1
string$arg2
Returns
string

Definition at line 1109 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getContentLanguage(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\getTargetLanguage(), MediaWiki\Parser\Parser\incrementExpensiveFunctionCount(), and NS_CATEGORY.

◆ pagesinnamespace()

static MediaWiki\Parser\CoreParserFunctions::pagesinnamespace ( $parser,
$namespace = '0',
$raw = null )
static
Parameters
Parser$parser
string$namespace
string | null$raw
Returns
array|string

Definition at line 779 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ pagesize()

static MediaWiki\Parser\CoreParserFunctions::pagesize ( $parser,
$page = '',
$raw = null )
static

Return the size of the given page, or 0 if it's nonexistent.

This is an expensive parser function and can't be called too many times per page.

Parameters
Parser$parser
string$pageName of page to check (Default: empty string)
string | null$rawShould number be human readable with commas or just number
Returns
string

Definition at line 1176 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ plural()

static MediaWiki\Parser\CoreParserFunctions::plural ( $parser,
$text = '',
$forms )
static
Parameters
Parser$parser
string$text
string...$forms What to output for each number (singular, dual, plural, etc.)
Returns
string

Definition at line 527 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getTargetLanguage().

◆ protectionexpiry()

static MediaWiki\Parser\CoreParserFunctions::protectionexpiry ( $parser,
$type = '',
$title = '' )
static

Returns the requested protection expiry for the current page.

This is an expensive parser function and can't be called too many times per page, unless the protection levels/expiries for the given title have already been retrieved

Parameters
Parser$parser
string$type
string$title
Returns
string

Definition at line 1229 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Parser\Parser\getTitle(), and MediaWiki\Parser\Parser\incrementExpensiveFunctionCount().

◆ protectionlevel()

static MediaWiki\Parser\CoreParserFunctions::protectionlevel ( $parser,
$type = '',
$title = '' )
static

Returns the requested protection level for the current page.

This is an expensive parser function and can't be called too many times per page, unless the protection levels/expiries for the given title have already been retrieved

Parameters
Parser$parser
string$type
string$title
Returns
string

Definition at line 1205 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Parser\Parser\getTitle(), and MediaWiki\Parser\Parser\incrementExpensiveFunctionCount().

◆ register()

static MediaWiki\Parser\CoreParserFunctions::register ( Parser $parser,
ServiceOptions $options )
static

◆ revisionday()

static MediaWiki\Parser\CoreParserFunctions::revisionday ( $parser,
$title = null )
static

Get the day from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the day from
Returns
string
Since
1.23

Definition at line 1864 of file CoreParserFunctions.php.

◆ revisionday2()

static MediaWiki\Parser\CoreParserFunctions::revisionday2 ( $parser,
$title = null )
static

Get the day with leading zeros from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the day from
Returns
string
Since
1.23

Definition at line 1881 of file CoreParserFunctions.php.

◆ revisionid()

static MediaWiki\Parser\CoreParserFunctions::revisionid ( $parser,
$title = null )
static

Get the id from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the id from
Returns
int|null|string
Since
1.23

Definition at line 1760 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getMiserMode(), MediaWiki\Parser\Parser\getNamespaceInfo(), MediaWiki\Parser\Parser\getOptions(), MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getRevisionId(), MediaWiki\Parser\Parser\getRevisionRecordObject(), and MediaWiki\Parser\Parser\getTitle().

◆ revisionmonth()

static MediaWiki\Parser\CoreParserFunctions::revisionmonth ( $parser,
$title = null )
static

Get the month with leading zeros from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the month from
Returns
string
Since
1.23

Definition at line 1898 of file CoreParserFunctions.php.

◆ revisionmonth1()

static MediaWiki\Parser\CoreParserFunctions::revisionmonth1 ( $parser,
$title = null )
static

Get the month from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the month from
Returns
string
Since
1.23

Definition at line 1915 of file CoreParserFunctions.php.

◆ revisiontimestamp()

static MediaWiki\Parser\CoreParserFunctions::revisiontimestamp ( $parser,
$title = null )
static

Get the timestamp from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the timestamp from
Returns
string
Since
1.23

Definition at line 1949 of file CoreParserFunctions.php.

◆ revisionuser()

static MediaWiki\Parser\CoreParserFunctions::revisionuser ( $parser,
$title = null )
static

Get the user from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the user from
Returns
string
Since
1.23

Definition at line 1966 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getRevisionUser(), and MediaWiki\Parser\Parser\getTitle().

◆ revisionyear()

static MediaWiki\Parser\CoreParserFunctions::revisionyear ( $parser,
$title = null )
static

Get the year from the last revision of a specified page.

Parameters
Parser$parser
string | null$titleTitle to get the year from
Returns
string
Since
1.23

Definition at line 1932 of file CoreParserFunctions.php.

◆ rootpagename()

static MediaWiki\Parser\CoreParserFunctions::rootpagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 998 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ rootpagenamee()

static MediaWiki\Parser\CoreParserFunctions::rootpagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1011 of file CoreParserFunctions.php.

References wfEscapeWikiText(), and wfUrlencode().

◆ special()

static MediaWiki\Parser\CoreParserFunctions::special ( $parser,
$text )
static
Parameters
Parser$parser
string$text
Returns
string

Definition at line 1396 of file CoreParserFunctions.php.

References NS_SPECIAL.

◆ speciale()

static MediaWiki\Parser\CoreParserFunctions::speciale ( $parser,
$text )
static
Parameters
Parser$parser
string$text
Returns
string

Definition at line 1414 of file CoreParserFunctions.php.

References wfUrlencode().

◆ subjectpagename()

static MediaWiki\Parser\CoreParserFunctions::subjectpagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1076 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), and wfEscapeWikiText().

◆ subjectpagenamee()

static MediaWiki\Parser\CoreParserFunctions::subjectpagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1090 of file CoreParserFunctions.php.

References MediaWiki\MediaWikiServices\getInstance(), and wfEscapeWikiText().

◆ subjectspace()

static MediaWiki\Parser\CoreParserFunctions::subjectspace ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 892 of file CoreParserFunctions.php.

◆ subjectspacee()

static MediaWiki\Parser\CoreParserFunctions::subjectspacee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 905 of file CoreParserFunctions.php.

References wfUrlencode().

◆ subpagename()

static MediaWiki\Parser\CoreParserFunctions::subpagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 972 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ subpagenamee()

static MediaWiki\Parser\CoreParserFunctions::subpagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 985 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ tagObj()

static MediaWiki\Parser\CoreParserFunctions::tagObj ( $parser,
$frame,
$args )
static

◆ talkpagename()

static MediaWiki\Parser\CoreParserFunctions::talkpagename ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1050 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ talkpagenamee()

static MediaWiki\Parser\CoreParserFunctions::talkpagenamee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
string

Definition at line 1063 of file CoreParserFunctions.php.

References wfEscapeWikiText().

◆ talkspace()

static MediaWiki\Parser\CoreParserFunctions::talkspace ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 866 of file CoreParserFunctions.php.

◆ talkspacee()

static MediaWiki\Parser\CoreParserFunctions::talkspacee ( $parser,
$title = null )
static
Parameters
Parser$parser
string | null$title
Returns
array|string

Definition at line 879 of file CoreParserFunctions.php.

References wfUrlencode().

◆ uc()

static MediaWiki\Parser\CoreParserFunctions::uc ( $parser,
$s = '' )
static
Parameters
Parser$parser
string$s
Returns
string

Definition at line 291 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getContentLanguage(), and MediaWiki\Parser\Parser\markerSkipCallback().

◆ ucfirst()

static MediaWiki\Parser\CoreParserFunctions::ucfirst ( $parser,
$s = '' )
static
Parameters
Parser$parser
string$s
Returns
array|string

Definition at line 273 of file CoreParserFunctions.php.

References MediaWiki\Parser\Parser\getContentLanguage().

◆ urlencode()

static MediaWiki\Parser\CoreParserFunctions::urlencode ( $parser,
$s = '',
$arg = null )
static

urlencodes a string according to one of three patterns: (T24474)

By default (for HTTP "query" strings), spaces are encoded as '+'. Or to encode a value for the HTTP "path", spaces are encoded as '%20'. For links to "wiki"s, or similar software, spaces are encoded as '_',

Parameters
Parser$parser
string$sThe text to encode.
string | null$arg(optional): The type of encoding.
Returns
string

Definition at line 231 of file CoreParserFunctions.php.

References $magicWords, MediaWiki\Parser\Parser\getMagicWordFactory(), MediaWiki\Parser\Parser\killMarkers(), MediaWiki\Parser\CoreParserFunctions\urlencode(), and wfUrlencode().

Referenced by MediaWiki\Parser\CoreParserFunctions\urlencode().

◆ urlFunction()

static MediaWiki\Parser\CoreParserFunctions::urlFunction ( $func,
$s = '',
$arg = null )
static
Parameters
string$func
string$s
string | null$arg
Returns
array|string

Definition at line 376 of file CoreParserFunctions.php.

References MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable\makeTitle(), NS_FILE, and NS_MEDIA.

Member Data Documentation

◆ REGISTER_OPTIONS

const MediaWiki\Parser\CoreParserFunctions::REGISTER_OPTIONS
Initial value:
= [
]
const AllowSlowParserFunctions
Name constant for the AllowSlowParserFunctions setting, for use with Config::get()
const AllowDisplayTitle
Name constant for the AllowDisplayTitle setting, for use with Config::get()
Access: internal

Definition at line 45 of file CoreParserFunctions.php.


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