PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.5.4
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.5.4
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 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / src / lib / Cookiebot_Review.php
cookiebot / src / lib Last commit date
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_Review.php
184 lines
1 <?php
2
3 namespace cybot\cookiebot\lib;
4
5 use WP_REST_SERVER;
6 use cybot\cookiebot\settings\pages\Support_Page;
7
8 class Cookiebot_Review {
9
10 /**
11 * Handler url.
12 *
13 * @var string
14 */
15 protected $api_url = 'https://www.cookiebot.com/wp-json/cmp/v1/survey/';
16
17 public function register_hooks() {
18 add_action( 'admin_enqueue_scripts', array( $this, 'cookiebot_admin_script' ), 9999 );
19 add_filter( 'plugin_action_links_cookiebot/cookiebot.php', array( $this, 'plugin_action_links' ) );
20 add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_action_links' ) );
21 add_action( 'wp_ajax_cb_submit_survey', array( $this, 'send_uninstall_survey' ) );
22 }
23
24 /**
25 * Edit action links
26 *
27 * @param array $links action links.
28 * @return array
29 */
30 public function plugin_action_links( $links ) {
31 if ( array_key_exists( 'deactivate', $links ) ) {
32 $links['deactivate'] = str_replace( '<a', '<a class="cb-deactivate-action"', $links['deactivate'] );
33 }
34
35 return $links;
36 }
37
38 /**
39 * Cookiebot Add ajax url
40 */
41 public function cookiebot_admin_script( $hook ) {
42 wp_enqueue_script(
43 'cookiebot_admin_js',
44 asset_url( 'js/backend/cookiebot-admin-script.js' ),
45 null,
46 Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
47 true
48 );
49
50 wp_enqueue_style(
51 'cookiebot-admin-global-css',
52 asset_url( 'css/backend/global/cookiebot_admin.css' ),
53 null,
54 Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
55 );
56
57 wp_localize_script(
58 'cookiebot_admin_js',
59 'cb_ajax',
60 array(
61 'ajax_url' => admin_url( 'admin-ajax.php' ),
62 )
63 );
64
65 wp_localize_script(
66 'cookiebot_admin_js',
67 'cb_survey',
68 array(
69 'survey_nonce' => wp_create_nonce( 'cookiebot_survey_nonce' ),
70 'logo' => asset_url( 'img/icons/shield_icon.svg' ),
71 'popup_header_title' => __( 'Leaving Usercentrics Cookiebot?', 'cookiebot' ),
72 'first_msg' => __( 'We\'re sad to see you go. Let us know how we can improve Usercentrics Cookiebot', 'cookiebot' ),
73 'options' => array(
74 array(
75 'text' => __( 'My site stopped working / it conflicted with other plugins', 'cookiebot' ),
76 'value' => '1',
77 ),
78 array(
79 'text' => __( 'Cookies weren’t being blocked correctly', 'cookiebot' ),
80 'value' => '2',
81 ),
82 array(
83 'text' => __( 'I couldn’t find or activate the Free plan', 'cookiebot' ),
84 'value' => '3',
85 ),
86 array(
87 'text' => __( 'The Premium plans are too expensive', 'cookiebot' ),
88 'value' => '4',
89 ),
90 array(
91 'text' => __( 'Missing features / didn\'t meet my expectations', 'cookiebot' ),
92 'value' => '5',
93 ),
94 array(
95 'text' => __( 'I found another plugin that fits my needs better', 'cookiebot' ),
96 'value' => '6',
97 ),
98 array(
99 'text' => __( 'I\'m only deactivating it temporarily', 'cookiebot' ),
100 'value' => '7',
101 ),
102 array(
103 'text' => __( 'Other', 'cookiebot' ),
104 'value' => '8',
105 'extra' => __( 'Please specify here', 'cookiebot' ),
106 ),
107 ),
108 'consent' => array(
109 'optional' => __( '(Optional)', 'cookiebot' ),
110 'first' => __(
111 ' By checking this box, you agree to submit troubleshooting information and allow us to contact you regarding the problem if necessary.',
112 'cookiebot'
113 ),
114 'second' => __(
115 'The information will be kept for no longer than 90 days. You may revoke this consent at any time, e.g. by sending an email to ',
116 'cookiebot'
117 ),
118 ),
119 'alert' => __( 'Please select one option', 'cookiebot' ),
120 'actions' => array(
121 'skip' => __( 'Skip and Deactivate', 'cookiebot' ),
122 'submit' => __( 'Submit and Deactivate', 'cookiebot' ),
123 ),
124 )
125 );
126
127 if ( 'plugins.php' === $hook ) {
128 include_view( 'admin/common/templates/extra/review-form.php' );
129 }
130 }
131
132 /**
133 * Send uninstall reason to server
134 *
135 * @return void
136 */
137 public function send_uninstall_survey() {
138 global $wpdb;
139 if ( ! check_ajax_referer( 'cookiebot_survey_nonce', 'survey_nonce', false ) ) {
140 wp_send_json_error( esc_html__( 'Sorry you are not allowed to do this.', 'cookiebot' ), 401 );
141 }
142 if ( ! isset( $_POST['reason_id'] ) ) {
143 wp_send_json_error( esc_html__( 'Please select one option', 'cookiebot' ), 400 );
144 }
145 $data = array(
146 'survey_check' => sanitize_text_field( wp_unslash( $_POST['survey_check'] ) ),
147 'reason_slug' => sanitize_text_field( wp_unslash( $_POST['reason_id'] ) ),
148 'reason_detail' => ! empty( $_POST['reason_text'] ) ? sanitize_text_field( wp_unslash( $_POST['reason_text'] ) ) : null,
149 'comments' => ! empty( $_POST['reason_info'] ) ? sanitize_text_field( wp_unslash( $_POST['reason_info'] ) ) : null,
150 'date' => gmdate( 'M d, Y h:i:s A' ),
151 'server' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : null,
152 'php_version' => phpversion(),
153 'mysql_version' => $wpdb->db_version(),
154 'wp_version' => get_bloginfo( 'version' ),
155 'locale' => get_locale(),
156 'plugin_version' => Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
157 'is_multisite' => is_multisite(),
158 );
159
160 if ( ! empty( $_POST['reason_debug'] ) && rest_sanitize_boolean( $_POST['reason_debug'] ) === true ) {
161 $support = new Support_Page();
162 $data['debug_info'] = wp_json_encode( $support->prepare_debug_data() );
163 }
164
165 wp_remote_post(
166 $this->api_url,
167 array(
168 'headers' => array(
169 'Content-Type' => 'application/json; charset=utf-8',
170 ),
171 'method' => 'POST',
172 'timeout' => 45,
173 'redirection' => 5,
174 'httpversion' => '1.0',
175 'blocking' => false,
176 'body' => wp_json_encode( $data ),
177 'cookies' => array(),
178 )
179 );
180
181 wp_send_json_success( null, 200 );
182 }
183 }
184