Documentation

BannerLink
in package
Uses UtilsProvider

Register banner link (currently only footer links) custom post type.

Table of Contents

Constants

CPT_NAME  = 'rcb-banner-link'
META_KEYS  = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_TYPE, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_ID, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_HIDE_COOKIE_BANNER, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_TARGET_BLANK]
META_NAME_EXTERNAL_URL  = 'externalUrl'
META_NAME_HIDE_COOKIE_BANNER  = 'hideCookieBanner'
META_NAME_IS_EXTERNAL_URL  = 'isExternalUrl'
META_NAME_IS_TARGET_BLANK  = 'isTargetBlank'
Should the link be opened in a new window?
META_NAME_PAGE_ID  = 'pageId'
META_NAME_PAGE_TYPE  = 'pageType'
SYNC_META_COPY  = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_TYPE, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_ID, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_HIDE_COOKIE_BANNER, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_TARGET_BLANK]
SYNC_META_COPY_ONCE  = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_EXTERNAL_URL]
SYNC_OPTIONS  = ['data' => ['menu_order'], 'meta' => ['copy' => \DevOwl\RealCookieBanner\settings\BannerLink::SYNC_META_COPY, 'copy-once' => \DevOwl\RealCookieBanner\settings\BannerLink::SYNC_META_COPY_ONCE]]

Properties

$cacheGetOrdered  : mixed
$me  : BannerLink
Singleton instance.

Methods

added_or_updated_post_meta()  : mixed
When the privacy policy page gets adjusted, let's update the checklist if Real Cookie Banner is mentioned in the privacy policy and if a privacy policy page is set.
createDefaults()  : mixed
Create default banner links (legal notice, privacy policy) from options known from older Real Cookie Banner versions or just blank links, so the user does not need to click on "Add another link" in the Settings UI.
delete_post()  : mixed
When a page gets deleted, check if the value is our configured banner links and reset the value accordingly.
getInstance()  : BannerLink
Get singleton instance.
getLegalLink()  : mixed
Get legal link (legal notice or privacy policy) as URL or page ID.
getOrdered()  : array<string|int, WP_Post>|WP_Error
Get all available banner links ordered.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
register()  : mixed
Register custom post type.
save_post_page()  : mixed
A page got updated, check if it is our privacy policy and recalculate the checklist.
toJson()  : mixed
Localize available banner links for frontend.
update_option_wp_page_for_privacy_policy()  : mixed
When Settings > Privacy got adjusted, apply the new privacy policy to the banner links, too.
__construct()  : mixed
C'tor.

Constants

CPT_NAME

public mixed CPT_NAME = 'rcb-banner-link'

META_KEYS

public mixed META_KEYS = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_TYPE, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_ID, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_HIDE_COOKIE_BANNER, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_TARGET_BLANK]

META_NAME_EXTERNAL_URL

public mixed META_NAME_EXTERNAL_URL = 'externalUrl'
public mixed META_NAME_HIDE_COOKIE_BANNER = 'hideCookieBanner'

META_NAME_IS_EXTERNAL_URL

public mixed META_NAME_IS_EXTERNAL_URL = 'isExternalUrl'

META_NAME_IS_TARGET_BLANK

Should the link be opened in a new window?

public mixed META_NAME_IS_TARGET_BLANK = 'isTargetBlank'
Tags
deprecated

Just used for backwards-compatibility

META_NAME_PAGE_ID

public mixed META_NAME_PAGE_ID = 'pageId'

META_NAME_PAGE_TYPE

public mixed META_NAME_PAGE_TYPE = 'pageType'

SYNC_META_COPY

public mixed SYNC_META_COPY = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_TYPE, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_EXTERNAL_URL, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_PAGE_ID, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_HIDE_COOKIE_BANNER, \DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_IS_TARGET_BLANK]

SYNC_META_COPY_ONCE

public mixed SYNC_META_COPY_ONCE = [\DevOwl\RealCookieBanner\settings\BannerLink::META_NAME_EXTERNAL_URL]

SYNC_OPTIONS

public mixed SYNC_OPTIONS = ['data' => ['menu_order'], 'meta' => ['copy' => \DevOwl\RealCookieBanner\settings\BannerLink::SYNC_META_COPY, 'copy-once' => \DevOwl\RealCookieBanner\settings\BannerLink::SYNC_META_COPY_ONCE]]

Properties

$cacheGetOrdered

private mixed $cacheGetOrdered = []

Methods

added_or_updated_post_meta()

When the privacy policy page gets adjusted, let's update the checklist if Real Cookie Banner is mentioned in the privacy policy and if a privacy policy page is set.

public added_or_updated_post_meta(int $meta_id, int $object_id, string $meta_key, mixed $meta_value) : mixed
Parameters
$meta_id : int
$object_id : int
$meta_key : string
$meta_value : mixed

createDefaults()

Create default banner links (legal notice, privacy policy) from options known from older Real Cookie Banner versions or just blank links, so the user does not need to click on "Add another link" in the Settings UI.

public createDefaults([bool $backwardsCompatibility = false ]) : mixed
Parameters
$backwardsCompatibility : bool = false

If true, it will try to restore the links from previous installed version

delete_post()

When a page gets deleted, check if the value is our configured banner links and reset the value accordingly.

public delete_post(number $postId) : mixed
Parameters
$postId : number

Get legal link (legal notice or privacy policy) as URL or page ID.

public getLegalLink(string $pageType, string $returnType) : mixed
Parameters
$pageType : string
$returnType : string

Can be url or id

getOrdered()

Get all available banner links ordered.

public getOrdered([bool $force = false ][, array<string|int, WP_Post$usePosts = null ]) : array<string|int, WP_Post>|WP_Error
Parameters
$force : bool = false
$usePosts : array<string|int, WP_Post> = null

If set, only meta is applied to the passed posts

Return values
array<string|int, WP_Post>|WP_Error

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

register()

Register custom post type.

public register() : mixed

save_post_page()

A page got updated, check if it is our privacy policy and recalculate the checklist.

public save_post_page(int $postId) : mixed
Parameters
$postId : int

toJson()

Localize available banner links for frontend.

public toJson() : mixed

update_option_wp_page_for_privacy_policy()

When Settings > Privacy got adjusted, apply the new privacy policy to the banner links, too.

public update_option_wp_page_for_privacy_policy(int $old_value, int $new_value) : mixed
Parameters
$old_value : int
$new_value : int

__construct()

C'tor.

private __construct() : mixed

        
On this page

Search results