BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
ParserOptions Class Reference

Set options of the Parser. More...

Public Member Functions

 getInterwikiMagic ()
 
 getAllowExternalImages ()
 
 getAllowExternalImagesFrom ()
 
 getEnableImageWhitelist ()
 
 getEditSection ()
 
 getNumberHeadings ()
 
 getAllowSpecialInclusion ()
 
 getTidy ()
 
 getInterfaceMessage ()
 
 getTargetLanguage ()
 
 getMaxIncludeSize ()
 
 getMaxPPNodeCount ()
 
 getMaxGeneratedPPNodeCount ()
 
 getMaxPPExpandDepth ()
 
 getMaxTemplateDepth ()
 
 getExpensiveParserFunctionLimit ()
 
 getRemoveComments ()
 
 getCurrentRevisionCallback ()
 
 getTemplateCallback ()
 
 getEnableLimitReport ()
 
 getCleanSignatures ()
 
 getExternalLinkTarget ()
 
 getDisableContentConversion ()
 
 getDisableTitleConversion ()
 
 getThumbSize ()
 
 getStubThreshold ()
 
 getIsPreview ()
 
 getIsSectionPreview ()
 
 getIsPrintable ()
 
 getUser ()
 
 getPreSaveTransform ()
 
 getDateFormat ()
 
 getTimestamp ()
 
 getUserLangObj ()
 
 getUserLang ()
 
 getAllowUnsafeRawHtml ()
 
 setInterwikiMagic ($x)
 
 setAllowExternalImages ($x)
 
 setAllowExternalImagesFrom ($x)
 
 setEnableImageWhitelist ($x)
 
 setDateFormat ($x)
 
 setEditSection ($x)
 
 setNumberHeadings ($x)
 
 setAllowSpecialInclusion ($x)
 
 setTidy ($x)
 
 setInterfaceMessage ($x)
 
 setTargetLanguage ($x)
 
 setMaxIncludeSize ($x)
 
 setMaxPPNodeCount ($x)
 
 setMaxGeneratedPPNodeCount ($x)
 
 setMaxTemplateDepth ($x)
 
 setExpensiveParserFunctionLimit ($x)
 
 setRemoveComments ($x)
 
 setCurrentRevisionCallback ($x)
 
 setTemplateCallback ($x)
 
 enableLimitReport ($x=true)
 
 setTimestamp ($x)
 
 setCleanSignatures ($x)
 
 setExternalLinkTarget ($x)
 
 disableContentConversion ($x=true)
 
 disableTitleConversion ($x=true)
 
 setUserLang ($x)
 
 setThumbSize ($x)
 
 setStubThreshold ($x)
 
 setPreSaveTransform ($x)
 
 setIsPreview ($x)
 
 setIsSectionPreview ($x)
 
 setIsPrintable ($x)
 
 setAllowUnsafeRawHtml ($x)
 
 setRedirectTarget ($title)
 
 getRedirectTarget ()
 
 addExtraKey ($key)
 
 __construct ($user=null, $lang=null)
 
 matches (ParserOptions $other)
 
 registerWatcher ($callback)
 
 optionUsed ($optionName)
 
 optionsHash ($forOptions, $title=null)
 
 setupFakeRevision ($title, $content, $user)
 

Static Public Member Functions

static newFromAnon ()
 
static newFromUser ($user)
 
static newFromUserAndLang (User $user, Language $lang)
 
static newFromContext (IContextSource $context)
 
static legacyOptions ()
 

Detailed Description

Set options of the Parser.

All member variables are supposed to be private in theory, although in practice this is not the case.

Constructor & Destructor Documentation

ParserOptions::__construct (   $user = null,
  $lang = null 
)

Constructor

Parameters
User$user
Language$lang

Member Function Documentation

ParserOptions::addExtraKey (   $key)

Extra key that should be present in the parser cache key.

Parameters
string$key
ParserOptions::getAllowUnsafeRawHtml ( )
Since
1.29
Returns
bool
ParserOptions::getRedirectTarget ( )

Get the previously-set redirect target.

Since
1.24
Returns
Title|null
ParserOptions::getUserLang ( )

Same as getUserLangObj() but returns a string instead.

Warning
: Calling this causes the parser cache to be fragmented by user language! To avoid cache fragmentation, output should not depend on the user language. Use Parser::getFunctionLang() or Parser::getTargetLanguage() instead!
See Also
getUserLangObj()
Returns
string Language code
Since
1.17
ParserOptions::getUserLangObj ( )

Get the user language used by the parser for this page and split the parser cache.

Warning
: Calling this causes the parser cache to be fragmented by user language! To avoid cache fragmentation, output should not depend on the user language. Use Parser::getFunctionLang() or Parser::getTargetLanguage() instead!
Note
This function will trigger a cache fragmentation by recording the 'userlang' option, see optionUsed(). This is done to avoid cache pollution when the page is rendered based on the language of the user.
When saving, this will return the default language instead of the user's. {{int: }} uses this which used to produce inconsistent link tables (bug 14404).
Returns
Language
Since
1.19
static ParserOptions::legacyOptions ( )
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.

Returns
array
ParserOptions::matches ( ParserOptions  $other)

Check if these options match that of another options set

This ignores report limit settings that only affect HTML comments

Parameters
ParserOptions$other
Returns
bool
Since
1.25
static ParserOptions::newFromAnon ( )
static

Get a ParserOptions object for an anonymous user

Since
1.27
Returns
ParserOptions
static ParserOptions::newFromContext ( IContextSource  $context)
static

Get a ParserOptions object from a IContextSource object

Parameters
IContextSource$context
Returns
ParserOptions
static ParserOptions::newFromUser (   $user)
static

Get a ParserOptions object from a given user. Language will be taken from $wgLang.

Parameters
User$user
Returns
ParserOptions
static ParserOptions::newFromUserAndLang ( User  $user,
Language  $lang 
)
static

Get a ParserOptions object from a given user and language

Parameters
User$user
Language$lang
Returns
ParserOptions
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.

Extensions which require it should install 'PageRenderingHash' hook, which will give them a chance to modify this key based on their own settings.

Since
1.17
Parameters
array$forOptions
Title$titleUsed to get the content language of the page (since r97636)
Returns
string Page rendering hash
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().

Parameters
string$optionNameName of the option
ParserOptions::registerWatcher (   $callback)

Registers a callback for tracking which ParserOptions which are used. This is a private API with the parser.

Parameters
callable$callback
ParserOptions::setAllowUnsafeRawHtml (   $x)
Parameters
bool|nullValue to set or null to get current value
Returns
bool Current value for allowUnsafeRawHtml
Since
1.29
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.

Since
1.24
Parameters
Title | null$title
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.

Since
1.25
Parameters
Title$title
Content$content
User$userThe user that the fake revision is attributed to
Returns
ScopedCallback to unset the hook

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