class Configurator extends ConfiguratorBase

Properties

protected Configurator $configurator from  ConfiguratorBase
protected $quickMatch {@inheritdoc}
protected int $regexpLimit from  ConfiguratorBase
protected array $aliases
protected array $attributeFilters
protected array $elements
protected string $prefix
protected array $unsafeElements
protected array $unsafeAttributes

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()

Generate this plugin's config

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

void
aliasAttribute(string $elName, string $attrName, string $alias)

Alias the HTML attribute of given HTML element to a given attribute name

void
aliasElement(string $elName, string $tagName)

Alias an HTML element to a given tag name

Tag
allowElement(string $elName)

Allow an HTML element to be used

Tag
allowUnsafeElement(string $elName)

Allow an unsafe HTML element to be used

Tag
allowElementWithSafety(string $elName, bool $allowUnsafe)

Allow a (potentially unsafe) HTML element to be used

Attribute
allowAttribute(string $elName, string $attrName)

Allow an attribute to be used in an HTML element

Attribute
allowUnsafeAttribute(string $elName, string $attrName)

Allow an unsafe attribute to be used in an HTML element

Attribute
allowAttributeWithSafety(string $elName, string $attrName, bool $allowUnsafe)

Allow a (potentially unsafe) attribute to be used in an HTML element

string
normalizeElementName(string $elName)

Validate and normalize an element name

string
normalizeAttributeName(string $attrName)

Validate and normalize an attribute name

void
rebuildTemplate(Tag $tag, string $elName, bool $allowUnsafe)

Rebuild a tag's template

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

in ConfiguratorBase at line 70
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 321
array|Dictionary|null asConfig()

Generate this plugin's config

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

at line 366
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 101
void aliasAttribute(string $elName, string $attrName, string $alias)

Alias the HTML attribute of given HTML element to a given attribute name

NOTE: will not create the target attribute

Parameters

string $elName

Name of the HTML element

string $attrName

Name of the HTML attribute

string $alias Alias

Return Value

void

at line 118
void aliasElement(string $elName, string $tagName)

Alias an HTML element to a given tag name

NOTE: will not create the target tag

Parameters

string $elName

Name of the HTML element

string $tagName

Name of the tag

Return Value

void

at line 131
Tag allowElement(string $elName)

Allow an HTML element to be used

Parameters

string $elName

Name of the element

Return Value

Tag

Tag that represents this element

at line 142
Tag allowUnsafeElement(string $elName)

Allow an unsafe HTML element to be used

Parameters

string $elName

Name of the element

Return Value

Tag

Tag that represents this element

at line 154
protected Tag allowElementWithSafety(string $elName, bool $allowUnsafe)

Allow a (potentially unsafe) HTML element to be used

Parameters

string $elName

Name of the element

bool $allowUnsafe

Whether to allow unsafe elements

Return Value

Tag

Tag that represents this element

at line 185
Attribute allowAttribute(string $elName, string $attrName)

Allow an attribute to be used in an HTML element

Parameters

string $elName

Name of the element

string $attrName

Name of the attribute

Return Value

Attribute

at line 197
Attribute allowUnsafeAttribute(string $elName, string $attrName)

Allow an unsafe attribute to be used in an HTML element

Parameters

string $elName

Name of the element

string $attrName

Name of the attribute

Return Value

Attribute

at line 210
protected Attribute allowAttributeWithSafety(string $elName, string $attrName, bool $allowUnsafe)

Allow a (potentially unsafe) attribute to be used in an HTML element

Parameters

string $elName

Name of the element

string $attrName

Name of the attribute

bool $allowUnsafe

Return Value

Attribute

at line 263
protected string normalizeElementName(string $elName)

Validate and normalize an element name

Accepts any name that would be valid, regardless of whether this element exists in HTML5. Might be slightly off as the HTML5 specs don't seem to require it to start with a letter but our implementation does.

Parameters

string $elName

Original element name

Return Value

string

Normalized element name, in lowercase

at line 281
protected string normalizeAttributeName(string $attrName)

Validate and normalize an attribute name

More restrictive than the specs but allows all HTML5 attributes and more.

Parameters

string $attrName

Original attribute name

Return Value

string

Normalized attribute name, in lowercase

at line 299
protected void rebuildTemplate(Tag $tag, string $elName, bool $allowUnsafe)

Rebuild a tag's template

Parameters

Tag $tag

Source tag

string $elName

Name of the HTML element created by the template

bool $allowUnsafe

Whether to allow unsafe markup

Return Value

void