BlockerPostType
extends AbstractBlockable
in package
implements
ImagePreviewBlockable
Uses
UtilsProvider, ImagePreviewBlockableTrait
Describe a blockable item by `WP_Post` custom post type.
Table of Contents
Interfaces
- ImagePreviewBlockable
- Provide an interface and mechanism to determine if a blockable should load a thumbnail via `ImagePreview`.
Properties
- $headlessContentBlocker : mixed
- $originalExpressions : array<string|int, string>
- Original rules from string rules.
- $post : mixed
- $regexp : mixed
- $selectorSyntaxFinder : array<string|int, SelectorSyntaxFinder>
- See `SelectorSyntaxFinder`.
- $variables : array<string|int, string>
- Variables can be passed as rule in format `:$myVar=...` and can be reused in selector syntax function arguments.
Methods
- __construct() : mixed
- C'tor.
- appendFromStringArray() : mixed
- Generate the custom element blockers and regular expressions and append it to this blockable instance.
- downloadImagePreviewFor() : bool
- See `ImagePreviewBlockable`.
- 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`.
- getOriginalExpressions() : array<string|int, string>
- Getter.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- getPost() : mixed
- 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.
- getSelectorSyntaxFinder() : mixed
- Getter.
- getVariable() : mixed
- getVariables() : mixed
- hasBlockerId() : mixed
- Determine if this blockable should be blocked.
Properties
$headlessContentBlocker
private
mixed
$headlessContentBlocker
$originalExpressions
Original rules from string rules.
private
array<string|int, string>
$originalExpressions
= []
$post
private
mixed
$post
$regexp
private
mixed
$regexp
= ['wildcard' => [], 'contains' => []]
$selectorSyntaxFinder
See `SelectorSyntaxFinder`.
private
array<string|int, SelectorSyntaxFinder>
$selectorSyntaxFinder
= []
$variables
Variables can be passed as rule in format `:$myVar=...` and can be reused in selector syntax function arguments.
private
array<string|int, string>
$variables
= []
Methods
__construct()
C'tor.
public
__construct(HeadlessContentBlocker $headlessContentBlocker, WP_Post $post) : mixed
Parameters
- $headlessContentBlocker : HeadlessContentBlocker
- $post : WP_Post
Tags
appendFromStringArray()
Generate the custom element blockers and regular expressions and append it to this blockable instance.
public
appendFromStringArray(array<string|int, string> $blockers) : mixed
Parameters
- $blockers : array<string|int, string>
downloadImagePreviewFor()
See `ImagePreviewBlockable`.
public
downloadImagePreviewFor(string $url, BlockedResult $result, AbstractMatch $match) : bool
Parameters
- $url : string
- $result : BlockedResult
- $match : AbstractMatch
Return values
boolfindSelectorSyntaxFinderForMatch()
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|nullgetContainsRegularExpressions()
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
stringgetOriginalExpressions()
Getter.
public
getOriginalExpressions() : array<string|int, string>
Return values
array<string|int, string>getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringgetPost()
Getter.
public
getPost() : mixed
Tags
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>getSelectorSyntaxFinder()
Getter.
public
getSelectorSyntaxFinder() : mixed
Tags
getVariable()
public
getVariable(mixed $variableName[, mixed $default = '' ]) : mixed
Parameters
- $variableName : mixed
- $default : mixed = ''
getVariables()
public
getVariables() : mixed
hasBlockerId()
Determine if this blockable should be blocked.
public
hasBlockerId() : mixed