MediaWiki
master
|
Set options of the Parser. More...
Public Member Functions | |
__construct ( $user=null, $lang=null) | |
addExtraKey ( $key) | |
Extra key that should be present in the parser cache key. More... | |
disableContentConversion ( $x=true) | |
Whether content conversion should be disabled. More... | |
disableTitleConversion ( $x=true) | |
Whether title conversion should be disabled. More... | |
enableLimitReport ( $x=true) | |
Enable limit report in an HTML comment on output. More... | |
getAllowExternalImages () | |
Allow all external images inline? More... | |
getAllowExternalImagesFrom () | |
External images to allow. More... | |
getAllowSpecialInclusion () | |
Allow inclusion of special pages? More... | |
getAllowUnsafeRawHtml () | |
If the wiki is configured to allow raw html ($wgRawHtml = true) is it allowed in the specific case of parsing this page. More... | |
getCleanSignatures () | |
Clean up signature texts? More... | |
getCurrentRevisionCallback () | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
getCurrentRevisionRecordCallback () | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
getDateFormat () | |
Date format index. More... | |
getDisableContentConversion () | |
Whether content conversion should be disabled. More... | |
getDisableTitleConversion () | |
Whether title conversion should be disabled. More... | |
getEnableImageWhitelist () | |
Use the on-wiki external image whitelist? More... | |
getEnableLimitReport () | |
Enable limit report in an HTML comment on output. More... | |
getExpensiveParserFunctionLimit () | |
Maximum number of calls per parse to expensive parser functions. More... | |
getExternalLinkTarget () | |
Target attribute for external links. More... | |
getInterfaceMessage () | |
Parsing an interface message? More... | |
getInterwikiMagic () | |
Whether to extract interlanguage links. More... | |
getIsPreview () | |
Parsing the page for a "preview" operation? More... | |
getIsPrintable () | |
Parsing the printable version of the page? More... | |
getIsSectionPreview () | |
Parsing the page for a "preview" operation on a single section? More... | |
getMagicISBNLinks () | |
Are magic ISBN links enabled? More... | |
getMagicPMIDLinks () | |
Are magic PMID links enabled? More... | |
getMagicRFCLinks () | |
Are magic RFC links enabled? More... | |
getMaxIncludeSize () | |
Maximum size of template expansions, in bytes. More... | |
getMaxPPExpandDepth () | |
Maximum recursion depth in PPFrame::expand() More... | |
getMaxPPNodeCount () | |
Maximum number of nodes touched by PPFrame::expand() More... | |
getMaxTemplateDepth () | |
Maximum recursion depth for templates within templates. More... | |
getNumberHeadings () | |
Automatically number headings? More... | |
getOption ( $name) | |
Fetch an option and track that is was accessed. More... | |
getPreSaveTransform () | |
Transform wiki markup when saving the page? More... | |
getRedirectTarget () | |
Get the previously-set redirect target. More... | |
getRemoveComments () | |
Remove HTML comments. More... | |
getSpeculativePageId () | |
A guess for {{PAGEID}}, calculated using the callback provided via setSpeculativeRevPageCallback(). More... | |
getSpeculativeRevId () | |
A guess for {{REVISIONID}}, calculated using the callback provided via setSpeculativeRevIdCallback(). More... | |
getStubThreshold () | |
Thumb size preferred by the user. More... | |
getTargetLanguage () | |
Target language for the parse. More... | |
getTemplateCallback () | |
Callback for template fetching; first argument to call_user_func(). More... | |
getThumbSize () | |
Thumb size preferred by the user. More... | |
getTimestamp () | |
Timestamp used for {{CURRENTDAY}} etc. More... | |
getUser () | |
Current user. More... | |
getUserLang () | |
Same as getUserLangObj() but returns a string instead. More... | |
getUserLangObj () | |
Get the user language used by the parser for this page and split the parser cache. More... | |
getWrapOutputClass () | |
Class to use to wrap output from Parser::parse() More... | |
isSafeToCache (array $usedOptions=null) | |
Test whether these options are safe to cache. More... | |
matches (ParserOptions $other) | |
Check if these options match that of another options set. More... | |
matchesForCacheKey (ParserOptions $other) | |
optionsHash ( $forOptions, $title=null) | |
Generate a hash string with the values set on these ParserOptions for the keys given in the array. More... | |
optionUsed ( $optionName) | |
Called when an option is accessed. More... | |
registerWatcher ( $callback) | |
Registers a callback for tracking which ParserOptions which are used. More... | |
setAllowExternalImages ( $x) | |
Allow all external images inline? More... | |
setAllowExternalImagesFrom ( $x) | |
External images to allow. More... | |
setAllowSpecialInclusion ( $x) | |
Allow inclusion of special pages? More... | |
setAllowUnsafeRawHtml ( $x) | |
If the wiki is configured to allow raw html ($wgRawHtml = true) is it allowed in the specific case of parsing this page. More... | |
setCleanSignatures ( $x) | |
Clean up signature texts? More... | |
setCurrentRevisionCallback ( $x) | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
setCurrentRevisionRecordCallback ( $x) | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
setDateFormat ( $x) | |
Date format index. More... | |
setEnableImageWhitelist ( $x) | |
Use the on-wiki external image whitelist? More... | |
setExpensiveParserFunctionLimit ( $x) | |
Maximum number of calls per parse to expensive parser functions. More... | |
setExternalLinkTarget ( $x) | |
Target attribute for external links. More... | |
setInterfaceMessage ( $x) | |
Parsing an interface message? More... | |
setInterwikiMagic ( $x) | |
Specify whether to extract interlanguage links. More... | |
setIsPreview ( $x) | |
Parsing the page for a "preview" operation? More... | |
setIsPrintable ( $x) | |
Parsing the printable version of the page? More... | |
setIsSectionPreview ( $x) | |
Parsing the page for a "preview" operation on a single section? More... | |
setMaxIncludeSize ( $x) | |
Maximum size of template expansions, in bytes. More... | |
setMaxPPNodeCount ( $x) | |
Maximum number of nodes touched by PPFrame::expand() More... | |
setMaxTemplateDepth ( $x) | |
Maximum recursion depth for templates within templates. More... | |
setNumberHeadings ( $x) | |
Automatically number headings? More... | |
setOption ( $name, $value) | |
Set an option, generically. More... | |
setPreSaveTransform ( $x) | |
Transform wiki markup when saving the page? More... | |
setRedirectTarget ( $title) | |
Note that setting or changing this does not make the page a redirect or change its target, it merely records the information for reference during the parse. More... | |
setRemoveComments ( $x) | |
Remove HTML comments. More... | |
setSpeculativePageIdCallback ( $x) | |
Callback to generate a guess for {{PAGEID}}. More... | |
setSpeculativeRevIdCallback ( $x) | |
Callback to generate a guess for {{REVISIONID}}. More... | |
setStubThreshold ( $x) | |
Thumb size preferred by the user. More... | |
setTargetLanguage ( $x) | |
Target language for the parse. More... | |
setTemplateCallback ( $x) | |
Callback for template fetching; first argument to call_user_func(). More... | |
setThumbSize ( $x) | |
Thumb size preferred by the user. More... | |
setTidy ( $x) | |
Use tidy to cleanup output HTML? More... | |
setTimestamp ( $x) | |
Timestamp used for {{CURRENTDAY}} etc. More... | |
setupFakeRevision ( $title, $content, $user) | |
Sets a hook to force that a page exists, and sets a current revision callback to return a revision with custom content when the current revision of the page is requested. More... | |
setUserLang ( $x) | |
Set the user language used by the parser for this page and split the parser cache. More... | |
setWrapOutputClass ( $className) | |
CSS class to use to wrap output from Parser::parse() More... | |
Static Public Member Functions | |
static | allCacheVaryingOptions () |
Return all option keys that vary the options hash. More... | |
static | clearStaticCache () |
Reset static caches. More... | |
static | getLazyOptions () |
Get lazy-loaded options. More... | |
static | newCanonical ( $context=null, $userLang=null) |
Creates a "canonical" ParserOptions object. More... | |
static | newFromAnon () |
Get a ParserOptions object for an anonymous user. More... | |
static | newFromContext (IContextSource $context) |
Get a ParserOptions object from a IContextSource object. More... | |
static | newFromUser ( $user) |
Get a ParserOptions object from a given user. More... | |
static | newFromUserAndLang (User $user, Language $lang) |
Get a ParserOptions object from a given user and language. More... | |
Protected Member Functions | |
setOptionLegacy ( $name, $value) | |
Legacy implementation. More... | |
Private Member Functions | |
initialiseFromUser ( $user, $lang) | |
Get user options. More... | |
lazyLoadOption ( $name) | |
optionToString ( $value) | |
Convert an option to a string value. More... | |
Static Private Member Functions | |
static | getCacheVaryingOptionsHash () |
Get cache varying options, with the name of the option in the key, and a boolean in the value which indicates whether the cache is indeed varied. More... | |
static | getCanonicalOverrides () |
Get "canonical" non-default option values. More... | |
static | getDefaults () |
Get default option values. More... | |
static | initDateFormat (ParserOptions $popt) |
Lazy initializer for dateFormat. More... | |
static | initSpeculativePageId (ParserOptions $popt) |
Callback registered with ParserOptions::$lazyOptions, triggered by getSpeculativePageId(). More... | |
static | initSpeculativeRevId (ParserOptions $popt) |
Callback registered with ParserOptions::$lazyOptions, triggered by getSpeculativeRevId(). More... | |
Private Attributes | |
$mExtraKey = '' | |
Appended to the options hash. More... | |
string null | $mTimestamp |
Timestamp used for {{CURRENTDAY}} etc. More... | |
User | $mUser |
Stored user object. More... | |
callable null | $onAccessCallback = null |
Function to be called when an option is accessed. More... | |
array | $options |
Current values for all options that are relevant for caching. More... | |
Title null | $redirectTarget = null |
If the page being parsed is a redirect, this should hold the redirect target. More... | |
Static Private Attributes | |
static array null | $cacheVaryingOptionsHash = null |
Specify options that are included in the cache key. More... | |
static array | $callbacks |
Specify pseudo-options that are actually callbacks. More... | |
static array null | $defaults = null |
Default values for all options that are relevant for caching. More... | |
static array | $initialCacheVaryingOptionsHash |
Initial inCacheKey options (before hook) More... | |
static callable[] | $initialLazyOptions |
Initial lazy-loaded options (before hook) More... | |
static callable[] null | $lazyOptions = null |
Lazy-loaded options. More... | |
Set options of the Parser.
How to add an option in core:
How to add an option in an extension:
Definition at line 44 of file ParserOptions.php.
ParserOptions::__construct | ( | $user = null , |
|
$lang = null |
|||
) |
User | null | $user | (null falls back to $wgUser and is deprecated since 1.36) |
Language | null | $lang |
Definition at line 1092 of file ParserOptions.php.
References $lang, $wgLang, initialiseFromUser(), StubObject\unstub(), and wfDeprecated().
ParserOptions::addExtraKey | ( | $key | ) |
Extra key that should be present in the parser cache key.
string | $key |
Definition at line 1074 of file ParserOptions.php.
|
static |
Return all option keys that vary the options hash.
Definition at line 1431 of file ParserOptions.php.
Referenced by WikitextContent\fillParserOutput(), ParserCache\getKey(), Parser\RevisionOutputCache\makeParserOutputKey(), ParserCache\makeParserOutputKey(), and optionsHash().
|
static |
ParserOptions::disableContentConversion | ( | $x = true | ) |
Whether content conversion should be disabled.
bool | null | $x | New value (null is no change) |
Definition at line 560 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::disableTitleConversion | ( | $x = true | ) |
Whether title conversion should be disabled.
bool | null | $x | New value (null is no change) |
Definition at line 577 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::enableLimitReport | ( | $x = true | ) |
Enable limit report in an HTML comment on output.
bool | null | $x | New value (null is no change) |
Definition at line 507 of file ParserOptions.php.
References setOptionLegacy().
Referenced by ApiParse\tweakParserOptions().
ParserOptions::getAllowExternalImages | ( | ) |
Allow all external images inline?
Definition at line 255 of file ParserOptions.php.
References getOption().
ParserOptions::getAllowExternalImagesFrom | ( | ) |
External images to allow.
When self::getAllowExternalImages() is false
Definition at line 278 of file ParserOptions.php.
References getOption().
ParserOptions::getAllowSpecialInclusion | ( | ) |
Allow inclusion of special pages?
Definition at line 338 of file ParserOptions.php.
References getOption().
ParserOptions::getAllowUnsafeRawHtml | ( | ) |
If the wiki is configured to allow raw html ($wgRawHtml = true) is it allowed in the specific case of parsing this page.
This is meant to disable unsafe parser tags in cases where a malicious user may control the input to the parser.
Definition at line 800 of file ParserOptions.php.
References getOption().
|
staticprivate |
Get cache varying options, with the name of the option in the key, and a boolean in the value which indicates whether the cache is indeed varied.
Definition at line 189 of file ParserOptions.php.
References $cacheVaryingOptionsHash, and getDefaults().
Referenced by isSafeToCache().
|
staticprivate |
Get "canonical" non-default option values.
Definition at line 1309 of file ParserOptions.php.
References $wgEnableParserLimitReporting.
Referenced by isSafeToCache(), and optionsHash().
ParserOptions::getCleanSignatures | ( | ) |
Clean up signature texts?
Definition at line 516 of file ParserOptions.php.
References getOption().
ParserOptions::getCurrentRevisionCallback | ( | ) |
Callback for current revision fetching; first argument to call_user_func().
Definition at line 848 of file ParserOptions.php.
References $title, getOption(), and wfDeprecated().
ParserOptions::getCurrentRevisionRecordCallback | ( | ) |
Callback for current revision fetching; first argument to call_user_func().
Definition at line 886 of file ParserOptions.php.
References $title, and getOption().
ParserOptions::getDateFormat | ( | ) |
Date format index.
Definition at line 687 of file ParserOptions.php.
References getOption().
|
staticprivate |
Get default option values.
Definition at line 1228 of file ParserOptions.php.
References $initialCacheVaryingOptionsHash, $initialLazyOptions, $wgAllowExternalImages, $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgCleanSignatures, $wgEnableImageWhitelist, $wgEnableMagicLinks, $wgExpensiveParserFunctionLimit, $wgExternalLinkTarget, $wgInterwikiMagic, $wgMaxArticleSize, $wgMaxPPExpandDepth, $wgMaxPPNodeCount, $wgMaxTemplateDepth, and Hooks\runner().
Referenced by getCacheVaryingOptionsHash(), initialiseFromUser(), isSafeToCache(), and optionsHash().
ParserOptions::getDisableContentConversion | ( | ) |
Whether content conversion should be disabled.
Definition at line 551 of file ParserOptions.php.
References getOption().
ParserOptions::getDisableTitleConversion | ( | ) |
Whether title conversion should be disabled.
Definition at line 568 of file ParserOptions.php.
References getOption().
Referenced by Parser\parse().
ParserOptions::getEnableImageWhitelist | ( | ) |
Use the on-wiki external image whitelist?
Definition at line 301 of file ParserOptions.php.
References getOption().
ParserOptions::getEnableLimitReport | ( | ) |
Enable limit report in an HTML comment on output.
Definition at line 498 of file ParserOptions.php.
References getOption().
ParserOptions::getExpensiveParserFunctionLimit | ( | ) |
Maximum number of calls per parse to expensive parser functions.
Definition at line 461 of file ParserOptions.php.
References getOption().
ParserOptions::getExternalLinkTarget | ( | ) |
Target attribute for external links.
Definition at line 534 of file ParserOptions.php.
References getOption().
ParserOptions::getInterfaceMessage | ( | ) |
Parsing an interface message?
Definition at line 367 of file ParserOptions.php.
References getOption().
ParserOptions::getInterwikiMagic | ( | ) |
Whether to extract interlanguage links.
When true, interlanguage links will be returned by ParserOutput::getLanguageLinks() instead of generating link HTML.
Definition at line 238 of file ParserOptions.php.
References getOption().
ParserOptions::getIsPreview | ( | ) |
Parsing the page for a "preview" operation?
Definition at line 619 of file ParserOptions.php.
References getOption().
ParserOptions::getIsPrintable | ( | ) |
Parsing the printable version of the page?
Definition at line 653 of file ParserOptions.php.
References getOption().
ParserOptions::getIsSectionPreview | ( | ) |
Parsing the page for a "preview" operation on a single section?
Definition at line 636 of file ParserOptions.php.
References getOption().
|
static |
Get lazy-loaded options.
This array should be initialised by the constructor. The return type hint is used as an assertion to ensure this has happened and to coerce the type for static analysis.
Definition at line 177 of file ParserOptions.php.
References $lazyOptions.
Referenced by lazyLoadOption().
ParserOptions::getMagicISBNLinks | ( | ) |
Are magic ISBN links enabled?
Definition at line 764 of file ParserOptions.php.
References getOption().
ParserOptions::getMagicPMIDLinks | ( | ) |
Are magic PMID links enabled?
Definition at line 773 of file ParserOptions.php.
References getOption().
ParserOptions::getMagicRFCLinks | ( | ) |
Are magic RFC links enabled?
Definition at line 782 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxIncludeSize | ( | ) |
Maximum size of template expansions, in bytes.
Definition at line 401 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxPPExpandDepth | ( | ) |
Maximum recursion depth in PPFrame::expand()
Definition at line 435 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxPPNodeCount | ( | ) |
Maximum number of nodes touched by PPFrame::expand()
Definition at line 418 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxTemplateDepth | ( | ) |
Maximum recursion depth for templates within templates.
Definition at line 443 of file ParserOptions.php.
References getOption().
ParserOptions::getNumberHeadings | ( | ) |
Automatically number headings?
Definition at line 321 of file ParserOptions.php.
References getOption().
ParserOptions::getOption | ( | $name | ) |
Fetch an option and track that is was accessed.
string | $name | Option name |
Definition at line 146 of file ParserOptions.php.
References lazyLoadOption(), and optionUsed().
Referenced by getAllowExternalImages(), getAllowExternalImagesFrom(), getAllowSpecialInclusion(), getAllowUnsafeRawHtml(), getCleanSignatures(), getCurrentRevisionCallback(), getCurrentRevisionRecordCallback(), getDateFormat(), getDisableContentConversion(), getDisableTitleConversion(), getEnableImageWhitelist(), getEnableLimitReport(), getExpensiveParserFunctionLimit(), getExternalLinkTarget(), getInterfaceMessage(), getInterwikiMagic(), getIsPreview(), getIsPrintable(), getIsSectionPreview(), getMagicISBNLinks(), getMagicPMIDLinks(), getMagicRFCLinks(), getMaxIncludeSize(), getMaxPPExpandDepth(), getMaxPPNodeCount(), getMaxTemplateDepth(), getNumberHeadings(), getPreSaveTransform(), getRemoveComments(), getSpeculativePageId(), getSpeculativeRevId(), getStubThreshold(), getTargetLanguage(), getTemplateCallback(), getThumbSize(), getUserLangObj(), getWrapOutputClass(), initSpeculativePageId(), and initSpeculativeRevId().
ParserOptions::getPreSaveTransform | ( | ) |
Transform wiki markup when saving the page?
Definition at line 670 of file ParserOptions.php.
References getOption().
Referenced by Parser\preSaveTransform().
ParserOptions::getRedirectTarget | ( | ) |
Get the previously-set redirect target.
Definition at line 1064 of file ParserOptions.php.
References $redirectTarget.
ParserOptions::getRemoveComments | ( | ) |
Remove HTML comments.
Definition at line 480 of file ParserOptions.php.
References getOption().
ParserOptions::getSpeculativePageId | ( | ) |
A guess for {{PAGEID}}, calculated using the callback provided via setSpeculativeRevPageCallback().
For consistency, the value will be calculated upon the first call of this method, and re-used for subsequent calls.
If no callback was defined via setSpeculativePageIdCallback(), this method will return false.
Definition at line 972 of file ParserOptions.php.
References getOption().
ParserOptions::getSpeculativeRevId | ( | ) |
A guess for {{REVISIONID}}, calculated using the callback provided via setSpeculativeRevIdCallback().
For consistency, the value will be calculated upon the first call of this method, and re-used for subsequent calls.
If no callback was defined via setSpeculativeRevIdCallback(), this method will return false.
Definition at line 958 of file ParserOptions.php.
References getOption().
ParserOptions::getStubThreshold | ( | ) |
Thumb size preferred by the user.
Definition at line 602 of file ParserOptions.php.
References getOption().
ParserOptions::getTargetLanguage | ( | ) |
Target language for the parse.
Definition at line 384 of file ParserOptions.php.
References getOption().
ParserOptions::getTemplateCallback | ( | ) |
Callback for template fetching; first argument to call_user_func().
Definition at line 935 of file ParserOptions.php.
References getOption().
ParserOptions::getThumbSize | ( | ) |
Thumb size preferred by the user.
Definition at line 585 of file ParserOptions.php.
References getOption().
ParserOptions::getTimestamp | ( | ) |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 1030 of file ParserOptions.php.
References $mTimestamp, and wfTimestampNow().
ParserOptions::getUser | ( | ) |
Current user.
Definition at line 1082 of file ParserOptions.php.
References $mUser.
Referenced by Parser\fuzzTestPst(), and optionsHash().
ParserOptions::getUserLang | ( | ) |
Same as getUserLangObj() but returns a string instead.
Definition at line 742 of file ParserOptions.php.
References getUserLangObj().
ParserOptions::getUserLangObj | ( | ) |
Get the user language used by the parser for this page and split the parser cache.
Definition at line 726 of file ParserOptions.php.
References getOption().
Referenced by getUserLang().
ParserOptions::getWrapOutputClass | ( | ) |
Class to use to wrap output from Parser::parse()
Definition at line 821 of file ParserOptions.php.
References getOption().
|
staticprivate |
Lazy initializer for dateFormat.
ParserOptions | $popt |
Definition at line 696 of file ParserOptions.php.
|
private |
Get user options.
Definition at line 1323 of file ParserOptions.php.
References $lang, and getDefaults().
Referenced by __construct().
|
staticprivate |
Callback registered with ParserOptions::$lazyOptions, triggered by getSpeculativePageId().
ParserOptions | $popt |
Definition at line 996 of file ParserOptions.php.
References getOption().
|
staticprivate |
Callback registered with ParserOptions::$lazyOptions, triggered by getSpeculativeRevId().
ParserOptions | $popt |
Definition at line 982 of file ParserOptions.php.
References getOption().
ParserOptions::isSafeToCache | ( | array | $usedOptions = null | ) |
Test whether these options are safe to cache.
string[] | null | $usedOptions | the list of options actually used in the parse. Defaults to all options. |
Definition at line 1528 of file ParserOptions.php.
References $defaults, getCacheVaryingOptionsHash(), getCanonicalOverrides(), getDefaults(), and optionToString().
Referenced by Parser\RevisionOutputCache\save().
|
private |
string | $name | Lazy load option without tracking usage |
Definition at line 159 of file ParserOptions.php.
References $lazyOptions, and getLazyOptions().
Referenced by getOption(), matches(), matchesForCacheKey(), and optionsHash().
ParserOptions::matches | ( | ParserOptions | $other | ) |
Check if these options match that of another options set.
This ignores report limit settings that only affect HTML comments
ParserOptions | $other |
Definition at line 1342 of file ParserOptions.php.
References $options, lazyLoadOption(), and optionToString().
ParserOptions::matchesForCacheKey | ( | ParserOptions | $other | ) |
ParserOptions | $other |
Definition at line 1387 of file ParserOptions.php.
References lazyLoadOption(), and optionToString().
|
static |
Creates a "canonical" ParserOptions object.
For historical reasons, certain options have default values that are different from the canonical values used for caching.
IContextSource | string | User | null | $context |
|
Language | StubObject | null | $userLang | (see above) |
Definition at line 1178 of file ParserOptions.php.
References newFromAnon(), newFromContext(), and wfDeprecated().
Referenced by ApiParse\execute(), MediaWiki\Rest\Handler\ParsoidHTMLHelper\getHtml(), AbstractContent\getParserOutput(), Revision\RevisionRenderer\getRenderedRevision(), WikiPage\makeParserOptions(), and CLIParser\parse().
|
static |
Get a ParserOptions object for an anonymous user.
Definition at line 1117 of file ParserOptions.php.
Referenced by FormatInstallDoc\execute(), MessageCache\getParserOptions(), newCanonical(), and OutputPage\parserOptions().
|
static |
Get a ParserOptions object from a IContextSource object.
IContextSource | $context |
Definition at line 1156 of file ParserOptions.php.
References IContextSource\getLanguage(), and IContextSource\getUser().
Referenced by SpecialExpandTemplates\execute(), ApiExpandTemplates\execute(), ApiQueryRevisionsBase\extractDeprecatedContent(), SpecialExpandTemplates\generateHtml(), ApiComparePages\getDiffRevision(), RawAction\getRawText(), newCanonical(), OutputPage\parserOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().
|
static |
Get a ParserOptions object from a given user.
Language will be taken from $wgLang.
User | $user |
Definition at line 1131 of file ParserOptions.php.
Referenced by CompareParsers\checkOptions(), Parser\cleanSig(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), PPFuzzTest\execute(), Parser\extractSections(), Parser\getFlatSectionInfo(), ParserCache\getKey(), EditPage\getPreloadedContent(), and DumpRenderer\handleRevision().
Get a ParserOptions object from a given user and language.
Definition at line 1144 of file ParserOptions.php.
References $lang.
Referenced by EditPage\getContentObject(), LocalFile\getDescriptionText(), EditPage\isUndoClean(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), and EditPage\showDiff().
ParserOptions::optionsHash | ( | $forOptions, | |
$title = null |
|||
) |
Generate a hash string with the values set on these ParserOptions for the keys given in the array.
This will be used as part of the hash key for the parser cache, so users sharing the options with vary for the same page share the same cached data safely.
string[] | $forOptions | |
Title | null | $title | Used to get the content language of the page (since r97636) |
Definition at line 1468 of file ParserOptions.php.
References $defaults, $lang, $mExtraKey, $options, $title, $wgRenderHashAppend, allCacheVaryingOptions(), getCanonicalOverrides(), getDefaults(), getUser(), lazyLoadOption(), optionToString(), and Hooks\runner().
Referenced by WikitextContent\fillParserOutput(), Parser\RevisionOutputCache\makeParserOutputKey(), and ParserCache\makeParserOutputKey().
|
private |
Convert an option to a string value.
mixed | $value |
Definition at line 1440 of file ParserOptions.php.
Referenced by isSafeToCache(), matches(), matchesForCacheKey(), and optionsHash().
ParserOptions::optionUsed | ( | $optionName | ) |
Called when an option is accessed.
Calls the watcher that was set using registerWatcher(). Typically, the watcher callback is ParserOutput::registerOption(). The information registered that way will be used by ParserCache::save().
string | $optionName | Name of the option |
Definition at line 1420 of file ParserOptions.php.
Referenced by getOption().
ParserOptions::registerWatcher | ( | $callback | ) |
Registers a callback for tracking which ParserOptions which are used.
This is a private API with the parser.
callable | null | $callback |
Definition at line 1408 of file ParserOptions.php.
ParserOptions::setAllowExternalImages | ( | $x | ) |
Allow all external images inline?
bool | null | $x | New value (null is no change) |
Definition at line 266 of file ParserOptions.php.
References setOptionLegacy(), and wfDeprecated().
ParserOptions::setAllowExternalImagesFrom | ( | $x | ) |
External images to allow.
When self::getAllowExternalImages() is false
string | string[] | null | $x | New value (null is no change) |
Definition at line 292 of file ParserOptions.php.
References setOptionLegacy(), and wfDeprecated().
ParserOptions::setAllowSpecialInclusion | ( | $x | ) |
Allow inclusion of special pages?
bool | null | $x | New value (null is no change) |
Definition at line 347 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setAllowUnsafeRawHtml | ( | $x | ) |
If the wiki is configured to allow raw html ($wgRawHtml = true) is it allowed in the specific case of parsing this page.
bool | null | $x | Value to set or null to get current value |
Definition at line 812 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setCleanSignatures | ( | $x | ) |
Clean up signature texts?
bool | null | $x | New value (null is no change) |
Definition at line 526 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setCurrentRevisionCallback | ( | $x | ) |
Callback for current revision fetching; first argument to call_user_func().
callable | null | $x | New value (null is no change) |
Definition at line 915 of file ParserOptions.php.
References setOptionLegacy(), and wfDeprecated().
ParserOptions::setCurrentRevisionRecordCallback | ( | $x | ) |
Callback for current revision fetching; first argument to call_user_func().
callable | null | $x | New value |
Definition at line 927 of file ParserOptions.php.
References setOption().
Referenced by setupFakeRevision().
ParserOptions::setDateFormat | ( | $x | ) |
Date format index.
string | null | $x | New value (null is no change) |
Definition at line 705 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setEnableImageWhitelist | ( | $x | ) |
Use the on-wiki external image whitelist?
bool | null | $x | New value (null is no change) |
Definition at line 312 of file ParserOptions.php.
References setOptionLegacy(), and wfDeprecated().
ParserOptions::setExpensiveParserFunctionLimit | ( | $x | ) |
Maximum number of calls per parse to expensive parser functions.
int | null | $x | New value (null is no change) |
Definition at line 471 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setExternalLinkTarget | ( | $x | ) |
Target attribute for external links.
string | null | $x | New value (null is no change) |
Definition at line 543 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setInterfaceMessage | ( | $x | ) |
Parsing an interface message?
bool | null | $x | New value (null is no change) |
Definition at line 376 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setInterwikiMagic | ( | $x | ) |
Specify whether to extract interlanguage links.
bool | null | $x | New value (null is no change) |
Definition at line 247 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setIsPreview | ( | $x | ) |
Parsing the page for a "preview" operation?
bool | null | $x | New value (null is no change) |
Definition at line 628 of file ParserOptions.php.
References setOptionLegacy().
Referenced by ApiParse\tweakParserOptions().
ParserOptions::setIsPrintable | ( | $x | ) |
Parsing the printable version of the page?
bool | null | $x | New value (null is no change) |
Definition at line 662 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setIsSectionPreview | ( | $x | ) |
Parsing the page for a "preview" operation on a single section?
bool | null | $x | New value (null is no change) |
Definition at line 645 of file ParserOptions.php.
References setOptionLegacy().
Referenced by ApiParse\tweakParserOptions().
ParserOptions::setMaxIncludeSize | ( | $x | ) |
Maximum size of template expansions, in bytes.
int | null | $x | New value (null is no change) |
Definition at line 410 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setMaxPPNodeCount | ( | $x | ) |
Maximum number of nodes touched by PPFrame::expand()
int | null | $x | New value (null is no change) |
Definition at line 427 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setMaxTemplateDepth | ( | $x | ) |
Maximum recursion depth for templates within templates.
int | null | $x | New value (null is no change) |
Definition at line 452 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setNumberHeadings | ( | $x | ) |
Automatically number headings?
bool | null | $x | New value (null is no change) |
Definition at line 330 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setOption | ( | $name, | |
$value | |||
) |
Set an option, generically.
string | $name | Option name |
mixed | $value | New value. Passing null will set null, unlike many of the existing accessors which ignore null for historical reasons. |
Definition at line 206 of file ParserOptions.php.
Referenced by setCurrentRevisionRecordCallback(), setSpeculativePageIdCallback(), setSpeculativeRevIdCallback(), setTargetLanguage(), and setWrapOutputClass().
|
protected |
Legacy implementation.
string | $name | Option name |
mixed | $value | New value. Passing null does not set the value. |
Definition at line 223 of file ParserOptions.php.
References wfSetVar().
Referenced by disableContentConversion(), disableTitleConversion(), enableLimitReport(), setAllowExternalImages(), setAllowExternalImagesFrom(), setAllowSpecialInclusion(), setAllowUnsafeRawHtml(), setCleanSignatures(), setCurrentRevisionCallback(), setDateFormat(), setEnableImageWhitelist(), setExpensiveParserFunctionLimit(), setExternalLinkTarget(), setInterfaceMessage(), setInterwikiMagic(), setIsPreview(), setIsPrintable(), setIsSectionPreview(), setMaxIncludeSize(), setMaxPPNodeCount(), setMaxTemplateDepth(), setNumberHeadings(), setPreSaveTransform(), setRemoveComments(), setStubThreshold(), setTemplateCallback(), setThumbSize(), and setUserLang().
ParserOptions::setPreSaveTransform | ( | $x | ) |
Transform wiki markup when saving the page?
bool | null | $x | New value (null is no change) |
Definition at line 679 of file ParserOptions.php.
References setOptionLegacy().
Referenced by CssContent\preSaveTransform(), and JavaScriptContent\preSaveTransform().
ParserOptions::setRedirectTarget | ( | $title | ) |
Note that setting or changing this does not make the page a redirect or change its target, it merely records the information for reference during the parse.
Title | null | $title |
Definition at line 1054 of file ParserOptions.php.
References $title.
ParserOptions::setRemoveComments | ( | $x | ) |
Remove HTML comments.
bool | null | $x | New value (null is no change) |
Definition at line 490 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setSpeculativePageIdCallback | ( | $x | ) |
Callback to generate a guess for {{PAGEID}}.
callable | null | $x | New value |
Definition at line 1021 of file ParserOptions.php.
References setOption().
ParserOptions::setSpeculativeRevIdCallback | ( | $x | ) |
Callback to generate a guess for {{REVISIONID}}.
callable | null | $x | New value |
Definition at line 1010 of file ParserOptions.php.
References setOption().
ParserOptions::setStubThreshold | ( | $x | ) |
Thumb size preferred by the user.
int | null | $x | New value (null is no change) |
Definition at line 611 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setTargetLanguage | ( | $x | ) |
Target language for the parse.
Language | null | $x | New value |
Definition at line 393 of file ParserOptions.php.
References setOption().
ParserOptions::setTemplateCallback | ( | $x | ) |
Callback for template fetching; first argument to call_user_func().
callable | null | $x | New value (null is no change) |
Definition at line 944 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setThumbSize | ( | $x | ) |
Thumb size preferred by the user.
int | null | $x | New value (null is no change) |
Definition at line 594 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setTidy | ( | $x | ) |
Use tidy to cleanup output HTML?
bool | null | $x | New value (null is no change) |
Definition at line 357 of file ParserOptions.php.
References wfDeprecated().
ParserOptions::setTimestamp | ( | $x | ) |
Timestamp used for {{CURRENTDAY}} etc.
string | null | $x | New value (null is no change) |
Definition at line 1042 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setupFakeRevision | ( | $title, | |
$content, | |||
$user | |||
) |
Sets a hook to force that a page exists, and sets a current revision callback to return a revision with custom content when the current revision of the page is requested.
Definition at line 1554 of file ParserOptions.php.
References $content, $title, $wgHooks, and setCurrentRevisionRecordCallback().
ParserOptions::setUserLang | ( | $x | ) |
Set the user language used by the parser for this page and split the parser cache.
string | Language | $x | New value |
Definition at line 751 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setWrapOutputClass | ( | $className | ) |
CSS class to use to wrap output from Parser::parse()
string | $className | Class name to use for wrapping. Passing false to indicate "no wrapping" was deprecated in MediaWiki 1.31. |
Definition at line 832 of file ParserOptions.php.
References setOption(), and wfDeprecated().
Referenced by ApiParse\tweakParserOptions().
|
staticprivate |
Specify options that are included in the cache key.
Definition at line 73 of file ParserOptions.php.
Referenced by getCacheVaryingOptionsHash().
|
staticprivate |
Specify pseudo-options that are actually callbacks.
These must be ignored when checking for cacheability.
Definition at line 92 of file ParserOptions.php.
|
staticprivate |
Default values for all options that are relevant for caching.
Definition at line 51 of file ParserOptions.php.
Referenced by isSafeToCache(), and optionsHash().
|
staticprivate |
Initial inCacheKey options (before hook)
Definition at line 79 of file ParserOptions.php.
Referenced by getDefaults().
|
staticprivate |
Initial lazy-loaded options (before hook)
Definition at line 63 of file ParserOptions.php.
Referenced by getDefaults().
|
staticprivate |
Lazy-loaded options.
Definition at line 57 of file ParserOptions.php.
Referenced by getLazyOptions(), and lazyLoadOption().
|
private |
Appended to the options hash.
Definition at line 138 of file ParserOptions.php.
Referenced by optionsHash().
|
private |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 111 of file ParserOptions.php.
Referenced by getTimestamp().
|
private |
Stored user object.
Definition at line 118 of file ParserOptions.php.
Referenced by getUser().
|
private |
Function to be called when an option is accessed.
Definition at line 125 of file ParserOptions.php.
|
private |
Current values for all options that are relevant for caching.
Definition at line 104 of file ParserOptions.php.
Referenced by matches(), and optionsHash().
|
private |
If the page being parsed is a redirect, this should hold the redirect target.
Definition at line 133 of file ParserOptions.php.
Referenced by getRedirectTarget().