Constants

MIME_TYPE_JAVASCRIPT

MIME_TYPE_JAVASCRIPT ='text/javascript'

MIME_TYPE_CSS

MIME_TYPE_CSS ='text/css'

MIME_TYPE_HTML

MIME_TYPE_HTML ='text/html'

TRANSIENT_SCANNED_EXTERNAL_URLS

TRANSIENT_SCANNED_EXTERNAL_URLS =RCB_OPT_PREFIX . '-scanned-external-urls'

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

Returns

string

__construct()

__construct()

C'tor.

getMarkup()

getMarkup(integer|array<mixed,integer>  $ids)

Get markup by ID. This also returns the mime type used for the blocked content.

This can also be null when the scanned element is only blocked by URL (e.g. not by inline script, style or SelectorSyntaxBlocker).

Parameters

integer|array<mixed,integer> $ids

getScannedEntriesCount()

getScannedEntriesCount(): integer

Get a count of all scanned entries.

Returns

integer

getScannedSourceUrls()

getScannedSourceUrls()

Get all (known) scanned pages.

getIgnoredHosts()

getIgnoredHosts()

Get all ignored hosts. This is needed e.g. to re-ignore new scan entries.

removeSourceUrls()

removeSourceUrls(array<mixed,string>  $urls): integer

Remove scanned entries by source urls. This can be useful if you know a page got deleted.

Parameters

array<mixed,string> $urls

Returns

integer

ignoreBlockedUrlHosts()

ignoreBlockedUrlHosts(array<mixed,string>  $hosts,boolean  $state = true): integer

Ignore blocked URLs by host.

Parameters

array<mixed,string> $hosts
boolean $state

Set to false to unignore the host

Returns

integer

getScannedCombinedResults()

getScannedCombinedResults()

Get a list of found presets and external URL hosts.

getScannedPresets()

getScannedPresets()

Get scanned presets with details about the amount of found times, if ignored by the user, and the last scanned.

getScannedExternalUrls()

getScannedExternalUrls(): array

Get scanned external URLs aggregated by host.

Attention: This query is cached to a transient as it is very expensive! Use delete_transient(Query::TRANSIENT_SCANNED_EXTERNAL_URLS) to invalidate the cache.

Returns

array

getAllScannedExternalUrlsBy()

getAllScannedExternalUrlsBy(string  $by,string  $value)

Get scanned external URLs by host. This includes source page and complete blocked URL instead of only host.

Parameters

string $by

Can be host or preset

string $value

revisionCurrent()

revisionCurrent(array  $revision)

Provide a count for all scan results.

Parameters

array $revision

checkIfMarkupIsBlocked()

checkIfMarkupIsBlocked(array<mixed,integer>  $ids,array  $result)

Check server-side via PHP if the markup got blocked by an existing content blocker.

Parameters

array<mixed,integer> $ids
array $result

getExistingUrlExpressions()

getExistingUrlExpressions()

Calculate all existing expressions for blocked URLs.

transformExpressionsToMySQL()

transformExpressionsToMySQL(array<mixed,string>  $expressions,string  $column)

Transform a set of expression strings to a valid SQL statement. The regular expressions are combined with `OR` so you can check e.g. an URL column if it matches.

Parameters

array<mixed,string> $expressions
string $column