MediaWiki  1.23.8
ContextSource Class Reference

The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and provide accessors to it. More...

Inheritance diagram for ContextSource:
Collaboration diagram for ContextSource:

Public Member Functions

 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 Get the Config object. More...
 
 getContext ()
 Get the RequestContext object. More...
 
 getLang ()
 Get the Language object. More...
 
 getLanguage ()
 Get the Language object. More...
 
 getOutput ()
 Get the OutputPage object. More...
 
 getRequest ()
 Get the WebRequest object. More...
 
 getSkin ()
 Get the Skin object. More...
 
 getTitle ()
 Get the Title object. More...
 
 getUser ()
 Get the User object. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ()
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 Set the IContextSource object. More...
 

Private Attributes

IContextSource $context
 

Detailed Description

The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and provide accessors to it.

Definition at line 30 of file ContextSource.php.

Member Function Documentation

◆ canUseWikiPage()

ContextSource::canUseWikiPage ( )

Check whether a WikiPage object can be get with getWikiPage().

Callers should expect that an exception is thrown from getWikiPage() if this method returns false.

Since
1.19
Returns
bool

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 99 of file ContextSource.php.

References getContext().

Referenced by SkinTemplate\buildContentNavigationUrls(), and OutputPage\getJSVars().

◆ exportSession()

ContextSource::exportSession ( )

Export the resolved user IP, HTTP headers, user ID, and session ID.

The result will be reasonably sized to allow for serialization.

Returns
Array
Since
1.21

Implements IContextSource.

Definition at line 188 of file ContextSource.php.

References getContext().

Referenced by ApiUpload\getChunkResult(), and ApiUpload\performUpload().

◆ getConfig()

ContextSource::getConfig ( )

Get the Config object.

Since
1.23
Returns
Config

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 67 of file ContextSource.php.

References getContext().

Referenced by OutputPage\disallowUserJs(), and ApiFormatPhp\execute().

◆ getContext()

ContextSource::getContext ( )

Get the RequestContext object.

Since
1.18
Returns
RequestContext

Definition at line 40 of file ContextSource.php.

References $context, RequestContext\getMain(), and wfDebug().

Referenced by ApiMain\__construct(), OutputPage\addSubtitle(), SkinTemplate\buildContentNavigationUrls(), SkinTemplate\buildNavUrls(), canUseWikiPage(), DerivativeContext\canUseWikiPage(), ApiParse\categoriesHtml(), CategoryViewer\clearCategoryState(), ApiComparePages\execute(), ApiCreateAccount\execute(), ApiEmailUser\execute(), ApiRevisionDelete\execute(), ApiUserrights\execute(), ApiParse\execute(), ApiExpandTemplates\execute(), ApiOptions\execute(), ApiUnblock\execute(), ApiBlock\execute(), ApiFeedContributions\execute(), ApiLogin\execute(), ApiQueryUsers\execute(), ApiMain\executeAction(), exportSession(), ApiQueryRevisions\extractRowInfo(), ChangesList\formatCharacterDifference(), ProtectedPagesPager\formatValue(), ApiUpload\getChunkResult(), getConfig(), DerivativeContext\getConfig(), FormatMetadata\getExtendedMetadataFromHook(), UploadForm\getExtensionsMessage(), NewFilesPager\getForm(), OutputPage\getJSVars(), getLanguage(), DerivativeContext\getLanguage(), EditWatchlistNormalHTMLForm\getLegend(), getOutput(), DerivativeContext\getOutput(), DifferenceEngine\getParserOutput(), getRequest(), DerivativeContext\getRequest(), getSkin(), DerivativeContext\getSkin(), UploadForm\getSourceSection(), NewFilesPager\getStartBody(), getTitle(), DerivativeContext\getTitle(), HTMLForm\getTitle(), ApiUserrights\getUrUser(), getUser(), DerivativeContext\getUser(), getWikiPage(), DerivativeContext\getWikiPage(), OutputPage\headElement(), HistoryPager\historyLine(), ChangesList\insertLogEntry(), ChangesList\insertRollback(), LogEventsList\logLine(), ApiParse\makeParserOptions(), msg(), SkinTemplate\outputPage(), OutputPage\parserOptions(), ApiUpload\performUpload(), SkinTemplate\prepareQuickTemplate(), DifferenceEngine\renderNewRevision(), OutputPage\setHTMLTitle(), OutputPage\setPageTitle(), OutputPage\setTitle(), SideBarTest\setUp(), ApiMain\setupModule(), DifferenceEngine\showDiffPage(), SkinTemplate\tabAction(), and ApiWatch\watchTitle().

◆ getLang()

ContextSource::getLang ( )

Get the Language object.

Deprecated:
since 1.19 Use getLanguage instead
Returns
Language

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 142 of file ContextSource.php.

References getLanguage(), and wfDeprecated().

◆ getLanguage()

ContextSource::getLanguage ( )

Get the Language object.

Since
1.19
Returns
Language

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 154 of file ContextSource.php.

References getContext().

Referenced by AllmessagesTablePager\__construct(), OutputPage\addInlineStyle(), OutputPage\buildCssLinks(), Skin\buildSidebar(), ApiParse\execute(), ApiQueryAllMessages\execute(), FormatMetadata\fetchExtendedMetadata(), ApiParse\formatLangLinks(), SkinTemplate\formatLanguageName(), FormatMetadata\formatNum(), NewFilesPager\formatRow(), ActiveUsersPager\formatRow(), DeletedContribsPager\formatRow(), UsersPager\formatRow(), CategoryPager\formatRow(), BlockListPager\formatValue(), AllmessagesTablePager\formatValue(), ProtectedPagesPager\formatValue(), Skin\getCopyright(), UploadForm\getExtensionsMessage(), LogEventsList\getFilterLinks(), CategoryViewer\getHTML(), Skin\getHtmlElementAttributes(), getLang(), SkinTemplate\getLanguages(), EditWatchlistNormalHTMLForm\getLegend(), IndexPager\getLimitLinks(), TablePager\getLimitSelectList(), DeletedContribsPager\getNavigationBar(), AlphabeticPager\getNavigationBar(), ReverseChronologicalPager\getNavigationBar(), TablePager\getNavigationBar(), FormatMetadata\getPriorityLanguages(), ImageGalleryBase\getRenderLang(), DifferenceEngine\getRevisionHeader(), AllmessagesTablePager\getRowAttrs(), UploadForm\getSourceSection(), ChangesList\getTimestamp(), OutputPage\headElement(), HistoryPager\historyLine(), ChangesList\insertArticleLink(), ChangesList\insertDateHeader(), ChangesList\insertLogEntry(), ChangesList\insertUserRelatedLinks(), Skin\lastModified(), LogEventsList\logLine(), FormatMetadata\makeFormattedData(), OutputPage\makeResourceLoaderLink(), SkinTemplate\prepareQuickTemplate(), EnhancedChangesList\recentChangesBlockGroup(), OldChangesList\recentChangesLine(), EnhancedChangesList\recentChangesLine(), HistoryPager\revLink(), UploadFromUrlTestSuite\setUp(), OutputPage\showLagWarning(), DifferenceEngine\showMissingRevision(), EnhancedChangesList\sideArrow(), and OutputPage\styleLink().

◆ getOutput()

◆ getRequest()

ContextSource::getRequest ( )

Get the WebRequest object.

Since
1.18
Returns
WebRequest

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 77 of file ContextSource.php.

References getContext().

Referenced by UsersPager\__construct(), ActiveUsersPager\__construct(), AllmessagesTablePager\__construct(), IndexPager\__construct(), ApiMain\__construct(), TablePager\__construct(), OutputPage\addAcceptLanguage(), SkinTemplate\buildContentNavigationUrls(), OutputPage\buildCssLinks(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), OutputPage\checkLastModified(), ApiMain\checkMaxLag(), CategoryViewer\clearCategoryState(), ApiCreateAccount\execute(), ApiEditPage\execute(), ApiQueryDeletedrevs\execute(), ApiLogin\execute(), ApiMain\executeActionWithErrorHandling(), ApiMain\getCheck(), ApiQueryUserInfo\getCurrentUserInfo(), LogEventsList\getDefaultQuery(), IndexPager\getDefaultQuery(), LogEventsList\getExtraInputs(), LogPager\getFilterParams(), NewFilesPager\getForm(), OutputPage\getHeadLinksArray(), TablePager\getHiddenFields(), OutputPage\getScriptsForBottomQueue(), UploadForm\getSourceSection(), NewFilesPager\getStartBody(), ApiQueryUsers\getTokenFunctions(), ApiQueryRevisions\getTokenFunctions(), ApiQueryRecentChanges\getTokenFunctions(), ApiQueryInfo\getTokenFunctions(), ApiTokens\getTokenTypes(), Skin\getUndeleteLink(), ApiMain\getUpload(), ApiMain\getVal(), ApiMain\handleCORS(), ApiMain\handleException(), OutputPage\haveCacheVaryCookies(), ApiQuery\initModules(), SkinVector\initPage(), HTMLForm\loadData(), ApiMain\logRequest(), OutputPage\makeResourceLoaderLink(), OutputPage\output(), MediaWiki\parseTitle(), SkinTemplate\prepareQuickTemplate(), ApiMain\reportUnusedParams(), OutputPage\returnToMain(), ApiQueryRecentChanges\run(), OutputPage\sendCacheControl(), ApiMain\sendCacheHeaders(), ApiMain\setupExternalResponse(), ApiMain\setupModule(), ActiveUsersPager\setupOptions(), SkinTemplate\setupTemplateForOutput(), DifferenceEngine\showDiffPage(), OutputPage\showPermissionsErrorPage(), ApiMain\substituteResultWithError(), HTMLForm\tryAuthorizedSubmit(), and OutputPage\userCanPreview().

◆ getSkin()

ContextSource::getSkin ( )

Get the Skin object.

Since
1.18
Returns
Skin

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 164 of file ContextSource.php.

References getContext().

Referenced by ChangesList\__construct(), OutputPage\buildCssLinks(), OutputPage\getJSVars(), OutputPage\makeResourceLoaderLink(), and OutputPage\output().

◆ getTitle()

ContextSource::getTitle ( )

Get the Title object.

Since
1.18
Returns
Title

Implements IContextSource.

Reimplemented in ImageHistoryPseudoPager, HTMLForm, ImageListPager, AllmessagesTablePager, ProtectedTitlesPager, and DerivativeContext.

Definition at line 87 of file ContextSource.php.

References getContext().

Referenced by OutputPage\addAcceptLanguage(), OutputPage\addParserOutputNoText(), Skin\addToSidebarPlain(), OutputPage\addWikiText(), OutputPage\addWikiTextTidy(), SkinTemplate\buildContentNavigationUrls(), OutputPage\buildCssLinks(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), HistoryPager\curLink(), ApiEditPage\execute(), FileDuplicateSearchPage\formatResult(), HistoryPager\formatRow(), Skin\getCategories(), Skin\getCategoryLinks(), Skin\getCopyright(), DifferenceEngine\getDiffLang(), LogEventsList\getDisplayTitle(), HistoryPager\getEndBody(), LogEventsList\getFilterLinks(), NewFilesPager\getForm(), OutputPage\getHeadLinksArray(), OutputPage\getJSVars(), SkinTemplate\getLanguages(), SkinTemplate\getNameSpaceKey(), Skin\getNamespaceNotice(), ActiveUsersPager\getPageHeader(), UsersPager\getPageHeader(), Skin\getRelevantTitle(), OutputPage\getScriptsForBottomQueue(), HistoryPager\getStartBody(), CategoryPager\getStartForm(), Skin\getUndeleteLink(), OutputPage\headElement(), HistoryPager\historyLine(), Skin\isRevisionCurrent(), HistoryPager\lastLink(), Skin\lastModified(), DifferenceEngine\loadRevisionData(), DifferenceEngine\loadRevisionIds(), IndexPager\makeLink(), DifferenceEngine\mapDiffPrevNext(), OutputPage\parse(), Skin\preloadExistence(), SkinTemplate\prepareQuickTemplate(), Skin\printSource(), OutputPage\readOnlyPage(), DifferenceEngine\renderNewRevision(), HistoryPager\revLink(), OutputPage\setFeedAppendQuery(), DifferenceEngine\setText(), SkinTemplate\setupTemplateForOutput(), DifferenceEngine\showDiffPage(), Skin\subPageSubtitle(), and OutputPage\userCanPreview().

◆ getUser()

ContextSource::getUser ( )

Get the User object.

Since
1.18
Returns
User

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 132 of file ContextSource.php.

References getContext().

Referenced by IndexPager\__construct(), OutputPage\blockedPage(), SkinTemplate\buildContentNavigationUrls(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), ApiMain\canApiHighLimits(), ApiMain\checkAsserts(), ApiMain\checkExecutePermissions(), OutputPage\checkLastModified(), DifferenceEngine\deletedLink(), ApiQuery\doExport(), ApiCreateAccount\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiEmailUser\execute(), ApiMove\execute(), ApiRevisionDelete\execute(), ApiImport\execute(), ApiEditPage\execute(), ApiUpload\execute(), ApiWatch\execute(), ApiLogout\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiSetNotificationTimestamp\execute(), ApiOptions\execute(), ApiFileRevert\execute(), ApiPurge\execute(), ApiUnblock\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiRollback\execute(), ApiDelete\execute(), ApiBlock\execute(), ApiQueryBlocks\execute(), ApiQueryLogEvents\execute(), ApiQueryImageInfo\execute(), ApiImageRotate\execute(), ApiQueryRevisions\execute(), ApiQueryWatchlist\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryRevisions\extractRowInfo(), DeletedContribsPager\formatRow(), UsersPager\formatRow(), HistoryPager\formatRow(), BlockListPager\formatValue(), ProtectedPagesPager\formatValue(), ApiQueryLogEvents\getCacheMode(), Skin\getCategories(), Skin\getCategoryLinks(), ApiQueryUserInfo\getCurrentUserInfo(), UploadForm\getDescriptionSection(), HistoryPager\getEndBody(), LogPager\getFilterParams(), OutputPage\getHeadLinksArray(), HTMLForm\getHiddenFields(), OutputPage\getJSVars(), PreferencesForm\getModifiedUser(), Skin\getNewtalks(), UploadForm\getOptionsSection(), DeletedContribsPager\getQueryInfo(), ActiveUsersPager\getQueryInfo(), UsersPager\getQueryInfo(), BlockListPager\getQueryInfo(), NewPagesPager\getQueryInfo(), ApiQueryUserInfo\getRateLimits(), DifferenceEngine\getRevisionHeader(), OutputPage\getScriptsForBottomQueue(), LogEventsList\getShowHideLinks(), Skin\getSiteNotice(), UploadForm\getSourceSection(), HistoryPager\getStartBody(), LogEventsList\getTypeSelector(), Skin\getUndeleteLink(), ApiQueryInfo\getWatchedInfo(), ApiQueryInfo\getWatcherInfo(), HistoryPager\historyLine(), ChangesList\insertDateHeader(), ChangesList\insertDiffHist(), ChangesList\insertRollback(), Skin\lastModified(), LogPager\limitPerformer(), LogPager\limitTitle(), LogPager\limitType(), DifferenceEngine\loadNewText(), DifferenceEngine\loadText(), LogEventsList\logLine(), ApiMain\logRequest(), OutputPage\makeResourceLoaderLink(), DifferenceEngine\markPatrolledLink(), ApiPurge\mustBePosted(), ApiUpload\performUpload(), Skin\preloadExistence(), ApiQueryContributions\prepareQuery(), OutputPage\readOnlyPage(), EnhancedChangesList\recentChangesBlockGroup(), ImportReporter\reportPage(), DifferenceEngine\revisionDeleteLink(), HistoryPager\revLink(), ApiQueryWatchlist\run(), ApiQueryRecentChanges\run(), ApiUpload\selectUploadModule(), ApiMain\setupModule(), SkinTemplate\setupTemplateForOutput(), ChangesList\showAsUnpatrolled(), DifferenceEngine\showDiffPage(), Skin\showEmailUser(), ApiQueryBase\showHiddenUsersAddBlockInfo(), OutputPage\showPermissionsErrorPage(), HTMLForm\tryAuthorizedSubmit(), RevDel_List\updateLog(), OutputPage\userCanPreview(), and ApiQueryBase\userCanSeeRevDel().

◆ getWikiPage()

ContextSource::getWikiPage ( )

Get the WikiPage object.

May throw an exception if there's no Title object set or the Title object belongs to a special namespace that doesn't have WikiPage, so use first canUseWikiPage() to check whether this method can be called safely.

Since
1.19
Returns
WikiPage

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 112 of file ContextSource.php.

References getContext().

Referenced by SkinTemplate\buildContentNavigationUrls(), HistoryPager\curLink(), OutputPage\getJSVars(), HistoryPager\getQueryInfo(), SkinTemplate\prepareQuickTemplate(), and DifferenceEngine\renderNewRevision().

◆ msg()

ContextSource::msg ( )

Get a Message object with context set Parameters are the same as wfMessage()

Since
1.18
Returns
Message

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 175 of file ContextSource.php.

References $args, array(), and getContext().

Referenced by DeletedContribsPager\__construct(), AllmessagesTablePager\__construct(), UploadForm\__construct(), OutputPage\addBacklinkSubtitle(), OutputPage\addReturnTo(), Skin\addToSidebarPlain(), OutputPage\addWikiMsgArray(), SkinTemplate\buildContentNavigationUrls(), AllmessagesTablePager\buildForm(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), ImportReporter\close(), FormatMetadata\collapseContactInfo(), EnhancedChangesList\downArrow(), FormatMetadata\exifMsg(), Skin\footerLink(), FormatMetadata\formatCoords(), OutputPage\formatPermissionsErrorMessage(), ActiveUsersPager\formatRow(), DeletedContribsPager\formatRow(), UsersPager\formatRow(), CategoryPager\formatRow(), BlockListPager\formatValue(), AllmessagesTablePager\formatValue(), ProtectedPagesPager\formatValue(), HTMLForm\getButtons(), PreferencesForm\getButtons(), Skin\getCachedNotice(), Skin\getCategoryLinks(), Skin\getCopyright(), CategoryViewer\getCountMessage(), DifferenceEngine\getDiff(), TablePager\getEmptyBody(), UploadForm\getExtensionsMessage(), LogEventsList\getExtraInputs(), ApiFeedRecentChanges\getFeedObject(), ImageListPager\getFieldNames(), BlockListPager\getFieldNames(), ProtectedPagesPager\getFieldNames(), AllmessagesTablePager\getFieldNames(), LogEventsList\getFilterLinks(), NewFilesPager\getForm(), OutputPage\getHeadLinksArray(), CategoryViewer\getHTML(), CategoryViewer\getImageSection(), EditWatchlistNormalHTMLForm\getLegend(), HTMLForm\getLegend(), TablePager\getLimitDropdown(), DeletedContribsPager\getNavigationBar(), AlphabeticPager\getNavigationBar(), ReverseChronologicalPager\getNavigationBar(), TablePager\getNavigationBar(), Skin\getNewtalks(), ActiveUsersPager\getPageHeader(), UsersPager\getPageHeader(), CategoryViewer\getPagesSection(), HistoryPager\getRevisionButton(), DifferenceEngine\getRevisionHeader(), UploadForm\getSourceSection(), AllmessagesTablePager\getStartBody(), HistoryPager\getStartBody(), TablePager\getStartBody(), CategoryPager\getStartForm(), CategoryViewer\getSubcategorySection(), HTMLForm\getSubmitText(), LogEventsList\getTitleInput(), LogEventsList\getTitlePattern(), Skin\getUndeleteLink(), LogEventsList\getUserInput(), OutputPage\headElement(), HistoryPager\historyLine(), ChangesList\insertComment(), ChangesList\insertDiffHist(), ChangesList\insertLog(), ChangesList\insertUserRelatedLinks(), FormatMetadata\langItem(), Skin\lastModified(), DifferenceEngine\localiseLineNumbersCb(), Skin\logoText(), Skin\mainPageLink(), FormatMetadata\makeFormattedData(), DifferenceEngine\markPatrolledLink(), ChangesList\numberofWatchingusers(), CategoryViewer\pagingLinks(), ChangesList\preCacheMessages(), SkinTemplate\prepareQuickTemplate(), Skin\printSource(), OutputPage\readOnlyPage(), EnhancedChangesList\recentChangesBlockGroup(), EnhancedChangesList\recentChangesBlockLine(), ImportReporter\reportNotice(), ImportReporter\reportPage(), OutputPage\setPageTitle(), HTMLForm\setSubmitTextMsg(), HTMLForm\setWrapperLegendMsg(), DifferenceEngine\showDiffPage(), OutputPage\showErrorPage(), OutputPage\showFatalError(), OutputPage\showFileCopyError(), OutputPage\showFileDeleteError(), OutputPage\showFileNotFoundError(), OutputPage\showFileRenameError(), LogEventsList\showHeader(), DifferenceEngine\showMissingRevision(), LogEventsList\showOptions(), OutputPage\showPermissionsErrorPage(), OutputPage\showUnexpectedValueError(), EnhancedChangesList\sideArrow(), Skin\subPageSubtitle(), TraditionalImageGallery\toHTML(), OutputPage\versionRequired(), ApiWatch\watchTitle(), and OutputPage\wrapWikiMsg().

◆ setContext()

Member Data Documentation

◆ $context


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