MediaWiki
1.30.0
|
Factory for handling the special page list and generating SpecialPage objects. More...
Static Public Member Functions | |
static | capturePath (Title $title, IContextSource $context, LinkRenderer $linkRenderer=null) |
Just like executePath() but will override global variables and execute the page in "inclusion" mode. More... | |
static | executePath (Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null) |
Execute a special page path. More... | |
static | exists ( $name) |
Check if a given name exist as a special page or as a special page alias. More... | |
static | getList () |
Get the special page list as an array. More... | |
static | getLocalNameFor ( $name, $subpage=false) |
Get the local name for a specified canonical name. More... | |
static | getNames () |
Returns a list of canonical special page names. More... | |
static | getPage ( $name) |
Find the object with a given name and return it (or NULL) More... | |
static | getRegularPages () |
Return categorised listable special pages for all users. More... | |
static | getRestrictedPages (User $user=null) |
Return categorised listable special pages which are available for the current user, but not for everyone. More... | |
static | getTitleForAlias ( $alias) |
Get a title for a given alias. More... | |
static | getUsablePages (User $user=null) |
Return categorised listable special pages which are available for the current user, and everyone. More... | |
static | resetList () |
Reset the internal list of special pages. More... | |
static | 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... | |
Static Private Member Functions | |
static | getAliasList () |
Initialise and return the list of special page aliases. More... | |
static | getPageList () |
Get the special page list as an array. More... | |
Static Private Attributes | |
static | $aliases |
static | $coreList |
List of special page names to the subclass of SpecialPage which handles them. More... | |
static | $list |
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 47 of file SpecialPageFactory.php.
|
static |
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 598 of file SpecialPageFactory.php.
References $context, $linkRenderer, $ret, $title, $wgLang, $wgOut, $wgRequest, $wgTitle, $wgUser, executePath(), RequestContext\getMain(), and global.
|
static |
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 511 of file SpecialPageFactory.php.
References $context, $linkRenderer, $name, $query, $title, $wgSend404Code, getPage(), global, Profiler\instance(), and MediaWiki\run().
Referenced by capturePath(), MediaWiki\performRequest(), and SpecialSearchTest\testSubPageRedirect().
|
static |
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 366 of file SpecialPageFactory.php.
References $name, $title, getPageList(), list, and resolveAlias().
Referenced by ExtParserFunctions\ifexistCommon(), and Title\isAlwaysKnown().
|
staticprivate |
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 281 of file SpecialPageFactory.php.
References $aliases, $name, $wgContLang, as, getPageList(), global, and wfWarn().
Referenced by getLocalNameFor(), and resolveAlias().
|
static |
Get the special page list as an array.
Definition at line 220 of file SpecialPageFactory.php.
References getPageList(), and wfDeprecated().
|
static |
Get the local name for a specified canonical name.
string | $name | |
string | bool | $subpage |
Definition at line 657 of file SpecialPageFactory.php.
References $aliases, $name, $wgContLang, as, getAliasList(), global, and wfWarn().
Referenced by Title\fixSpecialName(), SpecialPage\getLocalName(), SpecialPage\getSafeTitleFor(), SpecialPage\getTitleValueFor(), SpecialPageFactoryTest\testConflictResolution(), SpecialPageFactoryTest\testGetAliasListRecursion(), and SpecialPageFactoryTest\testGetLocalNameFor().
|
static |
Returns a list of canonical special page names.
May be used to iterate over all registered special pages.
Definition at line 210 of file SpecialPageFactory.php.
Referenced by PrefixSearch\specialSearch(), SpecialPageFactoryTest\testGetNames(), SpecialPageFactoryTest\testHookNotCalledTwice(), and SpecialPageFactoryTest\testResetList().
|
static |
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 379 of file SpecialPageFactory.php.
References $name, ObjectFactory\getObjectFromSpec(), getPageList(), list, resolveAlias(), wfDeprecated(), and wfLogWarning().
Referenced by QueryAllSpecialPagesTest\__construct(), UpdateSpecialPages\execute(), executePath(), getRegularPages(), getRestrictedPages(), SpecialPageAction\getSpecialPage(), getUsablePages(), MediaWiki\performRequest(), ApiPageSet\processTitlesArray(), PrefixSearch\specialSearch(), SpecialPageFactoryTest\testGetPage(), and MediaWiki\triggerAsyncJobs().
|
staticprivate |
Get the special page list as an array.
Definition at line 230 of file SpecialPageFactory.php.
References $coreList, $list, $wgContentHandlerUseDB, $wgDisableInternalSearch, $wgEmailAuthentication, $wgEnableEmail, $wgEnableJavaScriptTest, $wgPageLanguageUseDB, $wgSpecialPages, global, and Hooks\run().
Referenced by exists(), getAliasList(), getList(), and getPage().
|
static |
Return categorised listable special pages for all users.
Definition at line 457 of file SpecialPageFactory.php.
|
static |
|
static |
Get a title for a given alias.
string | $alias |
Definition at line 711 of file SpecialPageFactory.php.
References $name, SpecialPage\getTitleFor(), list, and resolveAlias().
Referenced by SpecialPageFactoryTest\testGetTitleForAlias().
|
static |
Return categorised listable special pages which are available for the current user, and everyone.
Definition at line 431 of file SpecialPageFactory.php.
References $name, $user, $wgUser, as, RequestContext\getMain(), getPage(), and global.
Referenced by SpecialSpecialpages\getPageGroups().
|
static |
Reset the internal list of special pages.
Useful when changing $wgSpecialPages after the internal list has already been initialized, e.g. during testing.
Definition at line 199 of file SpecialPageFactory.php.
Referenced by PrefixSearchTest\setUp(), SearchEnginePrefixTest\setUp(), SpecialPageFactoryTest\tearDown(), PrefixSearchTest\tearDown(), SearchEnginePrefixTest\tearDown(), SpecialPageFactoryTest\testConflictResolution(), SpecialPageFactoryTest\testGetAliasListRecursion(), SpecialPageFactoryTest\testGetLocalNameFor(), SpecialPageFactoryTest\testGetNames(), SpecialPageFactoryTest\testGetPage(), SpecialPageFactoryTest\testGetTitleForAlias(), SpecialPageFactoryTest\testHookNotCalledTwice(), SpecialPageFactoryTest\testResetList(), and SpecialPageFactoryTest\testResolveAlias().
|
static |
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 338 of file SpecialPageFactory.php.
References $aliases, $name, $wgContLang, getAliasList(), and global.
Referenced by SkinTemplate\buildPersonalUrls(), Title\checkReadPermissions(), exists(), Title\fixSpecialName(), OldChangesList\formatChangeLine(), OutputPage\getJSVars(), getPage(), Skin\getPageClasses(), getTitleForAlias(), LogPage\getTitleLink(), Title\isSpecial(), Linker\normaliseSpecialPage(), MediaWiki\performRequest(), ApiPageSet\processTitlesArray(), CoreParserFunctions\special(), SpecialPageFactoryTest\testConflictResolution(), SpecialPageFactoryTest\testResolveAlias(), and MediaWiki\tryNormaliseRedirect().
|
staticprivate |
Definition at line 193 of file SpecialPageFactory.php.
Referenced by getAliasList(), getLocalNameFor(), and resolveAlias().
|
staticprivate |
List of special page names to the subclass of SpecialPage which handles them.
Definition at line 51 of file SpecialPageFactory.php.
Referenced by getPageList().
|
staticprivate |
Definition at line 192 of file SpecialPageFactory.php.
Referenced by getPageList().