MediaWiki  1.27.2
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=null)
 Constructor for OutputPage. More...
 
 addAcceptLanguage ()
 T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter existed in GET. More...
 
 addBacklinkSubtitle (Title $title, $query=[])
 Add a subtitle containing a backlink to a page. More...
 
 addCategoryLinks (array $categories)
 Add an array of categories, with names in the keys. More...
 
 addElement ($element, array $attribs=[], $contents= '')
 Shortcut for adding an Html::element via addHTML. More...
 
 addExtensionStyle ($url)
 Register and add a stylesheet from an extension directory. More...
 
 addFeedLink ($format, $href)
 Add a feed link to the page header. More...
 
 addHeadItem ($name, $value)
 Add or replace an header item 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...
 
 addMeta ($name, $val)
 Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:". More...
 
 addMetadataLink (array $linkarr)
 Add a new \<link\> with "rel" attribute set to "meta". More...
 
 addModuleMessages ($modules)
 Load messages of one or more ResourceLoader modules. More...
 
 addModules ($modules)
 Add one or more modules recognized by ResourceLoader. More...
 
 addModuleScripts ($modules)
 Add only JS of one or more modules recognized by ResourceLoader. More...
 
 addModuleStyles ($modules)
 Add only CSS of one or more modules recognized by ResourceLoader. More...
 
 addParserOutput ($parserOutput)
 Add everything from a ParserOutput object. More...
 
 addParserOutputContent ($parserOutput)
 Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput object, without any other metadata. More...
 
 addParserOutputMetadata ($parserOutput)
 Add all metadata associated with a ParserOutput object, but without the actual HTML. More...
 
 addParserOutputNoText ($parserOutput)
 Add a ParserOutput object, but without Html. More...
 
 addParserOutputText ($parserOutput)
 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, $version=null)
 Add a JavaScript file out of skins/common, or a given relative path. 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...
 
 addWikiTextTidy ($text, $linestart=true)
 Add wikitext with tidy enabled. More...
 
 addWikiTextTitle ($text, Title $title, $linestart, $tidy=false, $interface=false)
 Add wikitext with a custom Title object. More...
 
 addWikiTextTitleTidy ($text, &$title, $linestart=true)
 Add wikitext with a custom Title object and tidy enabled. More...
 
 addWikiTextWithTitle ($text, &$title, $linestart=true)
 Add wikitext with a custom Title object. More...
 
 allowClickjacking ()
 Turn off frame-breaking. More...
 
 buildCssLinks ()
 Build a set of "<link>" elements for the stylesheets specified in the $this->styles array. 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...
 
 enableTOC ($flag=true)
 Enables/disables TOC, doesn't override NOTOC 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 cookies that will influence on the cache. More...
 
 getCanonicalUrl ()
 Returns the URL to be used for the <link rel="canonical"> if one is set. More...
 
 getCategories ()
 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...
 
 getExternalHeadScripts ()
 <script src="..."> tags for "<head>". More...
 
 getExtStyle ()
 Get all styles added by extensions. 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...
 
 getHeadLinks ()
 
 getHeadLinksArray ()
 
 getHeadScripts ()
 JS stuff to put in the "<head>". More...
 
 getHTML ()
 Get the body HTML. More...
 
 getHTMLTitle ()
 Return the "HTML title", i.e. More...
 
 getIndicators ()
 Get the indicators associated with this page. More...
 
 getInlineHeadScripts ()
 <script>...</script> tags to put in "<head>". 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...
 
 getLinkTags ()
 Returns the current <link> tags. More...
 
 getMetadataAttribute ()
 Get the value of the "rel" attribute for metadata links. More...
 
 getMetaTags ()
 Returns the current <meta> tags. More...
 
 getModuleMessages ($filter=false, $position=null)
 Get the list of module messages to include on this page. More...
 
 getModules ($filter=false, $position=null, $param= 'mModules')
 Get the list of modules to include on this page. More...
 
 getModuleScripts ($filter=false, $position=null)
 Get the list of module JS to include on this page. More...
 
 getModuleStyles ($filter=false, $position=null)
 Get the list of module CSS to include on this page. More...
 
 getPageTitle ()
 Return the "page title", i.e. More...
 
 getPageTitleActionText ()
 Get the value of the "action text". 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...
 
 getScriptsForBottomQueue ($unused=null)
 JS stuff to put at the 'bottom', which goes at the bottom of the <body>. 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...
 
 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 ()
 
 lowerCdnMaxage ($maxage)
 Lower the value of the "s-maxage" part of the "Cache-control" HTTP header. More...
 
 makeResourceLoaderLink ($modules, $only, array $extraQuery=[])
 Construct neccecary html and loader preset states to load modules on a page. More...
 
 output ()
 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...
 
 parseInline ($text, $linestart=true, $interface=false)
 Parse wikitext, strip paragraphs, 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...
 
 rateLimited ()
 Turn off regular page output and return an error response for when rate limiting has triggered. More...
 
 readOnlyPage ()
 Display a page stating that the Wiki is in read-only mode. 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 ($v)
 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 ($v)
 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...
 
 setCopyrightUrl ($url)
 Set the copyright URL to send with the output. More...
 
 setETag ($tag)
 Set the value of the ETag HTTP header, only used if $wgUseETag is true. 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...
 
 setPageTitleActionText ($text)
 Set the new value of the "action text", this will be added to the "HTML title", separated from it with " - ". 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...
 
 setSquidMaxage ($maxage)
 
 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)
 
 showFileCopyError ($old, $new)
 
 showFileDeleteError ($name)
 
 showFileNotFoundError ($name)
 
 showFileRenameError ($old, $new)
 
 showLagWarning ($lag)
 Show a warning about slave lag. More...
 
 showNewSectionLink ()
 Show an "add new section" link? More...
 
 showPermissionsErrorPage (array $errors, $action=null)
 Output a standard permission error page. More...
 
 showUnexpectedValueError ($name, $val)
 
 userCanPreview ()
 To make it harder for someone to slip a user a fake user-JavaScript or user-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...
 
- 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 ()
 Get the Config object. More...
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 Get the Language object. More...
 
 getOutput ()
 Get the OutputPage object. More...
 
 getRequest ()
 Get the WebRequest object. More...
 
 getSkin ()
 Get the Skin object. More...
 
 getStats ()
 Get the Stats object. More...
 
 getTiming ()
 Get the Timing object. More...
 
 getTitle ()
 Get the Title object. More...
 
 getUser ()
 Get the User object. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ()
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 Set the IContextSource object. More...
 

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= '', $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...
 
 $mDebugtext = ''
 Holds the debug lines that will be output as comments in page source if $wgDebugComments is enabled. More...
 
bool $mNoGallery = false
 Comes from the parser. More...
 
string $mPageLinkTitle = ''
 Used by skin template. More...
 
string $mPagetitle = ''
 Should be private - has getter and setter. More...
 
string $mRedirect = ''
 
string $mRedirectCode = ''
 

Protected Member Functions

 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...
 
 styleLink ($style, array $options)
 Generate \<link\> tags for stylesheets. More...
 

Static Protected Member Functions

static getHtmlFromLoaderLinks (array $links)
 Build html output from an array of links from makeResourceLoaderLink. More...
 

Protected Attributes

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
 
array $mExtStyles = []
 Additional stylesheets. More...
 
 $mFeedLinksAppendQuery = null
 
array $mFileVersion = null
 
array $mHeadItems = []
 Array of elements in "<head>". More...
 
bool $mHideNewSectionLink = false
 
array $mImageTimeKeys = []
 
array $mIndicators = []
 
string $mInlineStyles = ''
 Inline CSS styles. More...
 
 $mJQueryDone = false
 Whether jQuery is already handled. More...
 
array $mJsConfigVars = []
 
string $mLastModified = ''
 Variable mLastModified and mEtag are used for sending cache control. More...
 
array $mLinktags = []
 
array $mMetatags = []
 Should be private. More...
 
array $mModules = []
 
array $mModuleScripts = []
 
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

 feedLink ($type, $url, $text)
 Generate a "<link rel/>" for a feed. More...
 

Private Attributes

string null $copyrightUrl
 The URL to send in a <link> element with rel=copyright. More...
 
bool $mArticleBodyOnly = false
 Flag if output should only contain the body of the article. More...
 
bool $mEnableSectionEditLinks = true
 Whether parser output should contain section edit links. More...
 
bool $mEnableTOC = true
 Whether parser output should contain table of contents. More...
 
 $mETag = false
 Contains an HTTP Entity Tags (see RFC 2616 section 3.13) which is used as a unique identifier for the content. More...
 
 $mFeedLinks = []
 Handles the Atom / RSS links. More...
 
 $mFollowPolicy = 'follow'
 
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...
 
string $mPageTitleActionText = ''
 
bool $mPrintable = false
 We have to set isPrintable(). More...
 
 $mProperties = []
 Additional key => value data. More...
 
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...
 
 $mVaryHeader
 

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

Constructor & Destructor Documentation

OutputPage::__construct ( IContextSource  $context = null)

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 | null$context

Definition at line 314 of file OutputPage.php.

References ContextSource\$context, ContextSource\setContext(), and wfDeprecated().

Member Function Documentation

OutputPage::addAcceptLanguage ( )

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

For example: /w/index.php?title=Main_page should always be served; but /w/index.php?title=Main_page&variant=zh-cn should never be served.

Definition at line 2082 of file OutputPage.php.

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

Referenced by sendCacheControl().

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

References $query, and addSubtitle().

OutputPage::addCategoryLinks ( array  $categories)

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

Parameters
array$categoriesMapping category name => sort key

Definition at line 1266 of file OutputPage.php.

References $dbr, $res, $title, $type, $wgContLang, as, DB_SLAVE, ContextSource\getConfig(), global, Linker\link(), Title\makeTitleSafe(), NS_CATEGORY, Hooks\run(), LinkBatch\setArray(), LinkCache\singleton(), string, and wfGetDB().

Referenced by addParserOutputMetadata(), and setCategoryLinks().

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

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

OutputPage::addExtensionStyle (   $url)

Register and add a stylesheet from an extension directory.

Deprecated:
since 1.27 use addModuleStyles() or addStyle() instead
Parameters
string$urlPath to sheet. Provide either a full url (beginning with 'http', etc) or a relative path from the document root (beginning with '/'). Otherwise it behaves identically to addStyle() and draws from the /skins folder.

Definition at line 475 of file OutputPage.php.

References wfDeprecated().

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

References ContextSource\getConfig().

OutputPage::addHeadItem (   $name,
  $value 
)

Add or replace an header 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 682 of file OutputPage.php.

References $name, and $value.

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

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

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

References Html\inlineScript().

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

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

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$value[optional] Value of the configuration variable

Definition at line 3141 of file OutputPage.php.

References $key, $keys, $value, and as.

Referenced by addParserOutputContent(), and addParserOutputMetadata().

OutputPage::addLanguageLinks ( array  $newLinkArray)

Add new language links.

Parameters
array$newLinkArrayAssociative array mapping language code to the page name

Definition at line 1238 of file OutputPage.php.

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

Referenced by addMetadataLink().

OutputPage::addMeta (   $name,
  $val 
)

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

Parameters
string$nameTag name
string$valTag value

Definition at line 372 of file OutputPage.php.

References $name.

Referenced by enableOOUI().

OutputPage::addMetadataLink ( array  $linkarr)

Add a new \<link\> with "rel" attribute set to "meta".

Parameters
array$linkarrAssociative array mapping attribute names to their values, both keys and values will be escaped, and the "rel" attribute will be automatically added

Definition at line 414 of file OutputPage.php.

References addLink(), and getMetadataAttribute().

OutputPage::addModuleMessages (   $modules)

Load messages of one or more ResourceLoader modules.

Deprecated:
since 1.26 Use addModules() instead
Parameters
string | array$modulesModule name (string) or array of module names

Definition at line 641 of file OutputPage.php.

References wfDeprecated().

OutputPage::addModules (   $modules)

Add one or more modules recognized by ResourceLoader.

Modules added through this function will be loaded by ResourceLoader when the page loads.

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

Definition at line 570 of file OutputPage.php.

References array().

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

OutputPage::addModuleScripts (   $modules)

Add only JS of one or more modules recognized by ResourceLoader.

Module scripts added through this function will be loaded by ResourceLoader when the page loads.

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

Definition at line 593 of file OutputPage.php.

References array().

Referenced by addParserOutputContent(), and addParserOutputMetadata().

OutputPage::addModuleStyles (   $modules)

Add only CSS of one or more modules recognized by ResourceLoader.

Module styles added through this function will be added using standard link CSS tags, rather than as a combined Javascript and CSS package. Thus, they will load when JavaScript is disabled (unless CSS also happens to be disabled).

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

Definition at line 618 of file OutputPage.php.

References array().

Referenced by ListToggle\__construct(), addHelpLink(), addParserOutputContent(), addParserOutputMetadata(), enableOOUI(), SkinFallback\setupSkinUserCss(), SkinApi\setupSkinUserCss(), and SkinTemplate\setupSkinUserCss().

OutputPage::addParserOutput (   $parserOutput)

Add everything from a ParserOutput object.

Parameters
ParserOutput$parserOutput

Definition at line 1851 of file OutputPage.php.

References $parserOutput, addParserOutputMetadata(), and addParserOutputText().

Referenced by addWikiTextTitle().

OutputPage::addParserOutputContent (   $parserOutput)

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

Definition at line 1824 of file OutputPage.php.

References $parserOutput, addJsConfigVars(), addModules(), addModuleScripts(), addModuleStyles(), and addParserOutputText().

Referenced by SpecialExpandTemplates\showHtmlPreview().

OutputPage::addParserOutputMetadata (   $parserOutput)

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

This includes categories, language links, ResourceLoader modules, effects of certain magic words, and so on.

Since
1.24
Parameters
ParserOutput$parserOutput

Definition at line 1764 of file OutputPage.php.

References $parserOutput, addCategoryLinks(), addJsConfigVars(), addModules(), addModuleScripts(), addModuleStyles(), array(), as, enableClientCache(), enableOOUI(), ContextSource\getConfig(), ContextSource\getTitle(), list, Hooks\run(), and setIndicators().

Referenced by addParserOutput(), and addParserOutputNoText().

OutputPage::addParserOutputNoText (   $parserOutput)

Add a ParserOutput object, but without Html.

Deprecated:
since 1.24, use addParserOutputMetadata() instead.
Parameters
ParserOutput$parserOutput

Definition at line 1751 of file OutputPage.php.

References $parserOutput, addParserOutputMetadata(), and wfDeprecated().

OutputPage::addParserOutputText (   $parserOutput)

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

Since
1.24
Parameters
ParserOutput$parserOutput

Definition at line 1840 of file OutputPage.php.

References $parserOutput, addHTML(), and Hooks\run().

Referenced by addParserOutput(), and addParserOutputContent().

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$textText of the link (input is not escaped)
array$optionsOptions array to pass to Linker

Definition at line 2610 of file OutputPage.php.

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

Referenced by returnToMain().

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

Referenced by addScriptFile().

OutputPage::addScriptFile (   $file,
  $version = null 
)

Add a JavaScript file out of skins/common, or a given relative path.

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

Parameters
string$fileFilename in skins/common or complete on-server path (/foo/bar.js)
string$versionStyle version of the file. Defaults to $wgStyleVersion

Definition at line 499 of file OutputPage.php.

References $path, $version, addScript(), ContextSource\getConfig(), Html\linkedScript(), and wfAppendQuery().

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

References $dir, and $options.

Referenced by buildCssLinksArray().

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

References ContextSource\getContext().

Referenced by addBacklinkSubtitle(), and setSubtitle().

OutputPage::addTemplate ( $template)

Add the output of a QuickTemplate to the output buffer.

Parameters
QuickTemplate$template

Definition at line 1868 of file OutputPage.php.

References $template, and addHTML().

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

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

OutputPage::addWikiMsg ( )

Add a wikitext-formatted message to the output.

This is equivalent to:

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

Definition at line 3939 of file OutputPage.php.

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

Referenced by versionRequired().

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

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

Referenced by addWikiMsg(), and showErrorPage().

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

Definition at line 1674 of file OutputPage.php.

References $title, addWikiTextTitle(), and ContextSource\getTitle().

Referenced by showPermissionsErrorPage(), and wrapWikiMsg().

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

Add wikitext with tidy enabled.

Parameters
string$textWikitext
bool$linestartIs this the start of a line?

Definition at line 1710 of file OutputPage.php.

References $title, addWikiTextTitleTidy(), and ContextSource\getTitle().

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

Add wikitext with a custom Title object.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?
bool$tidyWhether to use tidy
bool$interfaceWhether it is an interface message (for example disables conversion)

Definition at line 1725 of file OutputPage.php.

References $parserOutput, $wgParser, addParserOutput(), global, and parserOptions().

Referenced by addWikiText(), addWikiTextTitleTidy(), and addWikiTextWithTitle().

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

Add wikitext with a custom Title object and tidy enabled.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?

Definition at line 1700 of file OutputPage.php.

References $title, and addWikiTextTitle().

Referenced by addWikiTextTidy().

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

Add wikitext with a custom Title object.

Parameters
string$textWikitext
Title$title
bool$linestartIs this the start of a line?

Definition at line 1689 of file OutputPage.php.

References $title, and addWikiTextTitle().

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

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

References $query, Title\isRedirect(), Linker\link(), and wfMessage().

Referenced by RevertAction\getDescription().

OutputPage::buildCssLinks ( )

Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.

These will be applied to various media & IE conditionals.

Returns
string

Definition at line 3661 of file OutputPage.php.

References $link, $mInlineStyles, $name, $resourceLoader, $wgContLang, as, buildCssLinksArray(), Html\element(), ContextSource\getConfig(), ContextSource\getLanguage(), getModuleStyles(), ContextSource\getRequest(), getResourceLoader(), ContextSource\getSkin(), ContextSource\getTitle(), global, Html\inlineStyle(), makeResourceLoaderLink(), ResourceLoaderModule\TYPE_STYLES, and userCanPreview().

Referenced by headElement().

OutputPage::buildCssLinksArray ( )
Returns
array

Definition at line 3768 of file OutputPage.php.

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

Referenced by buildCssLinks().

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

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

OutputPage::clearHTML ( )

Clear the body HTML.

Definition at line 1518 of file OutputPage.php.

Referenced by prepareErrorPage().

OutputPage::clearSubtitle ( )

Clear the subtitles.

Definition at line 1048 of file OutputPage.php.

Referenced by prepareErrorPage(), and setSubtitle().

OutputPage::disable ( )

Disable output completely, i.e.

calling output() will have no effect

Definition at line 1081 of file OutputPage.php.

Referenced by checkLastModified().

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

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

OutputPage::enableClientCache (   $state)

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

Parameters
bool$state
Returns
bool

Definition at line 1964 of file OutputPage.php.

References wfSetVar().

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

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

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

Referenced by addParserOutputMetadata().

OutputPage::enableSectionEditLinks (   $flag = true)

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

Parameters
bool$flag
Since
1.23

Definition at line 4029 of file OutputPage.php.

OutputPage::enableTOC (   $flag = true)

Enables/disables TOC, doesn't override NOTOC

Parameters
bool$flag
Since
1.22

Definition at line 4012 of file OutputPage.php.

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

References Html\element().

Referenced by getHeadLinksArray().

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$positionIf not null, only return modules with this position
string$type
Returns
array

Definition at line 530 of file OutputPage.php.

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

Referenced by getModules().

OutputPage::forceHideNewSectionLink ( )

Forcibly hide the new section link?

Returns
bool

Definition at line 1108 of file OutputPage.php.

References $mHideNewSectionLink.

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

Format a list of error messages.

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

Definition at line 2496 of file OutputPage.php.

References as, and ContextSource\msg().

Referenced by showPermissionsErrorPage().

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

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

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

OutputPage::getArticleBodyOnly ( )

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

Returns
bool

Definition at line 721 of file OutputPage.php.

References $mArticleBodyOnly.

OutputPage::getBottomScripts ( )

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

Returns
string

Definition at line 3121 of file OutputPage.php.

References getScriptsForBottomQueue().

OutputPage::getCacheVaryCookies ( )

Get the list of cookies that will influence on the cache.

Returns
array

Definition at line 1973 of file OutputPage.php.

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

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

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

References $mCanonicalUrl.

OutputPage::getCategories ( )

Get the list of category names this page belongs to.

Returns
array Array of strings

Definition at line 1365 of file OutputPage.php.

References $mCategories.

Referenced by getJSVars().

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

References $mCategoryLinks.

OutputPage::getExternalHeadScripts ( )

<script src="..."> tags for "<head>".

This is the startup module and other modules marked with position 'top'.

Returns
string HTML fragment

Definition at line 2974 of file OutputPage.php.

References makeResourceLoaderLink(), and ResourceLoaderModule\TYPE_SCRIPTS.

Referenced by getHeadScripts(), and headElement().

OutputPage::getExtStyle ( )

Get all styles added by extensions.

Deprecated:
since 1.27
Returns
array

Definition at line 486 of file OutputPage.php.

References $mExtStyles, and wfDeprecated().

OutputPage::getFeedAppendQuery ( )

Will currently always return null.

Returns
null

Definition at line 1182 of file OutputPage.php.

References $mFeedLinksAppendQuery.

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

References $mImageTimeKeys.

OutputPage::getFileVersion ( )

Get the displayed file version.

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

Definition at line 1641 of file OutputPage.php.

References $mFileVersion.

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

Definition at line 2151 of file OutputPage.php.

References ContextSource\getConfig().

Referenced by getJSVars(), and output().

OutputPage::getHeadItemsArray ( )

Get an array of head items.

Returns
array

Definition at line 666 of file OutputPage.php.

References $mHeadItems.

Referenced by ParserOutput\addOutputPageMetadata().

OutputPage::getHeadLinks ( )
Returns
string HTML tag links to be put in the header.
Deprecated:
since 1.24 Use OutputPage::headElement or if you have to, OutputPage::getHeadLinksArray directly.

Definition at line 3595 of file OutputPage.php.

References getHeadLinksArray(), and wfDeprecated().

OutputPage::getHeadScripts ( )

JS stuff to put in the "<head>".

This is the startup module, config vars and modules marked with position 'top'

Returns
string HTML fragment

Definition at line 2964 of file OutputPage.php.

References getExternalHeadScripts(), and getInlineHeadScripts().

OutputPage::getHTML ( )

Get the body HTML.

Returns
string HTML

Definition at line 1527 of file OutputPage.php.

References $mBodytext.

Referenced by SkinTemplate\setupSkinUserCss().

static OutputPage::getHtmlFromLoaderLinks ( array  $links)
staticprotected

Build html output from an array of links from makeResourceLoaderLink.

Parameters
array$links
Returns
string HTML

Definition at line 2935 of file OutputPage.php.

References $html, $link, as, ResourceLoader\makeInlineScript(), and ResourceLoader\makeLoaderStateScript().

OutputPage::getHTMLTitle ( )

Return the "HTML title", i.e.

the content of the "<title>" tag.

Returns
string

Definition at line 938 of file OutputPage.php.

References $mHTMLtitle.

Referenced by headElement().

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

References $mIndicators.

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

References $mJsConfigVars.

Referenced by ParserOutput\addOutputPageMetadata(), and 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 3161 of file OutputPage.php.

References $lang, $title, $type, $user, $vars, $wgContLang, as, ContextSource\canUseWikiPage(), MWNamespace\exists(), Action\getActionName(), MWNamespace\getCanonicalName(), getCategories(), ContextSource\getContext(), getFrameOptions(), getJsConfigVars(), WebRequest\getRequestId(), getRevisionId(), ContextSource\getSkin(), ContextSource\getTitle(), ContextSource\getUser(), ContextSource\getWikiPage(), global, isArticle(), list, NS_SPECIAL, SpecialPageFactory\resolveAlias(), Hooks\run(), TS_UNIX, and wfTimestampOrNull().

Referenced by getInlineHeadScripts().

OutputPage::getKeyHeader ( )

Get a complete Key header.

Returns
string

Definition at line 2048 of file OutputPage.php.

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

Referenced by sendCacheControl().

OutputPage::getLanguageLinks ( )

Get the list of language links.

Returns
array Array of Interwiki Prefixed (non DB key) Titles (e.g. 'fr:Test page')

Definition at line 1257 of file OutputPage.php.

References $mLanguageLinks.

OutputPage::getLinkTags ( )

Returns the current <link> tags.

Since
1.25
Returns
array

Definition at line 403 of file OutputPage.php.

References $mLinktags.

OutputPage::getMetadataAttribute ( )

Get the value of the "rel" attribute for metadata links.

Returns
string

Definition at line 444 of file OutputPage.php.

Referenced by addMetadataLink().

OutputPage::getMetaTags ( )

Returns the current <meta> tags.

Since
1.25
Returns
array

Definition at line 382 of file OutputPage.php.

References $mMetatags.

OutputPage::getModuleMessages (   $filter = false,
  $position = null 
)

Get the list of module messages to include on this page.

Deprecated:
since 1.26 Obsolete
Parameters
bool$filter
string | null$position
Returns
array Array of module names

Definition at line 630 of file OutputPage.php.

References wfDeprecated().

OutputPage::getModules (   $filter = false,
  $position = null,
  $param = 'mModules' 
)

Get the list of modules to include on this page.

Parameters
bool$filterWhether to filter out insufficiently trustworthy modules
string | null$positionIf not null, only return modules with this position
string$param
Returns
array Array of module names

Definition at line 556 of file OutputPage.php.

References filterModules().

Referenced by ParserOutput\addOutputPageMetadata(), getInlineHeadScripts(), getModuleScripts(), getModuleStyles(), and getScriptsForBottomQueue().

OutputPage::getModuleScripts (   $filter = false,
  $position = null 
)

Get the list of module JS to include on this page.

Parameters
bool$filter
string | null$position
Returns
array Array of module names

Definition at line 582 of file OutputPage.php.

References getModules().

Referenced by ParserOutput\addOutputPageMetadata(), getInlineHeadScripts(), and getScriptsForBottomQueue().

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

Get the list of module CSS to include on this page.

Parameters
bool$filter
string | null$position
Returns
array Array of module names

Definition at line 605 of file OutputPage.php.

References getModules().

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

OutputPage::getPageTitle ( )

Return the "page title", i.e.

the content of the \<h1\> tag.

Returns
string

Definition at line 983 of file OutputPage.php.

References $mPagetitle.

Referenced by headElement().

OutputPage::getPageTitleActionText ( )

Get the value of the "action text".

Returns
string

Definition at line 915 of file OutputPage.php.

References $mPageTitleActionText.

OutputPage::getPreventClickjacking ( )

Get the prevent-clickjacking flag.

Since
1.24
Returns
bool

Definition at line 2140 of file OutputPage.php.

References $mPreventClickjacking.

Referenced by ParserOutput\addOutputPageMetadata().

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

References $name.

OutputPage::getRedirect ( )

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

Returns
string

Definition at line 340 of file OutputPage.php.

References $mRedirect.

OutputPage::getResourceLoader ( )

Get a ResourceLoader object associated with this OutputPage.

Returns
ResourceLoader

Definition at line 2740 of file OutputPage.php.

References $mResourceLoader, and ContextSource\getConfig().

Referenced by buildCssLinks(), filterModules(), and makeResourceLoaderLink().

OutputPage::getRevisionId ( )

Get the displayed revision ID.

Returns
int

Definition at line 1597 of file OutputPage.php.

References $mRevisionId.

Referenced by getJSVars().

OutputPage::getRevisionTimestamp ( )

Get the timestamp of displayed revision.

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

Returns
string|null

Definition at line 1618 of file OutputPage.php.

References $mRevisionTimestamp.

OutputPage::getScriptsForBottomQueue (   $unused = null)

JS stuff to put at the 'bottom', which goes at the bottom of the <body>.

These are modules marked with position 'bottom', legacy scripts ($this->mScripts), site JS, and user JS.

Parameters
bool$unusedPreviously used to let this method change its output based on whether it was called by getExternalHeadScripts() or getBottomScripts().
Returns
string

Definition at line 3049 of file OutputPage.php.

References $mScripts, Xml\encodeJsCall(), ContextSource\getConfig(), getModules(), getModuleScripts(), ContextSource\getRequest(), ContextSource\getTitle(), ResourceLoader\makeInlineScript(), makeResourceLoaderLink(), ResourceLoaderModule\TYPE_COMBINED, ResourceLoaderModule\TYPE_SCRIPTS, and userCanPreview().

Referenced by getBottomScripts().

OutputPage::getSubtitle ( )

Get the subtitle.

Returns
string

Definition at line 1057 of file OutputPage.php.

OutputPage::getSyndicationLinks ( )

Return URLs for each supported syndication format for this page.

Returns
array Associating format keys with URLs

Definition at line 1173 of file OutputPage.php.

References $mFeedLinks.

Referenced by getHeadLinksArray().

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

Definition at line 648 of file OutputPage.php.

References $mTarget.

OutputPage::getTemplateIds ( )

Get the templates used on this page.

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

Definition at line 1651 of file OutputPage.php.

References $mTemplateIds.

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

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

Referenced by sendCacheControl().

OutputPage::hasHeadItem (   $name)

Check if the header item $name is already set.

Parameters
string$nameItem name
Returns
bool

Definition at line 692 of file OutputPage.php.

References $name.

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

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

Referenced by sendCacheControl().

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

References $mIsarticle.

Referenced by getJSVars().

OutputPage::isArticleRelated ( )

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

Returns
bool

Definition at line 1228 of file OutputPage.php.

References $mIsArticleRelated.

Referenced by getHeadLinksArray().

OutputPage::isDisabled ( )

Return whether the output will be completely disabled.

Returns
bool

Definition at line 1090 of file OutputPage.php.

References $mDoNothing.

OutputPage::isPrintable ( )

Return whether the page is "printable".

Returns
bool

Definition at line 1074 of file OutputPage.php.

References $mPrintable.

Referenced by makeResourceLoaderLink(), and sendCacheControl().

OutputPage::isSyndicated ( )

Should we output feed links for this page?

Returns
bool

Definition at line 1165 of file OutputPage.php.

Referenced by SkinTemplate\setupSkinUserCss().

OutputPage::isTOCEnabled ( )
Returns
bool
Since
1.22

Definition at line 4020 of file OutputPage.php.

References $mEnableTOC.

OutputPage::lowerCdnMaxage (   $maxage)

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

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

Definition at line 1952 of file OutputPage.php.

References setCdnMaxage().

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

Construct neccecary html and loader preset states to load modules on a page.

Use getHtmlFromLoaderLinks() to convert this array to HTML.

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
array A list of HTML strings and array of client loader preset states

Definition at line 2760 of file OutputPage.php.

References ContextSource\$context, $key, $link, $mTarget, $name, $query, $resourceLoader, $source, $user, $version, array(), as, Html\element(), Xml\encodeJsCall(), getAllowedModules(), ContextSource\getLanguage(), ContextSource\getRequest(), getResourceLoader(), ContextSource\getSkin(), ContextSource\getUser(), ResourceLoader\inDebugMode(), Html\inlineStyle(), isPrintable(), Html\linkedStyle(), ResourceLoader\makeInlineScript(), ResourceLoader\makeLoaderQuery(), ResourceLoader\makePackedModulesString(), Html\rawElement(), ResourceLoaderModule\TYPE_COMBINED, ResourceLoaderModule\TYPE_SCRIPTS, and ResourceLoaderModule\TYPE_STYLES.

Referenced by buildCssLinks(), getExternalHeadScripts(), getInlineHeadScripts(), and getScriptsForBottomQueue().

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

Parse wikitext and return the HTML.

Parameters
string$text
bool$linestartIs this the start of a line?
bool$interfaceUse interface language ($wgLang instead of $wgContLang) while parsing language sensitive magic words like GRAMMAR and PLURAL. This also disables LanguageConverter.
Language$languageTarget language object, will override $interface
Exceptions
MWException
Returns
string HTML

Definition at line 1884 of file OutputPage.php.

References $parserOutput, $wgParser, ContextSource\getTitle(), global, and parserOptions().

Referenced by parseInline(), and showPermissionsErrorPage().

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

Parse wikitext, strip paragraphs, and return the HTML.

Parameters
string$text
bool$linestartIs this the start of a line?
bool$interfaceUse interface language ($wgLang instead of $wgContLang) while parsing language sensitive magic words like GRAMMAR and PLURAL
Returns
string HTML

Definition at line 1924 of file OutputPage.php.

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

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
Returns
ParserOptions

Definition at line 1538 of file OutputPage.php.

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

Referenced by addWikiTextTitle(), and parse().

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

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

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

OutputPage::prependHTML (   $text)

Prepend $text to the body HTML.

Parameters
string$textHTML

Definition at line 1489 of file OutputPage.php.

References $mBodytext.

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

OutputPage::rateLimited ( )

Turn off regular page output and return an error response for when rate limiting has triggered.

Deprecated:
since 1.25; throw the exception directly

Definition at line 2551 of file OutputPage.php.

References wfDeprecated().

OutputPage::readOnlyPage ( )

Display a page stating that the Wiki is in read-only mode.

Should only be called after wfReadOnly() has returned true.

Historically, this function was used to show the source of the page that the user was trying to edit and also permissions error messages. The relevant code was moved into EditPage in 1.19 (r102024 / d83c2a431c2a) and removed here in 1.25.

Deprecated:
since 1.25; throw the exception directly
Exceptions
ReadOnlyError

Definition at line 2537 of file OutputPage.php.

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

Redirect to $url rather than displaying the normal page.

Parameters
string$urlURL
string$responsecodeHTTP status code

Definition at line 329 of file OutputPage.php.

Referenced by WebInstaller\execute().

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

References $type, and getAllowedModules().

Referenced by disallowUserJs().

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

Definition at line 2624 of file OutputPage.php.

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

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

OutputPage::sectionEditLinksEnabled ( )
Returns
bool
Since
1.23

Definition at line 4037 of file OutputPage.php.

References $mEnableSectionEditLinks.

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

OutputPage::setArticleFlag (   $v)

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

Definition at line 1193 of file OutputPage.php.

OutputPage::setArticleRelated (   $v)

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

Definition at line 1216 of file OutputPage.php.

Referenced by prepareErrorPage().

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

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

References addCategoryLinks().

Referenced by SpecialExpandTemplates\showHtmlPreview().

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

Referenced by lowerCdnMaxage(), and setSquidMaxage().

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

OutputPage::setETag (   $tag)

Set the value of the ETag HTTP header, only used if $wgUseETag is true.

Parameters
string$tagValue of "ETag" header

Definition at line 701 of file OutputPage.php.

References $tag.

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

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

Referenced by setSyndicated().

OutputPage::setFileVersion (   $file)

Set the displayed file version.

Parameters
File | bool$file
Returns
mixed Previous value

Definition at line 1628 of file OutputPage.php.

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

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

Referenced by setRobotPolicy().

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

References $name, and ContextSource\getContext().

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

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

Referenced by setRobotPolicy().

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

References $mIndicators.

Referenced by addHelpLink(), and addParserOutputMetadata().

OutputPage::setLanguageLinks ( array  $newLinkArray)

Reset the language links and add new language links.

Parameters
array$newLinkArrayAssociative array mapping language code to the page name

Definition at line 1248 of file OutputPage.php.

OutputPage::setLastModified (   $timestamp)

Override the last modified timestamp.

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

Definition at line 849 of file OutputPage.php.

References $timestamp, TS_RFC2822, and wfTimestamp().

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

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

Referenced by prepareErrorPage().

OutputPage::setPageTitleActionText (   $text)

Set the new value of the "action text", this will be added to the "HTML title", separated from it with " - ".

Parameters
string$textNew value of the "action text"

Definition at line 906 of file OutputPage.php.

OutputPage::setPrintable ( )

Set the page as printable, i.e.

it'll be displayed with all print styles included

Definition at line 1065 of file OutputPage.php.

OutputPage::setProperty (   $name,
  $value 
)

Set an additional output property.

Since
1.21
Parameters
string$name
mixed$value

Definition at line 732 of file OutputPage.php.

References $name, and $value.

OutputPage::setRedirectedFrom (   $t)

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

Parameters
Title$t

Definition at line 947 of file OutputPage.php.

References $t.

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$revidAn positive integer, or null
Returns
mixed Previous value

Definition at line 1587 of file OutputPage.php.

References wfSetVar().

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

References $timestamp, and wfSetVar().

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

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

Referenced by prepareErrorPage().

OutputPage::setSquidMaxage (   $maxage)
Parameters
$maxage
Deprecated:
since 1.27 Use setCdnMaxage() instead

Definition at line 1933 of file OutputPage.php.

References setCdnMaxage().

OutputPage::setStatusCode (   $statusCode)

Set the HTTP status code to send with the output.

Parameters
int$statusCode

Definition at line 361 of file OutputPage.php.

OutputPage::setSubtitle (   $str)

Replace the subtitle with $str.

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

Definition at line 1001 of file OutputPage.php.

References addSubtitle(), and clearSubtitle().

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

References setFeedAppendQuery().

OutputPage::setTarget (   $target)

Sets ResourceLoader target for load.php links.

If null, will be omitted

Parameters
string | null$target

Definition at line 657 of file OutputPage.php.

OutputPage::setTitle ( Title  $t)

Set the Title object to use.

Parameters
Title$t

Definition at line 992 of file OutputPage.php.

References ContextSource\getContext().

static OutputPage::setupOOUI (   $skinName = '',
  $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 4048 of file OutputPage.php.

References $dir, and ExtensionRegistry\getInstance().

Referenced by Parser\enableOOUI().

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

Output a standard error page.

showErrorPage( 'titlemsg', 'pagetextmsg' ); showErrorPage( 'titlemsg', 'pagetextmsg', array( '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 2383 of file OutputPage.php.

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

OutputPage::showFatalError (   $message)
OutputPage::showFileCopyError (   $old,
  $new 
)

Definition at line 2586 of file OutputPage.php.

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

OutputPage::showFileDeleteError (   $name)

Definition at line 2594 of file OutputPage.php.

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

OutputPage::showFileNotFoundError (   $name)

Definition at line 2598 of file OutputPage.php.

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

OutputPage::showFileRenameError (   $old,
  $new 
)

Definition at line 2590 of file OutputPage.php.

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

OutputPage::showLagWarning (   $lag)

Show a warning about slave 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$lagSlave lag

Definition at line 2565 of file OutputPage.php.

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

OutputPage::showNewSectionLink ( )

Show an "add new section" link?

Returns
bool

Definition at line 1099 of file OutputPage.php.

References $mNewSectionLink.

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

Output a standard permission error page.

Parameters
array$errorsError message keys
string$actionAction that was denied or null if unknown

Definition at line 2410 of file OutputPage.php.

References $query, $request, addHTML(), addWikiText(), formatPermissionsErrorMessage(), ContextSource\getRequest(), SpecialPage\getTitleFor(), ContextSource\getUser(), User\groupHasPermission(), Linker\linkKnown(), ContextSource\msg(), Title\newFromText(), Title\newMainPage(), parse(), prepareErrorPage(), returnToMain(), and wfArrayToCgi().

OutputPage::showUnexpectedValueError (   $name,
  $val 
)

Definition at line 2582 of file OutputPage.php.

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

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

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

Referenced by buildCssLinksArray().

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

References $wgRequest, as, and global.

Referenced by OutputPageTest\assertTransformCssMediaCase().

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$remotePathURL 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 3878 of file OutputPage.php.

References wfLogWarning().

Referenced by CSSMin\remapOne().

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

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

Referenced by ResourceLoaderFileModule\getScriptURLsForDebug(), ResourceLoaderSkinModule\getStyles(), and ResourceLoaderFileModule\getStyleURLsForDebug().

OutputPage::userCanPreview ( )

To make it harder for someone to slip a user a fake user-JavaScript or user-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 3288 of file OutputPage.php.

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

Referenced by buildCssLinks(), and getScriptsForBottomQueue().

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

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

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->addWikiText( "<div class='error'>\\n" . wfMessage( 'some-error' )->plain() . "\\n</div>" );

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

Parameters
string$wrap

Definition at line 3982 of file OutputPage.php.

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

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

Member Data Documentation

string null OutputPage::$copyrightUrl
private

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

Definition at line 306 of file OutputPage.php.

Referenced by getHeadLinksArray().

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

bool OutputPage::$mArticleBodyOnly = false
private

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

Definition at line 215 of file OutputPage.php.

Referenced by getArticleBodyOnly().

string OutputPage::$mBodytext = ''

Contains all of the "<body>" content.

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

Definition at line 67 of file OutputPage.php.

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

bool OutputPage::$mCanonicalUrl = false
protected

Definition at line 50 of file OutputPage.php.

Referenced by getCanonicalUrl(), and getHeadLinksArray().

array OutputPage::$mCategories = []
protected

Definition at line 127 of file OutputPage.php.

Referenced by getCategories().

array OutputPage::$mCategoryLinks = []
protected

Definition at line 124 of file OutputPage.php.

Referenced by getCategoryLinks().

int OutputPage::$mCdnMaxage = 0
protected

Cache stuff.

Looks like mEnableClientCache

Definition at line 234 of file OutputPage.php.

int OutputPage::$mCdnMaxageLimit = INF
protected

Upper limit on mCdnMaxage.

Definition at line 236 of file OutputPage.php.

int OutputPage::$mContainsNewMagic = 0
protected

Definition at line 196 of file OutputPage.php.

OutputPage::$mDebugtext = ''

Holds the debug lines that will be output as comments in page source if $wgDebugComments is enabled.

See also $wgShowDebug.

Deprecated:
since 1.20; use MWDebug class instead.

Definition at line 74 of file OutputPage.php.

array bool OutputPage::$mDoNothing = false
protected

Whether output is disabled.

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

Definition at line 191 of file OutputPage.php.

Referenced by isDisabled().

OutputPage::$mEnableClientCache = true
protected

Definition at line 212 of file OutputPage.php.

bool OutputPage::$mEnableSectionEditLinks = true
private

Whether parser output should contain section edit links.

Definition at line 301 of file OutputPage.php.

Referenced by sectionEditLinksEnabled().

bool OutputPage::$mEnableTOC = true
private

Whether parser output should contain table of contents.

Definition at line 296 of file OutputPage.php.

Referenced by isTOCEnabled().

OutputPage::$mETag = false
private

Contains an HTTP Entity Tags (see RFC 2616 section 3.13) which is used as a unique identifier for the content.

It is later used by the client to compare its cached version with the server version. Client sends headers If-Match and If-None-Match containing its locally cached ETAG value.

To get more information, you will have to look at HTTP/1.1 protocol which is properly described in RFC 2616 : http://tools.ietf.org/html/rfc2616

Definition at line 121 of file OutputPage.php.

Referenced by sendCacheControl().

array OutputPage::$mExtStyles = []
protected

Additional stylesheets.

Looks like this is for extensions. Might be replaced by ResourceLoader.

Definition at line 56 of file OutputPage.php.

Referenced by getExtStyle().

OutputPage::$mFeedLinks = []
private

Handles the Atom / RSS links.

We probably only support Atom in 2011.

See also
$wgAdvertisedFeedTypes

Definition at line 209 of file OutputPage.php.

Referenced by getSyndicationLinks().

OutputPage::$mFeedLinksAppendQuery = null
protected

Definition at line 179 of file OutputPage.php.

Referenced by getFeedAppendQuery().

array OutputPage::$mFileVersion = null
protected

Definition at line 252 of file OutputPage.php.

Referenced by getFileVersion().

OutputPage::$mFollowPolicy = 'follow'
private

Definition at line 270 of file OutputPage.php.

array OutputPage::$mHeadItems = []
protected

Array of elements in "<head>".

Parser might add its own headers!

Definition at line 153 of file OutputPage.php.

Referenced by getHeadItemsArray().

bool OutputPage::$mHideNewSectionLink = false
protected

Definition at line 221 of file OutputPage.php.

Referenced by forceHideNewSectionLink().

string OutputPage::$mHTMLtitle = ''
private

Stores contents of "<title>" tag.

Definition at line 77 of file OutputPage.php.

Referenced by getHTMLTitle().

array OutputPage::$mImageTimeKeys = []
protected

Definition at line 174 of file OutputPage.php.

Referenced by getFileSearchOptions().

OutputPage::$mIndexPolicy = 'index'
private

Definition at line 269 of file OutputPage.php.

array OutputPage::$mIndicators = []
protected

Definition at line 130 of file OutputPage.php.

Referenced by getIndicators(), and setIndicators().

string OutputPage::$mInlineStyles = ''
protected

Inline CSS styles.

Use addInlineStyle() sparingly

Definition at line 144 of file OutputPage.php.

Referenced by buildCssLinks().

bool OutputPage::$mIsarticle = false
private

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

Definition at line 83 of file OutputPage.php.

Referenced by isArticle().

bool OutputPage::$mIsArticleRelated = true
private

Stores "article flag" toggle.

Definition at line 86 of file OutputPage.php.

Referenced by isArticleRelated().

OutputPage::$mJQueryDone = false
protected

Whether jQuery is already handled.

Definition at line 267 of file OutputPage.php.

array OutputPage::$mJsConfigVars = []
protected

Definition at line 168 of file OutputPage.php.

Referenced by getJsConfigVars().

array OutputPage::$mLanguageLinks = []
private

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

'fr:Test page')

Definition at line 133 of file OutputPage.php.

Referenced by getLanguageLinks().

string OutputPage::$mLastModified = ''
protected

Variable mLastModified and mEtag are used for sending cache control.

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

Definition at line 110 of file OutputPage.php.

array OutputPage::$mLinktags = []
protected

Definition at line 47 of file OutputPage.php.

Referenced by getLinkTags().

array OutputPage::$mMetatags = []
protected

Should be private.

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

Definition at line 44 of file OutputPage.php.

Referenced by getMetaTags().

array OutputPage::$mModules = []
protected

Definition at line 156 of file OutputPage.php.

array OutputPage::$mModuleScripts = []
protected

Definition at line 159 of file OutputPage.php.

array OutputPage::$mModuleStyles = []
protected

Definition at line 162 of file OutputPage.php.

bool OutputPage::$mNewSectionLink = false
protected

Definition at line 218 of file OutputPage.php.

Referenced by showNewSectionLink().

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

string OutputPage::$mPageLinkTitle = ''

Used by skin template.

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

Definition at line 150 of file OutputPage.php.

string OutputPage::$mPagetitle = ''

Should be private - has getter and setter.

Contains the HTML title

Definition at line 61 of file OutputPage.php.

Referenced by getPageTitle().

string OutputPage::$mPageTitleActionText = ''
private

Definition at line 231 of file OutputPage.php.

Referenced by getPageTitleActionText().

ParserOptions OutputPage::$mParserOptions = null
protected

lazy initialised, use parserOptions()

Definition at line 202 of file OutputPage.php.

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().

bool OutputPage::$mPrintable = false
private

We have to set isPrintable().

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

Definition at line 92 of file OutputPage.php.

Referenced by isPrintable().

OutputPage::$mProperties = []
private

Additional key => value data.

Definition at line 286 of file OutputPage.php.

string OutputPage::$mRedirect = ''

Definition at line 101 of file OutputPage.php.

Referenced by getRedirect(), and output().

string OutputPage::$mRedirectCode = ''

Definition at line 177 of file OutputPage.php.

Referenced by output().

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.

ResourceLoader OutputPage::$mResourceLoader
protected

Definition at line 165 of file OutputPage.php.

Referenced by getResourceLoader().

int OutputPage::$mRevisionId = null
private

To include the variable {{REVISIONID}}.

Definition at line 246 of file OutputPage.php.

Referenced by getRevisionId().

string OutputPage::$mRevisionTimestamp = null
private

Definition at line 249 of file OutputPage.php.

Referenced by getRevisionTimestamp().

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

Referenced by getScriptsForBottomQueue().

int OutputPage::$mStatusCode
protected

Definition at line 104 of file OutputPage.php.

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

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 makeResourceLoaderLink().

array OutputPage::$mTemplateIds = []
protected

Definition at line 171 of file OutputPage.php.

Referenced by getTemplateIds().

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

Definition at line 271 of file OutputPage.php.

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: