MediaWiki  REL1_19
ParserOptions Class Reference

Set options of the Parser. More...

List of all members.

Public Member Functions

 __construct ($user=null, $lang=null)
 Constructor.
 addExtraKey ($key)
 Extra key that should be present in the parser cache key.
 enableLimitReport ($x=true)
 getAllowExternalImages ()
 getAllowExternalImagesFrom ()
 getAllowSpecialInclusion ()
 getCleanSignatures ()
 getDateFormat ()
 getEditSection ()
 getEnableImageWhitelist ()
 getEnableLimitReport ()
 getExternalLinkTarget ()
 getInterfaceMessage ()
 getInterwikiMagic ()
 getIsPreview ()
 getIsPrintable ()
 getIsSectionPreview ()
 getMath ()
 getMaxIncludeSize ()
 getMaxPPExpandDepth ()
 getMaxPPNodeCount ()
 getMaxTemplateDepth ()
 getNumberHeadings ()
 getPreSaveTransform ()
 getRemoveComments ()
 getSkin ($title=null)
 getStubThreshold ()
 getTargetLanguage ()
 getTemplateCallback ()
 getThumbSize ()
 getTidy ()
 getTimestamp ()
 getUseDynamicDates ()
 getUser ()
 getUserLang ()
 Same as getUserLangObj() but returns a string instead.
 getUserLangObj ()
 You shouldn't use this.
 optionsHash ($forOptions, $title=null)
 Generate a hash string with the values set on these ParserOptions for the keys given in the array.
 registerWatcher ($callback)
 Registers a callback for tracking which ParserOptions which are used.
 setAllowExternalImages ($x)
 setAllowExternalImagesFrom ($x)
 setAllowSpecialInclusion ($x)
 setCleanSignatures ($x)
 setDateFormat ($x)
 setEditSection ($x)
 setEnableImageWhitelist ($x)
 setExternalLinkTarget ($x)
 setInterfaceMessage ($x)
 setInterwikiMagic ($x)
 setIsPreview ($x)
 setIsPrintable ($x)
 setIsSectionPreview ($x)
 setMath ($x)
 setMaxIncludeSize ($x)
 setMaxPPNodeCount ($x)
 setMaxTemplateDepth ($x)
 setNumberHeadings ($x)
 setPreSaveTransform ($x)
 setRemoveComments ($x)
 setSkin ($x)
 setStubThreshold ($x)
 setTargetLanguage ($x)
 setTemplateCallback ($x)
 setThumbSize ($x)
 setTidy ($x)
 setTimestamp ($x)
 setUseDynamicDates ($x)
 setUserLang ($x)

Static Public Member Functions

static legacyOptions ()
 Returns the full array of options that would have been used by in 1.16.
static newFromContext (IContextSource $context)
 Get a ParserOptions object from a IContextSource object.
static newFromUser ($user)
 Get a ParserOptions object from a given user.
static newFromUserAndLang (User $user, Language $lang)
 Get a ParserOptions object from a given user and language.

Public Attributes

 $mAllowExternalImages
 Allow external images inline?
 $mAllowExternalImagesFrom
 If not, any exception?
 $mAllowSpecialInclusion
 Allow inclusion of special pages?
 $mCleanSignatures
 Clean up signature texts?
 $mDateFormat = null
 Date format index.
 $mEditSection = true
 Create "edit section" links?
 $mEnableImageWhitelist
 If not or it doesn't match, should we check an on-wiki whitelist?
 $mEnableLimitReport = false
 Enable limit report in an HTML comment on output.
 $mExternalLinkTarget
 Target attribute for external links.
 $mExtraKey = ''
 Extra key that should be present in the caching key.
 $mInterfaceMessage = false
 Which lang to call for PLURAL and GRAMMAR.
 $mInterwikiMagic
 Interlanguage links are removed and returned in an array.
 $mIsPreview = false
 Parsing the page for a "preview" operation?
 $mIsPrintable = false
 Parsing the printable version of the page?
 $mIsSectionPreview = false
 Parsing the page for a "preview" operation on a single section?
 $mMath
 User math preference (as integer).
 $mMaxIncludeSize
 Maximum size of template expansions, in bytes.
 $mMaxPPExpandDepth
 Maximum recursion depth in PPFrame::expand()
 $mMaxPPNodeCount
 Maximum number of nodes touched by PPFrame::expand()
 $mMaxTemplateDepth
 Maximum recursion depth for templates within templates.
 $mNumberHeadings
 Automatically number headings?
 $mPreSaveTransform = true
 Transform wiki markup when saving the page?
 $mRemoveComments = true
 Remove HTML comments.
 $mTargetLanguage = null
 Overrides $mInterfaceMessage with arbitrary language.
 $mTemplateCallback
 Callback for template fetching.
 $mThumbSize
 Thumb size preferred by the user.
 $mTidy = false
 Use tidy to cleanup output HTML?
 $mTimestamp
 Timestamp used for {{CURRENTDAY}} etc.
 $mUseDynamicDates
 Use DateFormatter to format dates.
 $mUser
 $mUserLang
 Language object of the User language.

Protected Member Functions

 optionUsed ($optionName)
 Called when an option is accessed.

Protected Attributes

 $onAccessCallback = null
 Function to be called when an option is accessed.

Private Member Functions

 initialiseFromUser ($user, $lang)
 Get user options.

Private Attributes

 $mStubThreshold
 Maximum article size of an article to be marked as "stub".

Detailed Description

Set options of the Parser.

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

Definition at line 16 of file ParserOptions.php.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
$userUser object
$langLanguage object

Definition at line 322 of file ParserOptions.php.

References $user, $wgLang, $wgUser, initialiseFromUser(), and StubObject\isRealObject().

Here is the call graph for this function:


Member Function Documentation

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

Definition at line 313 of file ParserOptions.php.

Definition at line 291 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 207 of file ParserOptions.php.

Definition at line 233 of file ParserOptions.php.

References optionUsed().

Referenced by optionsHash().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 193 of file ParserOptions.php.

Definition at line 198 of file ParserOptions.php.

Definition at line 189 of file ParserOptions.php.

Definition at line 216 of file ParserOptions.php.

Definition at line 218 of file ParserOptions.php.

References optionUsed().

Here is the call graph for this function:

Definition at line 217 of file ParserOptions.php.

Definition at line 209 of file ParserOptions.php.

References optionUsed().

Here is the call graph for this function:

Definition at line 200 of file ParserOptions.php.

Definition at line 202 of file ParserOptions.php.

Definition at line 201 of file ParserOptions.php.

Definition at line 203 of file ParserOptions.php.

Definition at line 194 of file ParserOptions.php.

References optionUsed().

Here is the call graph for this function:

Definition at line 221 of file ParserOptions.php.

Referenced by Parser\preSaveTransform().

Here is the caller graph for this function:

Definition at line 204 of file ParserOptions.php.

ParserOptions::getSkin ( title = null)
Parameters:
$titleTitle
Returns:
Skin
Deprecated:
since 1.18 Use Linker::* instead

Definition at line 228 of file ParserOptions.php.

References wfDeprecated().

Here is the call graph for this function:

Definition at line 213 of file ParserOptions.php.

References optionUsed().

Referenced by WikiPage\getParserOutput(), and WikiPage\isParserCacheUsed().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 199 of file ParserOptions.php.

Definition at line 205 of file ParserOptions.php.

Definition at line 211 of file ParserOptions.php.

References optionUsed().

Here is the call graph for this function:

Definition at line 197 of file ParserOptions.php.

Definition at line 241 of file ParserOptions.php.

References wfTimestampNow().

Here is the call graph for this function:

Definition at line 188 of file ParserOptions.php.

Definition at line 220 of file ParserOptions.php.

Referenced by Parser\testPst().

Here is the caller graph for this function:

Same as getUserLangObj() but returns a string instead.

Returns:
String Language code
Since:
1.17

Definition at line 267 of file ParserOptions.php.

References getUserLangObj().

Here is the call graph for this function:

You shouldn't use this.

Really. $parser->getFunctionLang() is all you need. Using this fragments the cache and is discouraged. Yes, {{int: }} uses this, producing inconsistent tables (Bug 14404).

Returns:
Language object
Since:
1.19

Definition at line 256 of file ParserOptions.php.

References optionUsed().

Referenced by getUserLang().

Here is the call graph for this function:

Here is the caller graph for this function:

ParserOptions::initialiseFromUser ( user,
lang 
) [private]

Get user options.

Parameters:
$userUser object
$langLanguage object

Definition at line 379 of file ParserOptions.php.

References $user, $wgAllowExternalImages, $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgCleanSignatures, $wgEnableImageWhitelist, $wgExternalLinkTarget, $wgInterwikiMagic, $wgMaxArticleSize, $wgMaxPPExpandDepth, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgUseDynamicDates, wfProfileIn(), and wfProfileOut().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Definition at line 432 of file ParserOptions.php.

References $wgUseDynamicDates.

Referenced by ParserCache\get(), ParserCache\getETag(), and ParserCache\getKey().

Here is the caller graph for this function:

static ParserOptions::newFromUserAndLang ( User user,
Language lang 
) [static]

Get a ParserOptions object from a given user and language.

Parameters:
$userUser object
$langLanguage object
Returns:
ParserOptions object

Definition at line 359 of file ParserOptions.php.

Referenced by WikiPage\makeParserOptions(), WikiPage\prepareTextForEdit(), RefreshLinksJob\run(), RefreshLinksJob2\run(), ParserOptionsTest\setUp(), and EditPage\showDiff().

Here is the caller graph for this function:

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 sharign the options with vary for the same page share the same cached data safely.

Replaces User::getPageRenderingHash()

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:
$forOptionsArray
$titleTitle: used to get the content language of the page (since r97636)
Returns:
string Page rendering hash

Definition at line 459 of file ParserOptions.php.

References $title, $wgContLang, $wgRenderHashAppend, getDateFormat(), and wfRunHooks().

Here is the call graph for this function:

ParserOptions::optionUsed ( optionName) [protected]

Called when an option is accessed.

Definition at line 421 of file ParserOptions.php.

Referenced by getDateFormat(), getIsPrintable(), getMath(), getNumberHeadings(), getStubThreshold(), getThumbSize(), and getUserLangObj().

Here is the caller graph for this function:

Registers a callback for tracking which ParserOptions which are used.

This is a private API with the parser.

Definition at line 414 of file ParserOptions.php.

Definition at line 273 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 274 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 279 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 293 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 276 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 277 of file ParserOptions.php.

References wfSetVar().

Referenced by Installer\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 275 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 294 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 284 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 272 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 306 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 308 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 307 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 295 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 286 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 287 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 288 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 278 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 304 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 289 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Deprecated:
in 1.19; will be removed in 1.20

Definition at line 283 of file ParserOptions.php.

References wfDeprecated().

Here is the call graph for this function:

Definition at line 303 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 285 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 290 of file ParserOptions.php.

References wfSetVar().

Referenced by ExtraParserTest\setUp().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 302 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 280 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 292 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 271 of file ParserOptions.php.

References wfSetVar().

Here is the call graph for this function:

Definition at line 296 of file ParserOptions.php.

References Language\factory(), and wfSetVar().

Here is the call graph for this function:


Member Data Documentation

ParserOptions::$mAllowExternalImages

Allow external images inline?

Definition at line 31 of file ParserOptions.php.

ParserOptions::$mAllowExternalImagesFrom

If not, any exception?

Definition at line 36 of file ParserOptions.php.

ParserOptions::$mAllowSpecialInclusion

Allow inclusion of special pages?

Definition at line 56 of file ParserOptions.php.

ParserOptions::$mCleanSignatures

Clean up signature texts?

1) Strip ~~~, ~~~~ and ~~~~~ out of signatures 2) Substitute all transclusions

Definition at line 125 of file ParserOptions.php.

ParserOptions::$mDateFormat = null

Date format index.

Definition at line 46 of file ParserOptions.php.

ParserOptions::$mEditSection = true

Create "edit section" links?

Definition at line 51 of file ParserOptions.php.

ParserOptions::$mEnableImageWhitelist

If not or it doesn't match, should we check an on-wiki whitelist?

Definition at line 41 of file ParserOptions.php.

ParserOptions::$mEnableLimitReport = false

Enable limit report in an HTML comment on output.

Definition at line 107 of file ParserOptions.php.

ParserOptions::$mExternalLinkTarget

Target attribute for external links.

Definition at line 117 of file ParserOptions.php.

ParserOptions::$mExtraKey = ''

Extra key that should be present in the caching key.

Definition at line 181 of file ParserOptions.php.

ParserOptions::$mInterfaceMessage = false

Which lang to call for PLURAL and GRAMMAR.

Definition at line 66 of file ParserOptions.php.

ParserOptions::$mInterwikiMagic

Interlanguage links are removed and returned in an array.

Definition at line 26 of file ParserOptions.php.

ParserOptions::$mIsPreview = false

Parsing the page for a "preview" operation?

Definition at line 166 of file ParserOptions.php.

ParserOptions::$mIsPrintable = false

Parsing the printable version of the page?

Definition at line 176 of file ParserOptions.php.

ParserOptions::$mIsSectionPreview = false

Parsing the page for a "preview" operation on a single section?

Definition at line 171 of file ParserOptions.php.

ParserOptions::$mMath

User math preference (as integer).

Not used (1.19)

Definition at line 140 of file ParserOptions.php.

ParserOptions::$mMaxIncludeSize

Maximum size of template expansions, in bytes.

Definition at line 76 of file ParserOptions.php.

ParserOptions::$mMaxPPExpandDepth

Maximum recursion depth in PPFrame::expand()

Definition at line 86 of file ParserOptions.php.

ParserOptions::$mMaxPPNodeCount

Maximum number of nodes touched by PPFrame::expand()

Definition at line 81 of file ParserOptions.php.

ParserOptions::$mMaxTemplateDepth

Maximum recursion depth for templates within templates.

Definition at line 91 of file ParserOptions.php.

ParserOptions::$mNumberHeadings

Automatically number headings?

Definition at line 135 of file ParserOptions.php.

ParserOptions::$mPreSaveTransform = true

Transform wiki markup when saving the page?

Definition at line 130 of file ParserOptions.php.

ParserOptions::$mRemoveComments = true

Remove HTML comments.

ONLY APPLIES TO PREPROCESS OPERATIONS

Definition at line 96 of file ParserOptions.php.

ParserOptions::$mStubThreshold [private]

Maximum article size of an article to be marked as "stub".

Definition at line 150 of file ParserOptions.php.

ParserOptions::$mTargetLanguage = null

Overrides $mInterfaceMessage with arbitrary language.

Definition at line 71 of file ParserOptions.php.

ParserOptions::$mTemplateCallback
Initial value:
                array( 'Parser', 'statelessFetchTemplate' )

Callback for template fetching.

Used as first argument to call_user_func().

Definition at line 101 of file ParserOptions.php.

ParserOptions::$mThumbSize

Thumb size preferred by the user.

Definition at line 145 of file ParserOptions.php.

ParserOptions::$mTidy = false

Use tidy to cleanup output HTML?

Definition at line 61 of file ParserOptions.php.

ParserOptions::$mTimestamp

Timestamp used for {{CURRENTDAY}} etc.

Definition at line 112 of file ParserOptions.php.

ParserOptions::$mUseDynamicDates

Use DateFormatter to format dates.

Definition at line 21 of file ParserOptions.php.

ParserOptions::$mUser

Definition at line 161 of file ParserOptions.php.

ParserOptions::$mUserLang

Language object of the User language.

Definition at line 155 of file ParserOptions.php.

ParserOptions::$onAccessCallback = null [protected]

Function to be called when an option is accessed.

Definition at line 186 of file ParserOptions.php.


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