PluginProbe
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.7.5
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.7.5
4.7.4 4.7.5 4.7.3 4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 All 95 releases
cookiebot / src / admin_notices / Cookiebot_Recommendation_Notice.php

Cookiebot_Recommendation_Notice.php in Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode 4.7.5, at src/admin_notices/Cookiebot_Recommendation_Notice.php

96 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace cybot\cookiebot\admin_notices;
4
5 use function cybot\cookiebot\lib\get_view_html;
6
7 class Cookiebot_Recommendation_Notice extends Cookiebot_Base_Notice {
8
9 const COOKIEBOT_NOTICE_OPTION_KEY = 'cookiebot_notice_recommend';
10 const COOKIEBOT_NOTICE_TEMPLATE_PATH = 'admin/notices/cookiebot-recommendation-notice.php';
11 const COOKIEBOT_NOTICE_LINK_TEMPLATE_PATH = 'admin/notices/cookiebot-recommendation-notice-links.php';
12
13 const COOKIEBOT_NOTICE_TIMES = array(
14 'later' => array(
15 'msg' => 'Never show again is clicked',
16 'action' => 'hide_temp_notice',
17 'name' => 'review_nonce',
18 'str' => false,
19 'time' => 'hide',
20 ),
21 'hide' => array(
22 'msg' => 'Never show again is clicked',
23 'action' => 'hide_recommendation',
24 'name' => 'review_nonce',
25 'str' => false,
26 'time' => 'hide',
27 ),
28 'visit' => array(
29 'msg' => 'Show me after 1 day',
30 'action' => 'hide_recommendation_next',
31 'name' => 'review_nonce',
32 'str' => true,
33 'time' => '+1 day',
34 ),
35 'two_week' => array(
36 'msg' => 'Show me after 2 weeks',
37 'action' => 'hide_recommendation_for_two_weeks',
38 'name' => 'review_nonce',
39 'str' => true,
40 'time' => '+2 weeks',
41 ),
42 );
43
44 public function __construct() {
45 parent::__construct();
46 // Check if recommendation notice delay option exists
47 if ( get_option( static::COOKIEBOT_NOTICE_OPTION_KEY, false ) === false ) {
48 // Delay in 1 day
49 add_option( static::COOKIEBOT_NOTICE_OPTION_KEY, strtotime( '+1 day' ) );
50 }
51 }
52
53 /**
54 * @return string
55 */
56 public function get_link_html() {
57 $two_week_review_ignore = wp_nonce_url(
58 add_query_arg( array( static::COOKIEBOT_NOTICE_OPTION_KEY => 'hide' ) ),
59 static::COOKIEBOT_NOTICE_TIMES['hide']['action'],
60 static::COOKIEBOT_NOTICE_TIMES['hide']['name']
61 );
62 $two_week_review_temp = wp_nonce_url(
63 add_query_arg( array( static::COOKIEBOT_NOTICE_OPTION_KEY => 'two_week' ) ),
64 static::COOKIEBOT_NOTICE_TIMES['two_week']['action'],
65 static::COOKIEBOT_NOTICE_TIMES['two_week']['name']
66 );
67 $visit_review_temp = wp_nonce_url(
68 add_query_arg( array( static::COOKIEBOT_NOTICE_OPTION_KEY => 'visit' ) ),
69 static::COOKIEBOT_NOTICE_TIMES['visit']['action'],
70 static::COOKIEBOT_NOTICE_TIMES['visit']['name']
71 );
72
73 return get_view_html(
74 static::COOKIEBOT_NOTICE_LINK_TEMPLATE_PATH,
75 array(
76 'two_week_review_ignore' => $two_week_review_ignore,
77 'two_week_review_temp' => $two_week_review_temp,
78 'visit_review_temp' => $visit_review_temp,
79 )
80 );
81 }
82
83 public function define_translations() {
84 $this->translations = array(
85 'title' => __(
86 'Share your experience',
87 'cookiebot'
88 ),
89 'msg' => __(
90 'Hi there! We are thrilled you love the Cookiebot CMP plugin. Could you do us a huge favor and leave a 5-star rating on WordPress? Your support will help us spread the word and empower more WordPress websites to meet GDPR and CCPA compliance standards effortlessly. Thank you for your support!',
91 'cookiebot'
92 ),
93 );
94 }
95 }
96