MediaWiki
1.23.10
|
Set options of the Parser. More...
Static Public Member Functions | |
static | legacyOptions () |
Returns the full array of options that would have been used by in 1.16. 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... | |
Public Attributes | |
$mAllowExternalImages | |
Allow external images inline? More... | |
$mAllowExternalImagesFrom | |
If not, any exception? More... | |
$mAllowSpecialInclusion | |
Allow inclusion of special pages? More... | |
$mCleanSignatures | |
Clean up signature texts? More... | |
$mDateFormat = null | |
Date format index. More... | |
$mDisableContentConversion | |
Whether content conversion should be disabled. More... | |
$mDisableTitleConversion | |
Whether title conversion should be disabled. More... | |
$mEditSection = true | |
Create "edit section" links? More... | |
$mEnableImageWhitelist | |
If not or it doesn't match, should we check an on-wiki whitelist? More... | |
$mEnableLimitReport = false | |
Enable limit report in an HTML comment on output. More... | |
$mExpensiveParserFunctionLimit | |
Maximum number of calls per parse to expensive parser functions. More... | |
$mExternalLinkTarget | |
Target attribute for external links. More... | |
$mExtraKey = '' | |
Extra key that should be present in the caching key. More... | |
$mInterfaceMessage = false | |
Which lang to call for PLURAL and GRAMMAR. More... | |
$mInterwikiMagic | |
Interlanguage links are removed and returned in an array. More... | |
$mIsPreview = false | |
Parsing the page for a "preview" operation? More... | |
$mIsPrintable = false | |
Parsing the printable version of the page? More... | |
$mIsSectionPreview = false | |
Parsing the page for a "preview" operation on a single section? More... | |
$mMaxGeneratedPPNodeCount | |
Maximum number of nodes generated by Preprocessor::preprocessToObj() More... | |
$mMaxIncludeSize | |
Maximum size of template expansions, in bytes. More... | |
$mMaxPPExpandDepth | |
Maximum recursion depth in PPFrame::expand() More... | |
$mMaxPPNodeCount | |
Maximum number of nodes touched by PPFrame::expand() More... | |
$mMaxTemplateDepth | |
Maximum recursion depth for templates within templates. More... | |
$mNumberHeadings | |
Automatically number headings? More... | |
$mPreSaveTransform = true | |
Transform wiki markup when saving the page? More... | |
$mRemoveComments = true | |
Remove HTML comments. More... | |
$mTargetLanguage = null | |
Overrides $mInterfaceMessage with arbitrary language. More... | |
$mTemplateCallback | |
Callback for template fetching. More... | |
$mThumbSize | |
Thumb size preferred by the user. More... | |
$mTidy = false | |
Use tidy to cleanup output HTML? More... | |
$mTimestamp | |
Timestamp used for {{CURRENTDAY}} etc. More... | |
User | $mUser |
Stored user object. More... | |
$mUserLang | |
Language object of the User language. More... | |
Protected Attributes | |
$onAccessCallback = null | |
Function to be called when an option is accessed. More... | |
Private Member Functions | |
initialiseFromUser ( $user, $lang) | |
Get user options. More... | |
Private Attributes | |
$mStubThreshold | |
Maximum article size of an article to be marked as "stub". More... | |
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 349 of file ParserOptions.php.
References $user, $wgLang, $wgUser, global, initialiseFromUser(), StubObject\isRealObject(), and User.
ParserOptions::addExtraKey | ( | $key | ) |
Extra key that should be present in the parser cache key.
Definition at line 340 of file ParserOptions.php.
ParserOptions::disableContentConversion | ( | $x = true | ) |
Definition at line 321 of file ParserOptions.php.
References wfSetVar().
ParserOptions::disableTitleConversion | ( | $x = true | ) |
Definition at line 322 of file ParserOptions.php.
References wfSetVar().
ParserOptions::enableLimitReport | ( | $x = true | ) |
Definition at line 317 of file ParserOptions.php.
References wfSetVar().
ParserOptions::getAllowExternalImages | ( | ) |
Definition at line 213 of file ParserOptions.php.
References $mAllowExternalImages.
ParserOptions::getAllowExternalImagesFrom | ( | ) |
Definition at line 214 of file ParserOptions.php.
References $mAllowExternalImagesFrom.
ParserOptions::getAllowSpecialInclusion | ( | ) |
Definition at line 219 of file ParserOptions.php.
References $mAllowSpecialInclusion.
ParserOptions::getCleanSignatures | ( | ) |
Definition at line 233 of file ParserOptions.php.
References $mCleanSignatures.
ParserOptions::getDateFormat | ( | ) |
Definition at line 249 of file ParserOptions.php.
References $mDateFormat, and optionUsed().
Referenced by optionsHash().
ParserOptions::getDisableContentConversion | ( | ) |
Definition at line 235 of file ParserOptions.php.
References $mDisableContentConversion.
ParserOptions::getDisableTitleConversion | ( | ) |
Definition at line 236 of file ParserOptions.php.
References $mDisableTitleConversion.
ParserOptions::getEditSection | ( | ) |
Definition at line 216 of file ParserOptions.php.
References $mEditSection.
ParserOptions::getEnableImageWhitelist | ( | ) |
Definition at line 215 of file ParserOptions.php.
References $mEnableImageWhitelist.
ParserOptions::getEnableLimitReport | ( | ) |
Definition at line 232 of file ParserOptions.php.
References $mEnableLimitReport.
ParserOptions::getExpensiveParserFunctionLimit | ( | ) |
Definition at line 229 of file ParserOptions.php.
References $mExpensiveParserFunctionLimit.
ParserOptions::getExternalLinkTarget | ( | ) |
Definition at line 234 of file ParserOptions.php.
References $mExternalLinkTarget.
ParserOptions::getInterfaceMessage | ( | ) |
Definition at line 221 of file ParserOptions.php.
References $mInterfaceMessage.
ParserOptions::getInterwikiMagic | ( | ) |
Definition at line 212 of file ParserOptions.php.
References $mInterwikiMagic.
ParserOptions::getIsPreview | ( | ) |
Definition at line 242 of file ParserOptions.php.
References $mIsPreview.
ParserOptions::getIsPrintable | ( | ) |
Definition at line 244 of file ParserOptions.php.
References $mIsPrintable, and optionUsed().
ParserOptions::getIsSectionPreview | ( | ) |
Definition at line 243 of file ParserOptions.php.
References $mIsSectionPreview.
ParserOptions::getMaxGeneratedPPNodeCount | ( | ) |
Definition at line 225 of file ParserOptions.php.
References $mMaxGeneratedPPNodeCount.
ParserOptions::getMaxIncludeSize | ( | ) |
Definition at line 223 of file ParserOptions.php.
References $mMaxIncludeSize.
ParserOptions::getMaxPPExpandDepth | ( | ) |
Definition at line 226 of file ParserOptions.php.
References $mMaxPPExpandDepth.
ParserOptions::getMaxPPNodeCount | ( | ) |
Definition at line 224 of file ParserOptions.php.
References $mMaxPPNodeCount.
ParserOptions::getMaxTemplateDepth | ( | ) |
Definition at line 227 of file ParserOptions.php.
References $mMaxTemplateDepth.
ParserOptions::getNumberHeadings | ( | ) |
Definition at line 217 of file ParserOptions.php.
References $mNumberHeadings, and optionUsed().
ParserOptions::getPreSaveTransform | ( | ) |
Definition at line 247 of file ParserOptions.php.
References $mPreSaveTransform.
ParserOptions::getRemoveComments | ( | ) |
Definition at line 230 of file ParserOptions.php.
References $mRemoveComments.
ParserOptions::getStubThreshold | ( | ) |
Definition at line 239 of file ParserOptions.php.
References $mStubThreshold, and optionUsed().
Referenced by WikiPage\getParserOutput(), and WikiPage\isParserCacheUsed().
ParserOptions::getTargetLanguage | ( | ) |
Definition at line 222 of file ParserOptions.php.
References $mTargetLanguage.
ParserOptions::getTemplateCallback | ( | ) |
Definition at line 231 of file ParserOptions.php.
References $mTemplateCallback.
ParserOptions::getThumbSize | ( | ) |
Definition at line 237 of file ParserOptions.php.
References $mThumbSize, and optionUsed().
ParserOptions::getTidy | ( | ) |
Definition at line 220 of file ParserOptions.php.
References $mTidy.
ParserOptions::getTimestamp | ( | ) |
Definition at line 257 of file ParserOptions.php.
References $mTimestamp, and wfTimestampNow().
ParserOptions::getUser | ( | ) |
ParserOptions::getUserLang | ( | ) |
Same as getUserLangObj() but returns a string instead.
Definition at line 291 of file ParserOptions.php.
References getUserLangObj().
ParserOptions::getUserLangObj | ( | ) |
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 280 of file ParserOptions.php.
References $mUserLang, and optionUsed().
Referenced by getUserLang().
|
private |
Get user options.
Definition at line 406 of file ParserOptions.php.
References $user, global, wfProfileIn(), and wfProfileOut().
Referenced by __construct().
|
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 464 of file ParserOptions.php.
References array().
Referenced by ParserCache\getETag(), and ParserCache\getKey().
|
static |
Get a ParserOptions object from a IContextSource object.
$context | IContextSource object |
Definition at line 396 of file ParserOptions.php.
References IContextSource\getLanguage(), and IContextSource\getUser().
Referenced by ApiExpandTemplates\execute(), SpecialExpandTemplates\execute(), SpecialExpandTemplates\generateHtml(), RawAction\getRawText(), ContentHandler\makeParserOptions(), OutputPage\parserOptions(), and Preferences\profilePreferences().
|
static |
Get a ParserOptions object from a given user.
Language will be taken from $wgLang.
$user | User object |
Definition at line 375 of file ParserOptions.php.
References $user.
Referenced by CompareParsers\checkOptions(), PPFuzzTest\execute(), ParserCache\getKey(), DumpRenderer\handleRevision(), ContentHandler\makeParserOptions(), WikiPage\preSaveTransform(), ExtraParserTest\testLongNumericLinesDontKillTheParser(), and ParserMethodsTest\testPreSaveTransform().
Get a ParserOptions object from a given user and language.
Definition at line 386 of file ParserOptions.php.
References $user.
Referenced by ContentHandler\makeParserOptions(), WikiPage\prepareContentForEdit(), ExtraParserTest\setUp(), PreprocessorTest\setUp(), ParserPreloadTest\setUp(), MagicVariableTest\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.
Extensions which require it should install 'PageRenderingHash' hook, which will give them a chance to modify this key based on their own settings.
array | $forOptions | |
Title | $title | Used to get the content language of the page (since r97636) |
Definition at line 484 of file ParserOptions.php.
References $mExtraKey, $mStubThreshold, $mThumbSize, $title, $wgContLang, array(), getDateFormat(), getUser(), global, and wfRunHooks().
ParserOptions::optionUsed | ( | $optionName | ) |
Called when an option is accessed.
string | $optionName | name of the option |
Definition at line 452 of file ParserOptions.php.
Referenced by getDateFormat(), getIsPrintable(), getNumberHeadings(), getStubThreshold(), getThumbSize(), and getUserLangObj().
ParserOptions::registerWatcher | ( | $callback | ) |
Registers a callback for tracking which ParserOptions which are used.
This is a private API with the parser.
Definition at line 444 of file ParserOptions.php.
ParserOptions::setAllowExternalImages | ( | $x | ) |
Definition at line 296 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setAllowExternalImagesFrom | ( | $x | ) |
Definition at line 297 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setAllowSpecialInclusion | ( | $x | ) |
Definition at line 302 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setCleanSignatures | ( | $x | ) |
Definition at line 319 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setDateFormat | ( | $x | ) |
Definition at line 299 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setEditSection | ( | $x | ) |
Definition at line 300 of file ParserOptions.php.
References wfSetVar().
Referenced by Installer\__construct(), and MessageCache\getParserOptions().
ParserOptions::setEnableImageWhitelist | ( | $x | ) |
Definition at line 298 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setExpensiveParserFunctionLimit | ( | $x | ) |
Definition at line 314 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setExternalLinkTarget | ( | $x | ) |
Definition at line 320 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setInterfaceMessage | ( | $x | ) |
Definition at line 307 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setInterwikiMagic | ( | $x | ) |
Definition at line 295 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setIsPreview | ( | $x | ) |
Definition at line 333 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setIsPrintable | ( | $x | ) |
Definition at line 335 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setIsSectionPreview | ( | $x | ) |
Definition at line 334 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMaxGeneratedPPNodeCount | ( | $x | ) |
Definition at line 311 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMaxIncludeSize | ( | $x | ) |
Definition at line 309 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMaxPPNodeCount | ( | $x | ) |
Definition at line 310 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMaxTemplateDepth | ( | $x | ) |
Definition at line 312 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setNumberHeadings | ( | $x | ) |
Definition at line 301 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setPreSaveTransform | ( | $x | ) |
Definition at line 331 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setRemoveComments | ( | $x | ) |
Definition at line 315 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setSkin | ( | $x | ) |
ParserOptions::setStubThreshold | ( | $x | ) |
Definition at line 330 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTargetLanguage | ( | $x | ) |
Definition at line 308 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTemplateCallback | ( | $x | ) |
Definition at line 316 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setThumbSize | ( | $x | ) |
Definition at line 329 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTidy | ( | $x | ) |
Definition at line 303 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTimestamp | ( | $x | ) |
Definition at line 318 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setUserLang | ( | $x | ) |
Definition at line 323 of file ParserOptions.php.
References Language\factory(), and wfSetVar().
ParserOptions::$mAllowExternalImages |
Allow external images inline?
Definition at line 41 of file ParserOptions.php.
Referenced by getAllowExternalImages().
ParserOptions::$mAllowExternalImagesFrom |
If not, any exception?
Definition at line 46 of file ParserOptions.php.
Referenced by getAllowExternalImagesFrom().
ParserOptions::$mAllowSpecialInclusion |
Allow inclusion of special pages?
Definition at line 66 of file ParserOptions.php.
Referenced by getAllowSpecialInclusion().
ParserOptions::$mCleanSignatures |
Clean up signature texts?
1) Strip ~~~, ~~~~ and ~~~~~ out of signatures 2) Substitute all transclusions
Definition at line 145 of file ParserOptions.php.
Referenced by getCleanSignatures().
ParserOptions::$mDateFormat = null |
ParserOptions::$mDisableContentConversion |
Whether content conversion should be disabled.
Definition at line 155 of file ParserOptions.php.
Referenced by getDisableContentConversion().
ParserOptions::$mDisableTitleConversion |
Whether title conversion should be disabled.
Definition at line 160 of file ParserOptions.php.
Referenced by getDisableTitleConversion().
ParserOptions::$mEditSection = true |
Create "edit section" links?
Definition at line 61 of file ParserOptions.php.
Referenced by getEditSection().
ParserOptions::$mEnableImageWhitelist |
If not or it doesn't match, should we check an on-wiki whitelist?
Definition at line 51 of file ParserOptions.php.
Referenced by getEnableImageWhitelist().
ParserOptions::$mEnableLimitReport = false |
Enable limit report in an HTML comment on output.
Definition at line 127 of file ParserOptions.php.
Referenced by getEnableLimitReport().
ParserOptions::$mExpensiveParserFunctionLimit |
Maximum number of calls per parse to expensive parser functions.
Definition at line 111 of file ParserOptions.php.
Referenced by getExpensiveParserFunctionLimit().
ParserOptions::$mExternalLinkTarget |
Target attribute for external links.
Definition at line 137 of file ParserOptions.php.
Referenced by getExternalLinkTarget().
ParserOptions::$mExtraKey = '' |
Extra key that should be present in the caching key.
Definition at line 205 of file ParserOptions.php.
Referenced by optionsHash().
ParserOptions::$mInterfaceMessage = false |
Which lang to call for PLURAL and GRAMMAR.
Definition at line 76 of file ParserOptions.php.
Referenced by getInterfaceMessage().
ParserOptions::$mInterwikiMagic |
Interlanguage links are removed and returned in an array.
Definition at line 36 of file ParserOptions.php.
Referenced by getInterwikiMagic().
ParserOptions::$mIsPreview = false |
Parsing the page for a "preview" operation?
Definition at line 190 of file ParserOptions.php.
Referenced by getIsPreview().
ParserOptions::$mIsPrintable = false |
Parsing the printable version of the page?
Definition at line 200 of file ParserOptions.php.
Referenced by getIsPrintable().
ParserOptions::$mIsSectionPreview = false |
Parsing the page for a "preview" operation on a single section?
Definition at line 195 of file ParserOptions.php.
Referenced by getIsSectionPreview().
ParserOptions::$mMaxGeneratedPPNodeCount |
Maximum number of nodes generated by Preprocessor::preprocessToObj()
Definition at line 96 of file ParserOptions.php.
Referenced by getMaxGeneratedPPNodeCount().
ParserOptions::$mMaxIncludeSize |
Maximum size of template expansions, in bytes.
Definition at line 86 of file ParserOptions.php.
Referenced by getMaxIncludeSize().
ParserOptions::$mMaxPPExpandDepth |
Maximum recursion depth in PPFrame::expand()
Definition at line 101 of file ParserOptions.php.
Referenced by getMaxPPExpandDepth().
ParserOptions::$mMaxPPNodeCount |
Maximum number of nodes touched by PPFrame::expand()
Definition at line 91 of file ParserOptions.php.
Referenced by getMaxPPNodeCount().
ParserOptions::$mMaxTemplateDepth |
Maximum recursion depth for templates within templates.
Definition at line 106 of file ParserOptions.php.
Referenced by getMaxTemplateDepth().
ParserOptions::$mNumberHeadings |
Automatically number headings?
Definition at line 165 of file ParserOptions.php.
Referenced by getNumberHeadings().
ParserOptions::$mPreSaveTransform = true |
Transform wiki markup when saving the page?
Definition at line 150 of file ParserOptions.php.
Referenced by getPreSaveTransform().
ParserOptions::$mRemoveComments = true |
Remove HTML comments.
ONLY APPLIES TO PREPROCESS OPERATIONS
Definition at line 116 of file ParserOptions.php.
Referenced by getRemoveComments().
|
private |
Maximum article size of an article to be marked as "stub".
Definition at line 175 of file ParserOptions.php.
Referenced by getStubThreshold(), and optionsHash().
ParserOptions::$mTargetLanguage = null |
Overrides $mInterfaceMessage with arbitrary language.
Definition at line 81 of file ParserOptions.php.
Referenced by getTargetLanguage().
ParserOptions::$mTemplateCallback |
Callback for template fetching.
Used as first argument to call_user_func().
Definition at line 121 of file ParserOptions.php.
Referenced by getTemplateCallback().
ParserOptions::$mThumbSize |
Thumb size preferred by the user.
Definition at line 170 of file ParserOptions.php.
Referenced by getThumbSize(), and optionsHash().
ParserOptions::$mTidy = false |
Use tidy to cleanup output HTML?
Definition at line 71 of file ParserOptions.php.
Referenced by getTidy().
ParserOptions::$mTimestamp |
Timestamp used for {{CURRENTDAY}} etc.
Definition at line 132 of file ParserOptions.php.
Referenced by getTimestamp().
User ParserOptions::$mUser |
ParserOptions::$mUserLang |
Language object of the User language.
Definition at line 180 of file ParserOptions.php.
Referenced by getUserLangObj().
|
protected |
Function to be called when an option is accessed.
Definition at line 210 of file ParserOptions.php.