MediaWiki REL1_30
CoreParserFunctions.php
Go to the documentation of this file.
1<?php
24
34 public static function register( $parser ) {
36
37 # Syntax for arguments (see Parser::setFunctionHook):
38 # "name for lookup in localized magic words array",
39 # function callback,
40 # optional Parser::SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
41 # instead of {{#int:...}})
42 $noHashFunctions = [
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',
59 ];
60 foreach ( $noHashFunctions as $func ) {
61 $parser->setFunctionHook( $func, [ __CLASS__, $func ], Parser::SFH_NO_HASH );
62 }
63
64 $parser->setFunctionHook(
65 'namespace',
66 [ __CLASS__, 'mwnamespace' ],
67 Parser::SFH_NO_HASH
68 );
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' ] );
74
76 $parser->setFunctionHook(
77 'displaytitle',
78 [ __CLASS__, 'displaytitle' ],
79 Parser::SFH_NO_HASH
80 );
81 }
83 $parser->setFunctionHook(
84 'pagesinnamespace',
85 [ __CLASS__, 'pagesinnamespace' ],
86 Parser::SFH_NO_HASH
87 );
88 }
89 }
90
96 public static function intFunction( $parser, $part1 = '' /*, ... */ ) {
97 if ( strval( $part1 ) !== '' ) {
98 $args = array_slice( func_get_args(), 2 );
99 $message = wfMessage( $part1, $args )
100 ->inLanguage( $parser->getOptions()->getUserLangObj() );
101 if ( !$message->exists() ) {
102 // When message does not exists, the message name is surrounded by angle
103 // and can result in a tag, therefore escape the angles
104 return $message->escaped();
105 }
106 return [ $message->plain(), 'noparse' => false ];
107 } else {
108 return [ 'found' => false ];
109 }
110 }
111
119 public static function formatDate( $parser, $date, $defaultPref = null ) {
120 $lang = $parser->getFunctionLang();
122
123 $date = trim( $date );
124
125 $pref = $parser->getOptions()->getDateFormat();
126
127 // Specify a different default date format other than the normal default
128 // if the user has 'default' for their setting
129 if ( $pref == 'default' && $defaultPref ) {
130 $pref = $defaultPref;
131 }
132
133 $date = $df->reformat( $pref, $date, [ 'match-whole' ] );
134 return $date;
135 }
136
137 public static function ns( $parser, $part1 = '' ) {
138 global $wgContLang;
139 if ( intval( $part1 ) || $part1 == "0" ) {
140 $index = intval( $part1 );
141 } else {
142 $index = $wgContLang->getNsIndex( str_replace( ' ', '_', $part1 ) );
143 }
144 if ( $index !== false ) {
145 return $wgContLang->getFormattedNsText( $index );
146 } else {
147 return [ 'found' => false ];
148 }
149 }
150
151 public static function nse( $parser, $part1 = '' ) {
152 $ret = self::ns( $parser, $part1 );
153 if ( is_string( $ret ) ) {
154 $ret = wfUrlencode( str_replace( ' ', '_', $ret ) );
155 }
156 return $ret;
157 }
158
171 public static function urlencode( $parser, $s = '', $arg = null ) {
172 static $magicWords = null;
173 if ( is_null( $magicWords ) ) {
174 $magicWords = new MagicWordArray( [ 'url_path', 'url_query', 'url_wiki' ] );
175 }
176 switch ( $magicWords->matchStartToEnd( $arg ) ) {
177 // Encode as though it's a wiki page, '_' for ' '.
178 case 'url_wiki':
179 $func = 'wfUrlencode';
180 $s = str_replace( ' ', '_', $s );
181 break;
182
183 // Encode for an HTTP Path, '%20' for ' '.
184 case 'url_path':
185 $func = 'rawurlencode';
186 break;
187
188 // Encode for HTTP query, '+' for ' '.
189 case 'url_query':
190 default:
191 $func = 'urlencode';
192 }
193 // See T105242, where the choice to kill markers and various
194 // other options were discussed.
195 return $func( $parser->killMarkers( $s ) );
196 }
197
198 public static function lcfirst( $parser, $s = '' ) {
199 global $wgContLang;
200 return $wgContLang->lcfirst( $s );
201 }
202
203 public static function ucfirst( $parser, $s = '' ) {
204 global $wgContLang;
205 return $wgContLang->ucfirst( $s );
206 }
207
213 public static function lc( $parser, $s = '' ) {
214 global $wgContLang;
215 return $parser->markerSkipCallback( $s, [ $wgContLang, 'lc' ] );
216 }
217
223 public static function uc( $parser, $s = '' ) {
224 global $wgContLang;
225 return $parser->markerSkipCallback( $s, [ $wgContLang, 'uc' ] );
226 }
227
228 public static function localurl( $parser, $s = '', $arg = null ) {
229 return self::urlFunction( 'getLocalURL', $s, $arg );
230 }
231
232 public static function localurle( $parser, $s = '', $arg = null ) {
233 $temp = self::urlFunction( 'getLocalURL', $s, $arg );
234 if ( !is_string( $temp ) ) {
235 return $temp;
236 } else {
237 return htmlspecialchars( $temp );
238 }
239 }
240
241 public static function fullurl( $parser, $s = '', $arg = null ) {
242 return self::urlFunction( 'getFullURL', $s, $arg );
243 }
244
245 public static function fullurle( $parser, $s = '', $arg = null ) {
246 $temp = self::urlFunction( 'getFullURL', $s, $arg );
247 if ( !is_string( $temp ) ) {
248 return $temp;
249 } else {
250 return htmlspecialchars( $temp );
251 }
252 }
253
254 public static function canonicalurl( $parser, $s = '', $arg = null ) {
255 return self::urlFunction( 'getCanonicalURL', $s, $arg );
256 }
257
258 public static function canonicalurle( $parser, $s = '', $arg = null ) {
259 $temp = self::urlFunction( 'getCanonicalURL', $s, $arg );
260 if ( !is_string( $temp ) ) {
261 return $temp;
262 } else {
263 return htmlspecialchars( $temp );
264 }
265 }
266
267 public static function urlFunction( $func, $s = '', $arg = null ) {
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 ) );
275 }
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() );
280 }
281 if ( !is_null( $arg ) ) {
282 $text = $title->$func( $arg );
283 } else {
284 $text = $title->$func();
285 }
286 return $text;
287 } else {
288 return [ 'found' => false ];
289 }
290 }
291
298 public static function formatnum( $parser, $num = '', $arg = null ) {
299 if ( self::matchAgainstMagicword( 'rawsuffix', $arg ) ) {
300 $func = [ $parser->getFunctionLang(), 'parseFormattedNumber' ];
301 } elseif ( self::matchAgainstMagicword( 'nocommafysuffix', $arg ) ) {
302 $func = [ $parser->getFunctionLang(), 'formatNumNoSeparators' ];
303 } else {
304 $func = [ $parser->getFunctionLang(), 'formatNum' ];
305 }
306 return $parser->markerSkipCallback( $num, $func );
307 }
308
315 public static function grammar( $parser, $case = '', $word = '' ) {
316 $word = $parser->killMarkers( $word );
317 return $parser->getFunctionLang()->convertGrammar( $word, $case );
318 }
319
325 public static function gender( $parser, $username ) {
326 $forms = array_slice( func_get_args(), 2 );
327
328 // Some shortcuts to avoid loading user data unnecessarily
329 if ( count( $forms ) === 0 ) {
330 return '';
331 } elseif ( count( $forms ) === 1 ) {
332 return $forms[0];
333 }
334
335 $username = trim( $username );
336
337 // default
338 $gender = User::getDefaultOption( 'gender' );
339
340 // allow prefix.
341 $title = Title::newFromText( $username );
342
343 if ( $title && $title->inNamespace( NS_USER ) ) {
344 $username = $title->getText();
345 }
346
347 // check parameter, or use the ParserOptions if in interface message
348 $user = User::newFromName( $username );
349 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
350 if ( $user ) {
351 $gender = $genderCache->getGenderOf( $user, __METHOD__ );
352 } elseif ( $username === '' && $parser->getOptions()->getInterfaceMessage() ) {
353 $gender = $genderCache->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
354 }
355 $ret = $parser->getFunctionLang()->gender( $gender, $forms );
356 return $ret;
357 }
358
364 public static function plural( $parser, $text = '' ) {
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 );
369 }
370
376 public static function bidi( $parser, $text = '' ) {
377 return $parser->getFunctionLang()->embedBidi( $text );
378 }
379
389 public static function displaytitle( $parser, $text = '', $uarg = '' ) {
391
392 static $magicWords = null;
393 if ( is_null( $magicWords ) ) {
394 $magicWords = new MagicWordArray( [ 'displaytitle_noerror', 'displaytitle_noreplace' ] );
395 }
396 $arg = $magicWords->matchStartToEnd( $uarg );
397
398 // parse a limited subset of wiki markup (just the single quote items)
399 $text = $parser->doQuotes( $text );
400
401 // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
402 $text = $parser->killMarkers( $text );
403
404 // list of disallowed tags for DISPLAYTITLE
405 // these will be escaped even though they are allowed in normal wiki 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' ];
408
409 // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
411 $htmlTagsCallback = function ( &$params ) {
412 $decoded = Sanitizer::decodeTagAttributes( $params );
413
414 if ( isset( $decoded['style'] ) ) {
415 // this is called later anyway, but we need it right now for the regexes below to be safe
416 // calling it twice doesn't hurt
417 $decoded['style'] = Sanitizer::checkCss( $decoded['style'] );
418
419 if ( preg_match( '/(display|user-select|visibility)\s*:/i', $decoded['style'] ) ) {
420 $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */';
421 }
422 }
423
424 $params = Sanitizer::safeEncodeTagAttributes( $decoded );
425 };
426 } else {
427 $htmlTagsCallback = null;
428 }
429
430 // only requested titles that normalize to the actual title are allowed through
431 // if $wgRestrictDisplayTitle is true (it is by default)
432 // mimic the escaping process that occurs in OutputPage::setPageTitle
433 $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
434 $text,
435 $htmlTagsCallback,
436 [],
437 [],
438 $bad
439 ) );
440 $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
441
443 ( $title instanceof Title
444 && !$title->hasFragment()
445 && $title->equals( $parser->mTitle ) )
446 ) {
447 $old = $parser->mOutput->getProperty( 'displaytitle' );
448 if ( $old === false || $arg !== 'displaytitle_noreplace' ) {
449 $parser->mOutput->setDisplayTitle( $text );
450 }
451 if ( $old !== false && $old !== $text && !$arg ) {
452 $converter = $parser->getConverterLanguage()->getConverter();
453 return '<span class="error">' .
454 wfMessage( 'duplicate-displaytitle',
455 // Message should be parsed, but these params should only be escaped.
456 $converter->markNoConversion( wfEscapeWikiText( $old ) ),
457 $converter->markNoConversion( wfEscapeWikiText( $text ) )
458 )->inContentLanguage()->text() .
459 '</span>';
460 } else {
461 return '';
462 }
463 } else {
464 $converter = $parser->getConverterLanguage()->getConverter();
465 $parser->getOutput()->addWarning(
466 wfMessage( 'restricted-displaytitle',
467 // Message should be parsed, but this param should only be escaped.
468 $converter->markNoConversion( wfEscapeWikiText( $text ) )
469 )->text()
470 );
471 $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
472 }
473 }
474
482 private static function matchAgainstMagicword( $magicword, $value ) {
483 $value = trim( strval( $value ) );
484 if ( $value === '' ) {
485 return false;
486 }
487 $mwObject = MagicWord::get( $magicword );
488 return $mwObject->matchStartToEnd( $value );
489 }
490
499 public static function formatRaw( $num, $raw, $language ) {
500 if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
501 return $num;
502 } else {
503 return $language->formatNum( $num );
504 }
505 }
506
507 public static function numberofpages( $parser, $raw = null ) {
508 return self::formatRaw( SiteStats::pages(), $raw, $parser->getFunctionLang() );
509 }
510
511 public static function numberofusers( $parser, $raw = null ) {
512 return self::formatRaw( SiteStats::users(), $raw, $parser->getFunctionLang() );
513 }
514 public static function numberofactiveusers( $parser, $raw = null ) {
515 return self::formatRaw( SiteStats::activeUsers(), $raw, $parser->getFunctionLang() );
516 }
517
518 public static function numberofarticles( $parser, $raw = null ) {
519 return self::formatRaw( SiteStats::articles(), $raw, $parser->getFunctionLang() );
520 }
521
522 public static function numberoffiles( $parser, $raw = null ) {
523 return self::formatRaw( SiteStats::images(), $raw, $parser->getFunctionLang() );
524 }
525
526 public static function numberofadmins( $parser, $raw = null ) {
527 return self::formatRaw(
528 SiteStats::numberingroup( 'sysop' ),
529 $raw,
530 $parser->getFunctionLang()
531 );
532 }
533
534 public static function numberofedits( $parser, $raw = null ) {
535 return self::formatRaw( SiteStats::edits(), $raw, $parser->getFunctionLang() );
536 }
537
538 public static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
539 return self::formatRaw(
540 SiteStats::pagesInNs( intval( $namespace ) ),
541 $raw,
542 $parser->getFunctionLang()
543 );
544 }
545 public static function numberingroup( $parser, $name = '', $raw = null ) {
546 return self::formatRaw(
547 SiteStats::numberingroup( strtolower( $name ) ),
548 $raw,
549 $parser->getFunctionLang()
550 );
551 }
552
562 public static function mwnamespace( $parser, $title = null ) {
563 $t = Title::newFromText( $title );
564 if ( is_null( $t ) ) {
565 return '';
566 }
567 return str_replace( '_', ' ', $t->getNsText() );
568 }
569 public static function namespacee( $parser, $title = null ) {
570 $t = Title::newFromText( $title );
571 if ( is_null( $t ) ) {
572 return '';
573 }
574 return wfUrlencode( $t->getNsText() );
575 }
576 public static function namespacenumber( $parser, $title = null ) {
577 $t = Title::newFromText( $title );
578 if ( is_null( $t ) ) {
579 return '';
580 }
581 return $t->getNamespace();
582 }
583 public static function talkspace( $parser, $title = null ) {
584 $t = Title::newFromText( $title );
585 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
586 return '';
587 }
588 return str_replace( '_', ' ', $t->getTalkNsText() );
589 }
590 public static function talkspacee( $parser, $title = null ) {
591 $t = Title::newFromText( $title );
592 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
593 return '';
594 }
595 return wfUrlencode( $t->getTalkNsText() );
596 }
597 public static function subjectspace( $parser, $title = null ) {
598 $t = Title::newFromText( $title );
599 if ( is_null( $t ) ) {
600 return '';
601 }
602 return str_replace( '_', ' ', $t->getSubjectNsText() );
603 }
604 public static function subjectspacee( $parser, $title = null ) {
605 $t = Title::newFromText( $title );
606 if ( is_null( $t ) ) {
607 return '';
608 }
609 return wfUrlencode( $t->getSubjectNsText() );
610 }
611
619 public static function pagename( $parser, $title = null ) {
620 $t = Title::newFromText( $title );
621 if ( is_null( $t ) ) {
622 return '';
623 }
624 return wfEscapeWikiText( $t->getText() );
625 }
626 public static function pagenamee( $parser, $title = null ) {
627 $t = Title::newFromText( $title );
628 if ( is_null( $t ) ) {
629 return '';
630 }
631 return wfEscapeWikiText( $t->getPartialURL() );
632 }
633 public static function fullpagename( $parser, $title = null ) {
634 $t = Title::newFromText( $title );
635 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
636 return '';
637 }
638 return wfEscapeWikiText( $t->getPrefixedText() );
639 }
640 public static function fullpagenamee( $parser, $title = null ) {
641 $t = Title::newFromText( $title );
642 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
643 return '';
644 }
645 return wfEscapeWikiText( $t->getPrefixedURL() );
646 }
647 public static function subpagename( $parser, $title = null ) {
648 $t = Title::newFromText( $title );
649 if ( is_null( $t ) ) {
650 return '';
651 }
652 return wfEscapeWikiText( $t->getSubpageText() );
653 }
654 public static function subpagenamee( $parser, $title = null ) {
655 $t = Title::newFromText( $title );
656 if ( is_null( $t ) ) {
657 return '';
658 }
659 return wfEscapeWikiText( $t->getSubpageUrlForm() );
660 }
661 public static function rootpagename( $parser, $title = null ) {
662 $t = Title::newFromText( $title );
663 if ( is_null( $t ) ) {
664 return '';
665 }
666 return wfEscapeWikiText( $t->getRootText() );
667 }
668 public static function rootpagenamee( $parser, $title = null ) {
669 $t = Title::newFromText( $title );
670 if ( is_null( $t ) ) {
671 return '';
672 }
673 return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getRootText() ) ) );
674 }
675 public static function basepagename( $parser, $title = null ) {
676 $t = Title::newFromText( $title );
677 if ( is_null( $t ) ) {
678 return '';
679 }
680 return wfEscapeWikiText( $t->getBaseText() );
681 }
682 public static function basepagenamee( $parser, $title = null ) {
683 $t = Title::newFromText( $title );
684 if ( is_null( $t ) ) {
685 return '';
686 }
687 return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getBaseText() ) ) );
688 }
689 public static function talkpagename( $parser, $title = null ) {
690 $t = Title::newFromText( $title );
691 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
692 return '';
693 }
694 return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
695 }
696 public static function talkpagenamee( $parser, $title = null ) {
697 $t = Title::newFromText( $title );
698 if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
699 return '';
700 }
701 return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
702 }
703 public static function subjectpagename( $parser, $title = null ) {
704 $t = Title::newFromText( $title );
705 if ( is_null( $t ) ) {
706 return '';
707 }
708 return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
709 }
710 public static function subjectpagenamee( $parser, $title = null ) {
711 $t = Title::newFromText( $title );
712 if ( is_null( $t ) ) {
713 return '';
714 }
715 return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedURL() );
716 }
717
728 public static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) {
729 global $wgContLang;
730 static $magicWords = null;
731 if ( is_null( $magicWords ) ) {
733 'pagesincategory_all',
734 'pagesincategory_pages',
735 'pagesincategory_subcats',
736 'pagesincategory_files'
737 ] );
738 }
739 static $cache = [];
740
741 // split the given option to its variable
742 if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
743 // {{pagesincategory:|raw[|type]}}
744 $raw = $arg1;
745 $type = $magicWords->matchStartToEnd( $arg2 );
746 } else {
747 // {{pagesincategory:[|type[|raw]]}}
748 $type = $magicWords->matchStartToEnd( $arg1 );
749 $raw = $arg2;
750 }
751 if ( !$type ) { // backward compatibility
752 $type = 'pagesincategory_all';
753 }
754
755 $title = Title::makeTitleSafe( NS_CATEGORY, $name );
756 if ( !$title ) { # invalid title
757 return self::formatRaw( 0, $raw, $parser->getFunctionLang() );
758 }
759 $wgContLang->findVariantLink( $name, $title, true );
760
761 // Normalize name for cache
762 $name = $title->getDBkey();
763
764 if ( !isset( $cache[$name] ) ) {
765 $category = Category::newFromTitle( $title );
766
767 $allCount = $subcatCount = $fileCount = $pagesCount = 0;
768 if ( $parser->incrementExpensiveFunctionCount() ) {
769 // $allCount is the total number of cat members,
770 // not the count of how many members are normal pages.
771 $allCount = (int)$category->getPageCount();
772 $subcatCount = (int)$category->getSubcatCount();
773 $fileCount = (int)$category->getFileCount();
774 $pagesCount = $allCount - $subcatCount - $fileCount;
775 }
776 $cache[$name]['pagesincategory_all'] = $allCount;
777 $cache[$name]['pagesincategory_pages'] = $pagesCount;
778 $cache[$name]['pagesincategory_subcats'] = $subcatCount;
779 $cache[$name]['pagesincategory_files'] = $fileCount;
780 }
781
782 $count = $cache[$name][$type];
783 return self::formatRaw( $count, $raw, $parser->getFunctionLang() );
784 }
785
795 public static function pagesize( $parser, $page = '', $raw = null ) {
796 $title = Title::newFromText( $page );
797
798 if ( !is_object( $title ) ) {
799 return self::formatRaw( 0, $raw, $parser->getFunctionLang() );
800 }
801
802 // fetch revision from cache/database and return the value
804 $length = $rev ? $rev->getSize() : 0;
805 if ( $length === null ) {
806 // We've had bugs where rev_len was not being recorded for empty pages, see T135414
807 $length = 0;
808 }
809 return self::formatRaw( $length, $raw, $parser->getFunctionLang() );
810 }
811
824 public static function protectionlevel( $parser, $type = '', $title = '' ) {
825 $titleObject = Title::newFromText( $title );
826 if ( !( $titleObject instanceof Title ) ) {
827 $titleObject = $parser->mTitle;
828 }
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, ',' );
834 }
835 return '';
836 }
837
850 public static function protectionexpiry( $parser, $type = '', $title = '' ) {
851 $titleObject = Title::newFromText( $title );
852 if ( !( $titleObject instanceof Title ) ) {
853 $titleObject = $parser->mTitle;
854 }
855 if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
856 $expiry = $titleObject->getRestrictionExpiry( strtolower( $type ) );
857 // getRestrictionExpiry() returns false on invalid type; trying to
858 // match protectionlevel() function that returns empty string instead
859 if ( $expiry === false ) {
860 $expiry = '';
861 }
862 return $expiry;
863 }
864 return '';
865 }
866
874 public static function language( $parser, $code = '', $inLanguage = '' ) {
875 $code = strtolower( $code );
876 $inLanguage = strtolower( $inLanguage );
877 $lang = Language::fetchLanguageName( $code, $inLanguage );
878 return $lang !== '' ? $lang : wfBCP47( $code );
879 }
880
890 public static function pad(
891 $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT
892 ) {
893 $padding = $parser->killMarkers( $padding );
894 $lengthOfPadding = mb_strlen( $padding );
895 if ( $lengthOfPadding == 0 ) {
896 return $string;
897 }
898
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 ) {
902 // Nothing to add
903 return $string;
904 }
905
906 # $finalPadding is just $padding repeated enough times so that
907 # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length
908 $finalPadding = '';
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;
914 }
915
916 if ( $direction == STR_PAD_LEFT ) {
917 return $finalPadding . $string;
918 } else {
919 return $string . $finalPadding;
920 }
921 }
922
923 public static function padleft( $parser, $string = '', $length = 0, $padding = '0' ) {
924 return self::pad( $parser, $string, $length, $padding, STR_PAD_LEFT );
925 }
926
927 public static function padright( $parser, $string = '', $length = 0, $padding = '0' ) {
928 return self::pad( $parser, $string, $length, $padding );
929 }
930
936 public static function anchorencode( $parser, $text ) {
937 $text = $parser->killMarkers( $text );
938 return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
939 }
940
941 public static function special( $parser, $text ) {
942 list( $page, $subpage ) = SpecialPageFactory::resolveAlias( $text );
943 if ( $page ) {
944 $title = SpecialPage::getTitleFor( $page, $subpage );
945 return $title->getPrefixedText();
946 } else {
947 // unknown special page, just use the given text as its title, if at all possible
948 $title = Title::makeTitleSafe( NS_SPECIAL, $text );
949 return $title ? $title->getPrefixedText() : self::special( $parser, 'Badtitle' );
950 }
951 }
952
953 public static function speciale( $parser, $text ) {
954 return wfUrlencode( str_replace( ' ', '_', self::special( $parser, $text ) ) );
955 }
956
965 public static function defaultsort( $parser, $text, $uarg = '' ) {
966 static $magicWords = null;
967 if ( is_null( $magicWords ) ) {
968 $magicWords = new MagicWordArray( [ 'defaultsort_noerror', 'defaultsort_noreplace' ] );
969 }
970 $arg = $magicWords->matchStartToEnd( $uarg );
971
972 $text = trim( $text );
973 if ( strlen( $text ) == 0 ) {
974 return '';
975 }
976 $old = $parser->getCustomDefaultSort();
977 if ( $old === false || $arg !== 'defaultsort_noreplace' ) {
978 $parser->setDefaultSort( $text );
979 }
980
981 if ( $old === false || $old == $text || $arg ) {
982 return '';
983 } else {
984 $converter = $parser->getConverterLanguage()->getConverter();
985 return '<span class="error">' .
986 wfMessage( 'duplicate-defaultsort',
987 // Message should be parsed, but these params should only be escaped.
988 $converter->markNoConversion( wfEscapeWikiText( $old ) ),
989 $converter->markNoConversion( wfEscapeWikiText( $text ) )
990 )->inContentLanguage()->text() .
991 '</span>';
992 }
993 }
994
1006 public static function filepath( $parser, $name = '', $argA = '', $argB = '' ) {
1007 $file = wfFindFile( $name );
1008
1009 if ( $argA == 'nowiki' ) {
1010 // {{filepath: | option [| size] }}
1011 $isNowiki = true;
1012 $parsedWidthParam = $parser->parseWidthParam( $argB );
1013 } else {
1014 // {{filepath: [| size [|option]] }}
1015 $parsedWidthParam = $parser->parseWidthParam( $argA );
1016 $isNowiki = ( $argB == 'nowiki' );
1017 }
1018
1019 if ( $file ) {
1020 $url = $file->getFullUrl();
1021
1022 // If a size is requested...
1023 if ( count( $parsedWidthParam ) ) {
1024 $mto = $file->transform( $parsedWidthParam );
1025 // ... and we can
1026 if ( $mto && !$mto->isError() ) {
1027 // ... change the URL to point to a thumbnail.
1028 $url = wfExpandUrl( $mto->getUrl(), PROTO_RELATIVE );
1029 }
1030 }
1031 if ( $isNowiki ) {
1032 return [ $url, 'nowiki' => true ];
1033 }
1034 return $url;
1035 } else {
1036 return '';
1037 }
1038 }
1039
1047 public static function tagObj( $parser, $frame, $args ) {
1048 if ( !count( $args ) ) {
1049 return '';
1050 }
1051 $tagName = strtolower( trim( $frame->expand( array_shift( $args ) ) ) );
1052
1053 if ( count( $args ) ) {
1054 $inner = $frame->expand( array_shift( $args ) );
1055 } else {
1056 $inner = null;
1057 }
1058
1059 $attributes = [];
1060 foreach ( $args as $arg ) {
1061 $bits = $arg->splitArg();
1062 if ( strval( $bits['index'] ) === '' ) {
1063 $name = trim( $frame->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
1064 $value = trim( $frame->expand( $bits['value'] ) );
1065 if ( preg_match( '/^(?:["\'](.+)["\']|""|\'\')$/s', $value, $m ) ) {
1066 $value = isset( $m[1] ) ? $m[1] : '';
1067 }
1068 $attributes[$name] = $value;
1069 }
1070 }
1071
1072 $stripList = $parser->getStripList();
1073 if ( !in_array( $tagName, $stripList ) ) {
1074 // we can't handle this tag (at least not now), so just re-emit it as an ordinary tag
1075 $attrText = '';
1076 foreach ( $attributes as $name => $value ) {
1077 $attrText .= ' ' . htmlspecialchars( $name ) . '="' . htmlspecialchars( $value ) . '"';
1078 }
1079 if ( $inner === null ) {
1080 return "<$tagName$attrText/>";
1081 }
1082 return "<$tagName$attrText>$inner</$tagName>";
1083 }
1084
1085 $params = [
1086 'name' => $tagName,
1087 'inner' => $inner,
1088 'attributes' => $attributes,
1089 'close' => "</$tagName>",
1090 ];
1091 return $parser->extensionSubstitution( $params, $frame );
1092 }
1093
1106 private static function getCachedRevisionObject( $parser, $title = null ) {
1107 if ( is_null( $title ) ) {
1108 return null;
1109 }
1110
1111 // Use the revision from the parser itself, when param is the current page
1112 // and the revision is the current one
1113 if ( $title->equals( $parser->getTitle() ) ) {
1114 $parserRev = $parser->getRevisionObject();
1115 if ( $parserRev && $parserRev->isCurrent() ) {
1116 // force reparse after edit with vary-revision flag
1117 $parser->getOutput()->setFlag( 'vary-revision' );
1118 wfDebug( __METHOD__ . ": use current revision from parser, setting vary-revision...\n" );
1119 return $parserRev;
1120 }
1121 }
1122
1123 // Normalize name for cache
1124 $page = $title->getPrefixedDBkey();
1125
1126 if ( !( $parser->currentRevisionCache && $parser->currentRevisionCache->has( $page ) )
1127 && !$parser->incrementExpensiveFunctionCount() ) {
1128 return null;
1129 }
1130 $rev = $parser->fetchCurrentRevisionOfTitle( $title );
1131 $pageID = $rev ? $rev->getPage() : 0;
1132 $revID = $rev ? $rev->getId() : 0;
1133
1134 // Register dependency in templatelinks
1135 $parser->getOutput()->addTemplate( $title, $pageID, $revID );
1136
1137 return $rev;
1138 }
1139
1147 public static function pageid( $parser, $title = null ) {
1148 $t = Title::newFromText( $title );
1149 if ( is_null( $t ) ) {
1150 return '';
1151 }
1152 // Use title from parser to have correct pageid after edit
1153 if ( $t->equals( $parser->getTitle() ) ) {
1154 $t = $parser->getTitle();
1155 return $t->getArticleID();
1156 }
1157
1158 // These can't have ids
1159 if ( !$t->canExist() || $t->isExternal() ) {
1160 return 0;
1161 }
1162
1163 // Check the link cache, maybe something already looked it up.
1164 $linkCache = LinkCache::singleton();
1165 $pdbk = $t->getPrefixedDBkey();
1166 $id = $linkCache->getGoodLinkID( $pdbk );
1167 if ( $id != 0 ) {
1168 $parser->mOutput->addLink( $t, $id );
1169 return $id;
1170 }
1171 if ( $linkCache->isBadLink( $pdbk ) ) {
1172 $parser->mOutput->addLink( $t, 0 );
1173 return $id;
1174 }
1175
1176 // We need to load it from the DB, so mark expensive
1177 if ( $parser->incrementExpensiveFunctionCount() ) {
1178 $id = $t->getArticleID();
1179 $parser->mOutput->addLink( $t, $id );
1180 return $id;
1181 }
1182 return null;
1183 }
1184
1192 public static function revisionid( $parser, $title = null ) {
1193 $t = Title::newFromText( $title );
1194 if ( is_null( $t ) ) {
1195 return '';
1196 }
1197 // fetch revision from cache/database and return the value
1199 return $rev ? $rev->getId() : '';
1200 }
1201
1209 public static function revisionday( $parser, $title = null ) {
1210 $t = Title::newFromText( $title );
1211 if ( is_null( $t ) ) {
1212 return '';
1213 }
1214 // fetch revision from cache/database and return the value
1216 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'j' ) : '';
1217 }
1218
1226 public static function revisionday2( $parser, $title = null ) {
1227 $t = Title::newFromText( $title );
1228 if ( is_null( $t ) ) {
1229 return '';
1230 }
1231 // fetch revision from cache/database and return the value
1233 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'd' ) : '';
1234 }
1235
1243 public static function revisionmonth( $parser, $title = null ) {
1244 $t = Title::newFromText( $title );
1245 if ( is_null( $t ) ) {
1246 return '';
1247 }
1248 // fetch revision from cache/database and return the value
1250 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'm' ) : '';
1251 }
1252
1260 public static function revisionmonth1( $parser, $title = null ) {
1261 $t = Title::newFromText( $title );
1262 if ( is_null( $t ) ) {
1263 return '';
1264 }
1265 // fetch revision from cache/database and return the value
1267 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'n' ) : '';
1268 }
1269
1277 public static function revisionyear( $parser, $title = null ) {
1278 $t = Title::newFromText( $title );
1279 if ( is_null( $t ) ) {
1280 return '';
1281 }
1282 // fetch revision from cache/database and return the value
1284 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'Y' ) : '';
1285 }
1286
1294 public static function revisiontimestamp( $parser, $title = null ) {
1295 $t = Title::newFromText( $title );
1296 if ( is_null( $t ) ) {
1297 return '';
1298 }
1299 // fetch revision from cache/database and return the value
1301 return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'YmdHis' ) : '';
1302 }
1303
1311 public static function revisionuser( $parser, $title = null ) {
1312 $t = Title::newFromText( $title );
1313 if ( is_null( $t ) ) {
1314 return '';
1315 }
1316 // fetch revision from cache/database and return the value
1318 return $rev ? $rev->getUserText() : '';
1319 }
1320
1333 public static function cascadingsources( $parser, $title = '' ) {
1334 $titleObject = Title::newFromText( $title );
1335 if ( !( $titleObject instanceof Title ) ) {
1336 $titleObject = $parser->mTitle;
1337 }
1338 if ( $titleObject->areCascadeProtectionSourcesLoaded()
1339 || $parser->incrementExpensiveFunctionCount()
1340 ) {
1341 $names = [];
1342 $sources = $titleObject->getCascadeProtectionSources();
1343 foreach ( $sources[0] as $sourceTitle ) {
1344 $names[] = $sourceTitle->getPrefixedText();
1345 }
1346 return implode( $names, '|' );
1347 }
1348 return '';
1349 }
1350
1351}
$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,...
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
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,...
if( $line===false) $args
Definition cdb.php:63
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)
static getInstance( $lang=null)
Get a DateFormatter object.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
Class for handling an array of magic words.
static & get( $id)
Factory: creates an object representing an ID.
MediaWikiServices is the service locator for the application scope of MediaWiki.
static articles()
static pagesInNs( $ns)
static images()
static edits()
static users()
static pages()
static numberingroup( $group)
Find the number of users in a given user group.
static activeUsers()
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a title within MediaWiki.
Definition Title.php:39
hasFragment()
Check if a Title fragment is set.
Definition Title.php:1454
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
Definition deferred.txt:11
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
Definition design.txt:57
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
Definition design.txt:18
do that in ParserLimitReportFormat instead $parser
Definition hooks.txt:2572
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
Definition hooks.txt:863
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 "&lt;div ...>$1&lt;/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
Definition hooks.txt:1976
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
Definition hooks.txt:1975
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:783
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
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
Definition hooks.txt:1760
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
const NS_FILE
Definition Defines.php:71
const NS_SPECIAL
Definition Defines.php:54
const NS_MEDIA
Definition Defines.php:53
const PROTO_RELATIVE
Definition Defines.php:222
const NS_CATEGORY
Definition Defines.php:79
const STRIP_COMMENTS
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']
Definition magicword.txt:33
$cache
Definition mcc.php:33
$params
if(!isset( $args[0])) $lang