\DevOwl\HeadlessContentBlocker\pluginsScriptInlineExtractExternalUrl

Detect semantically a script which could be loaded by an inline script.

If it finds an URL, it is put to the BlockedResult as Plugin.ScriptInlineExtractExternalUrl.

Example:

<script>(function(w, d, s, f, js, fjs) {
    (js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
    w._tbSettings = {
      tblocid: "DSPSxJyFMG5kkLGHq", width: "305px", color: "39a7df" };
    js.src = f; js.async = 1;
    fjs.parentNode.insertBefore(js, fjs);
})(window, document, "script", "https://static.teburio.de/widget.js");
</script>

Summary

Methods
Properties
Constants
__construct()
afterSetup()
init()
modifyHtmlAfterProcessing()
beforeMatch()
blockedMatch()
notBlockedMatch()
checkResult()
keepAlwaysAttributes()
skipInlineScriptVariableAssignment()
inlineStyleShouldBeExtracted()
inlineStyleModifyDocuments()
inlineStyleBlockRule()
visualParent()
blockableStringExpression()
getHeadlessContentBlocker()
extractExternalUrlFromInline()
No public properties found
BLOCKED_RESULT_DATA_KEY
No protected methods found
No protected properties found
N/A
No private methods found
$headlessContentBlocker
N/A

Constants

BLOCKED_RESULT_DATA_KEY

BLOCKED_RESULT_DATA_KEY ='Plugin.ScriptInlineExtractExternalUrl'

Properties

$headlessContentBlocker

$headlessContentBlocker :

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

See `AbstractPlugin`.

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.

extractExternalUrlFromInline()

extractExternalUrlFromInline(string  $markup)

Extract the URL from a given script-markup.

Parameters

string $markup