MediaWiki  master
OutputPage Class Reference

This class should be covered by a general architecture document which does not exist as of January 2011. More...

Inheritance diagram for OutputPage:
Collaboration diagram for OutputPage:

Public Member Functions

 __construct (IContextSource $context)
 Constructor for OutputPage. More...
 
 adaptCdnTTL ( $mtime, $minTTL=0, $maxTTL=0)
 Get TTL in [$minTTL,$maxTTL] in pass it to lowerCdnMaxage() More...
 
 addBacklinkSubtitle (Title $title, $query=[])
 Add a subtitle containing a backlink to a page. More...
 
 addBodyClasses ( $classes)
 Add a class to the <body> element. More...
 
 addCategoryLinks (array $categories)
 Add an array of categories, with names in the keys. More...
 
 addContentOverride (LinkTarget $target, Content $content)
 Add a mapping from a LinkTarget to a Content, for things like page preview. More...
 
 addContentOverrideCallback (callable $callback)
 Add a callback for mapping from a Title to a Content object, for things like page preview. More...
 
 addElement ( $element, array $attribs=[], $contents='')
 Shortcut for adding an Html::element via addHTML. More...
 
 addFeedLink ( $format, $href)
 Add a feed link to the page header. More...
 
 addHeadItem ( $name, $value)
 Add or replace a head item to the output. More...
 
 addHeadItems ( $values)
 Add one or more head items to the output. More...
 
 addHelpLink ( $to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators. More...
 
 addHTML ( $text)
 Append $text to the body HTML. More...
 
 addInlineScript ( $script)
 Add a self-contained script tag with the given contents Internal use only. More...
 
 addInlineStyle ( $style_css, $flip='noflip')
 Adds inline CSS styles Internal use only. More...
 
 addJsConfigVars ( $keys, $value=null)
 Add one or more variables to be set in mw.config in JavaScript. More...
 
 addLanguageLinks (array $newLinkArray)
 Add new language links. More...
 
 addLink (array $linkarr)
 Add a new \<link\> tag to the page header. More...
 
 addLinkHeader ( $header)
 Add an HTTP Link: header. More...
 
 addMeta ( $name, $val)
 Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:". More...
 
 addModules ( $modules)
 Load one or more ResourceLoader modules on this page. More...
 
 addModuleStyles ( $modules)
 Load the styles of one or more ResourceLoader modules on this page. More...
 
 addParserOutput (ParserOutput $parserOutput, $poOptions=[])
 Add everything from a ParserOutput object. More...
 
 addParserOutputContent (ParserOutput $parserOutput, $poOptions=[])
 Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput object, without any other metadata. More...
 
 addParserOutputMetadata (ParserOutput $parserOutput)
 Add all metadata associated with a ParserOutput object, but without the actual HTML. More...
 
 addParserOutputText (ParserOutput $parserOutput, $poOptions=[])
 Add the HTML associated with a ParserOutput object, without any metadata. More...
 
 addReturnTo ( $title, array $query=[], $text=null, $options=[])
 Add a "return to" link pointing to a specified title. More...
 
 addScript ( $script)
 Add raw HTML to the list of scripts (including \<script\> tag, etc.) Internal use only. More...
 
 addScriptFile ( $file, $unused=null)
 Add a JavaScript file to be loaded as <script> on this page. More...
 
 addStyle ( $style, $media='', $condition='', $dir='')
 Add a local or specified stylesheet, with the given media options. More...
 
 addSubtitle ( $str)
 Add $str to the subtitle. More...
 
 addTemplate (&$template)
 Add the output of a QuickTemplate to the output buffer. More...
 
 addVaryHeader ( $header, array $option=null)
 Add an HTTP header that will influence on the cache. More...
 
 addWikiMsg ()
 Add a wikitext-formatted message to the output. More...
 
 addWikiMsgArray ( $name, $args)
 Add a wikitext-formatted message to the output. More...
 
 addWikiText ( $text, $linestart=true, $interface=true)
 Convert wikitext to HTML and add it to the buffer Default assumes that the current page title will be used. More...
 
 addWikiTextAsContent ( $text, $linestart=true, Title $title=null)
 Convert wikitext in the page content language to HTML and add it to the buffer. More...
 
 addWikiTextAsInterface ( $text, $linestart=true, Title $title=null)
 Convert wikitext in the user interface language to HTML and add it to the buffer. More...
 
 addWikiTextTidy ( $text, $linestart=true)
 Add wikitext in content language. More...
 
 addWikiTextTitle ( $text, Title $title, $linestart, $tidy=false, $interface=false)
 Add wikitext with a custom Title object. More...
 
 addWikiTextTitleTidy ( $text, Title $title, $linestart=true)
 Add wikitext in content language with a custom Title object. More...
 
 addWikiTextWithTitle ( $text, Title $title, $linestart=true)
 Add wikitext with a custom Title object. More...
 
 allowClickjacking ()
 Turn off frame-breaking. More...
 
 buildCssLinksArray ()
 
 checkLastModified ( $timestamp)
 checkLastModified tells the client to use the client-cached page if possible. More...
 
 clearHTML ()
 Clear the body HTML. More...
 
 clearSubtitle ()
 Clear the subtitles. More...
 
 disable ()
 Disable output completely, i.e. More...
 
 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. More...
 
 enableClientCache ( $state)
 Use enableClientCache(false) to force it to send nocache headers. More...
 
 enableOOUI ()
 Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaWiki and this OutputPage instance. More...
 
 enableSectionEditLinks ( $flag=true)
 Enables/disables section edit links, doesn't override NOEDITSECTION More...
 
 forceHideNewSectionLink ()
 Forcibly hide the new section link? More...
 
 formatPermissionsErrorMessage (array $errors, $action=null)
 Format a list of error messages. More...
 
 getAllowedModules ( $type)
 Show what level of JavaScript / CSS untrustworthiness is allowed on this page. More...
 
 getArticleBodyOnly ()
 Return whether the output will contain only the body of the article. More...
 
 getBottomScripts ()
 JS stuff to put at the bottom of the <body>. More...
 
 getCacheVaryCookies ()
 Get the list of cookie names that will influence the cache. More...
 
 getCanonicalUrl ()
 Returns the URL to be used for the <link rel="canonical"> if one is set. More...
 
 getCategories ( $type='all')
 Get the list of category names this page belongs to. More...
 
 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. More...
 
 getCSPNonce ()
 Get (and set if not yet set) the CSP nonce. More...
 
 getDisplayTitle ()
 Returns page display title. More...
 
 getFeedAppendQuery ()
 Will currently always return null. More...
 
 getFileSearchOptions ()
 Get the files used on this page. More...
 
 getFileVersion ()
 Get the displayed file version. More...
 
 getFrameOptions ()
 Get the X-Frame-Options header value (without the name part), or false if there isn't one. More...
 
 getHeadItemsArray ()
 Get an array of head items. More...
 
 getHeadLinksArray ()
 
 getHTML ()
 Get the body HTML. More...
 
 getHTMLTitle ()
 Return the "HTML title", i.e. More...
 
 getIndicators ()
 Get the indicators associated with this page. More...
 
 getJsConfigVars ()
 Get the javascript config vars to include on this page. More...
 
 getJSVars ()
 Get an array containing the variables to be set in mw.config in JavaScript. More...
 
 getKeyHeader ()
 Get a complete Key header. More...
 
 getLanguageLinks ()
 Get the list of language links. More...
 
 getLinkHeader ()
 Return a Link: header. More...
 
 getLinkTags ()
 Returns the current <link> tags. More...
 
 getMetaTags ()
 Returns the current <meta> tags. More...
 
 getModules ( $filter=false, $position=null, $param='mModules', $type=ResourceLoaderModule::TYPE_COMBINED)
 Get the list of modules to include on this page. More...
 
 getModuleScripts ()
 
 getModuleStyles ( $filter=false, $position=null)
 Get the list of style-only modules to load on this page. More...
 
 getPageTitle ()
 Return the "page title", i.e. More...
 
 getPreventClickjacking ()
 Get the prevent-clickjacking flag. More...
 
 getProperty ( $name)
 Get an additional output property. More...
 
 getRedirect ()
 Get the URL to redirect to, or an empty string if not redirect URL set. More...
 
 getResourceLoader ()
 Get a ResourceLoader object associated with this OutputPage. More...
 
 getRevisionId ()
 Get the displayed revision ID. More...
 
 getRevisionTimestamp ()
 Get the timestamp of displayed revision. More...
 
 getRlClient ()
 Call this to freeze the module queue and JS config and create a formatter. More...
 
 getSubtitle ()
 Get the subtitle. More...
 
 getSyndicationLinks ()
 Return URLs for each supported syndication format for this page. More...
 
 getTarget ()
 
 getTemplateIds ()
 Get the templates used on this page. More...
 
 getUnprefixedDisplayTitle ()
 Returns page display title without namespace prefix if possible. More...
 
 getVaryHeader ()
 Return a Vary: header on which to vary caches. More...
 
 hasHeadItem ( $name)
 Check if the header item $name is already set. More...
 
 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. More...
 
 headElement (Skin $sk, $includeStyle=true)
 
 isArticle ()
 Return whether the content displayed page is related to the source of the corresponding article on the wiki. More...
 
 isArticleRelated ()
 Return whether this page is related an article on the wiki. More...
 
 isDisabled ()
 Return whether the output will be completely disabled. More...
 
 isPrintable ()
 Return whether the page is "printable". More...
 
 isSyndicated ()
 Should we output feed links for this page? More...
 
 isTOCEnabled ()
 Whether the output has a table of contents. More...
 
 loadSkinModules ( $sk)
 Transfer styles and JavaScript modules from skin. More...
 
 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. More...
 
 makeResourceLoaderLink ( $modules, $only, array $extraQuery=[])
 Explicily load or embed modules on a page. More...
 
 output ( $return=false)
 Finally, all the text has been munged and accumulated into the object, let's actually output it: More...
 
 parse ( $text, $linestart=true, $interface=false, $language=null)
 Parse wikitext and return the HTML. More...
 
 parseAsContent ( $text, $linestart=true)
 Parse wikitext in the page content language and return the HTML. More...
 
 parseAsInterface ( $text, $linestart=true)
 Parse wikitext in the user interface language and return the HTML. More...
 
 parseInline ( $text, $linestart=true, $interface=false)
 Parse wikitext, strip paragraph wrapper, and return the HTML. More...
 
 parseInlineAsInterface ( $text, $linestart=true)
 Parse wikitext in the user interface language, strip paragraph wrapper, and return the HTML. More...
 
 parserOptions ( $options=null)
 Get/set the ParserOptions object to use for wikitext parsing. More...
 
 prepareErrorPage ( $pageTitle, $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 an custom HTML title (content of the "<title>" tag). More...
 
 prependHTML ( $text)
 Prepend $text to the body HTML. More...
 
 preventClickjacking ( $enable=true)
 Set a flag which will cause an X-Frame-Options header appropriate for edit pages to be sent. More...
 
 redirect ( $url, $responsecode='302')
 Redirect to $url rather than displaying the normal page. More...
 
 reduceAllowedModules ( $type, $level)
 Limit the highest level of CSS/JS untrustworthiness allowed. More...
 
 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. More...
 
 sectionEditLinksEnabled ()
 
 sendCacheControl ()
 Send cache control HTTP headers. More...
 
 setArticleBodyOnly ( $only)
 Set whether the output should only contain the body of the article, without any skin, sidebar, etc. More...
 
 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. More...
 
 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. More...
 
 setCanonicalUrl ( $url)
 Set the URL to be used for the <link rel="canonical">. More...
 
 setCategoryLinks (array $categories)
 Reset the category links (but not the category list) and add $categories. More...
 
 setCdnMaxage ( $maxage)
 Set the value of the "s-maxage" part of the "Cache-control" HTTP header. More...
 
 setCopyright ( $hasCopyright)
 Set whether the standard copyright should be shown for the current page. More...
 
 setCopyrightUrl ( $url)
 Set the copyright URL to send with the output. More...
 
 setDisplayTitle ( $html)
 Same as page title but only contains name of the page, not any other text. More...
 
 setFeedAppendQuery ( $val)
 Add default feeds to the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version. More...
 
 setFileVersion ( $file)
 Set the displayed file version. More...
 
 setFollowPolicy ( $policy)
 Set the follow policy for the page, but leave the index policy un- touched. More...
 
 setHTMLTitle ( $name)
 "HTML title" means the contents of "<title>". More...
 
 setIndexPolicy ( $policy)
 Set the index policy for the page, but leave the follow policy un- touched. More...
 
 setIndicators (array $indicators)
 Add an array of indicators, with their identifiers as array keys and HTML contents as values. More...
 
 setLanguageLinks (array $newLinkArray)
 Reset the language links and add new language links. More...
 
 setLastModified ( $timestamp)
 Override the last modified timestamp. More...
 
 setPageTitle ( $name)
 "Page title" means the contents of \<h1\>. More...
 
 setPrintable ()
 Set the page as printable, i.e. More...
 
 setProperty ( $name, $value)
 Set an additional output property. More...
 
 setRedirectedFrom ( $t)
 Set $mRedirectedFrom, the Title of the page which redirected us to the current page. More...
 
 setRevisionId ( $revid)
 Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISIONID}} variable use. More...
 
 setRevisionTimestamp ( $timestamp)
 Set the timestamp of the revision which will be displayed. More...
 
 setRobotPolicy ( $policy)
 Set the robot policy for the page: http://www.robotstxt.org/meta.html More...
 
 setStatusCode ( $statusCode)
 Set the HTTP status code to send with the output. More...
 
 setSubtitle ( $str)
 Replace the subtitle with $str. More...
 
 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. More...
 
 setTarget ( $target)
 Sets ResourceLoader target for load.php links. More...
 
 setTitle (Title $t)
 Set the Title object to use. More...
 
 showErrorPage ( $title, $msg, $params=[])
 Output a standard error page. More...
 
 showFatalError ( $message)
 Output an error page. More...
 
 showFileCopyError ( $old, $new)
 
 showFileDeleteError ( $name)
 
 showFileNotFoundError ( $name)
 
 showFileRenameError ( $old, $new)
 
 showLagWarning ( $lag)
 Show a warning about replica DB lag. More...
 
 showNewSectionLink ()
 Show an "add new section" link? More...
 
 showPermissionsErrorPage (array $errors, $action=null)
 Output a standard permission error page. More...
 
 showsCopyright ()
 Return whether the standard copyright should be shown for the current page. More...
 
 showUnexpectedValueError ( $name, $val)
 
 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. More...
 
 versionRequired ( $version)
 Display an error page indicating that a given version of MediaWiki is required to use it. More...
 
 wrapWikiMsg ( $wrap)
 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. More...
 
 wrapWikiTextAsInterface ( $wrapperClass, $text)
 Convert wikitext in the user interface language to HTML and add it to the buffer with a <div class="$wrapperClass"> wrapper. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static buildBacklinkSubtitle (Title $title, $query=[])
 Build message object for a subtitle containing a backlink to a page. More...
 
static setupOOUI ( $skinName='default', $dir='ltr')
 Helper function to setup the PHP implementation of OOUI to use in this request. More...
 
static transformCssMedia ( $media)
 Transform "media" attribute based on request parameters. More...
 
static transformFilePath ( $remotePathPrefix, $localPath, $file)
 Utility method for transformResourceFilePath(). More...
 
static transformResourcePath (Config $config, $path)
 Transform path to web-accessible static resource. More...
 

Public Attributes

string $mBodytext = ''
 Contains all of the "<body>" content. More...
 
bool $mNoGallery = false
 Comes from the parser. More...
 
string $mPageLinkTitle = ''
 Used by skin template. More...
 
string $mRedirect = ''
 
string $mRedirectCode = ''
 

Protected Member Functions

 addCategoryLinksToLBAndGetResult (array $categories)
 
 buildExemptModules ()
 Build exempt modules and legacy non-ResourceLoader styles. More...
 
 filterModules (array $modules, $position=null, $type=ResourceLoaderModule::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) More...
 
 getAdvertisedFeedTypes ()
 Return effective list of advertised feed types. More...
 
 styleLink ( $style, array $options)
 Generate \<link\> tags for stylesheets. More...
 

Static Protected Member Functions

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

Protected Attributes

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

Private Member Functions

 addAcceptLanguage ()
 T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter in GET. More...
 
 addWikiTextTitleInternal ( $text, Title $title, $linestart, $tidy, $interface, $wrapperClass=null)
 Add wikitext with a custom Title object. More...
 
 feedLink ( $type, $url, $text)
 Generate a "<link rel/>" for a feed. More...
 
 getCdnCacheEpoch ( $reqTime, $maxAge)
 
 getFeaturePolicyReportOnly ()
 
 getOriginTrials ()
 Get the Origin-Trial header values. More...
 
 getReportTo ()
 
 getRlClientContext ()
 
 parseInternal ( $text, $title, $linestart, $tidy, $interface, $language)
 Parse wikitext and return the HTML (internal implementation helper) More...
 
 warnModuleTargetFilter ( $moduleName)
 

Private Attributes

callable [] $contentOverrideCallbacks = []
 
array $contentOverrides = []
 Map Title to Content. More...
 
string null $copyrightUrl
 The URL to send in a <link> element with rel=license. More...
 
string $CSPNonce
 The nonce for Content-Security-Policy. More...
 
string $displayTitle
 The displayed title of the page. More...
 
array $limitReportJSData = []
 Profiling data. More...
 
bool $mArticleBodyOnly = false
 Flag if output should only contain the body of the article. More...
 
bool $mEnableTOC = false
 Whether parser output contains a table of contents. More...
 
 $mFeedLinks = []
 Handles the Atom / RSS links. More...
 
 $mFollowPolicy = 'follow'
 
bool $mHasCopyright = false
 Is the content subject to copyright. More...
 
string $mHTMLtitle = ''
 Stores contents of "<title>" tag. More...
 
 $mIndexPolicy = 'index'
 
bool $mIsArticle = false
 Is the displayed content related to the source of the corresponding wiki article. More...
 
bool $mIsArticleRelated = true
 Stores "article flag" toggle. More...
 
array $mLanguageLinks = []
 Array of Interwiki Prefixed (non DB key) Titles (e.g. More...
 
 $mLinkHeader = []
 Link: header contents. More...
 
string $mPageTitle = ''
 The contents of. More...
 
bool $mPrintable = false
 We have to set isPrintable(). More...
 
 $mProperties = []
 Additional key => value data. More...
 
array Title $mRedirectedFrom = null
 If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redirect. More...
 
int $mRevisionId = null
 To include the variable {{REVISIONID}}. More...
 
string $mRevisionTimestamp = null
 
 $mScripts = ''
 Used for JavaScript (predates ResourceLoader) More...
 
array $mSubtitle = []
 Contains the page subtitle. More...
 
string null $mTarget = null
 ResourceLoader target for load.php links. More...
 
array $mVaryHeader
 Headers that cause the cache to vary. More...
 
ResourceLoaderClientHtml $rlClient
 
ResourceLoaderContext $rlClientContext
 
array $rlExemptStyleModules
 

Static Private Attributes

static array $cacheVaryCookies = null
 A cache of the names of the cookies that will influence the cache. More...
 

Detailed Description

This class should be covered by a general architecture document which does not exist as of January 2011.

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

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 46 of file OutputPage.php.

Constructor & Destructor Documentation

◆ __construct()

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 333 of file OutputPage.php.

References ContextSource\setContext().

Member Function Documentation

◆ adaptCdnTTL()

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

Get TTL in [$minTTL,$maxTTL] in 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: $wgSquidMaxage]
Since
1.28

Definition at line 2263 of file OutputPage.php.

References ContextSource\getConfig(), lowerCdnMaxage(), null, IExpiringStore\TTL_MINUTE, and wfTimestamp().

◆ addAcceptLanguage()

OutputPage::addAcceptLanguage ( )
private

T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter in GET.

For example: /w/index.php?title=Main_page will vary based on Accept-Language; but /w/index.php?title=Main_page&variant=zh-cn will not.

Definition at line 2428 of file OutputPage.php.

References $lang, $title, addVaryHeader(), as, LanguageCode\bcp47(), ContextSource\getRequest(), and ContextSource\getTitle().

Referenced by sendCacheControl().

◆ addBacklinkSubtitle()

OutputPage::addBacklinkSubtitle ( Title  $title,
  $query = [] 
)

Add a subtitle containing a backlink to a page.

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

Definition at line 1061 of file OutputPage.php.

References $query, and addSubtitle().

◆ addBodyClasses()

OutputPage::addBodyClasses (   $classes)

Add a class to the <body> element.

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

Definition at line 684 of file OutputPage.php.

References array().

◆ addCategoryLinks()

OutputPage::addCategoryLinks ( array  $categories)

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

Parameters
array$categoriesMapping category name => sort key

Definition at line 1322 of file OutputPage.php.

References $linkRenderer, $res, $services, $title, $type, addCategoryLinksToLBAndGetResult(), as, Title\makeTitleSafe(), NS_CATEGORY, Hooks\run(), and string.

Referenced by addParserOutputMetadata(), and setCategoryLinks().

◆ addCategoryLinksToLBAndGetResult()

OutputPage::addCategoryLinksToLBAndGetResult ( array  $categories)
protected
Parameters
array$categories
Returns
bool|IResultWrapper

Definition at line 1371 of file OutputPage.php.

References $dbr, $res, DB_REPLICA, LinkCache\getSelectFields(), NS_CATEGORY, LinkBatch\setArray(), and wfGetDB().

Referenced by addCategoryLinks().

◆ addContentOverride()

OutputPage::addContentOverride ( LinkTarget  $target,
Content  $content 
)

Add a mapping from a LinkTarget to a Content, for things like page preview.

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

Definition at line 609 of file OutputPage.php.

References $content, addContentOverrideCallback(), MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getNamespace(), and null.

◆ addContentOverrideCallback()

OutputPage::addContentOverrideCallback ( callable  $callback)

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

See also
ResourceLoaderContext::getContentOverrideCallback()
Since
1.32
Parameters
callable$callback

Definition at line 629 of file OutputPage.php.

Referenced by addContentOverride().

◆ addElement()

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 1587 of file OutputPage.php.

References $attribs, addHTML(), and Html\element().

◆ addFeedLink()

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 1189 of file OutputPage.php.

References getAdvertisedFeedTypes().

◆ addHeadItem()

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::addMetaLink() 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 654 of file OutputPage.php.

References $name, and $value.

◆ addHeadItems()

OutputPage::addHeadItems (   $values)

Add one or more head items to the output.

Since
1.28
Parameters
string|string[]$values Raw HTML

Definition at line 664 of file OutputPage.php.

References array().

◆ addHelpLink()

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 MW.o.
Since
1.25

Definition at line 1482 of file OutputPage.php.

References $link, addModuleStyles(), ContextSource\msg(), Html\rawElement(), setIndicators(), and wfUrlencode().

◆ addHTML()

◆ addInlineScript()

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 477 of file OutputPage.php.

References getCSPNonce(), and Html\inlineScript().

◆ addInlineStyle()

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 3910 of file OutputPage.php.

References ContextSource\getLanguage(), and Html\inlineStyle().

◆ addJsConfigVars()

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 3405 of file OutputPage.php.

References $keys, $value, and as.

Referenced by addParserOutputContent(), and addParserOutputMetadata().

◆ addLanguageLinks()

OutputPage::addLanguageLinks ( array  $newLinkArray)

Add new language links.

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

Definition at line 1294 of file OutputPage.php.

◆ addLink()

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 407 of file OutputPage.php.

◆ addLinkHeader()

OutputPage::addLinkHeader (   $header)

Add an HTTP Link: header.

Parameters
string$headerHeader value

Definition at line 2369 of file OutputPage.php.

References $header.

◆ addMeta()

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 386 of file OutputPage.php.

References $name.

◆ addModules()

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 547 of file OutputPage.php.

References $modules, and array().

Referenced by ListToggle\__construct(), MWDebug\addModules(), addParserOutputContent(), addParserOutputMetadata(), getRlClient(), and loadSkinModules().

◆ addModuleStyles()

OutputPage::addModuleStyles (   $modules)

Load the styles of one or more 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 582 of file OutputPage.php.

References $modules, and array().

Referenced by ListToggle\__construct(), addHelpLink(), addParserOutputContent(), addParserOutputMetadata(), enableOOUI(), getRlClient(), loadSkinModules(), and ApiParseTest\setupSkin().

◆ addParserOutput()

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

Add everything from a ParserOutput object.

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

Definition at line 2060 of file OutputPage.php.

References addParserOutputMetadata(), and addParserOutputText().

Referenced by addWikiTextTitleInternal().

◆ addParserOutputContent()

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 2030 of file OutputPage.php.

References addJsConfigVars(), addModules(), addModuleStyles(), addParserOutputText(), ParserOutput\getJsConfigVars(), ParserOutput\getModules(), and ParserOutput\getModuleStyles().

Referenced by SpecialExpandTemplates\showHtmlPreview().

◆ addParserOutputMetadata()

◆ addParserOutputText()

OutputPage::addParserOutputText ( ParserOutput  $parserOutput,
  $poOptions = [] 
)

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

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

Definition at line 2046 of file OutputPage.php.

References addHTML(), ParserOutput\getText(), and Hooks\runWithoutAbort().

Referenced by addParserOutput(), and addParserOutputContent().

◆ addReturnTo()

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

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

Parameters
Title$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 3049 of file OutputPage.php.

References $link, $linkRenderer, $options, $query, $title, addHTML(), and ContextSource\msg().

Referenced by returnToMain().

◆ addScript()

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 448 of file OutputPage.php.

Referenced by addScriptFile().

◆ addScriptFile()

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 460 of file OutputPage.php.

References $file, addScript(), getCSPNonce(), Html\linkedScript(), and wfDeprecated().

◆ addStyle()

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 3889 of file OutputPage.php.

References $options.

◆ addSubtitle()

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 1030 of file OutputPage.php.

References ContextSource\getContext().

Referenced by addBacklinkSubtitle(), and setSubtitle().

◆ addTemplate()

OutputPage::addTemplate ( $template)

Add the output of a QuickTemplate to the output buffer.

Parameters
QuickTemplate&$template

Definition at line 2070 of file OutputPage.php.

References $template, and addHTML().

◆ addVaryHeader()

OutputPage::addVaryHeader (   $header,
array  $option = null 
)

Add an HTTP header that will influence on the cache.

Parameters
string$headerHeader name
string[]|null$option Options for the Key header. See https://datatracker.ietf.org/doc/draft-fielding-http-key/ for the list of valid options.

Definition at line 2335 of file OutputPage.php.

References $header.

Referenced by addAcceptLanguage(), getKeyHeader(), getVaryHeader(), output(), and sendCacheControl().

◆ addWikiMsg()

OutputPage::addWikiMsg ( )

Add a wikitext-formatted message to the output.

This is equivalent to:

$wgOut->addWikiText( wfMessage( ... )->plain() )

Definition at line 4146 of file OutputPage.php.

References $args, $name, and addWikiMsgArray().

Referenced by versionRequired().

◆ addWikiMsgArray()

OutputPage::addWikiMsgArray (   $name,
  $args 
)

Add a wikitext-formatted message to the output.

Like addWikiMsg() except the parameters are taken as an array instead of a variable argument list.

Parameters
string$name
array$args

Definition at line 4160 of file OutputPage.php.

References $args, $name, addHTML(), and ContextSource\msg().

Referenced by addWikiMsg(), and showErrorPage().

◆ addWikiText()

OutputPage::addWikiText (   $text,
  $linestart = true,
  $interface = true 
)

Convert wikitext to HTML and add it to the buffer Default assumes that the current page title will be used.

Parameters
string$text
bool$linestartIs this the start of a line?
bool$interfaceIs this text in the user interface language?
Exceptions
MWException
Deprecated:
since 1.32 due to untidy output; use addWikiTextAsInterface() if $interface is default value or true, or else addWikiTextAsContent() if $interface is false.

Definition at line 1754 of file OutputPage.php.

References $title, addWikiTextTitleInternal(), ContextSource\getTitle(), and wfDeprecated().

◆ addWikiTextAsContent()

OutputPage::addWikiTextAsContent (   $text,
  $linestart = true,
Title  $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)
Title | null$titleOptional title to use; default of null means use current page title.
Exceptions
MWExceptionif $title is not provided and OutputPage::getTitle() is null
Since
1.32

Definition at line 1829 of file OutputPage.php.

References $title, addWikiTextTitleInternal(), ContextSource\getTitle(), and null.

◆ addWikiTextAsInterface()

OutputPage::addWikiTextAsInterface (   $text,
  $linestart = true,
Title  $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)
Title | null$titleOptional title to use; default of null means use current page title.
Exceptions
MWExceptionif $title is not provided and OutputPage::getTitle() is null
Since
1.32

Definition at line 1779 of file OutputPage.php.

References $title, addWikiTextTitleInternal(), ContextSource\getTitle(), and null.

Referenced by showPermissionsErrorPage(), and wrapWikiMsg().

◆ addWikiTextTidy()

OutputPage::addWikiTextTidy (   $text,
  $linestart = true 
)

Add wikitext in content language.

Output will be tidy.

Parameters
string$textWikitext in content language
bool$linestartIs this the start of a line?
Deprecated:
since 1.32 to rename methods consistently; use addWikiTextAsContent()

Definition at line 1878 of file OutputPage.php.

References $title, addWikiTextTitleInternal(), ContextSource\getTitle(), and wfDeprecated().

◆ addWikiTextTitle()

OutputPage::addWikiTextTitle (   $text,
Title  $title,
  $linestart,
  $tidy = false,
  $interface = false 
)

Add wikitext with a custom Title object.

Output is unwrapped.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?
bool$tidyWhether to use tidy. Setting this to false (or omitting it) is deprecated since 1.32; all wikitext should be tidied. For backwards-compatibility with prior MW releases, you may wish to invoke this method but set $tidy=true; this will result in equivalent output to the non-deprecated addWikiTextAsContent()/addWikiTextAsInterface() methods.
bool$interfaceWhether it is an interface message (for example disables conversion)
Deprecated:
since 1.32, use addWikiTextAsContent() or addWikiTextAsInterface() (depending on $interface)

Definition at line 1906 of file OutputPage.php.

References addWikiTextTitleInternal(), and wfDeprecated().

◆ addWikiTextTitleInternal()

OutputPage::addWikiTextTitleInternal (   $text,
Title  $title,
  $linestart,
  $tidy,
  $interface,
  $wrapperClass = null 
)
private

Add wikitext with a custom Title object.

Output is unwrapped.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?
bool$tidyWhether to use tidy. Setting this to false (or omitting it) is deprecated since 1.32; all wikitext should be tidied.
bool$interfaceWhether it is an interface message (for example disables conversion)
string$wrapperClassif not empty, wraps the output in a <div class="$wrapperClass">
Access:
private

Definition at line 1929 of file OutputPage.php.

References addParserOutput(), null, parseInternal(), and wfDeprecated().

Referenced by addWikiText(), addWikiTextAsContent(), addWikiTextAsInterface(), addWikiTextTidy(), addWikiTextTitle(), addWikiTextTitleTidy(), addWikiTextWithTitle(), and wrapWikiTextAsInterface().

◆ addWikiTextTitleTidy()

OutputPage::addWikiTextTitleTidy (   $text,
Title  $title,
  $linestart = true 
)

Add wikitext in content language with a custom Title object.

Output will be tidy.

Parameters
string$textWikitext in content language
Title$title
bool$linestartIs this the start of a line?
Deprecated:
since 1.32 to rename methods consistently; use addWikiTextAsContent()

Definition at line 1865 of file OutputPage.php.

References addWikiTextTitleInternal(), and wfDeprecated().

◆ addWikiTextWithTitle()

OutputPage::addWikiTextWithTitle (   $text,
Title  $title,
  $linestart = true 
)

Add wikitext with a custom Title object.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?
Deprecated:
since 1.32 due to untidy output; use addWikiTextAsInterface()

Definition at line 1850 of file OutputPage.php.

References addWikiTextTitleInternal(), and wfDeprecated().

◆ allowClickjacking()

OutputPage::allowClickjacking ( )

Turn off frame-breaking.

Alias for $this->preventClickjacking(false). This can be called from pages which do not contain any CSRF-protected HTML form.

Definition at line 2485 of file OutputPage.php.

◆ buildBacklinkSubtitle()

static OutputPage::buildBacklinkSubtitle ( Title  $title,
  $query = [] 
)
static

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

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

Definition at line 1046 of file OutputPage.php.

References $linkRenderer, $query, Title\isRedirect(), null, and wfMessage().

Referenced by RevertAction\getDescription(), and OutputPageTest\testBuildBacklinkSubtitle().

◆ buildCssLinksArray()

OutputPage::buildCssLinksArray ( )
Returns
array

Definition at line 3967 of file OutputPage.php.

References $file, $link, $options, as, and styleLink().

Referenced by buildExemptModules().

◆ buildExemptModules()

OutputPage::buildExemptModules ( )
protected

Build exempt modules and legacy non-ResourceLoader styles.

Returns
string|WrappedStringList HTML

Definition at line 3923 of file OutputPage.php.

References $mInlineStyles, $name, as, buildCssLinksArray(), Html\element(), makeResourceLoaderLink(), and ResourceLoaderModule\TYPE_STYLES.

Referenced by headElement().

◆ checkLastModified()

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 741 of file OutputPage.php.

References $name, $value, as, disable(), getCdnCacheEpoch(), ContextSource\getConfig(), ContextSource\getRequest(), ContextSource\getUser(), Hooks\run(), sendCacheControl(), wfClearOutputBuffers(), wfDebug(), and wfTimestamp().

◆ clearHTML()

OutputPage::clearHTML ( )

Clear the body HTML.

Definition at line 1594 of file OutputPage.php.

Referenced by prepareErrorPage().

◆ clearSubtitle()

OutputPage::clearSubtitle ( )

Clear the subtitles.

Definition at line 1068 of file OutputPage.php.

Referenced by prepareErrorPage(), and setSubtitle().

◆ combineWrappedStrings()

static OutputPage::combineWrappedStrings ( array  $chunks)
staticprotected

Combine WrappedString chunks and filter out empty ones.

Parameters
array$chunks
Returns
string|WrappedStringList HTML

Definition at line 3358 of file OutputPage.php.

◆ disable()

OutputPage::disable ( )

Disable output completely, i.e.

calling output() will have no effect

Definition at line 1101 of file OutputPage.php.

Referenced by checkLastModified().

◆ disallowUserJs()

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 1514 of file OutputPage.php.

References ContextSource\getConfig(), ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL, ResourceLoaderModule\ORIGIN_USER_SITEWIDE, reduceAllowedModules(), ResourceLoaderModule\TYPE_SCRIPTS, and ResourceLoaderModule\TYPE_STYLES.

Referenced by output().

◆ enableClientCache()

OutputPage::enableClientCache (   $state)

Use enableClientCache(false) to force it to send nocache headers.

Parameters
bool | null$stateNew value, or null to not set the value
Returns
bool Old value

Definition at line 2285 of file OutputPage.php.

References wfSetVar().

Referenced by addParserOutputMetadata(), SkinFallback\initPage(), and prepareErrorPage().

◆ enableOOUI()

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 4265 of file OutputPage.php.

References addModuleStyles(), ContextSource\getLanguage(), and ContextSource\getSkin().

Referenced by addParserOutputMetadata().

◆ enableSectionEditLinks()

OutputPage::enableSectionEditLinks (   $flag = true)

Enables/disables section edit links, doesn't override NOEDITSECTION

Parameters
bool$flag
Since
1.23
Deprecated:
since 1.31, use $poOptions to addParserOutput() instead.

Definition at line 4229 of file OutputPage.php.

References wfDeprecated().

◆ feedLink()

OutputPage::feedLink (   $type,
  $url,
  $text 
)
private

Generate a "<link rel/>" for a feed.

Parameters
string$typeFeed type
string$urlURL to the feed
string$textValue of the "title" attribute
Returns
string HTML fragment

Definition at line 3871 of file OutputPage.php.

References Html\element().

Referenced by getHeadLinksArray().

◆ filterModules()

OutputPage::filterModules ( array  $modules,
  $position = null,
  $type = ResourceLoaderModule::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
array$modules
string | null$positionUnused
string$type
Returns
array

Definition at line 489 of file OutputPage.php.

References $resourceLoader, $type, as, getAllowedModules(), ResourceLoaderModule\getOrigin(), getResourceLoader(), and warnModuleTargetFilter().

Referenced by getModules(), and makeResourceLoaderLink().

◆ forceHideNewSectionLink()

OutputPage::forceHideNewSectionLink ( )

Forcibly hide the new section link?

Returns
bool

Definition at line 1128 of file OutputPage.php.

References $mHideNewSectionLink.

◆ formatPermissionsErrorMessage()

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

Format a list of error messages.

Parameters
array$errorsArray of arrays returned by Title::getUserPermissionsErrors
string | null$actionAction that was denied or null if unknown
Returns
string The wikitext error-messages, formatted into a list.

Definition at line 2938 of file OutputPage.php.

References as, ContextSource\msg(), and null.

Referenced by showPermissionsErrorPage().

◆ getAdvertisedFeedTypes()

OutputPage::getAdvertisedFeedTypes ( )
protected

Return effective list of advertised feed types.

See also
addFeedLink()
Returns
array Array of feed type names ( 'rss', 'atom' )

Definition at line 1154 of file OutputPage.php.

References ContextSource\getConfig().

Referenced by addFeedLink(), getHeadLinksArray(), and setFeedAppendQuery().

◆ getAllowedModules()

OutputPage::getAllowedModules (   $type)

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

See also
ResourceLoaderModule::$origin
Parameters
string$typeResourceLoaderModule TYPE_ constant
Returns
int ResourceLoaderModule ORIGIN_ class constant

Definition at line 1539 of file OutputPage.php.

References $type, ResourceLoaderModule\ORIGIN_ALL, and ResourceLoaderModule\TYPE_COMBINED.

Referenced by filterModules(), getRlClient(), and reduceAllowedModules().

◆ getArticleBodyOnly()

OutputPage::getArticleBodyOnly ( )

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

Returns
bool

Definition at line 704 of file OutputPage.php.

References $mArticleBodyOnly.

◆ getBottomScripts()

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 3370 of file OutputPage.php.

References $mScripts, getCSPNonce(), getRlClient(), ResourceLoader\makeConfigSetScript(), and ResourceLoader\makeInlineScript().

◆ getCacheVaryCookies()

OutputPage::getCacheVaryCookies ( )

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

Returns
array

Definition at line 2294 of file OutputPage.php.

References ContextSource\getConfig(), null, and Hooks\run().

Referenced by getKeyHeader(), getVaryHeader(), and haveCacheVaryCookies().

◆ getCanonicalUrl()

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 437 of file OutputPage.php.

References $mCanonicalUrl.

◆ getCategories()

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
array Array of strings

Definition at line 1433 of file OutputPage.php.

References $type, and as.

Referenced by getJSVars().

◆ getCategoryLinks()

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
array

Definition at line 1420 of file OutputPage.php.

References $mCategoryLinks.

◆ getCdnCacheEpoch()

OutputPage::getCdnCacheEpoch (   $reqTime,
  $maxAge 
)
private
Parameters
int$reqTimeTime of request (eg. now)
int$maxAgeCache TTL in seconds
Returns
int Timestamp

Definition at line 829 of file OutputPage.php.

Referenced by checkLastModified().

◆ getCSPNonce()

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|bool Nonce or false to mean don't output nonce
Since
1.32

Definition at line 4290 of file OutputPage.php.

References $CSPNonce, ContextSource\getConfig(), ContentSecurityPolicy\isNonceRequired(), and null.

Referenced by addInlineScript(), addScriptFile(), getBottomScripts(), getJSVars(), getRlClient(), headElement(), and makeResourceLoaderLink().

◆ getDisplayTitle()

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 983 of file OutputPage.php.

References $displayTitle, $html, ContextSource\getTitle(), Sanitizer\normalizeCharReferences(), null, and Sanitizer\removeHTMLtags().

Referenced by getUnprefixedDisplayTitle().

◆ getFeaturePolicyReportOnly()

OutputPage::getFeaturePolicyReportOnly ( )
private

Definition at line 2552 of file OutputPage.php.

References ContextSource\getConfig().

Referenced by output().

◆ getFeedAppendQuery()

OutputPage::getFeedAppendQuery ( )

Will currently always return null.

Returns
null

Definition at line 1216 of file OutputPage.php.

References $mFeedLinksAppendQuery.

◆ getFileSearchOptions()

OutputPage::getFileSearchOptions ( )

Get the files used on this page.

Returns
array (dbKey => array('time' => MW timestamp or null, 'sha1' => sha1 or ''))
Since
1.18

Definition at line 1738 of file OutputPage.php.

References $mImageTimeKeys.

◆ getFileVersion()

OutputPage::getFileVersion ( )

Get the displayed file version.

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

Definition at line 1718 of file OutputPage.php.

References $mFileVersion.

◆ getFrameOptions()

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 2506 of file OutputPage.php.

References ContextSource\getConfig().

Referenced by getJSVars(), and output().

◆ getHeadItemsArray()

OutputPage::getHeadItemsArray ( )

Get an array of head items.

Returns
array

Definition at line 638 of file OutputPage.php.

References $mHeadItems.

Referenced by ParserOutput\addOutputPageMetadata().

◆ getHeadLinksArray()

◆ getHTML()

OutputPage::getHTML ( )

Get the body HTML.

Returns
string HTML

Definition at line 1603 of file OutputPage.php.

References $mBodytext.

Referenced by ArticleViewTest\getHtml().

◆ getHTMLTitle()

OutputPage::getHTMLTitle ( )

Return the "HTML title", i.e.

the content of the "<title>" tag.

Returns
string

Definition at line 913 of file OutputPage.php.

References $mHTMLtitle.

Referenced by headElement().

◆ getIndicators()

OutputPage::getIndicators ( )

Get the indicators associated with this page.

The array will be internally ordered by item keys.

Returns
array Keys: identifiers, values: HTML contents
Since
1.25

Definition at line 1470 of file OutputPage.php.

References $mIndicators.

◆ getJsConfigVars()

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 3395 of file OutputPage.php.

References $mJsConfigVars.

Referenced by ParserOutput\addOutputPageMetadata(), and getJSVars().

◆ getJSVars()

OutputPage::getJSVars ( )

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

Do not add things here which can be evaluated in ResourceLoaderStartUpModule

  • in other words, page-independent/site-wide variables (without state). You will only be adding bloat to the html page and causing page caches to have to be purged on configuration changes.
    Returns
    array

Definition at line 3425 of file OutputPage.php.

References $lang, $services, $title, $type, $user, $vars, as, ContextSource\canUseWikiPage(), MWNamespace\exists(), Action\getActionName(), MWNamespace\getCanonicalName(), getCategories(), ContextSource\getContext(), getCSPNonce(), getFrameOptions(), getJsConfigVars(), WebRequest\getRequestId(), getRevisionId(), ContextSource\getSkin(), ContextSource\getTitle(), ContextSource\getUser(), ContextSource\getWikiPage(), isArticle(), list, NS_SPECIAL, null, Hooks\run(), and wfTimestamp().

Referenced by getRlClient().

◆ getKeyHeader()

OutputPage::getKeyHeader ( )

Get a complete Key header.

Returns
string
Deprecated:
in 1.32; the IETF spec for this header expired w/o becoming a standard.

Definition at line 2393 of file OutputPage.php.

References $header, $options, addVaryHeader(), as, getCacheVaryCookies(), and wfDeprecated().

Referenced by sendCacheControl().

◆ getLanguageLinks()

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 1313 of file OutputPage.php.

References $mLanguageLinks.

◆ getLinkHeader()

OutputPage::getLinkHeader ( )

Return a Link: header.

Based on the values of $mLinkHeader.

Returns
string

Definition at line 2378 of file OutputPage.php.

Referenced by output().

◆ getLinkTags()

OutputPage::getLinkTags ( )

Returns the current <link> tags.

Since
1.25
Returns
array

Definition at line 417 of file OutputPage.php.

References $mLinktags.

◆ getMetaTags()

OutputPage::getMetaTags ( )

Returns the current <meta> tags.

Since
1.25
Returns
array

Definition at line 396 of file OutputPage.php.

References $mMetatags.

◆ getModules()

OutputPage::getModules (   $filter = false,
  $position = null,
  $param = 'mModules',
  $type = ResourceLoaderModule::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
array Array of module names

Definition at line 533 of file OutputPage.php.

References $filter, $modules, $type, filterModules(), and null.

Referenced by ParserOutput\addOutputPageMetadata(), getModuleStyles(), and getRlClient().

◆ getModuleScripts()

OutputPage::getModuleScripts ( )
Deprecated:
since 1.33 Use getModules() instead.
Returns
array

Definition at line 555 of file OutputPage.php.

References wfDeprecated().

◆ getModuleStyles()

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
array Array of module names

Definition at line 567 of file OutputPage.php.

References $filter, getModules(), null, and ResourceLoaderModule\TYPE_STYLES.

Referenced by ParserOutput\addOutputPageMetadata(), and getRlClient().

◆ getOriginTrials()

OutputPage::getOriginTrials ( )
private

Get the Origin-Trial header values.

This is used to enable Chrome Origin Trials: https://github.com/GoogleChrome/OriginTrials

Returns
array

Definition at line 2522 of file OutputPage.php.

References ContextSource\getConfig().

Referenced by output().

◆ getPageTitle()

OutputPage::getPageTitle ( )

Return the "page title", i.e.

the content of the \<h1\> tag.

Returns
string

Definition at line 960 of file OutputPage.php.

References $mPageTitle.

Referenced by headElement().

◆ getPreventClickjacking()

OutputPage::getPreventClickjacking ( )

Get the prevent-clickjacking flag.

Since
1.24
Returns
bool

Definition at line 2495 of file OutputPage.php.

References $mPreventClickjacking.

Referenced by ParserOutput\addOutputPageMetadata().

◆ getProperty()

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 726 of file OutputPage.php.

References $name, and null.

◆ getRedirect()

OutputPage::getRedirect ( )

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

Returns
string

Definition at line 354 of file OutputPage.php.

References $mRedirect.

◆ getReportTo()

OutputPage::getReportTo ( )
private

Definition at line 2528 of file OutputPage.php.

References $output, as, and ContextSource\getConfig().

Referenced by output().

◆ getResourceLoader()

OutputPage::getResourceLoader ( )

Get a ResourceLoader object associated with this OutputPage.

Returns
ResourceLoader

Definition at line 3323 of file OutputPage.php.

References $mResourceLoader.

Referenced by filterModules(), getRlClient(), getRlClientContext(), headElement(), and warnModuleTargetFilter().

◆ getRevisionId()

OutputPage::getRevisionId ( )

Get the displayed revision ID.

Returns
int

Definition at line 1674 of file OutputPage.php.

References $mRevisionId.

Referenced by getJSVars().

◆ getRevisionTimestamp()

OutputPage::getRevisionTimestamp ( )

Get the timestamp of displayed revision.

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

Returns
string|null

Definition at line 1695 of file OutputPage.php.

References $mRevisionTimestamp.

◆ getRlClient()

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
ResourceLoaderClientHtml

Definition at line 3148 of file OutputPage.php.

References ContextSource\$context, $dbr, $name, $rlClient, addModules(), addModuleStyles(), DB_REPLICA, getAllowedModules(), getCSPNonce(), getJSVars(), getModules(), getModuleStyles(), getResourceLoader(), getRlClientContext(), ContextSource\getSkin(), getTarget(), null, ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL, ResourceLoaderWikiModule\preloadTitleInfo(), ResourceLoaderClientHtml\setConfig(), ResourceLoaderClientHtml\setExemptStates(), ResourceLoaderClientHtml\setModules(), ResourceLoaderClientHtml\setModuleStyles(), ResourceLoaderModule\TYPE_COMBINED, use, and wfGetDB().

Referenced by getBottomScripts(), and headElement().

◆ getRlClientContext()

◆ getSubtitle()

OutputPage::getSubtitle ( )

Get the subtitle.

Returns
string

Definition at line 1077 of file OutputPage.php.

◆ getSyndicationLinks()

OutputPage::getSyndicationLinks ( )

Return URLs for each supported syndication format for this page.

Returns
array Associating format keys with URLs

Definition at line 1207 of file OutputPage.php.

References $mFeedLinks.

Referenced by getHeadLinksArray().

◆ getTarget()

OutputPage::getTarget ( )
Returns
null|string ResourceLoader target

Definition at line 589 of file OutputPage.php.

References $mTarget.

Referenced by getRlClient().

◆ getTemplateIds()

OutputPage::getTemplateIds ( )

Get the templates used on this page.

Returns
array (namespace => dbKey => revId)
Since
1.18

Definition at line 1728 of file OutputPage.php.

References $mTemplateIds.

◆ getUnprefixedDisplayTitle()

OutputPage::getUnprefixedDisplayTitle ( )

Returns page display title without namespace prefix if possible.

Since
1.32
Returns
string HTML

Definition at line 998 of file OutputPage.php.

References getDisplayTitle(), and ContextSource\getTitle().

◆ getVaryHeader()

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 2352 of file OutputPage.php.

References $header, $options, addVaryHeader(), as, and getCacheVaryCookies().

Referenced by sendCacheControl().

◆ hasHeadItem()

OutputPage::hasHeadItem (   $name)

Check if the header item $name is already set.

Parameters
string$nameItem name
Returns
bool

Definition at line 674 of file OutputPage.php.

References $name.

◆ haveCacheVaryCookies()

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 2315 of file OutputPage.php.

References $request, as, getCacheVaryCookies(), ContextSource\getRequest(), and wfDebug().

Referenced by sendCacheControl().

◆ headElement()

◆ isArticle()

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 1240 of file OutputPage.php.

References $mIsArticle.

Referenced by getJSVars(), and showsCopyright().

◆ isArticleRelated()

OutputPage::isArticleRelated ( )

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

Returns
bool

Definition at line 1262 of file OutputPage.php.

References $mIsArticleRelated.

Referenced by getHeadLinksArray().

◆ isDisabled()

OutputPage::isDisabled ( )

Return whether the output will be completely disabled.

Returns
bool

Definition at line 1110 of file OutputPage.php.

References $mDoNothing.

◆ isPrintable()

OutputPage::isPrintable ( )

Return whether the page is "printable".

Returns
bool

Definition at line 1094 of file OutputPage.php.

References $mPrintable.

Referenced by getRlClientContext(), and sendCacheControl().

◆ isSyndicated()

OutputPage::isSyndicated ( )

Should we output feed links for this page?

Returns
bool

Definition at line 1199 of file OutputPage.php.

◆ isTOCEnabled()

OutputPage::isTOCEnabled ( )

Whether the output has a table of contents.

Returns
bool
Since
1.22

Definition at line 4219 of file OutputPage.php.

References $mEnableTOC.

◆ loadSkinModules()

OutputPage::loadSkinModules (   $sk)

Transfer styles and JavaScript modules from skin.

Parameters
Skin$skto load modules for

Definition at line 2638 of file OutputPage.php.

References $modules, addModules(), addModuleStyles(), and as.

Referenced by output().

◆ lowerCdnMaxage()

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 2246 of file OutputPage.php.

References setCdnMaxage().

Referenced by adaptCdnTTL().

◆ makeResourceLoaderLink()

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

Explicily load or embed modules on a page.

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

Definition at line 3339 of file OutputPage.php.

References $modules, array(), filterModules(), getCSPNonce(), getRlClientContext(), ResourceLoaderClientHtml\makeLoad(), and null.

Referenced by buildExemptModules().

◆ 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
Exceptions
Exception
FatalError
MWException

Definition at line 2660 of file OutputPage.php.

References $code, $e, $mBodytext, $mRedirect, $mRedirectCode, $response, MWDebug\addModules(), addVaryHeader(), as, disallowUserJs(), ContextSource\getConfig(), getFeaturePolicyReportOnly(), getFrameOptions(), getLinkHeader(), getOriginTrials(), getReportTo(), ContextSource\getRequest(), ContextSource\getSkin(), loadSkinModules(), null, print, PROTO_CURRENT, Hooks\run(), Hooks\runWithoutAbort(), sendCacheControl(), ContentSecurityPolicy\sendHeaders(), wfExpandUrl(), and wfTimestamp().

◆ parse()

OutputPage::parse (   $text,
  $linestart = true,
  $interface = false,
  $language = null 
)

Parse wikitext and return the HTML.

Todo:
The output is wrapped in a
iff $interface is false; it's probably best to always strip the wrapper.
Parameters
string$text
bool$linestartIs this the start of a line?
bool$interfaceUse interface language (instead of content language) while parsing language sensitive magic words like GRAMMAR and PLURAL. This also disables LanguageConverter.
Language | null$languageTarget language object, will override $interface
Exceptions
MWException
Returns
string HTML
Deprecated:
since 1.32, due to untidy output and inconsistent wrapper; use parseAsContent() if $interface is default value or false, or else parseAsInterface() if $interface is true.

Definition at line 2092 of file OutputPage.php.

References ContextSource\getTitle(), parseInternal(), and wfDeprecated().

Referenced by showPermissionsErrorPage().

◆ parseAsContent()

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)
Exceptions
MWException
Returns
string HTML
Since
1.32

Definition at line 2112 of file OutputPage.php.

References ContextSource\getTitle(), null, and parseInternal().

◆ parseAsInterface()

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)
Exceptions
MWException
Returns
string HTML
Since
1.32

Definition at line 2133 of file OutputPage.php.

References ContextSource\getTitle(), null, and parseInternal().

Referenced by parseInlineAsInterface().

◆ parseInline()

OutputPage::parseInline (   $text,
  $linestart = true,
  $interface = false 
)

Parse wikitext, strip paragraph wrapper, and return the HTML.

Parameters
string$text
bool$linestartIs this the start of a line?
bool$interfaceUse interface language (instead of content language) while parsing language sensitive magic words like GRAMMAR and PLURAL
Returns
string HTML
Deprecated:
since 1.32, due to untidy output and confusing default for $interface. Use parseInlineAsInterface() if $interface is the default value or false, or else use Parser::stripOuterParagraph($outputPage->parseAsContent(...)).

Definition at line 2175 of file OutputPage.php.

References ContextSource\getTitle(), null, parseInternal(), Parser\stripOuterParagraph(), and wfDeprecated().

◆ parseInlineAsInterface()

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)
Exceptions
MWException
Returns
string HTML
Since
1.32

Definition at line 2156 of file OutputPage.php.

References parseAsInterface(), and Parser\stripOuterParagraph().

◆ parseInternal()

OutputPage::parseInternal (   $text,
  $title,
  $linestart,
  $tidy,
  $interface,
  $language 
)
private

Parse wikitext and return the HTML (internal implementation helper)

Parameters
string$text
Title$titleThe title to use
bool$linestartIs this the start of a line?
bool$tidyWhether the output should be tidied
bool$interfaceUse interface language (instead of content language) while parsing language sensitive magic words like GRAMMAR and PLURAL. This also disables LanguageConverter.
Language | null$languageTarget language object, will override $interface
Exceptions
MWException
Returns
ParserOutput

Definition at line 2200 of file OutputPage.php.

References $title, null, and parserOptions().

Referenced by addWikiTextTitleInternal(), parse(), parseAsContent(), parseAsInterface(), and parseInline().

◆ parserOptions()

OutputPage::parserOptions (   $options = null)

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

Parameters
ParserOptions | null$optionsEither the ParserOption to use or null to only get the current ParserOption object. This parameter is deprecated since 1.31.
Returns
ParserOptions

Definition at line 1614 of file OutputPage.php.

References $options, ContextSource\getContext(), ContextSource\getUser(), ParserOptions\newFromAnon(), ParserOptions\newFromContext(), null, wfDeprecated(), wfGetAllCallers(), wfLogWarning(), and wfSetVar().

Referenced by parseInternal().

◆ prepareErrorPage()

OutputPage::prepareErrorPage (   $pageTitle,
  $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 an custom HTML title (content of the "<title>" tag).

Parameters
string | Message$pageTitleWill be passed directly to setPageTitle()
string | Message$htmlTitleWill be passed directly to setHTMLTitle(); optional, if not passed the "<title>" attribute will be based on $pageTitle

Definition at line 2793 of file OutputPage.php.

References clearHTML(), clearSubtitle(), enableClientCache(), setArticleRelated(), setHTMLTitle(), setPageTitle(), and setRobotPolicy().

Referenced by showErrorPage(), showFatalError(), showPermissionsErrorPage(), and versionRequired().

◆ prependHTML()

OutputPage::prependHTML (   $text)

Prepend $text to the body HTML.

Parameters
string$textHTML

Definition at line 1565 of file OutputPage.php.

References $mBodytext.

◆ preventClickjacking()

OutputPage::preventClickjacking (   $enable = true)

Set a flag which 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.

Parameters
bool$enable

Definition at line 2476 of file OutputPage.php.

◆ redirect()

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

Redirect to $url rather than displaying the normal page.

Parameters
string$url
string$responsecodeHTTP status code

Definition at line 343 of file OutputPage.php.

Referenced by PageDataRequestHandler\httpContentNegotiation().

◆ reduceAllowedModules()

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$levelResourceLoaderModule class constant

Definition at line 1556 of file OutputPage.php.

References $type, and getAllowedModules().

Referenced by disallowUserJs().

◆ returnToMain()

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
Title | string | null$returntoTitle or String to return to
string | null$returntoqueryQuery string for the return to link

Definition at line 3065 of file OutputPage.php.

References addReturnTo(), ContextSource\getRequest(), Title\newFromText(), Title\newMainPage(), null, and wfCgiToArray().

Referenced by showErrorPage(), showPermissionsErrorPage(), and versionRequired().

◆ sectionEditLinksEnabled()

OutputPage::sectionEditLinksEnabled ( )
Returns
bool
Since
1.23
Deprecated:
since 1.31, use $poOptions to addParserOutput() instead.

Definition at line 4238 of file OutputPage.php.

References wfDeprecated().

◆ sendCacheControl()

OutputPage::sendCacheControl ( )

◆ setArticleBodyOnly()

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 695 of file OutputPage.php.

◆ setArticleFlag()

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 1227 of file OutputPage.php.

◆ setArticleRelated()

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 1250 of file OutputPage.php.

Referenced by prepareErrorPage().

◆ setCanonicalUrl()

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 426 of file OutputPage.php.

◆ setCategoryLinks()

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 1407 of file OutputPage.php.

References addCategoryLinks().

Referenced by SpecialExpandTemplates\showHtmlPreview().

◆ setCdnMaxage()

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 2233 of file OutputPage.php.

Referenced by lowerCdnMaxage().

◆ setCopyright()

OutputPage::setCopyright (   $hasCopyright)

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

Parameters
bool$hasCopyright

Definition at line 1271 of file OutputPage.php.

◆ setCopyrightUrl()

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 366 of file OutputPage.php.

◆ setDisplayTitle()

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 971 of file OutputPage.php.

References $html.

◆ setFeedAppendQuery()

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$valQuery to append to feed links or false to output default links

Definition at line 1171 of file OutputPage.php.

References $query, $type, as, getAdvertisedFeedTypes(), and ContextSource\getTitle().

Referenced by setSyndicated().

◆ setFileVersion()

OutputPage::setFileVersion (   $file)

Set the displayed file version.

Parameters
File | null$file
Returns
mixed Previous value

Definition at line 1705 of file OutputPage.php.

References $file, null, and wfSetVar().

◆ setFollowPolicy()

OutputPage::setFollowPolicy (   $policy)

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

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

Definition at line 887 of file OutputPage.php.

Referenced by setRobotPolicy().

◆ setHTMLTitle()

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 900 of file OutputPage.php.

References $name, and ContextSource\getContext().

Referenced by headElement(), prepareErrorPage(), and setPageTitle().

◆ setIndexPolicy()

OutputPage::setIndexPolicy (   $policy)

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

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

Definition at line 873 of file OutputPage.php.

Referenced by setRobotPolicy().

◆ setIndicators()

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.

Parameters
array$indicators
Since
1.25

Definition at line 1456 of file OutputPage.php.

References $mIndicators.

Referenced by addHelpLink(), and addParserOutputMetadata().

◆ setLanguageLinks()

OutputPage::setLanguageLinks ( array  $newLinkArray)

Reset the language links and add new language links.

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

Definition at line 1304 of file OutputPage.php.

◆ setLastModified()

OutputPage::setLastModified (   $timestamp)

Override the last modified timestamp.

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

Definition at line 843 of file OutputPage.php.

References wfTimestamp().

◆ setPageTitle()

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$name

Definition at line 938 of file OutputPage.php.

References $name, ContextSource\getContext(), ContextSource\msg(), Sanitizer\normalizeCharReferences(), Sanitizer\removeHTMLtags(), setHTMLTitle(), and Sanitizer\stripAllTags().

Referenced by prepareErrorPage().

◆ setPrintable()

OutputPage::setPrintable ( )

Set the page as printable, i.e.

it'll be displayed with all print styles included

Definition at line 1085 of file OutputPage.php.

◆ setProperty()

OutputPage::setProperty (   $name,
  $value 
)

Set an additional output property.

Since
1.21
Parameters
string$name
mixed$value

Definition at line 715 of file OutputPage.php.

References $name, and $value.

◆ setRedirectedFrom()

OutputPage::setRedirectedFrom (   $t)

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

Parameters
Title$t

Definition at line 922 of file OutputPage.php.

References $t.

◆ setRevisionId()

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 1664 of file OutputPage.php.

References null, and wfSetVar().

◆ setRevisionTimestamp()

OutputPage::setRevisionTimestamp (   $timestamp)

Set the timestamp of the revision which will be displayed.

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

Parameters
string | null$timestamp
Returns
mixed Previous value

Definition at line 1685 of file OutputPage.php.

References wfSetVar().

◆ setRobotPolicy()

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.
Returns
null

Definition at line 855 of file OutputPage.php.

References Article\formatRobotPolicy(), setFollowPolicy(), and setIndexPolicy().

Referenced by prepareErrorPage().

◆ setStatusCode()

OutputPage::setStatusCode (   $statusCode)

Set the HTTP status code to send with the output.

Parameters
int$statusCode

Definition at line 375 of file OutputPage.php.

◆ setSubtitle()

OutputPage::setSubtitle (   $str)

Replace the subtitle with $str.

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

Definition at line 1020 of file OutputPage.php.

References addSubtitle(), and clearSubtitle().

◆ setSyndicated()

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 1140 of file OutputPage.php.

References setFeedAppendQuery().

◆ setTarget()

OutputPage::setTarget (   $target)

Sets ResourceLoader target for load.php links.

If null, will be omitted

Parameters
string | null$target

Definition at line 598 of file OutputPage.php.

◆ setTitle()

OutputPage::setTitle ( Title  $t)

Set the Title object to use.

Parameters
Title$t

Definition at line 1011 of file OutputPage.php.

References ContextSource\getContext().

◆ setupOOUI()

static OutputPage::setupOOUI (   $skinName = 'default',
  $dir = 'ltr' 
)
static

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

Since
1.26
Parameters
string$skinNameThe Skin name to determine the correct OOUI theme
string$dirLanguage direction

Definition at line 4250 of file OutputPage.php.

References getSkinThemeMap().

Referenced by Parser\enableOOUI(), and MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor().

◆ showErrorPage()

OutputPage::showErrorPage (   $title,
  $msg,
  $params = [] 
)

Output a standard error page.

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

Parameters
string | Message$titleMessage key (string) for page title, or a Message object
string | Message$msgMessage key (string) for page text, or a Message object
array$paramsMessage parameters; ignored if $msg is a Message object

Definition at line 2818 of file OutputPage.php.

References $params, $title, addHTML(), addWikiMsgArray(), ContextSource\msg(), prepareErrorPage(), and returnToMain().

◆ showFatalError()

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 2995 of file OutputPage.php.

References addHTML(), ContextSource\msg(), and prepareErrorPage().

Referenced by showFileCopyError(), showFileDeleteError(), showFileNotFoundError(), showFileRenameError(), and showUnexpectedValueError().

◆ showFileCopyError()

OutputPage::showFileCopyError (   $old,
  $new 
)
Deprecated:
1.32 Use OutputPage::showFatalError or throw FatalError instead.

Definition at line 3012 of file OutputPage.php.

References ContextSource\msg(), showFatalError(), and wfDeprecated().

◆ showFileDeleteError()

OutputPage::showFileDeleteError (   $name)
Deprecated:
1.32 Use OutputPage::showFatalError or throw FatalError instead.

Definition at line 3028 of file OutputPage.php.

References $name, ContextSource\msg(), showFatalError(), and wfDeprecated().

◆ showFileNotFoundError()

OutputPage::showFileNotFoundError (   $name)
Deprecated:
1.32 Use OutputPage::showFatalError or throw FatalError instead.

Definition at line 3036 of file OutputPage.php.

References $name, ContextSource\msg(), showFatalError(), and wfDeprecated().

◆ showFileRenameError()

OutputPage::showFileRenameError (   $old,
  $new 
)
Deprecated:
1.32 Use OutputPage::showFatalError or throw FatalError instead.

Definition at line 3020 of file OutputPage.php.

References ContextSource\msg(), showFatalError(), and wfDeprecated().

◆ showLagWarning()

OutputPage::showLagWarning (   $lag)

Show a warning about replica DB lag.

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

Parameters
int$lagReplica lag

Definition at line 2977 of file OutputPage.php.

References ContextSource\getConfig(), ContextSource\getLanguage(), Html\rawElement(), and wrapWikiMsg().

◆ showNewSectionLink()

OutputPage::showNewSectionLink ( )

Show an "add new section" link?

Returns
bool

Definition at line 1119 of file OutputPage.php.

References $mNewSectionLink.

◆ showPermissionsErrorPage()

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 2845 of file OutputPage.php.

References $linkRenderer, $query, $request, $title, addHTML(), addWikiTextAsInterface(), array(), as, formatPermissionsErrorMessage(), ContextSource\getRequest(), SpecialPage\getTitleFor(), ContextSource\getUser(), User\groupHasPermission(), ContextSource\msg(), Title\newFromText(), Title\newMainPage(), null, parse(), prepareErrorPage(), PROTO_RELATIVE, returnToMain(), text, and wfArrayToCgi().

◆ showsCopyright()

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 1284 of file OutputPage.php.

References $mHasCopyright, and isArticle().

◆ showUnexpectedValueError()

OutputPage::showUnexpectedValueError (   $name,
  $val 
)
Deprecated:
1.32 Use OutputPage::showFatalError or throw FatalError instead.

Definition at line 3004 of file OutputPage.php.

References $name, ContextSource\msg(), showFatalError(), and wfDeprecated().

◆ styleLink()

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 3986 of file OutputPage.php.

References $link, ContextSource\getConfig(), ContextSource\getLanguage(), and Html\linkedStyle().

Referenced by buildCssLinksArray().

◆ transformCssMedia()

static OutputPage::transformCssMedia (   $media)
static

Transform "media" attribute based on request parameters.

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

Definition at line 4101 of file OutputPage.php.

References $wgRequest, as, and null.

Referenced by OutputPageTest\assertTransformCssMediaCase(), and ResourceLoader\makeModuleResponse().

◆ transformFilePath()

static 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 4085 of file OutputPage.php.

References wfLogWarning().

Referenced by CSSMin\remapOne().

◆ transformResourcePath()

static 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 4043 of file OutputPage.php.

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

Referenced by ResourceLoaderSkinModule\getLogoData(), ResourceLoaderFileModule\getScriptURLsForDebug(), ResourceLoaderFileModule\getStyleURLsForDebug(), and OutputPageTest\testTransformResourcePath().

◆ userCanPreview()

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 3560 of file OutputPage.php.

References $request, $title, $user, ContextSource\getRequest(), ContextSource\getTitle(), and ContextSource\getUser().

◆ versionRequired()

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 2924 of file OutputPage.php.

References addWikiMsg(), ContextSource\msg(), prepareErrorPage(), and returnToMain().

◆ warnModuleTargetFilter()

OutputPage::warnModuleTargetFilter (   $moduleName)
private

Definition at line 509 of file OutputPage.php.

References $mTarget, and getResourceLoader().

Referenced by filterModules().

◆ wrapWikiMsg()

OutputPage::wrapWikiMsg (   $wrap)

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='error'>\\n$1\\n</div>", 'some-error' );

Is equivalent to:

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

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

Parameters
string$wrap

Definition at line 4189 of file OutputPage.php.

References $args, $name, $s, addWikiTextAsInterface(), as, ContextSource\msg(), plain, and wfDeprecated().

Referenced by SpecialExpandTemplates\showHtmlPreview(), and showLagWarning().

◆ wrapWikiTextAsInterface()

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 1804 of file OutputPage.php.

References addWikiTextTitleInternal(), and ContextSource\getTitle().

Member Data Documentation

◆ $cacheVaryCookies

array OutputPage::$cacheVaryCookies = null
staticprivate

A cache of the names of the cookies that will influence the cache.

Definition at line 325 of file OutputPage.php.

◆ $contentOverrideCallbacks

callable [] OutputPage::$contentOverrideCallbacks = []
private

Definition at line 310 of file OutputPage.php.

◆ $contentOverrides

array OutputPage::$contentOverrides = []
private

Map Title to Content.

Definition at line 307 of file OutputPage.php.

◆ $copyrightUrl

string null OutputPage::$copyrightUrl
private

The URL to send in a <link> element with rel=license.

Definition at line 301 of file OutputPage.php.

Referenced by getHeadLinksArray().

◆ $CSPNonce

string OutputPage::$CSPNonce
private

The nonce for Content-Security-Policy.

Definition at line 320 of file OutputPage.php.

Referenced by getCSPNonce().

◆ $displayTitle

string OutputPage::$displayTitle
private

The displayed title of the page.

Different from page title if overridden by display title magic word or hooks. Can contain safe HTML. Different from page title which may contain messages such as "Editing X" which is displayed in h1. This can be used for other places where the page name is referred on the page.

Definition at line 67 of file OutputPage.php.

Referenced by getDisplayTitle().

◆ $limitReportJSData

array OutputPage::$limitReportJSData = []
private

Profiling data.

Definition at line 304 of file OutputPage.php.

◆ $mAdditionalBodyClasses

array OutputPage::$mAdditionalBodyClasses = []
protected

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

Definition at line 150 of file OutputPage.php.

Referenced by headElement().

◆ $mAllowedModules

array OutputPage::$mAllowedModules
protected
Initial value:

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

See also
ResourceLoaderModule::$origin ResourceLoaderModule::ORIGIN_ALL is assumed unless overridden;

Definition at line 189 of file OutputPage.php.

◆ $mArticleBodyOnly

bool OutputPage::$mArticleBodyOnly = false
private

Flag if output should only contain the body of the article.

Definition at line 218 of file OutputPage.php.

Referenced by getArticleBodyOnly().

◆ $mBodytext

string OutputPage::$mBodytext = ''

Contains all of the "<body>" content.

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

Definition at line 73 of file OutputPage.php.

Referenced by getHTML(), output(), and prependHTML().

◆ $mCanonicalUrl

bool OutputPage::$mCanonicalUrl = false
protected

Definition at line 54 of file OutputPage.php.

Referenced by getCanonicalUrl(), and getHeadLinksArray().

◆ $mCategories

array OutputPage::$mCategories
protected
Initial value:
= [
'hidden' => []

Definition at line 118 of file OutputPage.php.

◆ $mCategoryLinks

array OutputPage::$mCategoryLinks = []
protected

Definition at line 115 of file OutputPage.php.

Referenced by getCategoryLinks().

◆ $mCdnMaxage

int OutputPage::$mCdnMaxage = 0
protected

Cache stuff.

Looks like mEnableClientCache

Definition at line 234 of file OutputPage.php.

◆ $mCdnMaxageLimit

int OutputPage::$mCdnMaxageLimit = INF
protected

Upper limit on mCdnMaxage.

Definition at line 236 of file OutputPage.php.

◆ $mContainsNewMagic

int OutputPage::$mContainsNewMagic = 0
protected

Definition at line 199 of file OutputPage.php.

◆ $mDoNothing

array bool OutputPage::$mDoNothing = false
protected

Whether output is disabled.

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

Definition at line 194 of file OutputPage.php.

Referenced by isDisabled().

◆ $mEnableClientCache

OutputPage::$mEnableClientCache = true
protected

Definition at line 215 of file OutputPage.php.

◆ $mEnableTOC

bool OutputPage::$mEnableTOC = false
private

Whether parser output contains a table of contents.

Definition at line 296 of file OutputPage.php.

Referenced by isTOCEnabled().

◆ $mFeedLinks

OutputPage::$mFeedLinks = []
private

Handles the Atom / RSS links.

We probably only support Atom in 2011.

See also
$wgAdvertisedFeedTypes

Definition at line 212 of file OutputPage.php.

Referenced by getSyndicationLinks().

◆ $mFeedLinksAppendQuery

OutputPage::$mFeedLinksAppendQuery = null
protected

Definition at line 182 of file OutputPage.php.

Referenced by getFeedAppendQuery().

◆ $mFileVersion

array OutputPage::$mFileVersion = null
protected

Definition at line 252 of file OutputPage.php.

Referenced by getFileVersion().

◆ $mFollowPolicy

OutputPage::$mFollowPolicy = 'follow'
private

Definition at line 265 of file OutputPage.php.

◆ $mHasCopyright

bool OutputPage::$mHasCopyright = false
private

Is the content subject to copyright.

Definition at line 88 of file OutputPage.php.

Referenced by showsCopyright().

◆ $mHeadItems

array OutputPage::$mHeadItems = []
protected

Array of elements in "<head>".

Parser might add its own headers!

Definition at line 147 of file OutputPage.php.

Referenced by getHeadItemsArray().

◆ $mHideNewSectionLink

bool OutputPage::$mHideNewSectionLink = false
protected

Definition at line 224 of file OutputPage.php.

Referenced by forceHideNewSectionLink().

◆ $mHTMLtitle

string OutputPage::$mHTMLtitle = ''
private

Stores contents of "<title>" tag.

Definition at line 76 of file OutputPage.php.

Referenced by getHTMLTitle().

◆ $mImageTimeKeys

array OutputPage::$mImageTimeKeys = []
protected

Definition at line 177 of file OutputPage.php.

Referenced by getFileSearchOptions().

◆ $mIndexPolicy

OutputPage::$mIndexPolicy = 'index'
private

Definition at line 264 of file OutputPage.php.

◆ $mIndicators

array array OutputPage::$mIndicators = []
protected

Definition at line 124 of file OutputPage.php.

Referenced by getIndicators(), and setIndicators().

◆ $mInlineStyles

string OutputPage::$mInlineStyles = ''
protected

Inline CSS styles.

Use addInlineStyle() sparingly

Definition at line 138 of file OutputPage.php.

Referenced by buildExemptModules().

◆ $mIsArticle

bool OutputPage::$mIsArticle = false
private

Is the displayed content related to the source of the corresponding wiki article.

Definition at line 82 of file OutputPage.php.

Referenced by isArticle().

◆ $mIsArticleRelated

bool OutputPage::$mIsArticleRelated = true
private

Stores "article flag" toggle.

Definition at line 85 of file OutputPage.php.

Referenced by isArticleRelated().

◆ $mJsConfigVars

array OutputPage::$mJsConfigVars = []
protected

Definition at line 171 of file OutputPage.php.

Referenced by getJsConfigVars().

◆ $mLanguageLinks

array OutputPage::$mLanguageLinks = []
private

Array of Interwiki Prefixed (non DB key) Titles (e.g.

'fr:Test page')

Definition at line 127 of file OutputPage.php.

Referenced by getLanguageLinks().

◆ $mLastModified

string OutputPage::$mLastModified = ''
protected

Used for sending cache control.

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

Definition at line 112 of file OutputPage.php.

◆ $mLinkHeader

OutputPage::$mLinkHeader = []
private

Link: header contents.

Definition at line 315 of file OutputPage.php.

◆ $mLinktags

array OutputPage::$mLinktags = []
protected

Definition at line 51 of file OutputPage.php.

Referenced by getLinkTags().

◆ $mMetatags

array OutputPage::$mMetatags = []
protected

Should be private.

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

Definition at line 48 of file OutputPage.php.

Referenced by getMetaTags().

◆ $mModules

array OutputPage::$mModules = []
protected

Definition at line 153 of file OutputPage.php.

◆ $mModuleStyles

array OutputPage::$mModuleStyles = []
protected

Definition at line 156 of file OutputPage.php.

◆ $mNewSectionLink

bool OutputPage::$mNewSectionLink = false
protected

Definition at line 221 of file OutputPage.php.

Referenced by showNewSectionLink().

◆ $mNoGallery

bool 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.

Definition at line 231 of file OutputPage.php.

◆ $mPageLinkTitle

string OutputPage::$mPageLinkTitle = ''

Used by skin template.

Example: $tpl->set( 'displaytitle', $out->mPageLinkTitle );

Definition at line 144 of file OutputPage.php.

◆ $mPageTitle

string OutputPage::$mPageTitle = ''
private

The contents of.

Definition at line 58 of file OutputPage.php.

Referenced by getPageTitle().

◆ $mParserOptions

ParserOptions OutputPage::$mParserOptions = null
protected

lazy initialised, use parserOptions()

Definition at line 205 of file OutputPage.php.

◆ $mPreventClickjacking

bool 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. Setters: $this->preventClickjacking() and $this->allowClickjacking().

Definition at line 243 of file OutputPage.php.

Referenced by getPreventClickjacking().

◆ $mPrintable

bool OutputPage::$mPrintable = false
private

We have to set isPrintable().

Some pages should never be printed (ex: redirections).

Definition at line 94 of file OutputPage.php.

Referenced by isPrintable().

◆ $mProperties

OutputPage::$mProperties = []
private

Additional key => value data.

Definition at line 286 of file OutputPage.php.

◆ $mRedirect

string OutputPage::$mRedirect = ''

Definition at line 103 of file OutputPage.php.

Referenced by getRedirect(), and output().

◆ $mRedirectCode

string OutputPage::$mRedirectCode = ''

Definition at line 180 of file OutputPage.php.

Referenced by output().

◆ $mRedirectedFrom

array Title OutputPage::$mRedirectedFrom = null
private

If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redirect.

Definition at line 281 of file OutputPage.php.

◆ $mResourceLoader

ResourceLoader OutputPage::$mResourceLoader
protected

Definition at line 159 of file OutputPage.php.

Referenced by getResourceLoader().

◆ $mRevisionId

int OutputPage::$mRevisionId = null
private

To include the variable {{REVISIONID}}.

Definition at line 246 of file OutputPage.php.

Referenced by getRevisionId().

◆ $mRevisionTimestamp

string OutputPage::$mRevisionTimestamp = null
private

Definition at line 249 of file OutputPage.php.

Referenced by getRevisionTimestamp().

◆ $mScripts

OutputPage::$mScripts = ''
private

Used for JavaScript (predates ResourceLoader)

Todo:
We should split JS / CSS.

mScripts content is inserted as is in "<head>" by Skin. This might contain either a link to a stylesheet or inline CSS.

Definition at line 135 of file OutputPage.php.

Referenced by getBottomScripts().

◆ $mStatusCode

int OutputPage::$mStatusCode
protected

Definition at line 106 of file OutputPage.php.

◆ $mSubtitle

array OutputPage::$mSubtitle = []
private

Contains the page subtitle.

Special pages usually have some links here. Don't confuse with site subtitle added by skins.

Definition at line 100 of file OutputPage.php.

◆ $mTarget

string null OutputPage::$mTarget = null
private

ResourceLoader target for load.php links.

If null, will be omitted

Definition at line 291 of file OutputPage.php.

Referenced by getTarget(), and warnModuleTargetFilter().

◆ $mTemplateIds

array OutputPage::$mTemplateIds = []
protected

Definition at line 174 of file OutputPage.php.

Referenced by getTemplateIds().

◆ $mVaryHeader

array OutputPage::$mVaryHeader
private
Initial value:
= [
'Accept-Encoding' => [ 'match=gzip' ]

Headers that cause the cache to vary.

Key is header name, value is an array of options for the Key header.

Definition at line 271 of file OutputPage.php.

◆ $rlClient

ResourceLoaderClientHtml OutputPage::$rlClient
private

Definition at line 162 of file OutputPage.php.

Referenced by getRlClient().

◆ $rlClientContext

ResourceLoaderContext OutputPage::$rlClientContext
private

Definition at line 165 of file OutputPage.php.

Referenced by getRlClientContext().

◆ $rlExemptStyleModules

array OutputPage::$rlExemptStyleModules
private

Definition at line 168 of file OutputPage.php.

◆ $styles

array 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 262 of file OutputPage.php.


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