Documentation

BlockableScanner extends AbstractPlugin
in package

Provide a scanner for our content blocker. That means, you can pass `ScannableBlockable` instances to your `HeadlessContentBlocker` instance and you can continually fetch the scanned blockables from this plugin instance.

Table of Contents

Constants

BLOCKED_RESULT_DATA_KEY_IGNORE_IN_SCANNER  = 'Plugin.BlockableScanner.ignore-in-scanner'

Properties

$active  : mixed
$excludeHosts  : mixed
A list of excluded hosts.
$headlessContentBlocker  : mixed
$results  : array<string|int, ScanEntry>
Scan results.
$sourceUrl  : string
The source URL of the current HTML.

Methods

__construct()  : mixed
C'tor.
afterSetup()  : mixed
The content blocker got setup completely.
beforeMatch()  : mixed
See `AbstractPlugin`.
blockableStringExpression()  : string
Allows to modify the passed string expression to a blockable.
blockedMatch()  : mixed
See `AbstractPlugin`.
checkResult()  : BlockedResult
Called after a match got found and the matcher decided, if it should be blocked or not.
excludeHostByUrl()  : mixed
Give any URL and the host is completely excluded from the scanner results. In most cases, you need to exclude your own host!
filterFalsePositives()  : mixed
See `FalsePositivesProcessor`.
flushResults()  : mixed
Reset the scanner and return the found results.
getHeadlessContentBlocker()  : mixed
Getter.
init()  : mixed
Initialize your plugin add e.g. new visual parent definitions.
inlineStyleBlockRule()  : bool
Decide if a URL in a CSS rule should be blocked.
inlineStyleModifyDocuments()  : bool
Allows to modify blocked CSS documents.
inlineStyleShouldBeExtracted()  : bool
Do not extract blocked rules of a CSS inline script to a second document.
isNotAnExcludedUrl()  : mixed
Check if a given URL is not excluded from our hosts.
isStyleAttributeFalsePositive()  : mixed
Example: `<div style="opacity:0"`. Here, the `opacity:0` could be considered as external URL.
keepAlwaysAttributes()  : array<string|int, string>
Keep attributes for a specific match.
modifyHtmlAfterProcessing()  : mixed
Allows to modify the HTML after the content blocker has done its job.
notBlockedMatch()  : mixed
See `AbstractPlugin`. Needed to obtain external URLs.
setActive()  : mixed
Setter.
setSourceUrl()  : mixed
Setter.
setup()  : mixed
Before the content blocker gets setup.
skipInlineScriptVariableAssignment()  : array<string|int, string>
See `AbstractPlugin`.
visualParent()  : bool|string|number
Set a visual parent for a specific match.
probablyMemorizeExternalUrl()  : mixed
Probably memorize an external URL when it got not blocked through template nor created content blocker.
probablyMemorizeIsBlocked()  : mixed
Probably memorize a blocked content.
processBlockedByScriptInlineMatch()  : mixed
Memorize when an inline script got blocked through a non-created template.
processBlockedBySelectorSyntax()  : mixed
Memorize when a custom element by CSS Selector got blocked through a non-created template.
processBlockedByTagAttributeMatch()  : mixed
Memorize when a content got blocked through a non-created template.

Constants

BLOCKED_RESULT_DATA_KEY_IGNORE_IN_SCANNER

public mixed BLOCKED_RESULT_DATA_KEY_IGNORE_IN_SCANNER = 'Plugin.BlockableScanner.ignore-in-scanner'

Properties

$excludeHosts

A list of excluded hosts.

private mixed $excludeHosts = []

$sourceUrl

The source URL of the current HTML.

private string $sourceUrl = null

Methods

afterSetup()

The content blocker got setup completely.

public afterSetup() : mixed

blockableStringExpression()

Allows to modify the passed string expression to a blockable.

public blockableStringExpression(string $expression, AbstractBlockable $blockable) : string
Parameters
$expression : string
$blockable : AbstractBlockable
Return values
string

excludeHostByUrl()

Give any URL and the host is completely excluded from the scanner results. In most cases, you need to exclude your own host!

public excludeHostByUrl(string $url) : mixed
Parameters
$url : string

filterFalsePositives()

See `FalsePositivesProcessor`.

public filterFalsePositives() : mixed

flushResults()

Reset the scanner and return the found results.

public flushResults() : mixed

getHeadlessContentBlocker()

Getter.

public final getHeadlessContentBlocker() : mixed

init()

Initialize your plugin add e.g. new visual parent definitions.

public init() : mixed

isNotAnExcludedUrl()

Check if a given URL is not excluded from our hosts.

public isNotAnExcludedUrl(string $url) : mixed
Parameters
$url : string

isStyleAttributeFalsePositive()

Example: `<div style="opacity:0"`. Here, the `opacity:0` could be considered as external URL.

public isStyleAttributeFalsePositive(string $linkAttribute, string $link) : mixed
Parameters
$linkAttribute : string
$link : string
Tags
see
https://regex101.com/r/gPlyEq/1

keepAlwaysAttributes()

Keep attributes for a specific match.

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>

modifyHtmlAfterProcessing()

Allows to modify the HTML after the content blocker has done its job.

public modifyHtmlAfterProcessing(string $html) : mixed
Parameters
$html : string

setActive()

Setter.

public setActive(bool $active) : mixed
Parameters
$active : bool

setSourceUrl()

Setter.

public setSourceUrl(string $url) : mixed
Parameters
$url : string

setup()

Before the content blocker gets setup.

public setup() : mixed

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

Set a visual parent for a specific match.

public visualParent(bool|string|number $visualParent, AbstractMatcher $matcher, AbstractMatch $match) : bool|string|number
Parameters
$visualParent : bool|string|number
$matcher : AbstractMatcher
$match : AbstractMatch
Return values
bool|string|number

probablyMemorizeExternalUrl()

Probably memorize an external URL when it got not blocked through template nor created content blocker.

protected probablyMemorizeExternalUrl(BlockedResult $isBlocked, string $url, string $tag, string $attribute, Markup|null $markup) : mixed
Parameters
$isBlocked : BlockedResult
$url : string
$tag : string
$attribute : string
$markup : Markup|null

probablyMemorizeIsBlocked()

Probably memorize a blocked content.

protected probablyMemorizeIsBlocked(BlockedResult $isBlocked, string|null $url, string $tag, string $attribute) : mixed
Parameters
$isBlocked : BlockedResult
$url : string|null
$tag : string
$attribute : string

processBlockedByScriptInlineMatch()

Memorize when an inline script got blocked through a non-created template.

protected processBlockedByScriptInlineMatch(BlockedResult $isBlocked) : mixed
Parameters
$isBlocked : BlockedResult

processBlockedBySelectorSyntax()

Memorize when a custom element by CSS Selector got blocked through a non-created template.

protected processBlockedBySelectorSyntax(BlockedResult $isBlocked, SelectorSyntaxMatch $match) : mixed
Parameters
$isBlocked : BlockedResult
$match : SelectorSyntaxMatch

processBlockedByTagAttributeMatch()

Memorize when a content got blocked through a non-created template.

protected processBlockedByTagAttributeMatch(BlockedResult $isBlocked, TagAttributeMatch $match) : mixed
Parameters
$isBlocked : BlockedResult
$match : TagAttributeMatch

        
On this page

Search results