124 [
'Parser',
'statelessFetchRevision' ];
130 [
'Parser',
'statelessFetchTemplate' ];
387 if ( !isset( $this->mDateFormat ) ) {
388 $this->mDateFormat = $this->mUser->getDatePreference();
394 if ( !isset( $this->mTimestamp ) ) {
461 return wfSetVar( $this->mInterwikiMagic, $x );
465 return wfSetVar( $this->mAllowExternalImages, $x );
469 return wfSetVar( $this->mAllowExternalImagesFrom, $x );
473 return wfSetVar( $this->mEnableImageWhitelist, $x );
477 return wfSetVar( $this->mDateFormat, $x );
481 return wfSetVar( $this->mEditSection, $x );
485 return wfSetVar( $this->mNumberHeadings, $x );
489 return wfSetVar( $this->mAllowSpecialInclusion, $x );
493 return wfSetVar( $this->mTidy, $x );
497 return wfSetVar( $this->mInterfaceMessage, $x );
501 return wfSetVar( $this->mTargetLanguage, $x,
true );
505 return wfSetVar( $this->mMaxIncludeSize, $x );
509 return wfSetVar( $this->mMaxPPNodeCount, $x );
513 return wfSetVar( $this->mMaxGeneratedPPNodeCount, $x );
517 return wfSetVar( $this->mMaxTemplateDepth, $x );
522 return wfSetVar( $this->mExpensiveParserFunctionLimit, $x );
526 return wfSetVar( $this->mRemoveComments, $x );
531 return wfSetVar( $this->mCurrentRevisionCallback, $x );
536 return wfSetVar( $this->mSpeculativeRevIdCallback, $x );
540 return wfSetVar( $this->mTemplateCallback, $x );
544 return wfSetVar( $this->mEnableLimitReport, $x );
548 return wfSetVar( $this->mTimestamp, $x );
552 return wfSetVar( $this->mCleanSignatures, $x );
556 return wfSetVar( $this->mExternalLinkTarget, $x );
560 return wfSetVar( $this->mDisableContentConversion, $x );
564 return wfSetVar( $this->mDisableTitleConversion, $x );
568 if ( is_string( $x ) ) {
572 return wfSetVar( $this->mUserLang, $x );
576 return wfSetVar( $this->mThumbSize, $x );
580 return wfSetVar( $this->mStubThreshold, $x );
584 return wfSetVar( $this->mPreSaveTransform, $x );
588 return wfSetVar( $this->mIsPreview, $x );
592 return wfSetVar( $this->mIsSectionPreview, $x );
596 return wfSetVar( $this->mIsPrintable, $x );
610 $this->redirectTarget =
$title;
628 $this->mExtraKey .=
'!' . $key;
637 if (
$user === null ) {
639 if ( $wgUser === null ) {
645 if (
$lang === null ) {
705 $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion,
707 $wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
713 $this->mAllowExternalImages = $wgAllowExternalImages;
714 $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom;
715 $this->mEnableImageWhitelist = $wgEnableImageWhitelist;
716 $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
717 $this->mMaxIncludeSize = $wgMaxArticleSize * 1024;
718 $this->mMaxPPNodeCount = $wgMaxPPNodeCount;
719 $this->mMaxGeneratedPPNodeCount = $wgMaxGeneratedPPNodeCount;
720 $this->mMaxPPExpandDepth = $wgMaxPPExpandDepth;
721 $this->mMaxTemplateDepth = $wgMaxTemplateDepth;
722 $this->mExpensiveParserFunctionLimit = $wgExpensiveParserFunctionLimit;
723 $this->mCleanSignatures = $wgCleanSignatures;
724 $this->mExternalLinkTarget = $wgExternalLinkTarget;
727 $this->mMagicISBNLinks = $wgEnableMagicLinks[
'ISBN'];
728 $this->mMagicPMIDLinks = $wgEnableMagicLinks[
'PMID'];
729 $this->mMagicRFCLinks = $wgEnableMagicLinks[
'RFC'];
731 $this->mUser =
$user;
732 $this->mNumberHeadings =
$user->getOption(
'numberheadings' );
733 $this->mThumbSize =
$user->getOption(
'thumbsize' );
734 $this->mStubThreshold =
$user->getStubThreshold();
735 $this->mUserLang =
$lang;
749 $fields = array_keys( get_class_vars( __CLASS__ ) );
750 $fields = array_diff( $fields, [
751 'mEnableLimitReport',
754 foreach ( $fields
as $field ) {
755 if ( !is_object( $this->$field ) && $this->$field !== $other->$field ) {
761 $this->mUserLang->equals( $other->mUserLang ) &&
772 $this->onAccessCallback = $callback;
784 if ( $this->onAccessCallback ) {
785 call_user_func( $this->onAccessCallback, $optionName );
833 if ( in_array(
'stubthreshold', $forOptions ) ) {
839 if ( in_array(
'dateformat', $forOptions ) ) {
843 if ( in_array(
'numberheadings', $forOptions ) ) {
844 $confstr .=
'!' . ( $this->mNumberHeadings ?
'1' :
'' );
849 if ( in_array(
'userlang', $forOptions ) ) {
850 $confstr .=
'!' . $this->mUserLang->getCode();
855 if ( in_array(
'thumbsize', $forOptions ) ) {
863 if ( !is_null(
$title ) ) {
864 $confstr .=
$title->getPageLanguage()->getExtraHashOptions();
867 $confstr .= $wgContLang->getExtraHashOptions();
876 if ( !in_array(
'editsection', $forOptions ) ) {
878 } elseif ( !$this->mEditSection ) {
879 $confstr .=
'!edit=0';
882 if ( $this->mIsPrintable && in_array(
'printable', $forOptions ) ) {
883 $confstr .=
'!printable=1';
886 if ( $this->mExtraKey !=
'' ) {
892 Hooks::run(
'PageRenderingHash', [ &$confstr, $this->
getUser(), &$forOptions ] );
895 $confstr = str_replace(
' ',
'_', $confstr );
915 if ( $titleToCheck->equals(
$title ) ) {
917 'page' =>
$title->getArticleID(),
918 'user_text' =>
$user->getName(),
919 'user' =>
$user->getId(),
920 'parent_id' =>
$title->getLatestRevID(),
925 return call_user_func( $oldCallback, $titleToCheck,
$parser );
931 $wgHooks[
'TitleExists'][] =
932 function ( $titleToCheck, &$exists )
use (
$title ) {
933 if ( $titleToCheck->equals(
$title ) ) {
937 end( $wgHooks[
'TitleExists'] );
938 $key =
key( $wgHooks[
'TitleExists'] );
940 return new ScopedCallback(
function ()
use (
$title, $key ) {
942 unset( $wgHooks[
'TitleExists'][$key] );
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
$mMagicRFCLinks
Are magic RFC links enabled?
Interface for objects which can provide a MediaWiki context on request.
$wgMaxArticleSize
Maximum article size in kilobytes.
callable $mTemplateCallback
Callback for template fetching; first argument to call_user_func().
$mIsSectionPreview
Parsing the page for a "preview" operation on a single section?
static legacyOptions()
Returns the full array of options that would have been used by in 1.16.
disableTitleConversion($x=true)
$mAllowExternalImagesFrom
If not, any exception?
$mMaxGeneratedPPNodeCount
Maximum number of nodes generated by Preprocessor::preprocessToObj()
$mDateFormat
Date format index.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$mIsPreview
Parsing the page for a "preview" operation?
Set options of the Parser.
if(!isset($args[0])) $lang
setAllowSpecialInclusion($x)
static newFromUserAndLang(User $user, Language $lang)
Get a ParserOptions object from a given user and language.
initialiseFromUser($user, $lang)
Get user options.
setupFakeRevision($title, $content, $user)
Sets a hook to force that a page exists, and sets a current revision callback to return a revision wi...
$mExternalLinkTarget
Target attribute for external links.
getCurrentRevisionCallback()
getSpeculativeRevIdCallback()
setSpeculativeRevIdCallback($x)
$wgHooks['ArticleShow'][]
when a variable name is used in a it is silently declared as a new local masking the global
$mMagicISBNLinks
Are magic ISBN links enabled?
static newFromUser($user)
Get a ParserOptions object from a given user.
User $mUser
Stored user object.
Title null $redirectTarget
If the page being parsed is a redirect, this should hold the redirect target.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
$mStubThreshold
Maximum article size of an article to be marked as "stub".
$mTimestamp
Timestamp used for {{CURRENTDAY}} etc.
callable null $mSpeculativeRevIdCallback
Callback to generate a guess for {{REVISIONID}}.
$mMaxTemplateDepth
Maximum recursion depth for templates within templates.
$mTargetLanguage
Overrides $mInterfaceMessage with arbitrary language.
getUser()
Get the User object.
getAllowSpecialInclusion()
$wgRenderHashAppend
Append a configured value to the parser cache and the sitenotice key so that they can be kept separat...
static singleton()
Get an instance of this class.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
$mRemoveComments
Remove HTML comments.
$mAllowSpecialInclusion
Allow inclusion of special pages?
$mCleanSignatures
Clean up signature texts?
setEnableImageWhitelist($x)
registerWatcher($callback)
Registers a callback for tracking which ParserOptions which are used.
getRedirectTarget()
Get the previously-set redirect target.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
callable $mCurrentRevisionCallback
Callback for current revision fetching; first argument to call_user_func().
$mMaxPPNodeCount
Maximum number of nodes touched by PPFrame::expand()
$mIsPrintable
Parsing the printable version of the page?
getUserLangObj()
Get the user language used by the parser for this page and split the parser cache.
$mPreSaveTransform
Transform wiki markup when saving the page?
$wgDisableTitleConversion
Whether to enable language variant conversion for links.
$mInterfaceMessage
Which lang to call for PLURAL and GRAMMAR.
namespace and then decline to actually register it file or subcat img or subcat $title
$wgInterwikiMagic
Treat language links as magic connectors, not inline links.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getUserLang()
Same as getUserLangObj() but returns a string instead.
setAllowExternalImages($x)
getLanguage()
Get the Language object.
$mDisableTitleConversion
Whether title conversion should be disabled.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
$wgDisableLangConversion
Whether to enable language variant conversion.
static newFromAnon()
Get a ParserOptions object for an anonymous user.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
$mMagicPMIDLinks
Are magic PMID links enabled?
setRedirectTarget($title)
Set the redirect target.
$mInterwikiMagic
Interlanguage links are removed and returned in an array.
disableContentConversion($x=true)
$mExpensiveParserFunctionLimit
Maximum number of calls per parse to expensive parser functions.
setAllowExternalImagesFrom($x)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
$mMaxIncludeSize
Maximum size of template expansions, in bytes.
$onAccessCallback
Function to be called when an option is accessed.
$mDisableContentConversion
Whether content conversion should be disabled.
$mExtraKey
Extra key that should be present in the caching key.
$mEnableLimitReport
Enable limit report in an HTML comment on output.
getEnableImageWhitelist()
enableLimitReport($x=true)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
setMaxGeneratedPPNodeCount($x)
$mUserLang
Language object of the User language.
$mMaxPPExpandDepth
Maximum recursion depth in PPFrame::expand()
addExtraKey($key)
Extra key that should be present in the parser cache key.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
$mEditSection
Create "edit section" links?
$mAllowExternalImages
Allow external images inline?
getDisableTitleConversion()
setExternalLinkTarget($x)
static factory($code)
Get a cached or new language object for a given language code.
$mTidy
Use tidy to cleanup output HTML?
optionsHash($forOptions, $title=null)
Generate a hash string with the values set on these ParserOptions for the keys given in the array...
$mThumbSize
Thumb size preferred by the user.
$mEnableImageWhitelist
If not or it doesn't match, should we check an on-wiki whitelist?
setCurrentRevisionCallback($x)
__construct($user=null, $lang=null)
Constructor.
static isRealObject($obj)
Returns a bool value whenever $obj is a stub object.
setExpensiveParserFunctionLimit($x)
optionUsed($optionName)
Called when an option is accessed.
matches(ParserOptions $other)
Check if these options match that of another options set.
getAllowExternalImagesFrom()
getDisableContentConversion()
$mNumberHeadings
Automatically number headings?
getExpensiveParserFunctionLimit()
getMaxGeneratedPPNodeCount()