Plugin
extends AbstractPlugin
in package
Uses
UtilsProvider
Real Cookie Banner plugin for `HeadlessContentBlocker`.
Table of Contents
Constants
- TABLE_NAME_BLOCKER_THUMBNAILS = 'blocker_thumbnails'
Properties
- $headlessContentBlocker : mixed
- $wpContentDir : mixed
Methods
- __construct() : mixed
- C'tor.
- afterSetup() : mixed
- The content blocker got setup completely.
- beforeMatch() : mixed
- Called before a match got found.
- beforeSetBlockedInResult() : bool
- See `AbstractPlugin`. In this plugin we do only allow `wordpress-filter:%s*` expressions for pseudo elements catched by the e.g. `pre_http_request` filter.
- blockableStringExpression() : string
- See `AbstractPlugin`.
- blockedMatch() : mixed
- See `AbstractPlugin`.
- checkResult() : BlockedResult
- See `AbstractPlugin`.
- getHeadlessContentBlocker() : mixed
- Getter.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- init() : mixed
- Initialize your plugin add e.g. new visual parent definitions.
- inlineStyleBlockRule() : bool
- See `AbstractPlugin`.
- inlineStyleModifyDocuments() : bool
- See `AbstractPlugin`.
- inlineStyleShouldBeExtracted() : bool
- See `AbstractPlugin`.
- iterateBlockablesInString() : mixed
- This method is run while iterating blockables and check if rules are found within a string.
- keepAlwaysAttributes() : array<string|int, string>
- See `AbstractPlugin`.
- modifyBlockables() : array<string|int, AbstractBlockable>
- Modify the blockables array before it gets registered.
- modifyHtmlAfterProcessing() : mixed
- See `AbstractPlugin`.
- notBlockedMatch() : mixed
- Called after a match got not blocked. Opposite of `blockedMatch`.
- setup() : mixed
- Before the content blocker gets setup.
- skipInlineScriptVariableAssignment() : array<string|int, string>
- See `AbstractPlugin`.
- visualParent() : bool|string|number
- See `AbstractPlugin`.
Constants
TABLE_NAME_BLOCKER_THUMBNAILS
public
mixed
TABLE_NAME_BLOCKER_THUMBNAILS
= 'blocker_thumbnails'
Properties
$headlessContentBlocker
private
mixed
$headlessContentBlocker
$wpContentDir
private
mixed
$wpContentDir
Methods
__construct()
C'tor.
public
final __construct(HeadlessContentBlocker $headlessContentBlocker) : mixed
Parameters
- $headlessContentBlocker : HeadlessContentBlocker
afterSetup()
The content blocker got setup completely.
public
afterSetup() : mixed
Tags
beforeMatch()
Called before a match got found.
public
beforeMatch(AbstractMatcher $matcher, AbstractMatch $match) : mixed
Parameters
- $matcher : AbstractMatcher
- $match : AbstractMatch
Tags
beforeSetBlockedInResult()
See `AbstractPlugin`. In this plugin we do only allow `wordpress-filter:%s*` expressions for pseudo elements catched by the e.g. `pre_http_request` filter.
public
beforeSetBlockedInResult(BlockedResult $result, AbstractBlockable $blockable, string $expression, AbstractMatcher $matcher) : bool
Parameters
- $result : BlockedResult
- $blockable : AbstractBlockable
- $expression : string
- $matcher : AbstractMatcher
Return values
boolblockableStringExpression()
See `AbstractPlugin`.
public
blockableStringExpression(string $expression, AbstractBlockable $blockable) : string
Parameters
- $expression : string
- $blockable : AbstractBlockable
Return values
stringblockedMatch()
See `AbstractPlugin`.
public
blockedMatch(BlockedResult $result, AbstractMatcher $matcher, AbstractMatch $match) : mixed
Parameters
- $result : BlockedResult
- $matcher : AbstractMatcher
- $match : AbstractMatch
checkResult()
See `AbstractPlugin`.
public
checkResult(BlockedResult $result, AbstractMatcher $matcher, AbstractMatch $match) : BlockedResult
Parameters
- $result : BlockedResult
- $matcher : AbstractMatcher
- $match : AbstractMatch
Return values
BlockedResultgetHeadlessContentBlocker()
Getter.
public
final getHeadlessContentBlocker() : mixed
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringinit()
Initialize your plugin add e.g. new visual parent definitions.
public
init() : mixed
inlineStyleBlockRule()
See `AbstractPlugin`.
public
inlineStyleBlockRule(BlockedResult $result, string $url, StyleInlineMatcher|StyleInlineAttributeMatcher $matcher, StyleInlineMatch|StyleInlineAttributeMatch $match) : bool
Parameters
- $result : BlockedResult
- $url : string
- $matcher : StyleInlineMatcher|StyleInlineAttributeMatcher
- $match : StyleInlineMatch|StyleInlineAttributeMatch
Return values
boolinlineStyleModifyDocuments()
See `AbstractPlugin`.
public
inlineStyleModifyDocuments(Document $document, Document $extractedDocument, StyleInlineMatcher|StyleInlineAttributeMatcher $matcher, StyleInlineMatch|StyleInlineAttributeMatch $match) : bool
Parameters
- $document : Document
- $extractedDocument : Document
- $matcher : StyleInlineMatcher|StyleInlineAttributeMatcher
- $match : StyleInlineMatch|StyleInlineAttributeMatch
Return values
boolinlineStyleShouldBeExtracted()
See `AbstractPlugin`.
public
inlineStyleShouldBeExtracted(bool $extract, StyleInlineMatcher|StyleInlineAttributeMatcher $matcher, StyleInlineMatch|StyleInlineAttributeMatch $match) : bool
Parameters
- $extract : bool
- $matcher : StyleInlineMatcher|StyleInlineAttributeMatcher
- $match : StyleInlineMatch|StyleInlineAttributeMatch
Return values
booliterateBlockablesInString()
This method is run while iterating blockables and check if rules are found within a string.
public
iterateBlockablesInString(AbstractMatcher $matcher, BlockedResult $result, string $string, bool $useContainsRegularExpression, bool $multilineRegexp, array<string|int, string> $useRegularExpressionFromMap, array<string|int, AbstractBlockable> $useBlockables, bool $allowMultiple) : mixed
It allows you to add additional blockables to the result even if isAllowMultipleBlockerResults is false.
Note: All required IDs from each matching Blockable will be merged together, but only the ID of the first Blockable found
will be assigned as the consent-id of the element.
Parameters
- $matcher : AbstractMatcher
- $result : BlockedResult
- $string : string
- $useContainsRegularExpression : bool
- $multilineRegexp : bool
- $useRegularExpressionFromMap : array<string|int, string>
- $useBlockables : array<string|int, AbstractBlockable>
- $allowMultiple : bool
Tags
keepAlwaysAttributes()
See `AbstractPlugin`.
public
keepAlwaysAttributes(array<string|int, string> $keepAttributes, AbstractMatcher $matcher, AbstractMatch $match) : array<string|int, string>
Parameters
- $keepAttributes : array<string|int, string>
- $matcher : AbstractMatcher
- $match : AbstractMatch
Return values
array<string|int, string>modifyBlockables()
Modify the blockables array before it gets registered.
public
modifyBlockables(array<string|int, AbstractBlockable> $blockables) : array<string|int, AbstractBlockable>
Parameters
- $blockables : array<string|int, AbstractBlockable>
Tags
Return values
array<string|int, AbstractBlockable>modifyHtmlAfterProcessing()
See `AbstractPlugin`.
public
modifyHtmlAfterProcessing(string $html) : mixed
Parameters
- $html : string
notBlockedMatch()
Called after a match got not blocked. Opposite of `blockedMatch`.
public
notBlockedMatch(BlockedResult $result, AbstractMatcher $matcher, AbstractMatch $match) : mixed
Parameters
- $result : BlockedResult
- $matcher : AbstractMatcher
- $match : AbstractMatch
Tags
setup()
Before the content blocker gets setup.
public
setup() : mixed
Tags
skipInlineScriptVariableAssignment()
See `AbstractPlugin`.
public
skipInlineScriptVariableAssignment(array<string|int, string> $names, ScriptInlineMatcher $matcher, ScriptInlineMatch $match) : array<string|int, string>
Parameters
- $names : array<string|int, string>
- $matcher : ScriptInlineMatcher
- $match : ScriptInlineMatch
Return values
array<string|int, string>visualParent()
See `AbstractPlugin`.
public
visualParent(bool|string|number $visualParent, AbstractMatcher $matcher, AbstractMatch $match) : bool|string|number
Parameters
- $visualParent : bool|string|number
- $matcher : AbstractMatcher
- $match : AbstractMatch