MediaWiki  1.29.2
ApiHelp.php
Go to the documentation of this file.
1 <?php
27 use HtmlFormatter\HtmlFormatter;
28 
35 class ApiHelp extends ApiBase {
36  public function execute() {
37  $params = $this->extractRequestParams();
38  $modules = [];
39 
40  foreach ( $params['modules'] as $path ) {
41  $modules[] = $this->getModuleFromPath( $path );
42  }
43 
44  // Get the help
45  $context = new DerivativeContext( $this->getMain()->getContext() );
46  $context->setSkin( SkinFactory::getDefaultInstance()->makeSkin( 'apioutput' ) );
47  $context->setLanguage( $this->getMain()->getLanguage() );
48  $context->setTitle( SpecialPage::getTitleFor( 'ApiHelp' ) );
49  $out = new OutputPage( $context );
50  $out->setCopyrightUrl( 'https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright' );
51  $context->setOutput( $out );
52 
54 
55  // Grab the output from the skin
56  ob_start();
57  $context->getOutput()->output();
58  $html = ob_get_clean();
59 
60  $result = $this->getResult();
61  if ( $params['wrap'] ) {
62  $data = [
63  'mime' => 'text/html',
64  'filename' => 'api-help.html',
65  'help' => $html,
66  ];
67  ApiResult::setSubelementsList( $data, 'help' );
68  $result->addValue( null, $this->getModuleName(), $data );
69  } else {
70  $result->reset();
71  $result->addValue( null, 'text', $html, ApiResult::NO_SIZE_CHECK );
72  $result->addValue( null, 'mime', 'text/html', ApiResult::NO_SIZE_CHECK );
73  $result->addValue( null, 'filename', 'api-help.html', ApiResult::NO_SIZE_CHECK );
74  }
75  }
76 
96  public static function getHelp( IContextSource $context, $modules, array $options ) {
98 
99  if ( !is_array( $modules ) ) {
100  $modules = [ $modules ];
101  }
102 
103  $out = $context->getOutput();
104  $out->addModuleStyles( [
105  'mediawiki.hlist',
106  'mediawiki.apihelp',
107  ] );
108  if ( !empty( $options['toc'] ) ) {
109  $out->addModules( 'mediawiki.toc' );
110  }
111  $out->setPageTitle( $context->msg( 'api-help-title' ) );
112 
114  $cacheKey = null;
115  if ( count( $modules ) == 1 && $modules[0] instanceof ApiMain &&
116  $options['recursivesubmodules'] && $context->getLanguage() === $wgContLang
117  ) {
118  $cacheHelpTimeout = $context->getConfig()->get( 'APICacheHelpTimeout' );
119  if ( $cacheHelpTimeout > 0 ) {
120  // Get help text from cache if present
121  $cacheKey = wfMemcKey( 'apihelp', $modules[0]->getModulePath(),
122  (int)!empty( $options['toc'] ),
123  str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) ) );
124  $cached = $cache->get( $cacheKey );
125  if ( $cached ) {
126  $out->addHTML( $cached );
127  return;
128  }
129  }
130  }
131  if ( $out->getHTML() !== '' ) {
132  // Don't save to cache, there's someone else's content in the page
133  // already
134  $cacheKey = null;
135  }
136 
137  $options['recursivesubmodules'] = !empty( $options['recursivesubmodules'] );
138  $options['submodules'] = $options['recursivesubmodules'] || !empty( $options['submodules'] );
139 
140  // Prepend lead
141  if ( empty( $options['nolead'] ) ) {
142  $msg = $context->msg( 'api-help-lead' );
143  if ( !$msg->isDisabled() ) {
144  $out->addHTML( $msg->parseAsBlock() );
145  }
146  }
147 
148  $haveModules = [];
150  if ( !empty( $options['toc'] ) && $haveModules ) {
151  $out->addHTML( Linker::generateTOC( $haveModules, $context->getLanguage() ) );
152  }
153  $out->addHTML( $html );
154 
155  $helptitle = isset( $options['helptitle'] ) ? $options['helptitle'] : null;
156  $html = self::fixHelpLinks( $out->getHTML(), $helptitle, $haveModules );
157  $out->clearHTML();
158  $out->addHTML( $html );
159 
160  if ( $cacheKey !== null ) {
161  $cache->set( $cacheKey, $out->getHTML(), $cacheHelpTimeout );
162  }
163  }
164 
173  public static function fixHelpLinks( $html, $helptitle = null, $localModules = [] ) {
174  $formatter = new HtmlFormatter( $html );
175  $doc = $formatter->getDoc();
176  $xpath = new DOMXPath( $doc );
177  $nodes = $xpath->query( '//a[@href][not(contains(@class,\'apihelp-linktrail\'))]' );
178  foreach ( $nodes as $node ) {
179  $href = $node->getAttribute( 'href' );
180  do {
181  $old = $href;
182  $href = rawurldecode( $href );
183  } while ( $old !== $href );
184  if ( preg_match( '!Special:ApiHelp/([^&/|#]+)((?:#.*)?)!', $href, $m ) ) {
185  if ( isset( $localModules[$m[1]] ) ) {
186  $href = $m[2] === '' ? '#' . $m[1] : $m[2];
187  } elseif ( $helptitle !== null ) {
188  $href = Title::newFromText( str_replace( '$1', $m[1], $helptitle ) . $m[2] )
189  ->getFullURL();
190  } else {
191  $href = wfAppendQuery( wfScript( 'api' ), [
192  'action' => 'help',
193  'modules' => $m[1],
194  ] ) . $m[2];
195  }
196  $node->setAttribute( 'href', $href );
197  $node->removeAttribute( 'title' );
198  }
199  }
200 
201  return $formatter->getText();
202  }
203 
212  private static function wrap( Message $msg, $class, $tag = 'span' ) {
213  return Html::rawElement( $tag, [ 'class' => $class ],
214  $msg->parse()
215  );
216  }
217 
228  array $options, &$haveModules
229  ) {
230  $out = '';
231 
232  $level = empty( $options['headerlevel'] ) ? 2 : $options['headerlevel'];
233  if ( empty( $options['tocnumber'] ) ) {
234  $tocnumber = [ 2 => 0 ];
235  } else {
236  $tocnumber = &$options['tocnumber'];
237  }
238 
239  foreach ( $modules as $module ) {
240  $tocnumber[$level]++;
241  $path = $module->getModulePath();
242  $module->setContext( $context );
243  $help = [
244  'header' => '',
245  'flags' => '',
246  'description' => '',
247  'help-urls' => '',
248  'parameters' => '',
249  'examples' => '',
250  'submodules' => '',
251  ];
252 
253  if ( empty( $options['noheader'] ) || !empty( $options['toc'] ) ) {
254  $anchor = $path;
255  $i = 1;
256  while ( isset( $haveModules[$anchor] ) ) {
257  $anchor = $path . '|' . ++$i;
258  }
259 
260  if ( $module->isMain() ) {
261  $headerContent = $context->msg( 'api-help-main-header' )->parse();
262  $headerAttr = [
263  'class' => 'apihelp-header',
264  ];
265  } else {
266  $name = $module->getModuleName();
267  $headerContent = $module->getParent()->getModuleManager()->getModuleGroup( $name ) .
268  "=$name";
269  if ( $module->getModulePrefix() !== '' ) {
270  $headerContent .= ' ' .
271  $context->msg( 'parentheses', $module->getModulePrefix() )->parse();
272  }
273  // Module names are always in English and not localized,
274  // so English language and direction must be set explicitly,
275  // otherwise parentheses will get broken in RTL wikis
276  $headerAttr = [
277  'class' => 'apihelp-header apihelp-module-name',
278  'dir' => 'ltr',
279  'lang' => 'en',
280  ];
281  }
282 
283  $headerAttr['id'] = $anchor;
284 
285  $haveModules[$anchor] = [
286  'toclevel' => count( $tocnumber ),
287  'level' => $level,
288  'anchor' => $anchor,
289  'line' => $headerContent,
290  'number' => implode( '.', $tocnumber ),
291  'index' => false,
292  ];
293  if ( empty( $options['noheader'] ) ) {
294  $help['header'] .= Html::element(
295  'h' . min( 6, $level ),
296  $headerAttr,
297  $headerContent
298  );
299  }
300  } else {
301  $haveModules[$path] = true;
302  }
303 
304  $links = [];
305  $any = false;
306  for ( $m = $module; $m !== null; $m = $m->getParent() ) {
307  $name = $m->getModuleName();
308  if ( $name === 'main_int' ) {
309  $name = 'main';
310  }
311 
312  if ( count( $modules ) === 1 && $m === $modules[0] &&
313  !( !empty( $options['submodules'] ) && $m->getModuleManager() )
314  ) {
315  $link = Html::element( 'b', [ 'dir' => 'ltr', 'lang' => 'en' ], $name );
316  } else {
317  $link = SpecialPage::getTitleFor( 'ApiHelp', $m->getModulePath() )->getLocalURL();
318  $link = Html::element( 'a',
319  [ 'href' => $link, 'class' => 'apihelp-linktrail', 'dir' => 'ltr', 'lang' => 'en' ],
320  $name
321  );
322  $any = true;
323  }
324  array_unshift( $links, $link );
325  }
326  if ( $any ) {
327  $help['header'] .= self::wrap(
328  $context->msg( 'parentheses' )
329  ->rawParams( $context->getLanguage()->pipeList( $links ) ),
330  'apihelp-linktrail', 'div'
331  );
332  }
333 
334  $flags = $module->getHelpFlags();
335  $help['flags'] .= Html::openElement( 'div',
336  [ 'class' => 'apihelp-block apihelp-flags' ] );
337  $msg = $context->msg( 'api-help-flags' );
338  if ( !$msg->isDisabled() ) {
339  $help['flags'] .= self::wrap(
340  $msg->numParams( count( $flags ) ), 'apihelp-block-head', 'div'
341  );
342  }
343  $help['flags'] .= Html::openElement( 'ul' );
344  foreach ( $flags as $flag ) {
345  $help['flags'] .= Html::rawElement( 'li', null,
346  self::wrap( $context->msg( "api-help-flag-$flag" ), "apihelp-flag-$flag" )
347  );
348  }
349  $sourceInfo = $module->getModuleSourceInfo();
350  if ( $sourceInfo ) {
351  if ( isset( $sourceInfo['namemsg'] ) ) {
352  $extname = $context->msg( $sourceInfo['namemsg'] )->text();
353  } else {
354  // Probably English, so wrap it.
355  $extname = Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $sourceInfo['name'] );
356  }
357  $help['flags'] .= Html::rawElement( 'li', null,
358  self::wrap(
359  $context->msg( 'api-help-source', $extname, $sourceInfo['name'] ),
360  'apihelp-source'
361  )
362  );
363 
364  $link = SpecialPage::getTitleFor( 'Version', 'License/' . $sourceInfo['name'] );
365  if ( isset( $sourceInfo['license-name'] ) ) {
366  $msg = $context->msg( 'api-help-license', $link,
367  Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $sourceInfo['license-name'] )
368  );
369  } elseif ( SpecialVersion::getExtLicenseFileName( dirname( $sourceInfo['path'] ) ) ) {
370  $msg = $context->msg( 'api-help-license-noname', $link );
371  } else {
372  $msg = $context->msg( 'api-help-license-unknown' );
373  }
374  $help['flags'] .= Html::rawElement( 'li', null,
375  self::wrap( $msg, 'apihelp-license' )
376  );
377  } else {
378  $help['flags'] .= Html::rawElement( 'li', null,
379  self::wrap( $context->msg( 'api-help-source-unknown' ), 'apihelp-source' )
380  );
381  $help['flags'] .= Html::rawElement( 'li', null,
382  self::wrap( $context->msg( 'api-help-license-unknown' ), 'apihelp-license' )
383  );
384  }
385  $help['flags'] .= Html::closeElement( 'ul' );
386  $help['flags'] .= Html::closeElement( 'div' );
387 
388  foreach ( $module->getFinalDescription() as $msg ) {
389  $msg->setContext( $context );
390  $help['description'] .= $msg->parseAsBlock();
391  }
392 
393  $urls = $module->getHelpUrls();
394  if ( $urls ) {
395  $help['help-urls'] .= Html::openElement( 'div',
396  [ 'class' => 'apihelp-block apihelp-help-urls' ]
397  );
398  $msg = $context->msg( 'api-help-help-urls' );
399  if ( !$msg->isDisabled() ) {
400  $help['help-urls'] .= self::wrap(
401  $msg->numParams( count( $urls ) ), 'apihelp-block-head', 'div'
402  );
403  }
404  if ( !is_array( $urls ) ) {
405  $urls = [ $urls ];
406  }
407  $help['help-urls'] .= Html::openElement( 'ul' );
408  foreach ( $urls as $url ) {
409  $help['help-urls'] .= Html::rawElement( 'li', null,
410  Html::element( 'a', [ 'href' => $url, 'dir' => 'ltr' ], $url )
411  );
412  }
413  $help['help-urls'] .= Html::closeElement( 'ul' );
414  $help['help-urls'] .= Html::closeElement( 'div' );
415  }
416 
417  $params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
418  $dynamicParams = $module->dynamicParameterDocumentation();
419  $groups = [];
420  if ( $params || $dynamicParams !== null ) {
421  $help['parameters'] .= Html::openElement( 'div',
422  [ 'class' => 'apihelp-block apihelp-parameters' ]
423  );
424  $msg = $context->msg( 'api-help-parameters' );
425  if ( !$msg->isDisabled() ) {
426  $help['parameters'] .= self::wrap(
427  $msg->numParams( count( $params ) ), 'apihelp-block-head', 'div'
428  );
429  }
430  $help['parameters'] .= Html::openElement( 'dl' );
431 
432  $descriptions = $module->getFinalParamDescription();
433 
434  foreach ( $params as $name => $settings ) {
435  if ( !is_array( $settings ) ) {
436  $settings = [ ApiBase::PARAM_DFLT => $settings ];
437  }
438 
439  $help['parameters'] .= Html::rawElement( 'dt', null,
440  Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $module->encodeParamName( $name ) )
441  );
442 
443  // Add description
444  $description = [];
445  if ( isset( $descriptions[$name] ) ) {
446  foreach ( $descriptions[$name] as $msg ) {
447  $msg->setContext( $context );
448  $description[] = $msg->parseAsBlock();
449  }
450  }
451 
452  // Add usage info
453  $info = [];
454 
455  // Required?
456  if ( !empty( $settings[ApiBase::PARAM_REQUIRED] ) ) {
457  $info[] = $context->msg( 'api-help-param-required' )->parse();
458  }
459 
460  // Custom info?
461  if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
462  foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
463  $tag = array_shift( $i );
464  $info[] = $context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
465  ->numParams( count( $i ) )
466  ->params( $context->getLanguage()->commaList( $i ) )
467  ->params( $module->getModulePrefix() )
468  ->parse();
469  }
470  }
471 
472  // Type documentation
473  if ( !isset( $settings[ApiBase::PARAM_TYPE] ) ) {
474  $dflt = isset( $settings[ApiBase::PARAM_DFLT] )
475  ? $settings[ApiBase::PARAM_DFLT]
476  : null;
477  if ( is_bool( $dflt ) ) {
478  $settings[ApiBase::PARAM_TYPE] = 'boolean';
479  } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
480  $settings[ApiBase::PARAM_TYPE] = 'string';
481  } elseif ( is_int( $dflt ) ) {
482  $settings[ApiBase::PARAM_TYPE] = 'integer';
483  }
484  }
485  if ( isset( $settings[ApiBase::PARAM_TYPE] ) ) {
486  $type = $settings[ApiBase::PARAM_TYPE];
487  $multi = !empty( $settings[ApiBase::PARAM_ISMULTI] );
488  $hintPipeSeparated = true;
489  $count = ApiBase::LIMIT_SML2 + 1;
490 
491  if ( is_array( $type ) ) {
492  $count = count( $type );
493  $links = isset( $settings[ApiBase::PARAM_VALUE_LINKS] )
494  ? $settings[ApiBase::PARAM_VALUE_LINKS]
495  : [];
496  $values = array_map( function ( $v ) use ( $links ) {
497  // We can't know whether this contains LTR or RTL text.
498  $ret = $v === '' ? $v : Html::element( 'span', [ 'dir' => 'auto' ], $v );
499  if ( isset( $links[$v] ) ) {
500  $ret = "[[{$links[$v]}|$ret]]";
501  }
502  return $ret;
503  }, $type );
504  $i = array_search( '', $type, true );
505  if ( $i === false ) {
506  $values = $context->getLanguage()->commaList( $values );
507  } else {
508  unset( $values[$i] );
509  $values = $context->msg( 'api-help-param-list-can-be-empty' )
510  ->numParams( count( $values ) )
511  ->params( $context->getLanguage()->commaList( $values ) )
512  ->parse();
513  }
514  $info[] = $context->msg( 'api-help-param-list' )
515  ->params( $multi ? 2 : 1 )
516  ->params( $values )
517  ->parse();
518  $hintPipeSeparated = false;
519  } else {
520  switch ( $type ) {
521  case 'submodule':
522  $groups[] = $name;
523  if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
524  $map = $settings[ApiBase::PARAM_SUBMODULE_MAP];
525  ksort( $map );
526  $submodules = [];
527  foreach ( $map as $v => $m ) {
528  $submodules[] = "[[Special:ApiHelp/{$m}|{$v}]]";
529  }
530  } else {
531  $submodules = $module->getModuleManager()->getNames( $name );
532  sort( $submodules );
533  $prefix = $module->isMain()
534  ? '' : ( $module->getModulePath() . '+' );
535  $submodules = array_map( function ( $name ) use ( $prefix ) {
536  $text = Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $name );
537  return "[[Special:ApiHelp/{$prefix}{$name}|{$text}]]";
538  }, $submodules );
539  }
540  $count = count( $submodules );
541  $info[] = $context->msg( 'api-help-param-list' )
542  ->params( $multi ? 2 : 1 )
543  ->params( $context->getLanguage()->commaList( $submodules ) )
544  ->parse();
545  $hintPipeSeparated = false;
546  // No type message necessary, we have a list of values.
547  $type = null;
548  break;
549 
550  case 'namespace':
552  if ( isset( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) &&
553  is_array( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] )
554  ) {
555  $namespaces = array_merge( $namespaces, $settings[ApiBase::PARAM_EXTRA_NAMESPACES] );
556  }
557  sort( $namespaces );
558  $count = count( $namespaces );
559  $info[] = $context->msg( 'api-help-param-list' )
560  ->params( $multi ? 2 : 1 )
561  ->params( $context->getLanguage()->commaList( $namespaces ) )
562  ->parse();
563  $hintPipeSeparated = false;
564  // No type message necessary, we have a list of values.
565  $type = null;
566  break;
567 
568  case 'tags':
570  $count = count( $tags );
571  $info[] = $context->msg( 'api-help-param-list' )
572  ->params( $multi ? 2 : 1 )
573  ->params( $context->getLanguage()->commaList( $tags ) )
574  ->parse();
575  $hintPipeSeparated = false;
576  $type = null;
577  break;
578 
579  case 'limit':
580  if ( isset( $settings[ApiBase::PARAM_MAX2] ) ) {
581  $info[] = $context->msg( 'api-help-param-limit2' )
582  ->numParams( $settings[ApiBase::PARAM_MAX] )
583  ->numParams( $settings[ApiBase::PARAM_MAX2] )
584  ->parse();
585  } else {
586  $info[] = $context->msg( 'api-help-param-limit' )
587  ->numParams( $settings[ApiBase::PARAM_MAX] )
588  ->parse();
589  }
590  break;
591 
592  case 'integer':
593  // Possible messages:
594  // api-help-param-integer-min,
595  // api-help-param-integer-max,
596  // api-help-param-integer-minmax
597  $suffix = '';
598  $min = $max = 0;
599  if ( isset( $settings[ApiBase::PARAM_MIN] ) ) {
600  $suffix .= 'min';
601  $min = $settings[ApiBase::PARAM_MIN];
602  }
603  if ( isset( $settings[ApiBase::PARAM_MAX] ) ) {
604  $suffix .= 'max';
605  $max = $settings[ApiBase::PARAM_MAX];
606  }
607  if ( $suffix !== '' ) {
608  $info[] =
609  $context->msg( "api-help-param-integer-$suffix" )
610  ->params( $multi ? 2 : 1 )
611  ->numParams( $min, $max )
612  ->parse();
613  }
614  break;
615 
616  case 'upload':
617  $info[] = $context->msg( 'api-help-param-upload' )
618  ->parse();
619  // No type message necessary, api-help-param-upload should handle it.
620  $type = null;
621  break;
622 
623  case 'string':
624  case 'text':
625  // Displaying a type message here would be useless.
626  $type = null;
627  break;
628  }
629  }
630 
631  // Add type. Messages for grep: api-help-param-type-limit
632  // api-help-param-type-integer api-help-param-type-boolean
633  // api-help-param-type-timestamp api-help-param-type-user
634  // api-help-param-type-password
635  if ( is_string( $type ) ) {
636  $msg = $context->msg( "api-help-param-type-$type" );
637  if ( !$msg->isDisabled() ) {
638  $info[] = $msg->params( $multi ? 2 : 1 )->parse();
639  }
640  }
641 
642  if ( $multi ) {
643  $extra = [];
644  if ( $hintPipeSeparated ) {
645  $extra[] = $context->msg( 'api-help-param-multi-separate' )->parse();
646  }
647  if ( $count > ApiBase::LIMIT_SML1 ) {
648  $extra[] = $context->msg( 'api-help-param-multi-max' )
650  ->parse();
651  }
652  if ( $extra ) {
653  $info[] = implode( ' ', $extra );
654  }
655 
656  $allowAll = isset( $settings[ApiBase::PARAM_ALL] )
657  ? $settings[ApiBase::PARAM_ALL]
658  : false;
659  if ( $allowAll || $settings[ApiBase::PARAM_TYPE] === 'namespace' ) {
660  if ( $settings[ApiBase::PARAM_TYPE] === 'namespace' ) {
661  $allSpecifier = ApiBase::ALL_DEFAULT_STRING;
662  } else {
663  $allSpecifier = ( is_string( $allowAll ) ? $allowAll : ApiBase::ALL_DEFAULT_STRING );
664  }
665  $info[] = $context->msg( 'api-help-param-multi-all' )
666  ->params( $allSpecifier )
667  ->parse();
668  }
669  }
670  }
671 
672  // Add default
673  $default = isset( $settings[ApiBase::PARAM_DFLT] )
674  ? $settings[ApiBase::PARAM_DFLT]
675  : null;
676  if ( $default === '' ) {
677  $info[] = $context->msg( 'api-help-param-default-empty' )
678  ->parse();
679  } elseif ( $default !== null && $default !== false ) {
680  // We can't know whether this contains LTR or RTL text.
681  $info[] = $context->msg( 'api-help-param-default' )
682  ->params( Html::element( 'span', [ 'dir' => 'auto' ], $default ) )
683  ->parse();
684  }
685 
686  if ( !array_filter( $description ) ) {
687  $description = [ self::wrap(
688  $context->msg( 'api-help-param-no-description' ),
689  'apihelp-empty'
690  ) ];
691  }
692 
693  // Add "deprecated" flag
694  if ( !empty( $settings[ApiBase::PARAM_DEPRECATED] ) ) {
695  $help['parameters'] .= Html::openElement( 'dd',
696  [ 'class' => 'info' ] );
697  $help['parameters'] .= self::wrap(
698  $context->msg( 'api-help-param-deprecated' ),
699  'apihelp-deprecated', 'strong'
700  );
701  $help['parameters'] .= Html::closeElement( 'dd' );
702  }
703 
704  if ( $description ) {
705  $description = implode( '', $description );
706  $description = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $description );
707  $help['parameters'] .= Html::rawElement( 'dd',
708  [ 'class' => 'description' ], $description );
709  }
710 
711  foreach ( $info as $i ) {
712  $help['parameters'] .= Html::rawElement( 'dd', [ 'class' => 'info' ], $i );
713  }
714  }
715 
716  if ( $dynamicParams !== null ) {
717  $dynamicParams = ApiBase::makeMessage( $dynamicParams, $context, [
718  $module->getModulePrefix(),
719  $module->getModuleName(),
720  $module->getModulePath()
721  ] );
722  $help['parameters'] .= Html::element( 'dt', null, '*' );
723  $help['parameters'] .= Html::rawElement( 'dd',
724  [ 'class' => 'description' ], $dynamicParams->parse() );
725  }
726 
727  $help['parameters'] .= Html::closeElement( 'dl' );
728  $help['parameters'] .= Html::closeElement( 'div' );
729  }
730 
731  $examples = $module->getExamplesMessages();
732  if ( $examples ) {
733  $help['examples'] .= Html::openElement( 'div',
734  [ 'class' => 'apihelp-block apihelp-examples' ] );
735  $msg = $context->msg( 'api-help-examples' );
736  if ( !$msg->isDisabled() ) {
737  $help['examples'] .= self::wrap(
738  $msg->numParams( count( $examples ) ), 'apihelp-block-head', 'div'
739  );
740  }
741 
742  $help['examples'] .= Html::openElement( 'dl' );
743  foreach ( $examples as $qs => $msg ) {
744  $msg = ApiBase::makeMessage( $msg, $context, [
745  $module->getModulePrefix(),
746  $module->getModuleName(),
747  $module->getModulePath()
748  ] );
749 
750  $link = wfAppendQuery( wfScript( 'api' ), $qs );
751  $sandbox = SpecialPage::getTitleFor( 'ApiSandbox' )->getLocalURL() . '#' . $qs;
752  $help['examples'] .= Html::rawElement( 'dt', null, $msg->parse() );
753  $help['examples'] .= Html::rawElement( 'dd', null,
754  Html::element( 'a', [ 'href' => $link, 'dir' => 'ltr' ], "api.php?$qs" ) . ' ' .
755  Html::rawElement( 'a', [ 'href' => $sandbox ],
756  $context->msg( 'api-help-open-in-apisandbox' )->parse() )
757  );
758  }
759  $help['examples'] .= Html::closeElement( 'dl' );
760  $help['examples'] .= Html::closeElement( 'div' );
761  }
762 
763  $subtocnumber = $tocnumber;
764  $subtocnumber[$level + 1] = 0;
765  $suboptions = [
766  'submodules' => $options['recursivesubmodules'],
767  'headerlevel' => $level + 1,
768  'tocnumber' => &$subtocnumber,
769  'noheader' => false,
770  ] + $options;
771 
772  if ( $options['submodules'] && $module->getModuleManager() ) {
773  $manager = $module->getModuleManager();
774  $submodules = [];
775  foreach ( $groups as $group ) {
776  $names = $manager->getNames( $group );
777  sort( $names );
778  foreach ( $names as $name ) {
779  $submodules[] = $manager->getModule( $name );
780  }
781  }
782  $help['submodules'] .= self::getHelpInternal(
783  $context,
784  $submodules,
785  $suboptions,
786  $haveModules
787  );
788  }
789 
790  $module->modifyHelp( $help, $suboptions, $haveModules );
791 
792  Hooks::run( 'APIHelpModifyOutput', [ $module, &$help, $suboptions, &$haveModules ] );
793 
794  $out .= implode( "\n", $help );
795  }
796 
797  return $out;
798  }
799 
800  public function shouldCheckMaxlag() {
801  return false;
802  }
803 
804  public function isReadMode() {
805  return false;
806  }
807 
808  public function getCustomPrinter() {
809  $params = $this->extractRequestParams();
810  if ( $params['wrap'] ) {
811  return null;
812  }
813 
814  $main = $this->getMain();
815  $errorPrinter = $main->createPrinterByName( $main->getParameter( 'format' ) );
816  return new ApiFormatRaw( $main, $errorPrinter );
817  }
818 
819  public function getAllowedParams() {
820  return [
821  'modules' => [
822  ApiBase::PARAM_DFLT => 'main',
823  ApiBase::PARAM_ISMULTI => true,
824  ],
825  'submodules' => false,
826  'recursivesubmodules' => false,
827  'wrap' => false,
828  'toc' => false,
829  ];
830  }
831 
832  protected function getExamplesMessages() {
833  return [
834  'action=help'
835  => 'apihelp-help-example-main',
836  'action=help&modules=query&submodules=1'
837  => 'apihelp-help-example-submodules',
838  'action=help&recursivesubmodules=1'
839  => 'apihelp-help-example-recursive',
840  'action=help&modules=help'
841  => 'apihelp-help-example-help',
842  'action=help&modules=query+info|query+categorymembers'
843  => 'apihelp-help-example-query',
844  ];
845  }
846 
847  public function getHelpUrls() {
848  return [
849  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page',
850  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:FAQ',
851  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Quick_start_guide',
852  ];
853  }
854 }
ApiMain
This is the main API class, used for both external and internal processing.
Definition: ApiMain.php:45
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:34
ApiBase\PARAM_SUBMODULE_MAP
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
Definition: ApiBase.php:168
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:265
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:41
MWNamespace\getValidNamespaces
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
Definition: MWNamespace.php:264
ApiBase\PARAM_REQUIRED
const PARAM_REQUIRED
(boolean) Is the parameter required?
Definition: ApiBase.php:115
ApiHelp\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiHelp.php:832
ApiHelp\wrap
static wrap(Message $msg, $class, $tag='span')
Wrap a message in HTML with a class.
Definition: ApiHelp.php:212
Linker\generateTOC
static generateTOC( $tree, $lang=false)
Generate a table of contents from a section tree.
Definition: Linker.php:1577
captcha-old.count
count
Definition: captcha-old.py:225
ApiBase\PARAM_ALL
const PARAM_ALL
(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true,...
Definition: ApiBase.php:183
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1954
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:934
ApiHelp\isReadMode
isReadMode()
Indicates whether this module requires read rights.
Definition: ApiHelp.php:804
ApiBase\PARAM_TYPE
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition: ApiBase.php:91
ApiHelp\getHelpInternal
static getHelpInternal(IContextSource $context, array $modules, array $options, &$haveModules)
Recursively-called function to actually construct the help.
Definition: ApiHelp.php:227
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:610
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$params
$params
Definition: styleTest.css.php:40
IContextSource\msg
msg()
Get a Message object with context set.
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:82
ApiBase\makeMessage
static makeMessage( $msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
Definition: ApiBase.php:1642
ApiResult\NO_SIZE_CHECK
const NO_SIZE_CHECK
For addValue() and similar functions, do not check size while adding a value Don't use this unless yo...
Definition: ApiResult.php:56
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
$type
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2536
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
ApiBase
This abstract class implements many basic API functions, and is the base of all API classes.
Definition: ApiBase.php:41
ApiBase\getModuleFromPath
getModuleFromPath( $path)
Get a module from its module path.
Definition: ApiBase.php:572
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:143
wfAppendQuery
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Definition: GlobalFunctions.php:500
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
ApiBase\PARAM_DEPRECATED
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:109
ApiBase\PARAM_MIN
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:103
DerivativeContext
An IContextSource implementation which will inherit context from another source but allow individual ...
Definition: DerivativeContext.php:31
$html
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 & $html
Definition: hooks.txt:1956
wfMemcKey
wfMemcKey()
Make a cache key for the local wiki.
Definition: GlobalFunctions.php:2961
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3138
ApiBase\getModulePath
getModulePath()
Get the path to this module.
Definition: ApiBase.php:554
$tag
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
Definition: hooks.txt:1028
$modules
$modules
Definition: HTMLFormElement.php:12
ApiBase\PARAM_MAX
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:94
ApiFormatRaw
Formatter that spits out anything you like with any desired MIME type.
Definition: ApiFormatRaw.php:31
ApiHelp\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiHelp.php:847
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ApiBase\PARAM_EXTRA_NAMESPACES
const PARAM_EXTRA_NAMESPACES
(int[]) When PARAM_TYPE is 'namespace', include these as additional possible values.
Definition: ApiBase.php:189
ApiBase\ALL_DEFAULT_STRING
const ALL_DEFAULT_STRING
Definition: ApiBase.php:200
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:44
SpecialVersion\getExtLicenseFileName
static getExtLicenseFileName( $extDir)
Obtains the full path of an extensions copying or license file if one exists.
Definition: SpecialVersion.php:1042
ApiHelp\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiHelp.php:819
SpecialVersion\getVersion
static getVersion( $flags='', $lang=null)
Return a string of the MediaWiki version with Git revision if available.
Definition: SpecialVersion.php:268
ChangeTags\listExplicitlyDefinedTags
static listExplicitlyDefinedTags()
Lists tags explicitly defined in the valid_tag table of the database.
Definition: ChangeTags.php:1212
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:718
ApiHelp\fixHelpLinks
static fixHelpLinks( $html, $helptitle=null, $localModules=[])
Replace Special:ApiHelp links with links to api.php.
Definition: ApiHelp.php:173
ApiBase\LIMIT_SML2
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition: ApiBase.php:209
ApiBase\GET_VALUES_FOR_HELP
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
Definition: ApiBase.php:216
$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:1956
ApiBase\PARAM_HELP_MSG_INFO
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
Definition: ApiBase.php:145
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
ApiBase\PARAM_VALUE_LINKS
const PARAM_VALUE_LINKS
(string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles whic...
Definition: ApiBase.php:152
ApiHelp\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiHelp.php:36
$cache
$cache
Definition: mcc.php:33
ObjectCache\getMainWANInstance
static getMainWANInstance()
Get the main WAN cache object.
Definition: ObjectCache.php:370
ApiHelp\getHelp
static getHelp(IContextSource $context, $modules, array $options)
Generate help for the specified modules.
Definition: ApiHelp.php:96
IContextSource\getConfig
getConfig()
Get the site configuration.
$path
$path
Definition: NoLocalSettings.php:26
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:52
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
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:490
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:55
ApiHelp\shouldCheckMaxlag
shouldCheckMaxlag()
Indicates if this module needs maxlag to be checked.
Definition: ApiHelp.php:800
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2929
ApiBase\PARAM_MAX2
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
Definition: ApiBase.php:100
$help
$help
Definition: mcc.php:32
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:506
ApiHelp\getCustomPrinter
getCustomPrinter()
If the module may only be used with a certain format module, it should override this method to return...
Definition: ApiHelp.php:808
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
IContextSource\getOutput
getOutput()
Get the OutputPage object.
ApiResult\setSubelementsList
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes.
Definition: ApiResult.php:565
$options
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:1049
SkinFactory\getDefaultInstance
static getDefaultInstance()
Definition: SkinFactory.php:50
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2749
IContextSource\getLanguage
getLanguage()
Get the Language object.
ApiBase\LIMIT_SML1
const LIMIT_SML1
Slow query, standard limit.
Definition: ApiBase.php:207
array
the array() calling protocol came about after MediaWiki 1.4rc1.
$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
$out
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 $out
Definition: hooks.txt:783
ApiHelp
Class to output help for an API module.
Definition: ApiHelp.php:35