MediaWiki master
|
Factory for handling the special page list and generating SpecialPage objects. More...
Public Member Functions | |
__construct (ServiceOptions $options, Language $contLang, ObjectFactory $objectFactory, TitleFactory $titleFactory, HookContainer $hookContainer) | |
capturePath (PageReference $page, IContextSource $context, LinkRenderer $linkRenderer=null) | |
Just like executePath() but will override global variables and execute the page in "inclusion" mode. | |
executePath ( $path, IContextSource $context, $including=false, LinkRenderer $linkRenderer=null) | |
Execute a special page path. | |
exists ( $name) | |
Check if a given name exist as a special page or as a special page alias. | |
getListedPages () | |
Get listed special pages, including those that may require user rights. | |
getLocalNameFor ( $name, $subpage=false) | |
Get the local name for a specified canonical name. | |
getNames () | |
Returns a list of canonical special page names. | |
getPage ( $name) | |
Find the object with a given name and return it (or NULL) | |
getRegularPages () | |
Get listed special pages available to everyone by default. | |
getTitleForAlias ( $alias) | |
Get a title for a given alias. | |
getUsablePages (User $user) | |
Get listed special pages available to the current user. | |
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. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
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 204 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::__construct | ( | ServiceOptions | $options, |
Language | $contLang, | ||
ObjectFactory | $objectFactory, | ||
TitleFactory | $titleFactory, | ||
HookContainer | $hookContainer ) |
ServiceOptions | $options | |
Language | $contLang | |
ObjectFactory | $objectFactory | |
TitleFactory | $titleFactory | |
HookContainer | $hookContainer |
Definition at line 1320 of file SpecialPageFactory.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions().
MediaWiki\SpecialPage\SpecialPageFactory::capturePath | ( | PageReference | $page, |
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.
PageReference | $page | |
IContextSource | $context | |
LinkRenderer | null | $linkRenderer | (since 1.28) |
Definition at line 1744 of file SpecialPageFactory.php.
References $wgLang, $wgOut, $wgRequest, $wgTitle, $wgUser, MediaWiki\Context\IContextSource\getLanguage(), MediaWiki\Context\IContextSource\getOutput(), MediaWiki\Context\IContextSource\getRequest(), and MediaWiki\Context\IContextSource\getUser().
MediaWiki\SpecialPage\SpecialPageFactory::executePath | ( | $path, | |
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.
PageReference | string | $path | |
IContextSource | $context | |
bool | $including | Bool output is being captured for use in {{special:whatever}} |
LinkRenderer | null | $linkRenderer | (since 1.28) |
Definition at line 1657 of file SpecialPageFactory.php.
References $path, $url, MediaWiki\Context\IContextSource\getConfig(), MediaWiki\Context\IContextSource\getOutput(), MediaWiki\Context\IContextSource\getRequest(), Profiler\instance(), and MW_ENTRY_POINT.
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 1534 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::getListedPages | ( | ) |
Get listed special pages, including those that may require user rights.
Definition at line 1631 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::getLocalNameFor | ( | $name, | |
$subpage = false ) |
Get the local name for a specified canonical name.
string | $name | |
string | false | null | $subpage |
Definition at line 1818 of file SpecialPageFactory.php.
References 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 1342 of file SpecialPageFactory.php.
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 1547 of file SpecialPageFactory.php.
References wfLogWarning().
MediaWiki\SpecialPage\SpecialPageFactory::getRegularPages | ( | ) |
Get listed special pages available to everyone by default.
Definition at line 1613 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::getTitleForAlias | ( | $alias | ) |
Get a title for a given alias.
string | $alias |
Definition at line 1871 of file SpecialPageFactory.php.
MediaWiki\SpecialPage\SpecialPageFactory::getUsablePages | ( | User | $user | ) |
Get listed special pages available to the current user.
This includes both unrestricted pages, and restricted pages that the current user has the required permissions for.
User | $user | User object to check permissions provided |
Definition at line 1591 of file SpecialPageFactory.php.
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 1513 of file SpecialPageFactory.php.
const MediaWiki\SpecialPage\SpecialPageFactory::CONSTRUCTOR_OPTIONS |
Definition at line 1297 of file SpecialPageFactory.php.