MediaWiki
master
|
Factory for handling the special page list and generating SpecialPage objects. More...
Public Member Functions | |
__construct (ServiceOptions $options, Language $contLang, ObjectFactory $objectFactory, HookContainer $hookContainer) | |
capturePath (Title $title, IContextSource $context, LinkRenderer $linkRenderer=null) | |
Just like executePath() but will override global variables and execute the page in "inclusion" mode. More... | |
executePath (Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null) | |
Execute a special page path. More... | |
exists ( $name) | |
Check if a given name exist as a special page or as a special page alias. More... | |
getLocalNameFor ( $name, $subpage=false) | |
Get the local name for a specified canonical name. More... | |
getNames () | |
Returns a list of canonical special page names. More... | |
getPage ( $name) | |
Find the object with a given name and return it (or NULL) More... | |
getRegularPages () | |
Return categorised listable special pages for all users. More... | |
getRestrictedPages (User $user) | |
Return categorised listable special pages which are available for the current user, but not for everyone. More... | |
getTitleForAlias ( $alias) | |
Get a title for a given alias. More... | |
getUsablePages (User $user) | |
Return categorised listable special pages which are available for the current user, and everyone. More... | |
resolveAlias ( $alias) | |
Given a special page name with a possible subpage, return an array where the first element is the special page name and the second is the subpage. More... | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Private Member Functions | |
getAliasList () | |
Initialise and return the list of special page aliases. More... | |
getPageList () | |
Get the special page list as an array. More... | |
Private Attributes | |
array | $aliases |
Language | $contLang |
HookContainer | $hookContainer |
HookRunner | $hookRunner |
array | $list |
Special page name => class name. More... | |
ObjectFactory | $objectFactory |
ServiceOptions | $options |
const | CORE_LIST |
List of special page names to the subclass of SpecialPage which handles them. More... | |
Factory for handling the special page list and generating SpecialPage objects.
To add a special page in an extension, add to $wgSpecialPages either an object instance or an array containing the name and constructor parameters. The latter is preferred for performance reasons.
The object instantiated must be either an instance of SpecialPage or a sub-class thereof. It must have an execute() method, which sends the HTML for the special page to $wgOut. The parent class has an execute() method which distributes the call to the historical global functions. Additionally, execute() also checks if the user has the necessary access privileges and bails out if not.
To add a core special page, use the similar static list in SpecialPageFactory::$list. To remove a core static special page at runtime, use a SpecialPage_initList hook.
Definition at line 61 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::__construct | ( | ServiceOptions | $options, |
Language | $contLang, | ||
ObjectFactory | $objectFactory, | ||
HookContainer | $hookContainer | ||
) |
ServiceOptions | $options | |
Language | $contLang | |
ObjectFactory | $objectFactory | |
HookContainer | $hookContainer |
Definition at line 983 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\$contLang, MediaWiki\SpecialPage\SpecialPageFactory\$hookContainer, MediaWiki\SpecialPage\SpecialPageFactory\$objectFactory, MediaWiki\SpecialPage\SpecialPageFactory\$options, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().
MediaWiki\SpecialPage\SpecialPageFactory::capturePath | ( | Title | $title, |
IContextSource | $context, | ||
LinkRenderer | $linkRenderer = null |
||
) |
Just like executePath() but will override global variables and execute the page in "inclusion" mode.
Returns true if the execution was successful or false if there was no such special page, or a title object if it was a redirect.
Also saves the current $wgTitle, $wgOut, $wgRequest, $wgUser and $wgLang variables so that the special page will get the context it'd expect on a normal request, and then restores them to their previous values after.
Title | $title | |
IContextSource | $context | |
LinkRenderer | null | $linkRenderer | (since 1.28) |
Definition at line 1398 of file SpecialPageFactory.php.
References MediaWiki\$context, $title, $wgLang, $wgOut, $wgRequest, $wgTitle, MediaWiki\SpecialPage\SpecialPageFactory\executePath(), IContextSource\getLanguage(), RequestContext\getMain(), IContextSource\getOutput(), IContextSource\getRequest(), and IContextSource\getUser().
MediaWiki\SpecialPage\SpecialPageFactory::executePath | ( | Title & | $title, |
IContextSource & | $context, | ||
$including = false , |
|||
LinkRenderer | $linkRenderer = null |
||
) |
Execute a special page path.
The path may contain parameters, e.g. Special:Name/Params Extracts the special page name and call the execute method, passing the parameters
Returns a title object if the page is redirected, false if there was no such special page, and true if it was successful.
Title | &$title | |
IContextSource | &$context | |
bool | $including | Bool output is being captured for use in {{special:whatever}} |
LinkRenderer | null | $linkRenderer | (since 1.28) |
Definition at line 1314 of file SpecialPageFactory.php.
References MediaWiki\$context, $title, $wgSend404Code, IContextSource\getConfig(), IContextSource\getOutput(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), IContextSource\getRequest(), and Profiler\instance().
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\capturePath().
MediaWiki\SpecialPage\SpecialPageFactory::exists | ( | $name | ) |
Check if a given name exist as a special page or as a special page alias.
string | $name | Name of a special page |
Definition at line 1177 of file SpecialPageFactory.php.
References $title, MediaWiki\SpecialPage\SpecialPageFactory\getPageList(), and MediaWiki\SpecialPage\SpecialPageFactory\resolveAlias().
|
private |
Initialise and return the list of special page aliases.
Returns an array where the key is an alias, and the value is the canonical name of the special page. All registered special pages are guaranteed to map to themselves.
Definition at line 1100 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\$aliases, MediaWiki\SpecialPage\SpecialPageFactory\getPageList(), and wfWarn().
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(), and MediaWiki\SpecialPage\SpecialPageFactory\resolveAlias().
MediaWiki\SpecialPage\SpecialPageFactory::getLocalNameFor | ( | $name, | |
$subpage = false |
|||
) |
Get the local name for a specified canonical name.
string | $name | |
string | bool | $subpage |
Definition at line 1463 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\$aliases, MediaWiki\SpecialPage\SpecialPageFactory\getAliasList(), and wfWarn().
MediaWiki\SpecialPage\SpecialPageFactory::getNames | ( | ) |
Returns a list of canonical special page names.
May be used to iterate over all registered special pages.
Definition at line 1003 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\getPageList().
MediaWiki\SpecialPage\SpecialPageFactory::getPage | ( | $name | ) |
Find the object with a given name and return it (or NULL)
string | $name | Special page name, may be localised and/or an alias |
Definition at line 1190 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\getPageList(), MediaWiki\SpecialPage\SpecialPageFactory\resolveAlias(), wfDeprecatedMsg(), and wfLogWarning().
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\executePath(), MediaWiki\SpecialPage\SpecialPageFactory\getRegularPages(), MediaWiki\SpecialPage\SpecialPageFactory\getRestrictedPages(), and MediaWiki\SpecialPage\SpecialPageFactory\getUsablePages().
|
private |
Get the special page list as an array.
Definition at line 1012 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\$list, and MediaWiki\SpecialPage\SpecialPageFactory\CORE_LIST.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\exists(), MediaWiki\SpecialPage\SpecialPageFactory\getAliasList(), MediaWiki\SpecialPage\SpecialPageFactory\getNames(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), MediaWiki\SpecialPage\SpecialPageFactory\getRegularPages(), MediaWiki\SpecialPage\SpecialPageFactory\getRestrictedPages(), and MediaWiki\SpecialPage\SpecialPageFactory\getUsablePages().
MediaWiki\SpecialPage\SpecialPageFactory::getRegularPages | ( | ) |
Return categorised listable special pages for all users.
Definition at line 1264 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\getPage(), and MediaWiki\SpecialPage\SpecialPageFactory\getPageList().
MediaWiki\SpecialPage\SpecialPageFactory::getRestrictedPages | ( | User | $user | ) |
Return categorised listable special pages which are available for the current user, but not for everyone.
Definition at line 1283 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\getPage(), and MediaWiki\SpecialPage\SpecialPageFactory\getPageList().
MediaWiki\SpecialPage\SpecialPageFactory::getTitleForAlias | ( | $alias | ) |
Get a title for a given alias.
string | $alias |
Definition at line 1516 of file SpecialPageFactory.php.
References SpecialPage\getTitleFor(), and MediaWiki\SpecialPage\SpecialPageFactory\resolveAlias().
MediaWiki\SpecialPage\SpecialPageFactory::getUsablePages | ( | User | $user | ) |
Return categorised listable special pages which are available for the current user, and everyone.
Definition at line 1242 of file SpecialPageFactory.php.
References RequestContext\getMain(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), and MediaWiki\SpecialPage\SpecialPageFactory\getPageList().
MediaWiki\SpecialPage\SpecialPageFactory::resolveAlias | ( | $alias | ) |
Given a special page name with a possible subpage, return an array where the first element is the special page name and the second is the subpage.
string | $alias |
Definition at line 1156 of file SpecialPageFactory.php.
References MediaWiki\SpecialPage\SpecialPageFactory\$aliases, and MediaWiki\SpecialPage\SpecialPageFactory\getAliasList().
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\exists(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), and MediaWiki\SpecialPage\SpecialPageFactory\getTitleForAlias().
|
private |
Definition at line 947 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\getAliasList(), MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(), and MediaWiki\SpecialPage\SpecialPageFactory\resolveAlias().
|
private |
Definition at line 953 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\__construct().
|
private |
Definition at line 959 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\__construct().
|
private |
Definition at line 962 of file SpecialPageFactory.php.
|
private |
Special page name => class name.
Definition at line 944 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\getPageList().
|
private |
Definition at line 956 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\__construct().
|
private |
Definition at line 950 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\__construct().
const MediaWiki\SpecialPage\SpecialPageFactory::CONSTRUCTOR_OPTIONS |
Definition at line 967 of file SpecialPageFactory.php.
|
private |
List of special page names to the subclass of SpecialPage which handles them.
Definition at line 65 of file SpecialPageFactory.php.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\getPageList().