Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
Public Member Functions |Static Public Member Functions |Public Attributes |Protected Member Functions |List of all members
MediaWiki\Parser\Parser Class Reference
Parser

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

Public Member Functions

 __clone ()
 Allow extensions to clean up when the parser is cloned.
 
 __construct (ServiceOptions $svcOptions,MagicWordFactory $magicWordFactory,Language $contLang,ParserFactory $factory,UrlUtils $urlUtils,SpecialPageFactory $spFactory,LinkRendererFactory $linkRendererFactory,NamespaceInfo $nsInfo, LoggerInterface $logger,BadFileLookup $badFileLookup, LanguageConverterFactory $languageConverterFactory, LanguageNameUtils $languageNameUtils,HookContainer $hookContainer,TidyDriverBase $tidy,WANObjectCache $wanCache,UserOptionsLookup $userOptionsLookup,UserFactory $userFactory,TitleFormatter $titleFormatter,HttpRequestFactory $httpRequestFactory,TrackingCategories $trackingCategories,SignatureValidatorFactory $signatureValidatorFactory,UserNameUtils $userNameUtils)
 Constructing parsers directly is not allowed! Use a ParserFactory.
 
 __destruct ()
 Reduce memory usage to reduce the impact of circular references.
 
 addTrackingCategory ( $msg)
 
 argSubstitution (array $piece,PPFrame $frame)
 Triple brace replacement – used for template arguments.
 
 attributeStripCallback (&$text, $frame=false)
 Callback from the Sanitizer for expanding items found in HTML attribute values, so they can be safely tested and escaped.
 
 braceSubstitution (array $piece,PPFrame $frame)
 Return the text of a template, after recursively replacing any variables or templates within the template.
 
 callParserFunction (PPFrame $frame, $function, array $args=[], bool $inSolState=false)
 Call a parser function and return an array with text and flags.
 
 cleanSig ( $text, $parsing=false)
 Clean up signature text.
 
 clearState ()
 Clear Parser state.
 
 clearTagHooks ()
 Remove all tag hooks.
 
 doBlockLevels ( $text, $linestart)
 Make lists from lines starting with ':', '*', '#', etc.
 
 doQuotes ( $text)
 Helper function for handleAllQuotes()
 
 enableOOUI ()
 Set's up the PHP implementation of OOUI for use in this request and instructs OutputPage to enable OOUI for itself.
 
 extensionSubstitution (array $params,PPFrame $frame, bool $processNowiki=false)
 Return the text to be used for a given extension tag.
 
 fetchCurrentRevisionRecordOfTitle (LinkTarget $link)
 Fetch the current revision of a given title as a RevisionRecord.
 
 fetchFileAndTitle (LinkTarget $link, array $options=[])
 Fetch a file and its title and register a reference to it.
 
 fetchTemplateAndTitle (LinkTarget $link)
 Fetch the unparsed text of a template and register a reference to it.
 
 firstCallInit ()
 Used to do various kinds of initialisation on the first call of the parser.
 
 getBadFileLookup ()
 Get the BadFileLookup instance that this Parser is using.
 
 getContentLanguage ()
 Get the content language that this Parser is using.
 
 getDefaultSort ()
 Accessor for the 'defaultsort' page property.
 
 getExternalLinkAttribs ( $url)
 Get an associative array of additional HTML attributes appropriate for a particular external link.
 
 getFlatSectionInfo ( $text)
 Get an array of preprocessor section information.
 
 getFunctionHooks ()
 Get all registered function hook identifiers.
 
 getFunctionLang ()
 Get a language object for use in parser functions such as {{FORMATNUM:}}.
 
 getFunctionSynonyms ()
 
 getLinkRenderer ()
 Get a LinkRenderer instance to make links with.
 
 getMagicWordFactory ()
 Get the MagicWordFactory that this Parser is using.
 
 getOptions ()
 
 getOutput ()
 
 getOutputType ()
 Accessor for the output type.
 
 getPage ()
 Returns the page used as context for parsing, e.g.
 
 getPreloadText ( $text,PageReference $page,ParserOptions $options, $params=[])
 Process the wikitext for the "?preload=" feature.
 
 getPreprocessor ()
 Get a preprocessor object.
 
 getRevisionId ()
 Get the ID of the revision we are parsing.
 
 getRevisionRecordObject ()
 Get the revision record object for $this->mRevisionId.
 
 getRevisionSize ()
 Get the size of the revision.
 
 getRevisionTimestamp ()
 Get the timestamp associated with the current revision, adjusted for the default server-local timestamp.
 
 getRevisionUser ()
 Get the name of the user that edited the last revision.
 
 getSection ( $text, $sectionId, $defaultText='')
 This function returns the text of a section, specified by a number ($section).
 
 getStripList ()
 Get a list of strippable XML-like elements.
 
 getStripState ()
 
 getTags ()
 Accessor.
 
 getTargetLanguage ()
 Get the target language for the content being parsed.
 
 getTargetLanguageConverter ()
 Shorthand for getting a Language Converter for Target language.
 
 getTemplateDom (LinkTarget $title, bool $inSolState=false)
 Get the semi-parsed DOM representation of a template with a given title, and its redirect destination title.
 
 getTitle ()
 
 getUrlProtocols ()
 
 getUserIdentity ()
 Get a user either from the user set on Parser if it's set, or from the ParserOptions object otherwise.
 
 getUserSig (UserIdentity $user, $nickname=false, $fancySig=null)
 Fetch the user's signature text, if any, and normalize to validated, ready-to-insert wikitext.
 
 guessLegacySectionNameFromWikiText ( $text)
 Same as guessSectionNameFromWikiText(), but produces legacy anchors instead, if possible.
 
 guessSectionNameFromWikiText ( $text)
 Try to guess the section anchor name based on a wikitext fragment presumably extracted from a heading, for example "Header" from "== Header ==".
 
 incrementExpensiveFunctionCount ()
 
 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.
 
 interwikiTransclude (LinkTarget $link, $action)
 Transclude an interwiki link.
 
 isCurrentRevisionOfTitleCached (LinkTarget $link)
 
 isLocked ()
 Will entry points such as parse() throw an exception due to the parser already being active?
 
 killMarkers ( $text)
 Remove any strip markers found in the given text.
 
 limitationWarn ( $limitationType, $current='', $max='')
 Warn the user when a parser limitation is reached Will warn at most once the user per limitation type.
 
 makeImage (LinkTarget $link, $options, $holders=false)
 Parse image options text and use it to make an image.
 
 makeLimitReport (ParserOptions $parserOptions,ParserOutput $parserOutput)
 Set the limit report data in the current ParserOutput.
 
 markerSkipCallback ( $s, callable $callback)
 Call a callback function on all regions of the given text that are not inside strip markers, and replace those regions with the return value of the callback.
 
 modifyImageHtml (File $file, array $params, string &$html)
 Give hooks a chance to modify image thumbnail HTML.
 
 msg (string $msg,... $params)
 Helper function to correctly set the target language and title of a message based on the parser context.
 
 nextLinkID ()
 
 Options ( $x=null)
 Accessor/mutator for the ParserOptions object.
 
 OutputType ( $x=null)
 Accessor/mutator for the output type.
 
 parse ( $text,PageReference $page,ParserOptions $options, $linestart=true, $clearState=true, $revid=null)
 Convert wikitext to HTML Do not call this function recursively.
 
 parseExtensionTagAsTopLevelDoc (string $text)
 Needed by Parsoid/PHP to ensure all the hooks for extensions are run in the right order.
 
 parseWidthParam ( $value, $parseHeight=true, bool $localized=false)
 Parsed a width param of imagelink like 300px or 200x300px.
 
 preprocess ( $text, ?PageReference $page,ParserOptions $options, $revid=null, $frame=false)
 Expand templates and variables in the text, producing valid, static wikitext.
 
 preprocessToDom ( $text, $flags=0)
 Get the document object model for the given wikitext.
 
 preSaveTransform ( $text,PageReference $page,UserIdentity $user,ParserOptions $options, $clearState=true)
 Transform wiki markup when saving a page by doing "\\r\\n" -> "\\n" conversion, substituting signatures, {{subst:}} templates, etc.
 
 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.
 
 renderImageGallery ( $text, array $params)
 Renders an image gallery from a text with one line per image.
 
 replaceLinkHolders (&$text)
 Replace "<!--LINK-->" link placeholders with actual links, in the buffer Placeholders created in Linker::link()
 
 replaceSection ( $oldText, $sectionId, $newText)
 This function returns $oldtext after the content of the section specified by $section has been replaced with $text.
 
 replaceVariables ( $text, $frame=false, $argsOnly=false, array $options=[])
 Replace magic variables, templates, and template arguments with the appropriate text.
 
 resetOutput ()
 Reset the ParserOutput.
 
 setFunctionHook ( $id, callable $callback, $flags=0)
 Create a function, e.g.
 
 setHook ( $tag, callable $callback)
 Create an HTML-style tag, e.g.
 
 setLinkID ( $id)
 
 setOptions (ParserOptions $options)
 Mutator for the ParserOptions object.
 
 setOutputType ( $ot)
 Mutator for the output type.
 
 setPage (?PageReference $t=null)
 Set the page used as context for parsing, e.g.
 
 setStripExtTags (bool $val)
 
 setTitle (?Title $t=null)
 Set the context title.
 
 setUser (?UserIdentity $user)
 Set the current user.
 
 startExternalParse (?PageReference $page,ParserOptions $options, $outputType, $clearState=true, $revId=null)
 Set up some variables which are usually set up in parse() so that an external function can call some class members with confidence.
 
 stripSectionName ( $text)
 Strips a text string of wikitext for use in a section anchor.
 
 tagNeedsNowikiStrippedInTagPF (string $lowerTagName)
 
 transformMsg ( $text,ParserOptions $options, ?PageReference $page=null)
 Wrapper for preprocess()
 
 validateSig ( $text)
 Check that the user's signature contains no bad XML.
 

Static Public Member Functions

static cleanSigInSig ( $text)
 Strip 3, 4 or 5 tildes out of signatures.
 
static extractBody (string $text)
 Strip everything but the <body> from the provided string.
 
static extractTagsAndParams (array $elements, $text, &$matches)
 Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns the next text.
 
static formatPageTitle ( $nsText, $nsSeparator, $mainText)
 Add HTML tags marking the parts of a page title, to be displayed in the first heading of the page.
 
static getExternalLinkRel ( $url=false, $title=null)
 Get the rel attribute for a particular external link.
 
static guessSectionNameFromStrippedText ( $text)
 Like guessSectionNameFromWikiText(), but takes already-stripped text as input.
 
static normalizeLinkUrl ( $url)
 Replace unusual escape codes in a URL with their equivalent characters.
 
static replaceTableOfContentsMarker ( $text, $toc)
 Replace table of contents marker in parsed HTML.
 
static statelessFetchRevisionRecord (LinkTarget $link, $parser=null)
 Wrapper around RevisionLookup::getKnownCurrentRevision.
 
static statelessFetchTemplate ( $page, $parser=false)
 Static function to get a template Can be overridden via ParserOptions::setTemplateCallback().
 
static stripOuterParagraph ( $html)
 Strip outer.
 

Public Attributes

 $extCite
 
 $extTemplateStylesCache
 
 $mExpensiveFunctionCount
 Number of expensive parser function calls.
 
 $mExtArrays
 
 $mExtHashTables
 
 $mExtLoopsCounter
 
 $mExtVariables
 
array $mHeadings
 
int $mHighestExpansionDepth
 
 $mMarkerIndex = 0
 
int $mPPNodeCount
 
 $mTemplatePath
 
 $proofreadRenderingPages
 
 $scribunto_engine
 
 $static_tag_buf
 
const CONSTRUCTOR_OPTIONS
 
const EXT_LINK_URL_CLASS = '[^][<>"\\x00-\\x20\\x7F\p{Zs}\x{FFFD}]'
 Everything except bracket, space, or control characters.
 
const MARKER_PREFIX = "\x7f'\"`UNIQ-"
 
const OT_HTML = 1
 Output type: like Parser::parse()
 
const OT_PLAIN = 4
 Output type: like Parser::extractSections() - portions of the original are returned unchanged.
 
const OT_PREPROCESS = 3
 Output type: like Parser::preprocess()
 
const OT_WIKI = 2
 Output type: like Parser::preSaveTransform()
 
const SFH_NO_HASH = 1
 
const SFH_OBJECT_ARGS = 2
 

Protected Member Functions

 fetchFileNoRegister (LinkTarget $link, array $options=[])
 Helper function for fetchFileAndTitle.
 
 getHookContainer ()
 Get a HookContainer capable of returning metadata about hooks or running extension hooks.
 
 getHookRunner ()
 Get a HookRunner for calling core hooks.
 
 lock ()
 Lock the current instance of the parser.
 

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
Warning
$wgUser or $wgTitle or $wgRequest or $wgLang. Keep them away!
Settings:
$wgNamespacesWithSubpages
Settings only within ParserOptions:
$wgAllowExternalImages $wgAllowSpecialInclusion $wgInterwikiMagic $wgMaxArticleSize

Definition at line147 of fileParser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Parser::__construct(ServiceOptions$svcOptions,
MagicWordFactory$magicWordFactory,
Language$contLang,
ParserFactory$factory,
UrlUtils$urlUtils,
SpecialPageFactory$spFactory,
LinkRendererFactory$linkRendererFactory,
NamespaceInfo$nsInfo,
LoggerInterface$logger,
BadFileLookup$badFileLookup,
LanguageConverterFactory$languageConverterFactory,
LanguageNameUtils$languageNameUtils,
HookContainer$hookContainer,
TidyDriverBase$tidy,
WANObjectCache$wanCache,
UserOptionsLookup$userOptionsLookup,
UserFactory$userFactory,
TitleFormatter$titleFormatter,
HttpRequestFactory$httpRequestFactory,
TrackingCategories$trackingCategories,
SignatureValidatorFactory$signatureValidatorFactory,
UserNameUtils$userNameUtils )

Constructing parsers directly is not allowed! Use a ParserFactory.

Access: internal
Parameters
ServiceOptions$svcOptions
MagicWordFactory$magicWordFactory
Language$contLangContent language
ParserFactory$factory
UrlUtils$urlUtils
SpecialPageFactory$spFactory
LinkRendererFactory$linkRendererFactory
NamespaceInfo$nsInfo
LoggerInterface$logger
BadFileLookup$badFileLookup
LanguageConverterFactory$languageConverterFactory
LanguageNameUtils$languageNameUtils
HookContainer$hookContainer
TidyDriverBase$tidy
WANObjectCache$wanCache
UserOptionsLookup$userOptionsLookup
UserFactory$userFactory
TitleFormatter$titleFormatter
HttpRequestFactory$httpRequestFactory
TrackingCategories$trackingCategories
SignatureValidatorFactory$signatureValidatorFactory
UserNameUtils$userNameUtils

Definition at line464 of fileParser.php.

ReferencesMediaWiki\Parser\ParserFactory\$inParserFactory,MediaWiki\Config\ServiceOptions\assertRequiredOptions(),MediaWiki\Config\ServiceOptions\get(),NS_SPECIAL,MediaWiki\MainConfigNames\PreprocessorCacheThreshold,MediaWiki\Parser\CoreTagHooks\register(),MediaWiki\Parser\CoreTagHooks\REGISTER_OPTIONS, andMediaWiki\Utils\UrlUtils\validProtocols().

◆ __destruct()

MediaWiki\Parser\Parser::__destruct()

Reduce memory usage to reduce the impact of circular references.

Definition at line562 of fileParser.php.

Member Function Documentation

◆ __clone()

MediaWiki\Parser\Parser::__clone()

Allow extensions to clean up when the parser is cloned.

Definition at line577 of fileParser.php.

◆ addTrackingCategory()

MediaWiki\Parser\Parser::addTrackingCategory($msg)
See also
TrackingCategories::addTrackingCategory()
Parameters
string$msgMessage key
Returns
bool Whether the addition was successful
Since
1.19 method is public

Definition at line4235 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\displaytitle().

◆ argSubstitution()

MediaWiki\Parser\Parser::argSubstitution(array$piece,
PPFrame$frame )

Triple brace replacement – used for template arguments.

Parameters
array$piece
PPFrame$frame
Returns
array
Access: internal

Definition at line3988 of fileParser.php.

ReferencesMediaWiki\Parser\PPFrame\expand(),MediaWiki\Parser\PPFrame\getArgument(),MediaWiki\Parser\PPFrame\isTemplate(), andMediaWiki\Parser\PPFrame\virtualBracketedImplode().

◆ attributeStripCallback()

MediaWiki\Parser\Parser::attributeStripCallback(&$text,
$frame =false )

Callback from the Sanitizer for expanding items found in HTML attribute values, so they can be safely tested and escaped.

Parameters
string&$text
PPFrame | false$frame
Returns
string
Deprecated
since 1.35, internal callback should not have been public

Definition at line5801 of fileParser.php.

ReferenceswfDeprecated().

◆ braceSubstitution()

MediaWiki\Parser\Parser::braceSubstitution(array$piece,
PPFrame$frame )

Return the text of a template, after recursively replacing any variables or templates within the template.

Parameters
array$pieceThe parts of the template $piece['title']: the title, i.e. the part before the | $piece['parts']: the parameter array $piece['lineStart']: whether the brace was at the start of a line
PPFrame$frameThe current frame, contains template arguments
Exceptions
Exception
Returns
string|array The text of the template
Access: internal

Definition at line3044 of fileParser.php.

ReferencesMediaWiki\Parser\PPFrame\expand(),getTitle(),MediaWiki\Parser\PPFrame\loopCheck(),MediaWiki\Parser\PPFrame\newChild(),NS_TEMPLATE,MediaWiki\Context\RequestContext\setTitle(),MediaWiki\Parser\PPFrame\virtualBracketedImplode(),wfDeprecatedMsg(),wfEscapeWikiText(), andwfMessage().

◆ callParserFunction()

MediaWiki\Parser\Parser::callParserFunction(PPFrame$frame,
$function,
array$args =[],
bool$inSolState =false )

Call a parser function and return an array with text and flags.

The returned array will always contain a boolean 'found', indicating whether the parser function was found or not. It may also contain the following: text: string|object, resulting wikitext or PP DOM object isHTML: bool, $text is HTML, armour it against most wikitext transformation isRawHTML: bool, $text is raw HTML, armour it against all wikitext transformation isChildObj: bool, $text is a DOM node needing expansion in a child frame isLocalObj: bool, $text is a DOM node needing expansion in the current frame nowiki: bool, wiki markup in $text should be escaped

Since
1.21
Parameters
PPFrame$frameThe current frame, contains template arguments
string$functionFunction name
array$argsArguments to the function
bool$inSolStateIs the template processing starting in Start-Of-Line (SOL) position? Prepreprocessing (on behalf of Parsoid) uses this flag to set lineStart property on processor DOM tree nodes. Since the preprocessor tree doesn't rely on expanded templates, this flag is a best guess since {{expands-to-empty-string}} can blind it to SOL context. This flag is always false for legacy parser template expansions.
Returns
array

Definition at line3460 of fileParser.php.

ReferencesMediaWiki\Parser\PPFrame\expand().

◆ cleanSig()

MediaWiki\Parser\Parser::cleanSig($text,
$parsing =false )

Clean up signature text.

1) Strip 3, 4 or 5 tildes out of signatures, seecleanSigInSig 2) Substitute all transclusions

Parameters
string$text
bool$parsingWhether we're cleaning (preferences save) or parsing
Returns
string Signature text
Since
1.6

Definition at line4892 of fileParser.php.

◆ cleanSigInSig()

static MediaWiki\Parser\Parser::cleanSigInSig($text)
static

Strip 3, 4 or 5 tildes out of signatures.

Parameters
string$text
Returns
string Signature text with /~{3,5}/ removed
Since
1.7

Definition at line4934 of fileParser.php.

◆ clearState()

MediaWiki\Parser\Parser::clearState()

Clear Parser state.

Access: internal

Definition at line605 of fileParser.php.

ReferencesMediaWiki\Parser\Parser\getHookContainer(), andMediaWiki\Parser\Parser\resetOutput().

◆ clearTagHooks()

MediaWiki\Parser\Parser::clearTagHooks()

Remove all tag hooks.

Since
1.12

Definition at line5082 of fileParser.php.

◆ doBlockLevels()

MediaWiki\Parser\Parser::doBlockLevels($text,
$linestart )

Make lists from lines starting with ':', '*', '#', etc.

(DBL)

Parameters
string$text
bool$linestartWhether or not this is at the start of a line.
Access: internal
Returns
string The lists rendered as HTML
Deprecated
since 1.35, will not be supported in future parsers

Definition at line2842 of fileParser.php.

ReferenceswfDeprecated().

◆ doQuotes()

MediaWiki\Parser\Parser::doQuotes($text)

Helper function for handleAllQuotes()

Parameters
string$text
Returns
string
Access: internal

Definition at line2000 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\displaytitle().

◆ enableOOUI()

MediaWiki\Parser\Parser::enableOOUI()

Set's up the PHP implementation of OOUI for use in this request and instructs OutputPage to enable OOUI for itself.

Since
1.26
Deprecated
since 1.35, use $parser->getOutput()->setEnableOOUI() instead.

Definition at line6558 of fileParser.php.

ReferenceswfDeprecated().

◆ extensionSubstitution()

MediaWiki\Parser\Parser::extensionSubstitution(array$params,
PPFrame$frame,
bool$processNowiki =false )

Return the text to be used for a given extension tag.

This is the ghost of strip().

Parameters
array$paramsAssociative array of parameters: name PPNode for the tag name attr PPNode for unparsed text where tag attributes are thought to be attributes Optional associative array of parsed attributes inner Contents of extension element noClose Original text did not have a close tag
PPFrame$frame
bool$processNowikiProcess nowiki tags by running the nowiki tag handler Normally, nowikis are only processed for the HTML output type. With this arg set to true, they are processed (and converted to a nowiki strip marker) for all output types.
Returns
string
Access: internal
Since
1.12

Definition at line4049 of fileParser.php.

ReferencesMediaWiki\Parser\PPFrame\expand().

Referenced byMediaWiki\Parser\CoreParserFunctions\tagObj().

◆ extractBody()

static MediaWiki\Parser\Parser::extractBody(string$text)
static

Strip everything but the <body> from the provided string.

Parameters
string$text
Returns
string
Stability: unstable

Definition at line6533 of fileParser.php.

◆ extractTagsAndParams()

static MediaWiki\Parser\Parser::extractTagsAndParams(array$elements,
$text,
&$matches )
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' => [
'element',
'tag content',
['param' =>'x' ],
'<element param="x">tag content</element>' ]
Parameters
string[]$elementsList of element names. Comments are always extracted.
string$textSource text string.
array[]&$matchesOut parameter, Array: extracted tags
Returns
string Stripped text

Definition at line1290 of fileParser.php.

References$matches.

◆ fetchCurrentRevisionRecordOfTitle()

MediaWiki\Parser\Parser::fetchCurrentRevisionRecordOfTitle(LinkTarget$link)

Fetch the current revision of a given title as a RevisionRecord.

Note that the revision (and even the title) may not exist in the database, so everything contributing to the output of the parser should use this method where possible, rather than getting the revisions themselves. This method also caches its results, so using it benefits performance.

This can return null if the callback returns false

Since
1.35
Parameters
LinkTarget$link
Returns
RevisionRecord|null

Definition at line3606 of fileParser.php.

◆ fetchFileAndTitle()

MediaWiki\Parser\Parser::fetchFileAndTitle(LinkTarget$link,
array$options =[] )

Fetch a file and its title and register a reference to it.

If 'broken' is a key in $options then the file will appear as a broken thumbnail.

Parameters
LinkTarget$link
array$optionsArray of options to RepoGroup::findFile
Returns
array ( File or false, Title of file )
Since
1.18

Definition at line3866 of fileParser.php.

◆ fetchFileNoRegister()

MediaWiki\Parser\Parser::fetchFileNoRegister(LinkTarget$link,
array$options =[] )
protected

Helper function for fetchFileAndTitle.

Also useful if you need to fetch a file but not use it yet, for example to get the file's handler.

Parameters
LinkTarget$link
array$optionsArray of options to RepoGroup::findFile
Returns
File|false

Definition at line3893 of fileParser.php.

◆ fetchTemplateAndTitle()

MediaWiki\Parser\Parser::fetchTemplateAndTitle(LinkTarget$link)

Fetch the unparsed text of a template and register a reference to it.

Parameters
LinkTarget$link
Returns
array{0:string|false,1:Title}
Since
1.11

Definition at line3674 of fileParser.php.

ReferencesgetTitle().

◆ firstCallInit()

MediaWiki\Parser\Parser::firstCallInit()

Used to do various kinds of initialisation on the first call of the parser.

Deprecated
since 1.35, this initialization is done in the constructor and manual calls to ::firstCallInit() have no effect.
Since
1.7

Definition at line593 of fileParser.php.

◆ formatPageTitle()

static MediaWiki\Parser\Parser::formatPageTitle($nsText,
$nsSeparator,
$mainText )
static

Add HTML tags marking the parts of a page title, to be displayed in the first heading of the page.

Access: internal
Since
1.39
Parameters
string | HtmlArmor$nsText
string | HtmlArmor$nsSeparator
string | HtmlArmor$mainText
Returns
string HTML

Definition at line6517 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\parse().

◆ getBadFileLookup()

MediaWiki\Parser\Parser::getBadFileLookup()

Get the BadFileLookup instance that this Parser is using.

Since
1.35
Returns
BadFileLookup

Definition at line1267 of fileParser.php.

Referenced byMediaWiki\Linker\Linker\makeImageLink().

◆ getContentLanguage()

MediaWiki\Parser\Parser::getContentLanguage()

Get the content language that this Parser is using.

Since
1.32
Returns
Language

Definition at line1257 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\lc(),MediaWiki\Parser\CoreParserFunctions\lcfirst(),MediaWiki\Parser\CoreParserFunctions\ns(),MediaWiki\Parser\CoreParserFunctions\pagesincategory(),MediaWiki\Parser\CoreParserFunctions\uc(), andMediaWiki\Parser\CoreParserFunctions\ucfirst().

◆ getDefaultSort()

MediaWiki\Parser\Parser::getDefaultSort()

Accessor for the 'defaultsort' page property.

Will use the empty string if none is set.

This value is treated as a prefix, so the empty string is equivalent to sorting by page name.

Returns
string
Since
1.9
Deprecated
since 1.38, use $parser->getOutput()->getPageProperty('defaultsort') ?? ''

Definition at line6231 of fileParser.php.

ReferenceswfDeprecated().

◆ getExternalLinkAttribs()

MediaWiki\Parser\Parser::getExternalLinkAttribs($url)

Get an associative array of additional HTML attributes appropriate for a particular external link.

This currently may include rel => nofollow (depending on configuration, namespace, and the URL's domain) and/or a target attribute (depending on configuration).

Access: internal
Parameters
string$urlURL to extract the domain from for rel => nofollow if appropriate
Returns
array Associative array of HTML attributes

Definition at line2296 of fileParser.php.

References$url, andgetTitle().

◆ getExternalLinkRel()

static MediaWiki\Parser\Parser::getExternalLinkRel($url =false,
$title =null )
static

Get the rel attribute for a particular external link.

Since
1.21
Access: internal
Parameters
string | false$urlOptional URL, to extract the domain from for rel => nofollow if appropriate
LinkTarget | PageReference | null$titleOptional page, for wgNoFollowNsExceptions lookups
Returns
string|null Rel attribute for $url

Definition at line2270 of fileParser.php.

References$url, andwfGetUrlUtils().

◆ getFlatSectionInfo()

MediaWiki\Parser\Parser::getFlatSectionInfo($text)

Get an array of preprocessor section information.

Preprocessor sections are those identified by wikitext-style syntax, not HTML-style syntax. Templates are not expanded, so these sections do not include sections created by templates or parser functions. This is the same definition of a section as used by section editing, but not the same as TOC generation.

These sections are typically smaller than those acted on by getSection() and replaceSection() since they are not nested. Section nesting could be reconstructed from the heading levels.

The return value is an array of associative array info structures. Each associative array contains the following keys, describing a section:

  • index: An integer identifying the section.
  • level: The heading level, e.g. 1 for

    . For the section before the the first heading, this will be 0..offset: The byte offset within the wikitext at which the section startsstartsheading: The wikitext for the header which introduces the section, including equals signs. For the section before the first heading, this will be an empty string..text: The complete text of the section. @param string $text @return array[] \par "Access: internal"

Definition at line6033 of fileParser.php.

◆ getFunctionHooks()

MediaWiki\Parser\Parser::getFunctionHooks()

Get all registered function hook identifiers.

Returns
array
Since
1.8

Definition at line5169 of fileParser.php.

◆ getFunctionLang()

MediaWiki\Parser\Parser::getFunctionLang()

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

Returns
Language
Since
1.7
Deprecated
since 1.40; use ::getTargetLanguage() instead.

Definition at line1180 of fileParser.php.

ReferenceswfDeprecated().

◆ getFunctionSynonyms()

MediaWiki\Parser\Parser::getFunctionSynonyms()
Since
1.32
Returns
array{0:array<string,string>,1:array<string,string>}

Definition at line5822 of fileParser.php.

◆ getHookContainer()

MediaWiki\Parser\Parser::getHookContainer()
protected

Get a HookContainer capable of returning metadata about hooks or running extension hooks.

Since
1.35
Returns
HookContainer

Definition at line1688 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\clearState().

◆ getHookRunner()

MediaWiki\Parser\Parser::getHookRunner()
protected

Get a HookRunner for calling core hooks.

Access: internal
This is for use by core only. Hook interfaces may be removed without notice.
Since
1.35
Returns
HookRunner

Definition at line1700 of fileParser.php.

◆ getLinkRenderer()

MediaWiki\Parser\Parser::getLinkRenderer()

Get a LinkRenderer instance to make links with.

Since
1.28
Returns
LinkRenderer

Definition at line1232 of fileParser.php.

◆ getMagicWordFactory()

MediaWiki\Parser\Parser::getMagicWordFactory()

Get the MagicWordFactory that this Parser is using.

Since
1.32
Returns
MagicWordFactory

Definition at line1247 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\defaultsort(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Parser\CoreParserFunctions\formatnum(),MediaWiki\Parser\CoreParserFunctions\pagesincategory(), andMediaWiki\Parser\CoreParserFunctions\urlencode().

◆ getOptions()

MediaWiki\Parser\Parser::getOptions()
Returns
ParserOptions|null
Since
1.6

Definition at line1133 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\formatDate(),MediaWiki\Parser\CoreParserFunctions\gender(),MediaWiki\Parser\CoreTagHooks\html(),MediaWiki\Parser\CoreParserFunctions\intFunction(), andMediaWiki\Parser\CoreParserFunctions\revisionid().

◆ getOutput()

MediaWiki\Parser\Parser::getOutput()
Returns
ParserOutput
Since
1.14

Definition at line1119 of fileParser.php.

ReferenceswfDeprecated().

Referenced byMediaWiki\Parser\CoreParserFunctions\defaultsort(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Parser\CoreMagicVariables\expand(),MediaWiki\Parser\CoreParserFunctions\interlanguagelink(),MediaWiki\Parser\CoreParserFunctions\interwikilink(),MediaWiki\Parser\CoreParserFunctions\pageid(),MediaWiki\Parser\CoreParserFunctions\revisionid(),MediaWiki\Parser\CoreParserFunctions\revisionuser(), andTraditionalImageGallery\toHTML().

◆ getOutputType()

MediaWiki\Parser\Parser::getOutputType()

Accessor for the output type.

Returns
int One of the Parser::OT_... constants
Since
1.35

Definition at line1083 of fileParser.php.

◆ getPage()

MediaWiki\Parser\Parser::getPage()

Returns the page used as context for parsing, e.g.

when resolving relative subpage links.

Since
1.37
Returns
?PageReference Null if no page is set (deprecated since 1.34)

Definition at line1065 of fileParser.php.

ReferenceswfDeprecated().

◆ getPreloadText()

MediaWiki\Parser\Parser::getPreloadText($text,
PageReference$page,
ParserOptions$options,
$params =[] )

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

(T7210)

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

Parameters
string$text
PageReference$page
ParserOptions$options
array$params
Returns
string
Since
1.17

Definition at line990 of fileParser.php.

ReferencesMediaWiki\Parser\Preprocessor\DOM_FOR_INCLUSION,MediaWiki\Parser\PPFrame\NO_ARGS, andMediaWiki\Parser\PPFrame\NO_TEMPLATES.

◆ getPreprocessor()

MediaWiki\Parser\Parser::getPreprocessor()

Get a preprocessor object.

Returns
Preprocessor
Since
1.12.0

Definition at line1222 of fileParser.php.

◆ getRevisionId()

MediaWiki\Parser\Parser::getRevisionId()

Get the ID of the revision we are parsing.

The return value will be either:

  • a) Positive, indicating a specific revision ID (current or old)
  • b) Zero, meaning the revision ID is specified by getCurrentRevisionRecordCallback()
  • c) Null, meaning the parse is for preview mode and there is no revision
Returns
int|null
Since
1.13

Definition at line6087 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\revisionid().

◆ getRevisionRecordObject()

MediaWiki\Parser\Parser::getRevisionRecordObject()

Get the revision record object for $this->mRevisionId.

Returns
RevisionRecord|null Either a RevisionRecord object or null
Since
1.35

Definition at line6097 of fileParser.php.

ReferencesgetTitle().

Referenced byMediaWiki\Parser\CoreParserFunctions\revisionid().

◆ getRevisionSize()

MediaWiki\Parser\Parser::getRevisionSize()

Get the size of the revision.

Returns
int|null Revision size
Since
1.22

Definition at line6206 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\makeLimitReport().

◆ getRevisionTimestamp()

MediaWiki\Parser\Parser::getRevisionTimestamp()

Get the timestamp associated with the current revision, adjusted for the default server-local timestamp.

Returns
string TS_MW timestamp
Since
1.9

Definition at line6154 of fileParser.php.

◆ getRevisionUser()

MediaWiki\Parser\Parser::getRevisionUser()

Get the name of the user that edited the last revision.

Returns
string|null User name
Since
1.15

Definition at line6182 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\revisionuser().

◆ getSection()

MediaWiki\Parser\Parser::getSection($text,
$sectionId,
$defaultText ='' )

This function returns the text of a section, specified by a number ($section).

A section is text under a heading like == Heading == or \<h1\>Heading\</h1\>, or the first section before any such heading (section 0).

If a section contains subsections, these are also returned.

Parameters
string$textText to look in
string | int$sectionIdSection identifier as a number or string (e.g. 0, 1 or 'T-1').
string | false$defaultTextDefault to return if section is not found
Returns
string Text of the requested section
Since
1.7

Definition at line5983 of fileParser.php.

◆ getStripList()

MediaWiki\Parser\Parser::getStripList()

Get a list of strippable XML-like elements.

Returns
array

Definition at line1353 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\tagObj().

◆ getStripState()

MediaWiki\Parser\Parser::getStripState()
Returns
StripState
Since
1.34

Definition at line1361 of fileParser.php.

Referenced byMediaWiki\Parser\Parsoid\Config\DataAccess\preprocessWikitext(), andMediaWiki\Parser\CoreParserFunctions\tagObj().

◆ getTags()

MediaWiki\Parser\Parser::getTags()

Accessor.

Returns
array
Since
1.6

Definition at line5814 of fileParser.php.

◆ getTargetLanguage()

MediaWiki\Parser\Parser::getTargetLanguage()

Get the target language for the content being parsed.

This is usually the language that the content is in.

Since
1.19
Returns
Language

Definition at line1193 of fileParser.php.

ReferencesgetTitle().

Referenced byMediaWiki\Parser\CoreParserFunctions\bcp47(),MediaWiki\Parser\CoreParserFunctions\bidi(),MediaWiki\Parser\CoreParserFunctions\dir(),MediaWiki\Parser\CoreParserFunctions\formatDate(),MediaWiki\Parser\CoreParserFunctions\formatnum(),MediaWiki\Parser\CoreParserFunctions\gender(),MediaWiki\Parser\CoreParserFunctions\grammar(),MediaWiki\Parser\CoreParserFunctions\language(),MediaWiki\Parser\CoreParserFunctions\numberingroup(),MediaWiki\Parser\CoreParserFunctions\numberofactiveusers(),MediaWiki\Parser\CoreParserFunctions\numberofadmins(),MediaWiki\Parser\CoreParserFunctions\numberofarticles(),MediaWiki\Parser\CoreParserFunctions\numberofedits(),MediaWiki\Parser\CoreParserFunctions\numberoffiles(),MediaWiki\Parser\CoreParserFunctions\numberofpages(),MediaWiki\Parser\CoreParserFunctions\numberofusers(),MediaWiki\Parser\CoreParserFunctions\pagesincategory(),MediaWiki\Parser\CoreParserFunctions\pagesinnamespace(),MediaWiki\Parser\CoreParserFunctions\pagesize(), andMediaWiki\Parser\CoreParserFunctions\plural().

◆ getTargetLanguageConverter()

MediaWiki\Parser\Parser::getTargetLanguageConverter()

Shorthand for getting a Language Converter for Target language.

Since
public since 1.38
Returns
ILanguageConverter

Definition at line1666 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\defaultsort(),MediaWiki\Parser\CoreParserFunctions\displaytitle(), andMediaWiki\Parser\Parser\parse().

◆ getTemplateDom()

MediaWiki\Parser\Parser::getTemplateDom(LinkTarget$title,
bool$inSolState =false )

Get the semi-parsed DOM representation of a template with a given title, and its redirect destination title.

Cached.

The second element of the returned array may be a Title object, or may be the passed$title parameter, so if you need aTitle, pass it aTitle rather than a TitleValue.

Parameters
LinkTarget$title
bool$inSolStateIs the template processing starting in Start-Of-Line (SOL) position? Prepreprocessing (on behalf of Parsoid) uses this flag to set lineStart property on processor DOM tree nodes. Since the preprocessor tree doesn't rely on expanded templates, this flag is a best guess since {{expands-to-empty-string}} can blind it to SOL context. This flag is always false for legacy parser template expansions.
Returns
array{0:PPNode|false,1:LinkTarget} [Template DOM, final template title]
Since
1.12

Definition at line3555 of fileParser.php.

◆ getTitle()

MediaWiki\Parser\Parser::getTitle()
Since
1.6
Deprecated
since 1.37, use getPage instead.
Returns
Title

Definition at line1032 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\cascadingsources(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Linker\Linker\makeImageLink(),MediaWiki\Parser\CoreParserFunctions\pageid(),MediaWiki\Parser\CoreParserFunctions\protectionexpiry(),MediaWiki\Parser\CoreParserFunctions\protectionlevel(),MediaWiki\Parser\CoreParserFunctions\revisionid(), andMediaWiki\Parser\CoreParserFunctions\revisionuser().

◆ getUrlProtocols()

MediaWiki\Parser\Parser::getUrlProtocols()
Since
1.32
Returns
string

Definition at line5830 of fileParser.php.

◆ getUserIdentity()

MediaWiki\Parser\Parser::getUserIdentity()

Get a user either from the user set on Parser if it's set, or from the ParserOptions object otherwise.

Since
1.36
Returns
UserIdentity

Definition at line1212 of fileParser.php.

◆ getUserSig()

MediaWiki\Parser\Parser::getUserSig(UserIdentity$user,
$nickname =false,
$fancySig =null )

Fetch the user's signature text, if any, and normalize to validated, ready-to-insert wikitext.

If you have pre-fetched the nickname or the fancySig option, you can specify them here to save a database query. Do not reuse this parser instance after calling getUserSig(), as it may have changed.

Parameters
UserIdentity$user
string | false$nicknameNickname to use or false to use user's default nickname
bool | null$fancySigwhether the nicknname is the complete signature or null to use default value
Returns
string
Since
1.6

Definition at line4810 of fileParser.php.

ReferencesMediaWiki\User\UserIdentity\getName(),MediaWiki\User\UserIdentity\isRegistered(),wfEscapeWikiText(), andwfMessage().

◆ guessLegacySectionNameFromWikiText()

MediaWiki\Parser\Parser::guessLegacySectionNameFromWikiText($text)

Same as guessSectionNameFromWikiText(), but produces legacy anchors instead, if possible.

For use in redirects, since various versions of Microsoft browsers interpret Location: headers as something other than UTF-8, resulting in breakage.

Parameters
string$textThe section name
Returns
string Anchor (starting with '#')
Since
1.17

Definition at line6285 of fileParser.php.

◆ guessSectionNameFromStrippedText()

static MediaWiki\Parser\Parser::guessSectionNameFromStrippedText($text)
static

Like guessSectionNameFromWikiText(), but takes already-stripped text as input.

Parameters
string$textSection name (plain text)
Returns
string Anchor (starting with '#')
Since
1.31

Definition at line6298 of fileParser.php.

◆ guessSectionNameFromWikiText()

MediaWiki\Parser\Parser::guessSectionNameFromWikiText($text)

Try to guess the section anchor name based on a wikitext fragment presumably extracted from a heading, for example "Header" from "== Header ==".

Parameters
string$text
Returns
string Anchor (starting with '#')
Since
1.12

Definition at line6268 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\anchorencode().

◆ incrementExpensiveFunctionCount()

MediaWiki\Parser\Parser::incrementExpensiveFunctionCount()
Returns
bool False if the limit has been exceeded
Since
1.13

Definition at line4166 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\cascadingsources(),MediaWiki\Parser\CoreParserFunctions\pageid(),MediaWiki\Parser\CoreParserFunctions\pagesincategory(),MediaWiki\Parser\CoreParserFunctions\protectionexpiry(), andMediaWiki\Parser\CoreParserFunctions\protectionlevel().

◆ insertStripItem()

MediaWiki\Parser\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 line1374 of fileParser.php.

◆ internalParse()

MediaWiki\Parser\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: internal
Parameters
string$textThe text to parse
bool$isMainWhether this is being called from the main parse() function
PPFrame | false$frameA pre-processor frame
Returns
string

Definition at line1597 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\parse(), andMediaWiki\Parser\Parser\recursiveTagParse().

◆ interwikiTransclude()

MediaWiki\Parser\Parser::interwikiTransclude(LinkTarget$link,
$action )

Transclude an interwiki link.

Parameters
LinkTarget$link
string$actionUsually one of (raw, render)
Returns
string
Access: internal

Definition at line3917 of fileParser.php.

References$url, andwfMessage().

◆ isCurrentRevisionOfTitleCached()

MediaWiki\Parser\Parser::isCurrentRevisionOfTitleCached(LinkTarget$link)
Parameters
LinkTarget$link
Returns
bool
Since
1.34
Access: internal

Definition at line3635 of fileParser.php.

◆ isLocked()

MediaWiki\Parser\Parser::isLocked()

Will entry points such as parse() throw an exception due to the parser already being active?

Since
1.39
Returns
bool

Definition at line6484 of fileParser.php.

◆ killMarkers()

MediaWiki\Parser\Parser::killMarkers($text)

Remove any strip markers found in the given text.

Parameters
string$text
Returns
string
Since
1.19

Definition at line6404 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\anchorencode(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Parser\CoreParserFunctions\grammar(),MediaWiki\Parser\CoreParserFunctions\pad(),MediaWiki\Parser\CoreParserFunctions\tagObj(), andMediaWiki\Parser\CoreParserFunctions\urlencode().

◆ limitationWarn()

MediaWiki\Parser\Parser::limitationWarn($limitationType,
$current ='',
$max ='' )

Warn the user when a parser limitation is reached Will warn at most once the user per limitation type.

The results are shown during preview and run through the Parser (SeeEditPage.php)

Parameters
string$limitationTypeShould be one of: 'expensive-parserfunction' (corresponding messages: 'expensive-parserfunction-warning', 'expensive-parserfunction-category') 'post-expand-template-argument' (corresponding messages: 'post-expand-template-argument-warning', 'post-expand-template-argument-category') 'post-expand-template-inclusion' (corresponding messages: 'post-expand-template-inclusion-warning', 'post-expand-template-inclusion-category') 'node-count-exceeded' (corresponding messages: 'node-count-exceeded-warning', 'node-count-exceeded-category') 'expansion-depth-exceeded' (corresponding messages: 'expansion-depth-exceeded-warning', 'expansion-depth-exceeded-category')
string | int | null$currentCurrent value
string | int | null$maxMaximum allowed, when an explicit limit has been exceeded, provide the values (optional)
Access: internal

Definition at line3019 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\parse().

◆ lock()

MediaWiki\Parser\Parser::lock()
protected

Lock the current instance of the parser.

This is meant to stop someone from calling the parser recursively and messing up all the strip state.

Returns
ScopedCallback The lock will be released once the return value goes out of scope.

Definition at line6459 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\parse().

◆ makeImage()

MediaWiki\Parser\Parser::makeImage(LinkTarget$link,
$options,
$holders =false )

Parse image options text and use it to make an image.

Parameters
LinkTarget$link
string$options
LinkHolderArray | false$holders
Returns
string HTML
Since
1.5

Definition at line5447 of fileParser.php.

◆ makeLimitReport()

MediaWiki\Parser\Parser::makeLimitReport(ParserOptions$parserOptions,
ParserOutput$parserOutput )

Set the limit report data in the current ParserOutput.

Access: internal

Definition at line771 of fileParser.php.

ReferencesMediaWiki\MainConfigNames\EnableParserLimitReporting,MediaWiki\Parser\ParserOutput\getCacheExpiry(),MediaWiki\Parser\CacheTime\getCacheTime(),MediaWiki\Parser\ParserOptions\getExpensiveParserFunctionLimit(),MediaWiki\Parser\ParserOptions\getMaxIncludeSize(),MediaWiki\Parser\ParserOptions\getMaxPPExpandDepth(),MediaWiki\Parser\ParserOptions\getMaxPPNodeCount(),MediaWiki\Parser\Parser\getRevisionSize(),MediaWiki\Parser\ParserOutput\getTimeProfile(),MediaWiki\Parser\ParserOutput\hasReducedExpiry(),MediaWiki\Parser\ParserOptions\isMessage(),MediaWiki\MainConfigNames\MaxArticleSize,MediaWiki\Parser\ParserOutput\setLimitReportData(),MediaWiki\MainConfigNames\ShowHostnames, andwfHostname().

Referenced byMediaWiki\Parser\Parsoid\Config\DataAccess\makeLimitReport(), andMediaWiki\Parser\Parser\parse().

◆ markerSkipCallback()

MediaWiki\Parser\Parser::markerSkipCallback($s,
callable$callback )

Call a callback function on all regions of the given text that are not inside strip markers, and replace those regions with the return value of the callback.

For example, with input:

aaa<MARKER>bbb

This will call the callback function twice, with 'aaa' and 'bbb'. Those two strings will be replaced with the value returned by the callback in each case.

Parameters
string$s
callable$callback
Returns
string
Access: internal
Since
1.12

Definition at line6373 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\formatnum(),MediaWiki\Parser\CoreParserFunctions\lc(), andMediaWiki\Parser\CoreParserFunctions\uc().

◆ modifyImageHtml()

MediaWiki\Parser\Parser::modifyImageHtml(File$file,
array$params,
string &$html )

Give hooks a chance to modify image thumbnail HTML.

Parameters
File$file
array$params
string&$html

Definition at line5730 of fileParser.php.

◆ msg()

MediaWiki\Parser\Parser::msg(string$msg,
$params )

Helper function to correctly set the target language and title of a message based on the parser context.

Most uses of system messages inside extensions or parser functions should use this method (instead of directly usingwfMessage) to ensure that the cache is not polluted.

Parameters
string$msgThe localization message key @phpcs:ignore Generic.Files.LineLength
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float>...$params See Message::params()
Returns
Message
Since
1.40
See also
https://phabricator.wikimedia.org/T202481

Definition at line4256 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\defaultsort(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Parser\CoreTagHooks\html(), andMediaWiki\Parser\CoreTagHooks\indicator().

◆ nextLinkID()

MediaWiki\Parser\Parser::nextLinkID()
Returns
int
Since
1.14

Definition at line1162 of fileParser.php.

◆ normalizeLinkUrl()

static MediaWiki\Parser\Parser::normalizeLinkUrl($url)
static

Replace unusual escape codes in a URL with their equivalent characters.

This generally follows the syntax defined in RFC 3986, with special consideration for HTTP query strings.

Access: internal
Parameters
string$url
Returns
string

Definition at line2329 of fileParser.php.

References$url.

◆ Options()

MediaWiki\Parser\Parser::Options($x =null)

Accessor/mutator for the ParserOptions object.

Parameters
ParserOptions | null$xNew value or null to just get the current one
Returns
ParserOptions Current ParserOptions object
Deprecated
since 1.35, use getOptions() / setOptions()

Definition at line1153 of fileParser.php.

ReferenceswfDeprecated(), andwfSetVar().

◆ OutputType()

MediaWiki\Parser\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
Deprecated
since 1.35, use getOutputType()/setOutputType()

Definition at line1110 of fileParser.php.

ReferenceswfDeprecated(), andwfSetVar().

◆ parse()

MediaWiki\Parser\Parser::parse($text,
PageReference$page,
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
PageReference$page
ParserOptions$options
bool$linestart
bool$clearState
int | null$revidID of the revision being rendered. This is used to render REVISION* magic words. 0 means that any current revision will be used. Null means that {{REVISIONID}}/{{REVISIONUSER}} will be empty and {{REVISIONTIMESTAMP}} will use the current timestamp.
Returns
ParserOutput
Since
1.10 method is public

Definition at line673 of fileParser.php.

ReferencesMediaWiki\Parser\Parser\formatPageTitle(),MediaWiki\Parser\ParserOptions\getDisableTitleConversion(),MediaWiki\Parser\ParserOptions\getExpensiveParserFunctionLimit(),MediaWiki\Parser\Parser\getTargetLanguageConverter(),MediaWiki\Parser\Parser\internalParse(),MediaWiki\Parser\Parser\limitationWarn(),MediaWiki\Parser\Parser\lock(),MediaWiki\Parser\Parser\makeLimitReport(), andMediaWiki\Parser\Sanitizer\removeSomeTags().

◆ parseExtensionTagAsTopLevelDoc()

MediaWiki\Parser\Parser::parseExtensionTagAsTopLevelDoc(string$text)

Needed by Parsoid/PHP to ensure all the hooks for extensions are run in the right order.

The primary differences between this and recursiveTagParseFully are: (a) absence of $frame (b) passing true to internalParseHalfParse so all hooks are run (c) running 'ParserAfterParse' hook at the same point in the parsing pipeline when parse() does it. This kinda mimics Parsoid/JS behavior where exttags are processed by the M/w API.

This is a temporary convenience method and will go away as we proceed further with Parsoid <->Parser.php integration.

Access: internal
Deprecated
Parameters
string$textWikitext source of the extension
Returns
string

Definition at line924 of fileParser.php.

◆ parseWidthParam()

MediaWiki\Parser\Parser::parseWidthParam($value,
$parseHeight =true,
bool$localized =false )

Parsed a width param of imagelink like 300px or 200x300px.

Parameters
string$value
bool$parseHeight
bool$localizedDefaults to false; set to true if the $value has already been matched againstimg_width to localize thepx suffix.
Returns
array
Since
1.20
Access: internal

Definition at line6421 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\filepath().

◆ preprocess()

MediaWiki\Parser\Parser::preprocess($text,
?PageReference$page,
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
?PageReference$page
ParserOptions$options
int | null$revid
PPFrame | false$frame
Returns
mixed|string
Since
1.8

Definition at line943 of fileParser.php.

◆ preprocessToDom()

MediaWiki\Parser\Parser::preprocessToDom($text,
$flags =0 )

Get the document object model for the given wikitext.

See also
Preprocessor::preprocessToObj()

The generated DOM tree must depend only on the input text and the flags. The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of T6899.

Any flag added to the $flags parameter here, or any other parameter liable to cause a change in the DOM tree for a given text, must be passed through the section identifier in the section edit link and thus back to extractSections().

Parameters
string$textWikitext
int$flagsBit field of Preprocessor::DOM_* constants
Returns
PPNode
Since
1.23 method is public

Definition at line2922 of fileParser.php.

◆ preSaveTransform()

MediaWiki\Parser\Parser::preSaveTransform($text,
PageReference$page,
UserIdentity$user,
ParserOptions$options,
$clearState =true )

Transform wiki markup when saving a page by doing "\\r\\n" -> "\\n" conversion, substituting signatures, {{subst:}} templates, etc.

Parameters
string$textThe text to transform
PageReference$pagethe current article
UserIdentity$userthe current user
ParserOptions$optionsParsing options
bool$clearStateWhether to clear the parser state first
Returns
string The altered wiki markup
Since
1.3

Definition at line4689 of fileParser.php.

ReferencesMediaWiki\Parser\ParserOptions\getPreSaveTransform().

◆ recursivePreprocess()

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

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

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

Definition at line970 of fileParser.php.

◆ recursiveTagParse()

MediaWiki\Parser\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 toreturn 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
PPFrame | false$frameThe frame to use for expanding any template variables
Returns
string UNSAFE half-parsed HTML
Since
1.8

Definition at line875 of fileParser.php.

ReferencesMediaWiki\Parser\Parser\internalParse().

Referenced byMediaWiki\Parser\CoreTagHooks\langconvert(), andMediaWiki\Parser\Parser\recursiveTagParseFully().

◆ recursiveTagParseFully()

MediaWiki\Parser\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
PPFrame | false$frameThe frame to use for expanding any template variables
Returns
string Fully parsed HTML

Definition at line899 of fileParser.php.

ReferencesMediaWiki\Parser\Parser\recursiveTagParse().

Referenced byMediaWiki\Parser\CoreParserFunctions\interwikilink().

◆ renderImageGallery()

MediaWiki\Parser\Parser::renderImageGallery($text,
array$params )

Renders an image gallery from a text with one line per image.

text labels may be given by using |-style alternative text. E.g. Image:one.jpg|The number "1" Image:tree.jpg|A tree given as text will return the HTML of a gallery with two images, labeled 'The number "1"' and 'A tree'.

Parameters
string$text
array$params
Returns
string HTML
Access: internal

Definition at line5219 of fileParser.php.

References$matches,getTitle(), andNS_FILE.

◆ replaceLinkHolders()

MediaWiki\Parser\Parser::replaceLinkHolders(&$text)

Replace "<!--LINK-->" link placeholders with actual links, in the buffer Placeholders created in Linker::link()

Parameters
string&$text
Deprecated
since 1.34; should not be used outside parser class.

Definition at line5180 of fileParser.php.

◆ replaceSection()

MediaWiki\Parser\Parser::replaceSection($oldText,
$sectionId,
$newText )

This function returns $oldtext after the content of the section specified by $section has been replaced with $text.

If the target section does not exist, $oldtext is returned unchanged.

Parameters
string$oldTextFormer text of the article
string | int$sectionIdSection identifier as a number or string (e.g. 0, 1 or 'T-1').
string | false$newTextReplacing text
Returns
string Modified text
Since
1.7

Definition at line6000 of fileParser.php.

◆ replaceTableOfContentsMarker()

static MediaWiki\Parser\Parser::replaceTableOfContentsMarker($text,
$toc )
static

Replace table of contents marker in parsed HTML.

Used to remove or replace the marker. This method should be used instead of direct access to Parser::TOC_PLACEHOLDER, since in the future the placeholder might have additional attributes attached which should be ignored when the replacement is made.

Since
1.38
Stability: stable
Parameters
string$textParsed HTML
string$tocHTML table of contents string, or else an empty string to remove the marker.
Returns
string Result HTML

Definition at line4955 of fileParser.php.

◆ replaceVariables()

MediaWiki\Parser\Parser::replaceVariables($text,
$frame =false,
$argsOnly =false,
array$options =[] )

Replace magic variables, templates, and template arguments with the appropriate text.

Templates are substituted recursively, taking care to avoid infinite loops.

Note that the substitution depends on value of $mOutputType: self::OT_WIKI: only {{subst:}} templates self::OT_PREPROCESS: templates but not extension tags self::OT_HTML: all templates and extension tags

Parameters
string$textThe text to transform
false | PPFrame | array$frameObject describing the arguments passed to the template. Arguments may also be provided as an associative array, as was the usual case before MW1.12. Providing arguments this way may be useful for extensions wishing to perform variable replacement explicitly.
bool$argsOnlyOnly do argument (triple-brace) expansion, not double-brace expansion.
array$optionsVarious options used by Parsoid:
  • 'parsoidTopLevelCall' Is this coming from Parsoid for top-level templates? This is used to set start-of-line flag to true for template expansions since that is how Parsoid models templates.
  • 'processNowiki' expands <nowiki> and stores in strip state
Returns
string
Since
1.24 method is public

Definition at line2953 of fileParser.php.

ReferenceswfDeprecated().

◆ resetOutput()

MediaWiki\Parser\Parser::resetOutput()

Reset the ParserOutput.

Since
1.34

Definition at line650 of fileParser.php.

Referenced byMediaWiki\Parser\Parser\clearState(), andMediaWiki\Parser\Parsoid\Config\DataAccess\preprocessWikitext().

◆ setFunctionHook()

MediaWiki\Parser\Parser::setFunctionHook($id,
callable$callback,
$flags =0 )

Create a function, e.g.

{{sum:1|2|3}} The callback function should have the form: function myParserFunction( &$parser, $arg1, $arg2, $arg3 ) { ... }

Or with Parser::SFH_OBJECT_ARGS: function myParserFunction( $parser, $frame, $args ) { ... }

The callback may either return the text result of the function, or an array with the text in element 0, and a number of flags in the other elements. The names of the flags are specified in the keys. Valid flags are: found The text returned is valid, stop processing the template. This is on by default. nowiki Wiki markup in the return value should be escaped isHTML The returned text is HTML, armour it against most wikitext transformation, but perform language conversion and some other postprocessing isRawHTML The returned text is raw HTML, include it verbatim in the output.

Parameters
string$idThe magic word ID
callable$callbackThe callback function (and object) to use
int$flagsA combination of the following flags: Parser::SFH_NO_HASH No leading hash, i.e. {{plural:...}} instead of {{if:...}}

Parser::SFH_OBJECT_ARGS Pass the template arguments as PPNode objects instead of text. This allows for conditional expansion of the parse tree, allowing you to eliminate dead branches and thus speed up parsing. It is also possible to analyse the parse tree of the arguments, and to control the way they are expanded.

The $frame parameter is a PPFrame. This can be used to produce expanded text from the arguments, for instance: $text = isset( $args[0] ) ? $frame->expand( $args[0] ) : '';

For technical reasons, $args[0] is pre-expanded and will be a string. This may change in future versions. Please call $frame->expand() on it anyway so that your code keeps working if/when this is changed.

If you want whitespace to be trimmed from $args, you need to do it yourself, post- expansion.

Please read the documentation inincludes/parser/Preprocessor.php for more information about the methods available in PPFrame and PPNode.

Returns
string|callable|null The old callback function for this name, if any
Since
1.6

Definition at line5135 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\register().

◆ setHook()

MediaWiki\Parser\Parser::setHook($tag,
callable$callback )

Create an HTML-style tag, e.g.

"<yourtag>special text</yourtag>" The callback should have the following form: function myParserHook( $text, array $params, Parser $parser, PPFrame $frame ) { ... }

Transform and return $text. Use $parser for any required context, e.g. use $parser->getTitle() and $parser->getOptions() not $wgTitle or $wgOut->mParserOptions

Hooks may return extended information by returning an array, of which the first numbered element (index 0) must be the return string. The following other keys are used:

  • 'markerType': used by some core tag hooks to override which strip array their results are placed in, 'general' or 'nowiki'.
Parameters
string$tagThe tag to use, e.g. 'hook' for "<hook>"
callable$callbackThe callback to use for the tag
Returns
callable|null The old value of the mTagHooks array associated with the hook
Since
1.3

Definition at line5064 of fileParser.php.

Referenced byMediaWiki\Parser\CoreTagHooks\register().

◆ setLinkID()

MediaWiki\Parser\Parser::setLinkID($id)
Parameters
int$id
Since
1.8

Definition at line1170 of fileParser.php.

◆ setOptions()

MediaWiki\Parser\Parser::setOptions(ParserOptions$options)

Mutator for the ParserOptions object.

Parameters
ParserOptions$optionsThe new parser options
Since
1.35

Definition at line1142 of fileParser.php.

◆ setOutputType()

MediaWiki\Parser\Parser::setOutputType($ot)

Mutator for the output type.

Parameters
int$otOne of the Parser::OT_… constants
Since
1.8

Definition at line1092 of fileParser.php.

◆ setPage()

MediaWiki\Parser\Parser::setPage(?PageReference$t =null)

Set the page used as context for parsing, e.g.

when resolving relative subpage links.

Since
1.37
Parameters
?PageReference$t

Definition at line1042 of fileParser.php.

ReferencesNS_SPECIAL.

◆ setStripExtTags()

MediaWiki\Parser\Parser::setStripExtTags(bool$val)
Access: internal

Definition at line2988 of fileParser.php.

◆ setTitle()

MediaWiki\Parser\Parser::setTitle(?Title$t =null)

Set the context title.

Deprecated
since 1.37, use setPage() instead.
Parameters
Title | null$t
Since
1.12

Definition at line1023 of fileParser.php.

◆ setUser()

MediaWiki\Parser\Parser::setUser(?UserIdentity$user)

Set the current user.

Should only be used when doing pre-save transform.

Parameters
UserIdentity | null$useruser identity or null (to reset)
Since
1.17

Definition at line1012 of fileParser.php.

◆ startExternalParse()

MediaWiki\Parser\Parser::startExternalParse(?PageReference$page,
ParserOptions$options,
$outputType,
$clearState =true,
$revId =null )

Set up some variables which are usually set up in parse() so that an external function can call some class members with confidence.

Parameters
?PageReference$page
ParserOptions$options
int$outputTypeOne of the Parser::OT_… constants
bool$clearState
int | null$revId
Since
1.3

Definition at line4995 of fileParser.php.

◆ statelessFetchRevisionRecord()

static MediaWiki\Parser\Parser::statelessFetchRevisionRecord(LinkTarget$link,
$parser =null )
static

Wrapper around RevisionLookup::getKnownCurrentRevision.

Since
1.34
Parameters
LinkTarget$link
Parser | null$parser
Returns
RevisionRecord|false False if missing

Definition at line3651 of fileParser.php.

◆ statelessFetchTemplate()

static MediaWiki\Parser\Parser::statelessFetchTemplate($page,
$parser =false )
static

Static function to get a template Can be overridden via ParserOptions::setTemplateCallback().

Parameters
LinkTarget$page
Parser | false$parser
Returns
array
Since
1.12

Definition at line3716 of fileParser.php.

ReferencesNS_MEDIAWIKI,MediaWiki\HookContainer\HookRunner\onBeforeParserFetchTemplateRevisionRecord(), andwfMessage().

◆ stripOuterParagraph()

static MediaWiki\Parser\Parser::stripOuterParagraph($html)
static

Strip outer.

tag from the HTML source of a single paragraph.

Returns original HTML if the

tag has any attributes, if there's no wrapping

tag, or if there is more than one

tag in the input HTML.

Parameters
string$html
Returns
string
Since
1.24

Definition at line6498 of fileParser.php.

◆ stripSectionName()

MediaWiki\Parser\Parser::stripSectionName($text)

Strips a text string of wikitext for use in a section anchor.

Accepts a text string and then removes all wikitext from the string and leaves only the resultant text (i.e. the result of [[User:WikiSysop|Sysop]] would be "Sysop" and the result of [[User:WikiSysop]] would be "User:WikiSysop") - this is intended to create valid section anchors by mimicking the output of the parser when headings are parsed.

Parameters
string$textText string to be stripped of wikitext for use in a Section anchor
Returns
string Filtered text string
Since
1.12

Definition at line6335 of fileParser.php.

◆ tagNeedsNowikiStrippedInTagPF()

MediaWiki\Parser\Parser::tagNeedsNowikiStrippedInTagPF(string$lowerTagName)

Definition at line4025 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\tagObj().

◆ transformMsg()

MediaWiki\Parser\Parser::transformMsg($text,
ParserOptions$options,
?PageReference$page =null )

Wrapper for preprocess()

Parameters
string$textThe text to preprocess
ParserOptions$options
?PageReference$pageThe context page
Returns
string
Since
1.3

Definition at line5030 of fileParser.php.

◆ validateSig()

MediaWiki\Parser\Parser::validateSig($text)

Check that the user's signature contains no bad XML.

Parameters
string$text
Returns
string|false An expanded string, or false if invalid.
Since
1.6

Definition at line4877 of fileParser.php.

Member Data Documentation

◆ $extCite

MediaWiki\Parser\Parser::$extCite
Deprecated
since 1.42: T343230

Definition at line310 of fileParser.php.

◆ $extTemplateStylesCache

MediaWiki\Parser\Parser::$extTemplateStylesCache
Deprecated
since 1.42: T343226

Definition at line312 of fileParser.php.

◆ $mExpensiveFunctionCount

MediaWiki\Parser\Parser::$mExpensiveFunctionCount

Number of expensive parser function calls.

Deprecated
since 1.35

Definition at line289 of fileParser.php.

◆ $mExtArrays

MediaWiki\Parser\Parser::$mExtArrays
Deprecated
since 1.42: T203532

Definition at line318 of fileParser.php.

◆ $mExtHashTables

MediaWiki\Parser\Parser::$mExtHashTables
Deprecated
since 1.42: T359887

Definition at line320 of fileParser.php.

◆ $mExtLoopsCounter

MediaWiki\Parser\Parser::$mExtLoopsCounter
Deprecated
since 1.42: T203563

Definition at line322 of fileParser.php.

◆ $mExtVariables

MediaWiki\Parser\Parser::$mExtVariables
Deprecated
since 1.42: T203531

Definition at line316 of fileParser.php.

◆ $mHeadings

array MediaWiki\Parser\Parser::$mHeadings
Access: internal

Definition at line282 of fileParser.php.

◆ $mHighestExpansionDepth

int MediaWiki\Parser\Parser::$mHighestExpansionDepth
Access: internal

Definition at line279 of fileParser.php.

◆ $mMarkerIndex

MediaWiki\Parser\Parser::$mMarkerIndex = 0
Deprecated
since 1.35

Definition at line249 of fileParser.php.

◆ $mPPNodeCount

int MediaWiki\Parser\Parser::$mPPNodeCount
Access: internal

Definition at line274 of fileParser.php.

◆ $mTemplatePath

MediaWiki\Parser\Parser::$mTemplatePath
Deprecated
since 1.42: T362693

Definition at line326 of fileParser.php.

◆ $proofreadRenderingPages

MediaWiki\Parser\Parser::$proofreadRenderingPages
Deprecated
since 1.42: T362664

Definition at line324 of fileParser.php.

◆ $scribunto_engine

MediaWiki\Parser\Parser::$scribunto_engine
Deprecated
since 1.42: T343229

Definition at line308 of fileParser.php.

◆ $static_tag_buf

MediaWiki\Parser\Parser::$static_tag_buf
Deprecated
since 1.42: T357838

Definition at line314 of fileParser.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Parser\Parser::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnableParserLimitReporting
Name constant for the EnableParserLimitReporting setting, for use with Config::get()
const MaxSigChars
Name constant for the MaxSigChars setting, for use with Config::get()
const ServerName
Name constant for the ServerName setting, for use with Config::get()
const ParserEnableUserLanguage
Name constant for the ParserEnableUserLanguage setting, for use with Config::get()
const AllowSlowParserFunctions
Name constant for the AllowSlowParserFunctions setting, for use with Config::get()
const AllowDisplayTitle
Name constant for the AllowDisplayTitle setting, for use with Config::get()
const StylePath
Name constant for the StylePath setting, for use with Config::get()
const MaxTocLevel
Name constant for the MaxTocLevel setting, for use with Config::get()
const Localtimezone
Name constant for the Localtimezone setting, for use with Config::get()
const Server
Name constant for the Server setting, for use with Config::get()
const FragmentMode
Name constant for the FragmentMode setting, for use with Config::get()
const MaxArticleSize
Name constant for the MaxArticleSize setting, for use with Config::get()
const EnableScaryTranscluding
Name constant for the EnableScaryTranscluding setting, for use with Config::get()
const TranscludeCacheExpiry
Name constant for the TranscludeCacheExpiry setting, for use with Config::get()
const Sitename
Name constant for the Sitename setting, for use with Config::get()
const ArticlePath
Name constant for the ArticlePath setting, for use with Config::get()
const ScriptPath
Name constant for the ScriptPath setting, for use with Config::get()
const SignatureValidation
Name constant for the SignatureValidation setting, for use with Config::get()
const MiserMode
Name constant for the MiserMode setting, for use with Config::get()
const RawHtml
Name constant for the RawHtml setting, for use with Config::get()
const PreprocessorCacheThreshold
Name constant for the PreprocessorCacheThreshold setting, for use with Config::get()
const ExtraInterlanguageLinkPrefixes
Name constant for the ExtraInterlanguageLinkPrefixes setting, for use with Config::get()
const ShowHostnames
Name constant for the ShowHostnames setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line409 of fileParser.php.

Referenced byMediaWiki\Parser\ParserFactory\__construct().

◆ EXT_LINK_URL_CLASS

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

Everything except bracket, space, or control characters.

\p{Zs} is unicode 'separator, space' category. It covers the space 0x20 as well as U+3000 is IDEOGRAPHIC SPACE for T21052. \x{FFFD} is the Unicode replacement character, which the HTML5 spec uses to replace invalid HTML characters.

Definition at line162 of fileParser.php.

◆ MARKER_PREFIX

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

Definition at line214 of fileParser.php.

Referenced byMediaWiki\Parser\StripState\__construct(),MediaWiki\Parser\PPFrame_Hash\expand(), andMediaWiki\Parser\Parsoid\Config\DataAccess\preprocessWikitext().

◆ OT_HTML

const MediaWiki\Parser\Parser::OT_HTML = 1

Output type: like Parser::parse()

Definition at line185 of fileParser.php.

Referenced byMediaWiki\Parser\PPFrame_Hash\expand(), andMediaWiki\Parser\Parsoid\Config\DataAccess\makeLimitReport().

◆ OT_PLAIN

const MediaWiki\Parser\Parser::OT_PLAIN = 4

Output type: like Parser::extractSections() - portions of the original are returned unchanged.

Definition at line194 of fileParser.php.

◆ OT_PREPROCESS

const MediaWiki\Parser\Parser::OT_PREPROCESS = 3

Output type: like Parser::preprocess()

Definition at line189 of fileParser.php.

Referenced byMediaWiki\Parser\PPFrame_Hash\expand(), andMediaWiki\Parser\Parsoid\Config\DataAccess\preprocessWikitext().

◆ OT_WIKI

const MediaWiki\Parser\Parser::OT_WIKI = 2

Output type: like Parser::preSaveTransform()

Definition at line187 of fileParser.php.

Referenced byMediaWiki\Parser\PPFrame_Hash\expand().

◆ SFH_NO_HASH

const MediaWiki\Parser\Parser::SFH_NO_HASH = 1

Definition at line151 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\register().

◆ SFH_OBJECT_ARGS

const MediaWiki\Parser\Parser::SFH_OBJECT_ARGS = 2

Definition at line152 of fileParser.php.

Referenced byMediaWiki\Parser\CoreParserFunctions\register().


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

[8]ページ先頭

©2009-2025 Movatter.jp