MediaWiki  REL1_22
CoreParserFunctions Class Reference

Various core parser functions, registered in Parser::firstCallInit() More...

List of all members.

Static Public Member Functions

static anchorencode ($parser, $text)
static basepagename ($parser, $title=null)
static basepagenamee ($parser, $title=null)
static canonicalurl ($parser, $s= '', $arg=null)
static canonicalurle ($parser, $s= '', $arg=null)
static defaultsort ($parser, $text, $uarg= '')
static displaytitle ($parser, $text= '')
 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= '')
static formatDate ($parser, $date, $defaultPref=null)
static formatnum ($parser, $num= '', $arg=null)
static formatRaw ($num, $raw)
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)
static grammar ($parser, $case= '', $word= '')
static intFunction ($parser, $part1= '')
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 mwnamespace ($parser, $title=null)
 Given a title, return the namespace name that would be given by the corresponding magic word Note: function name changed to "mwnamespace" rather than "namespace" to not break PHP 5.3.
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 numberofviews ($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 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=null, $arg2=null)
 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= '')
static protectionlevel ($parser, $type= '', $title= '')
 Returns the requested protection level for the current page.
static register ($parser)
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: (bug 22474)
static urlFunction ($func, $s= '', $arg=null)

Static Private Member Functions

static matchAgainstMagicword ($magicword, $value)
 Matches the given value against the value of given magic word.

Detailed Description

Various core parser functions, registered in Parser::firstCallInit()

Definition at line 28 of file CoreParserFunctions.php.


Member Function Documentation

static CoreParserFunctions::anchorencode ( parser,
text 
) [static]
Parameters:
$parserParser
$text
Returns:
string

Definition at line 813 of file CoreParserFunctions.php.

References $parser.

static CoreParserFunctions::basepagename ( parser,
title = null 
) [static]

Definition at line 587 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::basepagenamee ( parser,
title = null 
) [static]

Definition at line 594 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::canonicalurl ( parser,
s = '',
arg = null 
) [static]

Definition at line 245 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::canonicalurle ( parser,
s = '',
arg = null 
) [static]

Definition at line 246 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::defaultsort ( parser,
text,
uarg = '' 
) [static]
Parameters:
$parserParser
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 842 of file CoreParserFunctions.php.

References $magicWords, $parser, array(), wfEscapeWikiText(), and wfMessage().

static CoreParserFunctions::displaytitle ( parser,
text = '' 
) [static]

Override the title of the page when viewed, provided we've been given a title which will normalise to the canonical title.

Parameters:
$parserParser: parent parser
string$textdesired title text
Returns:
String

Definition at line 363 of file CoreParserFunctions.php.

References $params, $parser, $title, array(), Sanitizer\checkCss(), Sanitizer\decodeTagAttributes(), global, Parser\MARKER_SUFFIX, Title\newFromText(), Sanitizer\normalizeCharReferences(), Sanitizer\removeHTMLtags(), Sanitizer\safeEncodeTagAttributes(), and Sanitizer\stripAllTags().

static CoreParserFunctions::filepath ( parser,
name = '',
argA = '',
argB = '' 
) [static]

Definition at line 874 of file CoreParserFunctions.php.

References $file, $name, $parser, array(), wfExpandUrl(), and wfFindFile().

static CoreParserFunctions::formatDate ( parser,
date,
defaultPref = null 
) [static]
Parameters:
$parserParser
$date
null$defaultPref
Returns:
mixed|string

Definition at line 133 of file CoreParserFunctions.php.

References $parser, array(), and DateFormatter\getInstance().

static CoreParserFunctions::formatnum ( parser,
num = '',
arg = null 
) [static]
Parameters:
$parserParser
string$num
string$arg
Returns:
string

Definition at line 279 of file CoreParserFunctions.php.

References $parser, and array().

static CoreParserFunctions::fullpagename ( parser,
title = null 
) [static]

Definition at line 545 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::fullpagenamee ( parser,
title = null 
) [static]

Definition at line 552 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::fullurl ( parser,
s = '',
arg = null 
) [static]

Definition at line 243 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::fullurle ( parser,
s = '',
arg = null 
) [static]

Definition at line 244 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::gender ( parser,
username 
) [static]
Parameters:
$parserParser
$usernamestring
Returns:

Definition at line 306 of file CoreParserFunctions.php.

References $parser, $ret, $title, $user, User\getDefaultOption(), User\newFromName(), Title\newFromText(), GenderCache\singleton(), wfProfileIn(), and wfProfileOut().

static CoreParserFunctions::grammar ( parser,
case = '',
word = '' 
) [static]
Parameters:
$parserParser
string$case
string$word
Returns:

Definition at line 296 of file CoreParserFunctions.php.

References $parser.

static CoreParserFunctions::intFunction ( parser,
part1 = '' 
) [static]
Parameters:
$parserParser
string$part1
Returns:
array

Definition at line 117 of file CoreParserFunctions.php.

References $parser, array(), and wfMessage().

static CoreParserFunctions::language ( parser,
code = '',
inLanguage = '' 
) [static]

Gives language names.

Parameters:
$parserParser
string$codeLanguage code (of which to get name)
string$inLanguageLanguage code (in which to get name)
Returns:
String

Definition at line 763 of file CoreParserFunctions.php.

References Language\fetchLanguageName(), and wfBCP47().

static CoreParserFunctions::lc ( parser,
s = '' 
) [static]
Parameters:
$parserParser
string$s
Returns:

Definition at line 226 of file CoreParserFunctions.php.

References $parser, $s, $wgContLang, array(), and global.

static CoreParserFunctions::lcfirst ( parser,
s = '' 
) [static]

Definition at line 211 of file CoreParserFunctions.php.

References $s, $wgContLang, and global.

static CoreParserFunctions::localurl ( parser,
s = '',
arg = null 
) [static]

Definition at line 241 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::localurle ( parser,
s = '',
arg = null 
) [static]

Definition at line 242 of file CoreParserFunctions.php.

References $s, and urlFunction().

static CoreParserFunctions::matchAgainstMagicword ( magicword,
value 
) [static, private]

Matches the given value against the value of given magic word.

Parameters:
string$magicwordmagic word key
mixed$valuevalue to match
Returns:
boolean true on successful match

Definition at line 421 of file CoreParserFunctions.php.

References $value, and MagicWord\get().

static CoreParserFunctions::mwnamespace ( parser,
title = null 
) [static]

Given a title, return the namespace name that would be given by the corresponding magic word Note: function name changed to "mwnamespace" rather than "namespace" to not break PHP 5.3.

Returns:
mixed|string

Definition at line 476 of file CoreParserFunctions.php.

References $t, $title, and Title\newFromText().

static CoreParserFunctions::namespacee ( parser,
title = null 
) [static]

Definition at line 483 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfUrlencode().

static CoreParserFunctions::namespacenumber ( parser,
title = null 
) [static]

Definition at line 490 of file CoreParserFunctions.php.

References $t, $title, and Title\newFromText().

static CoreParserFunctions::ns ( parser,
part1 = '' 
) [static]

Definition at line 151 of file CoreParserFunctions.php.

References $wgContLang, array(), and global.

Referenced by nse().

static CoreParserFunctions::nse ( parser,
part1 = '' 
) [static]

Definition at line 165 of file CoreParserFunctions.php.

References $parser, $ret, ns(), and wfUrlencode().

static CoreParserFunctions::numberingroup ( parser,
name = '',
raw = null 
) [static]

Definition at line 465 of file CoreParserFunctions.php.

References $name, formatRaw(), and SiteStats\numberingroup().

static CoreParserFunctions::numberofactiveusers ( parser,
raw = null 
) [static]

Definition at line 443 of file CoreParserFunctions.php.

References SiteStats\activeUsers(), and formatRaw().

static CoreParserFunctions::numberofadmins ( parser,
raw = null 
) [static]

Definition at line 452 of file CoreParserFunctions.php.

References formatRaw(), and SiteStats\numberingroup().

static CoreParserFunctions::numberofarticles ( parser,
raw = null 
) [static]

Definition at line 446 of file CoreParserFunctions.php.

References SiteStats\articles(), and formatRaw().

static CoreParserFunctions::numberofedits ( parser,
raw = null 
) [static]

Definition at line 455 of file CoreParserFunctions.php.

References SiteStats\edits(), and formatRaw().

static CoreParserFunctions::numberoffiles ( parser,
raw = null 
) [static]

Definition at line 449 of file CoreParserFunctions.php.

References formatRaw(), and SiteStats\images().

static CoreParserFunctions::numberofpages ( parser,
raw = null 
) [static]

Definition at line 437 of file CoreParserFunctions.php.

References formatRaw(), and SiteStats\pages().

static CoreParserFunctions::numberofusers ( parser,
raw = null 
) [static]

Definition at line 440 of file CoreParserFunctions.php.

References formatRaw(), and SiteStats\users().

static CoreParserFunctions::numberofviews ( parser,
raw = null 
) [static]

Definition at line 458 of file CoreParserFunctions.php.

References $wgDisableCounters, formatRaw(), global, and SiteStats\views().

static 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.

Returns:
string

Definition at line 774 of file CoreParserFunctions.php.

References $parser.

Referenced by padleft(), and padright().

static CoreParserFunctions::padleft ( parser,
string = '',
length = 0,
padding = '0' 
) [static]

Definition at line 800 of file CoreParserFunctions.php.

References $parser, and pad().

static CoreParserFunctions::padright ( parser,
string = '',
length = 0,
padding = '0' 
) [static]

Definition at line 804 of file CoreParserFunctions.php.

References $parser, and pad().

static CoreParserFunctions::pagename ( parser,
title = null 
) [static]

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

Returns:
String

Definition at line 531 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::pagenamee ( parser,
title = null 
) [static]

Definition at line 538 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::pagesincategory ( parser,
name = '',
arg1 = null,
arg2 = null 
) [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.

Returns:
string

Definition at line 636 of file CoreParserFunctions.php.

References $cache, $count, $magicWords, $name, $parser, $title, $wgContLang, array(), formatRaw(), global, Title\makeTitleSafe(), Category\newFromTitle(), and title.

static CoreParserFunctions::pagesinnamespace ( parser,
namespace = 0,
raw = null 
) [static]

Definition at line 462 of file CoreParserFunctions.php.

References formatRaw(), and SiteStats\pagesInNs().

static 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.

Todo:

FIXME: Title::getLength() documentation claims that it adds things to the link cache, so the local cache here should be unnecessary, but in fact calling getLength() repeatedly for the same $page does seem to run one query for each call?

Document parameters

Parameters:
$parserParser
$pageString Name of page to check (Default: empty string)
$rawString Should number be human readable with commas or just number
Returns:
string

Definition at line 709 of file CoreParserFunctions.php.

References $cache, $parser, $rev, $title, array(), formatRaw(), Title\newFromText(), Revision\newFromTitle(), and IDBAccessObject\READ_NORMAL.

static CoreParserFunctions::plural ( parser,
text = '' 
) [static]
Parameters:
$parserParser
string$text
Returns:

Definition at line 348 of file CoreParserFunctions.php.

References $parser.

static CoreParserFunctions::protectionlevel ( parser,
type = '',
title = '' 
) [static]

Returns the requested protection level for the current page.

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

Definition at line 745 of file CoreParserFunctions.php.

References $parser, $title, and Title\newFromText().

static CoreParserFunctions::register ( parser) [static]
Parameters:
$parserParser
Returns:
void

Definition at line 33 of file CoreParserFunctions.php.

References $parser, array(), and global.

static CoreParserFunctions::rootpagename ( parser,
title = null 
) [static]

Definition at line 573 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::rootpagenamee ( parser,
title = null 
) [static]

Definition at line 580 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::special ( parser,
text 
) [static]
static CoreParserFunctions::speciale ( parser,
text 
) [static]

Definition at line 830 of file CoreParserFunctions.php.

References $parser, and wfUrlencode().

static CoreParserFunctions::subjectpagename ( parser,
title = null 
) [static]

Definition at line 615 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::subjectpagenamee ( parser,
title = null 
) [static]

Definition at line 622 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::subjectspace ( parser,
title = null 
) [static]

Definition at line 511 of file CoreParserFunctions.php.

References $t, $title, and Title\newFromText().

static CoreParserFunctions::subjectspacee ( parser,
title = null 
) [static]

Definition at line 518 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfUrlencode().

static CoreParserFunctions::subpagename ( parser,
title = null 
) [static]

Definition at line 559 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::subpagenamee ( parser,
title = null 
) [static]

Definition at line 566 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::tagObj ( parser,
frame,
args 
) [static]

Parser function to extension tag adaptor.

Returns:
string

Definition at line 912 of file CoreParserFunctions.php.

References $name, $params, $parser, $value, array(), as, PPFrame\STRIP_COMMENTS, and wfMessage().

static CoreParserFunctions::talkpagename ( parser,
title = null 
) [static]

Definition at line 601 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::talkpagenamee ( parser,
title = null 
) [static]

Definition at line 608 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfEscapeWikiText().

static CoreParserFunctions::talkspace ( parser,
title = null 
) [static]

Definition at line 497 of file CoreParserFunctions.php.

References $t, $title, and Title\newFromText().

static CoreParserFunctions::talkspacee ( parser,
title = null 
) [static]

Definition at line 504 of file CoreParserFunctions.php.

References $t, $title, Title\newFromText(), and wfUrlencode().

static CoreParserFunctions::uc ( parser,
s = '' 
) [static]
Parameters:
$parserParser
string$s
Returns:

Definition at line 236 of file CoreParserFunctions.php.

References $parser, $s, $wgContLang, array(), and global.

static CoreParserFunctions::ucfirst ( parser,
s = '' 
) [static]

Definition at line 216 of file CoreParserFunctions.php.

References $s, $wgContLang, and global.

static CoreParserFunctions::urlencode ( parser,
s = '',
arg = null 
) [static]

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

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:
$parserParser object
string$sThe text to encode.
string$arg(optional): The type of encoding.
Returns:
string

Definition at line 185 of file CoreParserFunctions.php.

References $magicWords, $parser, $s, and array().

static CoreParserFunctions::urlFunction ( func,
s = '',
arg = null 
) [static]

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