class Configurator extends ConfiguratorBase

Properties

protected Configurator $configurator from  ConfiguratorBase
protected $quickMatch {@inheritdoc}
protected int $regexpLimit from  ConfiguratorBase
array $allowedFilters
protected bool $createMediaBBCode
SiteDefinitionCollection $defaultSites
protected $regexp {@inheritdoc}
protected array $sites
protected string $tagName
protected TemplateBuilder $templateBuilder

Methods

__construct(Configurator $configurator, array $overrideProps = [])

No description

setUp()

Executed by this plugin's constructor

finalize()

Finalize this plugin's configuration

array|Dictionary|null
asConfig()

No description

array
getBaseProperties()

Return a list of base properties meant to be added to asConfig()'s return

array
getJSHints()

Return additional hints used in the JavaScript parser

string|null
getJSParser()

Return this plugin's JavaScript parser

Tag
getTag()

Return the tag associated with this plugin, if applicable

void
disableQuickMatch()

Disable quickMatch

void
setAttrName(string $attrName)

Set $this->attrName with given attribute name, normalized

void
setQuickMatch(string $quickMatch)

Set the quickMatch string

void
setRegexpLimit(int $limit)

Set the maximum number of regexp matches

void
setTagName(string $tagName)

Set $this->tagName with given tag name, normalized

Tag
add(string $siteId, array|null $siteConfig = null)

Add a media site

array
getSites()

Return the list of configured sites

Tag
addTag(string $siteId, array $siteConfig)

Create and return a tag that handles given media site

void
checkAttributeFilters(array $attributes)

Check the safety of given attributes

array
convertRegexp(string $regexp)

Convert given regexp to a [regexp, map] pair

array[]
convertRegexps(array $regexps)

Convert a list of regexps

array
convertScrapeConfig(array $config)

Convert all regexps in a scraping config

array[]
convertScrapes(array $scrapes)

Convert all regexps in a list of scraping configs

void
createMediaTag()

Create the default MEDIA tag

string[]
getAttributeNamesFromRegexps(array $regexps)

Return the list of named captures from a list of [regexp, map] pairs

array
getAttributesConfig(array $siteConfig)

Get the attributes config for given site config

string
normalizeId(string $siteId)

Validate and normalize a site ID

Details

in ConfiguratorBase at line 42
final __construct(Configurator $configurator, array $overrideProps = [])

No description

Parameters

Configurator $configurator
array $overrideProps

Properties of the plugin will be overwritten with those

at line 65
protected setUp()

Executed by this plugin's constructor

in ConfiguratorBase at line 84
finalize()

Finalize this plugin's configuration

Executed by the configurator whenever the tags' config must be in a usable state:

  • before the parser's config is generated
  • before the renderer's stylesheet is generated
  • before HTML5 rules are generated

As such, this method may be called multiple times during configuration

at line 86
array|Dictionary|null asConfig()

No description

Return Value

array|Dictionary|null

in ConfiguratorBase at line 109
final array getBaseProperties()

Return a list of base properties meant to be added to asConfig()'s return

NOTE: this final method exists so that the plugin's configuration can always specify those base properties, even if they're omitted from asConfig(). Going forward, this ensure that new base properties added to ConfiguratorBase appear in the plugin's config without having to update every plugin

Return Value

array

in ConfiguratorBase at line 131
array getJSHints()

Return additional hints used in the JavaScript parser

Return Value

array

Hint names and values

in ConfiguratorBase at line 144
string|null getJSParser()

Return this plugin's JavaScript parser

This is the base implementation, meant to be overridden by custom plugins. By default it returns the Parser.js file from stock plugins' directory, if available

Return Value

string|null

JavaScript source, or NULL if no JS parser is available

in ConfiguratorBase at line 167
Tag getTag()

Return the tag associated with this plugin, if applicable

Return Value

Tag

in ConfiguratorBase at line 186
void disableQuickMatch()

Disable quickMatch

Return Value

void

in ConfiguratorBase at line 197
protected void setAttrName(string $attrName)

Set $this->attrName with given attribute name, normalized

Parameters

string $attrName

New attribute name

Return Value

void

in ConfiguratorBase at line 213
void setQuickMatch(string $quickMatch)

Set the quickMatch string

Parameters

string $quickMatch

Return Value

void

in ConfiguratorBase at line 229
void setRegexpLimit(int $limit)

Set the maximum number of regexp matches

Parameters

int $limit

Return Value

void

in ConfiguratorBase at line 247
protected void setTagName(string $tagName)

Set $this->tagName with given tag name, normalized

Parameters

string $tagName

New tag name

Return Value

void

at line 107
Tag add(string $siteId, array|null $siteConfig = null)

Add a media site

Parameters

string $siteId

Site's ID

array|null $siteConfig

Site's config

Return Value

Tag

Tag created for this site

at line 144
array getSites()

Return the list of configured sites

Return Value

array

Site's ID as keys, site's config as values

at line 156
protected Tag addTag(string $siteId, array $siteConfig)

Create and return a tag that handles given media site

Parameters

string $siteId
array $siteConfig

Return Value

Tag

at line 181
protected void checkAttributeFilters(array $attributes)

Check the safety of given attributes

Parameters

array $attributes

Return Value

void

at line 205
protected array convertRegexp(string $regexp)

Convert given regexp to a [regexp, map] pair

Parameters

string $regexp

Original regexp

Return Value

array

[regexp, [list of captures' names]]

at line 218
protected array[] convertRegexps(array $regexps)

Convert a list of regexps

Parameters

array $regexps

Original list

Return Value

array[]

Converted list

at line 229
protected array convertScrapeConfig(array $config)

Convert all regexps in a scraping config

Parameters

array $config

Original config

Return Value

array

Converted config

at line 243
protected array[] convertScrapes(array $scrapes)

Convert all regexps in a list of scraping configs

Parameters

array $scrapes

Original config

Return Value

array[]

Converted config

at line 253
protected void createMediaTag()

Create the default MEDIA tag

Return Value

void

at line 280
protected string[] getAttributeNamesFromRegexps(array $regexps)

Return the list of named captures from a list of [regexp, map] pairs

Parameters

array $regexps

List of [regexp, map] pairs

Return Value

string[]

at line 297
protected array getAttributesConfig(array $siteConfig)

Get the attributes config for given site config

Parameters

array $siteConfig

Site's config

Return Value

array

Map of [attrName => attrConfig]

at line 321
protected string normalizeId(string $siteId)

Validate and normalize a site ID

Parameters

string $siteId

Return Value

string