Constants

BLOCKED_RESULT_DATA_KEY_IGNORE_IN_SCANNER

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

Properties

$headlessContentBlocker

$headlessContentBlocker :

Type

$active

$active :

Type

$excludeHosts

$excludeHosts :

A list of excluded hosts.

Type

Methods

afterSetup()

afterSetup()

The content blocker got setup completely.

init()

init()

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

modifyHtmlAfterProcessing()

modifyHtmlAfterProcessing(string  $html)

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

Parameters

string $html

checkResult()

checkResult(\DevOwl\HeadlessContentBlocker\BlockedResult  $result,\DevOwl\HeadlessContentBlocker\matcher\AbstractMatcher  $matcher,\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match): \DevOwl\HeadlessContentBlocker\BlockedResult

Called after a match got found and the matcher decided, if it should be blocked or not.

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $result
\DevOwl\HeadlessContentBlocker\matcher\AbstractMatcher $matcher
\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match

Returns

\DevOwl\HeadlessContentBlocker\BlockedResult

inlineStyleShouldBeExtracted()

inlineStyleShouldBeExtracted(boolean  $extract,\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher  $matcher,\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch  $match): boolean

Do not extract blocked rules of a CSS inline script to a second document.

Parameters

boolean $extract
\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher $matcher
\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch $match

Returns

boolean

inlineStyleModifyDocuments()

inlineStyleModifyDocuments(\Sabberworm\CSS\CSSList\Document  $document,\Sabberworm\CSS\CSSList\Document  $extractedDocument,\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher  $matcher,\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch  $match): boolean

Allows to modify blocked CSS documents.

Parameters

\Sabberworm\CSS\CSSList\Document $document
\Sabberworm\CSS\CSSList\Document $extractedDocument
\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher $matcher
\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch $match

Returns

boolean

inlineStyleBlockRule()

inlineStyleBlockRule(\DevOwl\HeadlessContentBlocker\BlockedResult  $result,string  $url,\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher  $matcher,\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch  $match): boolean

Decide if a URL in a CSS rule should be blocked.

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $result
string $url
\DevOwl\HeadlessContentBlocker\matcher\StyleInlineMatcher|\DevOwl\HeadlessContentBlocker\matcher\StyleInlineAttributeMatcher $matcher
\DevOwl\FastHtmlTag\finder\match\StyleInlineMatch|\DevOwl\HeadlessContentBlocker\finder\match\StyleInlineAttributeMatch $match

Returns

boolean

visualParent()

visualParent(boolean|string|\DevOwl\HeadlessContentBlocker\number  $visualParent,\DevOwl\HeadlessContentBlocker\matcher\AbstractMatcher  $matcher,\DevOwl\FastHtmlTag\finder\match\AbstractMatch  $match): boolean|string|\DevOwl\HeadlessContentBlocker\number

Set a visual parent for a specific match.

Parameters

boolean|string|\DevOwl\HeadlessContentBlocker\number $visualParent
\DevOwl\HeadlessContentBlocker\matcher\AbstractMatcher $matcher
\DevOwl\FastHtmlTag\finder\match\AbstractMatch $match

Returns

boolean|string|\DevOwl\HeadlessContentBlocker\number

blockableStringExpression()

blockableStringExpression(string  $expression,\DevOwl\HeadlessContentBlocker\AbstractBlockable  $blockable): string

Allows to modify the passed string expression to a blockable.

Parameters

string $expression
\DevOwl\HeadlessContentBlocker\AbstractBlockable $blockable

Returns

string

getHeadlessContentBlocker()

getHeadlessContentBlocker()

Getter.

excludeHostByUrl()

excludeHostByUrl(string  $url)

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

Parameters

string $url

filterFalsePositives()

filterFalsePositives()

See `FalsePositivesProcessor`.

applyIgnoreByHosts()

applyIgnoreByHosts(array<mixed,string>  $hosts)

If you are providing a UI scanner, you can apply `ignore` to be `true` again for already ignored entries.

Parameters

array<mixed,string> $hosts

isNotAnExcludedUrl()

isNotAnExcludedUrl(string  $url)

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

Parameters

string $url

isStyleAttributeFalsePositive()

isStyleAttributeFalsePositive(string  $linkAttribute,string  $link)

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

Parameters

string $linkAttribute
string $link

flushResults()

flushResults()

Reset the scanner and return the found results.

setActive()

setActive(boolean  $active)

Setter.

Parameters

boolean $active

processBlockedByTagAttributeMatch()

processBlockedByTagAttributeMatch(\DevOwl\HeadlessContentBlocker\BlockedResult  $isBlocked,string  $linkAttribute,string  $link)

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

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $isBlocked
string $linkAttribute
string $link

processBlockedByScriptInlineMatch()

processBlockedByScriptInlineMatch(\DevOwl\HeadlessContentBlocker\BlockedResult  $isBlocked)

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

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $isBlocked

probablyMemorizeExternalUrl()

probablyMemorizeExternalUrl(\DevOwl\HeadlessContentBlocker\BlockedResult  $isBlocked,string  $url,string  $tag,string  $attribute,\DevOwl\HeadlessContentBlocker\Markup|null  $markup)

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

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $isBlocked
string $url
string $tag
string $attribute
\DevOwl\HeadlessContentBlocker\Markup|null $markup

probablyMemorizeIsBlocked()

probablyMemorizeIsBlocked(\DevOwl\HeadlessContentBlocker\BlockedResult  $isBlocked,string  $url,string  $tag,string  $attribute)

Probably memorize a blocked content.

Parameters

\DevOwl\HeadlessContentBlocker\BlockedResult $isBlocked
string $url
string $tag
string $attribute