MediaWiki
1.30.0
|
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... | |
getEditSection () | |
Create "edit section" links? More... | |
getRedirectTarget () | |
Get the previously-set redirect target. More... | |
getTimestamp () | |
Timestamp used for {{CURRENTDAY}} etc. More... | |
getUser () | |
Current user. More... | |
isSafeToCache () | |
Test whether these options are safe to cache. More... | |
matches (ParserOptions $other) | |
Check if these options match that of another options set. More... | |
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... | |
setEditSection ( $x) | |
Create "edit section" links? More... | |
setRedirectTarget ( $title) | |
Set the redirect target. 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... | |
Static Public Member Functions | |
static | allCacheVaryingOptions () |
Return all option keys that vary the options hash. More... | |
static | legacyOptions () |
Returns the full array of options that would have been used by in 1.16. More... | |
static | newCanonical (User $user=null, $lang=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... | |
Private Member Functions | |
initialiseFromUser ( $user, $lang) | |
Get user options. More... | |
optionToString ( $value) | |
Convert an option to a string value. More... | |
Static Private Member Functions | |
static | getCanonicalOverrides () |
Get "canonical" non-default option values. More... | |
static | getDefaults () |
Get default option values. More... | |
Private Attributes | |
bool | $mEditSection = true |
The edit section flag is in ParserOptions for historical reasons, but doesn't actually affect the parser output since Feb 2015. More... | |
$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 | $defaults = null |
Default values for all options that are relevant for caching. More... | |
static array | $inCacheKey |
Specify options that are included in the cache key. More... | |
static callback[] | $lazyOptions |
Lazy-loaded options. More... | |
Option accessors | |
getOption ( $name) | |
Fetch an option, generically. More... | |
setOption ( $name, $value) | |
Set an option, generically. More... | |
getInterwikiMagic () | |
Whether to extract interlanguage links. More... | |
setInterwikiMagic ( $x) | |
Specify whether to extract interlanguage links. More... | |
getAllowExternalImages () | |
Allow all external images inline? More... | |
setAllowExternalImages ( $x) | |
Allow all external images inline? More... | |
getAllowExternalImagesFrom () | |
External images to allow. More... | |
setAllowExternalImagesFrom ( $x) | |
External images to allow. More... | |
getEnableImageWhitelist () | |
Use the on-wiki external image whitelist? More... | |
setEnableImageWhitelist ( $x) | |
Use the on-wiki external image whitelist? More... | |
getNumberHeadings () | |
Automatically number headings? More... | |
setNumberHeadings ( $x) | |
Automatically number headings? More... | |
getAllowSpecialInclusion () | |
Allow inclusion of special pages? More... | |
setAllowSpecialInclusion ( $x) | |
Allow inclusion of special pages? More... | |
getTidy () | |
Use tidy to cleanup output HTML? More... | |
setTidy ( $x) | |
Use tidy to cleanup output HTML? More... | |
getInterfaceMessage () | |
Parsing an interface message? More... | |
setInterfaceMessage ( $x) | |
Parsing an interface message? More... | |
getTargetLanguage () | |
Target language for the parse. More... | |
setTargetLanguage ( $x) | |
Target language for the parse. More... | |
getMaxIncludeSize () | |
Maximum size of template expansions, in bytes. More... | |
setMaxIncludeSize ( $x) | |
Maximum size of template expansions, in bytes. More... | |
getMaxPPNodeCount () | |
Maximum number of nodes touched by PPFrame::expand() More... | |
setMaxPPNodeCount ( $x) | |
Maximum number of nodes touched by PPFrame::expand() More... | |
getMaxGeneratedPPNodeCount () | |
Maximum number of nodes generated by Preprocessor::preprocessToObj() More... | |
setMaxGeneratedPPNodeCount ( $x) | |
Maximum number of nodes generated by Preprocessor::preprocessToObj() More... | |
getMaxPPExpandDepth () | |
Maximum recursion depth in PPFrame::expand() More... | |
getMaxTemplateDepth () | |
Maximum recursion depth for templates within templates. More... | |
setMaxTemplateDepth ( $x) | |
Maximum recursion depth for templates within templates. More... | |
getExpensiveParserFunctionLimit () | |
Maximum number of calls per parse to expensive parser functions. More... | |
setExpensiveParserFunctionLimit ( $x) | |
Maximum number of calls per parse to expensive parser functions. More... | |
getRemoveComments () | |
Remove HTML comments. More... | |
setRemoveComments ( $x) | |
Remove HTML comments. More... | |
getEnableLimitReport () | |
Enable limit report in an HTML comment on output. More... | |
enableLimitReport ( $x=true) | |
Enable limit report in an HTML comment on output. More... | |
getCleanSignatures () | |
Clean up signature texts? More... | |
setCleanSignatures ( $x) | |
Clean up signature texts? More... | |
getExternalLinkTarget () | |
Target attribute for external links. More... | |
setExternalLinkTarget ( $x) | |
Target attribute for external links. More... | |
getDisableContentConversion () | |
Whether content conversion should be disabled. More... | |
disableContentConversion ( $x=true) | |
Whether content conversion should be disabled. More... | |
getDisableTitleConversion () | |
Whether title conversion should be disabled. More... | |
disableTitleConversion ( $x=true) | |
Whether title conversion should be disabled. More... | |
getThumbSize () | |
Thumb size preferred by the user. More... | |
setThumbSize ( $x) | |
Thumb size preferred by the user. More... | |
getStubThreshold () | |
Thumb size preferred by the user. More... | |
setStubThreshold ( $x) | |
Thumb size preferred by the user. More... | |
getIsPreview () | |
Parsing the page for a "preview" operation? More... | |
setIsPreview ( $x) | |
Parsing the page for a "preview" operation? More... | |
getIsSectionPreview () | |
Parsing the page for a "preview" operation on a single section? More... | |
setIsSectionPreview ( $x) | |
Parsing the page for a "preview" operation on a single section? More... | |
getIsPrintable () | |
Parsing the printable version of the page? More... | |
setIsPrintable ( $x) | |
Parsing the printable version of the page? More... | |
getPreSaveTransform () | |
Transform wiki markup when saving the page? More... | |
setPreSaveTransform ( $x) | |
Transform wiki markup when saving the page? More... | |
getDateFormat () | |
Date format index. More... | |
setDateFormat ( $x) | |
Date format index. More... | |
getUserLangObj () | |
Get the user language used by the parser for this page and split the parser cache. More... | |
getUserLang () | |
Same as getUserLangObj() but returns a string instead. More... | |
setUserLang ( $x) | |
Set the user language used by the parser for this page and split the parser cache. More... | |
getMagicISBNLinks () | |
Are magic ISBN links enabled? More... | |
getMagicPMIDLinks () | |
Are magic PMID links enabled? More... | |
getMagicRFCLinks () | |
Are magic RFC links enabled? 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... | |
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... | |
getWrapOutputClass () | |
Class to use to wrap output from Parser::parse() More... | |
setWrapOutputClass ( $className) | |
CSS class to use to wrap output from Parser::parse() More... | |
getCurrentRevisionCallback () | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
setCurrentRevisionCallback ( $x) | |
Callback for current revision fetching; first argument to call_user_func(). More... | |
getTemplateCallback () | |
Callback for template fetching; first argument to call_user_func(). More... | |
setTemplateCallback ( $x) | |
Callback for template fetching; first argument to call_user_func(). More... | |
getSpeculativeRevIdCallback () | |
Callback to generate a guess for {{REVISIONID}}. More... | |
setSpeculativeRevIdCallback ( $x) | |
Callback to generate a guess for {{REVISIONID}}. More... | |
setOptionLegacy ( $name, $value) | |
Legacy implementation. More... | |
static | initDateFormat ( $popt) |
Lazy initializer for dateFormat. More... | |
Set options of the Parser.
How to add an option in core:
How to add an option in an extension:
Definition at line 40 of file ParserOptions.php.
ParserOptions::__construct | ( | $user = null , |
|
$lang = null |
|||
) |
Definition at line 936 of file ParserOptions.php.
References $lang, $user, $wgLang, $wgUser, global, initialiseFromUser(), StubObject\isRealObject(), and User.
ParserOptions::addExtraKey | ( | $key | ) |
Extra key that should be present in the parser cache key.
string | $key |
Definition at line 917 of file ParserOptions.php.
|
static |
Return all option keys that vary the options hash.
Definition at line 1235 of file ParserOptions.php.
References getDefaults().
Referenced by ParserCache\getETag(), ParserCache\getKey(), and ParserOptionsTest\testAllCacheVaryingOptions().
ParserOptions::disableContentConversion | ( | $x = true | ) |
Whether content conversion should be disabled.
bool | null | $x | New value (null is no change) |
Definition at line 518 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 535 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 465 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::getAllowExternalImages | ( | ) |
Allow all external images inline?
Definition at line 200 of file ParserOptions.php.
References getOption().
ParserOptions::getAllowExternalImagesFrom | ( | ) |
External images to allow.
When self::getAllowExternalImages() is false
Definition at line 220 of file ParserOptions.php.
References getOption().
ParserOptions::getAllowSpecialInclusion | ( | ) |
Allow inclusion of special pages?
Definition at line 274 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 755 of file ParserOptions.php.
References getOption().
|
staticprivate |
Get "canonical" non-default option values.
Definition at line 1112 of file ParserOptions.php.
References $wgEnableParserLimitReporting, and global.
Referenced by isSafeToCache(), and optionsHash().
ParserOptions::getCleanSignatures | ( | ) |
Clean up signature texts?
Definition at line 474 of file ParserOptions.php.
References getOption().
ParserOptions::getCurrentRevisionCallback | ( | ) |
Callback for current revision fetching; first argument to call_user_func().
Definition at line 798 of file ParserOptions.php.
References getOption().
ParserOptions::getDateFormat | ( | ) |
Date format index.
Definition at line 645 of file ParserOptions.php.
References getOption().
|
staticprivate |
Get default option values.
Definition at line 1037 of file ParserOptions.php.
References $wgAllowExternalImages, $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgCleanSignatures, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgEnableImageWhitelist, $wgEnableMagicLinks, $wgExpensiveParserFunctionLimit, $wgExternalLinkTarget, $wgInterwikiMagic, $wgMaxArticleSize, $wgMaxGeneratedPPNodeCount, $wgMaxPPExpandDepth, $wgMaxPPNodeCount, $wgMaxTemplateDepth, User\getDefaultOption(), global, and Hooks\run().
Referenced by allCacheVaryingOptions(), initialiseFromUser(), isSafeToCache(), and optionsHash().
ParserOptions::getDisableContentConversion | ( | ) |
Whether content conversion should be disabled.
Definition at line 509 of file ParserOptions.php.
References getOption().
ParserOptions::getDisableTitleConversion | ( | ) |
Whether title conversion should be disabled.
Definition at line 526 of file ParserOptions.php.
References getOption().
ParserOptions::getEditSection | ( | ) |
Create "edit section" links?
Definition at line 874 of file ParserOptions.php.
References $mEditSection.
ParserOptions::getEnableImageWhitelist | ( | ) |
Use the on-wiki external image whitelist?
Definition at line 240 of file ParserOptions.php.
References getOption().
ParserOptions::getEnableLimitReport | ( | ) |
Enable limit report in an HTML comment on output.
Definition at line 456 of file ParserOptions.php.
References getOption().
ParserOptions::getExpensiveParserFunctionLimit | ( | ) |
Maximum number of calls per parse to expensive parser functions.
Definition at line 419 of file ParserOptions.php.
References getOption().
ParserOptions::getExternalLinkTarget | ( | ) |
Target attribute for external links.
Definition at line 492 of file ParserOptions.php.
References getOption().
ParserOptions::getInterfaceMessage | ( | ) |
Parsing an interface message?
Definition at line 308 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 183 of file ParserOptions.php.
References getOption().
ParserOptions::getIsPreview | ( | ) |
Parsing the page for a "preview" operation?
Definition at line 577 of file ParserOptions.php.
References getOption().
ParserOptions::getIsPrintable | ( | ) |
Parsing the printable version of the page?
Definition at line 611 of file ParserOptions.php.
References getOption().
ParserOptions::getIsSectionPreview | ( | ) |
Parsing the page for a "preview" operation on a single section?
Definition at line 594 of file ParserOptions.php.
References getOption().
ParserOptions::getMagicISBNLinks | ( | ) |
Are magic ISBN links enabled?
Definition at line 720 of file ParserOptions.php.
References getOption().
ParserOptions::getMagicPMIDLinks | ( | ) |
Are magic PMID links enabled?
Definition at line 729 of file ParserOptions.php.
References getOption().
ParserOptions::getMagicRFCLinks | ( | ) |
Are magic RFC links enabled?
Definition at line 737 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxGeneratedPPNodeCount | ( | ) |
Maximum number of nodes generated by Preprocessor::preprocessToObj()
Definition at line 376 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxIncludeSize | ( | ) |
Maximum size of template expansions, in bytes.
Definition at line 342 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxPPExpandDepth | ( | ) |
Maximum recursion depth in PPFrame::expand()
Definition at line 393 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxPPNodeCount | ( | ) |
Maximum number of nodes touched by PPFrame::expand()
Definition at line 359 of file ParserOptions.php.
References getOption().
ParserOptions::getMaxTemplateDepth | ( | ) |
Maximum recursion depth for templates within templates.
Definition at line 401 of file ParserOptions.php.
References getOption().
ParserOptions::getNumberHeadings | ( | ) |
Automatically number headings?
Definition at line 257 of file ParserOptions.php.
References getOption().
ParserOptions::getOption | ( | $name | ) |
Fetch an option, generically.
string | $name | Option name |
Definition at line 129 of file ParserOptions.php.
References $name, options(), and optionUsed().
Referenced by getAllowExternalImages(), getAllowExternalImagesFrom(), getAllowSpecialInclusion(), getAllowUnsafeRawHtml(), getCleanSignatures(), getCurrentRevisionCallback(), getDateFormat(), getDisableContentConversion(), getDisableTitleConversion(), getEnableImageWhitelist(), getEnableLimitReport(), getExpensiveParserFunctionLimit(), getExternalLinkTarget(), getInterfaceMessage(), getInterwikiMagic(), getIsPreview(), getIsPrintable(), getIsSectionPreview(), getMagicISBNLinks(), getMagicPMIDLinks(), getMagicRFCLinks(), getMaxGeneratedPPNodeCount(), getMaxIncludeSize(), getMaxPPExpandDepth(), getMaxPPNodeCount(), getMaxTemplateDepth(), getNumberHeadings(), getPreSaveTransform(), getRemoveComments(), getSpeculativeRevIdCallback(), getStubThreshold(), getTargetLanguage(), getTemplateCallback(), getThumbSize(), getTidy(), getUserLangObj(), and getWrapOutputClass().
ParserOptions::getPreSaveTransform | ( | ) |
Transform wiki markup when saving the page?
Definition at line 628 of file ParserOptions.php.
References getOption().
ParserOptions::getRedirectTarget | ( | ) |
Get the previously-set redirect target.
Definition at line 907 of file ParserOptions.php.
References $redirectTarget.
ParserOptions::getRemoveComments | ( | ) |
Remove HTML comments.
Definition at line 438 of file ParserOptions.php.
References getOption().
ParserOptions::getSpeculativeRevIdCallback | ( | ) |
Callback to generate a guess for {{REVISIONID}}.
Definition at line 834 of file ParserOptions.php.
References getOption().
ParserOptions::getStubThreshold | ( | ) |
Thumb size preferred by the user.
Definition at line 560 of file ParserOptions.php.
References getOption().
Referenced by WikiPage\getParserOutput(), and WikiPage\shouldCheckParserCache().
ParserOptions::getTargetLanguage | ( | ) |
Target language for the parse.
Definition at line 325 of file ParserOptions.php.
References getOption().
ParserOptions::getTemplateCallback | ( | ) |
Callback for template fetching; first argument to call_user_func().
Definition at line 816 of file ParserOptions.php.
References getOption().
ParserOptions::getThumbSize | ( | ) |
Thumb size preferred by the user.
Definition at line 543 of file ParserOptions.php.
References getOption().
ParserOptions::getTidy | ( | ) |
Use tidy to cleanup output HTML?
Definition at line 291 of file ParserOptions.php.
References getOption().
ParserOptions::getTimestamp | ( | ) |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 854 of file ParserOptions.php.
References $mTimestamp, and wfTimestampNow().
ParserOptions::getUser | ( | ) |
Current user.
Definition at line 925 of file ParserOptions.php.
References $mUser.
Referenced by optionsHash().
ParserOptions::getUserLang | ( | ) |
Same as getUserLangObj() but returns a string instead.
Definition at line 698 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 682 of file ParserOptions.php.
References getOption().
Referenced by getUserLang().
ParserOptions::getWrapOutputClass | ( | ) |
Class to use to wrap output from Parser::parse()
Definition at line 776 of file ParserOptions.php.
References getOption().
|
staticprivate |
Lazy initializer for dateFormat.
Definition at line 652 of file ParserOptions.php.
|
private |
Get user options.
Definition at line 1127 of file ParserOptions.php.
References $lang, $user, getDefaults(), and options().
Referenced by __construct().
ParserOptions::isSafeToCache | ( | ) |
Test whether these options are safe to cache.
Definition at line 1344 of file ParserOptions.php.
References $defaults, $value, as, getCanonicalOverrides(), getDefaults(), options(), and optionToString().
Referenced by WikiPage\getParserOutput().
|
static |
Returns the full array of options that would have been used by in 1.16.
Used to get the old parser cache entries when available.
Definition at line 1218 of file ParserOptions.php.
References wfDeprecated().
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 1146 of file ParserOptions.php.
References $name, $options, as, options(), 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.
User | null | $user | |
Language | StubObject | null | $lang |
Definition at line 1020 of file ParserOptions.php.
References $lang, $ret, $user, and as.
Referenced by ContentHandler\makeParserOptions(), ParserOptionsTest\testGetInvalidOption(), ParserOptionsTest\testIsSafeToCache(), ParserOptionsTest\testMatches(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), ParserOptionsTest\testOptionsHash(), ParserOptionsTest\testOptionsHashEditSection(), and ParserOptionsTest\testSetInvalidOption().
|
static |
Get a ParserOptions object for an anonymous user.
Definition at line 963 of file ParserOptions.php.
References $wgContLang, and global.
Referenced by MessageCache\getParserOptions(), and OutputPage\parserOptions().
|
static |
Get a ParserOptions object from a IContextSource object.
IContextSource | $context |
Definition at line 1005 of file ParserOptions.php.
References $context.
Referenced by ApiExpandTemplates\execute(), SpecialExpandTemplates\execute(), ApiQueryRevisionsBase\extractRevisionInfo(), SpecialExpandTemplates\generateHtml(), ApiComparePages\getDiffContent(), RawAction\getRawText(), OutputPage\parserOptions(), and Preferences\profilePreferences().
|
static |
Get a ParserOptions object from a given user.
Language will be taken from $wgLang.
User | $user |
Definition at line 978 of file ParserOptions.php.
References $user.
Referenced by CompareParsers\checkOptions(), PPFuzzTest\execute(), ParserFuzzTest\fuzzTest(), ParserCache\getKey(), SpecialCiteThisPage\getParserOptions(), EditPage\getPreloadedContent(), DumpRenderer\handleRevision(), ExtraParserTest\testLongNumericLinesDontKillTheParser(), and ParserMethodsTest\testPreSaveTransform().
Get a ParserOptions object from a given user and language.
Definition at line 992 of file ParserOptions.php.
Referenced by EditPage\getContentObject(), TagHookTest\getParserOptions(), WikiPage\prepareContentForEdit(), ExtraParserTest\setUp(), MagicVariableTest\setUp(), PreprocessorTest\setUp(), ParserPreloadTest\setUp(), EditPage\showDiff(), TextContentTest\testPreloadTransform(), and TextContentTest\testPreSaveTransform().
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.
array | $forOptions | |
Title | $title | Used to get the content language of the page (since r97636) |
Definition at line 1277 of file ParserOptions.php.
References $defaults, $inCacheKey, $mEditSection, $mExtraKey, $options, $title, $wgContLang, $wgRenderHashAppend, as, getCanonicalOverrides(), getDefaults(), getUser(), global, optionToString(), and Hooks\run().
|
private |
Convert an option to a string value.
mixed | $value |
Definition at line 1249 of file ParserOptions.php.
References $value.
Referenced by isSafeToCache(), matches(), 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 1205 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 | $callback |
Definition at line 1193 of file ParserOptions.php.
ParserOptions::setAllowExternalImages | ( | $x | ) |
Allow all external images inline?
bool | null | $x | New value (null is no change) |
Definition at line 209 of file ParserOptions.php.
References setOptionLegacy().
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 232 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setAllowSpecialInclusion | ( | $x | ) |
Allow inclusion of special pages?
bool | null | $x | New value (null is no change) |
Definition at line 283 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 767 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 484 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 808 of file ParserOptions.php.
References setOptionLegacy().
Referenced by setupFakeRevision().
ParserOptions::setDateFormat | ( | $x | ) |
Date format index.
string | null | $x | New value (null is no change) |
Definition at line 661 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setEditSection | ( | $x | ) |
Create "edit section" links?
bool | null | $x | New value (null is no change) |
Definition at line 883 of file ParserOptions.php.
References wfSetVar().
Referenced by MessageCache\getParserOptions().
ParserOptions::setEnableImageWhitelist | ( | $x | ) |
Use the on-wiki external image whitelist?
bool | null | $x | New value (null is no change) |
Definition at line 249 of file ParserOptions.php.
References setOptionLegacy().
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 429 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 501 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 317 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 192 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 586 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setIsPrintable | ( | $x | ) |
Parsing the printable version of the page?
bool | null | $x | New value (null is no change) |
Definition at line 620 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 603 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setMaxGeneratedPPNodeCount | ( | $x | ) |
Maximum number of nodes generated by Preprocessor::preprocessToObj()
int | null | $x | New value (null is no change) |
Definition at line 385 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setMaxIncludeSize | ( | $x | ) |
Maximum size of template expansions, in bytes.
int | null | $x | New value (null is no change) |
Definition at line 351 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 368 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 410 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setNumberHeadings | ( | $x | ) |
Automatically number headings?
bool | null | $x | New value (null is no change) |
Definition at line 266 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 151 of file ParserOptions.php.
References $name, $value, and options().
Referenced by setTargetLanguage(), and setWrapOutputClass().
|
protected |
Legacy implementation.
string | $name | Option name |
mixed | $value | New value. Passing null does not set the value. |
Definition at line 168 of file ParserOptions.php.
References $name, $value, options(), and wfSetVar().
Referenced by disableContentConversion(), disableTitleConversion(), enableLimitReport(), setAllowExternalImages(), setAllowExternalImagesFrom(), setAllowSpecialInclusion(), setAllowUnsafeRawHtml(), setCleanSignatures(), setCurrentRevisionCallback(), setDateFormat(), setEnableImageWhitelist(), setExpensiveParserFunctionLimit(), setExternalLinkTarget(), setInterfaceMessage(), setInterwikiMagic(), setIsPreview(), setIsPrintable(), setIsSectionPreview(), setMaxGeneratedPPNodeCount(), setMaxIncludeSize(), setMaxPPNodeCount(), setMaxTemplateDepth(), setNumberHeadings(), setPreSaveTransform(), setRemoveComments(), setSpeculativeRevIdCallback(), setStubThreshold(), setTemplateCallback(), setThumbSize(), setTidy(), and setUserLang().
ParserOptions::setPreSaveTransform | ( | $x | ) |
Transform wiki markup when saving the page?
bool | null | $x | New value (null is no change) |
Definition at line 637 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setRedirectTarget | ( | $title | ) |
Set the redirect target.
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 897 of file ParserOptions.php.
References $title.
ParserOptions::setRemoveComments | ( | $x | ) |
Remove HTML comments.
bool | null | $x | New value (null is no change) |
Definition at line 448 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setSpeculativeRevIdCallback | ( | $x | ) |
Callback to generate a guess for {{REVISIONID}}.
callable | null | $x | New value (null is no change) |
Definition at line 844 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setStubThreshold | ( | $x | ) |
Thumb size preferred by the user.
int | null | $x | New value (null is no change) |
Definition at line 569 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setTargetLanguage | ( | $x | ) |
Target language for the parse.
Language | null | $x | New value |
Definition at line 334 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 825 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 552 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 300 of file ParserOptions.php.
References setOptionLegacy().
ParserOptions::setTimestamp | ( | $x | ) |
Timestamp used for {{CURRENTDAY}} etc.
string | null | $x | New value (null is no change) |
Definition at line 866 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 1368 of file ParserOptions.php.
References $parser, $title, $user, $wgHooks, global, key, setCurrentRevisionCallback(), LinkCache\singleton(), and use.
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 707 of file ParserOptions.php.
References Language\factory(), and setOptionLegacy().
ParserOptions::setWrapOutputClass | ( | $className | ) |
CSS class to use to wrap output from Parser::parse()
string | bool | $className | Set false to disable wrapping. |
Definition at line 786 of file ParserOptions.php.
References setOption().
Referenced by ExtraParserTest\testLongNumericLinesDontKillTheParser().
|
staticprivate |
Default values for all options that are relevant for caching.
Definition at line 47 of file ParserOptions.php.
Referenced by isSafeToCache(), and optionsHash().
|
staticprivate |
Specify options that are included in the cache key.
Definition at line 61 of file ParserOptions.php.
Referenced by optionsHash().
|
staticprivate |
Lazy-loaded options.
Definition at line 53 of file ParserOptions.php.
|
private |
The edit section flag is in ParserOptions for historical reasons, but doesn't actually affect the parser output since Feb 2015.
Definition at line 89 of file ParserOptions.php.
Referenced by getEditSection(), and optionsHash().
|
private |
Appended to the options hash.
Definition at line 116 of file ParserOptions.php.
Referenced by optionsHash().
|
private |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 82 of file ParserOptions.php.
Referenced by getTimestamp().
|
private |
Stored user object.
Definition at line 96 of file ParserOptions.php.
Referenced by getUser().
|
private |
Function to be called when an option is accessed.
Definition at line 103 of file ParserOptions.php.
|
private |
Current values for all options that are relevant for caching.
Definition at line 75 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 111 of file ParserOptions.php.
Referenced by getRedirectTarget().