section */ public $mHeadItems = []; /** * @var array $mModules Modules to be loaded by ResourceLoader */ public $mModules = []; /** * @var array $mModuleStyles Modules of which only the CSSS will be loaded by ResourceLoader. */ public $mModuleStyles = []; /** * @var array $mJsConfigVars JavaScript config variable for mw.config combined with this page. */ public $mJsConfigVars = []; /** * @var array $mOutputHooks Hook tags as per $wgParserOutputHooks. */ public $mOutputHooks = []; /** * @var array $mWarnings Warning text to be returned to the user. * Wikitext formatted, in the key only. */ public $mWarnings = []; /** * @var array $mSections Table of contents */ public $mSections = []; /** * @var array $mProperties Name/value pairs to be cached in the DB. */ public $mProperties = []; /** * @var string $mTOCHTML HTML of the TOC. */ public $mTOCHTML = ''; /** * @var string $mTimestamp Timestamp of the revision. */ public $mTimestamp; /** * @var bool $mEnableOOUI Whether OOUI should be enabled. */ public $mEnableOOUI = false; /** * @var string $mIndexPolicy 'index' or 'noindex'? Any other value will result in no change. */ private $mIndexPolicy = ''; /** * @var true[] $mAccessedOptions List of ParserOptions (stored in the keys). */ private $mAccessedOptions = []; /** * @var array $mExtensionData extra data used by extensions. */ private $mExtensionData = []; /** * @var array $mLimitReportData Parser limit report data. */ private $mLimitReportData = []; /** @var array Parser limit report data for JSON */ private $mLimitReportJSData = []; /** * @var array $mParseStartTime Timestamps for getTimeSinceStart(). */ private $mParseStartTime = []; /** * @var bool $mPreventClickjacking Whether to emit X-Frame-Options: DENY. */ private $mPreventClickjacking = false; /** * @var array $mFlags Generic flags. */ private $mFlags = []; /** @var int|null Assumed rev ID for {{REVISIONID}} if no revision is set */ private $mSpeculativeRevId; /** string CSS classes to use for the wrapping div, stored in the array keys. * If no class is given, no wrapper is added. */ private $mWrapperDivClasses = []; /** @var int Upper bound of expiry based on parse duration */ private $mMaxAdaptiveExpiry = INF; const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#s'; // finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, MIN_AR_TTL) // Current values imply that m=3933.333333 and b=-333.333333 // See https://www.nngroup.com/articles/website-response-times/ const PARSE_FAST_SEC = 0.100; // perceived "fast" page parse const PARSE_SLOW_SEC = 1.0; // perceived "slow" page parse const FAST_AR_TTL = 60; // adaptive TTL for "fast" pages const SLOW_AR_TTL = 3600; // adaptive TTL for "slow" pages const MIN_AR_TTL = 15; // min adaptive TTL (for sanity, pool counter, and edit stashing) /** * @param 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. * @param array $languageLinks * @param array $categoryLinks * @param bool $unused * @param string $titletext */ public function __construct( $text = '', $languageLinks = [], $categoryLinks = [], $unused = false, $titletext = '' ) { $this->mText = $text; $this->mLanguageLinks = $languageLinks; $this->mCategories = $categoryLinks; $this->mTitleText = $titletext; } /** * 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 * * @return bool Whether this ParserOutput contains rendered text. If this returns false, the * ParserOutput contains meta-data only. */ public function hasText() { return ( $this->mText !== null ); } /** * Get the cacheable text with markers still in it. The * return value is suitable for writing back via setText() but is not valid * for display to the user. * * @return string * @since 1.27 */ public function getRawText() { if ( $this->mText === null ) { throw new LogicException( 'This ParserOutput contains no text!' ); } return $this->mText; } /** * Get the output HTML * * @param array $options (since 1.31) Transformations to apply to the HTML * - allowTOC: (bool) Show the TOC, assuming there were enough headings * to generate one and `__NOTOC__` wasn't used. Default is true, * but might be statefully overridden. * - enableSectionEditLinks: (bool) Include section edit links, assuming * section edit link tokens are present in the HTML. Default is true, * but might be statefully overridden. * - unwrap: (bool) Return text without a wrapper div. Default is false, * meaning a wrapper div will be added if getWrapperDivClass() returns * a non-empty string. * - wrapperDivClass: (string) Wrap the output in a div and apply the given * CSS class to that div. This overrides the output of getWrapperDivClass(). * Setting this to an empty string has the same effect as 'unwrap' => true. * - deduplicateStyles: (bool) When true, which is the default, `#s', function ( $m ) use ( &$seen ) { $attr = Sanitizer::decodeTagAttributes( $m[1] ); if ( !isset( $attr['data-mw-deduplicate'] ) ) { return $m[0]; } $key = $attr['data-mw-deduplicate']; if ( !isset( $seen[$key] ) ) { $seen[$key] = true; return $m[0]; } // We were going to use an empty