Using the BorlabsCookieHelper() function, third-party developers can create their own Content Blockers and make changes to blocked content at runtime. Blocking individual content is also possible with this function.
addContentBlocker
Adds a Content Blocker. If the system uses the Multilanguage Plugin WPML or Polylang, the Content Blocker is created for all languages.
Usage
BorlabsCookieHelper()->addContentBlocker($contentBlockerId, $name, $description = '', $privacyPolicyURL = '', $hosts, $previewHTML, $previewCSS = '', $globalJS = '', $initJS = '', $settings = [], $status = false, $undeletable = false);
Arguments
Argument | Type | Description |
---|---|---|
$contentBlockerId | String, Pattern: [a-z-_]{3,} | The ID of the Content Blocker. If the ID is already in use, the Content Blocker is not created. |
$name | String | Name of the Content Blocker. |
$description | String | Description of the Content Blocker. Displayed first when editing the Content Blocker. (Optional) |
$privacyPolicyURL | String | URL to the privacy policy. (Optional) |
$hosts | Array | Hosts that are to be assigned to this Content Blocker. |
$previewHTML | String | The HTML code of the preview of the blocked content. |
$previewCSS | String | CSS-Code of the Content Blocker. (Optional) |
$globalJS | String | Global JavaScript. Use pure JavaScript. (Optional) |
$initJS | String | Initial JavaScript. Use pure JavaScript. The variable el contains the unlocked object. (Optional) |
$settings | Array | Additional settings for the Content Blocker. (Optional) |
$status | Bool | Status of the Content Blocker. (Optional) Default: false |
$undeletable | Bool | Content Blocker cannot be deleted. (Optional) Default: false |
blockContent
Blocks the transferred content.
Usage
BorlabsCookieHelper()->blockContent($content, $contentBlockerId, $title = '');
Arguments
Argument | Type | Description |
---|---|---|
$content | String | Content to be blocked. |
$contentBlockerId | String | The ID of the Content Blocker. |
$title | String | Title. (Optional) |
blockCookie
Blocks the transferred content. The content is unblocked if there is a consent for the Cookie.
Usage
BorlabsCookieHelper()->blockCookie($content, $cookieId);
Arguments
Argument | Type | Description |
---|---|---|
$content | String | Content to be blocked. |
$cookieId | String | The ID of the Cookie. |
blockCookieGroup
Blocks the transferred content. The content will be unblocked if there is a consent for the Cookie Group.
Usage
BorlabsCookieHelper()->blockCookieGroup($content, $cookieGroupId);
Arguments
Argument | Type | Description |
---|---|---|
$content | String | Content to be blocked. |
$cookieGroupId | String | The ID of the Cookie Group. |
blockIframes
Searches for and blocks iframes in the content transferred.
Usage
BorlabsCookieHelper()->blockIframes($content);
Arguments
Argument | Type | Description |
---|---|---|
$content | String | Content with iframes that are to be blocked. |
deleteContentBlocker
Deletes a Content Blocker.
Usage
BorlabsCookieHelper()->deleteContentBlocker($contentBlockerId);
Arguments
Argument | Type | Description |
---|---|---|
$contentBlockerId | String | The ID of the Content Blocker. |
gaveConsent
Returns true if permission was granted for the Cookie ID.
Usage
BorlabsCookieHelper()->gaveConsent($cookieId);
Arguments
Argument | Type | Beschreibung |
---|---|---|
$cookieID | String | The ID of the Cookie. |
getContentBlockerData
Returns all information about a Content Blocker.
Usage
BorlabsCookieHelper()->getContentBlockerData($contentBlockerId);
Arguments
Argument | Type | Description |
---|---|---|
$contentBlockerId | String | The ID of the Content Blocker. |
getContentBlockerDataById
Returns all information about a Content Blocker using the id (not the Content Blocker ID).
Usage
BorlabsCookieHelper()->getContentBlockerDataById($id);
Arguments
Argument | Type | Description |
---|---|---|
$id | Integer | The id ( `id` ) of the Content Blocker. Available when editing a Content Blocker in the backend when saving and validating. |
getCurrentTitleOfContentBlocker
Returns the title of the current blocked content.
Usage
BorlabsCookieHelper()->getCurrentTitleOfContentBlocker();
setCurrentBlockedContent
Overwrites the content to be blocked.
Usage
BorlabsCookieHelper()->setCurrentBlockedContent($content);
Arguments
Argument | Type | Description |
---|---|---|
$content | String | Content to be blocked. |
updateContentBlockerJavaScript
Overwrites the settings and JavaScript of a Content Blocker at runtime.
Usage
BorlabsCookieHelper()->updateContentBlockerJavaScript($contentBlockerId, $globalJS = '', $initJS = '', $settings = []);
Arguments
Argument | Type | Description |
---|---|---|
$contentBlockerId | String | The ID of the Content Blocker. |
$globalJS | String | Global JavaScript. Use pure JavaScript. (Optional) |
$initJS | String | Initial JavaScript. Use pure JavaScript. (Optional) |
$settings | Array | Additional settings for the Content Blocker. |