\DevOwl\FastHtmlTag\finderScriptInlineFinder

Find inline scripts.

Summary

Methods
Properties
Constants
getRegularExpression()
createMatch()
replace()
addCallback()
setFastHtmlTag()
getCallbacks()
getFastHtmlTag()
__construct()
isNotAnInlineScript()
prepareMatch()
No public properties found
SCRIPT_INLINE_REGEXP
applyCallbacks()
No protected properties found
N/A
No private methods found
$fastHtmlTag
$callbacks
N/A

Constants

SCRIPT_INLINE_REGEXP

SCRIPT_INLINE_REGEXP ='/<script([^>]*)>([^<]*(?:<(?!\/script>)[^<]*)*)<\/script>/smix'

Inline scripts are completely different than usual URL scripts. We need to get all available inline scripts, scrape their content and check if it needs to blocked.

Attention: This also captures usual script tags, so you have to check this manually via PHP if the src tag is given!

Available matches: $match[0] => Full string $match[1] => Attributes string after <script $match[2] => Full inline script

Properties

$callbacks

$callbacks :array<mixed,callable>

Callbacks.

Type

array<mixed,callable>

Methods

getRegularExpression()

getRegularExpression()

Get regular expression.

createMatch()

createMatch(array  $m): \DevOwl\FastHtmlTag\finder\match\AbstractMatch|false

See `AbstractRegexFinder`.

Parameters

array $m

Returns

\DevOwl\FastHtmlTag\finder\match\AbstractMatch|false —

Returns false if no match got found and we cannot process it

replace()

replace(string  $html)

Find HTML tags for this finder and replace it with our modifiers.

Parameters

string $html

addCallback()

addCallback(callable  $callback)

Add a callable. The first parameter is an instance of `AbstractMatch`.

Parameters

callable $callback

getCallbacks()

getCallbacks()

Getter.

getFastHtmlTag()

getFastHtmlTag()

Getter.

__construct()

__construct()

C'tor.

isNotAnInlineScript()

isNotAnInlineScript(array  $attributes)

Checks if the passed attributes of a found `<script` tag is not an inline script.

Parameters

array $attributes

prepareMatch()

prepareMatch(array  $m)

Prepare the result match of a `createRegexp` regexp.

Parameters

array $m