MediaWiki master
MediaWiki\Output\OutputPage Class Reference

This is one of the Core classes and should be read at least once by any new developers. More...

Inherits MediaWiki\Context\ContextSource.

Collaboration diagram for MediaWiki\Output\OutputPage:

Public Member Functions

 __construct (IContextSource $context)
 Constructor for OutputPage.
 
 adaptCdnTTL ( $mtime, $minTTL=0, $maxTTL=0)
 Get TTL in [$minTTL,$maxTTL] and pass it to lowerCdnMaxage()
 
 addBacklinkSubtitle (PageReference $title, $query=[])
 Add a subtitle containing a backlink to a page.
 
 addBodyClasses ( $classes)
 Add a class to the <body> element.
 
 addCategoryLinks (array $categories)
 Add an array of categories, with names in the keys.
 
 addContentOverride ( $target, Content $content)
 Force the given Content object for the given page, for things like page preview.
 
 addContentOverrideCallback (callable $callback)
 Add a callback for mapping from a Title to a Content object, for things like page preview.
 
 addElement ( $element, array $attribs=[], $contents='')
 Shortcut for adding an Html::element via addHTML.
 
 addFeedLink ( $format, $href)
 Add a feed link to the page header.
 
 addHeadItem ( $name, $value)
 Add or replace a head item to the output.
 
 addHeadItems ( $values)
 Add one or more head items to the output.
 
 addHelpLink ( $to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators.
 
 addHTML ( $text)
 Append $text to the body HTML.
 
 addHtmlClasses ( $classes)
 Add a class to the <html> element.
 
 addInlineScript ( $script)
 Add a self-contained script tag with the given contents Internal use only.
 
 addInlineStyle ( $style_css, $flip='noflip')
 Adds inline CSS styles Internal use only.
 
 addJsConfigVars ( $keys, $value=null)
 Add one or more variables to be set in mw.config in JavaScript.
 
 addLanguageLinks (array $newLinkArray)
 Add new language links.
 
 addLink (array $linkarr)
 Add a new \<link\> tag to the page header.
 
 addLinkHeader ( $header)
 Add an HTTP Link: header.
 
 addMeta ( $name, $val)
 Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".
 
 addModules ( $modules)
 Load one or more ResourceLoader modules on this page.
 
 addModuleStyles ( $modules)
 Load the styles of one or more style-only ResourceLoader modules on this page.
 
 addParserOutput (ParserOutput $parserOutput, $poOptions=[])
 Add everything from a ParserOutput object.
 
 addParserOutputContent (ParserOutput $parserOutput, $poOptions=[])
 Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput object, without any other metadata.
 
 addParserOutputMetadata (ParserOutput $parserOutput)
 Add all metadata associated with a ParserOutput object, but without the actual HTML.
 
 addParserOutputText ( $text, $poOptions=[])
 Add the HTML associated with a ParserOutput object, without any metadata.
 
 addReturnTo ( $title, array $query=[], $text=null, $options=[])
 Add a "return to" link pointing to a specified title.
 
 addScript ( $script)
 Add raw HTML to the list of scripts (including \<script\> tag, etc.) Internal use only.
 
 addScriptFile ( $file, $unused=null)
 Add a JavaScript file to be loaded as <script> on this page.
 
 addStyle ( $style, $media='', $condition='', $dir='')
 Add a local or specified stylesheet, with the given media options.
 
 addSubtitle ( $str)
 Add $str to the subtitle.
 
 addTemplate (&$template)
 Add the output of a QuickTemplate to the output buffer.
 
 addVaryHeader ( $header)
 Add an HTTP header that will have an influence on the cache.
 
 addWikiMsg ( $name,... $args)
 Add a wikitext-formatted message to the output.
 
 addWikiMsgArray ( $name, $args)
 Add a wikitext-formatted message to the output.
 
 addWikiTextAsContent ( $text, $linestart=true, PageReference $title=null)
 Convert wikitext in the page content language to HTML and add it to the buffer.
 
 addWikiTextAsInterface ( $text, $linestart=true, PageReference $title=null)
 Convert wikitext in the user interface language to HTML and add it to the buffer.
 
 buildCssLinksArray ()
 
 checkLastModified ( $timestamp)
 checkLastModified tells the client to use the client-cached page if possible.
 
 clearHTML ()
 Clear the body HTML.
 
 clearSubtitle ()
 Clear the subtitles.
 
 considerCacheSettingsFinal ()
 Set the expectation that cache control will not change after this point.
 
 couldBePublicCached ()
 Whether the output might become publicly cached.
 
 disable ()
 Disable output completely, i.e.
 
 disableClientCache ()
 Force the page to send nocache headers.
 
 disallowUserJs ()
 Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bundled with, or generated by, the software.
 
 enableClientCache ()
 Do not send nocache headers.
 
 enableOOUI ()
 Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaWiki and this OutputPage instance.
 
 forceHideNewSectionLink ()
 Forcibly hide the new section link?
 
 formatPermissionsErrorMessage (array $errors, $action=null)
 Format a list of error messages.
 
 formatPermissionStatus (PermissionStatus $status, string $action=null)
 Format permission $status obtained from Authority for display.
 
 getAllowedModules ( $type)
 Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
 
 getArticleBodyOnly ()
 Return whether the output will contain only the body of the article.
 
 getBottomScripts ()
 JS stuff to put at the bottom of the <body>.
 
 getCacheVaryCookies ()
 Get the list of cookie names that will influence the cache.
 
 getCanonicalUrl ()
 Returns the URL to be used for the <link rel=canonical>> if one is set.
 
 getCategories ( $type='all')
 Get the list of category names this page belongs to.
 
 getCategoryLinks ()
 Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link, where $type is either "normal" or "hidden" (for hidden categories) and $link a HTML fragment with a link to the category page.
 
 getCSP ()
 Get the ContentSecurityPolicy object.
 
 getCSPNonce ()
 Get (and set if not yet set) the CSP nonce.
 
 getDisplayTitle ()
 Returns page display title.
 
 getFeedAppendQuery ()
 Will currently always return null.
 
 getFileSearchOptions ()
 Get the files used on this page.
 
 getFileVersion ()
 Get the displayed file version.
 
 getFollowPolicy ()
 Get the current follow policy for the page as a string.
 
 getFrameOptions ()
 Get the X-Frame-Options header value (without the name part), or false if there isn't one.
 
 getHeadItemsArray ()
 Get an array of head items.
 
 getHeadLinksArray ()
 
 getHTML ()
 Get the body HTML.
 
 getHTMLTitle ()
 Return the "HTML title", i.e.
 
 getIndexPolicy ()
 Get the current index policy for the page as a string.
 
 getIndicators ()
 Get the indicators associated with this page.
 
 getJsConfigVars ()
 Get the javascript config vars to include on this page.
 
 getJSVars (?int $flag=null)
 Get an array containing the variables to be set in mw.config in JavaScript.
 
 getLanguageLinks ()
 Get the list of language links.
 
 getLinkHeader ()
 Return a Link: header.
 
 getLinkTags ()
 Returns the current <link> tags.
 
 getMetaTags ()
 Returns the current <meta> tags.
 
 getModules ( $filter=false, $position=null, $param='mModules', $type=RL\Module::TYPE_COMBINED)
 Get the list of modules to include on this page.
 
 getModuleStyles ( $filter=false, $position=null)
 Get the list of style-only modules to load on this page.
 
 getOutputFlag (string $name)
 
 getPageTitle ()
 Return the "page title", i.e.
 
 getPreventClickjacking ()
 Get the prevent-clickjacking flag.
 
 getProperty ( $name)
 Get an additional output property.
 
 getRedirect ()
 Get the URL to redirect to, or an empty string if not redirect URL set.
 
 getResourceLoader ()
 Get a ResourceLoader object associated with this OutputPage.
 
 getRevisionId ()
 Get the displayed revision ID.
 
 getRevisionTimestamp ()
 Get the timestamp of displayed revision.
 
 getRlClient ()
 Call this to freeze the module queue and JS config and create a formatter.
 
 getRobotPolicy ()
 Get the current robot policy for the page as a string in the form <index policy>,<follow policy>.
 
 getSubtitle ()
 
 getSyndicationLinks ()
 Return URLs for each supported syndication format for this page.
 
 getTarget ()
 
 getTemplateIds ()
 Get the templates used on this page.
 
 getTOCData ()
 
 getUnprefixedDisplayTitle ()
 Returns page display title without namespace prefix if possible.
 
 getVaryHeader ()
 Return a Vary: header on which to vary caches.
 
 hasHeadItem ( $name)
 Check if the header item $name is already set.
 
 haveCacheVaryCookies ()
 Check if the request has a cache-varying cookie header If it does, it's very important that we don't allow public caching.
 
 headElement (Skin $sk, $includeStyle=true)
 
 isArticle ()
 Return whether the content displayed page is related to the source of the corresponding article on the wiki.
 
 isArticleRelated ()
 Return whether this page is related an article on the wiki.
 
 isDisabled ()
 Return whether the output will be completely disabled.
 
 isPrintable ()
 Return whether the page is "printable".
 
 isRevisionCurrent ()
 Whether the revision displayed is the latest revision of the page.
 
 isSyndicated ()
 Should we output feed links for this page?
 
 isTOCEnabled ()
 Whether the output has a table of contents when the ToC is rendered inline.
 
 loadSkinModules ( $sk)
 Transfer styles and JavaScript modules from skin.
 
 lowerCdnMaxage ( $maxage)
 Set the value of the "s-maxage" part of the "Cache-control" HTTP header to $maxage if that is lower than the current s-maxage.
 
 makeResourceLoaderLink ( $modules, $only, array $extraQuery=[])
 Explicitly load or embed modules on a page.
 
 output ( $return=false)
 Finally, all the text has been munged and accumulated into the object, let's actually output it:
 
 parseAsContent ( $text, $linestart=true)
 Parse wikitext in the page content language and return the HTML.
 
 parseAsInterface ( $text, $linestart=true)
 Parse wikitext in the user interface language and return the HTML.
 
 parseInlineAsInterface ( $text, $linestart=true)
 Parse wikitext in the user interface language, strip paragraph wrapper, and return the HTML.
 
 parserOptions ()
 Get/set the ParserOptions object to use for wikitext parsing.
 
 prepareErrorPage ( $pageTitle=null, $htmlTitle=false)
 Prepare this object to display an error page; disable caching and indexing, clear the current text and redirect, set the page's title and optionally a custom HTML title (content of the "<title>" tag).
 
 prependHTML ( $text)
 Prepend $text to the body HTML.
 
 redirect ( $url, $responsecode='302')
 Redirect to $url rather than displaying the normal page.
 
 reduceAllowedModules ( $type, $level)
 Limit the highest level of CSS/JS untrustworthiness allowed.
 
 returnToMain ( $unused=null, $returnto=null, $returntoquery=null)
 Add a "return to" link pointing to a specified title, or the title indicated in the request, or else the main page.
 
 sendCacheControl ()
 Send cache control HTTP headers.
 
 setArticleBodyOnly ( $only)
 Set whether the output should only contain the body of the article, without any skin, sidebar, etc.
 
 setArticleFlag ( $newVal)
 Set whether the displayed content is related to the source of the corresponding article on the wiki Setting true will cause the change "article related" toggle to true.
 
 setArticleRelated ( $newVal)
 Set whether this page is related an article on the wiki Setting false will cause the change of "article flag" toggle to false.
 
 setCanonicalUrl ( $url)
 Set the URL to be used for the <link rel=canonical>>.
 
 setCategoryLinks (array $categories)
 Reset the category links (but not the category list) and add $categories.
 
 setCdnMaxage ( $maxage)
 Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
 
 setContentLangForJS (Bcp47Code $lang)
 
 setCopyright ( $hasCopyright)
 Set whether the standard copyright should be shown for the current page.
 
 setCopyrightUrl ( $url)
 Set the copyright URL to send with the output.
 
 setCspOutputMode (string $mode)
 Sets the output mechanism for content security policies (HTTP headers or meta tags).
 
 setDisplayTitle ( $html)
 Same as page title but only contains name of the page, not any other text.
 
 setFeedAppendQuery ( $val)
 Add default feeds to the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version.
 
 setFileVersion ( $file)
 Set the displayed file version.
 
 setFollowPolicy ( $policy)
 Set the follow policy for the page, but leave the index policy un- touched.
 
 setHTMLTitle ( $name)
 "HTML title" means the contents of "<title>".
 
 setIndexPolicy ( $policy)
 Set the index policy for the page, but leave the follow policy un- touched.
 
 setIndicators (array $indicators)
 Add an array of indicators, with their identifiers as array keys and HTML contents as values.
 
 setLanguageLinks (array $newLinkArray)
 Reset the language links and add new language links.
 
 setLastModified ( $timestamp)
 Override the last modified timestamp.
 
 setPageTitle ( $name)
 "Page title" means the contents of \<h1\>.
 
 setPageTitleMsg (Message $msg)
 "Page title" means the contents of \<h1\>.
 
 setPreventClickjacking (bool $enable)
 Set the prevent-clickjacking flag.
 
 setPrintable ()
 Set the page as printable, i.e.
 
 setProperty ( $name, $value)
 Set an additional output property.
 
 setRedirectedFrom (PageReference $t)
 Set $mRedirectedFrom, the page which redirected us to the current page.
 
 setRevisionId ( $revid)
 Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISIONID}} variable use.
 
 setRevisionIsCurrent (bool $isCurrent)
 Set whether the revision displayed (as set in ::setRevisionId()) is the latest revision of the page.
 
 setRevisionTimestamp ( $timestamp)
 Set the timestamp of the revision which will be displayed.
 
 setRobotPolicy ( $policy)
 Set the robot policy for the page: http://www.robotstxt.org/meta.html
 
 setRobotsOptions (array $options=[])
 Set the robots policy with options for the page.
 
 setStatusCode ( $statusCode)
 Set the HTTP status code to send with the output.
 
 setSubtitle ( $str)
 Replace the subtitle with $str.
 
 setSyndicated ( $show=true)
 Add or remove feed links in the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version.
 
 setTitle (PageReference $t)
 Set the Title object to use.
 
 setTOCData (TOCData $tocData)
 Adds Table of Contents data to OutputPage from ParserOutput.
 
 showErrorPage ( $title, $msg, $params=[], $returnto=null, $returntoquery=null)
 Output a standard error page.
 
 showFatalError ( $message)
 Output an error page.
 
 showLagWarning ( $lag)
 Show a warning about replica DB lag.
 
 showNewSectionLink ()
 Show an "add new section" link?
 
 showPendingTakeover ( $fallbackUrl, $msg,... $params)
 Output a standard "wait for takeover" warning.
 
 showPermissionsErrorPage (array $errors, $action=null)
 Output a standard permission error page.
 
 showsCopyright ()
 Return whether the standard copyright should be shown for the current page.
 
 tailElement ( $skin)
 The final bits that go to the bottom of a page HTML document including the closing tags.
 
 userCanPreview ()
 To make it harder for someone to slip a user a fake JavaScript or CSS preview, a random token is associated with the login session.
 
 versionRequired ( $version)
 Display an error page indicating that a given version of MediaWiki is required to use it.
 
 wrapWikiMsg ( $wrap,... $msgSpecs)
 This function takes a number of message/argument specifications, wraps them in some overall structure, and then parses the result and adds it to the output.
 
 wrapWikiTextAsInterface ( $wrapperClass, $text)
 Convert wikitext in the user interface language to HTML and add it to the buffer with a <div class="$wrapperClass"> wrapper.
 
- Public Member Functions inherited from MediaWiki\Context\ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getActionName ()
 Get the action name for the current web request.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getLanguageCode ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static buildBacklinkSubtitle (PageReference $page, $query=[])
 Build message object for a subtitle containing a backlink to a page.
 
static resetOOUI ()
 Notify of a change in global skin or language which would necessitate reinitialization of OOUI global static data.
 
static setupOOUI ( $skinName=null, $dir=null)
 Helper function to setup the PHP implementation of OOUI to use in this request.
 
static transformCssMedia ( $media)
 Transform "media" attribute based on request parameters.
 
static transformFilePath ( $remotePathPrefix, $localPath, $file)
 Utility method for transformResourceFilePath().
 
static transformResourcePath (Config $config, $path)
 Transform path to web-accessible static resource.
 

Public Attributes

string $mBodytext = ''
 Contains all of the "<body>" content.
 
bool $mNoGallery = false
 Comes from the parser.
 
string $mRedirect = ''
 
string $mRedirectCode = ''
 
const CSP_HEADERS = 'headers'
 Output CSP policies as headers.
 
const CSP_META = 'meta'
 Output CSP policies as meta tags.
 

Protected Member Functions

 addCategoryLinksToLBAndGetResult (array $categories)
 
 buildExemptModules ()
 Build exempt modules and legacy non-ResourceLoader styles.
 
 filterModules (array $modules, $position=null, $type=RL\Module::TYPE_COMBINED)
 Filter an array of modules to remove insufficiently trustworthy members, and modules which are no longer registered (eg a page is cached before an extension is disabled)
 
 getAdvertisedFeedTypes ()
 Return effective list of advertised feed types.
 
 styleLink ( $style, array $options)
 Generate \<link\> tags for stylesheets.
 

Static Protected Member Functions

static combineWrappedStrings (array $chunks)
 Combine WrappedString chunks and filter out empty ones.
 

Protected Attributes

array $mAdditionalBodyClasses = []
 Additional <body> classes; there are also <body> classes from other sources.
 
array $mAdditionalHtmlClasses = []
 Additional <html> classes; This should be rarely modified; prefer mAdditionalBodyClasses.
 
array $mAllowedModules
 What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
 
string false $mCanonicalUrl = false
 
string[][] $mCategories
 
string[][] $mCategoryLinks = []
 
int $mCdnMaxage = 0
 Cache stuff.
 
int $mCdnMaxageLimit = INF
 Upper limit on mCdnMaxage.
 
bool $mDoNothing = false
 Whether output is disabled.
 
bool $mEnableClientCache = true
 Set to false to send no-cache headers, disabling client-side caching.
 
 $mFeedLinksAppendQuery = null
 
array $mFileVersion = null
 
string[] $mHeadItems = []
 Array of elements in "<head>".
 
bool $mHideNewSectionLink = false
 
array $mImageTimeKeys = []
 
string[] $mIndicators = []
 
string $mInlineStyles = ''
 Inline CSS styles.
 
array $mJsConfigVars = []
 
string $mLastModified = ''
 Used for sending cache control.
 
array $mLinktags = []
 
string[][] $mMetatags = []
 Should be private.
 
array $mModules = []
 
array $mModuleStyles = []
 
bool $mNewSectionLink = false
 
ParserOptions $mParserOptions = null
 lazy initialised, use parserOptions()
 
bool $mPreventClickjacking = true
 Controls if anti-clickjacking / frame-breaking headers will be sent.
 
ResourceLoader $mResourceLoader
 
int $mStatusCode
 
array< int, array< string, int > > $mTemplateIds = []
 
array $styles = []
 An array of stylesheet filenames (relative from skins path), with options for CSS media, IE conditions, and RTL/LTR direction.
 

Detailed Description

This is one of the Core classes and should be read at least once by any new developers.

Also documented at https://www.mediawiki.org/wiki/Manual:Architectural_modules/OutputPage

This class is used to prepare the final rendering. A skin is then applied to the output parameters (links, javascript, html, categories ...).

Todo
FIXME: Another class handles sending the whole page to the client.

Some comments comes from a pairing session between Zak Greant and Antoine Musso in November 2010.

Todo
document

Definition at line 96 of file OutputPage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Output\OutputPage::__construct ( IContextSource $context)

Constructor for OutputPage.

This should not be called directly. Instead a new RequestContext should be created and it will implicitly create a OutputPage tied to that context.

Parameters
IContextSource$context

Definition at line 465 of file OutputPage.php.

References MediaWiki\Context\IContextSource\getConfig(), MediaWiki\Context\IContextSource\getRequest(), and MediaWiki\Context\ContextSource\setContext().

Member Function Documentation

◆ adaptCdnTTL()

MediaWiki\Output\OutputPage::adaptCdnTTL ( $mtime,
$minTTL = 0,
$maxTTL = 0 )

Get TTL in [$minTTL,$maxTTL] and pass it to lowerCdnMaxage()

This sets and returns $minTTL if $mtime is false or null. Otherwise, the TTL is higher the older the $mtime timestamp is. Essentially, the TTL is 90% of the age of the object, subject to the min and max.

Parameters
string | int | float | bool | null$mtimeLast-Modified timestamp
int$minTTLMinimum TTL in seconds [default: 1 minute]
int$maxTTLMaximum TTL in seconds [default: $wgCdnMaxAge]
Since
1.28

Definition at line 2552 of file OutputPage.php.

References wfTimestamp().

◆ addBacklinkSubtitle()

MediaWiki\Output\OutputPage::addBacklinkSubtitle ( PageReference $title,
$query = [] )

Add a subtitle containing a backlink to a page.

Parameters
PageReference$titleTitle to link to
array$queryArray of additional parameters to include in the link

Definition at line 1309 of file OutputPage.php.

◆ addBodyClasses()

MediaWiki\Output\OutputPage::addBodyClasses ( $classes)

Add a class to the <body> element.

Since
1.30
Parameters
string | string[]$classesOne or more classes to add

Definition at line 792 of file OutputPage.php.

Referenced by Article\showDiffPage().

◆ addCategoryLinks()

MediaWiki\Output\OutputPage::addCategoryLinks ( array $categories)

Add an array of categories, with names in the keys.

Parameters
array$categoriesMapping category name => sort key

Definition at line 1568 of file OutputPage.php.

References NS_CATEGORY.

◆ addCategoryLinksToLBAndGetResult()

MediaWiki\Output\OutputPage::addCategoryLinksToLBAndGetResult ( array $categories)
protected
Parameters
array$categories
Returns
IResultWrapper

Definition at line 1626 of file OutputPage.php.

References NS_CATEGORY.

◆ addContentOverride()

MediaWiki\Output\OutputPage::addContentOverride ( $target,
Content $content )

Force the given Content object for the given page, for things like page preview.

See also
self::addContentOverrideCallback()
Since
1.32
Parameters
LinkTarget | PageReference$target
Content$content

Definition at line 704 of file OutputPage.php.

References MediaWiki\Output\OutputPage\addContentOverrideCallback().

◆ addContentOverrideCallback()

MediaWiki\Output\OutputPage::addContentOverrideCallback ( callable $callback)

Add a callback for mapping from a Title to a Content object, for things like page preview.

See also
RL\Context::getContentOverrideCallback()
Since
1.32
Parameters
callable$callback

Definition at line 724 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\addContentOverride().

◆ addElement()

MediaWiki\Output\OutputPage::addElement ( $element,
array $attribs = [],
$contents = '' )

Shortcut for adding an Html::element via addHTML.

Since
1.19
Parameters
string$element
array$attribs
string$contents

Definition at line 1863 of file OutputPage.php.

◆ addFeedLink()

MediaWiki\Output\OutputPage::addFeedLink ( $format,
$href )

Add a feed link to the page header.

Parameters
string$formatFeed type, should be a key of $wgFeedClasses
string$hrefURL

Definition at line 1435 of file OutputPage.php.

◆ addHeadItem()

MediaWiki\Output\OutputPage::addHeadItem ( $name,
$value )

Add or replace a head item to the output.

Whenever possible, use more specific options like ResourceLoader modules, OutputPage::addLink(), OutputPage::addMeta() and OutputPage::addFeedLink() Fallback options for those are: OutputPage::addStyle, OutputPage::addScript(), OutputPage::addInlineScript() and OutputPage::addInlineStyle() This would be your very LAST fallback.

Parameters
string$nameItem name
string$valueRaw HTML

Definition at line 761 of file OutputPage.php.

◆ addHeadItems()

MediaWiki\Output\OutputPage::addHeadItems ( $values)

Add one or more head items to the output.

Since
1.28
Parameters
string | string[]$valuesRaw HTML

Definition at line 772 of file OutputPage.php.

◆ addHelpLink()

MediaWiki\Output\OutputPage::addHelpLink ( $to,
$overrideBaseUrl = false )

Adds help link with an icon via page indicators.

Link target can be overridden by a local message containing a wikilink: the message key is: lowercase action or special page name + '-helppage'.

Parameters
string$toTarget MediaWiki.org page title or encoded URL.
bool$overrideBaseUrlWhether $url is a full URL, to avoid MediaWiki.org.
Since
1.25

Definition at line 1753 of file OutputPage.php.

References wfUrlencode().

◆ addHTML()

MediaWiki\Output\OutputPage::addHTML ( $text)

Append $text to the body HTML.

Parameters
string$textHTML

Definition at line 1850 of file OutputPage.php.

Referenced by Article\showDeletedRevisionHeader(), Article\showDiffPage(), Article\showMissingArticle(), and Article\showPatrolFooter().

◆ addHtmlClasses()

MediaWiki\Output\OutputPage::addHtmlClasses ( $classes)

Add a class to the <html> element.

This should rarely be used. Instead use OutputPage::addBodyClasses() if possible.

Stability: unstable
Experimental since 1.35. Prefer OutputPage::addBodyClasses()
Parameters
string | string[]$classesOne or more classes to add

Definition at line 735 of file OutputPage.php.

◆ addInlineScript()

MediaWiki\Output\OutputPage::addInlineScript ( $script)

Add a self-contained script tag with the given contents Internal use only.

Use OutputPage::addModules() if possible.

Parameters
string$scriptJavaScript text, no script tags

Definition at line 609 of file OutputPage.php.

◆ addInlineStyle()

MediaWiki\Output\OutputPage::addInlineStyle ( $style_css,
$flip = 'noflip' )

Adds inline CSS styles Internal use only.

Use OutputPage::addModuleStyles() if possible.

Parameters
mixed$style_cssInline CSS
string$flipSet to 'flip' to flip the CSS if needed

Definition at line 4428 of file OutputPage.php.

◆ addJsConfigVars()

MediaWiki\Output\OutputPage::addJsConfigVars ( $keys,
$value = null )

Add one or more variables to be set in mw.config in JavaScript.

Parameters
string | array$keysKey or array of key/value pairs
mixed | null$value[optional] Value of the configuration variable

Definition at line 3734 of file OutputPage.php.

Referenced by Article\showRedirectedFromHeader().

◆ addLanguageLinks()

MediaWiki\Output\OutputPage::addLanguageLinks ( array $newLinkArray)

Add new language links.

Parameters
string[]$newLinkArrayArray of interwiki-prefixed (non DB key) titles (e.g. 'fr:Test page')

Definition at line 1540 of file OutputPage.php.

◆ addLink()

MediaWiki\Output\OutputPage::addLink ( array $linkarr)

Add a new \<link\> tag to the page header.

Note: use setCanonicalUrl() for rel=canonical.

Parameters
array$linkarrAssociative array of attributes.

Definition at line 544 of file OutputPage.php.

◆ addLinkHeader()

MediaWiki\Output\OutputPage::addLinkHeader ( $header)

Add an HTTP Link: header.

Parameters
string$headerHeader value

Definition at line 2687 of file OutputPage.php.

References $header.

◆ addMeta()

MediaWiki\Output\OutputPage::addMeta ( $name,
$val )

Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".

Parameters
string$nameName of the meta tag
string$valValue of the meta tag

Definition at line 523 of file OutputPage.php.

Referenced by Skin\initPage().

◆ addModules()

MediaWiki\Output\OutputPage::addModules ( $modules)

Load one or more ResourceLoader modules on this page.

Parameters
string | array$modulesModule name (string) or array of module names

Definition at line 660 of file OutputPage.php.

Referenced by MediaWiki\Html\ListToggle\__construct(), MWDebug\addModules(), Article\showPatrolFooter(), and Article\showRedirectedFromHeader().

◆ addModuleStyles()

MediaWiki\Output\OutputPage::addModuleStyles ( $modules)

Load the styles of one or more style-only ResourceLoader modules on this page.

Module styles added through this function will be loaded as a stylesheet, using a standard <link rel=stylesheet> HTML tag, rather than as a combined Javascript and CSS package. Thus, they will even load when JavaScript is disabled.

Parameters
string | array$modulesModule name (string) or array of module names

Definition at line 686 of file OutputPage.php.

Referenced by MediaWiki\Html\ListToggle\__construct(), Article\setOldSubtitle(), and Article\showPatrolFooter().

◆ addParserOutput()

MediaWiki\Output\OutputPage::addParserOutput ( ParserOutput $parserOutput,
$poOptions = [] )

Add everything from a ParserOutput object.

Parameters
ParserOutput$parserOutput
array$poOptionsOptions to ParserOutput::getText()

Definition at line 2410 of file OutputPage.php.

◆ addParserOutputContent()

MediaWiki\Output\OutputPage::addParserOutputContent ( ParserOutput $parserOutput,
$poOptions = [] )

Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput object, without any other metadata.

Since
1.24
Parameters
ParserOutput$parserOutput
array$poOptionsOptions to ParserOutput::getText()

Definition at line 2378 of file OutputPage.php.

References MediaWiki\Parser\ParserOutput\getJsConfigVars(), MediaWiki\Parser\ParserOutput\getModules(), and MediaWiki\Parser\ParserOutput\getModuleStyles().

◆ addParserOutputMetadata()

MediaWiki\Output\OutputPage::addParserOutputMetadata ( ParserOutput $parserOutput)

Add all metadata associated with a ParserOutput object, but without the actual HTML.

This includes categories, language links, ResourceLoader modules, effects of certain magic words, and so on. It does not include section information.

Since
1.24
Parameters
ParserOutput$parserOutput

Definition at line 2223 of file OutputPage.php.

References MediaWiki\Parser\ParserOutput\getAllFlags(), MediaWiki\Parser\ParserOutput\getCategoryMap(), MediaWiki\Parser\ParserOutput\getEnableOOUI(), MediaWiki\Parser\ParserOutput\getExtraCSPDefaultSrcs(), MediaWiki\Parser\ParserOutput\getExtraCSPScriptSrcs(), MediaWiki\Parser\ParserOutput\getExtraCSPStyleSrcs(), MediaWiki\Parser\ParserOutput\getFileSearchOptions(), MediaWiki\Parser\ParserOutput\getHeadItems(), MediaWiki\Parser\ParserOutput\getHideNewSection(), MediaWiki\Parser\ParserOutput\getImages(), MediaWiki\Parser\ParserOutput\getIndicators(), MediaWiki\Parser\ParserOutput\getJsConfigVars(), MediaWiki\Parser\ParserOutput\getLanguageLinks(), MediaWiki\Parser\ParserOutput\getLimitReportJSData(), MediaWiki\Parser\ParserOutput\getModules(), MediaWiki\Parser\ParserOutput\getModuleStyles(), MediaWiki\Parser\ParserOutput\getNewSection(), MediaWiki\Parser\ParserOutput\getNoGallery(), MediaWiki\Parser\ParserOutput\getOutputFlag(), MediaWiki\Parser\ParserOutput\getPreventClickjacking(), MediaWiki\Parser\ParserOutput\getTemplateIds(), getTitle(), MediaWiki\Parser\ParserOutput\getTOCData(), MediaWiki\Parser\ParserOutput\getWrapperDivClass(), and CacheTime\isCacheable().

◆ addParserOutputText()

MediaWiki\Output\OutputPage::addParserOutputText ( $text,
$poOptions = [] )

Add the HTML associated with a ParserOutput object, without any metadata.

Access: internal
For local use only
Parameters
string | ParserOutput$text
array$poOptionsOptions to ParserOutput::getText()

Definition at line 2395 of file OutputPage.php.

References wfDeprecated().

◆ addReturnTo()

MediaWiki\Output\OutputPage::addReturnTo ( $title,
array $query = [],
$text = null,
$options = [] )

Add a "return to" link pointing to a specified title.

Parameters
LinkTarget$titleTitle to link
array$queryQuery string parameters
string | null$textText of the link (input is not escaped)
array$optionsOptions array to pass to Linker

Definition at line 3298 of file OutputPage.php.

◆ addScript()

MediaWiki\Output\OutputPage::addScript ( $script)

Add raw HTML to the list of scripts (including \<script\> tag, etc.) Internal use only.

Use OutputPage::addModules() or OutputPage::addJsConfigVars() if possible.

Parameters
string$scriptRaw HTML

Definition at line 586 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\addScriptFile().

◆ addScriptFile()

MediaWiki\Output\OutputPage::addScriptFile ( $file,
$unused = null )

Add a JavaScript file to be loaded as <script> on this page.

Internal use only. Use OutputPage::addModules() if possible.

Parameters
string$fileURL to file (absolute path, protocol-relative, or full url)
string | null$unusedPreviously used to change the cache-busting query parameter

Definition at line 598 of file OutputPage.php.

References MediaWiki\Output\OutputPage\addScript().

◆ addStyle()

MediaWiki\Output\OutputPage::addStyle ( $style,
$media = '',
$condition = '',
$dir = '' )

Add a local or specified stylesheet, with the given media options.

Internal use only. Use OutputPage::addModuleStyles() if possible.

Parameters
string$styleURL to the file
string$mediaTo specify a media type, 'screen', 'printable', 'handheld' or any.
string$conditionFor IE conditional comments, specifying an IE version
string$dirSet to 'rtl' or 'ltr' for direction-specific sheets

Definition at line 4406 of file OutputPage.php.

◆ addSubtitle()

MediaWiki\Output\OutputPage::addSubtitle ( $str)

Add $str to the subtitle.

Parameters
string | Message$strString or Message to add to the subtitle. String should be safe HTML.

Definition at line 1271 of file OutputPage.php.

References getContext().

Referenced by Article\setOldSubtitle(), and Article\showRedirectedFromHeader().

◆ addTemplate()

MediaWiki\Output\OutputPage::addTemplate ( & $template)

Add the output of a QuickTemplate to the output buffer.

Parameters
\\QuickTemplate&$template

Definition at line 2421 of file OutputPage.php.

◆ addVaryHeader()

MediaWiki\Output\OutputPage::addVaryHeader ( $header)

Add an HTTP header that will have an influence on the cache.

Parameters
string$headerHeader name

Definition at line 2658 of file OutputPage.php.

References $header.

◆ addWikiMsg()

MediaWiki\Output\OutputPage::addWikiMsg ( $name,
$args )

Add a wikitext-formatted message to the output.

Parameters
string | MessageSpecifier$nameMessage key
mixed...$args Message parameters. Unlike wfMessage(), this method only accepts variadic parameters (they can't be passed as a single array parameter).

Definition at line 4673 of file OutputPage.php.

◆ addWikiMsgArray()

MediaWiki\Output\OutputPage::addWikiMsgArray ( $name,
$args )

Add a wikitext-formatted message to the output.

Parameters
string | MessageSpecifier$nameMessage key
array$argsMessage parameters. Unlike wfMessage(), this method only accepts the parameters as an array (they can't be passed as variadic parameters), or just a single parameter (this only works by accident, don't rely on it).

Definition at line 4685 of file OutputPage.php.

◆ addWikiTextAsContent()

MediaWiki\Output\OutputPage::addWikiTextAsContent ( $text,
$linestart = true,
PageReference $title = null )

Convert wikitext in the page content language to HTML and add it to the buffer.

The result with be language-converted to the user's preferred variant. Assumes that the current page title will be used if optional $title is not provided. Output will be tidy.

Parameters
string$textWikitext in the page content language
bool$linestartIs this the start of a line? (Defaults to true)
PageReference | null$titleOptional title to use; default of null means use current page title.
Since
1.32

Definition at line 2075 of file OutputPage.php.

References getTitle().

Referenced by Article\showMissingArticle().

◆ addWikiTextAsInterface()

MediaWiki\Output\OutputPage::addWikiTextAsInterface ( $text,
$linestart = true,
PageReference $title = null )

Convert wikitext in the user interface language to HTML and add it to the buffer.

The result will not be language-converted, as user interface messages are already localized into a specific variant. Assumes that the current page title will be used if optional $title is not provided. Output will be tidy.

Parameters
string$textWikitext in the user interface language
bool$linestartIs this the start of a line? (Defaults to true)
PageReference | null$titleOptional title to use; default of null means use current page title.
Since
1.32

Definition at line 2029 of file OutputPage.php.

References getTitle().

Referenced by Article\showMissingArticle().

◆ buildBacklinkSubtitle()

static MediaWiki\Output\OutputPage::buildBacklinkSubtitle ( PageReference $page,
$query = [] )
static

Build message object for a subtitle containing a backlink to a page.

Since
1.25
Parameters
PageReference$pageTitle to link to
array$queryArray of additional parameters to include in the link
Returns
Message

Definition at line 1287 of file OutputPage.php.

References MediaWiki\Page\PageReference\getNamespace(), NS_SPECIAL, and wfMessage().

◆ buildCssLinksArray()

MediaWiki\Output\OutputPage::buildCssLinksArray ( )
Returns
array

Definition at line 4496 of file OutputPage.php.

◆ buildExemptModules()

MediaWiki\Output\OutputPage::buildExemptModules ( )
protected

Build exempt modules and legacy non-ResourceLoader styles.

Returns
string|WrappedStringList HTML

Definition at line 4441 of file OutputPage.php.

◆ checkLastModified()

MediaWiki\Output\OutputPage::checkLastModified ( $timestamp)

checkLastModified tells the client to use the client-cached page if possible.

If successful, the OutputPage is disabled so that any future call to OutputPage->output() have no effect.

Side effect: sets mLastModified for Last-Modified header

Parameters
string$timestamp
Returns
bool True if cache-ok headers was sent.

Definition at line 849 of file OutputPage.php.

References MediaWiki\MainConfigNames\CacheEpoch, MediaWiki\MainConfigNames\CachePages, MediaWiki\MainConfigNames\CdnMaxAge, MediaWiki\Output\OutputPage\disable(), MediaWiki\Context\ContextSource\getConfig(), MediaWiki\Context\ContextSource\getRequest(), MediaWiki\Context\ContextSource\getUser(), MediaWiki\Output\OutputPage\sendCacheControl(), MediaWiki\MainConfigNames\UseCdn, wfDebug(), wfResetOutputBuffers(), and wfTimestamp().

◆ clearHTML()

MediaWiki\Output\OutputPage::clearHTML ( )

Clear the body HTML.

Definition at line 1870 of file OutputPage.php.

◆ clearSubtitle()

MediaWiki\Output\OutputPage::clearSubtitle ( )

Clear the subtitles.

Definition at line 1316 of file OutputPage.php.

◆ combineWrappedStrings()

static MediaWiki\Output\OutputPage::combineWrappedStrings ( array $chunks)
staticprotected

Combine WrappedString chunks and filter out empty ones.

Parameters
array$chunks
Returns
string|WrappedStringList HTML

Definition at line 3666 of file OutputPage.php.

◆ considerCacheSettingsFinal()

MediaWiki\Output\OutputPage::considerCacheSettingsFinal ( )

Set the expectation that cache control will not change after this point.

This should be called after the main processing logic has completed (e.g. Action::show or SpecialPage::execute), but may be called before Skin output has started (OutputPage::output).

Since
1.34

Definition at line 2611 of file OutputPage.php.

◆ couldBePublicCached()

MediaWiki\Output\OutputPage::couldBePublicCached ( )

Whether the output might become publicly cached.

Since
1.34
Returns
bool

Definition at line 2588 of file OutputPage.php.

◆ disable()

MediaWiki\Output\OutputPage::disable ( )

Disable output completely, i.e.

calling output() will have no effect

Definition at line 1347 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\checkLastModified().

◆ disableClientCache()

MediaWiki\Output\OutputPage::disableClientCache ( )

Force the page to send nocache headers.

Since
1.38

Definition at line 2578 of file OutputPage.php.

Referenced by SkinFallback\initPage().

◆ disallowUserJs()

MediaWiki\Output\OutputPage::disallowUserJs ( )

Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bundled with, or generated by, the software.

Site-wide styles are controlled by a config setting, since they can be used to create a custom skin/theme, but not user-specific ones.

Todo
this should be given a more accurate name

Definition at line 1788 of file OutputPage.php.

◆ enableClientCache()

MediaWiki\Output\OutputPage::enableClientCache ( )

Do not send nocache headers.

Definition at line 2570 of file OutputPage.php.

◆ enableOOUI()

MediaWiki\Output\OutputPage::enableOOUI ( )

Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaWiki and this OutputPage instance.

Since
1.25

Definition at line 4780 of file OutputPage.php.

◆ filterModules()

MediaWiki\Output\OutputPage::filterModules ( array $modules,
$position = null,
$type = RL\Module::TYPE_COMBINED )
protected

Filter an array of modules to remove insufficiently trustworthy members, and modules which are no longer registered (eg a page is cached before an extension is disabled)

Parameters
string[]$modules
string | null$positionUnused
string$type
Returns
string[]

Definition at line 621 of file OutputPage.php.

References MediaWiki\Output\OutputPage\getResourceLoader().

Referenced by MediaWiki\Output\OutputPage\getModules().

◆ forceHideNewSectionLink()

MediaWiki\Output\OutputPage::forceHideNewSectionLink ( )

Forcibly hide the new section link?

Returns
bool

Definition at line 1374 of file OutputPage.php.

◆ formatPermissionsErrorMessage()

MediaWiki\Output\OutputPage::formatPermissionsErrorMessage ( array $errors,
$action = null )

Format a list of error messages.

Deprecated
since 1.36. Use ::formatPermissionStatus instead
Parameters
array$errorsArray of arrays returned by PermissionManager::getPermissionErrors
string | null$actionAction that was denied or null if unknown
Returns
string The wikitext error-messages, formatted into a list.

Definition at line 3224 of file OutputPage.php.

◆ formatPermissionStatus()

MediaWiki\Output\OutputPage::formatPermissionStatus ( PermissionStatus $status,
string $action = null )

Format permission $status obtained from Authority for display.

Parameters
PermissionStatus$status
string | null$actionthat was denied or null if unknown
Returns
string

Definition at line 3208 of file OutputPage.php.

◆ getAdvertisedFeedTypes()

MediaWiki\Output\OutputPage::getAdvertisedFeedTypes ( )
protected

Return effective list of advertised feed types.

See also
addFeedLink()
Returns
string[] Array of feed type names ( 'rss', 'atom' )

Definition at line 1400 of file OutputPage.php.

◆ getAllowedModules()

MediaWiki\Output\OutputPage::getAllowedModules ( $type)

Show what level of JavaScript / CSS untrustworthiness is allowed on this page.

See also
RL\Module::$origin
Parameters
string$typeRL\Module TYPE_ constant
Returns
int Module ORIGIN_ class constant

Definition at line 1813 of file OutputPage.php.

◆ getArticleBodyOnly()

MediaWiki\Output\OutputPage::getArticleBodyOnly ( )

Return whether the output will contain only the body of the article.

Returns
bool

Definition at line 812 of file OutputPage.php.

◆ getBottomScripts()

MediaWiki\Output\OutputPage::getBottomScripts ( )

JS stuff to put at the bottom of the <body>.

These are legacy scripts ($this->mScripts), and user JS.

Returns
string|WrappedStringList HTML

Definition at line 3678 of file OutputPage.php.

References getRequest(), and wfHostname().

◆ getCacheVaryCookies()

MediaWiki\Output\OutputPage::getCacheVaryCookies ( )

Get the list of cookie names that will influence the cache.

Returns
array

Definition at line 2620 of file OutputPage.php.

◆ getCanonicalUrl()

MediaWiki\Output\OutputPage::getCanonicalUrl ( )

Returns the URL to be used for the <link rel=canonical>> if one is set.

Since
1.25
Returns
bool|string

Definition at line 574 of file OutputPage.php.

References MediaWiki\Output\OutputPage\$mCanonicalUrl.

◆ getCategories()

MediaWiki\Output\OutputPage::getCategories ( $type = 'all')

Get the list of category names this page belongs to.

Parameters
string$typeThe type of categories which should be returned. Possible values:
  • all: all categories of all types
  • hidden: only the hidden categories
  • normal: all categories, except hidden categories
Returns
string[]

Definition at line 1690 of file OutputPage.php.

◆ getCategoryLinks()

MediaWiki\Output\OutputPage::getCategoryLinks ( )

Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link, where $type is either "normal" or "hidden" (for hidden categories) and $link a HTML fragment with a link to the category page.

Returns
string[][]

Definition at line 1677 of file OutputPage.php.

◆ getCSP()

MediaWiki\Output\OutputPage::getCSP ( )

Get the ContentSecurityPolicy object.

Since
1.35
Returns
ContentSecurityPolicy

Definition at line 4811 of file OutputPage.php.

◆ getCSPNonce()

MediaWiki\Output\OutputPage::getCSPNonce ( )

Get (and set if not yet set) the CSP nonce.

This value needs to be included in any <script> tags on the page.

Returns
string|false Nonce or false to mean don't output nonce
Since
1.32
Deprecated
Since 1.35 use getCSP()->getNonce() instead

Definition at line 4800 of file OutputPage.php.

References wfDeprecated().

◆ getDisplayTitle()

MediaWiki\Output\OutputPage::getDisplayTitle ( )

Returns page display title.

Performs some normalization, but this not as strict the magic word.

Since
1.32
Returns
string HTML

Definition at line 1198 of file OutputPage.php.

References getTitle().

◆ getFeedAppendQuery()

MediaWiki\Output\OutputPage::getFeedAppendQuery ( )

Will currently always return null.

Returns
null

Definition at line 1462 of file OutputPage.php.

◆ getFileSearchOptions()

MediaWiki\Output\OutputPage::getFileSearchOptions ( )

Get the files used on this page.

Returns
array [ dbKey => [ 'time' => MW timestamp or null, 'sha1' => sha1 or '' ] ]
Since
1.18

Definition at line 2011 of file OutputPage.php.

◆ getFileVersion()

MediaWiki\Output\OutputPage::getFileVersion ( )

Get the displayed file version.

Returns
array|null ('time' => MW timestamp, 'sha1' => sha1)

Definition at line 1991 of file OutputPage.php.

◆ getFollowPolicy()

MediaWiki\Output\OutputPage::getFollowPolicy ( )

Get the current follow policy for the page as a string.

Returns
string

Definition at line 1076 of file OutputPage.php.

◆ getFrameOptions()

MediaWiki\Output\OutputPage::getFrameOptions ( )

Get the X-Frame-Options header value (without the name part), or false if there isn't one.

This is used by Skin to determine whether to enable JavaScript frame-breaking, for clients that don't support X-Frame-Options.

Returns
string|false

Definition at line 2763 of file OutputPage.php.

◆ getHeadItemsArray()

MediaWiki\Output\OutputPage::getHeadItemsArray ( )

Get an array of head items.

Returns
string[]

Definition at line 744 of file OutputPage.php.

References MediaWiki\Output\OutputPage\$mHeadItems.

◆ getHeadLinksArray()

MediaWiki\Output\OutputPage::getHeadLinksArray ( )
Returns
array Array in format "link name or number => 'link html'".

Definition at line 4006 of file OutputPage.php.

References $header, getAuthority(), getTitle(), MW_VERSION, PROTO_RELATIVE, wfAppendQuery(), and wfScript().

◆ getHTML()

MediaWiki\Output\OutputPage::getHTML ( )

Get the body HTML.

Returns
string HTML

Definition at line 1879 of file OutputPage.php.

◆ getHTMLTitle()

MediaWiki\Output\OutputPage::getHTMLTitle ( )

Return the "HTML title", i.e.

the content of the "<title>" tag.

Returns
string

Definition at line 1099 of file OutputPage.php.

Referenced by Skin\initPage().

◆ getIndexPolicy()

MediaWiki\Output\OutputPage::getIndexPolicy ( )

Get the current index policy for the page as a string.

Returns
string

Definition at line 1054 of file OutputPage.php.

◆ getIndicators()

MediaWiki\Output\OutputPage::getIndicators ( )

Get the indicators associated with this page.

The array will be internally ordered by item keys.

Returns
string[] Keys: identifiers, values: HTML contents
Since
1.25

Definition at line 1732 of file OutputPage.php.

◆ getJsConfigVars()

MediaWiki\Output\OutputPage::getJsConfigVars ( )

Get the javascript config vars to include on this page.

Returns
array Array of javascript config vars
Since
1.23

Definition at line 3724 of file OutputPage.php.

◆ getJSVars()

MediaWiki\Output\OutputPage::getJSVars ( ?int $flag = null)

Get an array containing the variables to be set in mw.config in JavaScript.

Do not add things here which can be evaluated in RL\StartUpModule, in other words, page-independent/site-wide variables (without state). These would add a blocking HTML cost to page rendering time, and require waiting for HTTP caches to expire before configuration changes take effect everywhere.

By default, these are loaded in the HTML head and block page rendering. Config variable names can be set in CORE_LATE_JS_CONFIG_VAR_NAMES, or for extensions via the 'LateJSConfigVarNames' attribute, to opt-in to being sent from the end of the HTML body instead, to improve page load time. In JavaScript, late variables should be accessed via mw.hook('wikipage.content').

Parameters
int | null$flagReturn only the specified kind of variables: self::JS_VAR_EARLY or self::JS_VAR_LATE. For internal use only.
Returns
array

Definition at line 3763 of file OutputPage.php.

References getAuthority(), getContext(), getRequest(), getTitle(), getUser(), NS_SPECIAL, and wfTimestamp().

◆ getLanguageLinks()

MediaWiki\Output\OutputPage::getLanguageLinks ( )

Get the list of language links.

Returns
string[] Array of interwiki-prefixed (non DB key) titles (e.g. 'fr:Test page')

Definition at line 1559 of file OutputPage.php.

◆ getLinkHeader()

MediaWiki\Output\OutputPage::getLinkHeader ( )

Return a Link: header.

Based on the values of $mLinkHeader.

Returns
string|false

Definition at line 2696 of file OutputPage.php.

◆ getLinkTags()

MediaWiki\Output\OutputPage::getLinkTags ( )

Returns the current <link> tags.

Since
1.25
Returns
array

Definition at line 554 of file OutputPage.php.

References MediaWiki\Output\OutputPage\$mLinktags.

◆ getMetaTags()

MediaWiki\Output\OutputPage::getMetaTags ( )

Returns the current <meta> tags.

Since
1.25
Returns
array

Definition at line 533 of file OutputPage.php.

References MediaWiki\Output\OutputPage\$mMetatags.

◆ getModules()

MediaWiki\Output\OutputPage::getModules ( $filter = false,
$position = null,
$param = 'mModules',
$type = RL\Module::TYPE_COMBINED )

Get the list of modules to include on this page.

Parameters
bool$filterWhether to filter out insufficiently trustworthy modules
string | null$positionUnused
string$param
string$type
Returns
string[] Array of module names

Definition at line 646 of file OutputPage.php.

References MediaWiki\Output\OutputPage\filterModules().

Referenced by MediaWiki\Output\OutputPage\getModuleStyles().

◆ getModuleStyles()

MediaWiki\Output\OutputPage::getModuleStyles ( $filter = false,
$position = null )

Get the list of style-only modules to load on this page.

Parameters
bool$filter
string | null$positionUnused
Returns
string[] Array of module names

Definition at line 671 of file OutputPage.php.

References MediaWiki\Output\OutputPage\getModules().

◆ getOutputFlag()

MediaWiki\Output\OutputPage::getOutputFlag ( string $name)
Access: internal
Will be replaced by direct access to ParserOutput::getOutputFlag()
Parameters
string$nameA flag name from ParserOutputFlags
Returns
bool

Definition at line 2134 of file OutputPage.php.

◆ getPageTitle()

MediaWiki\Output\OutputPage::getPageTitle ( )

Return the "page title", i.e.

the content of the \<h1\> tag.

Returns
string

Definition at line 1175 of file OutputPage.php.

◆ getPreventClickjacking()

MediaWiki\Output\OutputPage::getPreventClickjacking ( )

Get the prevent-clickjacking flag.

Since
1.24
Returns
bool

Definition at line 2752 of file OutputPage.php.

◆ getProperty()

MediaWiki\Output\OutputPage::getProperty ( $name)

Get an additional output property.

Since
1.21
Parameters
string$name
Returns
mixed Property value or null if not found

Definition at line 834 of file OutputPage.php.

◆ getRedirect()

MediaWiki\Output\OutputPage::getRedirect ( )

Get the URL to redirect to, or an empty string if not redirect URL set.

Returns
string

Definition at line 491 of file OutputPage.php.

References MediaWiki\Output\OutputPage\$mRedirect.

◆ getResourceLoader()

MediaWiki\Output\OutputPage::getResourceLoader ( )

Get a ResourceLoader object associated with this OutputPage.

Returns
ResourceLoader

Definition at line 3632 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\filterModules().

◆ getRevisionId()

MediaWiki\Output\OutputPage::getRevisionId ( )

Get the displayed revision ID.

Returns
int|null

Definition at line 1923 of file OutputPage.php.

◆ getRevisionTimestamp()

MediaWiki\Output\OutputPage::getRevisionTimestamp ( )

Get the timestamp of displayed revision.

This will be null if not filled by setRevisionTimestamp().

Returns
string|null

Definition at line 1968 of file OutputPage.php.

◆ getRlClient()

MediaWiki\Output\OutputPage::getRlClient ( )

Call this to freeze the module queue and JS config and create a formatter.

Depending on the Skin, this may get lazy-initialised in either headElement() or getBottomScripts(). See SkinTemplate::prepareQuickTemplate(). Calling this too early may cause unexpected side-effects since disallowUserJs() may be called at any time to change the module filters retroactively. Skins and extension hooks may also add modules until very late in the request lifecycle.

Returns
RL\ClientHtml

Definition at line 3441 of file OutputPage.php.

References getUser(), and MediaWiki\ResourceLoader\ClientHtml\setConfig().

◆ getRobotPolicy()

MediaWiki\Output\OutputPage::getRobotPolicy ( )

Get the current robot policy for the page as a string in the form <index policy>,<follow policy>.

Returns
string

Definition at line 980 of file OutputPage.php.

◆ getSubtitle()

MediaWiki\Output\OutputPage::getSubtitle ( )
Returns
string

Definition at line 1323 of file OutputPage.php.

◆ getSyndicationLinks()

MediaWiki\Output\OutputPage::getSyndicationLinks ( )

Return URLs for each supported syndication format for this page.

Returns
array Associating format keys with URLs

Definition at line 1453 of file OutputPage.php.

◆ getTarget()

MediaWiki\Output\OutputPage::getTarget ( )
Returns
null|string ResourceLoader target

Definition at line 693 of file OutputPage.php.

◆ getTemplateIds()

MediaWiki\Output\OutputPage::getTemplateIds ( )

Get the templates used on this page.

Returns
array<int,array<string,int>> (namespace => dbKey => revId)
Since
1.18

Definition at line 2001 of file OutputPage.php.

◆ getTOCData()

MediaWiki\Output\OutputPage::getTOCData ( )
Access: internal
For usage in Skin::getTOCData() only.
Returns
?TOCData Table of Contents data, or null if OutputPage::setTOCData() has not been called.

Definition at line 2124 of file OutputPage.php.

◆ getUnprefixedDisplayTitle()

MediaWiki\Output\OutputPage::getUnprefixedDisplayTitle ( )

Returns page display title without namespace prefix if possible.

This method is unreliable and best avoided. (T314399)

Since
1.32
Returns
string HTML

Definition at line 1215 of file OutputPage.php.

References $matches, and getTitle().

◆ getVaryHeader()

MediaWiki\Output\OutputPage::getVaryHeader ( )

Return a Vary: header on which to vary caches.

Based on the keys of $mVaryHeader, such as Accept-Encoding or Cookie

Returns
string

Definition at line 2670 of file OutputPage.php.

References $header.

◆ hasHeadItem()

MediaWiki\Output\OutputPage::hasHeadItem ( $name)

Check if the header item $name is already set.

Parameters
string$nameItem name
Returns
bool

Definition at line 782 of file OutputPage.php.

◆ haveCacheVaryCookies()

MediaWiki\Output\OutputPage::haveCacheVaryCookies ( )

Check if the request has a cache-varying cookie header If it does, it's very important that we don't allow public caching.

Returns
bool

Definition at line 2641 of file OutputPage.php.

References getRequest(), and wfDebug().

◆ headElement()

MediaWiki\Output\OutputPage::headElement ( Skin $sk,
$includeStyle = true )
Parameters
Skin$skThe given Skin
bool$includeStyleUnused
Returns
string The doctype, opening "<html>", and head element.

Definition at line 3536 of file OutputPage.php.

References getContext(), Skin\getHtmlElementAttributes(), Skin\getOptions(), Skin\getPageClasses(), Skin\getSkinName(), getTitle(), getUser(), Skin\isResponsive(), and wfDeprecated().

◆ isArticle()

MediaWiki\Output\OutputPage::isArticle ( )

Return whether the content displayed page is related to the source of the corresponding article on the wiki.

Returns
bool

Definition at line 1486 of file OutputPage.php.

◆ isArticleRelated()

MediaWiki\Output\OutputPage::isArticleRelated ( )

Return whether this page is related an article on the wiki.

Returns
bool

Definition at line 1508 of file OutputPage.php.

◆ isDisabled()

MediaWiki\Output\OutputPage::isDisabled ( )

Return whether the output will be completely disabled.

Returns
bool

Definition at line 1356 of file OutputPage.php.

◆ isPrintable()

MediaWiki\Output\OutputPage::isPrintable ( )

Return whether the page is "printable".

Returns
bool

Definition at line 1340 of file OutputPage.php.

◆ isRevisionCurrent()

MediaWiki\Output\OutputPage::isRevisionCurrent ( )

Whether the revision displayed is the latest revision of the page.

Since
1.34
Returns
bool

Definition at line 1943 of file OutputPage.php.

◆ isSyndicated()

MediaWiki\Output\OutputPage::isSyndicated ( )

Should we output feed links for this page?

Returns
bool

Definition at line 1445 of file OutputPage.php.

◆ isTOCEnabled()

MediaWiki\Output\OutputPage::isTOCEnabled ( )

Whether the output has a table of contents when the ToC is rendered inline.

Returns
bool
Since
1.22

Definition at line 4736 of file OutputPage.php.

◆ loadSkinModules()

MediaWiki\Output\OutputPage::loadSkinModules ( $sk)

Transfer styles and JavaScript modules from skin.

Parameters
Skin$skto load modules for

Definition at line 2874 of file OutputPage.php.

◆ lowerCdnMaxage()

MediaWiki\Output\OutputPage::lowerCdnMaxage ( $maxage)

Set the value of the "s-maxage" part of the "Cache-control" HTTP header to $maxage if that is lower than the current s-maxage.

Either way, $maxage is now an upper limit on s-maxage, so that future calls to setCdnMaxage() will no longer be able to raise the s-maxage above $maxage.

Parameters
int$maxageMaximum cache time on the CDN, in seconds
Since
1.27

Definition at line 2535 of file OutputPage.php.

◆ makeResourceLoaderLink()

MediaWiki\Output\OutputPage::makeResourceLoaderLink ( $modules,
$only,
array $extraQuery = [] )

Explicitly load or embed modules on a page.

Parameters
array | string$modulesOne or more module names
string$onlyRL\Module TYPE_ class constant
array$extraQuery[optional] Array with extra query parameters for the request
Returns
string|WrappedStringList HTML

Definition at line 3648 of file OutputPage.php.

◆ output()

MediaWiki\Output\OutputPage::output ( $return = false)

Finally, all the text has been munged and accumulated into the object, let's actually output it:

Parameters
bool$returnSet to true to get the result as a string rather than sending it
Returns
string|null

Definition at line 2893 of file OutputPage.php.

References getRequest(), PROTO_CURRENT, and wfTimestamp().

◆ parseAsContent()

MediaWiki\Output\OutputPage::parseAsContent ( $text,
$linestart = true )

Parse wikitext in the page content language and return the HTML.

The result will be language-converted to the user's preferred variant. Output will be tidy.

Parameters
string$textWikitext in the page content language
bool$linestartIs this the start of a line? (Defaults to true)
Returns
string HTML
Since
1.32

Definition at line 2435 of file OutputPage.php.

References getContext(), and getTitle().

◆ parseAsInterface()

MediaWiki\Output\OutputPage::parseAsInterface ( $text,
$linestart = true )

Parse wikitext in the user interface language and return the HTML.

The result will not be language-converted, as user interface messages are already localized into a specific variant. Output will be tidy.

Parameters
string$textWikitext in the user interface language
bool$linestartIs this the start of a line? (Defaults to true)
Returns
string HTML
Since
1.32

Definition at line 2457 of file OutputPage.php.

References getContext(), and getTitle().

◆ parseInlineAsInterface()

MediaWiki\Output\OutputPage::parseInlineAsInterface ( $text,
$linestart = true )

Parse wikitext in the user interface language, strip paragraph wrapper, and return the HTML.

The result will not be language-converted, as user interface messages are already localized into a specific variant. Output will be tidy. Outer paragraph wrapper will only be stripped if the result is a single paragraph.

Parameters
string$textWikitext in the user interface language
bool$linestartIs this the start of a line? (Defaults to true)
Returns
string HTML
Since
1.32

Definition at line 2481 of file OutputPage.php.

◆ parserOptions()

MediaWiki\Output\OutputPage::parserOptions ( )

Get/set the ParserOptions object to use for wikitext parsing.

Returns
ParserOptions

Definition at line 1888 of file OutputPage.php.

References getContext(), and getUser().

◆ prepareErrorPage()

MediaWiki\Output\OutputPage::prepareErrorPage ( $pageTitle = null,
$htmlTitle = false )

Prepare this object to display an error page; disable caching and indexing, clear the current text and redirect, set the page's title and optionally a custom HTML title (content of the "<title>" tag).

Parameters
string | Message | null$pageTitleWill be passed directly to setPageTitle()
string | Message | false$htmlTitleWill be passed directly to setHTMLTitle(); optional, if not passed the "<title>" attribute will be based on $pageTitle
Note
Explicitly passing $pageTitle or $htmlTitle has been deprecated since 1.41; use ::setPageTitleMsg() and ::setHTMLTitle() instead.

Definition at line 3042 of file OutputPage.php.

References wfDeprecated().

◆ prependHTML()

MediaWiki\Output\OutputPage::prependHTML ( $text)

Prepend $text to the body HTML.

Parameters
string$textHTML

Definition at line 1840 of file OutputPage.php.

◆ redirect()

MediaWiki\Output\OutputPage::redirect ( $url,
$responsecode = '302' )

Redirect to $url rather than displaying the normal page.

Parameters
string$url
string | int$responsecodeHTTP status code

Definition at line 480 of file OutputPage.php.

Referenced by MediaWiki\LinkedData\PageDataRequestHandler\httpContentNegotiation().

◆ reduceAllowedModules()

MediaWiki\Output\OutputPage::reduceAllowedModules ( $type,
$level )

Limit the highest level of CSS/JS untrustworthiness allowed.

If passed the same or a higher level than the current level of untrustworthiness set, the level will remain unchanged.

Parameters
string$type
int$levelRL\Module class constant

Definition at line 1830 of file OutputPage.php.

◆ resetOOUI()

static MediaWiki\Output\OutputPage::resetOOUI ( )
static

Notify of a change in global skin or language which would necessitate reinitialization of OOUI global static data.

Access: internal

Definition at line 4767 of file OutputPage.php.

◆ returnToMain()

MediaWiki\Output\OutputPage::returnToMain ( $unused = null,
$returnto = null,
$returntoquery = null )

Add a "return to" link pointing to a specified title, or the title indicated in the request, or else the main page.

Parameters
mixed | null$unused
PageReference | LinkTarget | string | null$returntoPage to return to
string | null$returntoqueryQuery string for the return to link

Definition at line 3314 of file OutputPage.php.

References getRequest(), and wfCgiToArray().

◆ sendCacheControl()

MediaWiki\Output\OutputPage::sendCacheControl ( )

Send cache control HTTP headers.

Definition at line 2807 of file OutputPage.php.

References getRequest(), and wfDebug().

Referenced by MediaWiki\Output\OutputPage\checkLastModified().

◆ setArticleBodyOnly()

MediaWiki\Output\OutputPage::setArticleBodyOnly ( $only)

Set whether the output should only contain the body of the article, without any skin, sidebar, etc.

Used e.g. when calling with "action=render".

Parameters
bool$onlyWhether to output only the body of the article

Definition at line 803 of file OutputPage.php.

◆ setArticleFlag()

MediaWiki\Output\OutputPage::setArticleFlag ( $newVal)

Set whether the displayed content is related to the source of the corresponding article on the wiki Setting true will cause the change "article related" toggle to true.

Parameters
bool$newVal

Definition at line 1473 of file OutputPage.php.

◆ setArticleRelated()

MediaWiki\Output\OutputPage::setArticleRelated ( $newVal)

Set whether this page is related an article on the wiki Setting false will cause the change of "article flag" toggle to false.

Parameters
bool$newVal

Definition at line 1496 of file OutputPage.php.

◆ setCanonicalUrl()

MediaWiki\Output\OutputPage::setCanonicalUrl ( $url)

Set the URL to be used for the <link rel=canonical>>.

This should be used in preference to addLink(), to avoid duplicate link tags.

Parameters
string$url

Definition at line 563 of file OutputPage.php.

Referenced by Article\showRedirectedFromHeader().

◆ setCategoryLinks()

MediaWiki\Output\OutputPage::setCategoryLinks ( array $categories)

Reset the category links (but not the category list) and add $categories.

Parameters
array$categoriesMapping category name => sort key

Definition at line 1663 of file OutputPage.php.

◆ setCdnMaxage()

MediaWiki\Output\OutputPage::setCdnMaxage ( $maxage)

Set the value of the "s-maxage" part of the "Cache-control" HTTP header.

Parameters
int$maxageMaximum cache time on the CDN, in seconds.

Definition at line 2522 of file OutputPage.php.

◆ setContentLangForJS()

MediaWiki\Output\OutputPage::setContentLangForJS ( Bcp47Code $lang)
Access: internal
For use by ViewAction/Article only
Since
1.42
Parameters
Bcp47Code$lang

Definition at line 2143 of file OutputPage.php.

◆ setCopyright()

MediaWiki\Output\OutputPage::setCopyright ( $hasCopyright)

Set whether the standard copyright should be shown for the current page.

Parameters
bool$hasCopyright

Definition at line 1517 of file OutputPage.php.

◆ setCopyrightUrl()

MediaWiki\Output\OutputPage::setCopyrightUrl ( $url)

Set the copyright URL to send with the output.

Empty string to omit, null to reset.

Since
1.26
Parameters
string | null$url

Definition at line 503 of file OutputPage.php.

◆ setCspOutputMode()

MediaWiki\Output\OutputPage::setCspOutputMode ( string $mode)

Sets the output mechanism for content security policies (HTTP headers or meta tags).

Defaults to HTTP headers; in most cases this should not be changed.

Meta mode should not be used together with setArticleBodyOnly() as meta tags and other headers are not output when that flag is set.

Parameters
string$modeOne of the CSP_* constants
Returns
void
See also
self::CSP_HEADERS
self::CSP_META

Definition at line 4828 of file OutputPage.php.

◆ setDisplayTitle()

MediaWiki\Output\OutputPage::setDisplayTitle ( $html)

Same as page title but only contains name of the page, not any other text.

Since
1.32
Parameters
string$htmlPage title text.
See also
OutputPage::setPageTitle

Definition at line 1186 of file OutputPage.php.

◆ setFeedAppendQuery()

MediaWiki\Output\OutputPage::setFeedAppendQuery ( $val)

Add default feeds to the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version.

See also
addFeedLink()
Parameters
string | false$valQuery to append to feed links or false to output default links

Definition at line 1417 of file OutputPage.php.

References getTitle().

◆ setFileVersion()

MediaWiki\Output\OutputPage::setFileVersion ( $file)

Set the displayed file version.

Parameters
File | null$file
Returns
mixed Previous value

Definition at line 1978 of file OutputPage.php.

References File\exists(), and wfSetVar().

◆ setFollowPolicy()

MediaWiki\Output\OutputPage::setFollowPolicy ( $policy)

Set the follow policy for the page, but leave the index policy un- touched.

Parameters
string$policyEither 'follow' or 'nofollow'.

Definition at line 1064 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\setRobotPolicy(), and Article\showMissingArticle().

◆ setHTMLTitle()

MediaWiki\Output\OutputPage::setHTMLTitle ( $name)

"HTML title" means the contents of "<title>".

It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.

Parameters
string | Message$name

Definition at line 1086 of file OutputPage.php.

References getContext().

◆ setIndexPolicy()

MediaWiki\Output\OutputPage::setIndexPolicy ( $policy)

Set the index policy for the page, but leave the follow policy un- touched.

Parameters
string$policyEither 'index' or 'noindex'.

Definition at line 1042 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\setRobotPolicy(), and Article\showMissingArticle().

◆ setIndicators()

MediaWiki\Output\OutputPage::setIndicators ( array $indicators)

Add an array of indicators, with their identifiers as array keys and HTML contents as values.

In case of duplicate keys, existing values are overwritten.

Note
External code which calls this method should ensure that any indicators sourced from parsed wikitext are wrapped with the appropriate class; see note in ::getIndicators().
Parameters
string[]$indicators
Since
1.25

Definition at line 1718 of file OutputPage.php.

◆ setLanguageLinks()

MediaWiki\Output\OutputPage::setLanguageLinks ( array $newLinkArray)

Reset the language links and add new language links.

Parameters
string[]$newLinkArrayArray of interwiki-prefixed (non DB key) titles (e.g. 'fr:Test page')

Definition at line 1550 of file OutputPage.php.

◆ setLastModified()

MediaWiki\Output\OutputPage::setLastModified ( $timestamp)

Override the last modified timestamp.

Parameters
string$timestampNew timestamp, in a format readable by wfTimestamp()

Definition at line 952 of file OutputPage.php.

References wfTimestamp().

◆ setPageTitle()

MediaWiki\Output\OutputPage::setPageTitle ( $name)

"Page title" means the contents of \<h1\>.

It is stored as a valid HTML fragment. This function allows good tags like \<sup\> in the \<h1\> tag, but not bad tags like \<script\>. This function automatically sets \<title\> to the same content as \<h1\> but with all tags removed. Bad tags that were escaped in \<h1\> will still be escaped in \<title\>, and good tags like \<i\> will be dropped entirely.

Parameters
string | Message$nameThe page title, either as HTML string or as a message which will be formatted with FORMAT_TEXT to yield HTML. Passing a Message is deprecated, since 1.41; please use ::setPageTitleMsg() for that case instead.

Phan-taint-check gets very confused by $name being either a string or a Message

Definition at line 1127 of file OutputPage.php.

References getContext().

◆ setPageTitleMsg()

MediaWiki\Output\OutputPage::setPageTitleMsg ( Message $msg)

"Page title" means the contents of \<h1\>.

This message takes a Message, which will be formatted with FORMAT_ESCAPED to yield HTML. Raw parameters to the message may contain some HTML tags; see ::setPageTitle() and Sanitizer::removeSomeTags() for details. This function automatically sets \<title\> to the same content as \<h1\> but with all tags removed. Bad tags from "raw" parameters that were escaped in \<h1\> will still be escaped in \<title\>, and good tags like \<i\> will be dropped entirely.

Parameters
Message$msgThe page title, as a message which will be formatted with FORMAT_ESCAPED to yield HTML.
Since
1.41

Definition at line 1151 of file OutputPage.php.

Referenced by Article\showDiffPage().

◆ setPreventClickjacking()

MediaWiki\Output\OutputPage::setPreventClickjacking ( bool $enable)

Set the prevent-clickjacking flag.

If true, will cause an X-Frame-Options header appropriate for edit pages to be sent. The header value is controlled by $wgEditPageFrameOptions. This is the default for special pages. If you display a CSRF-protected form on an ordinary view page, then you need to call this function.

Setting this flag to false will turn off frame-breaking. This can be called from pages which do not contain any CSRF-protected HTML form.

Parameters
bool$enableIf true, will cause an X-Frame-Options header appropriate for edit pages to be sent.
Since
1.38

Definition at line 2742 of file OutputPage.php.

Referenced by Article\showPatrolFooter().

◆ setPrintable()

MediaWiki\Output\OutputPage::setPrintable ( )

Set the page as printable, i.e.

it'll be displayed with all print styles included

Definition at line 1331 of file OutputPage.php.

◆ setProperty()

MediaWiki\Output\OutputPage::setProperty ( $name,
$value )

Set an additional output property.

Since
1.21
Parameters
string$name
mixed$value

Definition at line 823 of file OutputPage.php.

◆ setRedirectedFrom()

MediaWiki\Output\OutputPage::setRedirectedFrom ( PageReference $t)

Set $mRedirectedFrom, the page which redirected us to the current page.

Parameters
PageReference$t

Definition at line 1108 of file OutputPage.php.

Referenced by Article\showRedirectedFromHeader().

◆ setRevisionId()

MediaWiki\Output\OutputPage::setRevisionId ( $revid)

Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISIONID}} variable use.

Parameters
int | null$revidA positive integer, or null
Returns
mixed Previous value

Definition at line 1913 of file OutputPage.php.

References wfSetVar().

◆ setRevisionIsCurrent()

MediaWiki\Output\OutputPage::setRevisionIsCurrent ( bool $isCurrent)

Set whether the revision displayed (as set in ::setRevisionId()) is the latest revision of the page.

Parameters
bool$isCurrent

Definition at line 1933 of file OutputPage.php.

◆ setRevisionTimestamp()

MediaWiki\Output\OutputPage::setRevisionTimestamp ( $timestamp)

Set the timestamp of the revision which will be displayed.

This is used to avoid a extra DB call in SkinComponentFooter::lastModified().

Parameters
string | null$timestamp
Returns
mixed Previous value

Definition at line 1958 of file OutputPage.php.

References wfSetVar().

◆ setRobotPolicy()

MediaWiki\Output\OutputPage::setRobotPolicy ( $policy)

Set the robot policy for the page: http://www.robotstxt.org/meta.html

Parameters
string$policyThe literal string to output as the contents of the meta tag. Will be parsed according to the spec and output in standardized form.

Definition at line 963 of file OutputPage.php.

References MediaWiki\Output\OutputPage\setFollowPolicy(), and MediaWiki\Output\OutputPage\setIndexPolicy().

◆ setRobotsOptions()

MediaWiki\Output\OutputPage::setRobotsOptions ( array $options = [])

Set the robots policy with options for the page.

Since
1.38
Parameters
array$optionsAn array of key-value pairs or a string to populate the robots meta tag content attribute as a string.

Definition at line 1011 of file OutputPage.php.

◆ setStatusCode()

MediaWiki\Output\OutputPage::setStatusCode ( $statusCode)

Set the HTTP status code to send with the output.

Parameters
int$statusCode

Definition at line 512 of file OutputPage.php.

◆ setSubtitle()

MediaWiki\Output\OutputPage::setSubtitle ( $str)

Replace the subtitle with $str.

Parameters
string | Message$strNew value of the subtitle. String should be safe HTML.

Definition at line 1260 of file OutputPage.php.

◆ setSyndicated()

MediaWiki\Output\OutputPage::setSyndicated ( $show = true)

Add or remove feed links in the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version.

See also
addFeedLink()
Parameters
bool$showTrue: add default feeds, false: remove all feeds

Definition at line 1386 of file OutputPage.php.

◆ setTitle()

MediaWiki\Output\OutputPage::setTitle ( PageReference $t)

Set the Title object to use.

Parameters
PageReference$t

Definition at line 1247 of file OutputPage.php.

References getContext().

◆ setTOCData()

MediaWiki\Output\OutputPage::setTOCData ( TOCData $tocData)

Adds Table of Contents data to OutputPage from ParserOutput.

Parameters
TOCData$tocData
Access: internal
For use by Article.php

Definition at line 2115 of file OutputPage.php.

◆ setupOOUI()

static MediaWiki\Output\OutputPage::setupOOUI ( $skinName = null,
$dir = null )
static

Helper function to setup the PHP implementation of OOUI to use in this request.

Since
1.26
Parameters
string | null$skinNameIgnored since 1.41
string | null$dirIgnored since 1.41

Definition at line 4747 of file OutputPage.php.

◆ showErrorPage()

MediaWiki\Output\OutputPage::showErrorPage ( $title,
$msg,
$params = [],
$returnto = null,
$returntoquery = null )

Output a standard error page.

showErrorPage( 'titlemsg', 'pagetextmsg' ); showErrorPage( 'titlemsg', 'pagetextmsg', [ 'param1', 'param2' ] ); showErrorPage( 'titlemsg', $messageObject ); showErrorPage( $titleMessageObject, $messageObject );

Parameters
string | MessageSpecifier$titleMessage key (string) for page title, or a MessageSpecifier
string | MessageSpecifier$msgMessage key (string) for page text, or a MessageSpecifier
array$paramsMessage parameters; ignored if $msg is a Message object
PageReference | LinkTarget | string | null$returntoPage to show a return link to; defaults to the 'returnto' URL parameter
string | null$returntoqueryQuery string for the return to link; defaults to the 'returntoquery' URL parameter

Definition at line 3076 of file OutputPage.php.

References $params.

◆ showFatalError()

MediaWiki\Output\OutputPage::showFatalError ( $message)

Output an error page.

Note
FatalError exception class provides an alternative.
Parameters
string$messageError to output. Must be escaped for HTML.

Definition at line 3283 of file OutputPage.php.

◆ showLagWarning()

MediaWiki\Output\OutputPage::showLagWarning ( $lag)

Show a warning about replica DB lag.

If the lag is higher than $wgDatabaseReplicaLagCritical seconds, then the warning is a bit more obvious. If the lag is lower than $wgDatabaseReplicaLagWarning, then no warning is shown.

Parameters
int$lagReplica lag

Definition at line 3264 of file OutputPage.php.

◆ showNewSectionLink()

MediaWiki\Output\OutputPage::showNewSectionLink ( )

Show an "add new section" link?

Returns
bool

Definition at line 1365 of file OutputPage.php.

◆ showPendingTakeover()

MediaWiki\Output\OutputPage::showPendingTakeover ( $fallbackUrl,
$msg,
$params )

Output a standard "wait for takeover" warning.

This is useful for extensions which are hooking an action and suppressing its normal output so it can be taken over with JS.

showPendingTakeover( 'url', 'pagetextmsg' ); showPendingTakeover( 'url', 'pagetextmsg', [ 'param1', 'param2' ] ); showPendingTakeover( 'url', $messageObject );

Parameters
string$fallbackUrlURL to redirect to if the user doesn't have JavaScript or ResourceLoader available; this should ideally be to a page that provides similar functionality without requiring JavaScript
string | MessageSpecifier$msgMessage key (string) for page text, or a MessageSpecifier
mixed...$params Message parameters; ignored if $msg is a Message object

Definition at line 3354 of file OutputPage.php.

References $params.

◆ showPermissionsErrorPage()

MediaWiki\Output\OutputPage::showPermissionsErrorPage ( array $errors,
$action = null )

Output a standard permission error page.

Parameters
array$errorsError message keys or [key, param...] arrays
string | null$actionAction that was denied or null if unknown

Definition at line 3106 of file OutputPage.php.

References getAuthority(), getRequest(), getUser(), PROTO_RELATIVE, and wfArrayToCgi().

◆ showsCopyright()

MediaWiki\Output\OutputPage::showsCopyright ( )

Return whether the standard copyright should be shown for the current page.

By default, it is true for all articles but other pages can signal it by using setCopyright( true ).

Used by SkinTemplate to decided whether to show the copyright.

Returns
bool

Definition at line 1530 of file OutputPage.php.

◆ styleLink()

MediaWiki\Output\OutputPage::styleLink ( $style,
array $options )
protected

Generate \<link\> tags for stylesheets.

Parameters
string$styleURL to the file
array$optionsOption, can contain 'condition', 'dir', 'media' keys
Returns
string HTML fragment

Definition at line 4515 of file OutputPage.php.

◆ tailElement()

MediaWiki\Output\OutputPage::tailElement ( $skin)

The final bits that go to the bottom of a page HTML document including the closing tags.

Access: internal
Since
1.37
Parameters
Skin$skin
Returns
string

Definition at line 4841 of file OutputPage.php.

◆ transformCssMedia()

static MediaWiki\Output\OutputPage::transformCssMedia ( $media)
static

Transform "media" attribute based on request parameters.

Parameters
string$mediaCurrent value of the "media" attribute
Returns
string|null Modified value of the "media" attribute, or null to disable this stylesheet

Definition at line 4635 of file OutputPage.php.

References $wgRequest.

◆ transformFilePath()

static MediaWiki\Output\OutputPage::transformFilePath ( $remotePathPrefix,
$localPath,
$file )
static

Utility method for transformResourceFilePath().

Caller is responsible for ensuring the file exists. Emits a PHP warning otherwise.

Since
1.27
Parameters
string$remotePathPrefixURL path prefix that points to $localPath
string$localPathFile directory exposed at $remotePath
string$filePath to target file relative to $localPath
Returns
string URL

Definition at line 4613 of file OutputPage.php.

References wfLogWarning().

◆ transformResourcePath()

static MediaWiki\Output\OutputPage::transformResourcePath ( Config $config,
$path )
static

Transform path to web-accessible static resource.

This is used to add a validation hash as query string. This aids various behaviors:

  • Put long Cache-Control max-age headers on responses for improved cache performance.
  • Get the correct version of a file as expected by the current page.
  • Instantly get the updated version of a file after deployment.

Avoid using this for urls included in HTML as otherwise clients may get different versions of a resource when navigating the site depending on when the page was cached. If changes to the url propagate, this is not a problem (e.g. if the url is in an external stylesheet).

Since
1.27
Parameters
Config$config
string$pathPath-absolute URL to file (from document root, must start with "/")
Returns
string URL

Definition at line 4573 of file OutputPage.php.

References $path, and MediaWiki\Config\Config\get().

◆ userCanPreview()

MediaWiki\Output\OutputPage::userCanPreview ( )

To make it harder for someone to slip a user a fake JavaScript or CSS preview, a random token is associated with the login session.

If it's not passed back with the preview request, we won't render the code.

Returns
bool

Definition at line 3976 of file OutputPage.php.

References getAuthority(), getRequest(), getTitle(), and getUser().

◆ versionRequired()

MediaWiki\Output\OutputPage::versionRequired ( $version)

Display an error page indicating that a given version of MediaWiki is required to use it.

Parameters
mixed$versionThe version of MediaWiki needed to use the page

Definition at line 3191 of file OutputPage.php.

◆ wrapWikiMsg()

MediaWiki\Output\OutputPage::wrapWikiMsg ( $wrap,
$msgSpecs )

This function takes a number of message/argument specifications, wraps them in some overall structure, and then parses the result and adds it to the output.

In the $wrap, $1 is replaced with the first message, $2 with the second, and so on. The subsequent arguments may be either 1) strings, in which case they are message names, or 2) arrays, in which case, within each array, the first element is the message name, and subsequent elements are the parameters to that message.

Don't use this for messages that are not in the user's interface language.

For example:

$wgOut->wrapWikiMsg( "<div class='customclass'>\\n$1\\n</div>", 'some-msg-key' );

Is equivalent to:

$wgOut->addWikiTextAsInterface( "<div class='customclass'>\\n"
    . wfMessage( 'some-msg-key' )->plain() . "\\n</div>" );

The newline after the opening div is needed in some wikitext. See T21226.

Parameters
string$wrap
mixed...$msgSpecs

Definition at line 4715 of file OutputPage.php.

◆ wrapWikiTextAsInterface()

MediaWiki\Output\OutputPage::wrapWikiTextAsInterface ( $wrapperClass,
$text )

Convert wikitext in the user interface language to HTML and add it to the buffer with a <div class="$wrapperClass"> wrapper.

The result will not be language-converted, as user interface messages as already localized into a specific variant. The $text will be parsed in start-of-line context. Output will be tidy.

Parameters
string$wrapperClassThe class attribute value for the
wrapper in the output HTML
string$text
Wikitext in the user interface language
Since
1.32

Definition at line 2052 of file OutputPage.php.

References getTitle().

Member Data Documentation

◆ $mAdditionalBodyClasses

array MediaWiki\Output\OutputPage::$mAdditionalBodyClasses = []
protected

Additional <body> classes; there are also <body> classes from other sources.

Definition at line 242 of file OutputPage.php.

◆ $mAdditionalHtmlClasses

array MediaWiki\Output\OutputPage::$mAdditionalHtmlClasses = []
protected

Additional <html> classes; This should be rarely modified; prefer mAdditionalBodyClasses.

Definition at line 233 of file OutputPage.php.

◆ $mAllowedModules

array MediaWiki\Output\OutputPage::$mAllowedModules
protected
Initial value:
= [
RL\Module::TYPE_COMBINED => RL\Module::ORIGIN_ALL,
]

What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?

See also
RL\Module::$origin RL\Module::ORIGIN_ALL is assumed unless overridden;

Definition at line 293 of file OutputPage.php.

◆ $mBodytext

string MediaWiki\Output\OutputPage::$mBodytext = ''

Contains all of the "<body>" content.

Should be private we got set/get accessors and the append() method.

Definition at line 145 of file OutputPage.php.

◆ $mCanonicalUrl

string false MediaWiki\Output\OutputPage::$mCanonicalUrl = false
protected

Definition at line 122 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\getCanonicalUrl().

◆ $mCategories

string [][] MediaWiki\Output\OutputPage::$mCategories
protected
Initial value:
= [
'hidden' => [],
'normal' => [],
]
Deprecated
since 1.38, will be made private (T301020)

Definition at line 202 of file OutputPage.php.

◆ $mCategoryLinks

string [][] MediaWiki\Output\OutputPage::$mCategoryLinks = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 196 of file OutputPage.php.

◆ $mCdnMaxage

int MediaWiki\Output\OutputPage::$mCdnMaxage = 0
protected

Cache stuff.

Looks like mEnableClientCache

Definition at line 347 of file OutputPage.php.

◆ $mCdnMaxageLimit

int MediaWiki\Output\OutputPage::$mCdnMaxageLimit = INF
protected

Upper limit on mCdnMaxage.

Definition at line 349 of file OutputPage.php.

◆ $mDoNothing

bool MediaWiki\Output\OutputPage::$mDoNothing = false
protected

Whether output is disabled.

If this is true, the 'output' method will do nothing.

Definition at line 298 of file OutputPage.php.

◆ $mEnableClientCache

bool MediaWiki\Output\OutputPage::$mEnableClientCache = true
protected

Set to false to send no-cache headers, disabling client-side caching.

(This variable should really be named in the opposite sense; see ::disableClientCache().)

Deprecated
since 1.38; will be made private (T301020)

Definition at line 321 of file OutputPage.php.

◆ $mFeedLinksAppendQuery

MediaWiki\Output\OutputPage::$mFeedLinksAppendQuery = null
protected

Definition at line 286 of file OutputPage.php.

◆ $mFileVersion

array MediaWiki\Output\OutputPage::$mFileVersion = null
protected

Definition at line 368 of file OutputPage.php.

◆ $mHeadItems

string [] MediaWiki\Output\OutputPage::$mHeadItems = []
protected

Array of elements in "<head>".

Parser might add its own headers!

Deprecated
since 1.38; will be made private (T301020)

Definition at line 239 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\getHeadItemsArray().

◆ $mHideNewSectionLink

bool MediaWiki\Output\OutputPage::$mHideNewSectionLink = false
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 336 of file OutputPage.php.

◆ $mImageTimeKeys

array MediaWiki\Output\OutputPage::$mImageTimeKeys = []
protected

Definition at line 281 of file OutputPage.php.

◆ $mIndicators

string [] MediaWiki\Output\OutputPage::$mIndicators = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 211 of file OutputPage.php.

◆ $mInlineStyles

string MediaWiki\Output\OutputPage::$mInlineStyles = ''
protected

Inline CSS styles.

Use addInlineStyle() sparingly

Definition at line 227 of file OutputPage.php.

◆ $mJsConfigVars

array MediaWiki\Output\OutputPage::$mJsConfigVars = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 272 of file OutputPage.php.

◆ $mLastModified

string MediaWiki\Output\OutputPage::$mLastModified = ''
protected

Used for sending cache control.

The whole caching system should probably be moved into its own class.

Definition at line 190 of file OutputPage.php.

◆ $mLinktags

array MediaWiki\Output\OutputPage::$mLinktags = []
protected

Definition at line 119 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\getLinkTags().

◆ $mMetatags

string [][] MediaWiki\Output\OutputPage::$mMetatags = []
protected

Should be private.

Used with addMeta() which adds "<meta>"

Definition at line 116 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\getMetaTags().

◆ $mModules

array MediaWiki\Output\OutputPage::$mModules = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 248 of file OutputPage.php.

◆ $mModuleStyles

array MediaWiki\Output\OutputPage::$mModuleStyles = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 254 of file OutputPage.php.

◆ $mNewSectionLink

bool MediaWiki\Output\OutputPage::$mNewSectionLink = false
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 330 of file OutputPage.php.

◆ $mNoGallery

bool MediaWiki\Output\OutputPage::$mNoGallery = false

Comes from the parser.

This was probably made to load CSS/JS only if we had "<gallery>". Used directly in CategoryPage.php. Looks like ResourceLoader can replace this.

Deprecated
since 1.38; will be made private (T301020)

Definition at line 344 of file OutputPage.php.

◆ $mParserOptions

ParserOptions MediaWiki\Output\OutputPage::$mParserOptions = null
protected

lazy initialised, use parserOptions()

Definition at line 306 of file OutputPage.php.

◆ $mPreventClickjacking

bool MediaWiki\Output\OutputPage::$mPreventClickjacking = true
protected

Controls if anti-clickjacking / frame-breaking headers will be sent.

This should be done for pages where edit actions are possible. Setter: $this->setPreventClickjacking()

Definition at line 356 of file OutputPage.php.

◆ $mRedirect

string MediaWiki\Output\OutputPage::$mRedirect = ''

Definition at line 181 of file OutputPage.php.

Referenced by MediaWiki\Output\OutputPage\getRedirect().

◆ $mRedirectCode

string MediaWiki\Output\OutputPage::$mRedirectCode = ''

Definition at line 284 of file OutputPage.php.

◆ $mResourceLoader

ResourceLoader MediaWiki\Output\OutputPage::$mResourceLoader
protected

Definition at line 257 of file OutputPage.php.

◆ $mStatusCode

int MediaWiki\Output\OutputPage::$mStatusCode
protected

Definition at line 184 of file OutputPage.php.

◆ $mTemplateIds

array<int,array<string,int> > MediaWiki\Output\OutputPage::$mTemplateIds = []
protected
Deprecated
since 1.38; will be made private (T301020)

Definition at line 278 of file OutputPage.php.

◆ $styles

array MediaWiki\Output\OutputPage::$styles = []
protected

An array of stylesheet filenames (relative from skins path), with options for CSS media, IE conditions, and RTL/LTR direction.

For internal use; add settings in the skin via $this->addStyle()

Style again! This seems like a code duplication since we already have mStyles. This is what makes Open Source amazing.

Definition at line 378 of file OutputPage.php.

◆ CSP_HEADERS

const MediaWiki\Output\OutputPage::CSP_HEADERS = 'headers'

Output CSP policies as headers.

Definition at line 100 of file OutputPage.php.

◆ CSP_META

const MediaWiki\Output\OutputPage::CSP_META = 'meta'

Output CSP policies as meta tags.

Definition at line 102 of file OutputPage.php.


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