MediaWiki master
MediaWiki\Parser\ParserOutput Class Reference

ParserOutput is a rendering of a Content object or a message. More...

Inherits MediaWiki\Parser\CacheTime, and ContentMetadataCollector.

Collaboration diagram for MediaWiki\Parser\ParserOutput:

Public Member Functions

 __clone ()
 
 __construct (?string $text=null, array $languageLinks=[], array $categoryLinks=[], $unused=false, string $titletext='')
 
 __serialize ()
 
 addCacheMessage (string $msg)
 Adds a comment notice about cache state to the text of the page.
 
 addCategory ( $c, $sort='')
 Add a category.
 
 addExistenceDependency (ParsoidLinkTarget $link)
 Add a dependency on the existence of a page.
 
 addExternalLink ( $url)
 
 addExtraCSPDefaultSrc ( $src)
 Add an extra value to Content-Security-Policy default-src directive.
 
 addExtraCSPScriptSrc ( $src)
 Add an extra value to Content-Security-Policy script-src directive.
 
 addExtraCSPStyleSrc ( $src)
 Add an extra value to Content-Security-Policy style-src directive.
 
 addHeadItem ( $section, $tag=false)
 Add some text to the "<head>".
 
 addImage ( $name, $timestamp=null, $sha1=null)
 Register a file dependency for this output.
 
 addInterwikiLink ( $link)
 
 addJsConfigVars ( $keys, $value=null)
 Add one or more variables to be set in mw.config in JavaScript.
 
 addLanguageLink ( $t)
 Add a language link.
 
 addLink (ParsoidLinkTarget $link, $id=null)
 Record a local or interwiki inline link for saving in future link tables.
 
 addModules (array $modules)
 
 addModuleStyles (array $modules)
 
 addOutputPageMetadata (OutputPage $out)
 Accommodate very basic transcluding of a temporary OutputPage object into parser output.
 
 addTemplate ( $link, $page_id, $rev_id)
 Register a template dependency for this output.
 
 addWarningMsg (string $msg,... $args)
 Add a warning to the output for this page.
 
 addWarningMsgVal (MessageSpecifier $mv, ?string $key=null)
 Add a warning to the output for this page.
 
 addWrapperDivClass ( $class)
 Add a CSS class to use for the wrapping div.
 
 appendExtensionData (string $key, $value, MergeStrategy|string $strategy=MergeStrategy::UNION)
 Appends arbitrary data to this ParserObject.
 
 appendJsConfigVar (string $key, $value, MergeStrategy|string $strategy=MergeStrategy::UNION)
 Append a value to a variable to be set in mw.config in JavaScript.
 
 appendLinkList (string|ParserOutputLinkTypes $linkType, array $linkItem)
 Append a link of the given type.
 
 appendOutputStrings (string|ParserOutputStringSets $name, array $value)
 Provides a uniform interface to various string sets stored in the ParserOutput.
 
 clearLanguageLinks ()
 
 clearParseStartTime ()
 Unset the parse start time.
 
 clearWrapperDivClass ()
 Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrapperDivClass() is called.
 
 collectMetadata (ContentMetadataCollector $metadata)
 Adds the metadata collected in this ParserOutput to the supplied ContentMetadataCollector.
 
 finalizeAdaptiveCacheExpiry ()
 Call this when parsing is done to lower the TTL based on low parse times.
 
 getAllFlags ()
 
 getCacheExpiry ()
 Returns the number of seconds after which this object should expire.This method is used by ParserCache to determine how long the ParserOutput can be cached. The timestamp of expiry can be calculated by adding getCacheExpiry() to getCacheTime(). The value returned by getCacheExpiry() is smaller or equal to the value of $wgParserCacheExpireTime and influenced by the values provided to calls to updateCacheExpiry(), but child classes may adjust the raw value: for example, to add minimums, dynamic adjustments, or reductions to the default expiry based on output properties.
Note
Use the protected $mCacheExpiry property to access the "real" minimum value provided to updateCacheExpiry, but as this should generally not be accessed outside this class no public getter method has been provided.
This method should return 0 if and only if isCacheable() returns false.

 
 getCacheMessage ()
 
 getCategoryMap ()
 Return category names and sort keys as a map.
 
 getCategoryNames ()
 Return the names of the categories on this page.
 
 getCategorySortKey (string $name)
 Return the sort key for a given category name, or null if the category is not present in this ParserOutput.
 
 getContentHolder ()
 Return the ContentHolder storing the HTML/DOM contents of this ParserOutput.
 
 getContentHolderText ()
 Returns the body fragment text of the ParserOutput.
 
 getDisplayTitle ()
 Get the title to be used for display.
 
 getEnableOOUI ()
 
 getExtensionData ( $key)
 Gets extensions data previously attached to this ParserOutput using setExtensionData().
 
getExternalLinks ()
 
 getExtraCSPDefaultSrcs ()
 Get extra Content-Security-Policy 'default-src' directives.
 
 getExtraCSPScriptSrcs ()
 Get extra Content-Security-Policy 'script-src' directives.
 
 getExtraCSPStyleSrcs ()
 Get extra Content-Security-Policy 'style-src' directives.
 
getFileSearchOptions ()
 
 getHeadItems ()
 
 getHideNewSection ()
 
getImages ()
 
 getIndexPolicy ()
 
 getIndicators ()
 
 getInterwikiLinks ()
 
 getJsConfigVars (bool $showStrategyKeys=false)
 
 getLanguage ()
 Get the primary language code of the output.
 
 getLanguageLinks ()
 
 getLimitReportData ()
 
 getLimitReportJSData ()
 
 getLinkList (string|ParserOutputLinkTypes $linkType, ?int $onlyNamespace=null)
 Get a list of links of the given type.
 
getLinks ()
 
getLinksSpecial ()
 
 getModules ()
 
 getModuleStyles ()
 
 getNewSection ()
 
 getNoGallery ()
 
 getOutputFlag (ParserOutputFlags|string $flag)
 Provides a uniform interface to various boolean flags stored in the ParserOutput.
 
 getOutputStrings (string|ParserOutputStringSets $name)
 Provides a uniform interface to various boolean string sets stored in the ParserOutput.
 
 getPageProperties ()
 Return all the page properties set on this ParserOutput.
 
 getPageProperty (string $name)
 Look up a page property.
 
 getPreventClickjacking ()
 Get the prevent-clickjacking flag.
 
 getRawText ()
 Get the cacheable text with <mw:editsection> markers still in it.
 
 getRedirectHeader ()
 Return an HTML prefix to be applied on redirect pages, or null if this is not a redirect.
 
 getRenderId ()
 Return the unique rendering id for this ParserOutput.
 
 getRevisionTimestamp ()
 
 getRevisionTimestampUsed ()
 
 getRevisionUsedSha1Base36 ()
 
 getSections ()
 
 getSpeculativePageIdUsed ()
 
 getSpeculativeRevIdUsed ()
 
getTemplateIds ()
 
getTemplates ()
 
 getTimeProfile (string $clock)
 Returns the time that elapsed between the most recent call to resetParseStartTime() and the first call to recordTimeProfile() after that.
 
 getTimestamp ()
 
 getTitle ()
 Get the page used as context for creating this output.
 
 getTitleText ()
 
 getTOCData ()
 
 getWarningMsgs ()
 
 getWarnings ()
 
 getWrapperDivClass ()
 Returns the class (or classes) to be used with the wrapper div for this output.
 
 hasImages ()
 Return true if there are image dependencies registered for this ParserOutput.
 
 hasLinks ()
 Return true if the given parser output has local links registered in the metadata.
 
 hasReducedExpiry ()
 Check whether the cache TTL was lowered from the site default.
 
 hasText ()
 Returns true if text was passed to the constructor, or set using setText().
 
 mergeHtmlMetaDataFrom (ParserOutput $source)
 Merges HTML metadata such as head items, JS config vars, and HTTP cache control info from $source into this ParserOutput.
 
 mergeInternalMetaDataFrom (ParserOutput $source)
 Merges internal metadata such as flags, accessed options, and profiling info from $source into this ParserOutput.
 
 mergeTrackingMetaDataFrom (ParserOutput $source)
 Merges dependency tracking metadata such as backlinks, images used, and extension data from $source into this ParserOutput.
 
 recordTimeProfile ()
 Record the time since resetParseStartTime() was last called.
 
 resetParseStartTime ()
 Resets the parse start timestamps for future calls to getTimeProfile() and recordTimeProfile().
 
 runOutputPipeline (ParserOptions $popts, array $options=[])
 
 setCategories (array $c)
 Overwrite the category map.
 
 setContentHolder (ContentHolder $contentHolder)
 
 setContentHolderText (?string $text)
 Sets the body fragment text of the ParserOutput.
 
 setDisplayTitle (string $text)
 Override the title to be used for display.
 
 setEnableOOUI (bool $enable=false)
 Enables OOUI, if true, in any OutputPage instance this ParserOutput object is added to.
 
 setExtensionData ( $key, $value)
 Attaches arbitrary data to this ParserObject.
 
 setFromParserOptions (ParserOptions $parserOptions)
 Transfer parser options which affect post-processing from ParserOptions to this ParserOutput.
 
 setHideNewSection (bool $value)
 
 setIndexPolicy ( $policy)
 Update the index policy of the robots meta tag.
 
 setIndicator ( $id, $content)
 
 setJsConfigVar (string $key, $value)
 Add a variable to be set in mw.config in JavaScript.
 
 setLanguage (Bcp47Code $lang)
 Set the primary language of the output.
 
 setLanguageLinks ( $ll)
 
 setLimitReportData ( $key, $value)
 Sets parser limit report data for a key.
 
 setNewSection ( $value)
 
 setNoGallery ( $value)
 
 setNumericPageProperty (string $propName, $numericValue)
 Set a numeric page property whose value is intended to be sorted and indexed.
 
 setOutputFlag (ParserOutputFlags|string $name, bool $val=true)
 Provides a uniform interface to various boolean flags stored in the ParserOutput.
 
 setPageProperty (string $name, string $value)
 Set a page property to be stored in the page_props database table.
 
 setPreventClickjacking (bool $flag)
 Set the prevent-clickjacking flag.
 
 setRawText (?string $text)
 Set the raw text of the ParserOutput.
 
 setRedirectHeader (string $html)
 Set an HTML prefix to be applied on redirect pages.
 
 setRenderId (string $renderId)
 Store a unique rendering id for this ParserOutput.
 
 setRevisionTimestamp (?string $timestamp)
 
 setRevisionTimestampUsed ( $timestamp)
 
 setRevisionUsedSha1Base36 ( $hash)
 
 setSections (array $sectionArray)
 
 setSpeculativePageIdUsed ( $id)
 
 setSpeculativeRevIdUsed ( $id)
 
 setText ( $text)
 Set the raw text of the ParserOutput.
 
 setTimestamp ( $timestamp)
 
 setTitle (ParsoidLinkTarget|PageReference $title)
 Sets the page context used to create this output.
 
 setTitleText (string $t)
 
 setTOCData (TOCData $tocData)
 
 setUnsortedPageProperty (string $propName, string $value='')
 Set a page property whose value is not intended to be sorted and indexed.
 
 toJsonArray ()
 Returns a JSON serializable structure representing this ParserOutput instance.
 
 unsetPageProperty (string $name)
 Remove a page property.
 
 updateRuntimeAdaptiveExpiry (int $ttl, ?string $source=null)
 Lower the runtime adaptive TTL to at most this value.
 
- Public Member Functions inherited from MediaWiki\Parser\CacheTime
 expired ( $touched)
 Return true if this cached output object predates the global or per-article cache invalidation timestamps, or if it comes from an incompatible older version.
 
 getCacheExpirySource ()
 
 getCacheRevisionId ()
 
 getCacheTime ()
 
 getUsedOptions ()
 Returns the options from its ParserOptions which have been taken into account to produce the output.
 
 hasCacheTime ()
 
 isCacheable ()
 
 isDifferentRevision ( $id)
 Return true if this cached output object is for a different revision of the page.
 
 recordOption (string $option)
 Tags a parser option for use in the cache key for this parser output.
 
 recordOptions (array $options)
 Tags a list of parser option names for use in the cache key for this parser output.
 
 setCacheRevisionId ( $id)
 
 setCacheTime ( $t)
 setCacheTime() sets the timestamp expressing when the page has been rendered.
 
 updateCacheExpiry ( $seconds, ?string $source=null)
 Reduce the number of seconds after which this object should expire.
 

Static Public Member Functions

static isLinkInternal ( $internal, $url)
 Checks, if a url is pointing to the own server.
 
static jsonClassHintFor (string $keyName)
 
static newFromJsonArray (array $json)
 

Public Attributes

const MW_MERGE_STRATEGY_KEY = '_mw-strategy'
 
const MW_MERGE_STRATEGY_UNION = MergeStrategy::UNION
 Merge strategy to use for ParserOutput accumulators: "union" means that values are strings, stored as a set, and exposed as a PHP associative array mapping from values to true.
 
const PARSOID_PAGE_BUNDLE_KEY = 'parsoid-page-bundle'
 

Protected Member Functions

 initFromJson (array $jsonData)
 Initialize member fields from an array returned by jsonSerialize().
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Parser\CacheTime
int int null $mCacheExpiry = null
 Seconds after which the object should expire, use 0 for not cacheable and null for "the default cache expiration time" (which is assumed to be greater than zero).
 
string string null $mCacheExpirySource = null
 Human-readable label identifying what caused the current cache expiry value (e.g.
 
int int null $mCacheRevisionId = null
 Revision ID that was parsed.
 
string string $mCacheTime = ''
 TS::MW timestamp when this object was generated, or '' if not yet set.
 
array array< string, true > $mParseUsedOptions = []
 ParserOptions which have been taken into account to produce output, option names stored in array keys.
 

Detailed Description

ParserOutput is a rendering of a Content object or a message.

Content objects and messages often contain wikitext, but not always.

ParserOutput object combine the HTML rendering of Content objects or messages, available via ::getContentHolderText(), with various bits of metadata generated during rendering, which may include categories, links, page properties, and extension data, among others.

ParserOutput objects corresponding to the content of page revisions are created by the ParserOutputAccess service, which automatically caches them via ParserCache where appropriate and produces new output via ContentHandler as needed.

In addition, wikitext from system messages as well as odd bits of wikitext rendered to create special pages and other UX elements are rendered to ParserOutput objects. In these cases the metadata from the ParserOutput is generally discarded and the ParserOutput is not cached. ParserOptions::setIsMessage(true) is usually used when rendering system messages. ParserOptions::setInterfaceMessage(true) is usually used when rendering system messages in the user interface language, and occasionally for the other odd bits of wikitext as well. These options are not used as consistently as one would hope.

A ParserOutput object corresponding to a given revision may be a combination of the renderings of multiple "slots": the Multi-Content Revisions (MCR) work allows articles to be composed from multiple Content objects. Each Content renders to a ParserOutput, and those ParserOutputs are merged by RevisionRenderer::combineSlotOutput() to create the final article output.

Similarly, OutputPage maintains metadata overlapping with the metadata kept by ParserOutput (T301020) and may merge several ParserOutputs using OutputPage::addParserOutput() to create the final output page. Parsoid parses certain transclusions in independent top-level contexts using Parser::parseExtensionTagAsTopLevelDoc() and these also result in ParserOutputs which are merged via ParserOutput::collectMetadata().

Future plans for incremental parsing and asynchronous rendering may result in several of these component ParserOutput objects being cached independently and then recombined asynchronously, so operations on ParserOutput objects should be compatible with that model (T300979).

Definition at line 89 of file ParserOutput.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\ParserOutput::__construct ( ?string $text = null,
array $languageLinks = [],
array $categoryLinks = [],
$unused = false,
string $titletext = '' )
Parameters
string | null$textHTML. Use null to indicate that this ParserOutput contains only meta-data, and the HTML output is undetermined, as opposed to empty. Passing null here causes hasText() to return false. In 1.39 the default value changed from '' to null.
array$languageLinks
array$categoryLinks
bool$unused
string$titletext

Definition at line 333 of file ParserOutput.php.

References MediaWiki\Parser\ParserOutput\addLanguageLink(), MediaWiki\Parser\ContentHolder\createEmpty(), MediaWiki\Parser\ContentHolder\createFromLegacyString(), and MediaWiki\Parser\ParserOutput\resetParseStartTime().

Member Function Documentation

◆ __clone()

MediaWiki\Parser\ParserOutput::__clone ( )

Definition at line 3552 of file ParserOutput.php.

◆ __serialize()

MediaWiki\Parser\ParserOutput::__serialize ( )

Definition at line 3545 of file ParserOutput.php.

◆ addCacheMessage()

MediaWiki\Parser\ParserOutput::addCacheMessage ( string $msg)

Adds a comment notice about cache state to the text of the page.

Parameters
string$msg
Access: internal
used by ParserCache

Definition at line 466 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().

◆ addCategory()

MediaWiki\Parser\ParserOutput::addCategory ( $c,
$sort = '' )

Add a category.

Although ParserOutput::getCategorySortKey() will return exactly the sort key you specify here, before storing in the database all sort keys will be language converted, HTML entities will be decoded, newlines stripped, and then they will be truncated to 255 bytes. Thus the "effective" sort key in the DB may be different from what is passed to $sort here and returned by ::getCategorySortKey().

Parameters
string | ParsoidLinkTarget$cThe category name
string$sortThe sort key; an empty string indicates that the default sort key for the page should be used.

Definition at line 1218 of file ParserOutput.php.

◆ addExistenceDependency()

MediaWiki\Parser\ParserOutput::addExistenceDependency ( ParsoidLinkTarget $link)

Add a dependency on the existence of a page.

The cache entry will be invalidated if the page is created or deleted.

Since
1.44
Parameters
ParsoidLinkTarget$link

Definition at line 1512 of file ParserOutput.php.

References NS_FILE, NS_MEDIA, and NS_SPECIAL.

◆ addExternalLink()

MediaWiki\Parser\ParserOutput::addExternalLink ( $url)
Parameters
string$url

Definition at line 1399 of file ParserOutput.php.

◆ addExtraCSPDefaultSrc()

MediaWiki\Parser\ParserOutput::addExtraCSPDefaultSrc ( $src)

Add an extra value to Content-Security-Policy default-src directive.

Call this if you are including a resource (e.g. image) from a third party domain. This is used for all source types except style and script.

Since
1.35
Parameters
string$srcCSP source e.g. example.com

Definition at line 2584 of file ParserOutput.php.

◆ addExtraCSPScriptSrc()

MediaWiki\Parser\ParserOutput::addExtraCSPScriptSrc ( $src)

Add an extra value to Content-Security-Policy script-src directive.

Call this if you are loading third-party Javascript

Since
1.35
Parameters
string$srcCSP source e.g. example.com

Definition at line 2606 of file ParserOutput.php.

◆ addExtraCSPStyleSrc()

MediaWiki\Parser\ParserOutput::addExtraCSPStyleSrc ( $src)

Add an extra value to Content-Security-Policy style-src directive.

Since
1.35
Parameters
string$srcCSP source e.g. example.com

Definition at line 2594 of file ParserOutput.php.

◆ addHeadItem()

MediaWiki\Parser\ParserOutput::addHeadItem ( $section,
$tag = false )

Add some text to the "<head>".

If $tag is set, the section with that tag will only be included once in a given page.

Parameters
string$section
string | false$tag

Definition at line 1532 of file ParserOutput.php.

◆ addImage()

MediaWiki\Parser\ParserOutput::addImage ( $name,
$timestamp = null,
$sha1 = null )

Register a file dependency for this output.

Parameters
string | ParsoidLinkTarget$nameTitle dbKey
string | false | null$timestampMW timestamp of file creation (or false if non-existing)
string | false | null$sha1Base 36 SHA-1 of file (or false if non-existing)

Definition at line 1464 of file ParserOutput.php.

◆ addInterwikiLink()

MediaWiki\Parser\ParserOutput::addInterwikiLink ( $link)
Parameters
ParsoidLinkTarget$linkmust be an interwiki link (used to require Title until 1.38).

Definition at line 1497 of file ParserOutput.php.

◆ addJsConfigVars()

MediaWiki\Parser\ParserOutput::addJsConfigVars ( $keys,
$value = null )

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

Parameters
string | array$keysKey or array of key/value pairs.
mixed | null$value[optional] Value of the configuration variable.
Since
1.23
Deprecated
since 1.38, use ::setJsConfigVar() or ::appendJsConfigVar() which ensures compatibility with asynchronous parsing; emitting warnings since 1.43.

Definition at line 1568 of file ParserOutput.php.

◆ addLanguageLink()

MediaWiki\Parser\ParserOutput::addLanguageLink ( $t)

Add a language link.

Parameters
ParsoidLinkTarget | string$t

Definition at line 1275 of file ParserOutput.php.

Referenced by MediaWiki\Parser\ParserOutput\__construct().

◆ addLink()

MediaWiki\Parser\ParserOutput::addLink ( ParsoidLinkTarget $link,
$id = null )

Record a local or interwiki inline link for saving in future link tables.

Parameters
ParsoidLinkTarget$link(used to require Title until 1.38)
int | null$idOptional known page_id so we can skip the lookup

Definition at line 1430 of file ParserOutput.php.

Referenced by MediaWiki\Content\WikitextContentHandler\fillParserOutput().

◆ addModules()

MediaWiki\Parser\ParserOutput::addModules ( array $modules)
See also
OutputPage::addModules
Parameters
string[]$modules

Definition at line 1544 of file ParserOutput.php.

◆ addModuleStyles()

MediaWiki\Parser\ParserOutput::addModuleStyles ( array $modules)
See also
OutputPage::addModuleStyles
Parameters
string[]$modules

Definition at line 1553 of file ParserOutput.php.

Referenced by MediaWiki\Content\JsonContentHandler\fillParserOutput(), and MediaWiki\Content\WikitextContentHandler\fillParserOutput().

◆ addOutputPageMetadata()

MediaWiki\Parser\ParserOutput::addOutputPageMetadata ( OutputPage $out)

Accommodate very basic transcluding of a temporary OutputPage object into parser output.

This is a fragile method that cannot be relied upon in any meaningful way. It exists solely to support the wikitext feature of transcluding a SpecialPage, and only has to work for that use case to ensure relevant styles are loaded, and that essential config vars needed between SpecialPage and a JS feature are added.

This relies on there being no overlap between modules or config vars added by the SpecialPage and those added by parser extensions. If there is overlap, then arise and break one or both sides. This is expected and unsupported.

Access: internal
For use by Parser for basic special page transclusion
Parameters
OutputPage$out

Definition at line 1651 of file ParserOutput.php.

◆ addTemplate()

MediaWiki\Parser\ParserOutput::addTemplate ( $link,
$page_id,
$rev_id )

Register a template dependency for this output.

Parameters
ParsoidLinkTarget$link(used to require Title until 1.38)
int$page_id
int$rev_id

Definition at line 1481 of file ParserOutput.php.

◆ addWarningMsg()

MediaWiki\Parser\ParserOutput::addWarningMsg ( string $msg,
$args )

Add a warning to the output for this page.

Parameters
string$msgThe localization message key for the warning
mixed|JsonDeserializable...$args Optional arguments for the message. These arguments must be serializable/deserializable with JsonCodec; see the
Note
on ParserOutput::setExtensionData()
Since
1.38

Definition at line 1340 of file ParserOutput.php.

◆ addWarningMsgVal()

MediaWiki\Parser\ParserOutput::addWarningMsgVal ( MessageSpecifier $mv,
?string $key = null )

Add a warning to the output for this page.

Parameters
MessageSpecifier$mv
?string$keyAn optional deduplication key, used to prevent duplicate messages. If omitted or null, the MessageValue key will be used for deduplication.
Since
1.43

Definition at line 1307 of file ParserOutput.php.

References $path, and Wikimedia\Message\MessageSpecifier\getKey().

◆ addWrapperDivClass()

MediaWiki\Parser\ParserOutput::addWrapperDivClass ( $class)

Add a CSS class to use for the wrapping div.

If no class is given, no wrapper is added.

Parameters
string$class

Definition at line 475 of file ParserOutput.php.

◆ appendExtensionData()

MediaWiki\Parser\ParserOutput::appendExtensionData ( string $key,
$value,
MergeStrategy|string $strategy = MergeStrategy::UNION )

Appends arbitrary data to this ParserObject.

This can be used to store some information in the ParserOutput object for later use during page output. The data will be cached along with the ParserOutput object, but unlike data set using setPageProperty(), it is not recorded in the database.

See ::setExtensionData() for more details on rationale and use.

In order to provide for out-of-order/asynchronous/incremental parsing, this method appends values to a set. See ::setExtensionData() for the flag-like version of this method.

Note
Only values which can be array keys are currently supported as values.
Parameters
string$keyThe key for accessing the data. Extensions should take care to avoid conflicts in naming keys. It is suggested to use the extension's name as a prefix.
string | int$valueThe value to append to the list.
MergeStrategy | string$strategyMerge strategy; see MergeStrategy for details.
Since
1.38

Definition at line 2269 of file ParserOutput.php.

◆ appendJsConfigVar()

MediaWiki\Parser\ParserOutput::appendJsConfigVar ( string $key,
$value,
MergeStrategy|string $strategy = MergeStrategy::UNION )

Append a value to a variable to be set in mw.config in JavaScript.

In order to ensure the result is independent of the parse order, the value of this key will be an associative array, mapping all of the values set under that key to true. (The array is implicitly ordered in PHP, but you should treat it as unordered.) If you want a non-array type for the key, and can ensure that only a single value will be set, you should use ::setJsConfigVar() instead.

Parameters
string$keyKey to use under mw.config
string | int$valueValue to append to the configuration variable.
MergeStrategy | string$strategyMerge strategy: see MergeStrategy for details.
Since
1.38

Definition at line 1622 of file ParserOutput.php.

◆ appendLinkList()

MediaWiki\Parser\ParserOutput::appendLinkList ( string|ParserOutputLinkTypes $linkType,
array $linkItem )

Append a link of the given type.

Provides a uniform interface to various lists of links stored in the metadata, in a form which facilitates merging.

Parameters
string | ParserOutputLinkTypes$linkTypeThe link type
array{link:ParsoidLinkTarget,pageid?:int,revid?:int,sort?:string,time?:string|false,sha1?:string|false}$linkItem A link item, in the form returned by ::getLinkList()
Exceptions
UnhandledMatchErrorif given an unknown link type
Since
1.45

Definition at line 836 of file ParserOutput.php.

◆ appendOutputStrings()

MediaWiki\Parser\ParserOutput::appendOutputStrings ( string|ParserOutputStringSets $name,
array $value )

Provides a uniform interface to various string sets stored in the ParserOutput.

String sets internal to MediaWiki core should have names which are constants in ParserOutputStringSets. Extensions should use ::appendExtensionData() rather than creating new string sets with ::appendOutputStrings() in order to prevent namespace conflicts.

Parameters
string | ParserOutputStringSets$nameA string set name
string[]$value
Since
1.41

Definition at line 2126 of file ParserOutput.php.

◆ clearLanguageLinks()

MediaWiki\Parser\ParserOutput::clearLanguageLinks ( )
Access: internal
For use by OutputPage only.

Definition at line 1133 of file ParserOutput.php.

◆ clearParseStartTime()

MediaWiki\Parser\ParserOutput::clearParseStartTime ( )

Unset the parse start time.

This is intended for testing purposes only, in order to avoid spurious differences between testing outputs created at different times.

Since
1.43

Definition at line 2339 of file ParserOutput.php.

◆ clearWrapperDivClass()

MediaWiki\Parser\ParserOutput::clearWrapperDivClass ( )

Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrapperDivClass() is called.

Definition at line 483 of file ParserOutput.php.

Referenced by MediaWiki\Content\CssContentHandler\fillParserOutput(), MediaWiki\Content\JavaScriptContentHandler\fillParserOutput(), MediaWiki\Content\TextContentHandler\fillParserOutput(), and MediaWiki\Content\VueContentHandler\fillParserOutput().

◆ collectMetadata()

MediaWiki\Parser\ParserOutput::collectMetadata ( ContentMetadataCollector $metadata)

Adds the metadata collected in this ParserOutput to the supplied ContentMetadataCollector.

This is similar to ::mergeHtmlMetaDataFrom() but in the opposite direction, since ParserOutput is read/write while ContentMetadataCollector is write-only.

Parameters
ContentMetadataCollector$metadata
Since
1.38

Definition at line 2871 of file ParserOutput.php.

◆ finalizeAdaptiveCacheExpiry()

MediaWiki\Parser\ParserOutput::finalizeAdaptiveCacheExpiry ( )

Call this when parsing is done to lower the TTL based on low parse times.

Since
1.28

Definition at line 2615 of file ParserOutput.php.

◆ getAllFlags()

MediaWiki\Parser\ParserOutput::getAllFlags ( )
Returns
string[] List of flags signifying special cases
Access: internal
Used in WikitextContentHandler::preSaveTransform() and OutputPage::addParserOutputMetadata().

Definition at line 1868 of file ParserOutput.php.

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

◆ getCacheExpiry()

MediaWiki\Parser\ParserOutput::getCacheExpiry ( )

Returns the number of seconds after which this object should expire.This method is used by ParserCache to determine how long the ParserOutput can be cached. The timestamp of expiry can be calculated by adding getCacheExpiry() to getCacheTime(). The value returned by getCacheExpiry() is smaller or equal to the value of $wgParserCacheExpireTime and influenced by the values provided to calls to updateCacheExpiry(), but child classes may adjust the raw value: for example, to add minimums, dynamic adjustments, or reductions to the default expiry based on output properties.

Note
Use the protected $mCacheExpiry property to access the "real" minimum value provided to updateCacheExpiry, but as this should generally not be accessed outside this class no public getter method has been provided.
This method should return 0 if and only if isCacheable() returns false.

Reimplemented from MediaWiki\Parser\CacheTime.

Definition at line 2466 of file ParserOutput.php.

Referenced by MediaWiki\Parser\Parser\makeLimitReport(), MediaWiki\Parser\RevisionOutputCache\save(), MediaWiki\Parser\ParserCache\save(), and MediaWiki\Page\WikiPage\triggerOpportunisticLinksUpdate().

◆ getCacheMessage()

MediaWiki\Parser\ParserOutput::getCacheMessage ( )
Access: internal
Returns
string

Definition at line 671 of file ParserOutput.php.

◆ getCategoryMap()

MediaWiki\Parser\ParserOutput::getCategoryMap ( )

Return category names and sort keys as a map.

BEWARE that numeric category names get converted to 'int' when stored as array keys. Because of this, use of this method is not recommended in new code; using ::getCategoryNames() and ::getCategorySortKey() will be less error-prone.

Returns
array<string|int,string>
Access: internal

Definition at line 623 of file ParserOutput.php.

◆ getCategoryNames()

MediaWiki\Parser\ParserOutput::getCategoryNames ( )

Return the names of the categories on this page.

Unlike ::getCategories(), sort keys are not included in the return value.

Returns
array<string> The names of the categories
Since
1.38

Definition at line 605 of file ParserOutput.php.

◆ getCategorySortKey()

MediaWiki\Parser\ParserOutput::getCategorySortKey ( string $name)

Return the sort key for a given category name, or null if the category is not present in this ParserOutput.

Returns the empty string if the category is to use the default sort key.

Note
The effective sort key in the database may vary from what is returned here; see note in ParserOutput::addCategory().
Parameters
string$nameThe category name
Returns
?string The sort key for the category, or null if the category is not present in this ParserOutput
Since
1.40

Definition at line 640 of file ParserOutput.php.

◆ getContentHolder()

MediaWiki\Parser\ParserOutput::getContentHolder ( )

Return the ContentHolder storing the HTML/DOM contents of this ParserOutput.

Stability: unstable
Since
1.45

Definition at line 358 of file ParserOutput.php.

◆ getContentHolderText()

MediaWiki\Parser\ParserOutput::getContentHolderText ( )

Returns the body fragment text of the ParserOutput.

This is a shortcut for ::getContentHolder()->getAsHtmlString( BODY_FRAGMENT ).

Since
1.42

Definition at line 3577 of file ParserOutput.php.

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

◆ getDisplayTitle()

MediaWiki\Parser\ParserOutput::getDisplayTitle ( )

Get the title to be used for display.

As per the contract of setDisplayTitle(), this is safe HTML, ready to be served to the client.

Returns
string|false HTML

Definition at line 1705 of file ParserOutput.php.

◆ getEnableOOUI()

MediaWiki\Parser\ParserOutput::getEnableOOUI ( )
Returns
bool
Deprecated
since 1.46; use ::getOutputFlag( ParserOutputFlags::ENABLE_OOUI )

Definition at line 1051 of file ParserOutput.php.

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

◆ getExtensionData()

MediaWiki\Parser\ParserOutput::getExtensionData ( $key)

Gets extensions data previously attached to this ParserOutput using setExtensionData().

Typically, such data would be set while parsing the page, e.g. by a parser function.

Since
1.21
Parameters
string$keyThe key to look up.
Returns
mixed|null The value previously set for the given key using setExtensionData() or null if no value was set for this key.

Definition at line 2294 of file ParserOutput.php.

◆ getExternalLinks()

& MediaWiki\Parser\ParserOutput::getExternalLinks ( )
Note
Use of the reference returned by this method has been deprecated since 1.43. In a future release this will return a normal array. Use ::addExternalLink() to modify the set of external links stored in this ParserOutput.

Definition at line 932 of file ParserOutput.php.

Referenced by MediaWiki\Search\ParserOutputSearchDataExtractor\getExternalLinks(), and MediaWiki\Deferred\LinksUpdate\ExternalLinksTable\setParserOutput().

◆ getExtraCSPDefaultSrcs()

MediaWiki\Parser\ParserOutput::getExtraCSPDefaultSrcs ( )

Get extra Content-Security-Policy 'default-src' directives.

Since
1.35
Returns
string[]

Definition at line 1060 of file ParserOutput.php.

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

◆ getExtraCSPScriptSrcs()

MediaWiki\Parser\ParserOutput::getExtraCSPScriptSrcs ( )

Get extra Content-Security-Policy 'script-src' directives.

Since
1.35
Returns
string[]

Definition at line 1069 of file ParserOutput.php.

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

◆ getExtraCSPStyleSrcs()

MediaWiki\Parser\ParserOutput::getExtraCSPStyleSrcs ( )

Get extra Content-Security-Policy 'style-src' directives.

Since
1.35
Returns
string[]

Definition at line 1078 of file ParserOutput.php.

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

◆ getFileSearchOptions()

& MediaWiki\Parser\ParserOutput::getFileSearchOptions ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::MEDIA)

Definition at line 921 of file ParserOutput.php.

References wfDeprecated().

◆ getHeadItems()

MediaWiki\Parser\ParserOutput::getHeadItems ( )
Returns
array

Definition at line 955 of file ParserOutput.php.

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

◆ getHideNewSection()

MediaWiki\Parser\ParserOutput::getHideNewSection ( )
Deprecated
since 1.46; use ::getOutputFlag( ParserOutputFlags::HIDE_NEW_SECTION )

Definition at line 1366 of file ParserOutput.php.

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

◆ getImages()

& MediaWiki\Parser\ParserOutput::getImages ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::MEDIA)

Definition at line 906 of file ParserOutput.php.

References wfDeprecated().

◆ getIndexPolicy()

MediaWiki\Parser\ParserOutput::getIndexPolicy ( )

Definition at line 1007 of file ParserOutput.php.

◆ getIndicators()

MediaWiki\Parser\ParserOutput::getIndicators ( )
Returns
array<string,string> Maps identifiers to HTML contents
Since
1.25

Definition at line 651 of file ParserOutput.php.

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

◆ getInterwikiLinks()

MediaWiki\Parser\ParserOutput::getInterwikiLinks ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::INTERWIKI)

Definition at line 593 of file ParserOutput.php.

References wfDeprecated().

◆ getJsConfigVars()

MediaWiki\Parser\ParserOutput::getJsConfigVars ( bool $showStrategyKeys = false)
Parameters
bool$showStrategyKeysDefaults to false; if set to true will expose the internal MW_MERGE_STRATEGY_KEY in the result. This should only be used internally to allow safe merge of config vars.
Returns
array
Since
1.23

Definition at line 980 of file ParserOutput.php.

Referenced by MediaWiki\Output\OutputPage\addParserOutputContent(), and MediaWiki\Output\OutputPage\addParserOutputMetadata().

◆ getLanguage()

MediaWiki\Parser\ParserOutput::getLanguage ( )

Get the primary language code of the output.

This returns the primary language of the output, including any LanguageConverter variant applied.

NOTE: This may differ from the wiki's default content language ($wgLanguageCode, MediaWikiServices::getContentLanguage), because each page may have its own "page language" set (PageStoreRecord, Title::getDbPageLanguageCode, ContentHandler::getPageLanguage).

NOTE: This may differ from the "page language" when parsing user interface messages, in which case this reflects the user language (including any variant preference).

NOTE: This may differ from the Parser's "target language" that was set while the Parser was parsing the page, because the final output is converted to the current user's preferred LanguageConverter variant (assuming this is a variant of the target language). See Parser::getTargetLanguageConverter()->getPreferredVariant(); use LanguageFactory::getParentLanguage() on the language code to obtain the base language code. LanguageConverter::getPreferredVariant() depends on the global RequestContext for the URL and the User language preference.

Finally, note that a single ParserOutput object may contain HTML content in multiple different languages and directions (T114640). Authors of wikitext and of parser extensions are expected to mark such subtrees with a lang attribute (set to a BCP-47 value, see Language::toBcp47Code()) and a corresponding dir attribute (see Language::getDir()). This method returns the language code for wrapper of the HTML content.

See also
Parser::internalParseHalfParsed
Since
1.40
Returns
?Bcp47Code The primary language for this output, or null if a language was not set.

Definition at line 1795 of file ParserOutput.php.

◆ getLanguageLinks()

MediaWiki\Parser\ParserOutput::getLanguageLinks ( )
Returns
string[]
Note
Before 1.43, this function returned an array reference.
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::LANGUAGE)

Definition at line 576 of file ParserOutput.php.

References wfDeprecated().

◆ getLimitReportData()

MediaWiki\Parser\ParserOutput::getLimitReportData ( )
Returns
array

Definition at line 1036 of file ParserOutput.php.

◆ getLimitReportJSData()

MediaWiki\Parser\ParserOutput::getLimitReportJSData ( )
Returns
array

Definition at line 1043 of file ParserOutput.php.

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

◆ getLinkList()

MediaWiki\Parser\ParserOutput::getLinkList ( string|ParserOutputLinkTypes $linkType,
?int $onlyNamespace = null )

Get a list of links of the given type.

Provides a uniform interface to various lists of links stored in the metadata.

Each element of the returned array has a LinkTarget as the 'link' property. Local and template links also have 'pageid' set. Template links have 'revid' set. Category links have 'sort' set. Media links optionally have 'time' and 'sha1' set.

Parameters
string | ParserOutputLinkTypes$linkTypeA link type
?int$onlyNamespace(optional) if non-null, will return only links in the given namespace
Returns
list<array{link:ParsoidLinkTarget,pageid?:int,revid?:int,sort?:string,time?:string|false,sha1?:string|false}>
Since
1.43
Exceptions
UnhandledMatchErrorif given an unknown link type

Definition at line 705 of file ParserOutput.php.

Referenced by MediaWiki\Output\OutputPage\addParserOutputMetadata(), MediaWiki\Search\ParserOutputSearchDataExtractor\getCategories(), MediaWiki\Search\ParserOutputSearchDataExtractor\getOutgoingLinks(), MediaWiki\Search\ParserOutputSearchDataExtractor\getTemplates(), MediaWiki\Deferred\LinksUpdate\CategoryLinksTable\setParserOutput(), MediaWiki\Deferred\LinksUpdate\ExistenceLinksTable\setParserOutput(), MediaWiki\Deferred\LinksUpdate\ImageLinksTable\setParserOutput(), MediaWiki\Deferred\LinksUpdate\InterwikiLinksTable\setParserOutput(), MediaWiki\Deferred\LinksUpdate\LangLinksTable\setParserOutput(), MediaWiki\Deferred\LinksUpdate\PageLinksTable\setParserOutput(), and MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\setParserOutput().

◆ getLinks()

& MediaWiki\Parser\ParserOutput::getLinks ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::LOCAL)

Definition at line 863 of file ParserOutput.php.

References wfDeprecated().

◆ getLinksSpecial()

& MediaWiki\Parser\ParserOutput::getLinksSpecial ( )
Returns
array Keys are DBKs for the links to special pages in the document
Since
1.35
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::SPECIAL)

Definition at line 888 of file ParserOutput.php.

References wfDeprecated().

◆ getModules()

MediaWiki\Parser\ParserOutput::getModules ( )

◆ getModuleStyles()

MediaWiki\Parser\ParserOutput::getModuleStyles ( )

◆ getNewSection()

MediaWiki\Parser\ParserOutput::getNewSection ( )
Deprecated
since 1.46; use ::getOutputFlag( ParserOutputFlags::NEW_SECTION )

Definition at line 1373 of file ParserOutput.php.

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

◆ getNoGallery()

MediaWiki\Parser\ParserOutput::getNoGallery ( )
Returns
bool
Deprecated
since 1.46; use ::getOutputFlag( ParserOutputFlags::NO_GALLERY )

Definition at line 948 of file ParserOutput.php.

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

◆ getOutputFlag()

MediaWiki\Parser\ParserOutput::getOutputFlag ( ParserOutputFlags|string $flag)

Provides a uniform interface to various boolean flags stored in the ParserOutput.

Flags internal to MediaWiki core should have names which are constants in ParserOutputFlags. Extensions should only use ::getOutputFlag() to query flags defined in ParserOutputFlags in core; they should use ::getExtensionData() to define their own flags.

Parameters
ParserOutputFlags | string$flagA flag. The use of flag name strings which are not present in ParserOutputFlags was deprecated in 1.45.
Returns
bool The flag value
Since
1.38

Definition at line 2108 of file ParserOutput.php.

Referenced by MediaWiki\Output\OutputPage\addParserOutputMetadata(), and MediaWiki\Page\WikiPage\triggerOpportunisticLinksUpdate().

◆ getOutputStrings()

MediaWiki\Parser\ParserOutput::getOutputStrings ( string|ParserOutputStringSets $name)

Provides a uniform interface to various boolean string sets stored in the ParserOutput.

String sets internal to MediaWiki core should have names which are constants in ParserOutputStringSets. Extensions should only use ::getOutputStrings() to query string sets defined in ParserOutputStringSets in core; they should use ::appendExtensionData() to define their own string sets.

Parameters
string | ParserOutputStringSets$nameA string set name
Returns
string[] The string set value
Since
1.41

Definition at line 2162 of file ParserOutput.php.

◆ getPageProperties()

MediaWiki\Parser\ParserOutput::getPageProperties ( )

Return all the page properties set on this ParserOutput.

Returns
array<string,?scalar>
Since
1.38

Definition at line 2049 of file ParserOutput.php.

Referenced by MediaWiki\Deferred\LinksUpdate\PagePropsTable\setParserOutput().

◆ getPageProperty()

MediaWiki\Parser\ParserOutput::getPageProperty ( string $name)

Look up a page property.

Parameters
string$nameThe page property name to look up.
Returns
?scalar The value previously set using ::setPageProperty(), ::setUnsortedPageProperty(), or ::setNumericPageProperty(). Returns null if no value was set for the given property name.
Note
You would need to use ::getPageProperties() to test for an explicitly-set null value; but see the note in ::setPageProperty() deprecating the use of null values.
Since
1.38

Definition at line 2031 of file ParserOutput.php.

Referenced by MediaWiki\Deferred\LinksUpdate\CategoryLinksTable\setParserOutput().

◆ getPreventClickjacking()

MediaWiki\Parser\ParserOutput::getPreventClickjacking ( )

Get the prevent-clickjacking flag.

Returns
bool Flag value
Since
1.38
See also
::setPreventClickjacking
Deprecated
since 1.46; use ::getOutputFlag( ParserOutputFlags::PREVENT_CLICKJACKING )

Definition at line 2556 of file ParserOutput.php.

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

◆ getRawText()

MediaWiki\Parser\ParserOutput::getRawText ( )

Get the cacheable text with <mw:editsection> markers still in it.

The return value is suitable for writing back via setText() but is not valid for display to the user.

Returns
string
Since
1.27
Deprecated
since 1.45; use ::getContentHolderText() instead

Definition at line 393 of file ParserOutput.php.

References wfDeprecated().

◆ getRedirectHeader()

MediaWiki\Parser\ParserOutput::getRedirectHeader ( )

Return an HTML prefix to be applied on redirect pages, or null if this is not a redirect.

Returns
?string HTML to prepend to redirect pages, or null
Access: internal

Definition at line 1822 of file ParserOutput.php.

◆ getRenderId()

MediaWiki\Parser\ParserOutput::getRenderId ( )

Return the unique rendering id for this ParserOutput.

This is used whenever a client needs to record a dependency on a specific parse.

Returns
string|null
Access: internal

Definition at line 1853 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().

◆ getRevisionTimestamp()

MediaWiki\Parser\ParserOutput::getRevisionTimestamp ( )
Returns
string|null TS::MW timestamp of the revision content

Definition at line 1020 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save().

◆ getRevisionTimestampUsed()

MediaWiki\Parser\ParserOutput::getRevisionTimestampUsed ( )
Returns
string|null TS::MW timestamp or null if not used
Since
1.34

Definition at line 540 of file ParserOutput.php.

◆ getRevisionUsedSha1Base36()

MediaWiki\Parser\ParserOutput::getRevisionUsedSha1Base36 ( )
Returns
string|null Lowercase SHA-1 base 36 hash, null if unused, or "" on inconsistency
Since
1.34

Definition at line 567 of file ParserOutput.php.

◆ getSections()

MediaWiki\Parser\ParserOutput::getSections ( )
Access: internal
Returns
array

Definition at line 679 of file ParserOutput.php.

◆ getSpeculativePageIdUsed()

MediaWiki\Parser\ParserOutput::getSpeculativePageIdUsed ( )
Returns
int|null
Since
1.34

Definition at line 524 of file ParserOutput.php.

◆ getSpeculativeRevIdUsed()

MediaWiki\Parser\ParserOutput::getSpeculativeRevIdUsed ( )
Returns
int|null
Since
1.28

Definition at line 508 of file ParserOutput.php.

◆ getTemplateIds()

& MediaWiki\Parser\ParserOutput::getTemplateIds ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::TEMPLATE)

Definition at line 900 of file ParserOutput.php.

References wfDeprecated().

◆ getTemplates()

& MediaWiki\Parser\ParserOutput::getTemplates ( )
Deprecated
since 1.43, use ::getLinkList(ParserOutputLinkTypes::TEMPLATE)

Definition at line 894 of file ParserOutput.php.

References wfDeprecated().

◆ getTimeProfile()

MediaWiki\Parser\ParserOutput::getTimeProfile ( string $clock)

Returns the time that elapsed between the most recent call to resetParseStartTime() and the first call to recordTimeProfile() after that.

Clocks available are:

  • wall: Wall clock time
  • cpu: CPU time (requires getrusage)

If recordTimeProfile() has noit been called since the most recent call to resetParseStartTime(), or if resetParseStartTime() was never called, then this method will return null.

Parameters
string$clock
Since
1.42
Returns
float|null

Definition at line 2388 of file ParserOutput.php.

Referenced by MediaWiki\Parser\Parser\makeLimitReport().

◆ getTimestamp()

MediaWiki\Parser\ParserOutput::getTimestamp ( )
Returns
string|null TS::MW timestamp of the revision content
Deprecated
since 1.42; use ::getRevisionTimestamp() instead

Definition at line 1028 of file ParserOutput.php.

References wfDeprecated().

◆ getTitle()

MediaWiki\Parser\ParserOutput::getTitle ( )

Get the page used as context for creating this output.

The displayed page title may differ, see ::getDisplayTitle(), but this is the context object, corresponding to Parser::getPage().

Since
1.46 (also backported to 1.43.7, 1.44.4, 1.45.2)

Definition at line 1721 of file ParserOutput.php.

◆ getTitleText()

MediaWiki\Parser\ParserOutput::getTitleText ( )

Definition at line 655 of file ParserOutput.php.

Referenced by MediaWiki\Page\Article\adjustDisplayTitle().

◆ getTOCData()

MediaWiki\Parser\ParserOutput::getTOCData ( )
Returns
?TOCData the table of contents data, or null if it hasn't been set.

Definition at line 663 of file ParserOutput.php.

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

◆ getWarningMsgs()

MediaWiki\Parser\ParserOutput::getWarningMsgs ( )
Returns
list<MessageValue>

Definition at line 1003 of file ParserOutput.php.

◆ getWarnings()

MediaWiki\Parser\ParserOutput::getWarnings ( )
Deprecated
since 1.45; use ::getWarningMsgs.

Definition at line 996 of file ParserOutput.php.

◆ getWrapperDivClass()

MediaWiki\Parser\ParserOutput::getWrapperDivClass ( )

Returns the class (or classes) to be used with the wrapper div for this output.

If there is no wrapper class given, no wrapper div should be added. The wrapper div is added automatically by getText().

Definition at line 492 of file ParserOutput.php.

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

◆ hasImages()

MediaWiki\Parser\ParserOutput::hasImages ( )

Return true if there are image dependencies registered for this ParserOutput.

Since
1.44

Definition at line 916 of file ParserOutput.php.

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

◆ hasLinks()

MediaWiki\Parser\ParserOutput::hasLinks ( )

Return true if the given parser output has local links registered in the metadata.

Returns
bool
Since
1.44

Definition at line 874 of file ParserOutput.php.

◆ hasReducedExpiry()

MediaWiki\Parser\ParserOutput::hasReducedExpiry ( )

Check whether the cache TTL was lowered from the site default.

When content is determined by more than hard state (e.g. page edits), such as template/file transclusions based on the current timestamp or extension tags that generate lists based on queries, this return true.

This method mainly exists to facilitate the logic in WikiPage::triggerOpportunisticLinksUpdate. As such, beware that reducing the TTL for reasons that do not relate to "dynamic content", may have the side-effect of incurring more RefreshLinksJob executions.

Access: internal
For use by Parser and WikiPage
Since
1.37
Returns
bool

Definition at line 2451 of file ParserOutput.php.

Referenced by MediaWiki\Parser\Parser\makeLimitReport(), and MediaWiki\Page\WikiPage\triggerOpportunisticLinksUpdate().

◆ hasText()

MediaWiki\Parser\ParserOutput::hasText ( )

Returns true if text was passed to the constructor, or set using setText().

Returns false if null was passed to the $text parameter of the constructor to indicate that this ParserOutput only contains meta-data, and the HTML output is undetermined.

Since
1.32
Returns
bool Whether this ParserOutput contains rendered text. If this returns false, the ParserOutput contains meta-data only.

Definition at line 380 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().

◆ initFromJson()

MediaWiki\Parser\ParserOutput::initFromJson ( array $jsonData)
protected

Initialize member fields from an array returned by jsonSerialize().

Parameters
array$jsonData

Reimplemented from MediaWiki\Parser\CacheTime.

Definition at line 3353 of file ParserOutput.php.

◆ isLinkInternal()

static MediaWiki\Parser\ParserOutput::isLinkInternal ( $internal,
$url )
static

Checks, if a url is pointing to the own server.

Parameters
string$internalThe server to check against
string$urlThe url to check
Returns
bool
Access: internal

Definition at line 1385 of file ParserOutput.php.

◆ jsonClassHintFor()

static MediaWiki\Parser\ParserOutput::jsonClassHintFor ( string $keyName)
static

Definition at line 3341 of file ParserOutput.php.

◆ mergeHtmlMetaDataFrom()

MediaWiki\Parser\ParserOutput::mergeHtmlMetaDataFrom ( ParserOutput $source)

Merges HTML metadata such as head items, JS config vars, and HTTP cache control info from $source into this ParserOutput.

This should be used whenever the HTML in $source has been somehow merged into the HTML of this ParserOutput.

Access: internal
Used only by RevisionRenderer

Definition at line 2750 of file ParserOutput.php.

◆ mergeInternalMetaDataFrom()

MediaWiki\Parser\ParserOutput::mergeInternalMetaDataFrom ( ParserOutput $source)

Merges internal metadata such as flags, accessed options, and profiling info from $source into this ParserOutput.

This should be used whenever the state of $source has any impact on the state of this ParserOutput.

Access: internal
Used only by RevisionRenderer

Definition at line 2673 of file ParserOutput.php.

◆ mergeTrackingMetaDataFrom()

MediaWiki\Parser\ParserOutput::mergeTrackingMetaDataFrom ( ParserOutput $source)

Merges dependency tracking metadata such as backlinks, images used, and extension data from $source into this ParserOutput.

This allows dependency tracking to be done for the combined output of multiple content slots.

Access: internal
Used only by RevisionRenderer

Definition at line 2842 of file ParserOutput.php.

References $source.

◆ newFromJsonArray()

static MediaWiki\Parser\ParserOutput::newFromJsonArray ( array $json)
static

Reimplemented from MediaWiki\Parser\CacheTime.

Definition at line 3334 of file ParserOutput.php.

◆ recordTimeProfile()

MediaWiki\Parser\ParserOutput::recordTimeProfile ( )

Record the time since resetParseStartTime() was last called.

The recorded time can be accessed using getTimeProfile().

After resetParseStartTime() was called, the first call to recordTimeProfile() will record the time profile. Subsequent calls to recordTimeProfile() will have no effect until resetParseStartTime() is called again.

Since
1.42

Definition at line 2353 of file ParserOutput.php.

◆ resetParseStartTime()

MediaWiki\Parser\ParserOutput::resetParseStartTime ( )

Resets the parse start timestamps for future calls to getTimeProfile() and recordTimeProfile().

Since
1.22

Definition at line 2325 of file ParserOutput.php.

Referenced by MediaWiki\Parser\ParserOutput\__construct().

◆ runOutputPipeline()

MediaWiki\Parser\ParserOutput::runOutputPipeline ( ParserOptions $popts,
array $options = [] )

Definition at line 443 of file ParserOutput.php.

◆ setCategories()

MediaWiki\Parser\ParserOutput::setCategories ( array $c)

Overwrite the category map.

Parameters
array<string,string>$c Map of category names to sort keys
Since
1.38

Definition at line 1235 of file ParserOutput.php.

◆ setContentHolder()

MediaWiki\Parser\ParserOutput::setContentHolder ( ContentHolder $contentHolder)
Access: internal
Use __construct or PageBundleParserOutputConverter.
Since
1.45

Definition at line 366 of file ParserOutput.php.

◆ setContentHolderText()

MediaWiki\Parser\ParserOutput::setContentHolderText ( ?string $text)

◆ setDisplayTitle()

MediaWiki\Parser\ParserOutput::setDisplayTitle ( string $text)

Override the title to be used for display.

Note
this is assumed to have been validated (check equal normalisation, etc.)
this is expected to be safe HTML, ready to be served to the client.
Parameters
string$textDesired title text

Definition at line 1692 of file ParserOutput.php.

◆ setEnableOOUI()

MediaWiki\Parser\ParserOutput::setEnableOOUI ( bool $enable = false)

Enables OOUI, if true, in any OutputPage instance this ParserOutput object is added to.

Since
1.26
Parameters
bool$enableIf OOUI should be enabled or not
Deprecated
since 1.46; use ::setOutputFlag( ParserOutputFlags::ENABLE_OOUI )

Definition at line 1267 of file ParserOutput.php.

◆ setExtensionData()

MediaWiki\Parser\ParserOutput::setExtensionData ( $key,
$value )

Attaches arbitrary data to this ParserObject.

This can be used to store some information in the ParserOutput object for later use during page output. The data will be cached along with the ParserOutput object, but unlike data set using setPageProperty(), it is not recorded in the database.

This method is provided to overcome the unsafe practice of attaching extra information to a ParserObject by directly assigning member variables.

To use setExtensionData() to pass extension information from a hook inside the parser to a hook in the page output, use this in the parser hook:

Example:
$parser->getOutput()->setExtensionData( 'my_ext_foo', '...' );

And then later, in OutputPageParserOutput or similar:

Example:
$output->getExtensionData( 'my_ext_foo' );

In MediaWiki 1.20 and older, you have to use a custom member variable within the ParserOutput object:

Example:
$parser->getOutput()->my_ext_foo = '...';
Note
Only scalar values, e.g. numbers, strings, arrays or MediaWiki\Json\JsonDeserializable instances are supported as a value. Attempt to set other class instance as extension data will break ParserCache for the page.
Since MW 1.38 the practice of setting conflicting values for the same key has been deprecated. As with ::setJsConfigVar(), if you set the same key multiple times on a ParserOutput, it is expected that the value will be identical each time. If you want to collect multiple pieces of data under a single key, use ::appendExtensionData().
Parameters
string$keyThe key for accessing the data. Extensions should take care to avoid conflicts in naming keys. It is suggested to use the extension's name as a prefix.
mixed | JsonDeserializable$valueThe value to set. Setting a value to null is equivalent to removing the value.
Since
1.21

Definition at line 2229 of file ParserOutput.php.

◆ setFromParserOptions()

MediaWiki\Parser\ParserOutput::setFromParserOptions ( ParserOptions $parserOptions)

◆ setHideNewSection()

MediaWiki\Parser\ParserOutput::setHideNewSection ( bool $value)
Parameters
bool$valueHide the new section link?
Deprecated
since 1.46; use ::setOutputFlag( ParserOutputFlags::HIDE_NEW_SECTION )

Definition at line 1359 of file ParserOutput.php.

◆ setIndexPolicy()

MediaWiki\Parser\ParserOutput::setIndexPolicy ( $policy)

Update the index policy of the robots meta tag.

Note that calling this method does not guarantee that self::getIndexPolicy() will return the given policy – if different calls set the index policy to 'index' and 'noindex', then 'noindex' always wins (T16899), even if the 'index' call happened later. If this is not what you want, you can reset ParserOutputFlags::NO_INDEX_POLICY with self::setOutputFlag().

Parameters
string$policy'index' or 'noindex'.
Returns
string The previous policy.

Definition at line 1175 of file ParserOutput.php.

◆ setIndicator()

MediaWiki\Parser\ParserOutput::setIndicator ( $id,
$content )
Parameters
string$id
string$content
Since
1.25

Definition at line 1250 of file ParserOutput.php.

◆ setJsConfigVar()

MediaWiki\Parser\ParserOutput::setJsConfigVar ( string $key,
$value )

Add a variable to be set in mw.config in JavaScript.

In order to ensure the result is independent of the parse order, the values set here must be unique – that is, you can pass the same $key multiple times but ONLY if the $value is identical each time. If you want to collect multiple pieces of data under a single key, use ::appendJsConfigVar().

Parameters
string$keyKey to use under mw.config
mixed | null$valueValue of the configuration variable.
Since
1.38

Definition at line 1593 of file ParserOutput.php.

◆ setLanguage()

MediaWiki\Parser\ParserOutput::setLanguage ( Bcp47Code $lang)

Set the primary language of the output.

See the discussion and caveats in ::getLanguage().

Parameters
Bcp47Code$langThe primary language for this output, including any variant specification.
Since
1.40

Definition at line 1812 of file ParserOutput.php.

◆ setLanguageLinks()

MediaWiki\Parser\ParserOutput::setLanguageLinks ( $ll)
Deprecated
since 1.42, use ::addLanguageLink() instead.

Definition at line 1119 of file ParserOutput.php.

References wfDeprecated().

◆ setLimitReportData()

MediaWiki\Parser\ParserOutput::setLimitReportData ( $key,
$value )

Sets parser limit report data for a key.

The key is used as the prefix for various messages used for formatting:

  • $key: The label for the field in the limit report
  • $key-value-text: Message used to format the value in the "NewPP limit report" HTML comment. If missing, uses $key-format.
  • $key-value-html: Message used to format the value in the preview limit report table. If missing, uses $key-format.
  • $key-value: Message used to format the value. If missing, uses "$1".

Note that all values are interpreted as wikitext, and so should be encoded with htmlspecialchars() as necessary, but should avoid complex HTML for display in the "NewPP limit report" comment.

Since
1.22
Parameters
string$keyMessage key
mixed$valueAppropriate for Message::params()

Definition at line 2411 of file ParserOutput.php.

Referenced by MediaWiki\Parser\Parser\makeLimitReport().

◆ setNewSection()

MediaWiki\Parser\ParserOutput::setNewSection ( $value)
Parameters
bool$value
Deprecated
since 1.46; use ::setOutputFlag( ParserOutputFlags::HIDE_NEW_SECTION )

Definition at line 1351 of file ParserOutput.php.

◆ setNoGallery()

MediaWiki\Parser\ParserOutput::setNoGallery ( $value)
Parameters
bool$value
Deprecated
since 1.46; use ::setOutputFlag( ParserOutputFlags::NO_GALLERY )

Definition at line 940 of file ParserOutput.php.

◆ setNumericPageProperty()

MediaWiki\Parser\ParserOutput::setNumericPageProperty ( string $propName,
$numericValue )

Set a numeric page property whose value is intended to be sorted and indexed.

The sort key used for the property will be the value, coerced to a number.

See ::setPageProperty() for details.

In the future, we may allow the value to be specified independent of sort key (T357783).

Parameters
string$propNameThe name of the page property
int | float | string$numericValuethe numeric value
Since
1.42

Definition at line 1989 of file ParserOutput.php.

◆ setOutputFlag()

MediaWiki\Parser\ParserOutput::setOutputFlag ( ParserOutputFlags|string $name,
bool $val = true )

Provides a uniform interface to various boolean flags stored in the ParserOutput.

Flags internal to MediaWiki core should have names which are constants in ParserOutputFlags. Extensions should use ::setExtensionData() rather than creating new flags with ::setOutputFlag() in order to prevent namespace conflicts.

Flags are always combined with OR. That is, the flag is set in the resulting ParserOutput if the flag is set in any of the fragments composing the ParserOutput.

Note
The combination policy means that a ParserOutput may end up with both INDEX_POLICY and NO_INDEX_POLICY set. It is expected that NO_INDEX_POLICY "wins" in that case. (T16899) (This resolution is implemented in ::getIndexPolicy().)
Parameters
ParserOutputFlags | string$nameA flag name. The use of flags which are not present in ParserOutputFlags has been discouraged since 1.38 and was officially deprecated in 1.45.
bool$val
Since
1.38

Definition at line 2075 of file ParserOutput.php.

References wfDeprecated().

Referenced by MediaWiki\Content\CssContentHandler\fillParserOutput(), MediaWiki\Content\JavaScriptContentHandler\fillParserOutput(), MediaWiki\Content\VueContentHandler\fillParserOutput(), and MediaWiki\Content\WikitextContentHandler\fillParserOutput().

◆ setPageProperty()

MediaWiki\Parser\ParserOutput::setPageProperty ( string $name,
string $value )

Set a page property to be stored in the page_props database table.

page_props is a key-value store indexed by the page ID. This allows the parser to set a property on a page which can then be quickly retrieved given the page ID or via a DB join when given the page title.

Since 1.23, page_props are also indexed by numeric value, to allow for efficient "top k" queries of pages wrt a given property. This only works if the value is passed as a int, float, or bool. Since 1.42 you should use ::setNumericPageProperty() if you want your page property value to be indexed, which will ensure that the value is of the proper type.

setPageProperty() is thus used to propagate properties from the parsed page to request contexts other than a page view of the currently parsed article.

Some applications examples:

  • To implement hidden categories, hiding pages from category listings by storing a page property.
  • Overriding the displayed article title (ParserOutput::setDisplayTitle()).
  • To implement image tagging, for example displaying an icon on an image thumbnail to indicate that it is listed for deletion on Wikimedia Commons. This is not actually implemented, yet but would be pretty cool.
Note
Use of non-scalar values (anything other than string|int|float|bool) has been deprecated in 1.42. Although any JSON-serializable value can be stored/fetched in ParserOutput, when the values are stored to the database (in deferred/LinksUpdate/PagePropsTable.php) they will be converted: booleans will be converted to '0' and '1', null will become '', and everything else will be cast to string (not JSON-serialized). Page properties obtained from the PageProps service will thus always be strings.
The sort key stored in the database will be NULL unless the value passed here is an int|float|bool. If you do not want your property value indexed and sorted (for example, the value is a title string which can be numeric but only incidentally, like when it gets retrieved from an array key) be sure to cast to string or use ::setUnsortedPageProperty(). If you do want your property value indexed and sorted, you should use ::setNumericPageProperty() instead as this will ensure the value type is correct. Note that either way it is possible to efficiently look up all the pages with a certain property; we are only talking about sorting the values assigned to the property, for example for a "top N values of the property" query.
Note that ::getPageProperty()/::setPageProperty() do not do any conversions themselves; you should therefore be careful to distinguish values returned from the PageProp service (always strings) from values retrieved from a ParserOutput.
Do not use setPageProperty() to set a property which is only used in a context where the ParserOutput object itself is already available, for example a normal page view. There is no need to save such a property in the database since the text is already parsed; use ::setExtensionData() instead.
Example:
$parser->getOutput()->setExtensionData( 'my_ext_foo', '...' );

And then later, in OutputPageParserOutput or similar:

Example:
$output->getExtensionData( 'my_ext_foo' );
Note
The use of null as a value was deprecated in 1.42; use the empty string instead if you need a placeholder value, or ::unsetPageProperty() if you mean to remove a page property.
The use of non-string values was deprecated in 1.42; if you need an page property value with a sort index use ::setNumericPageProperty().
Parameters
string$name
string$value
Since
1.38

Definition at line 1971 of file ParserOutput.php.

◆ setPreventClickjacking()

MediaWiki\Parser\ParserOutput::setPreventClickjacking ( bool $flag)

Set the prevent-clickjacking flag.

If set this 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 with $flag = true.

Parameters
bool$flagNew flag value
Since
1.38
Deprecated
since 1.46; use ::setOutputFlag( ParserOutputFlags::PREVENT_CLICKJACKING )

Definition at line 2544 of file ParserOutput.php.

◆ setRawText()

MediaWiki\Parser\ParserOutput::setRawText ( ?string $text)

Set the raw text of the ParserOutput.

If you did not generate html, pass null to mark it as such.

Since
1.42
Parameters
string | null$textHTML content of ParserOutput or null if not generated
Deprecated
Since 1.45, use ::setContentHolderText()

Definition at line 1092 of file ParserOutput.php.

◆ setRedirectHeader()

MediaWiki\Parser\ParserOutput::setRedirectHeader ( string $html)

Set an HTML prefix to be applied on redirect pages.

Parameters
string$htmlHTML to prepend to redirect pages

Definition at line 1830 of file ParserOutput.php.

Referenced by MediaWiki\Content\WikitextContentHandler\fillParserOutput().

◆ setRenderId()

MediaWiki\Parser\ParserOutput::setRenderId ( string $renderId)

Store a unique rendering id for this ParserOutput.

This is used whenever a client needs to record a dependency on a specific parse. It is typically set only when a parser output is cached.

Parameters
string$renderIda UUID identifying a specific parse
Access: internal

Definition at line 1842 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().

◆ setRevisionTimestamp()

MediaWiki\Parser\ParserOutput::setRevisionTimestamp ( ?string $timestamp)
Parameters
?string$timestampTS::MW timestamp of the revision content

Definition at line 1188 of file ParserOutput.php.

Referenced by MediaWiki\Parser\RevisionOutputCache\save().

◆ setRevisionTimestampUsed()

MediaWiki\Parser\ParserOutput::setRevisionTimestampUsed ( $timestamp)
Parameters
string$timestampTS::MW timestamp
Since
1.34

Definition at line 532 of file ParserOutput.php.

◆ setRevisionUsedSha1Base36()

MediaWiki\Parser\ParserOutput::setRevisionUsedSha1Base36 ( $hash)
Parameters
string$hashLowercase SHA-1 base 36 hash
Since
1.34

Definition at line 548 of file ParserOutput.php.

◆ setSections()

MediaWiki\Parser\ParserOutput::setSections ( array $sectionArray)
Parameters
array$sectionArray
Returns
array Previous value of ::getSections()

Definition at line 1156 of file ParserOutput.php.

Referenced by MediaWiki\Content\CssContentHandler\fillParserOutput(), MediaWiki\Content\JavaScriptContentHandler\fillParserOutput(), and MediaWiki\Content\VueContentHandler\fillParserOutput().

◆ setSpeculativePageIdUsed()

MediaWiki\Parser\ParserOutput::setSpeculativePageIdUsed ( $id)
Parameters
int$id
Since
1.34

Definition at line 516 of file ParserOutput.php.

◆ setSpeculativeRevIdUsed()

MediaWiki\Parser\ParserOutput::setSpeculativeRevIdUsed ( $id)
Parameters
int$id
Since
1.28

Definition at line 500 of file ParserOutput.php.

◆ setText()

MediaWiki\Parser\ParserOutput::setText ( $text)

Set the raw text of the ParserOutput.

If you did not generate html, pass null to mark it as such.

Since
1.39 You can now pass null to this function
Parameters
string | null$textHTML content of ParserOutput or null if not generated
Returns
string|null Previous value of ParserOutput's raw text
Deprecated
since 1.42; use ::setContentHolderText() which matches the getter ::getContentHolderText()

Definition at line 1109 of file ParserOutput.php.

References wfDeprecated().

◆ setTimestamp()

MediaWiki\Parser\ParserOutput::setTimestamp ( $timestamp)
Parameters
?string$timestampTS::MW timestamp of the revision content
Returns
?string The previous value of the timestamp
Deprecated
since 1.42; use ::setRevisionTimestamp() instead

Definition at line 1198 of file ParserOutput.php.

References wfDeprecated(), and wfSetVar().

◆ setTitle()

MediaWiki\Parser\ParserOutput::setTitle ( ParsoidLinkTarget|PageReference $title)

Sets the page context used to create this output.

This should generally be the same as Parser::getPage().

This should be a local page, and any fragment portion of the title is discarded.

Since
1.46

Definition at line 1747 of file ParserOutput.php.

References MediaWiki\DAO\WikiAwareEntity\assertWiki().

◆ setTitleText()

MediaWiki\Parser\ParserOutput::setTitleText ( string $t)
Parameters
string$t
Returns
?string

Definition at line 1141 of file ParserOutput.php.

References wfSetVar().

◆ setTOCData()

MediaWiki\Parser\ParserOutput::setTOCData ( TOCData $tocData)
Parameters
TOCData$tocDataTable of contents data for the page

Definition at line 1148 of file ParserOutput.php.

◆ setUnsortedPageProperty()

MediaWiki\Parser\ParserOutput::setUnsortedPageProperty ( string $propName,
string $value = '' )

Set a page property whose value is not intended to be sorted and indexed.

See ::setPageProperty() for details. It is recommended to use the empty string if you need a placeholder value (ie, if it is the presence of the property which is important, not the value the property is set to).

It is still possible to efficiently look up all the pages with a certain property (the "presence" of it is indexed; see Special:PagesWithProp, list=pageswithprop).

Parameters
string$propNameThe name of the page property
string$valueOptional value; defaults to the empty string.
Since
1.42

Definition at line 2014 of file ParserOutput.php.

◆ toJsonArray()

MediaWiki\Parser\ParserOutput::toJsonArray ( )

Returns a JSON serializable structure representing this ParserOutput instance.

See also
::newFromJsonArray()
Returns
array

Reimplemented from MediaWiki\Parser\CacheTime.

Definition at line 3269 of file ParserOutput.php.

◆ unsetPageProperty()

MediaWiki\Parser\ParserOutput::unsetPageProperty ( string $name)

Remove a page property.

Parameters
string$nameThe page property name.
Since
1.38

Definition at line 2040 of file ParserOutput.php.

◆ updateRuntimeAdaptiveExpiry()

MediaWiki\Parser\ParserOutput::updateRuntimeAdaptiveExpiry ( int $ttl,
?string $source = null )

Lower the runtime adaptive TTL to at most this value.

Parameters
int$ttl
string | null$sourceCache-expiry attribution label
Since
1.46
See also
CacheTime::updateCacheExpiry()
Deprecated
since 1.46 Calling this method without $source.
Since
1.28

Definition at line 2569 of file ParserOutput.php.

Member Data Documentation

◆ MW_MERGE_STRATEGY_KEY

const MediaWiki\Parser\ParserOutput::MW_MERGE_STRATEGY_KEY = '_mw-strategy'
Access: internal
Since
1.38

Definition at line 105 of file ParserOutput.php.

◆ MW_MERGE_STRATEGY_UNION

const MediaWiki\Parser\ParserOutput::MW_MERGE_STRATEGY_UNION = MergeStrategy::UNION

Merge strategy to use for ParserOutput accumulators: "union" means that values are strings, stored as a set, and exposed as a PHP associative array mapping from values to true.

This constant should be treated as

Access: internal
until we expose alternative merge strategies for external use.
Access: internal
Since
1.38
Deprecated
since 1.45; use MergeStrategy::UNION

Definition at line 118 of file ParserOutput.php.

◆ PARSOID_PAGE_BUNDLE_KEY

const MediaWiki\Parser\ParserOutput::PARSOID_PAGE_BUNDLE_KEY = 'parsoid-page-bundle'
Access: internal
Since
1.45

Definition at line 99 of file ParserOutput.php.


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