Documentation

Blocker
in package
Uses UtilsProvider

Block common HTML tags!

Table of Contents

Constants

BUTTON_CLICKED_IDENTIFIER  = 'unblock'
DEPENDANT_VISIBILITY_CONTAINERS  = [ '[role="tabpanel"]', // [Plugin Comp] https://wordpress.org/plugins/essential-addons-for-elementor-lite/ '.eael-tab-content-item', // [Plugin Comp] https://de.wordpress.org/plugins/wp-contact-slider/ '.wpcs_content_inner', // [Plugin Comp] OptimizePress '.op3-contenttoggleitem-content', // [Plugin Comp] Popup Maker '.pum-overlay', // [Plugin Comp] Elementor Pro Popups '[data-elementor-type="popup"]', // [Plugin Comp] https://ultimateblocks.com/content-toggle-accordion-block/ '.wp-block-ub-content-toggle-accordion-content-wrap', // [Plugin Comp] Impreza '.w-popup-wrap', // [Plugin Comp] Oxygen Builder '.oxy-lightbox_inner[data-inner-content=true]', '.oxy-pro-accordion_body', '.oxy-tab-content', // [Plugin Comp] https://wordpress.org/plugins/kadence-blocks/ '.kt-accordion-panel', // [Plugin Comp] WP Bakery Tabs '.vc_tta-panel-body', // [Plugin Comp] Magnific popup '.mfp-hide', // [Plugin Comp] Thrive Architect lightbox 'div[id^="tve_thrive_lightbox_"]', ]
Before trying to create a visual content blocker, check if the node is inside a given container and if it is, wait until this container is visible. For example, you are providing a sidebar with blocked content, you need to pass the selector for this sidebar.
FORCE_TIME_COMMENT_QUERY_ARG  = 'rcb-calc-time'
Force to output the needed computing time at the end of the page for debug purposes.
OB_START_PLUGINS_LOADED_PRIORITY  = (PHP_INT_MAX - 1) * -1
SET_VISUAL_PARENT_IF_CLASS_OF_PARENT  = [ // [Plugin Comp] Divi Builder 'et_pb_video_box' => 1, // [Theme Comp] Astra Theme (Gutenberg Block) 'ast-oembed-container' => 1, // [Plugin Comp] WP Bakery 'wpb_video_wrapper' => 1, // [Plugin Comp] GoodLayers page builder 'gdlr-core-pbf-background-video' => '.gdlr-core-pbf-background-wrap', ]
If a given class of the `parentElement` is given, set the visual parent. This is needed for some page builder and theme compatibilities. This is only used on client-side (see `findVisualParent`).

Properties

$headlessContentBlocker  : HeadlessContentBlocker
See `HeadlessContentBlocker`
$processedOutputBufferHtmlHashes  : mixed
A list of MD5 hashes of HTML strings which got successfully processed. This allows you to run `registerOutputBuffer` multiple times.

Methods

autoptimize_filter_css_exclude()  : mixed
Exclude blocked styles from autoptimize inline aggregation.
avf_exclude_assets()  : mixed
Exclude blocked styles and scripts
closeOutputBuffer()  : mixed
Close a output buffer. This is not necessarily needed as PHP automatically closes them, but in some cases it is needed to make the modified content available to previously read output buffers in e.g.
getHeadlessContentBlocker()  : mixed
Get `HeadlessContentBlocker` instance.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
instance()  : mixed
New instance.
modifyOEmbedHtmlToKeepOriginalUrl()  : mixed
Modify the HTML of an oEmbed HTML and keep the original pasted URL as attribute so our headless content blocker can generate an image preview from the original URL.
modifyUrlToSkipContentBlocker()  : mixed
Modify any URL and add a query argument to skip the content blocker mechanism.
ob_start()  : mixed
Event for ob_start.
registerOutputBuffer()  : mixed
Apply the content blocker attributes to the output buffer when it is enabled.
replace()  : mixed
Apply content blockers to a given HTML. It also supports JSON output.
createBlockables()  : array<string|int, AbstractBlockable>
Get all available blockables.
isAdminAjaxAction()  : mixed
Allows to modify content within a `admin-ajax.php` action.
isCurrentRequestException()  : mixed
Check if the current request should not load any blocking mechanism depending on a special condition.
isEnabled()  : mixed
Check if content blocker is enabled on the current request.
__construct()  : mixed
C'tor.

Constants

BUTTON_CLICKED_IDENTIFIER

public mixed BUTTON_CLICKED_IDENTIFIER = 'unblock'

DEPENDANT_VISIBILITY_CONTAINERS

Before trying to create a visual content blocker, check if the node is inside a given container and if it is, wait until this container is visible. For example, you are providing a sidebar with blocked content, you need to pass the selector for this sidebar.

public mixed DEPENDANT_VISIBILITY_CONTAINERS = [ '[role="tabpanel"]', // [Plugin Comp] https://wordpress.org/plugins/essential-addons-for-elementor-lite/ '.eael-tab-content-item', // [Plugin Comp] https://de.wordpress.org/plugins/wp-contact-slider/ '.wpcs_content_inner', // [Plugin Comp] OptimizePress '.op3-contenttoggleitem-content', // [Plugin Comp] Popup Maker '.pum-overlay', // [Plugin Comp] Elementor Pro Popups '[data-elementor-type="popup"]', // [Plugin Comp] https://ultimateblocks.com/content-toggle-accordion-block/ '.wp-block-ub-content-toggle-accordion-content-wrap', // [Plugin Comp] Impreza '.w-popup-wrap', // [Plugin Comp] Oxygen Builder '.oxy-lightbox_inner[data-inner-content=true]', '.oxy-pro-accordion_body', '.oxy-tab-content', // [Plugin Comp] https://wordpress.org/plugins/kadence-blocks/ '.kt-accordion-panel', // [Plugin Comp] WP Bakery Tabs '.vc_tta-panel-body', // [Plugin Comp] Magnific popup '.mfp-hide', // [Plugin Comp] Thrive Architect lightbox 'div[id^="tve_thrive_lightbox_"]', ]

FORCE_TIME_COMMENT_QUERY_ARG

Force to output the needed computing time at the end of the page for debug purposes.

public mixed FORCE_TIME_COMMENT_QUERY_ARG = 'rcb-calc-time'

OB_START_PLUGINS_LOADED_PRIORITY

public mixed OB_START_PLUGINS_LOADED_PRIORITY = (PHP_INT_MAX - 1) * -1

SET_VISUAL_PARENT_IF_CLASS_OF_PARENT

If a given class of the `parentElement` is given, set the visual parent. This is needed for some page builder and theme compatibilities. This is only used on client-side (see `findVisualParent`).

public mixed SET_VISUAL_PARENT_IF_CLASS_OF_PARENT = [ // [Plugin Comp] Divi Builder 'et_pb_video_box' => 1, // [Theme Comp] Astra Theme (Gutenberg Block) 'ast-oembed-container' => 1, // [Plugin Comp] WP Bakery 'wpb_video_wrapper' => 1, // [Plugin Comp] GoodLayers page builder 'gdlr-core-pbf-background-video' => '.gdlr-core-pbf-background-wrap', ]

Properties

$processedOutputBufferHtmlHashes

A list of MD5 hashes of HTML strings which got successfully processed. This allows you to run `registerOutputBuffer` multiple times.

private mixed $processedOutputBufferHtmlHashes = []

Methods

avf_exclude_assets()

Exclude blocked styles and scripts

public avf_exclude_assets(array<string|int, mixed> $assets) : mixed
Parameters
$assets : array<string|int, mixed>

closeOutputBuffer()

Close a output buffer. This is not necessarily needed as PHP automatically closes them, but in some cases it is needed to make the modified content available to previously read output buffers in e.g.

public closeOutputBuffer() : mixed

earlier WordPress hook lifecycle.

getHeadlessContentBlocker()

Get `HeadlessContentBlocker` instance.

public getHeadlessContentBlocker() : mixed

getPluginConstantPrefix()

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

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

instance()

New instance.

public static instance() : mixed
Tags
codeCoverageIgnore

modifyUrlToSkipContentBlocker()

Modify any URL and add a query argument to skip the content blocker mechanism.

public modifyUrlToSkipContentBlocker(string $url) : mixed
Parameters
$url : string

ob_start()

Event for ob_start.

public ob_start(string $response) : mixed
Parameters
$response : string

registerOutputBuffer()

Apply the content blocker attributes to the output buffer when it is enabled.

public registerOutputBuffer() : mixed

You can start this output buffer multiple times as it is safe to avoid execution of same strings multiple times for the headless content blocker (e.g. multiple WordPress hook lifecycle).

replace()

Apply content blockers to a given HTML. It also supports JSON output.

public replace(string $html) : mixed

If you want to use this functionality in your plugin, please use the filter Consent/Block/HTML instead!

Parameters
$html : string

isAdminAjaxAction()

Allows to modify content within a `admin-ajax.php` action.

protected isAdminAjaxAction() : mixed

isCurrentRequestException()

Check if the current request should not load any blocking mechanism depending on a special condition.

protected isCurrentRequestException() : mixed

isEnabled()

Check if content blocker is enabled on the current request.

protected isEnabled() : mixed

__construct()

C'tor.

private __construct() : mixed
Tags
codeCoverageIgnore

        
On this page

Search results