Documentation

ScannableBlockable extends AbstractBlockable
in package

Describe a blockable item.

Table of Contents

Constants

DEFAULT_GROUP  = '__default__'
Every rule is within this group.

Properties

$currentlyAddingRules  : mixed
$extended  : mixed
$headlessContentBlocker  : mixed
$identifier  : mixed
$originalExpressions  : array<string|int, string>
Original rules from string rules.
$regexp  : mixed
$ruleGroups  : array<string|int, RuleGroup>
Each rule group gets an own instance of `RuleGroup`.
$rules  : array<string|int, Rule>
Each expression gets an own instance of `Rule`.
$selectorSyntaxFinder  : array<string|int, SelectorSyntaxFinder>
See `SelectorSyntaxFinder`.

Methods

__construct()  : mixed
C'tor.
addRules()  : mixed
Allows to add rules and rule groups dynamically.
appendFromStringArray()  : mixed
Generate the custom element blockers and regular expressions and append it to this blockable instance.
checkExpressionsMatchesGroups()  : mixed
Check if a set of expressions matches at least one in our configured groups.
findSelectorSyntaxFinderForMatch()  : mixed
Find a `SyntaxSelectorFinder` for a given `AbstractMatch`.
getBlockerId()  : int|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.
getContainsRegularExpressions()  : array<string|int, string>
Getter.
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`.
getExtended()  : mixed
Getter.
getGroupsWithExpressionsMap()  : mixed
Get a map of `Record<string (group), string[] (expressions)>`.
getIdentifier()  : mixed
Getter.
getOriginalExpressions()  : array<string|int, string>
Getter.
getRegularExpressions()  : array<string|int, string>
Getter.
getRequiredIds()  : array<string|int, int|string>
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.
getRuleGroups()  : mixed
Getter.
getRules()  : mixed
Getter.
getRulesByExpression()  : array<string|int, Rule>
Getter.
getSelectorSyntaxFinder()  : mixed
Getter.
hasBlockerId()  : mixed
Determine if this blockable should be blocked.

Constants

DEFAULT_GROUP

Every rule is within this group.

public mixed DEFAULT_GROUP = '__default__'

Properties

$originalExpressions

Original rules from string rules.

private array<string|int, string> $originalExpressions = []

$selectorSyntaxFinder

See `SelectorSyntaxFinder`.

private array<string|int, SelectorSyntaxFinder> $selectorSyntaxFinder = []

Methods

__construct()

C'tor.

public __construct(HeadlessContentBlocker $headlessContentBlocker, string $identifier[, string $extended = null ][, array<string|int, Rule>|array<string|int, array<string|int, mixed>> $rules = [] ][, array<string|int, RuleGroup>|array<string|int, array<string|int, mixed>> $ruleGroups = [] ]) : mixed

Example array for $rules:

[
    [
         'expression' => "*google.com/recaptcha*",
         'assignedToGroups' => 'script', // can be string[]
         'queryArgs' => [
              [
                  'queryArg' => 'id',
                  'isOptional' => true,
                  'regExp' => '/^UA-/'
              ]
         ],
         'needsRequiredSiblingRule' => false
    ]
]
Parameters
$headlessContentBlocker : HeadlessContentBlocker
$identifier : string
$extended : string = null

The parent extended template identifier

$rules : array<string|int, Rule>|array<string|int, array<string|int, mixed>> = []

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

$ruleGroups : array<string|int, RuleGroup>|array<string|int, array<string|int, mixed>> = []

You can also pass an array which gets automatically converted to RuleGroup.

Tags
codeCoverageIgnore

addRules()

Allows to add rules and rule groups dynamically.

public addRules(array<string|int, Rule>|array<string|int, array<string|int, mixed>>|array<string|int, string> $rules[, array<string|int, RuleGroup>|array<string|int, array<string|int, mixed>> $ruleGroups = [] ][, bool $appendFromStringArray = true ]) : mixed
Parameters
$rules : array<string|int, Rule>|array<string|int, array<string|int, mixed>>|array<string|int, string>

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

$ruleGroups : array<string|int, RuleGroup>|array<string|int, array<string|int, mixed>> = []

You can also pass an array which gets automatically converted to RuleGroup.

$appendFromStringArray : bool = true

Run $this->appendFromStringArray() for the added rules

appendFromStringArray()

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

public appendFromStringArray(mixed $blockers) : mixed
Parameters
$blockers : mixed

checkExpressionsMatchesGroups()

Check if a set of expressions matches at least one in our configured groups.

public checkExpressionsMatchesGroups(array<string|int, array<string|int, string>> $expressionsMap) : mixed

It returns only true when all configured groups got resolved.

Parameters
$expressionsMap : array<string|int, array<string|int, string>>

findSelectorSyntaxFinderForMatch()

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

public findSelectorSyntaxFinderForMatch(AbstractMatch $match) : mixed
Parameters
$match : AbstractMatch

getBlockerId()

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.

public getBlockerId() : int|null
Return values
int|null

getContainsRegularExpressions()

Getter.

public getContainsRegularExpressions() : array<string|int, string>
Return values
array<string|int, string>

getCriteria()

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

public getCriteria() : string

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

Return values
string

getGroupsWithExpressionsMap()

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

public getGroupsWithExpressionsMap() : mixed

getOriginalExpressions()

Getter.

public getOriginalExpressions() : array<string|int, string>
Return values
array<string|int, string>

getRegularExpressions()

Getter.

public getRegularExpressions() : array<string|int, string>
Return values
array<string|int, string>

getRequiredIds()

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.

public getRequiredIds() : array<string|int, int|string>
Return values
array<string|int, int|string>

getRulesByExpression()

Getter.

public getRulesByExpression(string $expression) : array<string|int, Rule>
Parameters
$expression : string
Tags
codeCoverageIgnore
Return values
array<string|int, Rule>

getSelectorSyntaxFinder()

Getter.

public getSelectorSyntaxFinder() : mixed
Tags
codeCoverageIgnore

hasBlockerId()

Determine if this blockable should be blocked.

public hasBlockerId() : mixed

        
On this page

Search results