diff --git a/src/lib/Cookiebot_Activated.php b/src/lib/Cookiebot_Activated.php index 0314bbf3..1328a16a 100644 --- a/src/lib/Cookiebot_Activated.php +++ b/src/lib/Cookiebot_Activated.php @@ -87,13 +87,13 @@ private function set_to_mode_auto_when_no_cookiebot_id_is_set() { private function set_banner_enabled_by_default() { $enabled = get_option( 'cookiebot-banner-enabled', 'default' ); $cbid = Cookiebot_WP::get_cbid(); - + // Set to enabled if it's a fresh install (default) if ( $enabled === 'default' ) { $enabled = '1'; update_option( 'cookiebot-banner-enabled', $enabled ); } - + // If banner is disabled but CBID is configured, it was disabled by hosting or plugin update. Re-enable it. if ( $enabled === '0' && ! empty( $cbid ) ) { update_option( 'cookiebot-banner-enabled', '1' ); diff --git a/src/lib/script_loader_tag/Script_Loader_Tag.php b/src/lib/script_loader_tag/Script_Loader_Tag.php index 4964c65b..e27f8131 100644 --- a/src/lib/script_loader_tag/Script_Loader_Tag.php +++ b/src/lib/script_loader_tag/Script_Loader_Tag.php @@ -111,7 +111,7 @@ function ( $tag ) use ( $handle ) { public function cookiebot_add_consent_attribute_to_script_tag( $attributes ) { // First, check if this script requires consent (registered via add_tag) $handle = $this->extract_handle_from_attributes( $attributes ); - + if ( $handle && array_key_exists( $handle, $this->tags ) && ! empty( $this->tags[ $handle ] ) ) { $attributes['type'] = 'text/plain'; $attributes['data-cookieconsent'] = implode( ',', $this->tags[ $handle ] ); @@ -141,7 +141,7 @@ public function cookiebot_add_consent_attribute_to_inline_script_tag( $attribute // Check if inline script belongs to a consent-required parent script $base_handle = $this->extract_base_id_from_inline_id( $attributes['id'] ); - + if ( $base_handle && array_key_exists( $base_handle, $this->tags ) && ! empty( $this->tags[ $base_handle ] ) ) { $attributes['type'] = 'text/plain'; $attributes['data-cookieconsent'] = implode( ',', $this->tags[ $base_handle ] );