MediaWiki
REL1_22
|
Set options of the Parser. More...
Public Member Functions | |
__construct ($user=null, $lang=null) | |
Constructor. | |
addExtraKey ($key) | |
Extra key that should be present in the parser cache key. | |
disableContentConversion ($x=true) | |
disableTitleConversion ($x=true) | |
enableLimitReport ($x=true) | |
getAllowExternalImages () | |
getAllowExternalImagesFrom () | |
getAllowSpecialInclusion () | |
getCleanSignatures () | |
getDateFormat () | |
getDisableContentConversion () | |
getDisableTitleConversion () | |
getEditSection () | |
getEnableImageWhitelist () | |
getEnableLimitReport () | |
getExpensiveParserFunctionLimit () | |
getExternalLinkTarget () | |
getInterfaceMessage () | |
getInterwikiMagic () | |
getIsPreview () | |
getIsPrintable () | |
getIsSectionPreview () | |
getMath () | |
getMaxGeneratedPPNodeCount () | |
getMaxIncludeSize () | |
getMaxPPExpandDepth () | |
getMaxPPNodeCount () | |
getMaxTemplateDepth () | |
getNumberHeadings () | |
getPreSaveTransform () | |
getRemoveComments () | |
getSkin ($title=null) | |
getStubThreshold () | |
getTargetLanguage () | |
getTemplateCallback () | |
getThumbSize () | |
getTidy () | |
getTimestamp () | |
getUser () | |
getUserLang () | |
Same as getUserLangObj() but returns a string instead. | |
getUserLangObj () | |
Get the user language used by the parser for this page. | |
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) | |
setExpensiveParserFunctionLimit ($x) | |
setExternalLinkTarget ($x) | |
setInterfaceMessage ($x) | |
setInterwikiMagic ($x) | |
setIsPreview ($x) | |
setIsPrintable ($x) | |
setIsSectionPreview ($x) | |
setMath ($x) | |
setMaxGeneratedPPNodeCount ($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) | |
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. | |
$mDisableContentConversion | |
Whether content conversion should be disabled. | |
$mDisableTitleConversion | |
Whether title conversion should be disabled. | |
$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. | |
$mExpensiveParserFunctionLimit | |
Maximum number of calls per parse to expensive parser functions. | |
$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). | |
$mMaxGeneratedPPNodeCount | |
Maximum number of nodes generated by Preprocessor::preprocessToObj() | |
$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. | |
User | $mUser |
Stored user object. | |
$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". |
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 31 of file ParserOptions.php.
ParserOptions::__construct | ( | $ | user = null , |
$ | lang = null |
||
) |
Constructor.
Definition at line 369 of file ParserOptions.php.
ParserOptions::addExtraKey | ( | $ | key | ) |
Extra key that should be present in the parser cache key.
Definition at line 360 of file ParserOptions.php.
Definition at line 339 of file ParserOptions.php.
References wfSetVar().
Definition at line 340 of file ParserOptions.php.
References wfSetVar().
ParserOptions::enableLimitReport | ( | $ | x = true | ) |
Definition at line 335 of file ParserOptions.php.
References wfSetVar().
Definition at line 218 of file ParserOptions.php.
Definition at line 219 of file ParserOptions.php.
Definition at line 224 of file ParserOptions.php.
Definition at line 238 of file ParserOptions.php.
Definition at line 267 of file ParserOptions.php.
References optionUsed().
Definition at line 240 of file ParserOptions.php.
Definition at line 241 of file ParserOptions.php.
Definition at line 221 of file ParserOptions.php.
Definition at line 220 of file ParserOptions.php.
Definition at line 237 of file ParserOptions.php.
Definition at line 234 of file ParserOptions.php.
Definition at line 239 of file ParserOptions.php.
Definition at line 226 of file ParserOptions.php.
Definition at line 217 of file ParserOptions.php.
Definition at line 250 of file ParserOptions.php.
Definition at line 252 of file ParserOptions.php.
Definition at line 251 of file ParserOptions.php.
Definition at line 243 of file ParserOptions.php.
Definition at line 230 of file ParserOptions.php.
Definition at line 228 of file ParserOptions.php.
Definition at line 231 of file ParserOptions.php.
Definition at line 229 of file ParserOptions.php.
Definition at line 232 of file ParserOptions.php.
Definition at line 222 of file ParserOptions.php.
Definition at line 255 of file ParserOptions.php.
Definition at line 235 of file ParserOptions.php.
ParserOptions::getSkin | ( | $ | title = null | ) |
$title | Title |
Definition at line 262 of file ParserOptions.php.
Definition at line 247 of file ParserOptions.php.
Referenced by WikiPage\isParserCacheUsed().
Definition at line 227 of file ParserOptions.php.
Definition at line 236 of file ParserOptions.php.
Definition at line 245 of file ParserOptions.php.
Definition at line 225 of file ParserOptions.php.
Definition at line 275 of file ParserOptions.php.
References wfTimestampNow().
Definition at line 254 of file ParserOptions.php.
Referenced by Parser\testPreprocess().
Same as getUserLangObj() but returns a string instead.
Definition at line 309 of file ParserOptions.php.
Get the user language used by the parser for this page.
You shouldn't use this. Really. $parser->getFunctionLang() is all you need.
To avoid side-effects where the page will be rendered based on the language of the user who last saved, this function will triger a cache fragmentation. Usage of this method is discouraged for that reason.
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).
Definition at line 298 of file ParserOptions.php.
ParserOptions::initialiseFromUser | ( | $ | user, |
$ | lang | ||
) | [private] |
Get user options.
Definition at line 426 of file ParserOptions.php.
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 484 of file ParserOptions.php.
Referenced by ParserCache\get(), ParserCache\getETag(), and ParserCache\getKey().
static ParserOptions::newFromContext | ( | IContextSource $ | context | ) | [static] |
Get a ParserOptions object from a IContextSource object.
$context | IContextSource object |
Definition at line 416 of file ParserOptions.php.
Referenced by ApiExpandTemplates\execute(), RawAction\getRawText(), ContentHandler\makeParserOptions(), Preferences\profilePreferences(), and NewParserTest\testParserTest().
static ParserOptions::newFromUser | ( | $ | user | ) | [static] |
Get a ParserOptions object from a given user.
Language will be taken from $wgLang.
$user | User object |
Definition at line 395 of file ParserOptions.php.
Referenced by CompareParsers\checkOptions(), PPFuzzTest\execute(), ParserCache\getKey(), DumpRenderer\handleRevision(), ContentHandler\makeParserOptions(), ExtraParserTest\testBug8689(), NewParserTest\testFuzzTests(), and ParserMethodsTest\testPreSaveTransform().
static ParserOptions::newFromUserAndLang | ( | User $ | user, |
Language $ | lang | ||
) | [static] |
Get a ParserOptions object from a given user and language.
Definition at line 406 of file ParserOptions.php.
Referenced by ContentHandler\makeParserOptions(), ExtraParserTest\setUp(), PreprocessorTest\setUp(), TagHookTest\testBadFunctionTagHooks(), TagHookTest\testBadTagHooks(), TagHookTest\testFunctionTagHooks(), TextContentTest\testPreloadTransform(), TextContentTest\testPreSaveTransform(), and TagHookTest\testTagHooks().
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.
$forOptions | Array |
$title | Title: used to get the content language of the page (since r97636) |
Definition at line 506 of file ParserOptions.php.
ParserOptions::optionUsed | ( | $ | optionName | ) | [protected] |
Called when an option is accessed.
Definition at line 472 of file ParserOptions.php.
Referenced by getDateFormat().
ParserOptions::registerWatcher | ( | $ | callback | ) |
Registers a callback for tracking which ParserOptions which are used.
This is a private API with the parser.
Definition at line 465 of file ParserOptions.php.
Definition at line 314 of file ParserOptions.php.
References wfSetVar().
Definition at line 315 of file ParserOptions.php.
References wfSetVar().
Definition at line 320 of file ParserOptions.php.
References wfSetVar().
Definition at line 337 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setDateFormat | ( | $ | x | ) |
Definition at line 317 of file ParserOptions.php.
References wfSetVar().
Definition at line 318 of file ParserOptions.php.
References wfSetVar().
Definition at line 316 of file ParserOptions.php.
References wfSetVar().
Definition at line 332 of file ParserOptions.php.
Definition at line 338 of file ParserOptions.php.
References wfSetVar().
Definition at line 325 of file ParserOptions.php.
References wfDeprecated().
Definition at line 313 of file ParserOptions.php.
ParserOptions::setIsPreview | ( | $ | x | ) |
Definition at line 353 of file ParserOptions.php.
Definition at line 355 of file ParserOptions.php.
References wfSetVar().
Definition at line 354 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMath | ( | $ | x | ) |
Definition at line 342 of file ParserOptions.php.
Definition at line 329 of file ParserOptions.php.
References wfSetVar().
Definition at line 327 of file ParserOptions.php.
References wfSetVar().
Definition at line 328 of file ParserOptions.php.
References wfSetVar().
Definition at line 330 of file ParserOptions.php.
References wfSetVar().
Definition at line 319 of file ParserOptions.php.
References wfSetVar().
Definition at line 351 of file ParserOptions.php.
References wfSetVar().
Definition at line 333 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setSkin | ( | $ | x | ) |
Definition at line 324 of file ParserOptions.php.
Definition at line 350 of file ParserOptions.php.
References wfSetVar().
Definition at line 326 of file ParserOptions.php.
References wfSetVar().
Definition at line 334 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setThumbSize | ( | $ | x | ) |
Definition at line 349 of file ParserOptions.php.
ParserOptions::setTidy | ( | $ | x | ) |
Definition at line 321 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTimestamp | ( | $ | x | ) |
Definition at line 336 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setUserLang | ( | $ | x | ) |
Definition at line 343 of file ParserOptions.php.
References wfSetVar().
ParserOptions::$mAllowExternalImages |
Allow external images inline?
Definition at line 41 of file ParserOptions.php.
ParserOptions::$mAllowExternalImagesFrom |
If not, any exception?
Definition at line 46 of file ParserOptions.php.
ParserOptions::$mAllowSpecialInclusion |
Allow inclusion of special pages?
Definition at line 66 of file ParserOptions.php.
ParserOptions::$mCleanSignatures |
Clean up signature texts?
1) Strip ~~~, ~~~~ and ~~~~~ out of signatures 2) Substitute all transclusions
Definition at line 145 of file ParserOptions.php.
ParserOptions::$mDateFormat = null |
Date format index.
Definition at line 56 of file ParserOptions.php.
ParserOptions::$mDisableContentConversion |
Whether content conversion should be disabled.
Definition at line 155 of file ParserOptions.php.
ParserOptions::$mDisableTitleConversion |
Whether title conversion should be disabled.
Definition at line 160 of file ParserOptions.php.
ParserOptions::$mEditSection = true |
Create "edit section" links?
Definition at line 61 of file ParserOptions.php.
ParserOptions::$mEnableImageWhitelist |
If not or it doesn't match, should we check an on-wiki whitelist?
Definition at line 51 of file ParserOptions.php.
ParserOptions::$mEnableLimitReport = false |
Enable limit report in an HTML comment on output.
Definition at line 127 of file ParserOptions.php.
ParserOptions::$mExpensiveParserFunctionLimit |
Maximum number of calls per parse to expensive parser functions.
Definition at line 111 of file ParserOptions.php.
ParserOptions::$mExternalLinkTarget |
Target attribute for external links.
Definition at line 137 of file ParserOptions.php.
ParserOptions::$mExtraKey = '' |
Extra key that should be present in the caching key.
Definition at line 210 of file ParserOptions.php.
ParserOptions::$mInterfaceMessage = false |
Which lang to call for PLURAL and GRAMMAR.
Definition at line 76 of file ParserOptions.php.
ParserOptions::$mInterwikiMagic |
Interlanguage links are removed and returned in an array.
Definition at line 36 of file ParserOptions.php.
ParserOptions::$mIsPreview = false |
Parsing the page for a "preview" operation?
Definition at line 195 of file ParserOptions.php.
ParserOptions::$mIsPrintable = false |
Parsing the printable version of the page?
Definition at line 205 of file ParserOptions.php.
ParserOptions::$mIsSectionPreview = false |
Parsing the page for a "preview" operation on a single section?
Definition at line 200 of file ParserOptions.php.
ParserOptions::$mMath |
User math preference (as integer).
Not used (1.19)
Definition at line 170 of file ParserOptions.php.
ParserOptions::$mMaxGeneratedPPNodeCount |
Maximum number of nodes generated by Preprocessor::preprocessToObj()
Definition at line 96 of file ParserOptions.php.
ParserOptions::$mMaxIncludeSize |
Maximum size of template expansions, in bytes.
Definition at line 86 of file ParserOptions.php.
ParserOptions::$mMaxPPExpandDepth |
Maximum recursion depth in PPFrame::expand()
Definition at line 101 of file ParserOptions.php.
ParserOptions::$mMaxPPNodeCount |
Maximum number of nodes touched by PPFrame::expand()
Definition at line 91 of file ParserOptions.php.
ParserOptions::$mMaxTemplateDepth |
Maximum recursion depth for templates within templates.
Definition at line 106 of file ParserOptions.php.
ParserOptions::$mNumberHeadings |
Automatically number headings?
Definition at line 165 of file ParserOptions.php.
ParserOptions::$mPreSaveTransform = true |
Transform wiki markup when saving the page?
Definition at line 150 of file ParserOptions.php.
ParserOptions::$mRemoveComments = true |
Remove HTML comments.
ONLY APPLIES TO PREPROCESS OPERATIONS
Definition at line 116 of file ParserOptions.php.
ParserOptions::$mStubThreshold [private] |
Maximum article size of an article to be marked as "stub".
Definition at line 180 of file ParserOptions.php.
ParserOptions::$mTargetLanguage = null |
Overrides $mInterfaceMessage with arbitrary language.
Definition at line 81 of file ParserOptions.php.
ParserOptions::$mTemplateCallback |
array( 'Parser', 'statelessFetchTemplate' )
Callback for template fetching.
Used as first argument to call_user_func().
Definition at line 121 of file ParserOptions.php.
ParserOptions::$mThumbSize |
Thumb size preferred by the user.
Definition at line 175 of file ParserOptions.php.
ParserOptions::$mTidy = false |
Use tidy to cleanup output HTML?
Definition at line 71 of file ParserOptions.php.
ParserOptions::$mTimestamp |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 132 of file ParserOptions.php.
User ParserOptions::$mUser |
Stored user object.
Definition at line 190 of file ParserOptions.php.
ParserOptions::$mUserLang |
Language object of the User language.
Definition at line 185 of file ParserOptions.php.
ParserOptions::$onAccessCallback = null [protected] |
Function to be called when an option is accessed.
Definition at line 215 of file ParserOptions.php.