Constants

EXPRESSION_REGEXP

EXPRESSION_REGEXP ='/^([A-Za-z_-]+)(?:%s)+$/m'

See class description.

Available matches: $match[0] => Full string $match[1] => Tag $match[2] => Attribute $match[3] => Comparator (can be empty) $match[4] => Value (can be empty)

EXPRESSION_REGEXP_INNER_SINGLE_ATTRIBUTE

EXPRESSION_REGEXP_INNER_SINGLE_ATTRIBUTE ='\[([A-Za-z_-]+)(?:(%s)"([^"]+)")?(?:\s*:\s*(.*))?]'

PCRE does currently not support repeating capture groups, we need to capture this manually by duplicating the attribute regular expression.

Properties

$regexp

$regexp :

Type

$callbacks

$callbacks :array<mixed,callable>

Callbacks.

Type

array<mixed,callable>

$expression

$expression :

Type

$tag

$tag :

Type

$attributes

$attributes :

Type

Methods

getRegularExpression()

getRegularExpression()

Get regular expression.

createMatch()

createMatch(array  $m): \DevOwl\FastHtmlTag\finder\match\AbstractMatch|false

See `AbstractRegexFinder`.

Parameters

array $m

Returns

\DevOwl\FastHtmlTag\finder\match\AbstractMatch|false —

Returns false if no match got found and we cannot process it

prepareMatch()

prepareMatch(array  $m)

Prepare the result match of a `createRegexp` regexp.

Parameters

array $m

createRegexp()

createRegexp(array<mixed,string>  $searchTags,array<mixed,string>  $searchAttributes)

Create regular expression to catch multiple tags and attributes.

Available matches: $match[0] => Full string $match[1] => All content before the link attribute $match[2] => Used tag $match[3] => Used link attribute $match[4] => Used quote for link attribute $match[5] => Link $match[6] => All content after the link

Parameters

array<mixed,string> $searchTags
array<mixed,string> $searchAttributes

replace()

replace(string  $html)

Find HTML tags for this finder and replace it with our modifiers.

Parameters

string $html

addCallback()

addCallback(callable  $callback)

Add a callable. The first parameter is an instance of `AbstractMatch`.

Parameters

callable $callback

getCallbacks()

getCallbacks()

Getter.

getFastHtmlTag()

getFastHtmlTag()

Getter.

matchesAttributes()

matchesAttributes(array  $values,\DevOwl\FastHtmlTag\finder\match\SelectorSyntaxMatch  $match)

Checks if the current attribute and value matches all our defined attributes.

Parameters

array $values
\DevOwl\FastHtmlTag\finder\match\SelectorSyntaxMatch $match

If passed selector syntax functions are also executed

getExpression()

getExpression()

Getter.

getTag()

getTag()

Getter.

getAttributes()

getAttributes()

Getter.

fromExpression()

fromExpression(string  $expression): \DevOwl\FastHtmlTag\finder\SelectorSyntaxFinder|false

Create an instance from an expression like `div[id="my-id"]`.

Parameters

string $expression

Returns

\DevOwl\FastHtmlTag\finder\SelectorSyntaxFinder|false —

Returns false if the expression is invalid

isLinkEscaped()

isLinkEscaped(string  $link)

Do not modify escaped data as they appear mostly in JSON CDATA - we do not modify behavior of other plugins and themes ;-)

Parameters

string $link

__construct()

__construct(string  $expression,string  $tag,array<mixed,\DevOwl\FastHtmlTag\finder\SelectorSyntaxAttribute>  $attributes)

C'tor.

Parameters

string $expression
string $tag
array<mixed,\DevOwl\FastHtmlTag\finder\SelectorSyntaxAttribute> $attributes

If you rely on the regular expression match of the link attribute it is highly recommend to pass only one attribute and create multiple instances of TagAttributeFinder.