MediaWiki master
MediaWiki\Parser\Parsoid\Config\SiteConfig Class Reference

Site-level configuration for Parsoid. More...

Inherits ISiteConfig.

Collaboration diagram for MediaWiki\Parser\Parsoid\Config\SiteConfig:

Public Member Functions

 __construct (private readonly ServiceOptions $config, private readonly array $parsoidSettings, private readonly ObjectFactory $objectFactory, private readonly Language $contLang, private readonly StatsdDataFactoryInterface $stats, private readonly StatsFactory $statsFactory, private readonly MagicWordFactory $magicWordFactory, private readonly NamespaceInfo $namespaceInfo, private readonly SpecialPageFactory $specialPageFactory, private readonly InterwikiLookup $interwikiLookup, private readonly UserOptionsLookup $userOptionsLookup, private readonly LanguageFactory $languageFactory, private readonly LanguageConverterFactory $languageConverterFactory, private readonly LanguageNameUtils $languageNameUtils, private readonly UrlUtils $urlUtils, private readonly IContentHandlerFactory $contentHandlerFactory, private readonly array $extensionParsoidModules, private readonly ParserFactory $parserFactory, private readonly Config $mwConfig, private readonly bool $isTimedMediaHandlerLoaded,)
 
 allowedExternalImagePrefixes ()
 
 baseURI ()
 
 bswRegexp ()
 
 canonicalNamespaceId (string $name)
 
 categoryRegexp ()
 
 clearDeprecationFilters ()
 
 deprecated (string $function, string $version, int $callerOffset=2)
 
 exportMetadataToHeadBcp47 (Document $document, ContentMetadataCollector $metadata, string $defaultTitle, Bcp47Code $lang)
 
 filterDeprecationForTest (string $regex)
 
 galleryOptions ()
 
 getAsyncFallbackMessageKey ()
 Return the localization key we should use for asynchronous fallback content.
 
 getExternalLinkTarget ()
 
 getHistogramBuckets (float $mean, int $skip)
 Generate buckets based on skip and mean.
 
 getLogger ()
 
 getMagicWordMatcher (string $id)
 
 getMaxTemplateDepth ()
 
 getMWConfigValue (string $key)
 Lookup config.
 
 getNoFollowConfig ()
 
 getObjectFactory ()
 
 getParameterizedAliasMatcher (array $words)
 
 incrementCounter (string $name, array $labels, float $amount=1)
 Increment a counter metric.
 
 interwikiMagic ()
 
 interwikiMap ()
 
 iwp ()
 
 langBcp47 ()
 
 langConverterEnabledBcp47 (Bcp47Code $lang)
 
 legalTitleChars ()
 
 linkPrefixRegex ()
 
 magicLinkEnabled (string $which)
 
 mainpage ()
 
 mainPageLinkTarget ()
 
 metrics ()
 
 namespaceCase (int $ns)
 
 namespaceHasSubpages (int $ns)
 
 namespaceId (string $name)
 
 namespaceIsTalk (int $ns)
 
 namespaceName (int $ns)
 
 observeHistogram (string $name, float $value, array $buckets, array $labels)
 Record a histogram metric.
 
 observeTiming (string $name, float $value, array $labels)
 Record a timing metric.
 
 prefixedStatsFactory ()
 Create a prefixed StatsFactory for parsoid stats.
 
 redirectRegexp ()
 
 relativeLinkPrefix ()
 
 rtl ()
 
 script ()
 
 scriptpath ()
 
 server ()
 
 setMaxTemplateDepth (int $depth)
 Overrides the max template depth in the MediaWiki configuration.
 
 specialPageLocalName (string $alias)
 
 supportsContentModel (string $model)
 Returns true iff Parsoid natively supports the given content model.
 
 timezoneOffset ()
 
 ucfirst (string $str)
 
 variants ()
 Language variant information.
 
 variantsFor (Bcp47Code $code)
 Language variant information for the given language (or null if unknown).
 
 widthOption ()
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Protected Member Functions

 getDoubleUnderscoreIDs ()
 Return list of magic word IDs used for behavior switches.
 
 getFunctionSynonyms ()
 
 getMagicWords ()
 
 getNonNativeExtensionTags ()
 
 getProtocols ()
 
 getSpecialNSAliases ()
 
 getSpecialPageAliases (string $specialPage)
 
 getVariableIDs ()
 Return list of magic word IDs used for magic variables (memoized zero-argument parser functions).
 
 linkTrail ()
 
 shouldValidateExtConfig ()
 

Detailed Description

Site-level configuration for Parsoid.

This includes both global configuration and wiki-level configuration.

Since
1.39
Access: internal

Definition at line 59 of file SiteConfig.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Parsoid\Config\SiteConfig::__construct ( private readonly ServiceOptions $config,
private readonly array $parsoidSettings,
private readonly ObjectFactory $objectFactory,
private readonly Language $contLang,
private readonly StatsdDataFactoryInterface $stats,
private readonly StatsFactory $statsFactory,
private readonly MagicWordFactory $magicWordFactory,
private readonly NamespaceInfo $namespaceInfo,
private readonly SpecialPageFactory $specialPageFactory,
private readonly InterwikiLookup $interwikiLookup,
private readonly UserOptionsLookup $userOptionsLookup,
private readonly LanguageFactory $languageFactory,
private readonly LanguageConverterFactory $languageConverterFactory,
private readonly LanguageNameUtils $languageNameUtils,
private readonly UrlUtils $urlUtils,
private readonly IContentHandlerFactory $contentHandlerFactory,
private readonly array $extensionParsoidModules,
private readonly ParserFactory $parserFactory,
private readonly Config $mwConfig,
private readonly bool $isTimedMediaHandlerLoaded )

Definition at line 94 of file SiteConfig.php.

Member Function Documentation

◆ allowedExternalImagePrefixes()

MediaWiki\Parser\Parsoid\Config\SiteConfig::allowedExternalImagePrefixes ( )

Definition at line 242 of file SiteConfig.php.

◆ baseURI()

MediaWiki\Parser\Parsoid\Config\SiteConfig::baseURI ( )

Definition at line 290 of file SiteConfig.php.

◆ bswRegexp()

MediaWiki\Parser\Parsoid\Config\SiteConfig::bswRegexp ( )

Definition at line 339 of file SiteConfig.php.

◆ canonicalNamespaceId()

MediaWiki\Parser\Parsoid\Config\SiteConfig::canonicalNamespaceId ( string $name)

Definition at line 349 of file SiteConfig.php.

◆ categoryRegexp()

MediaWiki\Parser\Parsoid\Config\SiteConfig::categoryRegexp ( )

Definition at line 325 of file SiteConfig.php.

References NS_CATEGORY.

◆ clearDeprecationFilters()

MediaWiki\Parser\Parsoid\Config\SiteConfig::clearDeprecationFilters ( )

Definition at line 836 of file SiteConfig.php.

◆ deprecated()

MediaWiki\Parser\Parsoid\Config\SiteConfig::deprecated ( string $function,
string $version,
int $callerOffset = 2 )

Definition at line 826 of file SiteConfig.php.

◆ exportMetadataToHeadBcp47()

MediaWiki\Parser\Parsoid\Config\SiteConfig::exportMetadataToHeadBcp47 ( Document $document,
ContentMetadataCollector $metadata,
string $defaultTitle,
Bcp47Code $lang )

Parameters
Document$document
ContentMetadataCollector$metadata
string$defaultTitle
Bcp47Code$lang

Definition at line 540 of file SiteConfig.php.

◆ filterDeprecationForTest()

MediaWiki\Parser\Parsoid\Config\SiteConfig::filterDeprecationForTest ( string $regex)

Definition at line 831 of file SiteConfig.php.

◆ galleryOptions()

MediaWiki\Parser\Parsoid\Config\SiteConfig::galleryOptions ( )

Definition at line 238 of file SiteConfig.php.

◆ getAsyncFallbackMessageKey()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getAsyncFallbackMessageKey ( )

Return the localization key we should use for asynchronous fallback content.

Definition at line 793 of file SiteConfig.php.

◆ getDoubleUnderscoreIDs()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getDoubleUnderscoreIDs ( )
protected

Return list of magic word IDs used for behavior switches.

Returns
list<string>

Definition at line 663 of file SiteConfig.php.

◆ getExternalLinkTarget()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getExternalLinkTarget ( )
Returns
string|false

Definition at line 785 of file SiteConfig.php.

◆ getFunctionSynonyms()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getFunctionSynonyms ( )
protected

Definition at line 668 of file SiteConfig.php.

◆ getHistogramBuckets()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getHistogramBuckets ( float $mean,
int $skip )

Generate buckets based on skip and mean.

Parameters
float$mean
int$skip
Returns
float[]

Definition at line 221 of file SiteConfig.php.

◆ getLogger()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getLogger ( )

Definition at line 146 of file SiteConfig.php.

◆ getMagicWordMatcher()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getMagicWordMatcher ( string $id)

Definition at line 678 of file SiteConfig.php.

◆ getMagicWords()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getMagicWords ( )
protected
Returns
array<string,array> $magicWord => [ int $caseSensitive, string ...$alias ]

Definition at line 673 of file SiteConfig.php.

◆ getMaxTemplateDepth()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getMaxTemplateDepth ( )

Definition at line 723 of file SiteConfig.php.

◆ getMWConfigValue()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getMWConfigValue ( string $key)

Lookup config.

Parameters
string$key
Returns
mixed config value for $key, if present or null, if not.

Definition at line 500 of file SiteConfig.php.

◆ getNoFollowConfig()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getNoFollowConfig ( )

Definition at line 776 of file SiteConfig.php.

◆ getNonNativeExtensionTags()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getNonNativeExtensionTags ( )
protected

Definition at line 708 of file SiteConfig.php.

◆ getObjectFactory()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getObjectFactory ( )

Definition at line 141 of file SiteConfig.php.

◆ getParameterizedAliasMatcher()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getParameterizedAliasMatcher ( array $words)

Definition at line 683 of file SiteConfig.php.

◆ getProtocols()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getProtocols ( )
protected

Definition at line 772 of file SiteConfig.php.

◆ getSpecialNSAliases()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getSpecialNSAliases ( )
protected

Definition at line 746 of file SiteConfig.php.

References NS_SPECIAL.

◆ getSpecialPageAliases()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getSpecialPageAliases ( string $specialPage)
protected

Definition at line 765 of file SiteConfig.php.

◆ getVariableIDs()

MediaWiki\Parser\Parsoid\Config\SiteConfig::getVariableIDs ( )
protected

Return list of magic word IDs used for magic variables (memoized zero-argument parser functions).

Returns
list<string>

Definition at line 655 of file SiteConfig.php.

◆ incrementCounter()

MediaWiki\Parser\Parsoid\Config\SiteConfig::incrementCounter ( string $name,
array $labels,
float $amount = 1 )

Increment a counter metric.

Parameters
string$name
array$labels
float$amount
Returns
void

Definition at line 232 of file SiteConfig.php.

◆ interwikiMagic()

MediaWiki\Parser\Parsoid\Config\SiteConfig::interwikiMagic ( )

Definition at line 391 of file SiteConfig.php.

◆ interwikiMap()

MediaWiki\Parser\Parsoid\Config\SiteConfig::interwikiMap ( )

Definition at line 401 of file SiteConfig.php.

◆ iwp()

MediaWiki\Parser\Parsoid\Config\SiteConfig::iwp ( )

Definition at line 461 of file SiteConfig.php.

◆ langBcp47()

MediaWiki\Parser\Parsoid\Config\SiteConfig::langBcp47 ( )

Definition at line 481 of file SiteConfig.php.

◆ langConverterEnabledBcp47()

MediaWiki\Parser\Parsoid\Config\SiteConfig::langConverterEnabledBcp47 ( Bcp47Code $lang)

Definition at line 508 of file SiteConfig.php.

◆ legalTitleChars()

MediaWiki\Parser\Parsoid\Config\SiteConfig::legalTitleChars ( )

Definition at line 465 of file SiteConfig.php.

◆ linkPrefixRegex()

MediaWiki\Parser\Parsoid\Config\SiteConfig::linkPrefixRegex ( )

Definition at line 469 of file SiteConfig.php.

◆ linkTrail()

MediaWiki\Parser\Parsoid\Config\SiteConfig::linkTrail ( )
protected

Definition at line 477 of file SiteConfig.php.

◆ magicLinkEnabled()

MediaWiki\Parser\Parsoid\Config\SiteConfig::magicLinkEnabled ( string $which)

Definition at line 396 of file SiteConfig.php.

◆ mainpage()

MediaWiki\Parser\Parsoid\Config\SiteConfig::mainpage ( )

Definition at line 485 of file SiteConfig.php.

◆ mainPageLinkTarget()

MediaWiki\Parser\Parsoid\Config\SiteConfig::mainPageLinkTarget ( )

Definition at line 490 of file SiteConfig.php.

◆ metrics()

MediaWiki\Parser\Parsoid\Config\SiteConfig::metrics ( )

Definition at line 167 of file SiteConfig.php.

Referenced by MediaWiki\Rest\Handler\ParsoidHandler\__construct().

◆ namespaceCase()

MediaWiki\Parser\Parsoid\Config\SiteConfig::namespaceCase ( int $ns)

Definition at line 371 of file SiteConfig.php.

◆ namespaceHasSubpages()

MediaWiki\Parser\Parsoid\Config\SiteConfig::namespaceHasSubpages ( int $ns)

Definition at line 366 of file SiteConfig.php.

◆ namespaceId()

MediaWiki\Parser\Parsoid\Config\SiteConfig::namespaceId ( string $name)

Definition at line 354 of file SiteConfig.php.

◆ namespaceIsTalk()

MediaWiki\Parser\Parsoid\Config\SiteConfig::namespaceIsTalk ( int $ns)

Definition at line 376 of file SiteConfig.php.

◆ namespaceName()

MediaWiki\Parser\Parsoid\Config\SiteConfig::namespaceName ( int $ns)

Definition at line 360 of file SiteConfig.php.

◆ observeHistogram()

MediaWiki\Parser\Parsoid\Config\SiteConfig::observeHistogram ( string $name,
float $value,
array $buckets,
array $labels )

Record a histogram metric.

Parameters
string$name
float$valueA time value in milliseconds
array$bucketsThe buckets used in this histogram
array$labelsThe metric labels
Returns
void

Definition at line 207 of file SiteConfig.php.

◆ observeTiming()

MediaWiki\Parser\Parsoid\Config\SiteConfig::observeTiming ( string $name,
float $value,
array $labels )

Record a timing metric.

Parameters
string$name
float$valueA time value in milliseconds
array$labels
Returns
void

Definition at line 193 of file SiteConfig.php.

◆ prefixedStatsFactory()

MediaWiki\Parser\Parsoid\Config\SiteConfig::prefixedStatsFactory ( )

Create a prefixed StatsFactory for parsoid stats.

Definition at line 181 of file SiteConfig.php.

◆ redirectRegexp()

MediaWiki\Parser\Parsoid\Config\SiteConfig::redirectRegexp ( )

Definition at line 320 of file SiteConfig.php.

◆ relativeLinkPrefix()

MediaWiki\Parser\Parsoid\Config\SiteConfig::relativeLinkPrefix ( )

Definition at line 297 of file SiteConfig.php.

◆ rtl()

MediaWiki\Parser\Parsoid\Config\SiteConfig::rtl ( )

Definition at line 504 of file SiteConfig.php.

◆ script()

MediaWiki\Parser\Parsoid\Config\SiteConfig::script ( )

Definition at line 521 of file SiteConfig.php.

◆ scriptpath()

MediaWiki\Parser\Parsoid\Config\SiteConfig::scriptpath ( )

Definition at line 525 of file SiteConfig.php.

◆ server()

MediaWiki\Parser\Parsoid\Config\SiteConfig::server ( )

Definition at line 529 of file SiteConfig.php.

◆ setMaxTemplateDepth()

MediaWiki\Parser\Parsoid\Config\SiteConfig::setMaxTemplateDepth ( int $depth)

Overrides the max template depth in the MediaWiki configuration.

Definition at line 730 of file SiteConfig.php.

◆ shouldValidateExtConfig()

MediaWiki\Parser\Parsoid\Config\SiteConfig::shouldValidateExtConfig ( )
protected

Definition at line 716 of file SiteConfig.php.

◆ specialPageLocalName()

MediaWiki\Parser\Parsoid\Config\SiteConfig::specialPageLocalName ( string $alias)

Definition at line 386 of file SiteConfig.php.

◆ supportsContentModel()

MediaWiki\Parser\Parsoid\Config\SiteConfig::supportsContentModel ( string $model)

Returns true iff Parsoid natively supports the given content model.

Parameters
string$modelcontent model identifier
Returns
bool

Definition at line 804 of file SiteConfig.php.

◆ timezoneOffset()

MediaWiki\Parser\Parsoid\Config\SiteConfig::timezoneOffset ( )

Definition at line 567 of file SiteConfig.php.

◆ ucfirst()

MediaWiki\Parser\Parsoid\Config\SiteConfig::ucfirst ( string $str)

Definition at line 381 of file SiteConfig.php.

◆ variants()

MediaWiki\Parser\Parsoid\Config\SiteConfig::variants ( )

Language variant information.

Returns
array<string,array> Keys are MediaWiki-internal variant codes (e.g. "zh-cn"), values are arrays with two fields:
  • base: (string) Base language code (e.g. "zh") (MediaWiki-internal)
  • fallbacks: (string[]) Fallback variants (MediaWiki-internal codes)
Deprecated
since 1.43; use ::variantsFor() (T320662)

Definition at line 579 of file SiteConfig.php.

References wfDeprecated().

◆ variantsFor()

MediaWiki\Parser\Parsoid\Config\SiteConfig::variantsFor ( Bcp47Code $code)

Language variant information for the given language (or null if unknown).

Parameters
Bcp47Code$codeThe language for which you want variant information
Returns
?array{base:Bcp47Code,fallbacks:Bcp47Code[]} an array with two fields:
  • base: (Bcp47Code) Base BCP-47 language code (e.g. "zh")
  • fallbacks: (Bcp47Code[]) Fallback variants, as BCP-47 codes

Definition at line 627 of file SiteConfig.php.

◆ widthOption()

MediaWiki\Parser\Parsoid\Config\SiteConfig::widthOption ( )

Definition at line 643 of file SiteConfig.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Parser\Parsoid\Config\SiteConfig::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const ExternalLinkTarget
Name constant for the ExternalLinkTarget setting, for use with Config::get()
const NoFollowDomainExceptions
Name constant for the NoFollowDomainExceptions setting, for use with Config::get()
const ParsoidExperimentalParserFunctionOutput
Name constant for the ParsoidExperimentalParserFunctionOutput setting, for use with Config::get()
const NamespaceAliases
Name constant for the NamespaceAliases setting, for use with Config::get()
const Server
Name constant for the Server setting, for use with Config::get()
const NoFollowNsExceptions
Name constant for the NoFollowNsExceptions setting, for use with Config::get()
const AllowExternalImages
Name constant for the AllowExternalImages setting, for use with Config::get()
const UrlProtocols
Name constant for the UrlProtocols setting, for use with Config::get()
const ArticlePath
Name constant for the ArticlePath setting, for use with Config::get()
const LocalTZoffset
Name constant for the LocalTZoffset setting, for use with Config::get()
const MaxTemplateDepth
Name constant for the MaxTemplateDepth setting, for use with Config::get()
const InterlanguageLinkCodeMap
Name constant for the InterlanguageLinkCodeMap setting, for use with Config::get()
const ScriptPath
Name constant for the ScriptPath setting, for use with Config::get()
const GalleryOptions
Name constant for the GalleryOptions setting, for use with Config::get()
const EnableMagicLinks
Name constant for the EnableMagicLinks setting, for use with Config::get()
const ThumbLimits
Name constant for the ThumbLimits setting, for use with Config::get()
const LanguageCode
Name constant for the LanguageCode setting, for use with Config::get()
const LocalInterwikis
Name constant for the LocalInterwikis setting, for use with Config::get()
const InterwikiMagic
Name constant for the InterwikiMagic setting, for use with Config::get()
const LoadScript
Name constant for the LoadScript setting, for use with Config::get()
const AllowExternalImagesFrom
Name constant for the AllowExternalImagesFrom setting, for use with Config::get()
const NoFollowLinks
Name constant for the NoFollowLinks setting, for use with Config::get()
const Script
Name constant for the Script setting, for use with Config::get()
const ExtraInterlanguageLinkPrefixes
Name constant for the ExtraInterlanguageLinkPrefixes setting, for use with Config::get()

Definition at line 61 of file SiteConfig.php.


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