getRequest(); $options = [ 'action' => 'help', 'nolead' => true, 'submodules' => $request->getCheck( 'submodules' ), 'recursivesubmodules' => $request->getCheck( 'recursivesubmodules' ), 'title' => $request->getVal( 'title', $this->getPageTitle( '$1' )->getPrefixedText() ), ]; // These are for linking from wikitext, since url parameters are a pain // to do. while ( true ) { if ( substr( $par, 0, 4 ) === 'sub/' ) { $par = substr( $par, 4 ); $options['submodules'] = 1; continue; } if ( substr( $par, 0, 5 ) === 'rsub/' ) { $par = substr( $par, 5 ); $options['recursivesubmodules'] = 1; continue; } $moduleName = $par; break; } if ( !$this->including() ) { unset( $options['nolead'], $options['title'] ); $options['modules'] = $moduleName; $link = wfAppendQuery( wfExpandUrl( wfScript( 'api' ), PROTO_CURRENT ), $options ); $this->getOutput()->redirect( $link ); return; } $main = new ApiMain( $this->getContext(), false ); try { $module = $main->getModuleFromPath( $moduleName ); } catch ( ApiUsageException $ex ) { $this->getOutput()->addHTML( Html::rawElement( 'span', [ 'class' => 'error' ], $this->msg( 'apihelp-no-such-module', $moduleName )->inContentLanguage()->parse() ) ); return; } catch ( UsageException $ex ) { $this->getOutput()->addHTML( Html::rawElement( 'span', [ 'class' => 'error' ], $this->msg( 'apihelp-no-such-module', $moduleName )->inContentLanguage()->parse() ) ); return; } ApiHelp::getHelp( $this->getContext(), $module, $options ); } public function isIncludable() { return true; } }