Properties

$regexp

$regexp :

Type

$headlessContentBlocker

$headlessContentBlocker :

Type

$identifier

$identifier :

Type

$originalExpressions

$originalExpressions :array<mixed,string>

List of original expressions passed through the rules.

Type

array<mixed,string>

$extended

$extended :

Type

Methods

__construct()

__construct(\DevOwl\HeadlessContentBlocker\HeadlessContentBlocker  $headlessContentBlocker,string  $identifier,string  $extended = null,array<mixed,\DevOwl\HeadlessContentBlocker\plugins\scanner\Rule>|array<mixed,array>  $rules = array())

C'tor.

Example array for $rules:

[
    [
         'expression' => "*google.com/recaptcha*",
         // If you want to configure group resolving, you need to configure the appropriated group via `$hostGroups`.
         // Otherwise, defaults of the group are considered. Means: Without group configured it will be marked as
         // "one rule within the group must-be-resolved".
         'assignedToGroups' => 'script', // can be string[]
         'queryArgs' => [
              [
                  'queryArg' => 'id',
                  'isOptional' => true,
                  'regexp' => '/^UA-/'
              ]
         ]
    ]
]

Parameters

\DevOwl\HeadlessContentBlocker\HeadlessContentBlocker $headlessContentBlocker
string $identifier
string $extended

The parent extended preset identifier

array<mixed,\DevOwl\HeadlessContentBlocker\plugins\scanner\Rule>|array<mixed,array> $rules

A list of expressions which hold different scan options; you can also pass an array which gets automatically converted to Rule.

appendFromStringArray()

appendFromStringArray(array<mixed,string>  $blockers)

Generate the custom element blockers and regular expressions and append it to this blockable instance.

Parameters

array<mixed,string> $blockers

findSelectorSyntaxFinderForMatch()

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

Find a `SyntaxSelectorFinder` for a given `AbstractMatch`.

Parameters

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

getBlockerId()

getBlockerId(): integer|null

Get the blocker ID. This is added as a custom HTML attribute to the blocked element so your frontend can e.g. add a visual content blocker.

Returns

integer|null

getRequiredIds()

getRequiredIds(): array<mixed,integer>

Get required IDs. This is added as a custom HTML attribute to the blocked element so your frontend can determine which items by ID are needed so the item can be unblocked.

Returns

array<mixed,integer>

getCriteria()

getCriteria(): string

The criteria type. This is added as a custom HTML attribute to the blocked element so your frontend can determine the origin for the `getRequiredIds`.

E.g. differ between TCF vendors and another custom criteria.

Returns

string

hasBlockerId()

hasBlockerId()

Determine if this blockable should be blocked.

getSelectorSyntaxFinder()

getSelectorSyntaxFinder()

Getter.

getRegularExpressions()

getRegularExpressions(): array<mixed,string>

Getter.

Returns

array<mixed,string>

getContainsRegularExpressions()

getContainsRegularExpressions(): array<mixed,string>

Getter.

Returns

array<mixed,string>

checkExpressionsMatchesGroups()

checkExpressionsMatchesGroups(array<mixed,string[]>  $expressionsMap)

Check if a set of expressions matches our configured groups.

Parameters

array<mixed,string[]> $expressionsMap

getGroupsWithExpressionsMap()

getGroupsWithExpressionsMap()

Get a map of `Record<string (group), string[] (expressions)>`.

getIdentifier()

getIdentifier()

Getter.

getOriginalExpressions()

getOriginalExpressions()

Getter.

getExtended()

getExtended()

Getter.

getRules()

getRules()

Getter.