MediaWiki REL1_27
Parser Class Reference

PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for making links), and provides a one-way transformation of that wiki markup it into (X)HTML output / markup (which in turn the browser understands, and can display). More...

Collaboration diagram for Parser:

Public Member Functions

 __clone ()
 Allow extensions to clean up when the parser is cloned.
 
 __construct ( $conf=[])
 
 __destruct ()
 Reduce memory usage to reduce the impact of circular references.
 
 clearState ()
 Clear Parser state.
 
 doAllQuotes ( $text)
 Replace single quotes with HTML markup.
 
 doHeadings ( $text)
 Parse headers and return html.
 
 doMagicLinks ( $text)
 Replace special strings like "ISBN xxx" and "RFC xxx" with magic external links.
 
 doQuotes ( $text)
 Helper function for doAllQuotes()
 
 doTableStuff ( $text)
 parse the wiki syntax used to render tables
 
 firstCallInit ()
 Do various kinds of initialisation on the first call of the parser.
 
 getConverterLanguage ()
 Get the language object for language conversion.
 
 getFunctionLang ()
 Get a language object for use in parser functions such as {{FORMATNUM:}}.
 
 getOptions ()
 Get the ParserOptions object.
 
 getOutput ()
 Get the ParserOutput object.
 
 getPreloadText ( $text, Title $title, ParserOptions $options, $params=[])
 Process the wikitext for the "?preload=" feature.
 
 getPreprocessor ()
 Get a preprocessor object.
 
 getStripList ()
 Get a list of strippable XML-like elements.
 
 getTargetLanguage ()
 Get the target language for the content being parsed.
 
 getTitle ()
 Accessor for the Title object.
 
 getUser ()
 Get a User object either from $this->mUser, if set, or from the ParserOptions object otherwise.
 
 insertStripItem ( $text)
 Add an item to the strip state Returns the unique tag which must be inserted into the stripped text The tag will be replaced with the original text in unstrip()
 
 internalParse ( $text, $isMain=true, $frame=false)
 Helper function for parse() that transforms wiki markup into half-parsed HTML.
 
 makeFreeExternalLink ( $url, $numPostProto)
 Make a free external link, given a user-supplied URL.
 
 nextLinkID ()
 
 Options ( $x=null)
 Accessor/mutator for the ParserOptions object.
 
 OutputType ( $x=null)
 Accessor/mutator for the output type.
 
 parse ( $text, Title $title, ParserOptions $options, $linestart=true, $clearState=true, $revid=null)
 Convert wikitext to HTML Do not call this function recursively.
 
 preprocess ( $text, Title $title=null, ParserOptions $options, $revid=null, $frame=false)
 Expand templates and variables in the text, producing valid, static wikitext.
 
 recursivePreprocess ( $text, $frame=false)
 Recursive parser entry point that can be called from an extension tag hook.
 
 recursiveTagParse ( $text, $frame=false)
 Half-parse wikitext to half-parsed HTML.
 
 recursiveTagParseFully ( $text, $frame=false)
 Fully parse wikitext to fully parsed HTML.
 
 setLinkID ( $id)
 
 setOutputType ( $ot)
 Set the output type.
 
 setTitle ( $t)
 Set the context title.
 
 setUser ( $user)
 Set the current user.
 
 Title ( $x=null)
 Accessor/mutator for the Title object.
 
 uniqPrefix ()
 Accessor for mUniqPrefix.
 

Static Public Member Functions

static extractTagsAndParams ( $elements, $text, &$matches, $uniq_prefix=null)
 Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns the next text.
 
static getRandomString ()
 Get a random string.
 

Public Attributes

MapCacheLRU null $currentRevisionCache
 
 $mArgStack
 
 $mAutonumber
 
 $mConf
 
 $mDefaultSort
 
 $mDefaultStripList = []
 
 $mDoubleUnderscores
 
 $mDTopen
 
 $mExpensiveFunctionCount
 
 $mExtLinkBracketedRegex
 
 $mFirstCall = true
 
 $mForceTocPosition
 
 $mFunctionHooks = []
 
 $mFunctionSynonyms = [ 0 => [], 1 => [] ]
 
 $mFunctionTagHooks = []
 
 $mGeneratedPPNodeCount
 
 $mHeadings
 
 $mHighestExpansionDepth
 
 $mImageParams = []
 
 $mImageParamsMagicArray = []
 
 $mIncludeCount
 
 $mIncludeSizes
 
bool $mInParse = false
 Recursive call protection.
 
 $mInPre
 
 $mInputSize = false
 
array $mLangLinkLanguages
 Array with the language name of each language link (i.e.
 
 $mLastSection
 
LinkHolderArray $mLinkHolders
 
 $mLinkID
 
 $mMarkerIndex = 0
 
ParserOptions $mOptions
 
ParserOutput $mOutput
 
 $mOutputType
 
 $mPPNodeCount
 
Preprocessor $mPreprocessor
 
 $mRevIdForTs
 
 $mRevisionId
 
 $mRevisionObject
 
 $mRevisionSize
 
 $mRevisionTimestamp
 
 $mRevisionUser
 
 $mShowToc
 
 $mStripList = []
 
StripState $mStripState
 
MagicWordArray $mSubstWords
 
 $mTagHooks = []
 
Title $mTitle
 
 $mTplDomCache
 
 $mTplRedirCache
 
 $mTransparentTagHooks = []
 
string $mUniqPrefix = Parser::MARKER_PREFIX
 Deprecated accessor for the strip marker prefix.
 
 $mUrlProtocols
 
User $mUser
 
 $mVarCache = []
 
MagicWordArray $mVariables
 
 $ot
 
const COLON_STATE_CLOSETAG = 3
 
const COLON_STATE_COMMENT = 5
 
const COLON_STATE_COMMENTDASH = 6
 
const COLON_STATE_COMMENTDASHDASH = 7
 
const COLON_STATE_TAG = 1
 
const COLON_STATE_TAGSLASH = 4
 
const COLON_STATE_TAGSTART = 2
 
const COLON_STATE_TEXT = 0
 
 else
 
const EXT_IMAGE_REGEX
 
const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])'
 
const EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F\p{Zs}]'
 
const HALF_PARSED_VERSION = 2
 Update this version number when the output of serialiseHalfParsedText() changes in an incompatible way.
 
const MARKER_PREFIX = "\x7f'\"`UNIQ-"
 
const OT_HTML = 1
 
const OT_MSG = 3
 
const OT_PLAIN = 4
 
const OT_PREPROCESS = 3
 
const OT_WIKI = 2
 
const PTD_FOR_INCLUSION = 1
 
const SFH_NO_HASH = 1
 
const SFH_OBJECT_ARGS = 2
 
const SPACE_NOT_NL = '(?:\t|&nbsp;|&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})'
 
const TOC_END = '</mw:toc>'
 
const TOC_START = '<mw:toc>'
 
const VERSION = '1.6.4'
 Update this version number when the ParserOutput format changes in an incompatible way, so the parser cache can automatically discard old data.
 

Protected Attributes

SectionProfiler $mProfiler
 

Private Member Functions

 internalParseHalfParsed ( $text, $isMain=true, $linestart=true)
 Helper function for parse() that transforms half-parsed HTML into fully parsed HTML.
 

Detailed Description

PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for making links), and provides a one-way transformation of that wiki markup it into (X)HTML output / markup (which in turn the browser understands, and can display).

There are seven main entry points into the Parser class:

  • Parser::parse() produces HTML output
  • Parser::preSaveTransform() produces altered wiki markup
  • Parser::preprocess() removes HTML comments and expands templates
  • Parser::cleanSig() and Parser::cleanSigInSig() cleans a signature before saving it to preferences
  • Parser::getSection() return the content of a section from an article for section editing
  • Parser::replaceSection() replaces a section by number inside an article
  • Parser::getPreloadText() removes <noinclude> sections and <includeonly> tags

Globals used: object: $wgContLang

Warning
$wgUser or $wgTitle or $wgRequest or $wgLang. Keep them away!
Settings:
$wgNamespacesWithSubpages
Settings only within ParserOptions:
$wgAllowExternalImages $wgAllowSpecialInclusion $wgInterwikiMagic $wgMaxArticleSize

Definition at line 67 of file Parser.php.

Constructor & Destructor Documentation

◆ __construct()

Parser::__construct (   $conf = [])
Parameters
array$conf

Definition at line 264 of file Parser.php.

References wfDebug(), and wfUrlProtocols().

◆ __destruct()

Parser::__destruct ( )

Reduce memory usage to reduce the impact of circular references.

Definition at line 290 of file Parser.php.

References $name, $value, and as.

Member Function Documentation

◆ __clone()

Parser::__clone ( )

Allow extensions to clean up when the parser is cloned.

Definition at line 302 of file Parser.php.

References as.

◆ clearState()

Parser::clearState ( )

Clear Parser state.

Access:\n private

Definition at line 345 of file Parser.php.

References $parser, and firstCallInit().

◆ doAllQuotes()

Parser::doAllQuotes (   $text)

Replace single quotes with HTML markup.

Access:\n private
Parameters
string$text
Returns
string The altered text

Definition at line 1587 of file Parser.php.

References $line, $lines, as, doQuotes(), and StringUtils\explode().

Referenced by internalParse().

◆ doHeadings()

Parser::doHeadings (   $text)

Parse headers and return html.

Access:\n private
Parameters
string$text
Returns
string

Definition at line 1571 of file Parser.php.

References $i.

Referenced by internalParse().

◆ doMagicLinks()

Parser::doMagicLinks (   $text)

Replace special strings like "ISBN xxx" and "RFC xxx" with magic external links.

DML

Access:\n private
Parameters
string$text
Returns
string

Definition at line 1410 of file Parser.php.

References of, or, and wfUrlProtocolsWithoutProtRel().

Referenced by internalParse().

◆ doQuotes()

Parser::doQuotes (   $text)

Helper function for doAllQuotes()

Parameters
string$text
Returns
string

Definition at line 1604 of file Parser.php.

References $i.

Referenced by CoreParserFunctions\displaytitle(), and doAllQuotes().

◆ doTableStuff()

Parser::doTableStuff (   $text)

parse the wiki syntax used to render tables

Access:\n private
Parameters
string$text
Returns
string

Definition at line 1033 of file Parser.php.

References $line, $lines, $matches, $out, as, attributes, StringUtils\explode(), Sanitizer\fixTagAttributes(), history, line, of, or, StringUtils\replaceMarkup(), table, and the.

Referenced by internalParse().

◆ extractTagsAndParams()

static Parser::extractTagsAndParams (   $elements,
  $text,
$matches,
  $uniq_prefix = null 
)
static

Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns the next text.

The output parameter $matches will be an associative array filled with data in the form:

'UNIQ-xxxxx' => array(
'element',
'tag content',
array( 'param' => 'x' ),
'<element param="x">tag content</element>' ) )
the array() calling protocol came about after MediaWiki 1.4rc1.
Parameters
array$elementsList of element names. Comments are always extracted.
string$textSource text string.
array$matchesOut parameter, Array: extracted tags
string | null$uniq_prefix
Returns
string Stripped text
Since
1.26 The uniq_prefix argument is deprecated.

Definition at line 936 of file Parser.php.

References $content, $matches, Sanitizer\decodeTagAttributes(), and wfDeprecated().

◆ firstCallInit()

Parser::firstCallInit ( )

Do various kinds of initialisation on the first call of the parser.

Definition at line 325 of file Parser.php.

References $parser, initialiseVariables(), CoreParserFunctions\register(), and CoreTagHooks\register().

Referenced by clearState().

◆ getConverterLanguage()

Parser::getConverterLanguage ( )

Get the language object for language conversion.

Returns
Language|null

Definition at line 885 of file Parser.php.

References getTargetLanguage().

Referenced by internalParseHalfParsed(), makeFreeExternalLink(), and parse().

◆ getFunctionLang()

Parser::getFunctionLang ( )

Get a language object for use in parser functions such as {{FORMATNUM:}}.

Returns
Language

Definition at line 854 of file Parser.php.

References getTargetLanguage().

◆ getOptions()

Parser::getOptions ( )

Get the ParserOptions object.

Returns
ParserOptions

Definition at line 822 of file Parser.php.

◆ getOutput()

Parser::getOutput ( )

Get the ParserOutput object.

Returns
ParserOutput

Definition at line 813 of file Parser.php.

◆ getPreloadText()

Parser::getPreloadText (   $text,
Title  $title,
ParserOptions  $options,
  $params = [] 
)

Process the wikitext for the "?preload=" feature.

(bug 5210)

"<noinclude>", "<includeonly>" etc. are parsed as for template transclusion, comments, templates, arguments, tags hooks and parser functions are untouched.

Parameters
string$text
Title$title
ParserOptions$options
array$params
Returns
string

Definition at line 698 of file Parser.php.

References $flags, $options, $params, getPreprocessor(), lock(), PPFrame\NO_ARGS, PPFrame\NO_TEMPLATES, preprocessToDom(), and startParse().

◆ getPreprocessor()

Parser::getPreprocessor ( )

Get a preprocessor object.

Returns
Preprocessor

Definition at line 907 of file Parser.php.

Referenced by getPreloadText().

◆ getRandomString()

static Parser::getRandomString ( )
static

Get a random string.

Returns
string
Deprecated:
since 1.26; use wfRandomString() instead.

Definition at line 719 of file Parser.php.

References wfDeprecated(), and wfRandomString().

◆ getStripList()

Parser::getStripList ( )

Get a list of strippable XML-like elements.

Returns
array

Definition at line 1006 of file Parser.php.

◆ getTargetLanguage()

Parser::getTargetLanguage ( )

Get the target language for the content being parsed.

This is usually the language that the content is in.

Since
1.19
Exceptions
MWException
Returns
Language

Definition at line 867 of file Parser.php.

Referenced by getConverterLanguage(), and getFunctionLang().

◆ getTitle()

Parser::getTitle ( )

Accessor for the Title object.

Returns
Title

Definition at line 768 of file Parser.php.

◆ getUser()

Parser::getUser ( )

Get a User object either from $this->mUser, if set, or from the ParserOptions object otherwise.

Returns
User

Definition at line 895 of file Parser.php.

◆ insertStripItem()

Parser::insertStripItem (   $text)

Add an item to the strip state Returns the unique tag which must be inserted into the stripped text The tag will be replaced with the original text in unstrip()

Parameters
string$text
Returns
string

Definition at line 1019 of file Parser.php.

◆ internalParse()

Parser::internalParse (   $text,
  $isMain = true,
  $frame = false 
)

Helper function for parse() that transforms wiki markup into half-parsed HTML.

Only called for $mOutputType == self::OT_HTML.

Access:\n private
Parameters
string$textThe text to parse
bool$isMainWhether this is being called from the main parse() function
PPFrame | bool$frameA pre-processor frame
Returns
string

Definition at line 1236 of file Parser.php.

References $parser, doAllQuotes(), doDoubleUnderscore(), doHeadings(), doMagicLinks(), doTableStuff(), formatHeadings(), preprocessToDom(), PTD_FOR_INCLUSION, Sanitizer\removeHTMLtags(), replaceExternalLinks(), replaceInternalLinks(), and replaceVariables().

Referenced by parse(), and recursiveTagParse().

◆ internalParseHalfParsed()

Parser::internalParseHalfParsed (   $text,
  $isMain = true,
  $linestart = true 
)
private

Helper function for parse() that transforms half-parsed HTML into fully parsed HTML.

Parameters
string$text
bool$isMain
bool$linestart
Returns
string

Definition at line 1307 of file Parser.php.

References $parser, doBlockLevels(), getConverterLanguage(), MWTidy\getModuleStyles(), MWTidy\isEnabled(), Sanitizer\normalizeCharReferences(), of, replaceLinkHolders(), replaceTransparentTags(), and MWTidy\tidy().

Referenced by parse(), and recursiveTagParseFully().

◆ makeFreeExternalLink()

Parser::makeFreeExternalLink (   $url,
  $numPostProto 
)

Make a free external link, given a user-supplied URL.

Parameters
string$url
int$numPostProtoThe number of characters after the protocol.
Returns
string HTML
Access:\n private

Definition at line 1496 of file Parser.php.

References Sanitizer\cleanUrl(), getConverterLanguage(), getExternalLinkAttribs(), Linker\makeExternalLink(), and maybeMakeExternalImage().

◆ nextLinkID()

Parser::nextLinkID ( )
Returns
int

Definition at line 839 of file Parser.php.

◆ Options()

Parser::Options (   $x = null)

Accessor/mutator for the ParserOptions object.

Parameters
ParserOptions$xNew value or null to just get the current one
Returns
ParserOptions Current ParserOptions object

Definition at line 832 of file Parser.php.

References wfSetVar().

◆ OutputType()

Parser::OutputType (   $x = null)

Accessor/mutator for the output type.

Parameters
int | null$xNew value or null to just get the current one
Returns
int

Definition at line 804 of file Parser.php.

References wfSetVar().

◆ parse()

Parser::parse (   $text,
Title  $title,
ParserOptions  $options,
  $linestart = true,
  $clearState = true,
  $revid = null 
)

Convert wikitext to HTML Do not call this function recursively.

Parameters
string$textText we want to parse
Title$title
ParserOptions$options
bool$linestart
bool$clearState
int$revidNumber to pass in {{REVISIONID}}
Returns
ParserOutput A ParserOutput

Definition at line 409 of file Parser.php.

References $options, $parser, $title, $value, $wgShowHostnames, as, getConverterLanguage(), global, internalParse(), internalParseHalfParsed(), limitationWarn(), lock(), startParse(), wfDebugLog(), wfHostname(), and wfMessage().

◆ preprocess()

Parser::preprocess (   $text,
Title  $title = null,
ParserOptions  $options,
  $revid = null,
  $frame = false 
)

Expand templates and variables in the text, producing valid, static wikitext.

Also removes comments. Do not call this function recursively.

Parameters
string$text
Title$title
ParserOptions$options
int | null$revid
bool | PPFrame$frame
Returns
mixed|string

Definition at line 653 of file Parser.php.

References $options, $parser, $title, lock(), replaceVariables(), and startParse().

◆ recursivePreprocess()

Parser::recursivePreprocess (   $text,
  $frame = false 
)

Recursive parser entry point that can be called from an extension tag hook.

Parameters
string$textText to be expanded
bool | PPFrame$frameThe frame to use for expanding any template variables
Returns
string
Since
1.19

Definition at line 679 of file Parser.php.

References replaceVariables().

◆ recursiveTagParse()

Parser::recursiveTagParse (   $text,
  $frame = false 
)

Half-parse wikitext to half-parsed HTML.

This recursive parser entry point can be called from an extension tag hook.

The output of this function IS NOT SAFE PARSED HTML; it is "half-parsed" instead, which means that lists and links have not been fully parsed yet, and strip markers are still present.

Use recursiveTagParseFully() to fully parse wikitext to output-safe HTML.

Use this function if you're a parser tag hook and you want to parse wikitext before or after applying additional transformations, and you intend to return the result as hook output, which will cause it to go through the rest of parsing process automatically.

If $frame is not provided, then template variables (e.g., {{{1}}}) within $text are not expanded

Parameters
string$textText extension wants to have parsed
bool | PPFrame$frameThe frame to use for expanding any template variables
Returns
string UNSAFE half-parsed HTML

Definition at line 610 of file Parser.php.

References $parser, and internalParse().

Referenced by recursiveTagParseFully().

◆ recursiveTagParseFully()

Parser::recursiveTagParseFully (   $text,
  $frame = false 
)

Fully parse wikitext to fully parsed HTML.

This recursive parser entry point can be called from an extension tag hook.

The output of this function is fully-parsed HTML that is safe for output. If you're a parser tag hook, you might want to use recursiveTagParse() instead.

If $frame is not provided, then template variables (e.g., {{{1}}}) within $text are not expanded

Since
1.25
Parameters
string$textText extension wants to have parsed
bool | PPFrame$frameThe frame to use for expanding any template variables
Returns
string Fully parsed HTML

Definition at line 636 of file Parser.php.

References internalParseHalfParsed(), and recursiveTagParse().

◆ setLinkID()

Parser::setLinkID (   $id)
Parameters
int$id

Definition at line 846 of file Parser.php.

◆ setOutputType()

Parser::setOutputType (   $ot)

Set the output type.

Parameters
int$otNew value

Definition at line 787 of file Parser.php.

References $ot, OT_HTML, OT_PLAIN, OT_PREPROCESS, and OT_WIKI.

◆ setTitle()

Parser::setTitle (   $t)

Set the context title.

Parameters
Title$t

Definition at line 750 of file Parser.php.

References $t, and Title\newFromText().

◆ setUser()

Parser::setUser (   $user)

Set the current user.

Should only be used when doing pre-save transform.

Parameters
User | null$userUser object or null (to reset)

Definition at line 730 of file Parser.php.

References $user.

◆ Title()

Parser::Title (   $x = null)

Accessor/mutator for the Title object.

Parameters
Title$xTitle object or null to just get the current one
Returns
Title

Definition at line 778 of file Parser.php.

References wfSetVar().

◆ uniqPrefix()

Parser::uniqPrefix ( )

Accessor for mUniqPrefix.

Returns
string
Deprecated:
since 1.26; use Parser::MARKER_PREFIX instead.

Definition at line 740 of file Parser.php.

References wfDeprecated().

Member Data Documentation

◆ $currentRevisionCache

MapCacheLRU null Parser::$currentRevisionCache
Since
1.24

A cache of the current revisions of titles. Keys are $title->getPrefixedDbKey()

Definition at line 250 of file Parser.php.

◆ $mArgStack

Parser::$mArgStack

Definition at line 191 of file Parser.php.

◆ $mAutonumber

Parser::$mAutonumber

Definition at line 184 of file Parser.php.

◆ $mConf

Parser::$mConf

Definition at line 173 of file Parser.php.

◆ $mDefaultSort

Parser::$mDefaultSort

Definition at line 199 of file Parser.php.

◆ $mDefaultStripList

Parser::$mDefaultStripList = []

Definition at line 154 of file Parser.php.

◆ $mDoubleUnderscores

Parser::$mDoubleUnderscores

Definition at line 200 of file Parser.php.

◆ $mDTopen

Parser::$mDTopen

Definition at line 184 of file Parser.php.

◆ $mExpensiveFunctionCount

Parser::$mExpensiveFunctionCount

Definition at line 201 of file Parser.php.

◆ $mExtLinkBracketedRegex

Parser::$mExtLinkBracketedRegex

Definition at line 173 of file Parser.php.

◆ $mFirstCall

Parser::$mFirstCall = true

Definition at line 159 of file Parser.php.

◆ $mForceTocPosition

Parser::$mForceTocPosition

Definition at line 202 of file Parser.php.

◆ $mFunctionHooks

Parser::$mFunctionHooks = []

Definition at line 150 of file Parser.php.

◆ $mFunctionSynonyms

Parser::$mFunctionSynonyms = [ 0 => [], 1 => [] ]

Definition at line 151 of file Parser.php.

◆ $mFunctionTagHooks

Parser::$mFunctionTagHooks = []

Definition at line 152 of file Parser.php.

◆ $mGeneratedPPNodeCount

Parser::$mGeneratedPPNodeCount

Definition at line 198 of file Parser.php.

◆ $mHeadings

Parser::$mHeadings

Definition at line 200 of file Parser.php.

◆ $mHighestExpansionDepth

Parser::$mHighestExpansionDepth

Definition at line 198 of file Parser.php.

◆ $mImageParams

Parser::$mImageParams = []

Definition at line 156 of file Parser.php.

◆ $mImageParamsMagicArray

Parser::$mImageParamsMagicArray = []

Definition at line 157 of file Parser.php.

◆ $mIncludeCount

Parser::$mIncludeCount

Definition at line 191 of file Parser.php.

◆ $mIncludeSizes

Parser::$mIncludeSizes

Definition at line 198 of file Parser.php.

◆ $mInParse

bool Parser::$mInParse = false

Recursive call protection.

This variable should be treated as if it were private.

Definition at line 256 of file Parser.php.

◆ $mInPre

Parser::$mInPre

Definition at line 191 of file Parser.php.

◆ $mInputSize

Parser::$mInputSize = false

Definition at line 229 of file Parser.php.

◆ $mLangLinkLanguages

array Parser::$mLangLinkLanguages

Array with the language name of each language link (i.e.

the interwiki prefix) in the key, value arbitrary. Used to avoid sending duplicate language links to the ParserOutput.

Definition at line 242 of file Parser.php.

◆ $mLastSection

Parser::$mLastSection

Definition at line 191 of file Parser.php.

◆ $mLinkHolders

LinkHolderArray Parser::$mLinkHolders

Definition at line 195 of file Parser.php.

◆ $mLinkID

Parser::$mLinkID

Definition at line 197 of file Parser.php.

◆ $mMarkerIndex

Parser::$mMarkerIndex = 0

Definition at line 158 of file Parser.php.

◆ $mOptions

ParserOptions Parser::$mOptions

Definition at line 215 of file Parser.php.

◆ $mOutput

ParserOutput Parser::$mOutput

Definition at line 183 of file Parser.php.

◆ $mOutputType

Parser::$mOutputType

Definition at line 221 of file Parser.php.

◆ $mPPNodeCount

Parser::$mPPNodeCount

Definition at line 198 of file Parser.php.

◆ $mPreprocessor

Preprocessor Parser::$mPreprocessor

Definition at line 177 of file Parser.php.

◆ $mProfiler

SectionProfiler Parser::$mProfiler
protected

Definition at line 259 of file Parser.php.

◆ $mRevIdForTs

Parser::$mRevIdForTs

Definition at line 228 of file Parser.php.

◆ $mRevisionId

Parser::$mRevisionId

Definition at line 224 of file Parser.php.

◆ $mRevisionObject

Parser::$mRevisionObject

Definition at line 223 of file Parser.php.

◆ $mRevisionSize

Parser::$mRevisionSize

Definition at line 227 of file Parser.php.

◆ $mRevisionTimestamp

Parser::$mRevisionTimestamp

Definition at line 225 of file Parser.php.

◆ $mRevisionUser

Parser::$mRevisionUser

Definition at line 226 of file Parser.php.

◆ $mShowToc

Parser::$mShowToc

Definition at line 202 of file Parser.php.

◆ $mStripList

Parser::$mStripList = []

Definition at line 153 of file Parser.php.

◆ $mStripState

StripState Parser::$mStripState

Definition at line 189 of file Parser.php.

◆ $mSubstWords

MagicWordArray Parser::$mSubstWords

Definition at line 171 of file Parser.php.

◆ $mTagHooks

Parser::$mTagHooks = []

Definition at line 148 of file Parser.php.

◆ $mTitle

Title Parser::$mTitle

Definition at line 220 of file Parser.php.

◆ $mTplDomCache

Parser::$mTplDomCache

Definition at line 200 of file Parser.php.

◆ $mTplRedirCache

Parser::$mTplRedirCache

Definition at line 200 of file Parser.php.

◆ $mTransparentTagHooks

Parser::$mTransparentTagHooks = []

Definition at line 149 of file Parser.php.

◆ $mUniqPrefix

string Parser::$mUniqPrefix = Parser::MARKER_PREFIX

Deprecated accessor for the strip marker prefix.

Deprecated:
since 1.26; use Parser::MARKER_PREFIX instead.

Definition at line 235 of file Parser.php.

◆ $mUrlProtocols

Parser::$mUrlProtocols

Definition at line 173 of file Parser.php.

◆ $mUser

User Parser::$mUser

Definition at line 207 of file Parser.php.

◆ $mVarCache

Parser::$mVarCache = []

Definition at line 155 of file Parser.php.

◆ $mVariables

MagicWordArray Parser::$mVariables

Definition at line 166 of file Parser.php.

◆ $ot

Parser::$ot

Definition at line 222 of file Parser.php.

Referenced by setOutputType().

◆ COLON_STATE_CLOSETAG

const Parser::COLON_STATE_CLOSETAG = 3

Definition at line 106 of file Parser.php.

◆ COLON_STATE_COMMENT

const Parser::COLON_STATE_COMMENT = 5

Definition at line 108 of file Parser.php.

◆ COLON_STATE_COMMENTDASH

const Parser::COLON_STATE_COMMENTDASH = 6

Definition at line 109 of file Parser.php.

◆ COLON_STATE_COMMENTDASHDASH

const Parser::COLON_STATE_COMMENTDASHDASH = 7

Definition at line 110 of file Parser.php.

◆ COLON_STATE_TAG

const Parser::COLON_STATE_TAG = 1

Definition at line 104 of file Parser.php.

◆ COLON_STATE_TAGSLASH

const Parser::COLON_STATE_TAGSLASH = 4

Definition at line 107 of file Parser.php.

◆ COLON_STATE_TAGSTART

const Parser::COLON_STATE_TAGSTART = 2

Definition at line 105 of file Parser.php.

◆ COLON_STATE_TEXT

const Parser::COLON_STATE_TEXT = 0

Definition at line 103 of file Parser.php.

◆ else

Parser::else
Initial value:
{
return $m[0]

Definition at line 1482 of file Parser.php.

◆ EXT_IMAGE_REGEX

const Parser::EXT_IMAGE_REGEX
Initial value:
= '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}]+)
\\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu'

Definition at line 95 of file Parser.php.

◆ EXT_LINK_ADDR

const Parser::EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])'

Definition at line 92 of file Parser.php.

◆ EXT_LINK_URL_CLASS

const Parser::EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F\p{Zs}]'

Definition at line 89 of file Parser.php.

◆ HALF_PARSED_VERSION

const Parser::HALF_PARSED_VERSION = 2

Update this version number when the output of serialiseHalfParsedText() changes in an incompatible way.

Definition at line 79 of file Parser.php.

◆ MARKER_PREFIX

const Parser::MARKER_PREFIX = "\x7f'\"`UNIQ-"

Definition at line 141 of file Parser.php.

Referenced by MediaWiki\Tidy\RaggettWrapper\replaceCallback().

◆ OT_HTML

const Parser::OT_HTML = 1

Definition at line 117 of file Parser.php.

◆ OT_MSG

const Parser::OT_MSG = 3

Definition at line 120 of file Parser.php.

◆ OT_PLAIN

const Parser::OT_PLAIN = 4

Definition at line 121 of file Parser.php.

◆ OT_PREPROCESS

const Parser::OT_PREPROCESS = 3

Definition at line 119 of file Parser.php.

◆ OT_WIKI

const Parser::OT_WIKI = 2

Definition at line 118 of file Parser.php.

◆ PTD_FOR_INCLUSION

const Parser::PTD_FOR_INCLUSION = 1

Definition at line 113 of file Parser.php.

Referenced by internalParse().

◆ SFH_NO_HASH

const Parser::SFH_NO_HASH = 1

Definition at line 82 of file Parser.php.

◆ SFH_OBJECT_ARGS

const Parser::SFH_OBJECT_ARGS = 2

Definition at line 83 of file Parser.php.

◆ SPACE_NOT_NL

const Parser::SPACE_NOT_NL = '(?:\t|&nbsp;|&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})'

Definition at line 100 of file Parser.php.

◆ TOC_END

const Parser::TOC_END = '</mw:toc>'

Definition at line 145 of file Parser.php.

◆ TOC_START

const Parser::TOC_START = '<mw:toc>'

Definition at line 144 of file Parser.php.

◆ VERSION

const Parser::VERSION = '1.6.4'

Update this version number when the ParserOutput format changes in an incompatible way, so the parser cache can automatically discard old data.

Definition at line 73 of file Parser.php.


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