Jump to content

Manual:ParserOptions.php

From mediawiki.org

Description

[edit]

This file sets the options of the Parser . It contains a number of variables and functions to get and set those variables. All variables are supposed to be private in theory, although in practise this is not the case. The ParserOptions are initialized using a User object.

Public methods

[edit]

Public methods, excluding long deprecated ones and methods for internal use only:

  • getOption() - fetch an option and track that is was accessed
  • setOption() - set an option, generically
  • getInterwikiMagic() - whether to extract interlanguage links (boolean)
  • setInterwikiMagic() - specify whether to extract interlanguage links.
  • getAllowExternalImages() - whether to allow all external images inline
  • getAllowExternalImagesFrom() - what external images to allow
  • getEnableImageWhitelist() - whether to use the on-wiki external image whitelist
  • getAllowSpecialInclusion() - whether to allow inclusion of special pages
  • setAllowSpecialInclusion()
  • getInterfaceMessage() - whether to parse an interface message
  • setInterfaceMessage()
  • getTargetLanguage()
  • setTargetLanguage()
  • getMaxIncludeSize()
  • setMaxIncludeSize()
  • getMaxPPNodeCount()
  • setMaxPPNodeCount() - maximum number of nodes touched by PPFrame::expand()
  • getMaxPPExpandDepth() - maximum recursion depth in PPFrame::expand()
  • getMaxTemplateDepth() - maximum recursion depth for templates within templates
  • setMaxTemplateDepth()
  • getExpensiveParserFunctionLimit()
  • setExpensiveParserFunctionLimit()
  • getRemoveComments()
  • setRemoveComments()
  • getCleanSignatures()
  • setCleanSignatures()
  • getExternalLinkTarget() - target attribute for external links.
  • setExternalLinkTarget()
  • getDisableContentConversion()
  • disableContentConversion()
  • getDisableTitleConversion()
  • disableTitleConversion()
  • getThumbSize() - get the thumb size preferred by the user.
  • setThumbSize()
  • getIsPreview() - whether the page for a "preview" operation is being parsed.
  • setIsPreview()
  • getIsSectionPreview() - whether the page for a "preview" operation on a single section is being parsed.
  • setIsSectionPreview()
  • getIsPrintable() - whether the printable version of the page is being parsed.
  • setIsPrintable()
  • getPreSaveTransform() - whether to transform wiki markup when saving the page
  • setPreSaveTransform()
  • getDateFormat()
  • setDateFormat()
  • getUserLangObj() - get the user language used by the parser for this page and split the parser cache.
  • setUserLangObj()
  • getUserLang() - same as getUserLangObj() but returns a string instead.
  • setUserLang()
  • getMagicISBNLinks()
  • getMagicPMIDLinks()
  • getMagicRFCLinks()
  • getSuppressTOC() - since 1.39. Should the table of contents be suppressed?
  • setSuppressTOC() - since 1.39.
  • getAllowUnsafeRawHtml()
  • setAllowUnsafeRawHtml()
  • getWrapOutputClass()
  • setWrapOutputClass()
  • getCurrentRevisionRecordCallback()
  • setCurrentRevisionRecordCallback()
  • getTemplateCallback() - callback for template fetching; first argument to call_user_func().
  • setTemplateCallback()
  • getSpeculativeRevId()
  • setSpeculativeRevIdCallback()
  • getSpeculativePageId()
  • setSpeculativePageIdCallback()
  • getTimestamp()
  • setTimestamp()
  • getRedirectTarget()
  • setRedirectTarget()
  • addExtraKey()
  • getUserIdentity()

Getting ParserOptions objects:

  • newFromAnon()
  • newFromUser() - get a ParserOptions object from a given user.
  • newFromUserAndLang() - get a ParserOptions object from a given user and language.
  • newFromContext() - get a ParserOptions object from a IContextSource object.
  • newFromUserAndLang()
  • newCanonical() - deprecated.

Checks, other:

  • matches() - check if these options match that of another options set
  • matchesForCacheKey()
  • registerWatcher() - register a callback for tracking which ParserOptions which are used.
  • optionUsed() - record that an option was internally accessed.
  • allCacheVaryingOptions()
  • optionsHash() - generate a hash string with the values set on these ParserOptions
  • isSafeToCache() - test whether these options are safe to cache.
  • setupFakeRevision()


See also

[edit]