SpecialPage Class Reference
[SpecialPage]

Parent special page class, also static functions for handling the special page list. More...

Inherited by DeletedContributionsPage, IncludableSpecialPage, RandomPage, SpecialBookSources, SpecialContributions, SpecialExport, SpecialImport, SpecialListGroupRights, SpecialNewpages, SpecialRecentChanges, SpecialResetpass, SpecialStatistics, SpecialTags, SpecialVersion, UnlistedSpecialPage, and UserrightsPage.

List of all members.

Public Member Functions

 SpecialPage ($name= '', $restriction= '', $listed=true, $function=false, $file= 'default', $includable=false)
 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.
 getName ()
 #@+ Accessor
 getRestriction ()
 getFile ()
 isListed ()
 name ($x=NULL)
 #@-
 restrictions ($x=NULL)
 listed ($x=NULL)
 func ($x=NULL)
 file ($x=NULL)
 includable ($x=NULL)
 including ($x=NULL)
 getLocalName ()
 #@-
 isRestricted ()
 Can be overridden by subclasses with more complicated permissions schemes.
 userCanExecute ($user)
 Checks if the given user (identified by an object) can execute this special page (as defined by $mRestriction).
 displayRestrictionError ()
 Output an error message telling the user what access level they have to have.
 setHeaders ()
 Sets headers - this should be called from the execute() method of all derived classes!
 execute ($par)
 Default execute method Checks user permissions, calls the function given in mFunction.
 outputHeader ($summaryMessageKey= '')
 Outputs a summary message on top of special pages Per default the message key is the canonical name of the special page May be overriden, i.e.
 getDescription ()
 getTitle ($subpage=false)
 Get a self-referential title object.
 setListed ($listed)
 Set whether this page is listed in Special:Specialpages, at run-time.
 getRedirect ($subpage)
 If the special page is a redirect, then get the Title object it redirects to.
 getRedirectQuery ()
 Return part of the request string for a special redirect page This allows passing, e.g.

Static Public Member Functions

static initList ()
 #@-
static initAliasList ()
static resolveAlias ($alias)
 Given a special page alias, return the special page name.
static resolveAliasWithSubpage ($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.
static addPage (&$page)
 Add a page to the list of valid special pages.
static setGroup ($page, $group)
 Add a page to a certain display group for Special:SpecialPages.
static getGroup (&$page)
 Add a page to a certain display group for Special:SpecialPages.
static removePage ($name)
 Remove a special page from the list Formerly used to disable expensive or dangerous special pages.
static exists ($name)
 Check if a given name exist as a special page or as a special page alias.
static getPage ($name)
 Find the object with a given name and return it (or NULL).
static getPageByAlias ($alias)
 Get a special page with a given localised name, or NULL if there is no such special page.
static getUsablePages ()
 Return categorised listable special pages which are available for the current user, and everyone.
static getRegularPages ()
 Return categorised listable special pages for all users.
static getRestrictedPages ()
 Return categorised listable special pages which are available for the current user, but not for everyone.
static executePath (&$title, $including=false)
 Execute a special page path.
static capturePath (&$title)
 Just like executePath() except it returns the HTML instead of outputting it Returns false if there was no such special page, or a title object if it was a redirect.
static getLocalNameFor ($name, $subpage=false)
 Get the local name for a specified canonical name.
static getTitleFor ($name, $subpage=false)
 Get a localised Title object for a specified special page name.
static getSafeTitleFor ($name, $subpage=false)
 Get a localised Title object for a page name with a possibly unvalidated subpage.
static getTitleForAlias ($alias)
 Get a title for a given alias.

Public Attributes

 $mName
 #@+
 $mLocalName
 The local name of this special page.
 $mRestriction
 Minimum user level required to access this page, or "" for anyone.
 $mListed
 Listed in Special:Specialpages?
 $mFunction
 Function name called by the default execute().
 $mFile
 File which needs to be included before the function above can be called.
 $mIncluding
 Whether or not this special page is being included from an article.
 $mIncludable
 Whether the special page can be included in an article.
 $mAllowedRedirectParams = array()
 Query parameters that can be passed through redirects.

Static Public Attributes

static $mList
 List of special pages, followed by parameters.
static $mAliases
static $mListInitialised = false


Detailed Description

Parent special page class, also static functions for handling the special page list.

Definition at line 30 of file SpecialPage.php.


Member Function Documentation

static SpecialPage::addPage ( &$  page  )  [static]

Add a page to the list of valid special pages.

This used to be the preferred method for adding special pages in extensions. It's now suggested that you add an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.

Parameters:
SpecialPage $page

Definition at line 295 of file SpecialPage.php.

References $page, and initList().

static SpecialPage::capturePath ( &$  title  )  [static]

Just like executePath() except it returns the HTML instead of outputting it Returns false if there was no such special page, or a title object if it was a redirect.

Definition at line 571 of file SpecialPage.php.

References $title, $wgOut, $wgTitle, and executePath().

Referenced by Parser::braceSubstitution().

SpecialPage::displayRestrictionError (  ) 

Output an error message telling the user what access level they have to have.

Definition at line 738 of file SpecialPage.php.

References $wgOut.

Referenced by DeletedContributionsPage::execute(), and execute().

SpecialPage::execute ( par  ) 

static SpecialPage::executePath ( &$  title,
including = false 
) [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.

Parameters:
$title a title object
$including output is being captured for use in {{special:whatever}}

Definition at line 495 of file SpecialPage.php.

References $name, $page, $title, $url, $wgOut, $wgRequest, $wgTitle, getPageByAlias(), wfArrayToCGI(), wfProfileIn(), and wfProfileOut().

Referenced by capturePath(), and MediaWiki::initializeSpecialCases().

static SpecialPage::exists ( name  )  [static]

Check if a given name exist as a special page or as a special page alias.

Parameters:
$name string: name of a special page
Returns:
boolean: true if a special page exists with this name

Definition at line 358 of file SpecialPage.php.

References $name, $wgContLang, initAliasList(), and initList().

SpecialPage::file ( x = NULL  ) 

Definition at line 695 of file SpecialPage.php.

References wfSetVar().

Referenced by SpecialRevisionDelete::execute(), and SpecialVersion::getSvnRevision().

SpecialPage::func ( x = NULL  ) 

Definition at line 694 of file SpecialPage.php.

References wfSetVar().

SpecialPage::getDescription (  ) 

Definition at line 805 of file SpecialPage.php.

References wfMsg().

Referenced by setHeaders().

SpecialPage::getFile (  ) 

Definition at line 684 of file SpecialPage.php.

static SpecialPage::getGroup ( &$  page  )  [static]

Add a page to a certain display group for Special:SpecialPages.

Parameters:
SpecialPage $page

Definition at line 321 of file SpecialPage.php.

References $page, $wgSpecialPageGroups, wfEmptyMsg(), and wfMsg().

Referenced by wfSpecialSpecialpages().

SpecialPage::getLocalName (  ) 

#@-

Get the localised name of the special page

Definition at line 703 of file SpecialPage.php.

References getLocalNameFor().

static SpecialPage::getLocalNameFor ( name,
subpage = false 
) [static]

Get the local name for a specified canonical name.

Parameters:
$name 
mixed $subpage Boolean false, or string
Returns:
string

Definition at line 595 of file SpecialPage.php.

References $name, and $wgContLang.

Referenced by Title::fixSpecialName(), getLocalName(), getSafeTitleFor(), and getTitleFor().

SpecialPage::getName (  ) 

#@+ Accessor

Deprecated:

Definition at line 682 of file SpecialPage.php.

static SpecialPage::getPage ( name  )  [static]

Find the object with a given name and return it (or NULL).

Parameters:
string $name

Definition at line 382 of file SpecialPage.php.

References $name, initList(), and wfCreateObject().

Referenced by SpecialNewpages::feedTitle(), SpecialContributions::feedTitle(), QueryPage::feedTitle(), getPageByAlias(), getRegularPages(), getRestrictedPages(), and getUsablePages().

static SpecialPage::getPageByAlias ( alias  )  [static]

Get a special page with a given localised name, or NULL if there is no such special page.

Definition at line 405 of file SpecialPage.php.

References getPage(), and resolveAlias().

Referenced by executePath().

SpecialPage::getRedirect ( subpage  ) 

If the special page is a redirect, then get the Title object it redirects to.

False otherwise.

Reimplemented in SpecialRedirectToSpecial, SpecialMypage, SpecialMytalk, and SpecialMycontributions.

Definition at line 827 of file SpecialPage.php.

SpecialPage::getRedirectQuery (  ) 

Return part of the request string for a special redirect page This allows passing, e.g.

action=history to Special:Mypage, etc.

Returns:
string

Definition at line 837 of file SpecialPage.php.

References $wgRequest.

static SpecialPage::getRegularPages (  )  [static]

Return categorised listable special pages for all users.

Definition at line 444 of file SpecialPage.php.

References $name, $page, getPage(), and initList().

Referenced by specialPagesList().

static SpecialPage::getRestrictedPages (  )  [static]

Return categorised listable special pages which are available for the current user, but not for everyone.

Definition at line 464 of file SpecialPage.php.

References $name, $page, $wgUser, getPage(), and initList().

Referenced by specialPagesList().

SpecialPage::getRestriction (  ) 

Definition at line 683 of file SpecialPage.php.

static SpecialPage::getSafeTitleFor ( name,
subpage = false 
) [static]

Get a localised Title object for a page name with a possibly unvalidated subpage.

Definition at line 622 of file SpecialPage.php.

References $name, getLocalNameFor(), and Title::makeTitleSafe().

Referenced by EmailNotification::composeCommonMailtext(), makeSpecialUrlSubpage(), SkinCologneBlue::quickBar(), and SkinNostalgia::topLinks().

SpecialPage::getTitle ( subpage = false  ) 

static SpecialPage::getTitleFor ( name,
subpage = false 
) [static]

Get a localised Title object for a specified special page name.

Definition at line 610 of file SpecialPage.php.

References $name, getLocalNameFor(), and Title::makeTitle().

Referenced by LoginForm::addNewAccount(), SpecialRevisionDelete::archivedfileLine(), EmailConfirmation::attemptConfirm(), Linker::blockLink(), SkinTemplate::buildContentActionUrls(), SkinTemplate::buildNavUrls(), WatchlistEditor::buildRemoveLine(), WatchlistEditor::buildTools(), SpecialContributions::contributionsSub(), LoginForm::cookieRedirectCheck(), UndeleteForm::diffHeader(), DBUnlockForm::doSubmit(), DBLockForm::doSubmit(), IPUnblockForm::doSubmit(), IPBlockForm::doSubmit(), SpecialTags::doTagRow(), emailUserLink(), WhatLinksHerePage::execute(), SpecialRevisionDelete::execute(), SpecialListGroupRights::execute(), EmailConfirmation::execute(), ApiFeedWatchlist::execute(), QueryPage::feedUrl(), UndeleteForm::formatFileRow(), UserRestrictionsPager::formatRestriction(), UnusedtemplatesPage::formatResult(), UndeleteForm::formatRevisionRow(), ProtectedPagesForm::formatRow(), IPUnblockForm::formatRow(), DeletedContribsPager::formatRow(), IPBlockForm::getBlockListLink(), IPBlockForm::getContribsLink(), UploadForm::getExistsWarning(), SpecialStatistics::getGroupStats(), OutputPage::getHeadLinks(), SearchEngine::getNearMatch(), WithoutInterwikiPage::getPageHeader(), SpecialMycontributions::getRedirect(), SpecialRedirectToSpecial::getRedirect(), getSearchLink(), LogEventsList::getShowHideLinks(), CategoryPager::getStartForm(), DeletedContributionsPage::getSubTitle(), getTitle(), QueryPage::getTitle(), getTitleForAlias(), IPBlockForm::getUnblockLink(), getUndeleteLink(), ImagePage::getUploadUrl(), PageHistory::history(), SpecialRevisionDelete::historyLine(), ImageHistoryList::imageHistoryLine(), MediaWiki::initializeSpecialCases(), OutputPage::loginToUse(), SpecialRevisionDelete::logLine(), LogEventsList::logLine(), Parser::magicLinkCallback(), LoginForm::mainLoginForm(), PreferencesForm::mainPrefsForm(), UploadForm::mainUploadForm(), Linker::makeBrokenImageLinkObj(), SpecialBookSources::makeForm(), LoginForm::makeLanguageSelectorLink(), Linker::makeMediaLinkObj(), IPUnblockForm::makeOptionsLink(), SpecialSearch::makeSearchLink(), makeSpecialUrl(), WantedTemplatesPage::makeWlhLink(), WantedPagesPage::makeWlhLink(), WantedFilesPage::makeWlhLink(), SpecialMostlinkedtemplates::makeWlhLink(), MostlinkedPage::makeWlhLink(), Article::markpatrolled(), moveThisPage(), nameAndLogin(), Linker::normaliseSpecialPage(), ImagePage::openShowImage(), SkinTemplate::outputPage(), SpecialSearchOld::powerSearchBox(), SpecialSearch::powerSearchBox(), MediaWiki::preliminaryChecks(), SkinCologneBlue::quickBar(), EnhancedChangesList::recentChangesLine(), PreferencesForm::restorePreferences(), LogPage::saveContent(), PreferencesForm::savePreferences(), Article::setOldSubtitle(), SpecialSearchOld::shortDialog(), SpecialSearch::shortDialog(), EditPage::showDeletionLog(), Article::showDeletionLog(), UndeleteForm::showFileConfirmationForm(), DBUnlockForm::showForm(), SpecialResetpass::showForm(), MovePageForm::showForm(), DBLockForm::showForm(), IPUnblockForm::showForm(), EmailUserForm::showForm(), IPBlockForm::showForm(), UndeleteForm::showHistory(), MergehistoryForm::showHistory(), SpecialSearchOld::showHit(), SpecialSearch::showHit(), SpecialRevisionDelete::showImages(), UndeleteForm::showList(), IPBlockForm::showLogFragment(), SpecialRevisionDelete::showLogItems(), MergehistoryForm::showMergeForm(), WatchlistEditor::showNormalForm(), ProtectedTitlesForm::showOptions(), ProtectedPagesForm::showOptions(), LogEventsList::showOptions(), WatchlistEditor::showRawForm(), EmailConfirmation::showRequestForm(), SpecialSearchOld::showResults(), SpecialSearch::showResults(), UndeleteForm::showRevision(), SpecialRevisionDelete::showRevs(), UndeleteForm::showSearchForm(), UploadForm::uploadWarning(), Title::userCanRead(), userContribsLink(), Linker::userLink(), EditPage::userNotLoggedInPage(), Linker::userToolLinks(), watchPageLinksLink(), wfProxyCheck(), wfSpecialEmailuser(), wfSpecialFileDuplicateSearch(), wfSpecialNewimages(), wfSpecialWatchlist(), whatLinksHere(), and WhatLinksHerePage::wlhLink().

static SpecialPage::getTitleForAlias ( alias  )  [static]

Get a title for a given alias.

Returns:
Title or null if there is no such alias

Definition at line 635 of file SpecialPage.php.

References $name, getTitleFor(), and resolveAlias().

Referenced by CoreParserFunctions::special().

static SpecialPage::getUsablePages (  )  [static]

Return categorised listable special pages which are available for the current user, and everyone.

Definition at line 419 of file SpecialPage.php.

References $name, $page, $wgUser, getPage(), and initList().

Referenced by wfSpecialSpecialpages().

SpecialPage::includable ( x = NULL  ) 

SpecialPage::including ( x = NULL  ) 

static SpecialPage::initAliasList (  )  [static]

Definition at line 234 of file SpecialPage.php.

References $name, and $wgContLang.

Referenced by exists(), resolveAlias(), and PrefixSearch::specialSearch().

static SpecialPage::initList (  )  [static]

SpecialPage::isListed (  ) 

Definition at line 685 of file SpecialPage.php.

SpecialPage::isRestricted (  ) 

Can be overridden by subclasses with more complicated permissions schemes.

Returns:
bool Should the page be displayed with the restricted-access pages?

Reimplemented in UserrightsPage.

Definition at line 717 of file SpecialPage.php.

References $wgGroupPermissions.

SpecialPage::listed ( x = NULL  ) 

Definition at line 693 of file SpecialPage.php.

References wfSetVar().

SpecialPage::name ( x = NULL  ) 

#@-

#@+ Accessor and mutator

Definition at line 691 of file SpecialPage.php.

References wfSetVar().

Referenced by outputHeader().

SpecialPage::outputHeader ( summaryMessageKey = ''  ) 

Outputs a summary message on top of special pages Per default the message key is the canonical name of the special page May be overriden, i.e.

by extensions to stick with the naming conventions for message keys: 'extensionname-xxx'

Parameters:
string message key of the summary

Definition at line 785 of file SpecialPage.php.

References $msg, $out, $wgContLang, $wgOut, including(), name(), wfEmptyMsg(), and wfMsgNoTrans().

Referenced by SpecialVersion::execute(), UserrightsPage::execute(), SpecialRevisionDelete::execute(), SpecialResetpass::execute(), SpecialRecentChanges::execute(), SpecialPrefixindex::execute(), SpecialNewpages::execute(), SpecialListGroupRights::execute(), SpecialImport::execute(), SpecialExport::execute(), SpecialContributions::execute(), SpecialAllpages::execute(), and execute().

static SpecialPage::removePage ( name  )  [static]

Remove a special page from the list Formerly used to disable expensive or dangerous special pages.

The preferred method is now to add a SpecialPage_initList hook.

Definition at line 346 of file SpecialPage.php.

References $name, and initList().

static SpecialPage::resolveAlias ( alias  )  [static]

Given a special page alias, return the special page name.

Returns false if there is no such alias.

Definition at line 258 of file SpecialPage.php.

References $wgContLang, initAliasList(), and initList().

Referenced by Title::fixSpecialName(), getPageByAlias(), getTitleForAlias(), Skin::makeGlobalVariablesScript(), and resolveAliasWithSubpage().

static SpecialPage::resolveAliasWithSubpage ( alias  )  [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.

Definition at line 276 of file SpecialPage.php.

References $name, and resolveAlias().

Referenced by SkinTemplate::buildPersonalUrls(), LogPage::getTitleLink(), Title::isSpecial(), Linker::normaliseSpecialPage(), EnhancedChangesList::recentChangesLine(), OldChangesList::recentChangesLine(), and Title::userCanRead().

SpecialPage::restrictions ( x = NULL  ) 

Definition at line 692 of file SpecialPage.php.

References wfSetVar().

static SpecialPage::setGroup ( page,
group 
) [static]

Add a page to a certain display group for Special:SpecialPages.

Parameters:
mixed $page (SpecialPage or string)
string $group

Definition at line 309 of file SpecialPage.php.

References $name, $page, and $wgSpecialPageGroups.

SpecialPage::setHeaders (  ) 

SpecialPage::setListed ( listed  ) 

Set whether this page is listed in Special:Specialpages, at run-time.

Definition at line 819 of file SpecialPage.php.

References wfSetVar().

SpecialPage::SpecialPage ( name = '',
restriction = '',
listed = true,
function = false,
file = 'default',
includable = false 
)

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 behaviour with userCanExecute() and displayRestrictionError()

Parameters:
string $name Name of the special page, as seen in links and URLs
string $restriction User right required, e.g. "block" or "delete"
boolean $listed Whether the page is listed in Special:Specialpages
string $function Function called by execute(). By default it is constructed from $name
string $file File which is included by execute(). It is also constructed from $name by default

Definition at line 660 of file SpecialPage.php.

References $file, and $name.

Referenced by SpecialRecentchangeslinked::__construct(), IncludableSpecialPage::IncludableSpecialPage(), and UnlistedSpecialPage::UnlistedSpecialPage().

SpecialPage::userCanExecute ( user  ) 

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.

Parameters:
User $user The user to check
Returns:
bool Does the user have permission to view the page?

Reimplemented in UserrightsPage.

Definition at line 731 of file SpecialPage.php.

References $user.

Referenced by DeletedContributionsPage::execute(), and execute().


Member Data Documentation

SpecialPage::$mAliases [static]

Definition at line 191 of file SpecialPage.php.

SpecialPage::$mAllowedRedirectParams = array()

Query parameters that can be passed through redirects.

Definition at line 72 of file SpecialPage.php.

SpecialPage::$mFile

File which needs to be included before the function above can be called.

Definition at line 60 of file SpecialPage.php.

SpecialPage::$mFunction

Function name called by the default execute().

Definition at line 56 of file SpecialPage.php.

SpecialPage::$mIncludable

Whether the special page can be included in an article.

Definition at line 68 of file SpecialPage.php.

SpecialPage::$mIncluding

Whether or not this special page is being included from an article.

Definition at line 64 of file SpecialPage.php.

SpecialPage::$mList [static]

List of special pages, followed by parameters.

If the only parameter is a string, that is the page name. Otherwise, it is an array. The format is one of: array( 'SpecialPage', name, right ) array( 'IncludableSpecialPage', name, right, listed? ) array( 'UnlistedSpecialPage', name, right ) array( 'SpecialRedirectToSpecial', name, page to redirect to, special page param, ... )

Definition at line 82 of file SpecialPage.php.

Referenced by PrefixSearch::specialSearch().

SpecialPage::$mListed

Listed in Special:Specialpages?

Definition at line 52 of file SpecialPage.php.

SpecialPage::$mListInitialised = false [static]

Definition at line 192 of file SpecialPage.php.

SpecialPage::$mLocalName

The local name of this special page.

Definition at line 43 of file SpecialPage.php.

SpecialPage::$mName

#@+

Access:
private The canonical name of this special page Also used for the default<h1> heading,
See also:
getDescription()

Definition at line 39 of file SpecialPage.php.

SpecialPage::$mRestriction

Minimum user level required to access this page, or "" for anyone.

Also used to categorise the pages in Special:Specialpages

Definition at line 48 of file SpecialPage.php.


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:47 2009 for MediaWiki by  doxygen 1.5.9