[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specialpage/ -> SpecialPageFactory.php (summary)

Factory for handling the special page list and generating SpecialPage objects. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 702 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SpecialPageFactory:: (17 methods):
  resetList()
  getNames()
  getList()
  getPageList()
  getAliasListObject()
  resolveAlias()
  setGroup()
  getGroup()
  exists()
  getPage()
  getUsablePages()
  getRegularPages()
  getRestrictedPages()
  executePath()
  capturePath()
  getLocalNameFor()
  getTitleForAlias()


Class: SpecialPageFactory  - X-Ref

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.

resetList()   X-Ref
Reset the internal list of special pages. Useful when changing $wgSpecialPages after
the internal list has already been initialized, e.g. during testing.


getNames()   X-Ref
Returns a list of canonical special page names.
May be used to iterate over all registered special pages.

return: string[]

getList()   X-Ref
Get the special page list as an array

return: array

getPageList()   X-Ref
Get the special page list as an array

return: array

getAliasListObject()   X-Ref
Initialise and return the list of special page aliases.  Returns an object with
properties which can be accessed $obj->pagename - each property name is an
alias, with the value being the canonical name of the special page. All
registered special pages are guaranteed to map to themselves.

return: object

resolveAlias( $alias )   X-Ref
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.

param: string $alias
return: array Array( String, String|null ), or array( null, null ) if the page is invalid

setGroup( $page, $group )   X-Ref
Add a page to a certain display group for Special:SpecialPages

param: SpecialPage|string $page
param: string $group

getGroup( &$page )   X-Ref
Get the group that the special page belongs in on Special:SpecialPage

param: SpecialPage $page
return: string

exists( $name )   X-Ref
Check if a given name exist as a special page or as a special page alias

param: string $name Name of a special page
return: bool True if a special page exists with this name

getPage( $name )   X-Ref
Find the object with a given name and return it (or NULL)

param: string $name Special page name, may be localised and/or an alias
return: SpecialPage|null SpecialPage object or null if the page doesn't exist

getUsablePages( User $user = null )   X-Ref
Return categorised listable special pages which are available
for the current user, and everyone.

param: User $user User object to check permissions, $wgUser will be used
return: array ( string => Specialpage )

getRegularPages()   X-Ref
Return categorised listable special pages for all users

return: array ( string => Specialpage )

getRestrictedPages( User $user = null )   X-Ref
Return categorised listable special pages which are available
for the current user, but not for everyone

param: User|null $user User object to use or null for $wgUser
return: array ( string => Specialpage )

executePath( Title &$title, IContextSource &$context, $including = false )   X-Ref
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.

param: Title $title
param: IContextSource $context
param: bool $including Bool output is being captured for use in {{special:whatever}}
return: bool

capturePath( Title $title, IContextSource $context )   X-Ref
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.

param: Title $title
param: IContextSource $context
return: string HTML fragment

getLocalNameFor( $name, $subpage = false )   X-Ref
Get the local name for a specified canonical name

param: string $name
param: string|bool $subpage
return: string

getTitleForAlias( $alias )   X-Ref
Get a title for a given alias

param: string $alias
return: Title|null Title or null if there is no such alias



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1