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 );
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' ] );
78 [ __CLASS__,
'displaytitle' ],
85 [ __CLASS__,
'pagesinnamespace' ],
97 if ( strval( $part1 ) !==
'' ) {
98 $args = array_slice( func_get_args(), 2 );
100 ->inLanguage(
$parser->getOptions()->getUserLangObj() );
101 if ( !$message->exists() ) {
104 return $message->escaped();
106 return [ $message->plain(),
'noparse' =>
false ];
108 return [
'found' =>
false ];
123 $date = trim( $date );
125 $pref =
$parser->getOptions()->getDateFormat();
129 if ( $pref ==
'default' && $defaultPref ) {
130 $pref = $defaultPref;
133 $date = $df->reformat( $pref, $date, [
'match-whole' ] );
139 if ( intval( $part1 ) || $part1 ==
"0" ) {
140 $index = intval( $part1 );
142 $index =
$wgContLang->getNsIndex( str_replace(
' ',
'_', $part1 ) );
144 if ( $index !==
false ) {
147 return [
'found' =>
false ];
153 if ( is_string(
$ret ) ) {
179 $func =
'wfUrlencode';
180 $s = str_replace(
' ',
'_',
$s );
185 $func =
'rawurlencode';
195 return $func(
$parser->killMarkers(
$s ) );
234 if ( !is_string( $temp ) ) {
237 return htmlspecialchars( $temp );
247 if ( !is_string( $temp ) ) {
250 return htmlspecialchars( $temp );
260 if ( !is_string( $temp ) ) {
263 return htmlspecialchars( $temp );
268 $title = Title::newFromText(
$s );
269 # Due to order of execution of a lot of bits, the values might be encoded
270 # before arriving here; if that's true, then the title can't be created
271 # and the variable will fail. If we can't get a decent title from the first
272 # attempt, url-decode and try for a second.
273 if ( is_null( $title ) ) {
274 $title = Title::newFromURL( urldecode(
$s ) );
276 if ( !is_null( $title ) ) {
277 # Convert NS_MEDIA -> NS_FILE
278 if ( $title->inNamespace(
NS_MEDIA ) ) {
279 $title = Title::makeTitle(
NS_FILE, $title->getDBkey() );
281 if ( !is_null( $arg ) ) {
282 $text = $title->$func( $arg );
284 $text = $title->$func();
288 return [
'found' =>
false ];
299 if ( self::matchAgainstMagicword(
'rawsuffix', $arg ) ) {
300 $func = [
$parser->getFunctionLang(),
'parseFormattedNumber' ];
301 } elseif ( self::matchAgainstMagicword(
'nocommafysuffix', $arg ) ) {
302 $func = [
$parser->getFunctionLang(),
'formatNumNoSeparators' ];
304 $func = [
$parser->getFunctionLang(),
'formatNum' ];
306 return $parser->markerSkipCallback( $num, $func );
316 $word =
$parser->killMarkers( $word );
317 return $parser->getFunctionLang()->convertGrammar( $word, $case );
326 $forms = array_slice( func_get_args(), 2 );
329 if ( count( $forms ) === 0 ) {
331 } elseif ( count( $forms ) === 1 ) {
341 $title = Title::newFromText(
$username, NS_USER );
343 if ( $title && $title->inNamespace( NS_USER ) ) {
349 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
351 $gender = $genderCache->getGenderOf( $user, __METHOD__ );
352 } elseif (
$username ===
'' &&
$parser->getOptions()->getInterfaceMessage() ) {
353 $gender = $genderCache->getGenderOf(
$parser->getOptions()->getUser(), __METHOD__ );
355 $ret =
$parser->getFunctionLang()->gender( $gender, $forms );
365 $forms = array_slice( func_get_args(), 2 );
366 $text =
$parser->getFunctionLang()->parseFormattedNumber( $text );
367 settype( $text, ctype_digit( $text ) ?
'int' :
'float' );
368 return $parser->getFunctionLang()->convertPlural( $text, $forms );
377 return $parser->getFunctionLang()->embedBidi( $text );
399 $text =
$parser->doQuotes( $text );
402 $text =
$parser->killMarkers( $text );
406 $bad = [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'div',
'blockquote',
'ol',
'ul',
'li',
'hr',
407 'table',
'tr',
'th',
'td',
'dl',
'dd',
'caption',
'p',
'ruby',
'rb',
'rt',
'rtc',
'rp',
'br' ];
411 $htmlTagsCallback =
function ( &
$params ) {
412 $decoded = Sanitizer::decodeTagAttributes(
$params );
414 if ( isset( $decoded[
'style'] ) ) {
417 $decoded[
'style'] = Sanitizer::checkCss( $decoded[
'style'] );
419 if ( preg_match(
'/(display|user-select|visibility)\s*:/i', $decoded[
'style'] ) ) {
420 $decoded[
'style'] =
'/* attempt to bypass $wgRestrictDisplayTitle */';
424 $params = Sanitizer::safeEncodeTagAttributes( $decoded );
427 $htmlTagsCallback =
null;
433 $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
440 $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
443 ( $title instanceof
Title
445 && $title->equals(
$parser->mTitle ) )
447 $old =
$parser->mOutput->getProperty(
'displaytitle' );
448 if ( $old ===
false || $arg !==
'displaytitle_noreplace' ) {
449 $parser->mOutput->setDisplayTitle( $text );
451 if ( $old !==
false && $old !== $text && !$arg ) {
452 $converter =
$parser->getConverterLanguage()->getConverter();
453 return '<span class="error">' .
458 )->inContentLanguage()->text() .
464 $converter =
$parser->getConverterLanguage()->getConverter();
465 $parser->getOutput()->addWarning(
471 $parser->addTrackingCategory(
'restricted-displaytitle-ignored' );
488 return $mwObject->matchStartToEnd(
$value );
499 public static function formatRaw( $num, $raw, $language ) {
500 if ( self::matchAgainstMagicword(
'rawsuffix', $raw ) ) {
503 return $language->formatNum( $num );
563 $t = Title::newFromText( $title );
564 if ( is_null(
$t ) ) {
567 return str_replace(
'_',
' ',
$t->getNsText() );
570 $t = Title::newFromText( $title );
571 if ( is_null(
$t ) ) {
577 $t = Title::newFromText( $title );
578 if ( is_null(
$t ) ) {
581 return $t->getNamespace();
584 $t = Title::newFromText( $title );
585 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
588 return str_replace(
'_',
' ',
$t->getTalkNsText() );
591 $t = Title::newFromText( $title );
592 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
598 $t = Title::newFromText( $title );
599 if ( is_null(
$t ) ) {
602 return str_replace(
'_',
' ',
$t->getSubjectNsText() );
605 $t = Title::newFromText( $title );
606 if ( is_null(
$t ) ) {
620 $t = Title::newFromText( $title );
621 if ( is_null(
$t ) ) {
627 $t = Title::newFromText( $title );
628 if ( is_null(
$t ) ) {
634 $t = Title::newFromText( $title );
635 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
641 $t = Title::newFromText( $title );
642 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
648 $t = Title::newFromText( $title );
649 if ( is_null(
$t ) ) {
655 $t = Title::newFromText( $title );
656 if ( is_null(
$t ) ) {
662 $t = Title::newFromText( $title );
663 if ( is_null(
$t ) ) {
669 $t = Title::newFromText( $title );
670 if ( is_null(
$t ) ) {
676 $t = Title::newFromText( $title );
677 if ( is_null(
$t ) ) {
683 $t = Title::newFromText( $title );
684 if ( is_null(
$t ) ) {
690 $t = Title::newFromText( $title );
691 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
697 $t = Title::newFromText( $title );
698 if ( is_null(
$t ) || !
$t->canHaveTalkPage() ) {
704 $t = Title::newFromText( $title );
705 if ( is_null(
$t ) ) {
711 $t = Title::newFromText( $title );
712 if ( is_null(
$t ) ) {
733 'pagesincategory_all',
734 'pagesincategory_pages',
735 'pagesincategory_subcats',
736 'pagesincategory_files'
742 if ( self::matchAgainstMagicword(
'rawsuffix', $arg1 ) ) {
752 $type =
'pagesincategory_all';
755 $title = Title::makeTitleSafe(
NS_CATEGORY, $name );
756 if ( !$title ) { # invalid title
759 $wgContLang->findVariantLink( $name, $title,
true );
762 $name = $title->getDBkey();
764 if ( !isset(
$cache[$name] ) ) {
765 $category = Category::newFromTitle( $title );
767 $allCount = $subcatCount = $fileCount = $pagesCount = 0;
768 if (
$parser->incrementExpensiveFunctionCount() ) {
771 $allCount = (int)$category->getPageCount();
772 $subcatCount = (int)$category->getSubcatCount();
773 $fileCount = (int)$category->getFileCount();
774 $pagesCount = $allCount - $subcatCount - $fileCount;
777 $cache[
$name][
'pagesincategory_pages'] = $pagesCount;
778 $cache[
$name][
'pagesincategory_subcats'] = $subcatCount;
779 $cache[
$name][
'pagesincategory_files'] = $fileCount;
796 $title = Title::newFromText( $page );
798 if ( !is_object( $title ) ) {
804 $length =
$rev ?
$rev->getSize() : 0;
805 if ( $length ===
null ) {
825 $titleObject = Title::newFromText( $title );
826 if ( !( $titleObject instanceof
Title ) ) {
827 $titleObject =
$parser->mTitle;
829 if ( $titleObject->areRestrictionsLoaded() ||
$parser->incrementExpensiveFunctionCount() ) {
830 $restrictions = $titleObject->getRestrictions( strtolower(
$type ) );
831 # Title::getRestrictions returns an array, its possible it may have
832 # multiple values in the future
833 return implode(
',', $restrictions );
851 $titleObject = Title::newFromText( $title );
852 if ( !( $titleObject instanceof
Title ) ) {
853 $titleObject =
$parser->mTitle;
855 if ( $titleObject->areRestrictionsLoaded() ||
$parser->incrementExpensiveFunctionCount() ) {
856 $expiry = $titleObject->getRestrictionExpiry( strtolower(
$type ) );
859 if ( $expiry ===
false ) {
876 $inLanguage = strtolower( $inLanguage );
877 $lang = Language::fetchLanguageName(
$code, $inLanguage );
890 public static function pad(
891 $parser, $string, $length, $padding =
'0', $direction = STR_PAD_RIGHT
893 $padding =
$parser->killMarkers( $padding );
894 $lengthOfPadding = mb_strlen( $padding );
895 if ( $lengthOfPadding == 0 ) {
899 # The remaining length to add counts down to 0 as padding is added
900 $length = min( (
int)$length, 500 ) - mb_strlen( $string );
901 if ( $length <= 0 ) {
906 # $finalPadding is just $padding repeated enough times so that
907 # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length
909 while ( $length > 0 ) {
910 # If $length < $lengthofPadding, truncate $padding so we get the
911 # exact length desired.
912 $finalPadding .= mb_substr( $padding, 0, $length );
913 $length -= $lengthOfPadding;
916 if ( $direction == STR_PAD_LEFT ) {
917 return $finalPadding . $string;
919 return $string . $finalPadding;
923 public static function padleft(
$parser, $string =
'', $length = 0, $padding =
'0' ) {
927 public static function padright(
$parser, $string =
'', $length = 0, $padding =
'0' ) {
937 $text =
$parser->killMarkers( $text );
939 return Sanitizer::safeEncodeAttribute(
$section );
945 $title = SpecialPage::getTitleFor( $page, $subpage );
946 return $title->getPrefixedText();
949 $title = Title::makeTitleSafe(
NS_SPECIAL, $text );
973 $text = trim( $text );
974 if ( strlen( $text ) == 0 ) {
977 $old =
$parser->getCustomDefaultSort();
978 if ( $old ===
false || $arg !==
'defaultsort_noreplace' ) {
979 $parser->setDefaultSort( $text );
982 if ( $old ===
false || $old == $text || $arg ) {
985 $converter =
$parser->getConverterLanguage()->getConverter();
986 return '<span class="error">' .
991 )->inContentLanguage()->text() .
1010 if ( $argA ==
'nowiki' ) {
1013 $parsedWidthParam = Parser::parseWidthParam( $argB );
1016 $parsedWidthParam = Parser::parseWidthParam( $argA );
1017 $isNowiki = ( $argB ==
'nowiki' );
1021 $url = $file->getFullUrl();
1024 if ( count( $parsedWidthParam ) ) {
1025 $mto = $file->transform( $parsedWidthParam );
1027 if ( $mto && !$mto->isError() ) {
1033 return [ $url,
'nowiki' =>
true ];
1049 if ( !count(
$args ) ) {
1052 $tagName = strtolower( trim( $frame->expand( array_shift(
$args ) ) ) );
1054 if ( count(
$args ) ) {
1055 $inner = $frame->expand( array_shift(
$args ) );
1061 foreach (
$args as $arg ) {
1062 $bits = $arg->splitArg();
1063 if ( strval( $bits[
'index'] ) ===
'' ) {
1065 $value = trim( $frame->expand( $bits[
'value'] ) );
1066 if ( preg_match(
'/^(?:["\'](.+)["\']|""|\'\')$/s',
$value, $m ) ) {
1067 $value = isset( $m[1] ) ? $m[1] :
'';
1073 $stripList =
$parser->getStripList();
1074 if ( !in_array( $tagName, $stripList ) ) {
1077 foreach ( $attributes as $name =>
$value ) {
1078 $attrText .=
' ' . htmlspecialchars( $name ) .
'="' . htmlspecialchars(
$value ) .
'"';
1080 if ( $inner ===
null ) {
1081 return "<$tagName$attrText/>";
1083 return "<$tagName$attrText>$inner</$tagName>";
1089 'attributes' => $attributes,
1090 'close' =>
"</$tagName>",
1108 if ( is_null( $title ) ) {
1114 if ( $title->equals(
$parser->getTitle() ) ) {
1115 $parserRev =
$parser->getRevisionObject();
1116 if ( $parserRev && $parserRev->isCurrent() ) {
1118 $parser->getOutput()->setFlag(
'vary-revision' );
1119 wfDebug( __METHOD__ .
": use current revision from parser, setting vary-revision...\n" );
1125 $page = $title->getPrefixedDBkey();
1127 if ( !(
$parser->currentRevisionCache &&
$parser->currentRevisionCache->has( $page ) )
1128 && !
$parser->incrementExpensiveFunctionCount() ) {
1131 $rev =
$parser->fetchCurrentRevisionOfTitle( $title );
1132 $pageID =
$rev ?
$rev->getPage() : 0;
1136 $parser->getOutput()->addTemplate( $title, $pageID, $revID );
1149 $t = Title::newFromText( $title );
1150 if ( is_null(
$t ) ) {
1154 if (
$t->equals(
$parser->getTitle() ) ) {
1156 return $t->getArticleID();
1160 if ( !
$t->canExist() ||
$t->isExternal() ) {
1165 $linkCache = LinkCache::singleton();
1166 $pdbk =
$t->getPrefixedDBkey();
1167 $id = $linkCache->getGoodLinkID( $pdbk );
1172 if ( $linkCache->isBadLink( $pdbk ) ) {
1178 if (
$parser->incrementExpensiveFunctionCount() ) {
1179 $id =
$t->getArticleID();
1194 $t = Title::newFromText( $title );
1195 if ( is_null(
$t ) ) {
1211 $t = Title::newFromText( $title );
1212 if ( is_null(
$t ) ) {
1217 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'j' ) :
'';
1228 $t = Title::newFromText( $title );
1229 if ( is_null(
$t ) ) {
1234 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'd' ) :
'';
1245 $t = Title::newFromText( $title );
1246 if ( is_null(
$t ) ) {
1251 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'm' ) :
'';
1262 $t = Title::newFromText( $title );
1263 if ( is_null(
$t ) ) {
1268 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'n' ) :
'';
1279 $t = Title::newFromText( $title );
1280 if ( is_null(
$t ) ) {
1285 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'Y' ) :
'';
1296 $t = Title::newFromText( $title );
1297 if ( is_null(
$t ) ) {
1302 return $rev ? MWTimestamp::getLocalInstance(
$rev->getTimestamp() )->format(
'YmdHis' ) :
'';
1313 $t = Title::newFromText( $title );
1314 if ( is_null(
$t ) ) {
1319 return $rev ?
$rev->getUserText() :
'';
1335 $titleObject = Title::newFromText( $title );
1336 if ( !( $titleObject instanceof
Title ) ) {
1337 $titleObject =
$parser->mTitle;
1339 if ( $titleObject->areCascadeProtectionSourcesLoaded()
1340 ||
$parser->incrementExpensiveFunctionCount()
1343 $sources = $titleObject->getCascadeProtectionSources();
1344 foreach ( $sources[0] as $sourceTitle ) {
1345 $names[] = $sourceTitle->getPrefixedText();
1347 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.
wfFindFile( $title, $options=[])
Find a file.
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 intFunction( $parser, $part1='')
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 numberofpages( $parser, $raw=null)
static lcfirst( $parser, $s='')
static urlFunction( $func, $s='', $arg=null)
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 plural( $parser, $text='')
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 gender( $parser, $username)
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 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 pagename( $parser, $title=null)
Functions to get and normalize pagenames, corresponding to the magic words of the same names.
static getCachedRevisionObject( $parser, $title=null)
Fetched the current revision of the given title and return this.
static matchAgainstMagicword( $magicword, $value)
Matches the given value against the value of given magic word.
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 formatRaw( $num, $raw, $language)
Formats a number according to a language.
static speciale( $parser, $text)
Class for handling an array of magic words.
static & get( $id)
Factory: creates an object representing an ID.
static numberingroup( $group)
Find the number of users in a given user group.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
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.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
do that in ParserLimitReportFormat instead $parser
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
this hook is for auditing only or null if authentication failed before getting that far $username
Allows to change the fields on the form that will be generated $name
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
processing should stop and the error should be shown to the user * false
magicword txt Magic Words are some phrases used in the wikitext They are used for two that looks like templates but that don t accept any parameter *Parser functions(like {{fullurl:...}}, {{#special:...}}) $magicWords['en']
if(!isset( $args[0])) $lang