[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

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

Parent class for all special pages. 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: 663 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SpecialPage:: (44 methods):
  getTitleFor()
  getSafeTitleFor()
  __construct()
  getName()
  getRestriction()
  isListed()
  setListed()
  listed()
  isIncludable()
  including()
  getLocalName()
  isExpensive()
  isCached()
  isRestricted()
  userCanExecute()
  displayRestrictionError()
  checkPermissions()
  checkReadOnly()
  requireLogin()
  prefixSearchSubpages()
  prefixSearchArray()
  setHeaders()
  run()
  beforeExecute()
  afterExecute()
  execute()
  outputHeader()
  getDescription()
  getTitle()
  getPageTitle()
  setContext()
  getContext()
  getRequest()
  getOutput()
  getUser()
  getSkin()
  getLanguage()
  getConfig()
  getFullTitle()
  getRobotPolicy()
  msg()
  addFeedLinks()
  getFinalGroupName()
  getGroupName()


Class: SpecialPage  - X-Ref

Parent class for all special pages.

Includes some static functions for handling the special page list deprecated
in favor of SpecialPageFactory.

getTitleFor( $name, $subpage = false, $fragment = '' )   X-Ref
Get a localised Title object for a specified special page name

param: string $name
param: string|bool $subpage Subpage string, or false to not use a subpage
param: string $fragment The link fragment (after the "#")
return: Title

getSafeTitleFor( $name, $subpage = false )   X-Ref
Get a localised Title object for a page name with a possibly unvalidated subpage

param: string $name
param: string|bool $subpage Subpage string, or false to not use a subpage
return: Title|null Title object or null if the page doesn't exist

__construct($name = '', $restriction = '', $listed = true,$function = false, $file = '', $includable = false)   X-Ref
Default constructor for special pages
Derivative classes should call this from their constructor
Note that if the user does not have the required level, an error message will
be displayed by the default execute() method, without the global function ever
being called.

If you override execute(), you can recover the default behavior with userCanExecute()
and displayRestrictionError()

param: string $name Name of the special page, as seen in links and URLs
param: string $restriction User right required, e.g. "block" or "delete"
param: bool $listed Whether the page is listed in Special:Specialpages
param: callable|bool $function Unused
param: string $file Unused
param: bool $includable Whether the page can be included in normal pages

getName()   X-Ref
Get the name of this Special Page.

return: string

getRestriction()   X-Ref
Get the permission that a user must have to execute this page

return: string

isListed()   X-Ref
Whether this special page is listed in Special:SpecialPages

return: bool

setListed( $listed )   X-Ref
Set whether this page is listed in Special:Specialpages, at run-time

param: bool $listed
return: bool

listed( $x = null )   X-Ref
Get or set whether this special page is listed in Special:SpecialPages

param: bool $x
return: bool

isIncludable()   X-Ref
Whether it's allowed to transclude the special page via {{Special:Foo/params}}

return: bool

including( $x = null )   X-Ref
Whether the special page is being evaluated via transclusion

param: bool $x
return: bool

getLocalName()   X-Ref
Get the localised name of the special page

return: string

isExpensive()   X-Ref
Is this page expensive (for some definition of expensive)?
Expensive pages are disabled or cached in miser mode.  Originally used
(and still overridden) by QueryPage and subclasses, moved here so that
Special:SpecialPages can safely call it for all special pages.

return: bool

isCached()   X-Ref
Is this page cached?
Expensive pages are cached or disabled in miser mode.
Used by QueryPage and subclasses, moved here so that
Special:SpecialPages can safely call it for all special pages.

return: bool

isRestricted()   X-Ref
Can be overridden by subclasses with more complicated permissions
schemes.

return: bool Should the page be displayed with the restricted-access

userCanExecute( User $user )   X-Ref
Checks if the given user (identified by an object) can execute this
special page (as defined by $mRestriction).  Can be overridden by sub-
classes with more complicated permissions schemes.

param: User $user The user to check
return: bool Does the user have permission to view the page?

displayRestrictionError()   X-Ref
Output an error message telling the user what access level they have to have


checkPermissions()   X-Ref
Checks if userCanExecute, and if not throws a PermissionsError

return: void

checkReadOnly()   X-Ref
If the wiki is currently in readonly mode, throws a ReadOnlyError

return: void

requireLogin($reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin')   X-Ref
If the user is not logged in, throws UserNotLoggedIn error

The user will be redirected to Special:Userlogin with the given message as an error on
the form.

param: string $reasonMsg [optional] Message key to be displayed on login page
param: string $titleMsg [optional] Passed on to UserNotLoggedIn constructor

prefixSearchSubpages( $search, $limit = 10 )   X-Ref
Return an array of subpages beginning with $search that this special page will accept.

For example, if a page supports subpages "foo", "bar" and "baz" (as in Special:PageName/foo,
etc.):

- `prefixSearchSubpages( "ba" )` should return `array( "bar", "baz" )`
- `prefixSearchSubpages( "f" )` should return `array( "foo" )`
- `prefixSearchSubpages( "z" )` should return `array()`
- `prefixSearchSubpages( "" )` should return `array( foo", "bar", "baz" )`

param: string $search Prefix to search for
param: int $limit Maximum number of results to return
return: string[] Matching subpages

prefixSearchArray( $search, $limit, array $subpages )   X-Ref
Helper function for implementations of prefixSearchSubpages() that
filter the values in memory (as oppposed to making a query).

param: string $search
param: int $limit
param: array $subpages
return: string[]

setHeaders()   X-Ref
Sets headers - this should be called from the execute() method of all derived classes!


run( $subPage )   X-Ref
Entry point.

param: string|null $subPage

beforeExecute( $subPage )   X-Ref
Gets called before @see SpecialPage::execute.

param: string|null $subPage

afterExecute( $subPage )   X-Ref
Gets called after @see SpecialPage::execute.

param: string|null $subPage

execute( $subPage )   X-Ref
Default execute method
Checks user permissions

This must be overridden by subclasses; it will be made abstract in a future version

param: string|null $subPage

outputHeader( $summaryMessageKey = '' )   X-Ref
Outputs a summary message on top of special pages
Per default the message key is the canonical name of the special page
May be overridden, i.e. by extensions to stick with the naming conventions
for message keys: 'extensionname-xxx'

param: string $summaryMessageKey Message key of the summary

getDescription()   X-Ref
Returns the name that goes in the \<h1\> in the special page itself, and
also the name that will be listed in Special:Specialpages

Derived classes can override this, but usually it is easier to keep the
default behavior.

return: string

getTitle( $subpage = false )   X-Ref
Get a self-referential title object

param: string|bool $subpage
return: Title

getPageTitle( $subpage = false )   X-Ref
Get a self-referential title object

param: string|bool $subpage
return: Title

setContext( $context )   X-Ref
Sets the context this SpecialPage is executed in

param: IContextSource $context

getContext()   X-Ref
Gets the context this SpecialPage is executed in

return: IContextSource|RequestContext

getRequest()   X-Ref
Get the WebRequest being used for this instance

return: WebRequest

getOutput()   X-Ref
Get the OutputPage being used for this instance

return: OutputPage

getUser()   X-Ref
Shortcut to get the User executing this instance

return: User

getSkin()   X-Ref
Shortcut to get the skin being used for this instance

return: Skin

getLanguage()   X-Ref
Shortcut to get user's language

return: Language

getConfig()   X-Ref
Shortcut to get main config object

return: Config

getFullTitle()   X-Ref
Return the full title, including $par

return: Title

getRobotPolicy()   X-Ref
Return the robot policy. Derived classes that override this can change
the robot policy set by setHeaders() from the default 'noindex,nofollow'.

return: string

msg( )   X-Ref
Wrapper around wfMessage that sets the current context.

return: Message

addFeedLinks( $params )   X-Ref
Adds RSS/atom links

param: array $params

getFinalGroupName()   X-Ref
Get the group that the special page belongs in on Special:SpecialPage
Use this method, instead of getGroupName to allow customization
of the group name from the wiki side

return: string Group of this special page

getGroupName()   X-Ref
Under which header this special page is listed in Special:SpecialPages
See messages 'specialpages-group-*' for valid names
This method defaults to group 'other'

return: string



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