Constants

HTML_TAG_IFRAME

HTML_TAG_IFRAME ='iframe'

HTML_TAG_DIV

HTML_TAG_DIV ='div'

HTML_ATTRIBUTE_SRC

HTML_ATTRIBUTE_SRC ='src'

HTML_ATTRIBUTE_ALTERNATIVE_SRC

HTML_ATTRIBUTE_ALTERNATIVE_SRC ='data-src'

Some plugins are using `data-src` (e.g. Thrive Architect) to provide the iframe to the frontend.

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

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.

transformUrl()

transformUrl(string  $link)

Transform a given YouTube / Vimeo URL to autoplay URL.

Parameters

string $link