buffer
1 year ago
script_loader_tag
1 year ago
traits
1 year ago
Account_Service.php
1 year ago
Consent_API_Helper.php
1 year ago
Cookie_Consent.php
1 year ago
Cookie_Consent_Interface.php
1 year ago
Cookiebot_Activated.php
1 year ago
Cookiebot_Admin_Links.php
1 year ago
Cookiebot_Automatic_Updates.php
1 year ago
Cookiebot_Deactivated.php
1 year ago
Cookiebot_Frame.php
1 year ago
Cookiebot_Javascript_Helper.php
1 year ago
Cookiebot_Review.php
1 year ago
Cookiebot_WP.php
1 year ago
Dependency_Container.php
1 year ago
Settings_Page_Tab.php
1 year ago
Settings_Service.php
1 year ago
Settings_Service_Interface.php
1 year ago
Supported_Languages.php
1 year ago
Supported_Regions.php
1 year ago
WP_Rocket_Helper.php
1 year ago
Widgets.php
1 year ago
global-deprecations.php
1 year ago
helper.php
1 year ago
Cookiebot_Activated.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | namespace cybot\cookiebot\lib; |
| 4 | |
| 5 | use cybot\cookiebot\addons\Cookiebot_Addons; |
| 6 | use cybot\cookiebot\admin_notices\Cookiebot_Recommendation_Notice; |
| 7 | use Exception; |
| 8 | |
| 9 | class Cookiebot_Activated { |
| 10 | |
| 11 | |
| 12 | /** |
| 13 | * @throws Exception |
| 14 | */ |
| 15 | public function run() { |
| 16 | $this->delay_notice_recommandation_when_it_is_first_activation(); |
| 17 | |
| 18 | $this->set_to_mode_auto_when_no_cookiebot_id_is_set(); |
| 19 | |
| 20 | $this->set_addons_default_settings(); |
| 21 | } |
| 22 | |
| 23 | private function delay_notice_recommandation_when_it_is_first_activation() { |
| 24 | // Delay display of recommendation notice in 3 days if not activated earlier |
| 25 | if ( get_option( Cookiebot_Recommendation_Notice::COOKIEBOT_NOTICE_OPTION_KEY, false ) === false ) { |
| 26 | // Not set yet - this must be first activation - delay in 3 days |
| 27 | update_option( Cookiebot_Recommendation_Notice::COOKIEBOT_NOTICE_OPTION_KEY, strtotime( '+3 days' ) ); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | private function set_to_mode_auto_when_no_cookiebot_id_is_set() { |
| 32 | if ( Cookiebot_WP::get_cbid() === '' ) { |
| 33 | if ( is_multisite() ) { |
| 34 | update_site_option( 'cookiebot-cookie-blocking-mode', 'auto' ); |
| 35 | update_site_option( 'cookiebot-nooutput-admin', true ); |
| 36 | } else { |
| 37 | update_option( 'cookiebot-cookie-blocking-mode', 'auto' ); |
| 38 | update_option( 'cookiebot-nooutput-admin', true ); |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @throws Exception |
| 45 | */ |
| 46 | private function set_addons_default_settings() { |
| 47 | $cookiebot_addons = Cookiebot_Addons::instance(); |
| 48 | $cookiebot_addons->cookiebot_activated(); |
| 49 | } |
| 50 | } |
| 51 |