Properties

$headlessContentBlocker

$headlessContentBlocker :

Type

Methods

createPlainResultFromMatch()

createPlainResultFromMatch(\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match)

Create a basic `BlockedResult` from an `AbstractMatch`.

Parameters

\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match

iterateBlockablesInString()

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`.

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $result
string $string
boolean $useContainsRegularExpression
boolean $multilineRegexp
array<mixed,string> $useRegularExpressionFromMap
\DevOwl\HeadlessContentBlocker\AbstractBlockable $useBlockables

getHeadlessContentBlocker()

getHeadlessContentBlocker()

Getter.

prepareChunksFromString()

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

Parameters

string $string
integer $maxChunkLength
integer $copySiblingChunkStringLength

applyCommonAttributes()

applyCommonAttributes(\DevOwl\HeadlessContentBlocker\BlockedResult  $result,\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match,string  $linkAttribute = null,string  $link = null)

Apply common attributes for our blocked element:

  • Visual parent
  • Replaced link attribute (optional)
  • Consent attributes depending on blocked item (consent-required, ...)
  • Replace always attributes

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $result
\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match
string $linkAttribute
string $link

applyReplaceAlwaysAttributes()

applyReplaceAlwaysAttributes(\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match)

Replace all known attributes which should be always replaced.

Parameters

\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match

applyNewLinkElement()

applyNewLinkElement(\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match,string  $linkAttribute,string  $link)

Prepare the new transformed link attribute.

Parameters

\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match
string $linkAttribute
string $link

isLocalizedVariable()

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=`.

Parameters

\DevOwl\FastHtmlTag\finder\match\ScriptInlineMatch $match