PluginProbe
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager / 0.0.2
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager v0.0.2
0.0.11 0.0.10 0.0.9 0.0.8 0.0.7 0.0.6 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5
cookiez / classes / plugin-activation.php

plugin-activation.php in Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager 0.0.2, at classes/plugin-activation.php

42 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Cookiez\Classes;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 require_once COOKIEZ_PATH . 'modules/connect/classes/config.php';
10
11 use Cookiez\Modules\Connect\Classes\Config as CookiezConfig;
12 use ElementorOne\Admin\Components\Fields;
13 use ElementorOne\Admin\Config;
14 use ElementorOne\Connect\Classes\Data;
15
16 final class Plugin_Activation {
17 public function __construct( $file ) {
18 register_activation_hook( $file, [ $this, 'handle' ] );
19 }
20
21 public function handle(): void {
22 $cookiez_token_option = CookiezConfig::APP_PREFIX . Data::ACCESS_TOKEN;
23 $one_token_option = Config::APP_PREFIX . Data::ACCESS_TOKEN;
24 $migrated_plugins_option = Fields::SETTING_PREFIX . 'migrated_plugins';
25
26 $is_cookiez_connected = ! empty( get_option( $cookiez_token_option ) );
27 $is_one_connected = ! empty( get_option( $one_token_option ) );
28
29 if ( $is_cookiez_connected || ! $is_one_connected ) {
30 return;
31 }
32
33 $migrated_plugins = get_option( $migrated_plugins_option, [] );
34 if ( in_array( CookiezConfig::PLUGIN_SLUG, $migrated_plugins, true ) ) {
35 return;
36 }
37
38 $migrated_plugins[] = CookiezConfig::PLUGIN_SLUG;
39 update_option( $migrated_plugins_option, $migrated_plugins, false );
40 }
41 }
42