MediaWiki REL1_36
|
Public Member Functions | |
__construct ( $text='', $languageLinks=[], $categoryLinks=[], $unused=false, $titletext='') | |
__sleep () | |
__wakeup () | |
addCacheMessage (string $msg) | |
Adds a comment notice about cache state to the text of the page. | |
addCategory ( $c, $sort) | |
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 ( $title) | |
addJsConfigVars ( $keys, $value=null) | |
Add one or more variables to be set in mw.config in JavaScript. | |
addLanguageLink ( $t) | |
addLink (Title $title, $id=null) | |
Record a local or interwiki inline link for saving in future link tables. | |
addModules ( $modules) | |
addModuleStyles ( $modules) | |
addOutputHook ( $hook, $data=false) | |
addOutputPageMetadata (OutputPage $out) | |
Copy items from the OutputPage object into this one. | |
addTemplate ( $title, $page_id, $rev_id) | |
Register a template dependency for this output. | |
addTrackingCategory ( $msg, $title) | |
Add a tracking category, getting the title from a system message, or print a debug message if the title is invalid. | |
addWarning ( $s) | |
addWrapperDivClass ( $class) | |
Add a CSS class to use for the wrapping div. | |
clearWrapperDivClass () | |
Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrapperDivClass() is called. | |
finalizeAdaptiveCacheExpiry () | |
Call this when parsing is done to lower the TTL based on low parse times. | |
getAllFlags () | |
& | getCategories () |
getCategoryLinks () | |
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 () |
getFlag ( $flag) | |
getHeadItems () | |
getHideNewSection () | |
& | getImages () |
getIndexPolicy () | |
getIndicators () | |
getInterwikiLinks () | |
getJsConfigVars () | |
& | getLanguageLinks () |
getLimitReportData () | |
getLimitReportJSData () | |
& | getLinks () |
& | getLinksSpecial () |
getModules () | |
getModuleStyles () | |
getNewSection () | |
getNoGallery () | |
getOutputHooks () | |
getProperties () | |
getProperty ( $name) | |
getRawText () | |
Get the cacheable text with <mw:editsection> markers still in it. | |
getRevisionTimestampUsed () | |
getRevisionUsedSha1Base36 () | |
getSections () | |
getSpeculativePageIdUsed () | |
getSpeculativeRevIdUsed () | |
& | getTemplateIds () |
& | getTemplates () |
getText ( $options=[]) | |
Get the output HTML. | |
getTimeSinceStart ( $clock) | |
Returns the time since resetParseStartTime() was last called. | |
getTimestamp () | |
getTitleText () | |
getTOCHTML () | |
getWarnings () | |
getWrapperDivClass () | |
Returns the class (or classes) to be used with the wrapper div for this otuput. | |
hasDynamicContent () | |
Check whether the cache TTL was lowered due to dynamic content. | |
hasText () | |
Returns true if text was passed to the constructor, or set using setText(). | |
hideNewSection ( $value) | |
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. | |
preventClickjacking ( $flag=null) | |
Get or set the prevent-clickjacking flag. | |
resetParseStartTime () | |
Resets the parse start timestamps for future calls to getTimeSinceStart() | |
setCategoryLinks ( $cl) | |
setDisplayTitle ( $text) | |
Override the title to be used for display. | |
setEnableOOUI ( $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. | |
setFlag ( $flag) | |
Attach a flag to the output so that it can be checked later to handle special cases. | |
setIndexPolicy ( $policy) | |
setIndicator ( $id, $content) | |
setLanguageLinks ( $ll) | |
setLimitReportData ( $key, $value) | |
Sets parser limit report data for a key. | |
setNewSection ( $value) | |
setNoGallery ( $value) | |
setProperty ( $name, $value) | |
Set a property to be stored in the page_props database table. | |
setRevisionTimestampUsed ( $timestamp) | |
setRevisionUsedSha1Base36 ( $hash) | |
setSections ( $toc) | |
setSpeculativePageIdUsed ( $id) | |
setSpeculativeRevIdUsed ( $id) | |
setText ( $text) | |
setTimestamp ( $timestamp) | |
setTitleText ( $t) | |
setTOCHTML ( $tochtml) | |
unsetProperty ( $name) | |
updateRuntimeAdaptiveExpiry ( $ttl) | |
Lower the runtime adaptive TTL to at most this value. | |
Public Member Functions inherited from 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. | |
getCacheExpiry () | |
Returns the number of seconds after which this object should expire. | |
getCacheRevisionId () | |
getCacheTime () | |
getUsedOptions () | |
Returns the options from its ParserOptions which have been taken into account to produce the output. | |
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) | |
Sets 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 | newFromJsonArray (JsonUnserializer $unserializer, array $json) |
Creates a new instance of the class and initialized it from the $json array. | |
Public Attributes | |
array | $mCategories |
Map of category names to sort keys. | |
bool | $mEnableOOUI = false |
Whether OOUI should be enabled. | |
array | $mExternalLinks = [] |
External link URLs, in the key only. | |
array | $mFileSearchOptions = [] |
DB keys of the images used mapped to sha1 and MW timestamp. | |
array | $mHeadItems = [] |
Items to put in the <head> section. | |
bool | $mHideNewSection = false |
Hide the new section link? | |
array | $mImages = [] |
DB keys of the images used, in the array key only. | |
array | $mIndicators = [] |
Page status indicators, usually displayed in top-right corner. | |
array | $mInterwikiLinks = [] |
2-D map of prefix/DBK (in keys only) for the inline interwiki links in the document. | |
array | $mJsConfigVars = [] |
JavaScript config variable for mw.config combined with this page. | |
array | $mLanguageLinks |
List of the full text of language links, in the order they appear. | |
int[][] | $mLinks = [] |
2-D map of NS/DBK to ID for the links in the document. | |
array | $mLinksSpecial = [] |
Keys are DBKs for the links to special pages in the document. | |
array | $mModules = [] |
Modules to be loaded by ResourceLoader. | |
array | $mModuleStyles = [] |
Modules of which only the CSSS will be loaded by ResourceLoader. | |
bool | $mNewSection = false |
Show a new section link? | |
bool | $mNoGallery = false |
No gallery on category page? (NOGALLERY). | |
array | $mOutputHooks = [] |
Hook tags as per $wgParserOutputHooks. | |
array | $mProperties = [] |
Name/value pairs to be cached in the DB. | |
array | $mSections = [] |
Table of contents. | |
array | $mTemplateIds = [] |
2-D map of NS/DBK to rev ID for the template references. | |
array | $mTemplates = [] |
2-D map of NS/DBK to ID for the template references. | |
string null | $mText = null |
The output text. | |
string | $mTimestamp |
Timestamp of the revision. | |
string | $mTitleText |
Title text of the chosen language variant, as HTML. | |
string | $mTOCHTML = '' |
HTML of the TOC. | |
array | $mWarnings = [] |
Warning text to be returned to the user. | |
const | SUPPORTS_STATELESS_TRANSFORMS = 1 |
Feature flags to indicate to extensions that MediaWiki core supports and uses getText() stateless transforms. | |
const | SUPPORTS_UNWRAP_TRANSFORM = 1 |
Public Attributes inherited from CacheTime | |
int null | $mCacheExpiry = null |
Seconds after which the object should expire, use 0 for not cacheable. | |
int null | $mCacheRevisionId = null |
Revision ID that was parsed. | |
string int | $mCacheTime = '' |
TS_MW timestamp when this object was generated, or -1 for not cacheable. | |
Protected Member Functions | |
initFromJson (JsonUnserializer $unserializer, array $jsonData) | |
Initialize member fields from an array returned by jsonSerialize(). | |
toJsonArray () | |
Returns a JSON serializable structure representing this ParserOutput instance. | |
Static Private Member Functions | |
static | detectAndDecodeBinary (array $properties) |
Finds any associative arrays that represent encoded binary strings, and replaces them with the decoded binary data. | |
static | detectAndEncodeBinary (array $properties) |
Finds any non-utf8 strings in the given array and replaces them with an associative array that wraps a base64 encoded version of the data. | |
static | getTimes ( $clock=null) |
static | merge2D (array $a, array $b) |
static | mergeList (array $a, array $b) |
static | mergeMap (array $a, array $b) |
static | mergeMixedList (array $a, array $b) |
static | useEachMinValue (array $a, array $b) |
static | useMaxValue ( $a, $b) |
static | useMinValue ( $a, $b) |
Private Attributes | |
array | $mExtensionData = [] |
extra data used by extensions. | |
array | $mExtraDefaultSrcs = [] |
Extra default-src for CSP [Everything but script and style]. | |
array | $mExtraScriptSrcs = [] |
Extra script-src for CSP. | |
array | $mExtraStyleSrcs = [] |
Extra style-src for CSP. | |
array | $mFlags = [] |
Generic flags. | |
string | $mIndexPolicy = '' |
'index' or 'noindex'? Any other value will result in no change. | |
array | $mLimitReportData = [] |
Parser limit report data. | |
array | $mLimitReportJSData = [] |
Parser limit report data for JSON. | |
int | $mMaxAdaptiveExpiry = INF |
Upper bound of expiry based on parse duration. | |
array | $mParseStartTime = [] |
Timestamps for getTimeSinceStart(). | |
bool | $mPreventClickjacking = false |
Whether to emit X-Frame-Options: DENY. | |
int null | $mSpeculativeRevId |
Assumed rev ID for {{REVISIONID}} if no revision is set. | |
$mWrapperDivClasses = [] | |
string CSS classes to use for the wrapping div, stored in the array keys. | |
int null | $revisionTimestampUsed |
Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set. | |
string null | $revisionUsedSha1Base36 |
SHA-1 base 36 hash of any self-transclusion. | |
int null | $speculativePageIdUsed |
Assumed page ID for {{PAGEID}} if no revision is set. | |
const | EDITSECTION_REGEX |
const | FAST_AR_TTL = 60 |
const | MIN_AR_TTL = 15 |
const | PARSE_FAST_SEC = 0.100 |
const | PARSE_SLOW_SEC = 1.0 |
const | SLOW_AR_TTL = 3600 |
Additional Inherited Members | |
Protected Attributes inherited from CacheTime | |
true[] | $mParseUsedOptions = [] |
ParserOptions which have been taken into account to produce output, option names stored in array keys. | |
Definition at line 31 of file ParserOutput.php.
ParserOutput::__construct | ( | $text = '' , |
|
$languageLinks = [] , |
|||
$categoryLinks = [] , |
|||
$unused = false , |
|||
$titletext = '' |
|||
) |
string | null | $text | HTML. 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. |
array | $languageLinks | |
array | $categoryLinks | |
bool | $unused | |
string | $titletext |
Definition at line 285 of file ParserOutput.php.
ParserOutput::__sleep | ( | ) |
Definition at line 1428 of file ParserOutput.php.
ParserOutput::__wakeup | ( | ) |
Reimplemented from CacheTime.
Definition at line 1826 of file ParserOutput.php.
ParserOutput::addCacheMessage | ( | string | $msg | ) |
Adds a comment notice about cache state to the text of the page.
string | $msg |
Definition at line 463 of file ParserOutput.php.
Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and ParserCache\save().
ParserOutput::addCategory | ( | $c, | |
$sort | |||
) |
Definition at line 756 of file ParserOutput.php.
Referenced by addTrackingCategory().
ParserOutput::addExternalLink | ( | $url | ) |
Definition at line 826 of file ParserOutput.php.
References $wgRegisterInternalExternals, $wgServer, and Parser\normalizeLinkUrl().
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.
string | $src | CSP source e.g. example.com |
Definition at line 1377 of file ParserOutput.php.
ParserOutput::addExtraCSPScriptSrc | ( | $src | ) |
Add an extra value to Content-Security-Policy script-src directive.
Call this if you are loading third-party Javascript
string | $src | CSP source e.g. example.com |
Definition at line 1399 of file ParserOutput.php.
ParserOutput::addExtraCSPStyleSrc | ( | $src | ) |
Add an extra value to Content-Security-Policy style-src directive.
string | $src | CSP source e.g. example.com |
Definition at line 1387 of file ParserOutput.php.
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.
string | $section | |
string | bool | $tag |
Definition at line 932 of file ParserOutput.php.
ParserOutput::addImage | ( | $name, | |
$timestamp = null , |
|||
$sha1 = null |
|||
) |
Register a file dependency for this output.
string | $name | Title dbKey |
string | false | null | $timestamp | MW timestamp of file creation (or false if non-existing) |
string | false | null | $sha1 | Base 36 SHA-1 of file (or false if non-existing) |
Definition at line 884 of file ParserOutput.php.
ParserOutput::addInterwikiLink | ( | $title | ) |
MWException | If given invalid input |
Definition at line 914 of file ParserOutput.php.
References $title.
Referenced by addLink().
ParserOutput::addJsConfigVars | ( | $keys, | |
$value = null |
|||
) |
Add one or more variables to be set in mw.config in JavaScript.
string | array | $keys | Key or array of key/value pairs. |
mixed | null | $value | [optional] Value of the configuration variable. |
Definition at line 963 of file ParserOutput.php.
References $keys.
Referenced by addOutputPageMetadata().
ParserOutput::addLanguageLink | ( | $t | ) |
Definition at line 780 of file ParserOutput.php.
References $t.
ParserOutput::addLink | ( | Title | $title, |
$id = null |
|||
) |
Record a local or interwiki inline link for saving in future link tables.
Title | $title | |
int | null | $id | Optional known page_id so we can skip the lookup |
Definition at line 849 of file ParserOutput.php.
References $title, addInterwikiLink(), NS_FILE, NS_MEDIA, and NS_SPECIAL.
Referenced by WikitextContent\fillParserOutput().
ParserOutput::addModules | ( | $modules | ) |
string | array | $modules |
Definition at line 944 of file ParserOutput.php.
References $modules.
Referenced by addOutputPageMetadata().
ParserOutput::addModuleStyles | ( | $modules | ) |
string | array | $modules |
Definition at line 952 of file ParserOutput.php.
References $modules.
Referenced by addOutputPageMetadata(), JsonContent\fillParserOutput(), and WikitextContent\fillParserOutput().
ParserOutput::addOutputHook | ( | $hook, | |
$data = false |
|||
) |
Definition at line 788 of file ParserOutput.php.
ParserOutput::addOutputPageMetadata | ( | OutputPage | $out | ) |
Copy items from the OutputPage object into this one.
OutputPage | $out |
Definition at line 979 of file ParserOutput.php.
References addJsConfigVars(), addModules(), addModuleStyles(), OutputPage\getHeadItemsArray(), OutputPage\getJsConfigVars(), OutputPage\getModules(), OutputPage\getModuleStyles(), and OutputPage\getPreventClickjacking().
ParserOutput::addTemplate | ( | $title, | |
$page_id, | |||
$rev_id | |||
) |
Register a template dependency for this output.
Title | $title | |
int | $page_id | |
int | $rev_id |
Definition at line 897 of file ParserOutput.php.
References $title.
ParserOutput::addTrackingCategory | ( | $msg, | |
$title | |||
) |
Add a tracking category, getting the title from a system message, or print a debug message if the title is invalid.
Any message used with this function should be registered so it will show up on Special:TrackingCategories. Core messages should be added to SpecialTrackingCategories::$coreTrackingCategories, and extensions should add to "TrackingCategories" in their extension.json.
Definition at line 1004 of file ParserOutput.php.
References $title, addCategory(), NS_CATEGORY, wfDebug(), and wfMessage().
ParserOutput::addWarning | ( | $s | ) |
Definition at line 784 of file ParserOutput.php.
References $s.
ParserOutput::addWrapperDivClass | ( | $class | ) |
Add a CSS class to use for the wrapping div.
If no class is given, no wrapper is added.
string | $class |
Definition at line 472 of file ParserOutput.php.
ParserOutput::clearWrapperDivClass | ( | ) |
Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrapperDivClass() is called.
Definition at line 480 of file ParserOutput.php.
Referenced by TextContent\fillParserOutput().
|
staticprivate |
Finds any associative arrays that represent encoded binary strings, and replaces them with the decoded binary data.
array | $properties |
Definition at line 1814 of file ParserOutput.php.
|
staticprivate |
Finds any non-utf8 strings in the given array and replaces them with an associative array that wraps a base64 encoded version of the data.
Inverse of detectAndDecodeBinary().
array | $properties |
Definition at line 1790 of file ParserOutput.php.
Referenced by toJsonArray().
ParserOutput::finalizeAdaptiveCacheExpiry | ( | ) |
Call this when parsing is done to lower the TTL based on low parse times.
Definition at line 1408 of file ParserOutput.php.
References getTimeSinceStart(), and CacheTime\updateCacheExpiry().
ParserOutput::getAllFlags | ( | ) |
Definition at line 1084 of file ParserOutput.php.
& ParserOutput::getCategories | ( | ) |
Definition at line 582 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), OutputPage\addParserOutputMetadata(), and SpecialExpandTemplates\showHtmlPreview().
ParserOutput::getCategoryLinks | ( | ) |
Definition at line 578 of file ParserOutput.php.
Referenced by MediaWiki\Search\ParserOutputSearchDataExtractor\getCategories().
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.
Definition at line 1055 of file ParserOutput.php.
References $t, and getTitleText().
ParserOutput::getEnableOOUI | ( | ) |
Definition at line 693 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
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.
string | $key | The key to look up. |
Definition at line 1242 of file ParserOutput.php.
& ParserOutput::getExternalLinks | ( | ) |
Definition at line 630 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), and MediaWiki\Search\ParserOutputSearchDataExtractor\getExternalLinks().
ParserOutput::getExtraCSPDefaultSrcs | ( | ) |
Get extra Content-Security-Policy 'default-src' directives.
Definition at line 702 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getExtraCSPScriptSrcs | ( | ) |
Get extra Content-Security-Policy 'script-src' directives.
Definition at line 711 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getExtraCSPStyleSrcs | ( | ) |
Get extra Content-Security-Policy 'style-src' directives.
Definition at line 720 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
& ParserOutput::getFileSearchOptions | ( | ) |
Definition at line 626 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getFlag | ( | $flag | ) |
string | $flag |
Definition at line 1076 of file ParserOutput.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData(), and MediaWiki\Storage\PageEditStash\storeStashValue().
ParserOutput::getHeadItems | ( | ) |
Definition at line 642 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getHideNewSection | ( | ) |
Definition at line 800 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
& ParserOutput::getImages | ( | ) |
Definition at line 622 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), and OutputPage\addParserOutputMetadata().
ParserOutput::getIndexPolicy | ( | ) |
Definition at line 670 of file ParserOutput.php.
ParserOutput::getIndicators | ( | ) |
Definition at line 590 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getInterwikiLinks | ( | ) |
Definition at line 574 of file ParserOutput.php.
Referenced by LinksUpdate\__construct().
ParserOutput::getJsConfigVars | ( | ) |
Definition at line 658 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputContent(), and OutputPage\addParserOutputMetadata().
& ParserOutput::getLanguageLinks | ( | ) |
Definition at line 570 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), and OutputPage\addParserOutputMetadata().
ParserOutput::getLimitReportData | ( | ) |
Definition at line 685 of file ParserOutput.php.
ParserOutput::getLimitReportJSData | ( | ) |
Definition at line 689 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
& ParserOutput::getLinks | ( | ) |
Definition at line 602 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), and MediaWiki\Search\ParserOutputSearchDataExtractor\getOutgoingLinks().
& ParserOutput::getLinksSpecial | ( | ) |
Definition at line 610 of file ParserOutput.php.
ParserOutput::getModules | ( | ) |
Definition at line 646 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputContent(), and OutputPage\addParserOutputMetadata().
ParserOutput::getModuleStyles | ( | ) |
Definition at line 650 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputContent(), and OutputPage\addParserOutputMetadata().
ParserOutput::getNewSection | ( | ) |
Definition at line 804 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getNoGallery | ( | ) |
Definition at line 638 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getOutputHooks | ( | ) |
Definition at line 662 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getProperties | ( | ) |
Definition at line 1173 of file ParserOutput.php.
Referenced by LinksUpdate\__construct().
ParserOutput::getProperty | ( | $name | ) |
string | $name | The property name to look up. |
Definition at line 1165 of file ParserOutput.php.
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.
Definition at line 316 of file ParserOutput.php.
References $mText.
Referenced by WikitextContent\fillParserOutput(), and getText().
ParserOutput::getRevisionTimestampUsed | ( | ) |
Definition at line 539 of file ParserOutput.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData().
ParserOutput::getRevisionUsedSha1Base36 | ( | ) |
Definition at line 566 of file ParserOutput.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData().
ParserOutput::getSections | ( | ) |
Definition at line 598 of file ParserOutput.php.
ParserOutput::getSpeculativePageIdUsed | ( | ) |
Definition at line 523 of file ParserOutput.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData().
ParserOutput::getSpeculativeRevIdUsed | ( | ) |
Definition at line 507 of file ParserOutput.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData().
& ParserOutput::getTemplateIds | ( | ) |
Definition at line 618 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
& ParserOutput::getTemplates | ( | ) |
Definition at line 614 of file ParserOutput.php.
Referenced by LinksUpdate\__construct(), and MediaWiki\Search\ParserOutputSearchDataExtractor\getTemplates().
ParserOutput::getText | ( | $options = [] | ) |
Get the output HTML.
array | $options | (since 1.31) Transformations to apply to the HTML
|
Definition at line 350 of file ParserOutput.php.
References getRawText(), getTitleText(), getWrapperDivClass(), Parser\TOC_END, Parser\TOC_START, and wfUrlencode().
Referenced by OutputPage\addParserOutputText(), Status\getHTML(), and Message\parseText().
|
staticprivate |
Definition at line 1246 of file ParserOutput.php.
ParserOutput::getTimeSinceStart | ( | $clock | ) |
Returns the time since resetParseStartTime() was last called.
Clocks available are:
string | $clock |
Definition at line 1278 of file ParserOutput.php.
Referenced by finalizeAdaptiveCacheExpiry().
ParserOutput::getTimestamp | ( | ) |
Definition at line 681 of file ParserOutput.php.
Referenced by Article\doOutputFromParserCache().
ParserOutput::getTitleText | ( | ) |
Definition at line 594 of file ParserOutput.php.
Referenced by Article\adjustDisplayTitle(), getDisplayTitle(), and getText().
ParserOutput::getTOCHTML | ( | ) |
Definition at line 674 of file ParserOutput.php.
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::getWarnings | ( | ) |
Definition at line 666 of file ParserOutput.php.
ParserOutput::getWrapperDivClass | ( | ) |
Returns the class (or classes) to be used with the wrapper div for this otuput.
If there is no wrapper class given, no wrapper div should be added. The wrapper div is added automatically by getText().
Definition at line 491 of file ParserOutput.php.
Referenced by getText().
ParserOutput::hasDynamicContent | ( | ) |
Check whether the cache TTL was lowered due to dynamic content.
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.
Definition at line 1340 of file ParserOutput.php.
References $wgParserCacheExpireTime, and CacheTime\getCacheExpiry().
Referenced by WikiPage\triggerOpportunisticLinksUpdate().
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.
Definition at line 304 of file ParserOutput.php.
Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and ParserCache\save().
ParserOutput::hideNewSection | ( | $value | ) |
Definition at line 796 of file ParserOutput.php.
|
protected |
Initialize member fields from an array returned by jsonSerialize().
JsonUnserializer | $unserializer | |
array | $jsonData |
Reimplemented from CacheTime.
Definition at line 1733 of file ParserOutput.php.
References MediaWiki\Json\JsonUnserializer\unserializeArray().
|
static |
Checks, if a url is pointing to the own server.
string | $internal | The server to check against |
string | $url | The url to check |
Definition at line 815 of file ParserOutput.php.
|
staticprivate |
Definition at line 1598 of file ParserOutput.php.
References $keys.
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 mered into the HTML of this ParserOutput.
ParserOutput | $source |
Definition at line 1487 of file ParserOutput.php.
References $source.
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.
ParserOutput | $source |
Definition at line 1451 of file ParserOutput.php.
References $source, useEachMinValue(), useMaxValue(), and wfLogWarning().
|
staticprivate |
Definition at line 1590 of file ParserOutput.php.
|
staticprivate |
Definition at line 1594 of file ParserOutput.php.
|
staticprivate |
Definition at line 1586 of file ParserOutput.php.
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.
ParserOutput | $source |
Definition at line 1556 of file ParserOutput.php.
References $source.
|
static |
Creates a new instance of the class and initialized it from the $json array.
JsonUnserializer | $unserializer | an instance of JsonUnserializer to use for nested properties if they need special care. |
array | $json |
Reimplemented from CacheTime.
Definition at line 1722 of file ParserOutput.php.
ParserOutput::preventClickjacking | ( | $flag = null | ) |
Get or set the prevent-clickjacking flag.
bool | null | $flag | New flag value, or null to leave it unchanged |
Definition at line 1353 of file ParserOutput.php.
References wfSetVar().
Referenced by OutputPage\addParserOutputMetadata().
ParserOutput::resetParseStartTime | ( | ) |
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition at line 1263 of file ParserOutput.php.
ParserOutput::setCategoryLinks | ( | $cl | ) |
Definition at line 732 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setDisplayTitle | ( | $text | ) |
Override the title to be used for display.
string | $text | Desired title text |
Definition at line 1042 of file ParserOutput.php.
References setProperty(), and setTitleText().
ParserOutput::setEnableOOUI | ( | $enable = false | ) |
Enables OOUI, if true, in any OutputPage instance this ParserOutput object is added to.
bool | $enable | If OOUI should be enabled or not |
Definition at line 776 of file ParserOutput.php.
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 setProperty(), 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:
And then later, in OutputPageParserOutput or similar:
In MediaWiki 1.20 and older, you have to use a custom member variable within the ParserOutput object:
string | $key | The 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 | JsonUnserializable | $value | The value to set. Setting a value to null is equivalent to removing the value. |
Definition at line 1223 of file ParserOutput.php.
ParserOutput::setFlag | ( | $flag | ) |
Attach a flag to the output so that it can be checked later to handle special cases.
string | $flag |
Definition at line 1068 of file ParserOutput.php.
Referenced by WikitextContent\fillParserOutput().
ParserOutput::setIndexPolicy | ( | $policy | ) |
Definition at line 744 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setIndicator | ( | $id, | |
$content | |||
) |
string | $id | |
string | $content |
Definition at line 765 of file ParserOutput.php.
References $content.
ParserOutput::setLanguageLinks | ( | $ll | ) |
Definition at line 728 of file ParserOutput.php.
References wfSetVar().
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:
Note that all values are interpreted as wikitext, and so should be encoded with htmlspecialchars() as necessary, but should avoid complex HTML for sanity of display in the "NewPP limit report" comment.
string | $key | Message key |
mixed | $value | Appropriate for Message::params() |
Definition at line 1306 of file ParserOutput.php.
ParserOutput::setNewSection | ( | $value | ) |
Definition at line 792 of file ParserOutput.php.
ParserOutput::setNoGallery | ( | $value | ) |
Definition at line 634 of file ParserOutput.php.
ParserOutput::setProperty | ( | $name, | |
$value | |||
) |
Set a 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.
setProperty() 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:
If you are writing an extension where you want to set a property in the parser which is used by an OutputPageParserOutput hook, you have to associate the extension data directly with the ParserOutput object. Since MediaWiki 1.21, you can use setExtensionData() to do this:
And then later, in OutputPageParserOutput or similar:
In MediaWiki 1.20 and older, you have to use a custom member variable within the ParserOutput object:
string | $name | |
int | float | string | bool | null | $value |
Definition at line 1153 of file ParserOutput.php.
Referenced by setDisplayTitle().
ParserOutput::setRevisionTimestampUsed | ( | $timestamp | ) |
string | $timestamp | TS_MW timestamp |
Definition at line 531 of file ParserOutput.php.
ParserOutput::setRevisionUsedSha1Base36 | ( | $hash | ) |
string | $hash | Lowercase SHA-1 base 36 hash |
Definition at line 547 of file ParserOutput.php.
ParserOutput::setSections | ( | $toc | ) |
Definition at line 740 of file ParserOutput.php.
References wfSetVar().
ParserOutput::setSpeculativePageIdUsed | ( | $id | ) |
ParserOutput::setSpeculativeRevIdUsed | ( | $id | ) |
ParserOutput::setText | ( | $text | ) |
Definition at line 724 of file ParserOutput.php.
References wfSetVar().
Referenced by FallbackContent\fillParserOutput(), JsonContent\fillParserOutput(), TextContent\fillParserOutput(), WikitextContent\fillParserOutput(), TablePager\getBodyOutput(), and TablePager\getFullOutput().
ParserOutput::setTimestamp | ( | $timestamp | ) |
Definition at line 752 of file ParserOutput.php.
References wfSetVar().
Referenced by MediaWiki\Parser\RevisionOutputCache\save().
ParserOutput::setTitleText | ( | $t | ) |
Definition at line 736 of file ParserOutput.php.
References $t, and wfSetVar().
Referenced by setDisplayTitle().
ParserOutput::setTOCHTML | ( | $tochtml | ) |
Definition at line 748 of file ParserOutput.php.
References wfSetVar().
|
protected |
Returns a JSON serializable structure representing this ParserOutput instance.
Reimplemented from CacheTime.
Definition at line 1662 of file ParserOutput.php.
References detectAndEncodeBinary().
ParserOutput::unsetProperty | ( | $name | ) |
Definition at line 1169 of file ParserOutput.php.
ParserOutput::updateRuntimeAdaptiveExpiry | ( | $ttl | ) |
Lower the runtime adaptive TTL to at most this value.
int | $ttl |
Definition at line 1363 of file ParserOutput.php.
References CacheTime\updateCacheExpiry().
|
staticprivate |
Definition at line 1617 of file ParserOutput.php.
References $keys.
Referenced by mergeInternalMetaDataFrom().
|
staticprivate |
Definition at line 1644 of file ParserOutput.php.
Referenced by mergeInternalMetaDataFrom().
|
staticprivate |
Definition at line 1632 of file ParserOutput.php.
array ParserOutput::$mCategories |
Map of category names to sort keys.
Definition at line 62 of file ParserOutput.php.
bool ParserOutput::$mEnableOOUI = false |
Whether OOUI should be enabled.
Definition at line 189 of file ParserOutput.php.
|
private |
extra data used by extensions.
Definition at line 199 of file ParserOutput.php.
array ParserOutput::$mExternalLinks = [] |
External link URLs, in the key only.
Definition at line 112 of file ParserOutput.php.
|
private |
Extra default-src for CSP [Everything but script and style].
Definition at line 227 of file ParserOutput.php.
|
private |
Extra script-src for CSP.
Definition at line 222 of file ParserOutput.php.
|
private |
Extra style-src for CSP.
Definition at line 232 of file ParserOutput.php.
array ParserOutput::$mFileSearchOptions = [] |
DB keys of the images used mapped to sha1 and MW timestamp.
Definition at line 107 of file ParserOutput.php.
|
private |
Generic flags.
Definition at line 237 of file ParserOutput.php.
array ParserOutput::$mHeadItems = [] |
Items to put in the <head> section.
Definition at line 138 of file ParserOutput.php.
bool ParserOutput::$mHideNewSection = false |
Hide the new section link?
Definition at line 128 of file ParserOutput.php.
array ParserOutput::$mImages = [] |
DB keys of the images used, in the array key only.
Definition at line 102 of file ParserOutput.php.
|
private |
'index' or 'noindex'? Any other value will result in no change.
Definition at line 194 of file ParserOutput.php.
array ParserOutput::$mIndicators = [] |
Page status indicators, usually displayed in top-right corner.
Definition at line 67 of file ParserOutput.php.
array ParserOutput::$mInterwikiLinks = [] |
2-D map of prefix/DBK (in keys only) for the inline interwiki links in the document.
Definition at line 118 of file ParserOutput.php.
array ParserOutput::$mJsConfigVars = [] |
JavaScript config variable for mw.config combined with this page.
Definition at line 153 of file ParserOutput.php.
array ParserOutput::$mLanguageLinks |
List of the full text of language links, in the order they appear.
Definition at line 57 of file ParserOutput.php.
|
private |
Parser limit report data.
Definition at line 204 of file ParserOutput.php.
|
private |
Parser limit report data for JSON.
Definition at line 207 of file ParserOutput.php.
int [][] ParserOutput::$mLinks = [] |
2-D map of NS/DBK to ID for the links in the document.
ID=zero for broken.
Definition at line 79 of file ParserOutput.php.
array ParserOutput::$mLinksSpecial = [] |
Keys are DBKs for the links to special pages in the document.
Definition at line 85 of file ParserOutput.php.
|
private |
Upper bound of expiry based on parse duration.
Definition at line 262 of file ParserOutput.php.
array ParserOutput::$mModules = [] |
Modules to be loaded by ResourceLoader.
Definition at line 143 of file ParserOutput.php.
array ParserOutput::$mModuleStyles = [] |
Modules of which only the CSSS will be loaded by ResourceLoader.
Definition at line 148 of file ParserOutput.php.
bool ParserOutput::$mNewSection = false |
Show a new section link?
Definition at line 123 of file ParserOutput.php.
bool ParserOutput::$mNoGallery = false |
No gallery on category page? (NOGALLERY).
Definition at line 133 of file ParserOutput.php.
array ParserOutput::$mOutputHooks = [] |
Hook tags as per $wgParserOutputHooks.
Definition at line 158 of file ParserOutput.php.
|
private |
Timestamps for getTimeSinceStart().
Definition at line 212 of file ParserOutput.php.
|
private |
Whether to emit X-Frame-Options: DENY.
Definition at line 217 of file ParserOutput.php.
array ParserOutput::$mProperties = [] |
Name/value pairs to be cached in the DB.
Definition at line 174 of file ParserOutput.php.
array ParserOutput::$mSections = [] |
Table of contents.
Definition at line 169 of file ParserOutput.php.
|
private |
Assumed rev ID for {{REVISIONID}} if no revision is set.
Definition at line 247 of file ParserOutput.php.
array ParserOutput::$mTemplateIds = [] |
2-D map of NS/DBK to rev ID for the template references.
ID=zero for broken.
Definition at line 97 of file ParserOutput.php.
array ParserOutput::$mTemplates = [] |
2-D map of NS/DBK to ID for the template references.
ID=zero for broken.
Definition at line 91 of file ParserOutput.php.
string null ParserOutput::$mText = null |
The output text.
Definition at line 51 of file ParserOutput.php.
string ParserOutput::$mTimestamp |
Timestamp of the revision.
Definition at line 184 of file ParserOutput.php.
string ParserOutput::$mTitleText |
Title text of the chosen language variant, as HTML.
Definition at line 72 of file ParserOutput.php.
string ParserOutput::$mTOCHTML = '' |
HTML of the TOC.
Definition at line 179 of file ParserOutput.php.
array ParserOutput::$mWarnings = [] |
Warning text to be returned to the user.
Wikitext formatted, in the key only.
Definition at line 164 of file ParserOutput.php.
|
private |
string CSS classes to use for the wrapping div, stored in the array keys.
If no class is given, no wrapper is added.
Definition at line 259 of file ParserOutput.php.
|
private |
Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set.
Definition at line 251 of file ParserOutput.php.
|
private |
SHA-1 base 36 hash of any self-transclusion.
Definition at line 254 of file ParserOutput.php.
|
private |
Assumed page ID for {{PAGEID}} if no revision is set.
Definition at line 249 of file ParserOutput.php.
|
private |
Definition at line 264 of file ParserOutput.php.
|
private |
Definition at line 272 of file ParserOutput.php.
|
private |
Definition at line 274 of file ParserOutput.php.
|
private |
Definition at line 270 of file ParserOutput.php.
|
private |
Definition at line 271 of file ParserOutput.php.
|
private |
Definition at line 273 of file ParserOutput.php.
const ParserOutput::SUPPORTS_STATELESS_TRANSFORMS = 1 |
Feature flags to indicate to extensions that MediaWiki core supports and uses getText() stateless transforms.
Definition at line 41 of file ParserOutput.php.
const ParserOutput::SUPPORTS_UNWRAP_TRANSFORM = 1 |
Definition at line 46 of file ParserOutput.php.