MediaWiki
REL1_19
|
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. | |
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". |
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.
ParserOptions::__construct | ( | $ | user = null , |
$ | lang = null |
||
) |
Constructor.
Definition at line 322 of file ParserOptions.php.
References $user, $wgLang, $wgUser, initialiseFromUser(), and StubObject\isRealObject().
ParserOptions::addExtraKey | ( | $ | key | ) |
Extra key that should be present in the parser cache key.
Definition at line 313 of file ParserOptions.php.
ParserOptions::enableLimitReport | ( | $ | x = true | ) |
Definition at line 291 of file ParserOptions.php.
References wfSetVar().
Definition at line 190 of file ParserOptions.php.
Definition at line 191 of file ParserOptions.php.
Definition at line 196 of file ParserOptions.php.
Definition at line 207 of file ParserOptions.php.
Definition at line 233 of file ParserOptions.php.
References optionUsed().
Referenced by optionsHash().
Definition at line 193 of file ParserOptions.php.
Definition at line 192 of file ParserOptions.php.
Definition at line 206 of file ParserOptions.php.
Definition at line 208 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().
Definition at line 217 of file ParserOptions.php.
Definition at line 209 of file ParserOptions.php.
References optionUsed().
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().
Definition at line 221 of file ParserOptions.php.
Referenced by Parser\preSaveTransform().
Definition at line 204 of file ParserOptions.php.
ParserOptions::getSkin | ( | $ | title = null | ) |
$title | Title |
Definition at line 228 of file ParserOptions.php.
References wfDeprecated().
Definition at line 213 of file ParserOptions.php.
References optionUsed().
Referenced by WikiPage\getParserOutput(), and WikiPage\isParserCacheUsed().
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().
Definition at line 197 of file ParserOptions.php.
Definition at line 241 of file ParserOptions.php.
References wfTimestampNow().
Definition at line 188 of file ParserOptions.php.
Definition at line 220 of file ParserOptions.php.
Referenced by Parser\testPst().
Same as getUserLangObj() but returns a string instead.
Definition at line 267 of file ParserOptions.php.
References getUserLangObj().
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).
Definition at line 256 of file ParserOptions.php.
References optionUsed().
Referenced by getUserLang().
ParserOptions::initialiseFromUser | ( | $ | user, |
$ | lang | ||
) | [private] |
Get user options.
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().
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().
static ParserOptions::newFromContext | ( | IContextSource $ | context | ) | [static] |
Get a ParserOptions object from a IContextSource object.
$context | IContextSource object |
Definition at line 369 of file ParserOptions.php.
References IContextSource\getLanguage(), and IContextSource\getUser().
Referenced by ApiParse\execute(), ApiExpandTemplates\execute(), ApiPurge\execute(), ApiQueryRevisions\extractRowInfo(), RawAction\getRawText(), OutputPage\parserOptions(), Preferences\profilePreferences(), DifferenceEngine\renderNewRevision(), ParserTest\runTest(), 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 348 of file ParserOptions.php.
References $user.
Referenced by CompareParsers\checkOptions(), PPFuzzTest\execute(), ParserTest\fuzzTest(), ParserCache\getKey(), EditPage\getPreloadedText(), EditPage\getPreviewText(), DumpRenderer\handleRevision(), WikiPage\makeParserOptions(), WikiPage\preSaveTransform(), ExtraParserTest\testBug8689(), NewParserTest\testFuzzTests(), and WikiPage\useParserCache().
static ParserOptions::newFromUserAndLang | ( | User $ | user, |
Language $ | lang | ||
) | [static] |
Get a ParserOptions object from a given user and language.
Definition at line 359 of file ParserOptions.php.
Referenced by WikiPage\makeParserOptions(), WikiPage\prepareTextForEdit(), RefreshLinksJob\run(), RefreshLinksJob2\run(), ParserOptionsTest\setUp(), and EditPage\showDiff().
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 459 of file ParserOptions.php.
References $title, $wgContLang, $wgRenderHashAppend, getDateFormat(), and wfRunHooks().
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().
ParserOptions::registerWatcher | ( | $ | callback | ) |
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().
Definition at line 274 of file ParserOptions.php.
References wfSetVar().
Definition at line 279 of file ParserOptions.php.
References wfSetVar().
Definition at line 293 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setDateFormat | ( | $ | x | ) |
Definition at line 276 of file ParserOptions.php.
References wfSetVar().
Definition at line 277 of file ParserOptions.php.
References wfSetVar().
Referenced by Installer\__construct().
Definition at line 275 of file ParserOptions.php.
References wfSetVar().
Definition at line 294 of file ParserOptions.php.
References wfSetVar().
Definition at line 284 of file ParserOptions.php.
References wfSetVar().
Definition at line 272 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setIsPreview | ( | $ | x | ) |
Definition at line 306 of file ParserOptions.php.
References wfSetVar().
Definition at line 308 of file ParserOptions.php.
References wfSetVar().
Definition at line 307 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setMath | ( | $ | x | ) |
Definition at line 295 of file ParserOptions.php.
References wfSetVar().
Definition at line 286 of file ParserOptions.php.
References wfSetVar().
Definition at line 287 of file ParserOptions.php.
References wfSetVar().
Definition at line 288 of file ParserOptions.php.
References wfSetVar().
Definition at line 278 of file ParserOptions.php.
References wfSetVar().
Definition at line 304 of file ParserOptions.php.
References wfSetVar().
Definition at line 289 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setSkin | ( | $ | x | ) |
Definition at line 283 of file ParserOptions.php.
References wfDeprecated().
Definition at line 303 of file ParserOptions.php.
References wfSetVar().
Definition at line 285 of file ParserOptions.php.
References wfSetVar().
Definition at line 290 of file ParserOptions.php.
References wfSetVar().
Referenced by ExtraParserTest\setUp().
ParserOptions::setThumbSize | ( | $ | x | ) |
Definition at line 302 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTidy | ( | $ | x | ) |
Definition at line 280 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setTimestamp | ( | $ | x | ) |
Definition at line 292 of file ParserOptions.php.
References wfSetVar().
Definition at line 271 of file ParserOptions.php.
References wfSetVar().
ParserOptions::setUserLang | ( | $ | x | ) |
Definition at line 296 of file ParserOptions.php.
References Language\factory(), and wfSetVar().
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 |
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.