MediaWiki REL1_31
SpecialApiHelp.php
Go to the documentation of this file.
1<?php
31 public function __construct() {
32 parent::__construct( 'ApiHelp' );
33 }
34
35 public function execute( $par ) {
36 if ( empty( $par ) ) {
37 $par = 'main';
38 }
39
40 // These come from transclusions
41 $request = $this->getRequest();
42 $options = [
43 'action' => 'help',
44 'nolead' => true,
45 'submodules' => $request->getCheck( 'submodules' ),
46 'recursivesubmodules' => $request->getCheck( 'recursivesubmodules' ),
47 'title' => $request->getVal( 'title', $this->getPageTitle( '$1' )->getPrefixedText() ),
48 ];
49
50 // These are for linking from wikitext, since url parameters are a pain
51 // to do.
52 while ( true ) {
53 if ( substr( $par, 0, 4 ) === 'sub/' ) {
54 $par = substr( $par, 4 );
55 $options['submodules'] = 1;
56 continue;
57 }
58
59 if ( substr( $par, 0, 5 ) === 'rsub/' ) {
60 $par = substr( $par, 5 );
61 $options['recursivesubmodules'] = 1;
62 continue;
63 }
64
65 $moduleName = $par;
66 break;
67 }
68
69 if ( !$this->including() ) {
70 unset( $options['nolead'], $options['title'] );
71 $options['modules'] = $moduleName;
73 $this->getOutput()->redirect( $link );
74 return;
75 }
76
77 $main = new ApiMain( $this->getContext(), false );
78 try {
79 $module = $main->getModuleFromPath( $moduleName );
80 } catch ( ApiUsageException $ex ) {
81 $this->getOutput()->addHTML( Html::rawElement( 'span', [ 'class' => 'error' ],
82 $this->msg( 'apihelp-no-such-module', $moduleName )->inContentLanguage()->parse()
83 ) );
84 return;
85 } catch ( UsageException $ex ) {
86 $this->getOutput()->addHTML( Html::rawElement( 'span', [ 'class' => 'error' ],
87 $this->msg( 'apihelp-no-such-module', $moduleName )->inContentLanguage()->parse()
88 ) );
89 return;
90 }
91
92 ApiHelp::getHelp( $this->getContext(), $module, $options );
93 }
94
95 public function isIncludable() {
96 return true;
97 }
98}
within a display generated by the Derivative if and wherever such third party notices normally appear The contents of the NOTICE file are for informational purposes only and do not modify the License You may add Your own attribution notices within Derivative Works that You alongside or as an addendum to the NOTICE text from the provided that such additional attribution notices cannot be construed as modifying the License You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for or distribution of Your or for any such Derivative Works as a provided Your and distribution of the Work otherwise complies with the conditions stated in this License Submission of Contributions Unless You explicitly state any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this without any additional terms or conditions Notwithstanding the nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions Trademarks This License does not grant permission to use the trade service or product names of the except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file Disclaimer of Warranty Unless required by applicable law or agreed to in Licensor provides the WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or including
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static getHelp(IContextSource $context, $modules, array $options)
Generate help for the specified modules.
Definition ApiHelp.php:93
This is the main API class, used for both external and internal processing.
Definition ApiMain.php:43
Exception used to abort API execution with an error.
Special page to redirect to API help pages, for situations where linking to the api....
execute( $par)
Default execute method Checks user permissions.
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}}.
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
Shortcut to construct a special page which is unlisted by default.
This exception will be thrown when dieUsage is called to stop module execution.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2806
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 & $options
Definition hooks.txt:2001
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition hooks.txt:3021
const PROTO_CURRENT
Definition Defines.php:232