MediaWiki  1.23.1
CoreParserFunctions.php
Go to the documentation of this file.
1 <?php
33  static function register( $parser ) {
34  global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions;
35 
36  # Syntax for arguments (see self::setFunctionHook):
37  # "name for lookup in localized magic words array",
38  # function callback,
39  # optional SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
40  # instead of {{#int:...}})
41  $noHashFunctions = array(
42  'ns', 'nse', 'urlencode', 'lcfirst', 'ucfirst', 'lc', 'uc',
43  'localurl', 'localurle', 'fullurl', 'fullurle', 'canonicalurl',
44  'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural',
45  'numberofpages', 'numberofusers', 'numberofactiveusers',
46  'numberofarticles', 'numberoffiles', 'numberofadmins',
47  'numberingroup', 'numberofedits', 'numberofviews', 'language',
48  'padleft', 'padright', 'anchorencode', 'defaultsort', 'filepath',
49  'pagesincategory', 'pagesize', 'protectionlevel',
50  'namespacee', 'namespacenumber', 'talkspace', 'talkspacee',
51  'subjectspace', 'subjectspacee', 'pagename', 'pagenamee',
52  'fullpagename', 'fullpagenamee', 'rootpagename', 'rootpagenamee',
53  'basepagename', 'basepagenamee', 'subpagename', 'subpagenamee',
54  'talkpagename', 'talkpagenamee', 'subjectpagename',
55  'subjectpagenamee', 'pageid', 'revisionid', 'revisionday',
56  'revisionday2', 'revisionmonth', 'revisionmonth1', 'revisionyear',
57  'revisiontimestamp', 'revisionuser', 'cascadingsources',
58  );
59  foreach ( $noHashFunctions as $func ) {
60  $parser->setFunctionHook( $func, array( __CLASS__, $func ), SFH_NO_HASH );
61  }
62 
63  $parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), SFH_NO_HASH );
64  $parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), SFH_NO_HASH );
65  $parser->setFunctionHook( 'special', array( __CLASS__, 'special' ) );
66  $parser->setFunctionHook( 'speciale', array( __CLASS__, 'speciale' ) );
67  $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
68  $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
69 
70  if ( $wgAllowDisplayTitle ) {
71  $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
72  }
73  if ( $wgAllowSlowParserFunctions ) {
74  $parser->setFunctionHook( 'pagesinnamespace', array( __CLASS__, 'pagesinnamespace' ), SFH_NO_HASH );
75  }
76  }
77 
83  static function intFunction( $parser, $part1 = '' /*, ... */ ) {
84  if ( strval( $part1 ) !== '' ) {
85  $args = array_slice( func_get_args(), 2 );
86  $message = wfMessage( $part1, $args )->inLanguage( $parser->getOptions()->getUserLangObj() )->plain();
87  return array( $message, 'noparse' => false );
88  } else {
89  return array( 'found' => false );
90  }
91  }
92 
100  static function formatDate( $parser, $date, $defaultPref = null ) {
101  $lang = $parser->getFunctionLang();
102  $df = DateFormatter::getInstance( $lang );
103 
104  $date = trim( $date );
105 
106  $pref = $parser->getOptions()->getDateFormat();
107 
108  // Specify a different default date format other than the the normal default
109  // if the user has 'default' for their setting
110  if ( $pref == 'default' && $defaultPref ) {
111  $pref = $defaultPref;
112  }
113 
114  $date = $df->reformat( $pref, $date, array( 'match-whole' ) );
115  return $date;
116  }
117 
118  static function ns( $parser, $part1 = '' ) {
120  if ( intval( $part1 ) || $part1 == "0" ) {
121  $index = intval( $part1 );
122  } else {
123  $index = $wgContLang->getNsIndex( str_replace( ' ', '_', $part1 ) );
124  }
125  if ( $index !== false ) {
126  return $wgContLang->getFormattedNsText( $index );
127  } else {
128  return array( 'found' => false );
129  }
130  }
131 
132  static function nse( $parser, $part1 = '' ) {
133  $ret = self::ns( $parser, $part1 );
134  if ( is_string( $ret ) ) {
135  $ret = wfUrlencode( str_replace( ' ', '_', $ret ) );
136  }
137  return $ret;
138  }
139 
152  static function urlencode( $parser, $s = '', $arg = null ) {
153  static $magicWords = null;
154  if ( is_null( $magicWords ) ) {
155  $magicWords = new MagicWordArray( array( 'url_path', 'url_query', 'url_wiki' ) );
156  }
157  switch ( $magicWords->matchStartToEnd( $arg ) ) {
158 
159  // Encode as though it's a wiki page, '_' for ' '.
160  case 'url_wiki':
161  $func = 'wfUrlencode';
162  $s = str_replace( ' ', '_', $s );
163  break;
164 
165  // Encode for an HTTP Path, '%20' for ' '.
166  case 'url_path':
167  $func = 'rawurlencode';
168  break;
169 
170  // Encode for HTTP query, '+' for ' '.
171  case 'url_query':
172  default:
173  $func = 'urlencode';
174  }
175  return $parser->markerSkipCallback( $s, $func );
176  }
177 
178  static function lcfirst( $parser, $s = '' ) {
180  return $wgContLang->lcfirst( $s );
181  }
182 
183  static function ucfirst( $parser, $s = '' ) {
185  return $wgContLang->ucfirst( $s );
186  }
187 
193  static function lc( $parser, $s = '' ) {
195  return $parser->markerSkipCallback( $s, array( $wgContLang, 'lc' ) );
196  }
197 
203  static function uc( $parser, $s = '' ) {
205  return $parser->markerSkipCallback( $s, array( $wgContLang, 'uc' ) );
206  }
207 
208  static function localurl( $parser, $s = '', $arg = null ) {
209  return self::urlFunction( 'getLocalURL', $s, $arg );
210  }
211 
212  static function localurle( $parser, $s = '', $arg = null ) {
213  $temp = self::urlFunction( 'getLocalURL', $s, $arg );
214  if ( !is_string( $temp ) ) {
215  return $temp;
216  } else {
217  return htmlspecialchars( $temp );
218  }
219  }
220 
221  static function fullurl( $parser, $s = '', $arg = null ) {
222  return self::urlFunction( 'getFullURL', $s, $arg );
223  }
224 
225  static function fullurle( $parser, $s = '', $arg = null ) {
226  $temp = self::urlFunction( 'getFullURL', $s, $arg );
227  if ( !is_string( $temp ) ) {
228  return $temp;
229  } else {
230  return htmlspecialchars( $temp );
231  }
232  }
233 
234  static function canonicalurl( $parser, $s = '', $arg = null ) {
235  return self::urlFunction( 'getCanonicalURL', $s, $arg );
236  }
237 
238  static function canonicalurle( $parser, $s = '', $arg = null ) {
239  return self::urlFunction( 'escapeCanonicalURL', $s, $arg );
240  }
241 
242  static function urlFunction( $func, $s = '', $arg = null ) {
244  # Due to order of execution of a lot of bits, the values might be encoded
245  # before arriving here; if that's true, then the title can't be created
246  # and the variable will fail. If we can't get a decent title from the first
247  # attempt, url-decode and try for a second.
248  if ( is_null( $title ) ) {
249  $title = Title::newFromURL( urldecode( $s ) );
250  }
251  if ( !is_null( $title ) ) {
252  # Convert NS_MEDIA -> NS_FILE
253  if ( $title->getNamespace() == NS_MEDIA ) {
254  $title = Title::makeTitle( NS_FILE, $title->getDBkey() );
255  }
256  if ( !is_null( $arg ) ) {
257  $text = $title->$func( $arg );
258  } else {
259  $text = $title->$func();
260  }
261  return $text;
262  } else {
263  return array( 'found' => false );
264  }
265  }
266 
273  static function formatnum( $parser, $num = '', $arg = null ) {
274  if ( self::matchAgainstMagicword( 'rawsuffix', $arg ) ) {
275  $func = array( $parser->getFunctionLang(), 'parseFormattedNumber' );
276  } elseif ( self::matchAgainstMagicword( 'nocommafysuffix', $arg ) ) {
277  $func = array( $parser->getFunctionLang(), 'formatNumNoSeparators' );
278  } else {
279  $func = array( $parser->getFunctionLang(), 'formatNum' );
280  }
281  return $parser->markerSkipCallback( $num, $func );
282  }
283 
290  static function grammar( $parser, $case = '', $word = '' ) {
291  $word = $parser->killMarkers( $word );
292  return $parser->getFunctionLang()->convertGrammar( $word, $case );
293  }
294 
300  static function gender( $parser, $username ) {
301  wfProfileIn( __METHOD__ );
302  $forms = array_slice( func_get_args(), 2 );
303 
304  // Some shortcuts to avoid loading user data unnecessarily
305  if ( count( $forms ) === 0 ) {
306  wfProfileOut( __METHOD__ );
307  return '';
308  } elseif ( count( $forms ) === 1 ) {
309  wfProfileOut( __METHOD__ );
310  return $forms[0];
311  }
312 
313  $username = trim( $username );
314 
315  // default
316  $gender = User::getDefaultOption( 'gender' );
317 
318  // allow prefix.
319  $title = Title::newFromText( $username );
320 
321  if ( $title && $title->getNamespace() == NS_USER ) {
322  $username = $title->getText();
323  }
324 
325  // check parameter, or use the ParserOptions if in interface message
326  $user = User::newFromName( $username );
327  if ( $user ) {
328  $gender = GenderCache::singleton()->getGenderOf( $user, __METHOD__ );
329  } elseif ( $username === '' && $parser->getOptions()->getInterfaceMessage() ) {
330  $gender = GenderCache::singleton()->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
331  }
332  $ret = $parser->getFunctionLang()->gender( $gender, $forms );
333  wfProfileOut( __METHOD__ );
334  return $ret;
335  }
336 
342  static function plural( $parser, $text = '' ) {
343  $forms = array_slice( func_get_args(), 2 );
344  $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
345  settype( $text, ctype_digit( $text ) ? 'int' : 'float' );
346  return $parser->getFunctionLang()->convertPlural( $text, $forms );
347  }
348 
357  static function displaytitle( $parser, $text = '' ) {
358  global $wgRestrictDisplayTitle;
359 
360  // parse a limited subset of wiki markup (just the single quote items)
361  $text = $parser->doQuotes( $text );
362 
363  // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
364  $text = preg_replace( '/' . preg_quote( $parser->uniqPrefix(), '/' ) . '.*?'
365  . preg_quote( Parser::MARKER_SUFFIX, '/' ) . '/', '', $text );
366 
367  // list of disallowed tags for DISPLAYTITLE
368  // these will be escaped even though they are allowed in normal wiki text
369  $bad = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr',
370  'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br' );
371 
372  // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
373  if ( $wgRestrictDisplayTitle ) {
374  $htmlTagsCallback = function ( &$params ) {
376 
377  if ( isset( $decoded['style'] ) ) {
378  // this is called later anyway, but we need it right now for the regexes below to be safe
379  // calling it twice doesn't hurt
380  $decoded['style'] = Sanitizer::checkCss( $decoded['style'] );
381 
382  if ( preg_match( '/(display|user-select|visibility)\s*:/i', $decoded['style'] ) ) {
383  $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */';
384  }
385  }
386 
388  };
389  } else {
390  $htmlTagsCallback = null;
391  }
392 
393  // only requested titles that normalize to the actual title are allowed through
394  // if $wgRestrictDisplayTitle is true (it is by default)
395  // mimic the escaping process that occurs in OutputPage::setPageTitle
396  $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $text, $htmlTagsCallback, array(), array(), $bad ) );
398 
399  if ( !$wgRestrictDisplayTitle ) {
400  $parser->mOutput->setDisplayTitle( $text );
401  } elseif ( $title instanceof Title && !$title->hasFragment() && $title->equals( $parser->mTitle ) ) {
402  $parser->mOutput->setDisplayTitle( $text );
403  }
404 
405  return '';
406  }
407 
415  private static function matchAgainstMagicword( $magicword, $value ) {
416  $value = trim( strval( $value ) );
417  if ( $value === '' ) {
418  return false;
419  }
420  $mwObject = MagicWord::get( $magicword );
421  return $mwObject->matchStartToEnd( $value );
422  }
423 
424  static function formatRaw( $num, $raw ) {
425  if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
426  return $num;
427  } else {
429  return $wgContLang->formatNum( $num );
430  }
431  }
432  static function numberofpages( $parser, $raw = null ) {
433  return self::formatRaw( SiteStats::pages(), $raw );
434  }
435  static function numberofusers( $parser, $raw = null ) {
436  return self::formatRaw( SiteStats::users(), $raw );
437  }
438  static function numberofactiveusers( $parser, $raw = null ) {
439  return self::formatRaw( SiteStats::activeUsers(), $raw );
440  }
441  static function numberofarticles( $parser, $raw = null ) {
442  return self::formatRaw( SiteStats::articles(), $raw );
443  }
444  static function numberoffiles( $parser, $raw = null ) {
445  return self::formatRaw( SiteStats::images(), $raw );
446  }
447  static function numberofadmins( $parser, $raw = null ) {
448  return self::formatRaw( SiteStats::numberingroup( 'sysop' ), $raw );
449  }
450  static function numberofedits( $parser, $raw = null ) {
451  return self::formatRaw( SiteStats::edits(), $raw );
452  }
453  static function numberofviews( $parser, $raw = null ) {
454  global $wgDisableCounters;
455  return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : '';
456  }
457  static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
458  return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw );
459  }
460  static function numberingroup( $parser, $name = '', $raw = null ) {
461  return self::formatRaw( SiteStats::numberingroup( strtolower( $name ) ), $raw );
462  }
463 
471  static function mwnamespace( $parser, $title = null ) {
473  if ( is_null( $t ) ) {
474  return '';
475  }
476  return str_replace( '_', ' ', $t->getNsText() );
477  }
478  static function namespacee( $parser, $title = null ) {
480  if ( is_null( $t ) ) {
481  return '';
482  }
483  return wfUrlencode( $t->getNsText() );
484  }
485  static function namespacenumber( $parser, $title = null ) {
487  if ( is_null( $t ) ) {
488  return '';
489  }
490  return $t->getNamespace();
491  }
492  static function talkspace( $parser, $title = null ) {
494  if ( is_null( $t ) || !$t->canTalk() ) {
495  return '';
496  }
497  return str_replace( '_', ' ', $t->getTalkNsText() );
498  }
499  static function talkspacee( $parser, $title = null ) {
501  if ( is_null( $t ) || !$t->canTalk() ) {
502  return '';
503  }
504  return wfUrlencode( $t->getTalkNsText() );
505  }
506  static function subjectspace( $parser, $title = null ) {
508  if ( is_null( $t ) ) {
509  return '';
510  }
511  return str_replace( '_', ' ', $t->getSubjectNsText() );
512  }
513  static function subjectspacee( $parser, $title = null ) {
515  if ( is_null( $t ) ) {
516  return '';
517  }
518  return wfUrlencode( $t->getSubjectNsText() );
519  }
520 
526  static function pagename( $parser, $title = null ) {
528  if ( is_null( $t ) ) {
529  return '';
530  }
531  return wfEscapeWikiText( $t->getText() );
532  }
533  static function pagenamee( $parser, $title = null ) {
535  if ( is_null( $t ) ) {
536  return '';
537  }
538  return wfEscapeWikiText( $t->getPartialURL() );
539  }
540  static function fullpagename( $parser, $title = null ) {
542  if ( is_null( $t ) || !$t->canTalk() ) {
543  return '';
544  }
545  return wfEscapeWikiText( $t->getPrefixedText() );
546  }
547  static function fullpagenamee( $parser, $title = null ) {
549  if ( is_null( $t ) || !$t->canTalk() ) {
550  return '';
551  }
552  return wfEscapeWikiText( $t->getPrefixedURL() );
553  }
554  static function subpagename( $parser, $title = null ) {
556  if ( is_null( $t ) ) {
557  return '';
558  }
559  return wfEscapeWikiText( $t->getSubpageText() );
560  }
561  static function subpagenamee( $parser, $title = null ) {
563  if ( is_null( $t ) ) {
564  return '';
565  }
566  return wfEscapeWikiText( $t->getSubpageUrlForm() );
567  }
568  static function rootpagename( $parser, $title = null ) {
570  if ( is_null( $t ) ) {
571  return '';
572  }
573  return wfEscapeWikiText( $t->getRootText() );
574  }
575  static function rootpagenamee( $parser, $title = null ) {
577  if ( is_null( $t ) ) {
578  return '';
579  }
580  return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getRootText() ) ) );
581  }
582  static function basepagename( $parser, $title = null ) {
584  if ( is_null( $t ) ) {
585  return '';
586  }
587  return wfEscapeWikiText( $t->getBaseText() );
588  }
589  static function basepagenamee( $parser, $title = null ) {
591  if ( is_null( $t ) ) {
592  return '';
593  }
594  return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
595  }
596  static function talkpagename( $parser, $title = null ) {
598  if ( is_null( $t ) || !$t->canTalk() ) {
599  return '';
600  }
601  return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
602  }
603  static function talkpagenamee( $parser, $title = null ) {
605  if ( is_null( $t ) || !$t->canTalk() ) {
606  return '';
607  }
608  return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
609  }
610  static function subjectpagename( $parser, $title = null ) {
612  if ( is_null( $t ) ) {
613  return '';
614  }
615  return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
616  }
617  static function subjectpagenamee( $parser, $title = null ) {
619  if ( is_null( $t ) ) {
620  return '';
621  }
622  return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedURL() );
623  }
624 
631  static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) {
633  static $magicWords = null;
634  if ( is_null( $magicWords ) ) {
636  'pagesincategory_all',
637  'pagesincategory_pages',
638  'pagesincategory_subcats',
639  'pagesincategory_files'
640  ) );
641  }
642  static $cache = array();
643 
644  // split the given option to its variable
645  if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
646  //{{pagesincategory:|raw[|type]}}
647  $raw = $arg1;
648  $type = $magicWords->matchStartToEnd( $arg2 );
649  } else {
650  //{{pagesincategory:[|type[|raw]]}}
651  $type = $magicWords->matchStartToEnd( $arg1 );
652  $raw = $arg2;
653  }
654  if ( !$type ) { //backward compatibility
655  $type = 'pagesincategory_all';
656  }
657 
659  if ( !$title ) { # invalid title
660  return self::formatRaw( 0, $raw );
661  }
662  $wgContLang->findVariantLink( $name, $title, true );
663 
664  // Normalize name for cache
665  $name = $title->getDBkey();
666 
667  if ( !isset( $cache[$name] ) ) {
668  $category = Category::newFromTitle( $title );
669 
670  $allCount = $subcatCount = $fileCount = $pagesCount = 0;
671  if ( $parser->incrementExpensiveFunctionCount() ) {
672  // $allCount is the total number of cat members,
673  // not the count of how many members are normal pages.
674  $allCount = (int)$category->getPageCount();
675  $subcatCount = (int)$category->getSubcatCount();
676  $fileCount = (int)$category->getFileCount();
677  $pagesCount = $allCount - $subcatCount - $fileCount;
678  }
679  $cache[$name]['pagesincategory_all'] = $allCount;
680  $cache[$name]['pagesincategory_pages'] = $pagesCount;
681  $cache[$name]['pagesincategory_subcats'] = $subcatCount;
682  $cache[$name]['pagesincategory_files'] = $fileCount;
683  }
684 
685  $count = $cache[$name][$type];
686  return self::formatRaw( $count, $raw );
687  }
688 
698  static function pagesize( $parser, $page = '', $raw = null ) {
699  $title = Title::newFromText( $page );
700 
701  if ( !is_object( $title ) ) {
702  return self::formatRaw( 0, $raw );
703  }
704 
705  // fetch revision from cache/database and return the value
707  $length = $rev ? $rev->getSize() : 0;
708  return self::formatRaw( $length, $raw );
709  }
710 
723  static function protectionlevel( $parser, $type = '', $title = '' ) {
724  $titleObject = Title::newFromText( $title );
725  if ( !( $titleObject instanceof Title ) ) {
726  $titleObject = $parser->mTitle;
727  }
728  if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
729  $restrictions = $titleObject->getRestrictions( strtolower( $type ) );
730  # Title::getRestrictions returns an array, its possible it may have
731  # multiple values in the future
732  return implode( $restrictions, ',' );
733  }
734  return '';
735  }
736 
744  static function language( $parser, $code = '', $inLanguage = '' ) {
745  $code = strtolower( $code );
746  $inLanguage = strtolower( $inLanguage );
747  $lang = Language::fetchLanguageName( $code, $inLanguage );
748  return $lang !== '' ? $lang : wfBCP47( $code );
749  }
750 
755  static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
756  $padding = $parser->killMarkers( $padding );
757  $lengthOfPadding = mb_strlen( $padding );
758  if ( $lengthOfPadding == 0 ) {
759  return $string;
760  }
761 
762  # The remaining length to add counts down to 0 as padding is added
763  $length = min( $length, 500 ) - mb_strlen( $string );
764  # $finalPadding is just $padding repeated enough times so that
765  # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length
766  $finalPadding = '';
767  while ( $length > 0 ) {
768  # If $length < $lengthofPadding, truncate $padding so we get the
769  # exact length desired.
770  $finalPadding .= mb_substr( $padding, 0, $length );
771  $length -= $lengthOfPadding;
772  }
773 
774  if ( $direction == STR_PAD_LEFT ) {
775  return $finalPadding . $string;
776  } else {
777  return $string . $finalPadding;
778  }
779  }
780 
781  static function padleft( $parser, $string = '', $length = 0, $padding = '0' ) {
782  return self::pad( $parser, $string, $length, $padding, STR_PAD_LEFT );
783  }
784 
785  static function padright( $parser, $string = '', $length = 0, $padding = '0' ) {
786  return self::pad( $parser, $string, $length, $padding );
787  }
788 
794  static function anchorencode( $parser, $text ) {
795  $text = $parser->killMarkers( $text );
796  return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
797  }
798 
799  static function special( $parser, $text ) {
800  list( $page, $subpage ) = SpecialPageFactory::resolveAlias( $text );
801  if ( $page ) {
802  $title = SpecialPage::getTitleFor( $page, $subpage );
803  return $title->getPrefixedText();
804  } else {
805  // unknown special page, just use the given text as its title, if at all possible
807  return $title ? $title->getPrefixedText() : self::special( $parser, 'Badtitle' );
808  }
809  }
810 
811  static function speciale( $parser, $text ) {
812  return wfUrlencode( str_replace( ' ', '_', self::special( $parser, $text ) ) );
813  }
814 
823  public static function defaultsort( $parser, $text, $uarg = '' ) {
824  static $magicWords = null;
825  if ( is_null( $magicWords ) ) {
826  $magicWords = new MagicWordArray( array( 'defaultsort_noerror', 'defaultsort_noreplace' ) );
827  }
828  $arg = $magicWords->matchStartToEnd( $uarg );
829 
830  $text = trim( $text );
831  if ( strlen( $text ) == 0 ) {
832  return '';
833  }
834  $old = $parser->getCustomDefaultSort();
835  if ( $old === false || $arg !== 'defaultsort_noreplace' ) {
836  $parser->setDefaultSort( $text );
837  }
838 
839  if ( $old === false || $old == $text || $arg ) {
840  return '';
841  } else {
842  $converter = $parser->getConverterLanguage()->getConverter();
843  return '<span class="error">' .
844  wfMessage( 'duplicate-defaultsort',
845  // Message should be parsed, but these params should only be escaped.
846  $converter->markNoConversion( wfEscapeWikiText( $old ) ),
847  $converter->markNoConversion( wfEscapeWikiText( $text ) )
848  )->inContentLanguage()->text() .
849  '</span>';
850  }
851  }
852 
853  // Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}}
854  // or {{filepath|300px}}, {{filepath|200x300px}}, {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}}
855  public static function filepath( $parser, $name = '', $argA = '', $argB = '' ) {
856  $file = wfFindFile( $name );
857 
858  if ( $argA == 'nowiki' ) {
859  // {{filepath: | option [| size] }}
860  $isNowiki = true;
861  $parsedWidthParam = $parser->parseWidthParam( $argB );
862  } else {
863  // {{filepath: [| size [|option]] }}
864  $parsedWidthParam = $parser->parseWidthParam( $argA );
865  $isNowiki = ( $argB == 'nowiki' );
866  }
867 
868  if ( $file ) {
869  $url = $file->getFullUrl();
870 
871  // If a size is requested...
872  if ( count( $parsedWidthParam ) ) {
873  $mto = $file->transform( $parsedWidthParam );
874  // ... and we can
875  if ( $mto && !$mto->isError() ) {
876  // ... change the URL to point to a thumbnail.
877  $url = wfExpandUrl( $mto->getUrl(), PROTO_RELATIVE );
878  }
879  }
880  if ( $isNowiki ) {
881  return array( $url, 'nowiki' => true );
882  }
883  return $url;
884  } else {
885  return '';
886  }
887  }
888 
893  public static function tagObj( $parser, $frame, $args ) {
894  if ( !count( $args ) ) {
895  return '';
896  }
897  $tagName = strtolower( trim( $frame->expand( array_shift( $args ) ) ) );
898 
899  if ( count( $args ) ) {
900  $inner = $frame->expand( array_shift( $args ) );
901  } else {
902  $inner = null;
903  }
904 
905  $stripList = $parser->getStripList();
906  if ( !in_array( $tagName, $stripList ) ) {
907  return '<span class="error">' .
908  wfMessage( 'unknown_extension_tag', $tagName )->inContentLanguage()->text() .
909  '</span>';
910  }
911 
912  $attributes = array();
913  foreach ( $args as $arg ) {
914  $bits = $arg->splitArg();
915  if ( strval( $bits['index'] ) === '' ) {
916  $name = trim( $frame->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
917  $value = trim( $frame->expand( $bits['value'] ) );
918  if ( preg_match( '/^(?:["\'](.+)["\']|""|\'\')$/s', $value, $m ) ) {
919  $value = isset( $m[1] ) ? $m[1] : '';
920  }
921  $attributes[$name] = $value;
922  }
923  }
924 
925  $params = array(
926  'name' => $tagName,
927  'inner' => $inner,
928  'attributes' => $attributes,
929  'close' => "</$tagName>",
930  );
931  return $parser->extensionSubstitution( $params, $frame );
932  }
933 
946  private static function getCachedRevisionObject( $parser, $title = null ) {
947  static $cache = array();
948 
949  if ( is_null( $title ) ) {
950  return null;
951  }
952 
953  // Use the revision from the parser itself, when param is the current page
954  // and the revision is the current one
955  if ( $title->equals( $parser->getTitle() ) ) {
956  $parserRev = $parser->getRevisionObject();
957  if ( $parserRev && $parserRev->isCurrent() ) {
958  // force reparse after edit with vary-revision flag
959  $parser->getOutput()->setFlag( 'vary-revision' );
960  wfDebug( __METHOD__ . ": use current revision from parser, setting vary-revision...\n" );
961  return $parserRev;
962  }
963  }
964 
965  // Normalize name for cache
966  $page = $title->getPrefixedDBkey();
967 
968  if ( array_key_exists( $page, $cache ) ) { // cache contains null values
969  return $cache[$page];
970  }
971  if ( $parser->incrementExpensiveFunctionCount() ) {
973  $pageID = $rev ? $rev->getPage() : 0;
974  $revID = $rev ? $rev->getId() : 0;
975  $cache[$page] = $rev; // maybe null
976 
977  // Register dependency in templatelinks
978  $parser->getOutput()->addTemplate( $title, $pageID, $revID );
979 
980  return $rev;
981  }
982  $cache[$page] = null;
983  return null;
984  }
985 
992  public static function pageid( $parser, $title = null ) {
994  if ( is_null( $t ) ) {
995  return '';
996  }
997  // Use title from parser to have correct pageid after edit
998  if ( $t->equals( $parser->getTitle() ) ) {
999  $t = $parser->getTitle();
1000  return $t->getArticleID();
1001  }
1002 
1003  // These can't have ids
1004  if ( !$t->canExist() || $t->isExternal() ) {
1005  return 0;
1006  }
1007 
1008  // Check the link cache, maybe something already looked it up.
1009  $linkCache = LinkCache::singleton();
1010  $pdbk = $t->getPrefixedDBkey();
1011  $id = $linkCache->getGoodLinkID( $pdbk );
1012  if ( $id != 0 ) {
1013  $parser->mOutput->addLink( $t, $id );
1014  return $id;
1015  }
1016  if ( $linkCache->isBadLink( $pdbk ) ) {
1017  $parser->mOutput->addLink( $t, 0 );
1018  return $id;
1019  }
1020 
1021  // We need to load it from the DB, so mark expensive
1022  if ( $parser->incrementExpensiveFunctionCount() ) {
1023  $id = $t->getArticleID();
1024  $parser->mOutput->addLink( $t, $id );
1025  return $id;
1026  }
1027  return null;
1028  }
1029 
1036  public static function revisionid( $parser, $title = null ) {
1038  if ( is_null( $t ) ) {
1039  return '';
1040  }
1041  // fetch revision from cache/database and return the value
1043  return $rev ? $rev->getId() : '';
1044  }
1045 
1052  public static function revisionday( $parser, $title = null ) {
1054  if ( is_null( $t ) ) {
1055  return '';
1056  }
1057  // fetch revision from cache/database and return the value
1059  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'j' ) : '';
1060  }
1061 
1068  public static function revisionday2( $parser, $title = null ) {
1070  if ( is_null( $t ) ) {
1071  return '';
1072  }
1073  // fetch revision from cache/database and return the value
1075  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'd' ) : '';
1076  }
1077 
1084  public static function revisionmonth( $parser, $title = null ) {
1086  if ( is_null( $t ) ) {
1087  return '';
1088  }
1089  // fetch revision from cache/database and return the value
1091  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'm' ) : '';
1092  }
1093 
1100  public static function revisionmonth1( $parser, $title = null ) {
1102  if ( is_null( $t ) ) {
1103  return '';
1104  }
1105  // fetch revision from cache/database and return the value
1107  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'n' ) : '';
1108  }
1109 
1116  public static function revisionyear( $parser, $title = null ) {
1118  if ( is_null( $t ) ) {
1119  return '';
1120  }
1121  // fetch revision from cache/database and return the value
1123  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'Y' ) : '';
1124  }
1125 
1132  public static function revisiontimestamp( $parser, $title = null ) {
1134  if ( is_null( $t ) ) {
1135  return '';
1136  }
1137  // fetch revision from cache/database and return the value
1139  return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'YmdHis' ) : '';
1140  }
1141 
1148  public static function revisionuser( $parser, $title = null ) {
1150  if ( is_null( $t ) ) {
1151  return '';
1152  }
1153  // fetch revision from cache/database and return the value
1155  return $rev ? $rev->getUserText() : '';
1156  }
1157 
1170  public static function cascadingsources( $parser, $title = '' ) {
1171  $titleObject = Title::newFromText( $title );
1172  if ( !( $titleObject instanceof Title ) ) {
1173  $titleObject = $parser->mTitle;
1174  }
1175  if ( $titleObject->areCascadeProtectionSourcesLoaded()
1176  || $parser->incrementExpensiveFunctionCount()
1177  ) {
1178  $names = array();
1179  $sources = $titleObject->getCascadeProtectionSources();
1180  foreach ( $sources[0] as $sourceTitle ) {
1181  $names[] = $sourceTitle->getPrefixedText();
1182  }
1183  return implode( $names, '|' );
1184  }
1185  return '';
1186  }
1187 
1188 }
User\getDefaultOption
static getDefaultOption( $opt)
Get a given default option value.
Definition: User.php:1383
GenderCache\singleton
static singleton()
Definition: GenderCache.php:39
SiteStats\articles
static articles()
Definition: SiteStats.php:124
DateFormatter\getInstance
static & getInstance( $lang=null)
Get a DateFormatter object.
Definition: DateFormatter.php:127
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
MagicWordArray
Class for handling an array of magic words.
Definition: MagicWord.php:676
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
PPFrame\STRIP_COMMENTS
const STRIP_COMMENTS
Definition: Preprocessor.php:75
wfBCP47
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
Definition: GlobalFunctions.php:3920
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
SiteStats\users
static users()
Definition: SiteStats.php:140
CoreParserFunctions\matchAgainstMagicword
static matchAgainstMagicword( $magicword, $value)
Matches the given value against the value of given magic word.
Definition: CoreParserFunctions.php:415
SiteStats\activeUsers
static activeUsers()
Definition: SiteStats.php:148
CoreParserFunctions\pad
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.
Definition: CoreParserFunctions.php:755
CoreParserFunctions\numberofactiveusers
static numberofactiveusers( $parser, $raw=null)
Definition: CoreParserFunctions.php:438
CoreParserFunctions\pageid
static pageid( $parser, $title=null)
Get the pageid of a specified page.
Definition: CoreParserFunctions.php:992
CoreParserFunctions\talkpagename
static talkpagename( $parser, $title=null)
Definition: CoreParserFunctions.php:596
CoreParserFunctions\rootpagename
static rootpagename( $parser, $title=null)
Definition: CoreParserFunctions.php:568
CoreParserFunctions\tagObj
static tagObj( $parser, $frame, $args)
Parser function to extension tag adaptor.
Definition: CoreParserFunctions.php:893
CoreParserFunctions\pagesize
static pagesize( $parser, $page='', $raw=null)
Return the size of the given page, or 0 if it's nonexistent.
Definition: CoreParserFunctions.php:698
SiteStats\pages
static pages()
Definition: SiteStats.php:132
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
CoreParserFunctions\rootpagenamee
static rootpagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:575
CoreParserFunctions\protectionlevel
static protectionlevel( $parser, $type='', $title='')
Returns the requested protection level for the current page.
Definition: CoreParserFunctions.php:723
$ret
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:1530
wfUrlencode
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
Definition: GlobalFunctions.php:330
SiteStats\numberingroup
static numberingroup( $group)
Find the number of users in a given user group.
Definition: SiteStats.php:166
SFH_OBJECT_ARGS
const SFH_OBJECT_ARGS
Definition: Defines.php:241
MagicWord\get
static & get( $id)
Factory: creates an object representing an ID.
Definition: MagicWord.php:238
CoreParserFunctions\nse
static nse( $parser, $part1='')
Definition: CoreParserFunctions.php:132
NS_FILE
const NS_FILE
Definition: Defines.php:85
$params
$params
Definition: styleTest.css.php:40
CoreParserFunctions\revisionmonth1
static revisionmonth1( $parser, $title=null)
Get the month from the last revision of a specified page.
Definition: CoreParserFunctions.php:1100
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:388
Sanitizer\safeEncodeTagAttributes
static safeEncodeTagAttributes( $assoc_array)
Build a partial tag string from an associative array of attribute names and values as returned by dec...
Definition: Sanitizer.php:1202
$s
$s
Definition: mergeMessageFileList.php:156
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
CoreParserFunctions\namespacenumber
static namespacenumber( $parser, $title=null)
Definition: CoreParserFunctions.php:485
CoreParserFunctions\talkspace
static talkspace( $parser, $title=null)
Definition: CoreParserFunctions.php:492
$wgContLang
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 content language as $wgContLang
Definition: design.txt:56
CoreParserFunctions\grammar
static grammar( $parser, $case='', $word='')
Definition: CoreParserFunctions.php:290
Sanitizer\stripAllTags
static stripAllTags( $text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1718
CoreParserFunctions\defaultsort
static defaultsort( $parser, $text, $uarg='')
Definition: CoreParserFunctions.php:823
CoreParserFunctions\revisionday
static revisionday( $parser, $title=null)
Get the day from the last revision of a specified page.
Definition: CoreParserFunctions.php:1052
CoreParserFunctions\pagename
static pagename( $parser, $title=null)
Functions to get and normalize pagenames, corresponding to the magic words of the same names.
Definition: CoreParserFunctions.php:526
SiteStats\images
static images()
Definition: SiteStats.php:156
CoreParserFunctions\revisionid
static revisionid( $parser, $title=null)
Get the id from the last revision of a specified page.
Definition: CoreParserFunctions.php:1036
CoreParserFunctions\talkspacee
static talkspacee( $parser, $title=null)
Definition: CoreParserFunctions.php:499
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
CoreParserFunctions\localurle
static localurle( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:212
IDBAccessObject\READ_NORMAL
const READ_NORMAL
Definition: IDBAccessObject.php:53
CoreParserFunctions\getCachedRevisionObject
static getCachedRevisionObject( $parser, $title=null)
Fetched the current revision of the given title and return this.
Definition: CoreParserFunctions.php:946
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
CoreParserFunctions\displaytitle
static displaytitle( $parser, $text='')
Override the title of the page when viewed, provided we've been given a title which will normalise to...
Definition: CoreParserFunctions.php:357
CoreParserFunctions\plural
static plural( $parser, $text='')
Definition: CoreParserFunctions.php:342
CoreParserFunctions\numberofpages
static numberofpages( $parser, $raw=null)
Definition: CoreParserFunctions.php:432
CoreParserFunctions\basepagenamee
static basepagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:589
$parser
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:1956
CoreParserFunctions\revisionyear
static revisionyear( $parser, $title=null)
Get the year from the last revision of a specified page.
Definition: CoreParserFunctions.php:1116
CoreParserFunctions\numberofviews
static numberofviews( $parser, $raw=null)
Definition: CoreParserFunctions.php:453
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
wfMessage
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 an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables 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
CoreParserFunctions\mwnamespace
static mwnamespace( $parser, $title=null)
Given a title, return the namespace name that would be given by the corresponding magic word Note: fu...
Definition: CoreParserFunctions.php:471
CoreParserFunctions\fullurle
static fullurle( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:225
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
CoreParserFunctions\numberofedits
static numberofedits( $parser, $raw=null)
Definition: CoreParserFunctions.php:450
CoreParserFunctions\revisionday2
static revisionday2( $parser, $title=null)
Get the day with leading zeros from the last revision of a specified page.
Definition: CoreParserFunctions.php:1068
CoreParserFunctions\fullurl
static fullurl( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:221
CoreParserFunctions\ucfirst
static ucfirst( $parser, $s='')
Definition: CoreParserFunctions.php:183
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
CoreParserFunctions\fullpagenamee
static fullpagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:547
$magicWords
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
CoreParserFunctions\gender
static gender( $parser, $username)
Definition: CoreParserFunctions.php:300
CoreParserFunctions\pagenamee
static pagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:533
CoreParserFunctions\ns
static ns( $parser, $part1='')
Definition: CoreParserFunctions.php:118
CoreParserFunctions\subjectpagename
static subjectpagename( $parser, $title=null)
Definition: CoreParserFunctions.php:610
CoreParserFunctions\language
static language( $parser, $code='', $inLanguage='')
Gives language names.
Definition: CoreParserFunctions.php:744
CoreParserFunctions\revisiontimestamp
static revisiontimestamp( $parser, $title=null)
Get the timestamp from the last revision of a specified page.
Definition: CoreParserFunctions.php:1132
list
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
Category\newFromTitle
static newFromTitle( $title)
Factory function.
Definition: Category.php:134
CoreParserFunctions\urlencode
static urlencode( $parser, $s='', $arg=null)
urlencodes a string according to one of three patterns: (bug 22474)
Definition: CoreParserFunctions.php:152
CoreParserFunctions\formatDate
static formatDate( $parser, $date, $defaultPref=null)
Definition: CoreParserFunctions.php:100
Revision\newFromTitle
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
Definition: Revision.php:106
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
CoreParserFunctions\fullpagename
static fullpagename( $parser, $title=null)
Definition: CoreParserFunctions.php:540
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
SiteStats\pagesInNs
static pagesInNs( $ns)
Definition: SiteStats.php:206
$value
$value
Definition: styleTest.css.php:45
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:67
CoreParserFunctions\formatRaw
static formatRaw( $num, $raw)
Definition: CoreParserFunctions.php:424
CoreParserFunctions\padleft
static padleft( $parser, $string='', $length=0, $padding='0')
Definition: CoreParserFunctions.php:781
CoreParserFunctions\padright
static padright( $parser, $string='', $length=0, $padding='0')
Definition: CoreParserFunctions.php:785
Title\newFromURL
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Definition: Title.php:241
CoreParserFunctions\revisionmonth
static revisionmonth( $parser, $title=null)
Get the month with leading zeros from the last revision of a specified page.
Definition: CoreParserFunctions.php:1084
SpecialPageFactory\resolveAlias
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:271
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:2077
PROTO_RELATIVE
const PROTO_RELATIVE
Definition: Defines.php:269
CoreParserFunctions\subjectspacee
static subjectspacee( $parser, $title=null)
Definition: CoreParserFunctions.php:513
CoreParserFunctions\speciale
static speciale( $parser, $text)
Definition: CoreParserFunctions.php:811
Language\fetchLanguageName
static fetchLanguageName( $code, $inLanguage=null, $include='all')
Definition: Language.php:936
CoreParserFunctions\urlFunction
static urlFunction( $func, $s='', $arg=null)
Definition: CoreParserFunctions.php:242
CoreParserFunctions\lc
static lc( $parser, $s='')
Definition: CoreParserFunctions.php:193
CoreParserFunctions\subjectspace
static subjectspace( $parser, $title=null)
Definition: CoreParserFunctions.php:506
CoreParserFunctions\subjectpagenamee
static subjectpagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:617
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
SFH_NO_HASH
const SFH_NO_HASH
Definition: Defines.php:240
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
$count
$count
Definition: UtfNormalTest2.php:96
$rev
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:1337
$args
if( $line===false) $args
Definition: cdb.php:62
Title
Represents a title within MediaWiki.
Definition: Title.php:35
CoreParserFunctions\numberofadmins
static numberofadmins( $parser, $raw=null)
Definition: CoreParserFunctions.php:447
CoreParserFunctions\cascadingsources
static cascadingsources( $parser, $title='')
Returns the sources of any cascading protection acting on a specified page.
Definition: CoreParserFunctions.php:1170
CoreParserFunctions\anchorencode
static anchorencode( $parser, $text)
Definition: CoreParserFunctions.php:794
$cache
$cache
Definition: mcc.php:32
CoreParserFunctions\uc
static uc( $parser, $s='')
Definition: CoreParserFunctions.php:203
CoreParserFunctions\special
static special( $parser, $text)
Definition: CoreParserFunctions.php:799
CoreParserFunctions\subpagenamee
static subpagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:561
CoreParserFunctions\filepath
static filepath( $parser, $name='', $argA='', $argB='')
Definition: CoreParserFunctions.php:855
CoreParserFunctions\namespacee
static namespacee( $parser, $title=null)
Definition: CoreParserFunctions.php:478
CoreParserFunctions\numberofarticles
static numberofarticles( $parser, $raw=null)
Definition: CoreParserFunctions.php:441
format
if the prop value should be in the metadata multi language array format
Definition: hooks.txt:1230
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
wfFindFile
wfFindFile( $title, $options=array())
Find a file.
Definition: GlobalFunctions.php:3693
CoreParserFunctions
Various core parser functions, registered in Parser::firstCallInit()
Definition: CoreParserFunctions.php:28
CoreParserFunctions\subpagename
static subpagename( $parser, $title=null)
Definition: CoreParserFunctions.php:554
NS_USER
const NS_USER
Definition: Defines.php:81
CoreParserFunctions\revisionuser
static revisionuser( $parser, $title=null)
Get the user from the last revision of a specified page.
Definition: CoreParserFunctions.php:1148
CoreParserFunctions\numberingroup
static numberingroup( $parser, $name='', $raw=null)
Definition: CoreParserFunctions.php:460
Sanitizer\normalizeCharReferences
static normalizeCharReferences( $text)
Ensure that any entities and character references are legal for XML and XHTML specifically.
Definition: Sanitizer.php:1299
SiteStats\views
static views()
Definition: SiteStats.php:108
Sanitizer\decodeTagAttributes
static decodeTagAttributes( $text)
Return an associative array of attribute names and values from a partial tag string.
Definition: Sanitizer.php:1166
CoreParserFunctions\numberofusers
static numberofusers( $parser, $raw=null)
Definition: CoreParserFunctions.php:435
$t
$t
Definition: testCompression.php:65
CoreParserFunctions\pagesincategory
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.
Definition: CoreParserFunctions.php:631
CoreParserFunctions\numberoffiles
static numberoffiles( $parser, $raw=null)
Definition: CoreParserFunctions.php:444
CoreParserFunctions\pagesinnamespace
static pagesinnamespace( $parser, $namespace=0, $raw=null)
Definition: CoreParserFunctions.php:457
CoreParserFunctions\formatnum
static formatnum( $parser, $num='', $arg=null)
Definition: CoreParserFunctions.php:273
CoreParserFunctions\lcfirst
static lcfirst( $parser, $s='')
Definition: CoreParserFunctions.php:178
CoreParserFunctions\canonicalurl
static canonicalurl( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:234
Sanitizer\checkCss
static checkCss( $value)
Pick apart some CSS and check it for forbidden or unsafe structures.
Definition: Sanitizer.php:838
LinkCache\singleton
static & singleton()
Get an instance of this class.
Definition: LinkCache.php:49
MWTimestamp\getLocalInstance
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
Definition: MWTimestamp.php:373
SiteStats\edits
static edits()
Definition: SiteStats.php:116
CoreParserFunctions\intFunction
static intFunction( $parser, $part1='')
Definition: CoreParserFunctions.php:83
CoreParserFunctions\basepagename
static basepagename( $parser, $title=null)
Definition: CoreParserFunctions.php:582
CoreParserFunctions\canonicalurle
static canonicalurle( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:238
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:497
CoreParserFunctions\localurl
static localurl( $parser, $s='', $arg=null)
Definition: CoreParserFunctions.php:208
Sanitizer\removeHTMLtags
static removeHTMLtags( $text, $processCallback=null, $args=array(), $extratags=array(), $removetags=array())
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
Definition: Sanitizer.php:366
$type
$type
Definition: testCompression.php:46
CoreParserFunctions\talkpagenamee
static talkpagenamee( $parser, $title=null)
Definition: CoreParserFunctions.php:603