$headlessContentBlocker
$headlessContentBlocker :
Match by `ScriptInlineMatcher`.
__construct(\DevOwl\HeadlessContentBlocker\HeadlessContentBlocker $headlessContentBlocker)
C'tor.
\DevOwl\HeadlessContentBlocker\HeadlessContentBlocker | $headlessContentBlocker |
match(\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch $match): \DevOwl\HeadlessContentBlocker\BlockedResult
See `AbstractMatcher`.
\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch | $match |
createResult(\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch $match): \DevOwl\HeadlessContentBlocker\BlockedResult
See `AbstractMatcher`.
\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch | $match |
createPlainResultFromMatch(\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Create a basic `BlockedResult` from an `AbstractMatch`.
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
probablyDisableDueToSkipped(\DevOwl\HeadlessContentBlocker\BlockedResult $result,\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Disable blocked result if it has the skipped-attribute.
\DevOwl\HeadlessContentBlocker\BlockedResult | $result | |
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
iterateBlockablesInString(\DevOwl\HeadlessContentBlocker\BlockedResult $result,string $string,boolean $useContainsRegularExpression = false,boolean $multilineRegexp = false,array<mixed,string> $useRegularExpressionFromMap = null,\DevOwl\HeadlessContentBlocker\AbstractBlockable $useBlockables = null)
Iterate our blockables in a given string and save results to the `BlockedResult`.
\DevOwl\HeadlessContentBlocker\BlockedResult | $result | |
string | $string | |
boolean | $useContainsRegularExpression | |
boolean | $multilineRegexp | |
array<mixed,string> | $useRegularExpressionFromMap | |
\DevOwl\HeadlessContentBlocker\AbstractBlockable | $useBlockables |
applyConsentAttributes(\DevOwl\HeadlessContentBlocker\BlockedResult $result,\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Create HTML attributes for the content blocker.
\DevOwl\HeadlessContentBlocker\BlockedResult | $result | |
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
getBlockables(): array<mixed,\DevOwl\HeadlessContentBlocker\AbstractBlockable>
Getter.
prepareChunksFromString(string $string,integer $maxChunkLength = 5000,integer $copySiblingChunkStringLength = 100)
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`.
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
).
string | $string | |
integer | $maxChunkLength | |
integer | $copySiblingChunkStringLength |
applyCommonAttributes(\DevOwl\HeadlessContentBlocker\BlockedResult $result,\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match,string $linkAttribute = null,string $link = null)
Apply common attributes for our blocked element:
consent-required
, ...)\DevOwl\HeadlessContentBlocker\BlockedResult | $result | |
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match | |
string | $linkAttribute | |
string | $link |
applyReplaceAlwaysAttributes(\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Replace all known attributes which should be always replaced.
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
applyNewLinkElement(\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match,string $linkAttribute,string $link)
Prepare the new transformed link attribute.
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match | |
string | $linkAttribute | |
string | $link |
applyVisualParent(\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Prepare visual parent depending on class.
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
applyCheckResultHooks(\DevOwl\HeadlessContentBlocker\BlockedResult $result,\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match)
Allows to run hooks on a blocked result instance.
\DevOwl\HeadlessContentBlocker\BlockedResult | $result | |
\DevOwl\FastHtmlTag\finder\match\AbstractMatch | $match |
isLocalizedVariable(\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch $match)
Check if a given inline script is produced by `wp_localized_script` and starts with something like `var xxxxx=`.
\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch | $match |