Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Config\Api\SiteConfig Class Reference

SiteConfig via MediaWiki's Action API. More...

+ Inheritance diagram for Wikimedia\Parsoid\Config\Api\SiteConfig:
+ Collaboration diagram for Wikimedia\Parsoid\Config\Api\SiteConfig:

Public Member Functions

 __construct (ApiHelper $api, array $opts)
 
 hasVideoInfo ()
 
 galleryOptions ()
 Default gallery options for this wiki.
 
 allowedExternalImagePrefixes ()
 Allowed external image URL prefixes.
 
 baseURI ()
 Site base URI.
 
 relativeLinkPrefix ()
 Prefix for relative links.
 
 canonicalNamespaceId (string $name)
 Map a canonical namespace name to its index.
Note
This replaces canonicalNamespaces
Parameters
string$nameall-lowercase and with underscores rather than spaces.
Returns
int|null

 
 namespaceId (string $name)
 Map a namespace name to its index.
Note
This replaces canonicalNamespaces
Parameters
string$nameall-lowercase and with underscores rather than spaces.
Returns
int|null

 
 namespaceName (int $ns)
 Map a namespace index to its preferred name (with spaces, not underscores).
Note
This replaces namespaceNames
Parameters
int$ns
Returns
string|null

 
 namespaceHasSubpages (int $ns)
 Test if a namespace has subpages.
Note
This replaces namespacesWithSubpages
Parameters
int$ns
Returns
bool

 
 namespaceCase (int $ns)
 Return namespace case setting.
Parameters
int$ns
Returns
string 'first-letter' or 'case-sensitive'

 
 specialPageLocalName (string $alias)
 Get the default local name for a special page.
Parameters
string$aliasSpecial page alias
Returns
string|null

 
 magicLinkEnabled (string $which)
 Return true if the specified magic link syntax is enabled on this wiki.
Parameters
string$whichOne of "ISBN", "PMID", or "RFC"
Returns
true if the specified magic link type is enabled on this wiki

 
 interwikiMagic ()
 Treat language links as magic connectors, not inline links.
 
 interwikiMap ()
 Interwiki link data.
 
 iwp ()
 Wiki identifier, for cache keys.
 
 legalTitleChars ()
 Legal title characters.
 
 linkPrefixRegex ()
 Link prefix regular expression.
 
 langBcp47 ()
 Wiki language code.
 
 mainpage ()
 
 mainPageLinkTarget ()
 Main page title, as LinkTarget.
 
 getMWConfigValue (string $key)
 Lookup config.
Parameters
string$key
Returns
mixed|null config value for $key, if present or null, if not.
Deprecated
This very broad interface is no longer needed.

 
 rtl ()
 Whether the wiki language is right-to-left.
 
 langConverterEnabledBcp47 (Bcp47Code $lang)
 Whether language converter is enabled for the specified language.
Parameters
Bcp47Code$lang
Returns
bool

 
 script ()
 The URL path to index.php.
 
 scriptpath ()
 FIXME: This is only used to compute the modules path below and maybe shouldn't be exposed.
 
 server ()
 The base URL of the server.
 
 exportMetadataToHeadBcp47 (Document $document, ContentMetadataCollector $metadata, string $defaultTitle, Bcp47Code $lang)
 Export content metadata via meta tags (and via a stylesheet for now to aid some clients).
Parameters
Document$document
ContentMetadataCollector$metadata
string$defaultTitleThe default title to display, as an unescaped string
Bcp47Code$langa BCP-47 language code

 
 redirectRegexp ()
 A regexp matching the localized 'REDIRECT' marker for this wiki.
 
 categoryRegexp ()
 A regexp matching the localized 'Category' prefix for this wiki.
 
 bswRegexp ()
 A regexp matching localized behavior switches for this wiki.
 
 timezoneOffset ()
 The wiki's time zone offset.
 
 variantsFor (Bcp47Code $lang)
 Language variant information for the given language (or null if unknown).
Parameters
Bcp47Code$langThe 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

 
 widthOption ()
 Default thumbnail width.
 
 getMagicWordMatcher (string $id)
 Get a regexp matching a localized magic word, given its id.FIXME: misleading function name
Parameters
string$id
Returns
string

 
 getParameterizedAliasMatcher (array $words)
 Get a matcher function for fetching values out of interpolated magic words, ie those with $1 in their aliases.The matcher takes a string and returns null if it doesn't match any of the words, or an associative array if it did match:

  • k: The magic word that matched
  • v: The value of $1 that was matched (the JS also returned 'a' with the specific alias that matched, but that seems to be unused and so is omitted here)
Parameters
string[]$wordsMagic words to match
Returns
callable

 
 ensureExtensionTag (string $tag)
 This function is public so it can be used to synchronize env for hybrid parserTests.
 
 getMaxTemplateDepth ()
 Get the maximum template depth.
Returns
int

 
 metrics ()
 Statistics aggregator, for counting and timing.
Returns
StatsdDataFactoryInterface|null

 
 incrementCounter (string $name, array $labels, float $amount=1)
 Increment a counter metric.
 
 observeTiming (string $name, float $value, array $labels)
 Record a timing metric.
 
 getNoFollowConfig ()
 
 getExternalLinkTarget ()
 
Returns
string|false

 
- Public Member Functions inherited from Wikimedia\Parsoid\Config\SiteConfig
 registerExtensionModule ( $configOrSpec)
 Register a Parsoid extension module.
 
 unregisterExtensionModule (int $extId)
 Unregister a Parsoid extension module.
 
 getExtensionModules ()
 Return the set of Parsoid extension modules associated with this SiteConfig.
 
 __construct ()
 Base constructor.
 
 fakeTimestamp ()
 Fake timestamp, for unit tests.
 
 getObjectFactory ()
 Return an object factory to use when instantiating extensions.
 
 tagNeedsNowikiStrippedInTagPF (string $lowerTagName)
 
 getContentModelHandler (string $contentmodel)
 Return a ContentModelHandler for the specified $contentmodel, if one is registered.
 
 getAnnotationStrippers ()
 Returns all the annotationStrippers that are defined as annotation configuration.
 
 isExtensionTag (string $name)
 Determine whether a given name, which must have already been converted to lower case, is a valid extension tag name.
 
 isAnnotationTag (string $tagName)
 
 getAnnotationTags ()
 Get an array of defined annotation tags in lower case.
 
 getExtensionTagNameMap ()
 Get an array of defined extension tags, with the lower case name in the key, and the value being arbitrary.
 
 getExtTagConfig (string $tagName)
 
 getExtTagImpl (string $tagName)
 
 getExtDOMProcessors ()
 Return an array mapping extension name to an array of object factory specs for Ext\DOMProcessor objects.
 
 getWt2HtmlLimits ()
 
 getHtml2WtLimits ()
 
 getLogger ()
 General log channel.
 
 setLogger (?LoggerInterface $logger)
 Set the log channel, for debugging.
 
 addHTMLTemplateParameters ()
 When processing template parameters, parse them to HTML and add it to the template parameters data.
 
 scrubBidiChars ()
 If enabled, bidi chars adjacent to category links will be stripped in the html -> wt serialization pass.
 
 bswPagePropRegexp ()
 Regex matching all double-underscore magic words.
 
 namespaceIsTalk (int $ns)
 Test if a namespace is a talk namespace.
 
 ucfirst (string $str)
 Uppercasing method for titles.
 
 interwikiMapNoNamespaces ()
 Interwiki link data, after removing items that conflict with namespace names.
 
 interwikiMatcher (string $href)
 Match interwiki URLs.
 
 linkTrailRegex ()
 Link trail regular expression.
 
 solTransparentWikitextRegexp ()
 A regex matching a line containing just whitespace, comments, and sol transparent links and behavior switches.
 
 solTransparentWikitextNoWsRegexp (bool $addIncludes=false)
 A regex matching a line containing just comments and sol transparent links and behavior switches.
 
 mwAliases ()
 List all magic words by canonical name.
 
 getMagicWordForFunctionHook (string $str)
 Return canonical magic word for a function hook.
 
 getMagicWordForVariable (string $str)
 Return canonical magic word for a variable.
 
 getMagicWordForMediaOption (string $word)
 Return canonical magic word for a media option.
 
 getMagicWordForBehaviorSwitch (string $word)
 Return canonical magic word for a behavior switch.
 
 isBehaviorSwitch (string $word)
 Check if a string is a recognized behavior switch.
 
 getMagicWordWT (string $word, string $suggest)
 Convert the internal canonical magic word name to the wikitext alias.
 
 getMediaPrefixParameterizedAliasMatcher ()
 Get a matcher function for fetching values out of interpolated magic words which are media prefix options.
 
 getExtResourceURLPatternMatcher ()
 Matcher for ISBN/RFC/PMID URL patterns, returning the type and number.
 
 linterEnabled ()
 
 getLinterSiteConfig ()
 Return the desired linter configuration.
 
 makeExtResourceURL (array $match, string $href, string $content)
 Serialize ISBN/RFC/PMID URL patterns.
 
 getProtocolsRegex (bool $excludeProtRel=false)
 Get a regex fragment matching URL protocols, quoted for an exclamation mark delimiter.
 
 hasValidProtocol (string $potentialLink)
 Matcher for valid protocols, must be anchored at start of string.
 
 findValidProtocol (string $potentialLink)
 Matcher for valid protocols, may occur at any point within string.
 

Public Attributes

const SITE_CONFIG_QUERY_PARAMS
 

Protected Member Functions

 reset ()
 
 addNamespace (array $ns)
 Add a new namespace to the config.
 
 linkTrail ()
 Return raw link trail regexp from config.
Returns
string

 
 getVariableIDs ()
 
 haveComputedFunctionSynonyms ()
 Does the SiteConfig provide precomputed function synonyms? If no, the SiteConfig is expected to provide an implementation for updateFunctionSynonym.
 
 updateFunctionSynonym (string $func, string $magicword, bool $caseSensitive)
 
 getMagicWords ()
 
 getNonNativeExtensionTags ()
 Get an array of defined extension tags, with the lower case name in the key, the value arbitrary.This is the set of extension tags that are configured in M/W core. $coreExtModules may already be part of it, but eventually this distinction will disappear since all extension tags have to be defined against the Parsoid's extension API.
Returns
array

 
 getSpecialNSAliases ()
 Return name spaces aliases for the NS_SPECIAL namespace.
Returns
array

 
 getSpecialPageAliases (string $specialPage)
 Return Special Page aliases for a special page name.
Parameters
string$specialPage
Returns
array

 
 getProtocols ()
 Get the list of valid protocols.
Returns
array

 
- Protected Member Functions inherited from Wikimedia\Parsoid\Config\SiteConfig
 processExtensionModule (ExtensionModule $ext)
 Register a Parsoid-compatible extension.
 
 getExtConfig ()
 
 exportMetadataHelper (Document $document, string $modulesLoadURI, array $modules, array $moduleStyles, array $jsConfigVars, string $htmlTitle, Bcp47Code $lang)
 Helper function to create <head> elements from metadata.
 
 getFunctionSynonyms ()
 Get a list of precomputed function synonyms.
 

Protected Attributes

 $nsNames = []
 
 $nsCase = []
 
 $nsIds = []
 
 $nsCanon = []
 
 $nsWithSubpages = []
 
- Protected Attributes inherited from Wikimedia\Parsoid\Config\SiteConfig
 $mwAliases
 
 $functionSynonyms
 
 $interwikiMapNoNamespaces
 
 $linkTrailRegex = false
 
 $logger = null
 
 $iwMatcherBatchSize = 4096
 
 $iwMatcher = null
 
 $addHTMLTemplateParameters = false
 
 $scrubBidiChars = false
 
 $linterEnabled = false
 
 $extConfig = null
 
 $wt2htmlLimits
 
 $html2wtLimits
 

Additional Inherited Members

- Static Public Member Functions inherited from Wikimedia\Parsoid\Config\SiteConfig
static createLogger (?string $filePath=null)
 
- Static Protected Member Functions inherited from Wikimedia\Parsoid\Config\SiteConfig
static quoteTitleRe (string $s, string $delimiter='/')
 Quote a title regex.
 

Detailed Description

SiteConfig via MediaWiki's Action API.

Note this is intended for testing, not performance.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Config\Api\SiteConfig::__construct ( ApiHelper $api,
array $opts )

Member Function Documentation

◆ addNamespace()

Wikimedia\Parsoid\Config\Api\SiteConfig::addNamespace ( array $ns)
protected

Add a new namespace to the config.

Protected access to let mocks and parser tests versions add new namespaces as required.

Parameters
array$nsNamespace info

◆ allowedExternalImagePrefixes()

Wikimedia\Parsoid\Config\Api\SiteConfig::allowedExternalImagePrefixes ( )

Allowed external image URL prefixes.

Returns
string[] The empty array matches no URLs. The empty string matches all URLs.

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ baseURI()

Wikimedia\Parsoid\Config\Api\SiteConfig::baseURI ( )

Site base URI.

This would be the URI found in <base href="..." />.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ bswRegexp()

Wikimedia\Parsoid\Config\Api\SiteConfig::bswRegexp ( )

A regexp matching localized behavior switches for this wiki.

The regexp should be delimited, but should not have boundary anchors or capture groups.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ canonicalNamespaceId()

Wikimedia\Parsoid\Config\Api\SiteConfig::canonicalNamespaceId ( string $name)

Map a canonical namespace name to its index.

Note
This replaces canonicalNamespaces
Parameters
string$nameall-lowercase and with underscores rather than spaces.
Returns
int|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ categoryRegexp()

Wikimedia\Parsoid\Config\Api\SiteConfig::categoryRegexp ( )

A regexp matching the localized 'Category' prefix for this wiki.

The regexp should be delimited, but should not have boundary anchors or capture groups.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ ensureExtensionTag()

Wikimedia\Parsoid\Config\Api\SiteConfig::ensureExtensionTag ( string $tag)

This function is public so it can be used to synchronize env for hybrid parserTests.

The parserTests setup includes the definition of a number of non-standard extension tags, whose names are passed over from the JS side in hybrid testing.

Parameters
string$tagName of an extension tag assumed to be present

◆ exportMetadataToHeadBcp47()

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

Export content metadata via meta tags (and via a stylesheet for now to aid some clients).

Parameters
Document$document
ContentMetadataCollector$metadata
string$defaultTitleThe default title to display, as an unescaped string
Bcp47Code$langa BCP-47 language code

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ galleryOptions()

Wikimedia\Parsoid\Config\Api\SiteConfig::galleryOptions ( )

Default gallery options for this wiki.

Returns
array<string,string|int|bool>

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getExternalLinkTarget()

Wikimedia\Parsoid\Config\Api\SiteConfig::getExternalLinkTarget ( )

Returns
string|false

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ getMagicWordMatcher()

Wikimedia\Parsoid\Config\Api\SiteConfig::getMagicWordMatcher ( string $id)

Get a regexp matching a localized magic word, given its id.FIXME: misleading function name

Parameters
string$id
Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getMagicWords()

Wikimedia\Parsoid\Config\Api\SiteConfig::getMagicWords ( )
protected

◆ getMaxTemplateDepth()

Wikimedia\Parsoid\Config\Api\SiteConfig::getMaxTemplateDepth ( )

Get the maximum template depth.

Returns
int

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getMWConfigValue()

Wikimedia\Parsoid\Config\Api\SiteConfig::getMWConfigValue ( string $key)

Lookup config.

Parameters
string$key
Returns
mixed|null config value for $key, if present or null, if not.
Deprecated
This very broad interface is no longer needed.

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ getNoFollowConfig()

Wikimedia\Parsoid\Config\Api\SiteConfig::getNoFollowConfig ( )

◆ getNonNativeExtensionTags()

Wikimedia\Parsoid\Config\Api\SiteConfig::getNonNativeExtensionTags ( )
protected

Get an array of defined extension tags, with the lower case name in the key, the value arbitrary.This is the set of extension tags that are configured in M/W core. $coreExtModules may already be part of it, but eventually this distinction will disappear since all extension tags have to be defined against the Parsoid's extension API.

Returns
array

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getParameterizedAliasMatcher()

Wikimedia\Parsoid\Config\Api\SiteConfig::getParameterizedAliasMatcher ( array $words)

Get a matcher function for fetching values out of interpolated magic words, ie those with $1 in their aliases.The matcher takes a string and returns null if it doesn't match any of the words, or an associative array if it did match:

  • k: The magic word that matched
  • v: The value of $1 that was matched (the JS also returned 'a' with the specific alias that matched, but that seems to be unused and so is omitted here)
Parameters
string[]$wordsMagic words to match
Returns
callable

$name is the canonical magic word name $re has patterns for matching aliases

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getProtocols()

Wikimedia\Parsoid\Config\Api\SiteConfig::getProtocols ( )
protected

Get the list of valid protocols.

Returns
array

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getSpecialNSAliases()

Wikimedia\Parsoid\Config\Api\SiteConfig::getSpecialNSAliases ( )
protected

Return name spaces aliases for the NS_SPECIAL namespace.

Returns
array

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getSpecialPageAliases()

Wikimedia\Parsoid\Config\Api\SiteConfig::getSpecialPageAliases ( string $specialPage)
protected

Return Special Page aliases for a special page name.

Parameters
string$specialPage
Returns
array

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ getVariableIDs()

Wikimedia\Parsoid\Config\Api\SiteConfig::getVariableIDs ( )
protected

◆ haveComputedFunctionSynonyms()

Wikimedia\Parsoid\Config\Api\SiteConfig::haveComputedFunctionSynonyms ( )
protected

Does the SiteConfig provide precomputed function synonyms? If no, the SiteConfig is expected to provide an implementation for updateFunctionSynonym.

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ incrementCounter()

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

Increment a counter metric.

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

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ interwikiMagic()

Wikimedia\Parsoid\Config\Api\SiteConfig::interwikiMagic ( )

Treat language links as magic connectors, not inline links.

Returns
bool

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ interwikiMap()

Wikimedia\Parsoid\Config\Api\SiteConfig::interwikiMap ( )

Interwiki link data.

Note that the order of the keys in this array is significant: if more than one prefix matches a given URL during html2wt conversion, the first match is used. If you want wikitech to be used instead of labsconsole, for example, the ‘'wikitech’=>[....]` key needs to enumerate first.

Returns
array<string,array> Keys are interwiki prefixes, values are arrays with the following keys:
  • prefix: (string) The interwiki prefix, same as the key.
  • url: (string) Target URL, containing a '$1' to be replaced by the interwiki target.
  • protorel: (bool, optional) Whether the url may be accessed by both http:// and https://.
  • local: (bool, optional) Whether the interwiki link is considered local (to the wikifarm).
  • localinterwiki: (bool, optional) Whether the interwiki link points to the current wiki.
  • language: (bool, optional) Whether the interwiki link is a language link.
  • extralanglink: (bool, optional) Whether the interwiki link is an "extra language link".
  • linktext: (string, optional) For "extra language links", the link text. (booleans marked "optional" must be omitted if false)

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ iwp()

Wikimedia\Parsoid\Config\Api\SiteConfig::iwp ( )

Wiki identifier, for cache keys.

Should match a key in mwApiMap()?

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ langBcp47()

Wikimedia\Parsoid\Config\Api\SiteConfig::langBcp47 ( )

Wiki language code.

Returns
Bcp47Code BCP-47 language code

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ langConverterEnabledBcp47()

Wikimedia\Parsoid\Config\Api\SiteConfig::langConverterEnabledBcp47 ( Bcp47Code $lang)

Whether language converter is enabled for the specified language.

Parameters
Bcp47Code$lang
Returns
bool

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ legalTitleChars()

Wikimedia\Parsoid\Config\Api\SiteConfig::legalTitleChars ( )

Legal title characters.

Regex is intended to match bytes, not Unicode characters.

Returns
string Regex character class (i.e. the bit that goes inside [])

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ linkPrefixRegex()

Wikimedia\Parsoid\Config\Api\SiteConfig::linkPrefixRegex ( )

Link prefix regular expression.

Returns
string|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ linkTrail()

Wikimedia\Parsoid\Config\Api\SiteConfig::linkTrail ( )
protected

Return raw link trail regexp from config.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ magicLinkEnabled()

Wikimedia\Parsoid\Config\Api\SiteConfig::magicLinkEnabled ( string $which)

Return true if the specified magic link syntax is enabled on this wiki.

Parameters
string$whichOne of "ISBN", "PMID", or "RFC"
Returns
true if the specified magic link type is enabled on this wiki

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ mainPageLinkTarget()

Wikimedia\Parsoid\Config\Api\SiteConfig::mainPageLinkTarget ( )

Main page title, as LinkTarget.

Returns
LinkTarget

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ metrics()

Wikimedia\Parsoid\Config\Api\SiteConfig::metrics ( )

Statistics aggregator, for counting and timing.

Returns
StatsdDataFactoryInterface|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ namespaceCase()

Wikimedia\Parsoid\Config\Api\SiteConfig::namespaceCase ( int $ns)

Return namespace case setting.

Parameters
int$ns
Returns
string 'first-letter' or 'case-sensitive'

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ namespaceHasSubpages()

Wikimedia\Parsoid\Config\Api\SiteConfig::namespaceHasSubpages ( int $ns)

Test if a namespace has subpages.

Note
This replaces namespacesWithSubpages
Parameters
int$ns
Returns
bool

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ namespaceId()

Wikimedia\Parsoid\Config\Api\SiteConfig::namespaceId ( string $name)

Map a namespace name to its index.

Note
This replaces canonicalNamespaces
Parameters
string$nameall-lowercase and with underscores rather than spaces.
Returns
int|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ namespaceName()

Wikimedia\Parsoid\Config\Api\SiteConfig::namespaceName ( int $ns)

Map a namespace index to its preferred name (with spaces, not underscores).

Note
This replaces namespaceNames
Parameters
int$ns
Returns
string|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ observeTiming()

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

Record a timing metric.

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

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ redirectRegexp()

Wikimedia\Parsoid\Config\Api\SiteConfig::redirectRegexp ( )

A regexp matching the localized 'REDIRECT' marker for this wiki.

The regexp should be delimited, but should not have boundary anchors or capture groups.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ relativeLinkPrefix()

Wikimedia\Parsoid\Config\Api\SiteConfig::relativeLinkPrefix ( )

Prefix for relative links.

Prefix to prepend to a page title to link to that page. Intended to be relative to the URI returned by baseURI().

If possible, keep the default "./" so clients need not know this value to extract titles from link hrefs.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ rtl()

Wikimedia\Parsoid\Config\Api\SiteConfig::rtl ( )

Whether the wiki language is right-to-left.

Returns
bool

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ script()

Wikimedia\Parsoid\Config\Api\SiteConfig::script ( )

The URL path to index.php.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ scriptpath()

Wikimedia\Parsoid\Config\Api\SiteConfig::scriptpath ( )

FIXME: This is only used to compute the modules path below and maybe shouldn't be exposed.

The base wiki path

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ server()

Wikimedia\Parsoid\Config\Api\SiteConfig::server ( )

The base URL of the server.

Returns
string

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ specialPageLocalName()

Wikimedia\Parsoid\Config\Api\SiteConfig::specialPageLocalName ( string $alias)

Get the default local name for a special page.

Parameters
string$aliasSpecial page alias
Returns
string|null

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ timezoneOffset()

Wikimedia\Parsoid\Config\Api\SiteConfig::timezoneOffset ( )

The wiki's time zone offset.

Returns
int Minutes east of UTC

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

◆ updateFunctionSynonym()

Wikimedia\Parsoid\Config\Api\SiteConfig::updateFunctionSynonym ( string $func,
string $magicword,
bool $caseSensitive )
protected

◆ variantsFor()

Wikimedia\Parsoid\Config\Api\SiteConfig::variantsFor ( Bcp47Code $lang)

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

Parameters
Bcp47Code$langThe 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

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

◆ widthOption()

Wikimedia\Parsoid\Config\Api\SiteConfig::widthOption ( )

Default thumbnail width.

Reimplemented from Wikimedia\Parsoid\Config\SiteConfig.

Reimplemented in Wikimedia\Parsoid\ParserTests\SiteConfig.

Member Data Documentation

◆ SITE_CONFIG_QUERY_PARAMS

const Wikimedia\Parsoid\Config\Api\SiteConfig::SITE_CONFIG_QUERY_PARAMS
Initial value:
= [
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => 'general|protocols|namespaces|namespacealiases|magicwords|interwikimap|'
. 'languagevariants|defaultoptions|specialpagealiases|extensiontags|'
. 'functionhooks|variables',
]

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