TagAttributeMatcher
extends AbstractMatcher
in package
Match by `TagAttributeFinder`.
Table of Contents
Constants
- FIX_SCRIPT_INLINE_DATA_URL_TRANSFORMATION_ATTRIBUTE = 'consent-fix-script-inline-data-url-transformation-attribute'
Properties
- $headlessContentBlocker : mixed
Methods
- __construct() : mixed
- C'tor.
- applyConsentAttributes() : mixed
- Create HTML attributes for the content blocker.
- calculateAllKeepAttributes() : array<string|int, string>
- Calculate all keep-attributes from plugins and configuration.
- createPlainResultFromMatch() : mixed
- Create a basic `BlockedResult` from an `AbstractMatch`.
- createResult() : BlockedResult
- See `AbstractMatcher`.
- getBlockables() : array<string|int, AbstractBlockable>
- Getter.
- getHeadlessContentBlocker() : mixed
- Getter.
- iterateBlockablesInString() : mixed
- Iterate our blockables in a given string and save results to the `BlockedResult`.
- match() : BlockedResult
- See `AbstractMatcher`.
- probablyDisableDueToSkipped() : mixed
- Disable blocked result if it has the skipped-attribute.
- applyCheckResultHooks() : mixed
- Allows to run hooks on a blocked result instance.
- applyCommonAttributes() : mixed
- Apply common attributes for our blocked element:
- applyNewLinkElement() : mixed
- Prepare the new transformed link attribute.
- applyReplaceAlwaysAttributes() : mixed
- Replace all known attributes which should be always replaced.
- applyVisualParent() : mixed
- Prepare visual parent depending on class.
- prepareChunksFromString() : mixed
- Prepare chunks cause `pcre.jit` can lead to `PREG_JIT_STACKLIMIT_ERROR` errors In a customer scenario, it lead to an error with a string length of `8191`.
Constants
FIX_SCRIPT_INLINE_DATA_URL_TRANSFORMATION_ATTRIBUTE
public
mixed
FIX_SCRIPT_INLINE_DATA_URL_TRANSFORMATION_ATTRIBUTE
= 'consent-fix-script-inline-data-url-transformation-attribute'
Properties
$headlessContentBlocker
private
mixed
$headlessContentBlocker
Methods
__construct()
C'tor.
public
__construct(HeadlessContentBlocker $headlessContentBlocker) : mixed
Parameters
- $headlessContentBlocker : HeadlessContentBlocker
applyConsentAttributes()
Create HTML attributes for the content blocker.
public
applyConsentAttributes(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
- $result : BlockedResult
- $match : AbstractMatch
calculateAllKeepAttributes()
Calculate all keep-attributes from plugins and configuration.
public
calculateAllKeepAttributes(AbstractMatch $match) : array<string|int, string>
Parameters
- $match : AbstractMatch
Return values
array<string|int, string>createPlainResultFromMatch()
Create a basic `BlockedResult` from an `AbstractMatch`.
public
createPlainResultFromMatch(AbstractMatch $match) : mixed
Parameters
- $match : AbstractMatch
createResult()
See `AbstractMatcher`.
public
createResult(TagAttributeMatch $match) : BlockedResult
Parameters
- $match : TagAttributeMatch
Tags
Return values
BlockedResultgetBlockables()
Getter.
public
getBlockables() : array<string|int, AbstractBlockable>
Return values
array<string|int, AbstractBlockable>getHeadlessContentBlocker()
Getter.
public
getHeadlessContentBlocker() : mixed
iterateBlockablesInString()
Iterate our blockables in a given string and save results to the `BlockedResult`.
public
iterateBlockablesInString(BlockedResult $result, string $string[, bool $useContainsRegularExpression = false ][, bool $multilineRegexp = false ][, array<string|int, string> $useRegularExpressionFromMap = null ][, AbstractBlockable $useBlockables = null ]) : mixed
Parameters
- $result : BlockedResult
- $string : string
- $useContainsRegularExpression : bool = false
- $multilineRegexp : bool = false
- $useRegularExpressionFromMap : array<string|int, string> = null
- $useBlockables : AbstractBlockable = null
match()
See `AbstractMatcher`.
public
match(TagAttributeMatch $match) : BlockedResult
Parameters
- $match : TagAttributeMatch
Return values
BlockedResultprobablyDisableDueToSkipped()
Disable blocked result if it has the skipped-attribute.
public
probablyDisableDueToSkipped(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
- $result : BlockedResult
- $match : AbstractMatch
applyCheckResultHooks()
Allows to run hooks on a blocked result instance.
protected
applyCheckResultHooks(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
- $result : BlockedResult
- $match : AbstractMatch
applyCommonAttributes()
Apply common attributes for our blocked element:
protected
applyCommonAttributes(BlockedResult $result, AbstractMatch $match[, string $linkAttribute = null ][, string $link = null ]) : mixed
- Visual parent
- Replaced link attribute (optional)
- Consent attributes depending on blocked item (
consent-required
, ...) - Replace always attributes
Parameters
- $result : BlockedResult
- $match : AbstractMatch
- $linkAttribute : string = null
- $link : string = null
applyNewLinkElement()
Prepare the new transformed link attribute.
protected
applyNewLinkElement(AbstractMatch $match, string $linkAttribute, string $link) : mixed
Parameters
- $match : AbstractMatch
- $linkAttribute : string
- $link : string
applyReplaceAlwaysAttributes()
Replace all known attributes which should be always replaced.
protected
applyReplaceAlwaysAttributes(AbstractMatch $match) : mixed
Parameters
- $match : AbstractMatch
applyVisualParent()
Prepare visual parent depending on class.
protected
applyVisualParent(AbstractMatch $match) : mixed
Parameters
- $match : AbstractMatch
prepareChunksFromString()
Prepare chunks cause `pcre.jit` can lead to `PREG_JIT_STACKLIMIT_ERROR` errors In a customer scenario, it lead to an error with a string length of `8191`.
protected
prepareChunksFromString(string $string[, int $maxChunkLength = 5000 ][, int $copySiblingChunkStringLength = 100 ]) : mixed
As we are using preg_match
we need to ensure, that the blockable expression can find
strings between two chunks (yeah, this can happen). So, add a small part of the previous
and next chunk ($copySiblingChunkStringLength
).
Parameters
- $string : string
- $maxChunkLength : int = 5000
- $copySiblingChunkStringLength : int = 100