Cookie Notice by dFactory - Version 2.1.3

Version Description

  • Fix: HTML attributes removed from text strings
  • Tweak: Improved sanitization of options
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Cookie Notice by dFactory
Version 2.1.3
Comparing to
See all releases

Code changes from version 2.1.2 to 2.1.3

cookie-notice.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Cookie Notice & Compliance for GDPR / CCPA
4
  Description: Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
5
- Version: 2.1.2
6
  Author: Hu-manity.co
7
  Author URI: https://hu-manity.co/
8
  Plugin URI: https://hu-manity.co/
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) )
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
- * @version 2.1.2
33
  */
34
  class Cookie_Notice {
35
 
@@ -85,7 +85,7 @@ class Cookie_Notice {
85
  'update_notice' => true,
86
  'update_delay_date' => 0
87
  ),
88
- 'version' => '2.1.2'
89
  );
90
 
91
  private static $_instance;
@@ -338,9 +338,9 @@ class Cookie_Notice {
338
  $scripts = html_entity_decode( trim( wp_kses( $content, $this->get_allowed_html() ) ) );
339
 
340
  if ( ! empty( $scripts ) ) {
341
- if ( preg_match_all( '/' . get_shortcode_regex() . '/', $content ) ) {
342
  $scripts = do_shortcode( $scripts );
343
- }
344
  return $scripts;
345
  }
346
  }
@@ -370,12 +370,11 @@ class Cookie_Notice {
370
 
371
  // escape class(es)
372
  $args['class'] = esc_attr( $args['class'] );
373
-
374
- if ( Cookie_Notice()->get_status() === 'active' ) {
375
  $shortcode = '<a href="#" class="cn-revoke-cookie cn-button cn-revoke-inline' . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '" data-hu-action="notice-revoke">' . esc_html( $args['title'] ) . '</a>';
376
- } else {
377
  $shortcode = '<a href="#" class="cn-revoke-cookie cn-button cn-revoke-inline' . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '">' . esc_html( $args['title'] ) . '</a>';
378
- }
379
 
380
  return $shortcode;
381
  }
@@ -390,19 +389,19 @@ class Cookie_Notice {
390
  public function cookies_policy_link_shortcode( $args, $content ) {
391
  // get options
392
  $options = $this->options['general'];
393
-
394
  // defaults
395
  $defaults = array(
396
  'title' => esc_html( $options['see_more_opt']['text'] !== '' ? $options['see_more_opt']['text'] : '&#x279c;' ),
397
- 'link' => ( $options['see_more_opt']['link_type'] === 'custom' ? $options['see_more_opt']['link'] : get_permalink( $options['see_more_opt']['id'] ) ),
398
- 'class' => $options['css_class']
399
  );
400
-
401
  // combine shortcode arguments
402
  $args = shortcode_atts( $defaults, $args );
403
-
404
  $shortcode = '<a href="' . $args['link'] . '" target="' . $options['link_target'] . '" id="cn-more-info" class="cn-privacy-policy-link cn-link' . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '">' . esc_html( $args['title'] ) . '</a>';
405
-
406
  return $shortcode;
407
  }
408
 
@@ -414,12 +413,11 @@ class Cookie_Notice {
414
  public static function cookies_accepted() {
415
  if ( Cookie_Notice()->get_status() === 'active' ) {
416
  $cookies = isset( $_COOKIE['hu-consent'] ) ? json_decode( stripslashes( $_COOKIE['hu-consent'] ), true ) : array();
417
-
418
- $result = ! empty( $cookies['consent'] ) ? true : false;
419
- } else {
420
  $result = isset( $_COOKIE['cookie_notice_accepted'] ) && $_COOKIE['cookie_notice_accepted'] === 'true';
421
- }
422
-
423
  return apply_filters( 'cn_is_cookie_accepted', $result );
424
  }
425
 
@@ -429,15 +427,14 @@ class Cookie_Notice {
429
  * @return boolean Whether cookies are set
430
  */
431
  public function cookies_set() {
432
- if ( Cookie_Notice()->get_status() === 'active' ) {
433
  $result = isset( $_COOKIE['hu-consent'] );
434
- } else {
435
  $result = isset( $_COOKIE['cookie_notice_accepted'] );
436
- }
437
-
438
- ; return apply_filters( 'cn_is_cookie_set', $result );
439
  }
440
-
441
  /**
442
  * Add WP Super Cache cookie.
443
  */
@@ -447,7 +444,7 @@ class Cookie_Notice {
447
  else
448
  do_action( 'wpsc_add_cookie', 'cookie_notice_accepted' );
449
  }
450
-
451
  /**
452
  * Delete WP Super Cache cookie.
453
  */
2
  /*
3
  Plugin Name: Cookie Notice & Compliance for GDPR / CCPA
4
  Description: Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
5
+ Version: 2.1.3
6
  Author: Hu-manity.co
7
  Author URI: https://hu-manity.co/
8
  Plugin URI: https://hu-manity.co/
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
+ * @version 2.1.3
33
  */
34
  class Cookie_Notice {
35
 
85
  'update_notice' => true,
86
  'update_delay_date' => 0
87
  ),
88
+ 'version' => '2.1.3'
89
  );
90
 
91
  private static $_instance;
338
  $scripts = html_entity_decode( trim( wp_kses( $content, $this->get_allowed_html() ) ) );
339
 
340
  if ( ! empty( $scripts ) ) {
341
+ if ( preg_match_all( '/' . get_shortcode_regex() . '/', $content ) )
342
  $scripts = do_shortcode( $scripts );
343
+
344
  return $scripts;
345
  }
346
  }
370
 
371
  // escape class(es)
372
  $args['class'] = esc_attr( $args['class'] );
373
+
374
+ if ( Cookie_Notice()->get_status() === 'active' )
375
  $shortcode = '<a href="#" class="cn-revoke-cookie cn-button cn-revoke-inline' . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '" data-hu-action="notice-revoke">' . esc_html( $args['title'] ) . '</a>';
376
+ else
377
  $shortcode = '<a href="#" class="cn-revoke-cookie cn-button cn-revoke-inline' . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '">' . esc_html( $args['title'] ) . '</a>';
 
378
 
379
  return $shortcode;
380
  }
389
  public function cookies_policy_link_shortcode( $args, $content ) {
390
  // get options
391
  $options = $this->options['general'];
392
+
393
  // defaults
394
  $defaults = array(
395
  'title' => esc_html( $options['see_more_opt']['text'] !== '' ? $options['see_more_opt']['text'] : '&#x279c;' ),
396
+ 'link' => ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ),
397
+ 'class' => esc_attr( $options['css_class'] )
398
  );
399
+
400
  // combine shortcode arguments
401
  $args = shortcode_atts( $defaults, $args );
402
+
403
  $shortcode = '<a href="' . $args['link'] . '" target="' . $options['link_target'] . '" id="cn-more-info" class="cn-privacy-policy-link cn-link' . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '">' . esc_html( $args['title'] ) . '</a>';
404
+
405
  return $shortcode;
406
  }
407
 
413
  public static function cookies_accepted() {
414
  if ( Cookie_Notice()->get_status() === 'active' ) {
415
  $cookies = isset( $_COOKIE['hu-consent'] ) ? json_decode( stripslashes( $_COOKIE['hu-consent'] ), true ) : array();
416
+
417
+ $result = ( is_array( $cookies ) && json_last_error() === JSON_ERROR_NONE && ! empty( $cookies['consent'] ) ) ? true : false;
418
+ } else
419
  $result = isset( $_COOKIE['cookie_notice_accepted'] ) && $_COOKIE['cookie_notice_accepted'] === 'true';
420
+
 
421
  return apply_filters( 'cn_is_cookie_accepted', $result );
422
  }
423
 
427
  * @return boolean Whether cookies are set
428
  */
429
  public function cookies_set() {
430
+ if ( Cookie_Notice()->get_status() === 'active' )
431
  $result = isset( $_COOKIE['hu-consent'] );
432
+ else
433
  $result = isset( $_COOKIE['cookie_notice_accepted'] );
434
+
435
+ return apply_filters( 'cn_is_cookie_set', $result );
 
436
  }
437
+
438
  /**
439
  * Add WP Super Cache cookie.
440
  */
444
  else
445
  do_action( 'wpsc_add_cookie', 'cookie_notice_accepted' );
446
  }
447
+
448
  /**
449
  * Delete WP Super Cache cookie.
450
  */
includes/frontend.php CHANGED
@@ -149,6 +149,8 @@ class Cookie_Notice_Frontend {
149
  else
150
  $options['message_text'] = wp_kses_post( $options['message_text'] );
151
 
 
 
152
  // escape css classes
153
  $options['css_class'] = esc_attr( $options['css_class'] );
154
  $options['button_class'] = esc_attr( $options['button_class'] );
@@ -158,7 +160,7 @@ class Cookie_Notice_Frontend {
158
  <!-- Cookie Notice plugin v' . Cookie_Notice()->defaults['version'] . ' by Hu-manity.co https://hu-manity.co/ -->
159
  <div id="cookie-notice" role="banner" class="cookie-notice-hidden cookie-revoke-hidden cn-position-' . esc_attr( $options['position'] ) . '" aria-label="' . esc_attr( $options['aria_label'] ) . '" style="background-color: rgba(' . implode( ',', Cookie_Notice()->hex2rgb( $options['colors']['bar'] ) ) . ',' . ( (int) $options['colors']['bar_opacity'] ) * 0.01 . ');">'
160
  . '<div class="cookie-notice-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
161
- . '<span id="cn-notice-text" class="cn-text-container">'. esc_html( $options['message_text'] ) . '</span>'
162
  . '<span id="cn-notice-buttons" class="cn-buttons-container"><a href="#" id="cn-accept-cookie" data-cookie-set="accept" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['accept_text'] ) . '">' . esc_html( $options['accept_text'] ) . '</a>'
163
  . ( $options['refuse_opt'] === true ? '<a href="#" id="cn-refuse-cookie" data-cookie-set="refuse" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['refuse_text'] ) . '">' . esc_html( $options['refuse_text'] ) . '</a>' : '' )
164
  . ( $options['see_more'] === true && $options['link_position'] === 'banner' ? '<a href="' . ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ) . '" target="' . esc_attr( $options['link_target'] ) . '" id="cn-more-info" class="cn-more-info ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['see_more_opt']['text'] ) . '">' . esc_html( $options['see_more_opt']['text'] ) . '</a>' : '' )
@@ -166,7 +168,7 @@ class Cookie_Notice_Frontend {
166
  . '</div>
167
  ' . ( $options['refuse_opt'] === true && $options['revoke_cookies'] == true ?
168
  '<div class="cookie-revoke-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
169
- . ( ! empty( $options['revoke_message_text'] ) ? '<span id="cn-revoke-text" class="cn-text-container">'. esc_html( $options['revoke_message_text'] ) . '</span>' : '' )
170
  . '<span id="cn-revoke-buttons" class="cn-buttons-container"><a href="#" class="cn-revoke-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['revoke_text'] ) . '">' . esc_html( $options['revoke_text'] ) . '</a></span>
171
  </div>' : '' ) . '
172
  </div>
149
  else
150
  $options['message_text'] = wp_kses_post( $options['message_text'] );
151
 
152
+ $options['revoke_message_text'] = wp_kses_post( $options['revoke_message_text'] );
153
+
154
  // escape css classes
155
  $options['css_class'] = esc_attr( $options['css_class'] );
156
  $options['button_class'] = esc_attr( $options['button_class'] );
160
  <!-- Cookie Notice plugin v' . Cookie_Notice()->defaults['version'] . ' by Hu-manity.co https://hu-manity.co/ -->
161
  <div id="cookie-notice" role="banner" class="cookie-notice-hidden cookie-revoke-hidden cn-position-' . esc_attr( $options['position'] ) . '" aria-label="' . esc_attr( $options['aria_label'] ) . '" style="background-color: rgba(' . implode( ',', Cookie_Notice()->hex2rgb( $options['colors']['bar'] ) ) . ',' . ( (int) $options['colors']['bar_opacity'] ) * 0.01 . ');">'
162
  . '<div class="cookie-notice-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
163
+ . '<span id="cn-notice-text" class="cn-text-container">'. $options['message_text'] . '</span>'
164
  . '<span id="cn-notice-buttons" class="cn-buttons-container"><a href="#" id="cn-accept-cookie" data-cookie-set="accept" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['accept_text'] ) . '">' . esc_html( $options['accept_text'] ) . '</a>'
165
  . ( $options['refuse_opt'] === true ? '<a href="#" id="cn-refuse-cookie" data-cookie-set="refuse" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['refuse_text'] ) . '">' . esc_html( $options['refuse_text'] ) . '</a>' : '' )
166
  . ( $options['see_more'] === true && $options['link_position'] === 'banner' ? '<a href="' . ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ) . '" target="' . esc_attr( $options['link_target'] ) . '" id="cn-more-info" class="cn-more-info ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['see_more_opt']['text'] ) . '">' . esc_html( $options['see_more_opt']['text'] ) . '</a>' : '' )
168
  . '</div>
169
  ' . ( $options['refuse_opt'] === true && $options['revoke_cookies'] == true ?
170
  '<div class="cookie-revoke-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
171
+ . ( ! empty( $options['revoke_message_text'] ) ? '<span id="cn-revoke-text" class="cn-text-container">' . $options['revoke_message_text'] . '</span>' : '' )
172
  . '<span id="cn-revoke-buttons" class="cn-buttons-container"><a href="#" class="cn-revoke-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['revoke_text'] ) . '">' . esc_html( $options['revoke_text'] ) . '</a></span>
173
  </div>' : '' ) . '
174
  </div>
includes/welcome-api.php CHANGED
@@ -1,828 +1,898 @@
1
- <?php
2
- // exit if accessed directly
3
- if ( ! defined( 'ABSPATH' ) )
4
- exit;
5
-
6
- /**
7
- * Cookie_Notice_Welcome_API class.
8
- *
9
- * @class Cookie_Notice_Welcome_API
10
- */
11
- class Cookie_Notice_Welcome_API {
12
- // api urls
13
- private $account_api_url = '';
14
- private $designer_api_url = '';
15
- private $x_api_key = '';
16
-
17
- /**
18
- * Constructor.
19
- *
20
- * @return void
21
- */
22
- public function __construct() {
23
- add_action( 'wp_ajax_cn_api_request', array( $this, 'api_request' ) );
24
-
25
- $this->account_api_url = 'https://account-api.hu-manity.co';
26
- $this->designer_api_url = 'https://designer-api.hu-manity.co';
27
- $this->x_api_key = 'hudft60djisdusdjwek';
28
- }
29
-
30
- /**
31
- * Ajax API request
32
- */
33
- public function api_request() {
34
- if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
35
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
36
-
37
- if ( ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
38
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
39
-
40
- if ( empty( $_POST['request'] ) )
41
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
42
-
43
- if ( ( $_POST['request'] === 'payment' && ! empty( $_POST['cn_payment_nonce'] ) && ! wp_verify_nonce( $_POST['cn_payment_nonce'], 'cn_api_payment' ) ) || ( ! empty( $_POST['cn_nonce'] ) && ! wp_verify_nonce( $_POST['cn_nonce'], 'cn_api_' . $_POST['request'] ) ) )
44
- wp_die( __( 'You do not have permission to access this page.', 'cookie-notice' ) );
45
-
46
- $request = in_array( $_POST['request'], array( 'register', 'login', 'configure', 'select_plan', 'payment', 'get_bt_init_token' ), true ) ? $_POST['request'] : '';
47
- $errors = array();
48
- $response = false;
49
-
50
- if ( ! $request )
51
- return false;
52
-
53
- // get app token data
54
- $data_token = get_transient( 'cookie_notice_app_token' );
55
- $api_token = ! empty( $data_token->token ) ? $data_token->token : '';
56
- $admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
57
- $app_id = Cookie_Notice()->options['general']['app_id'];
58
-
59
- $params = array();
60
-
61
- switch ( $request ) {
62
- case 'get_bt_init_token':
63
- $result = $this->request( 'get_token' );
64
-
65
- // is token available?
66
- if ( ! empty( $result->token ) )
67
- $response = array( 'token' => $result->token );
68
- break;
69
-
70
- case 'payment':
71
- $error = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
72
-
73
- // empty data?
74
- if ( empty( $_POST['payment_nonce'] ) || empty( $_POST['plan'] ) || empty( $_POST['method'] ) ) {
75
- $response = $error;
76
- break;
77
- }
78
-
79
- // validate plan and payment method
80
- $plan = in_array( $_POST['plan'], array( 'monthly', 'yearly' ), true ) ? $_POST['plan'] : false;
81
- $plan = ! empty( $plan ) ? 'compliance_' . $plan . '_notrial' : false;
82
-
83
- $method = in_array( $_POST['method'], array( 'credit_card', 'paypal' ), true ) ? $_POST['method'] : false;
84
-
85
- // valid plan and payment method?
86
- if ( empty( $plan ) || empty( $method ) ) {
87
- $response = array( 'error' => __( 'Empty plan or payment method data.', 'cookie-notice' ) );
88
- break;
89
- }
90
-
91
- $result = $this->request( 'get_customer', array( 'AppID' => $app_id ) );
92
-
93
- // user found?
94
- if ( ! empty( $result->id ) ) {
95
- $customer = $result;
96
- // create user
97
- } else {
98
- $result = $this->request(
99
- 'create_customer',
100
- array(
101
- 'AppID' => $app_id,
102
- 'AdminID' => $admin_id, // remove later - AdminID from API response
103
- 'paymentMethodNonce' => esc_attr( $_POST['payment_nonce'] )
104
- )
105
- );
106
-
107
- if ( ! empty( $result->success ) ) {
108
- $customer = $result->customer;
109
- } else {
110
- $customer = $result;
111
- }
112
- }
113
-
114
- // user created/received?
115
- if ( empty( $customer->id ) ) {
116
- $response = array( 'error' => __( 'Unable to create customer data.', 'cookie-notice' ) );
117
- break;
118
- }
119
-
120
- // @todo: check if subscribtion exists
121
- $subscription = $this->request(
122
- 'create_subscription',
123
- array(
124
- 'AppID' => $app_id,
125
- 'PlanId' => $plan,
126
- 'paymentMethodToken' => $customer->paymentMethods[0]->token
127
- )
128
- );
129
-
130
- // subscription assigned?
131
- if ( ! empty( $subscription->error ) ) {
132
- $response = $subscription->error;
133
- break;
134
- }
135
-
136
- break;
137
-
138
- case 'register':
139
- $email = is_email( $_POST['email'] );
140
- $pass = ! empty( $_POST['pass'] ) ? esc_attr( $_POST['pass'] ) : '';
141
- $pass2 = ! empty( $_POST['pass2'] ) ? esc_attr( $_POST['pass2'] ) : '';
142
- $terms = isset( $_POST['terms'] );
143
- $language = ! empty( $_POST['language'] ) ? esc_attr( $_POST['language'] ) : 'en';
144
-
145
- if ( ! $terms ) {
146
- $response = array( 'error' => __( "Please accept the Terms of Service to proceed.", 'cookie-notice' ) );
147
- break;
148
- }
149
-
150
- if ( ! $email ) {
151
- $response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
152
- break;
153
- }
154
-
155
- if ( ! $pass ) {
156
- $response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
157
- break;
158
- }
159
-
160
- if ( $pass !== $pass2 ) {
161
- $response = array( 'error' => __( "Passwords do not match.", 'cookie-notice' ) );
162
- break;
163
- }
164
-
165
- $params = array(
166
- 'AdminID' => $email,
167
- 'Password' => $pass,
168
- 'Language' => $language
169
- );
170
-
171
- $response = $this->request( $request, $params );
172
-
173
- // errors?
174
- if ( ! empty( $response->error ) ) {
175
- break;
176
- }
177
-
178
- // errors?
179
- if ( ! empty( $response->message ) ) {
180
- $response->error = $response->message;
181
- break;
182
- }
183
-
184
- // ok, so log in now
185
- $params = array(
186
- 'AdminID' => $email,
187
- 'Password' => $pass
188
- );
189
-
190
- $response = $this->request( 'login', $params );
191
-
192
- // errors?
193
- if ( ! empty( $response->error ) ) {
194
- break;
195
- }
196
-
197
- // errors?
198
- if ( ! empty( $response->message ) ) {
199
- $response->error = $response->message;
200
- break;
201
- }
202
- // token in response?
203
- if ( empty( $response->data->token ) ) {
204
- $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
205
- break;
206
- }
207
-
208
- // set token
209
- set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
210
-
211
- // multisite?
212
- if ( is_multisite() ) {
213
- switch_to_blog( 1 );
214
- $site_title = get_bloginfo( 'name' );
215
- $site_url = network_site_url();
216
- $site_description = get_bloginfo( 'description' );
217
- restore_current_blog();
218
- } else {
219
- $site_title = get_bloginfo( 'name' );
220
- $site_url = get_home_url();
221
- $site_description = get_bloginfo( 'description' );
222
- }
223
-
224
- // create new app, no need to check existing
225
- $params = array(
226
- 'DomainName' => $site_title,
227
- 'DomainUrl' => $site_url,
228
- );
229
-
230
- if ( ! empty( $site_description ) )
231
- $params['DomainDescription'] = $site_description;
232
-
233
- $response = $this->request( 'app_create', $params );
234
-
235
- // errors?
236
- if ( ! empty( $response->message ) ) {
237
- $response->error = $response->message;
238
- break;
239
- }
240
-
241
- // data in response?
242
- if ( empty( $response->data->AppID ) || empty( $response->data->SecretKey ) ) {
243
- $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
244
- break;
245
- } else {
246
- $app_id = $response->data->AppID;
247
- $secret_key = $response->data->SecretKey;
248
- }
249
-
250
- // update options: app ID and secret key
251
- Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_id, 'app_key' => $secret_key ), Cookie_Notice()->options['general'] );
252
-
253
- update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
254
-
255
- // purge cache
256
- delete_transient( 'cookie_notice_compliance_cache' );
257
-
258
- // get options
259
- // $app_config = get_transient( 'cookie_notice_app_config' );
260
-
261
- // create quick config
262
- $params = ! empty( $app_config ) && is_array( $app_config ) ? $app_config : array();
263
-
264
- // cast to objects
265
- if ( $params ) {
266
- foreach ( $params as $key => $array ) {
267
- $object = new stdClass();
268
-
269
- foreach ( $array as $subkey => $value ) {
270
- $new_params[$key] = $object;
271
- $new_params[$key]->{$subkey} = $value;
272
- }
273
- }
274
-
275
- $params = $new_params;
276
- }
277
-
278
- $params['AppID'] = $app_id;
279
- // @todo When mutliple default languages are supported
280
- $params['DefaultLanguage'] = 'en';
281
-
282
- $response = $this->request( 'quick_config', $params );
283
-
284
- if ( $response->status === 200 ) {
285
- // notify publish app
286
- $params = array(
287
- 'AppID' => $app_id
288
- );
289
-
290
- $response = $this->request( 'notify_app', $params );
291
-
292
- if ( $response->status === 200 ) {
293
- $response = true;
294
-
295
- // update app status
296
- update_option( 'cookie_notice_status', 'active' );
297
- } else {
298
- // update app status
299
- update_option( 'cookie_notice_status', 'pending' );
300
-
301
- // errors?
302
- if ( ! empty( $response->error ) ) {
303
- break;
304
- }
305
-
306
- // errors?
307
- if ( ! empty( $response->message ) ) {
308
- $response->error = $response->message;
309
- break;
310
- }
311
- }
312
- } else {
313
- // update app status
314
- update_option( 'cookie_notice_status', 'pending' );
315
-
316
- // errors?
317
- if ( ! empty( $response->error ) ) {
318
- $response->error = $response->error;
319
- break;
320
- }
321
-
322
- // errors?
323
- if ( ! empty( $response->message ) ) {
324
- $response->error = $response->message;
325
- break;
326
- }
327
- }
328
-
329
- break;
330
-
331
- case 'login':
332
- $email = is_email( $_POST['email'] );
333
- $pass = ! empty( $_POST['pass'] ) ? esc_attr( $_POST['pass'] ) : '';
334
-
335
- if ( ! $email ) {
336
- $response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
337
- break;
338
- }
339
-
340
- if ( ! $pass ) {
341
- $response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
342
- break;
343
- }
344
-
345
- $params = array(
346
- 'AdminID' => $email,
347
- 'Password' => $pass
348
- );
349
-
350
- $response = $this->request( $request, $params );
351
-
352
- // errors?
353
- if ( ! empty( $response->error ) ) {
354
- break;
355
- }
356
-
357
- // errors?
358
- if ( ! empty( $response->message ) ) {
359
- $response->error = $response->message;
360
- break;
361
- }
362
-
363
- // token in response?
364
- if ( empty( $response->data->token ) ) {
365
- $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
366
- break;
367
- }
368
-
369
- // set token
370
- set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
371
-
372
- // get apps and check if one for the current domain already exists
373
- $response = $this->request( 'list_apps', array() );
374
-
375
- // echo '<pre>'; print_r( $response ); echo '</pre>'; exit;
376
-
377
- // errors?
378
- if ( ! empty( $response->message ) ) {
379
- $response->error = $response->message;
380
- break;
381
- }
382
-
383
- $apps_list = array();
384
- $app_exists = false;
385
-
386
- // multisite?
387
- if ( is_multisite() ) {
388
- switch_to_blog( 1 );
389
- $site_title = get_bloginfo( 'name' );
390
- $site_url = network_site_url();
391
- $site_description = get_bloginfo( 'description' );
392
- restore_current_blog();
393
- } else {
394
- $site_title = get_bloginfo( 'name' );
395
- $site_url = get_home_url();
396
- $site_description = get_bloginfo( 'description' );
397
- }
398
-
399
- // apps added, check if current one exists
400
- if ( ! empty( $response->data ) ) {
401
- $apps_list = (array) $response->data;
402
-
403
- foreach ( $apps_list as $index => $app ) {
404
- $site_without_http = trim( str_replace( array( 'http://', 'https://' ), '', $site_url ), '/' );
405
-
406
- if ( $app->DomainUrl === $site_without_http ) {
407
- $app_exists = $app;
408
-
409
- continue;
410
- }
411
- }
412
- }
413
-
414
- // if no app, create one
415
- if ( ! $app_exists ) {
416
-
417
- // create new app
418
- $params = array(
419
- 'DomainName' => $site_title,
420
- 'DomainUrl' => $site_url,
421
- );
422
-
423
- if ( ! empty( $site_description ) )
424
- $params['DomainDescription'] = $site_description;
425
-
426
- $response = $this->request( 'app_create', $params );
427
-
428
- // errors?
429
- if ( ! empty( $response->message ) ) {
430
- $response->error = $response->message;
431
- break;
432
- }
433
-
434
- $app_exists = $response->data;
435
- }
436
-
437
- // check if we have the valid app data
438
- if ( empty( $app_exists->AppID ) || empty( $app_exists->SecretKey ) ) {
439
- $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
440
- break;
441
- }
442
-
443
- // update options: app ID and secret key
444
- Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_exists->AppID, 'app_key' => $app_exists->SecretKey ), Cookie_Notice()->options['general'] );
445
-
446
- update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
447
-
448
- // purge cache
449
- delete_transient( 'cookie_notice_compliance_cache' );
450
-
451
- // create quick config
452
- $params = array(
453
- 'AppID' => $app_exists->AppID,
454
- 'DefaultLanguage' => 'en'
455
- );
456
-
457
- $response = $this->request( 'quick_config', $params );
458
-
459
- if ( $response->status === 200 ) {
460
- // notify publish app
461
- $params = array(
462
- 'AppID' => $app_exists->AppID
463
- );
464
-
465
- $response = $this->request( 'notify_app', $params );
466
-
467
- if ( $response->status === 200 ) {
468
- $response = true;
469
-
470
- // update app status
471
- update_option( 'cookie_notice_status', 'active' );
472
- } else {
473
- // update app status
474
- update_option( 'cookie_notice_status', 'pending' );
475
-
476
- // errors?
477
- if ( ! empty( $response->error ) ) {
478
- break;
479
- }
480
-
481
- // errors?
482
- if ( ! empty( $response->message ) ) {
483
- $response->error = $response->message;
484
- break;
485
- }
486
- }
487
- } else {
488
- // update app status
489
- update_option( 'cookie_notice_status', 'pending' );
490
-
491
- // errors?
492
- if ( ! empty( $response->error ) ) {
493
- $response->error = $response->error;
494
- break;
495
- }
496
-
497
- // errors?
498
- if ( ! empty( $response->message ) ) {
499
- $response->error = $response->message;
500
- break;
501
- }
502
- }
503
-
504
- break;
505
-
506
- case 'configure':
507
- $fields = array(
508
- 'cn_position',
509
- 'cn_color_primary',
510
- 'cn_color_background',
511
- 'cn_color_border',
512
- 'cn_color_text',
513
- 'cn_color_heading',
514
- 'cn_color_button_text',
515
- 'cn_laws',
516
- 'cn_purposes'
517
- );
518
-
519
- $options = array();
520
-
521
- // loop through potential config form fields
522
- foreach ( $fields as $field ) {
523
- if ( isset( $_POST[$field] ) ) {
524
- switch ( $field ) {
525
- case 'cn_position':
526
- $options['design']['position'] = esc_attr( $_POST[$field] );
527
- break;
528
- case 'cn_color_primary':
529
- $options['design']['primaryColor'] = esc_attr( $_POST[$field] );
530
- break;
531
- case 'cn_color_background':
532
- $options['design']['bannerColor'] = esc_attr( $_POST[$field] );
533
- break;
534
- case 'cn_color_border':
535
- $options['design']['borderColor'] = esc_attr( $_POST[$field] );
536
- break;
537
- case 'cn_color_text':
538
- $options['design']['textColor'] = esc_attr( $_POST[$field] );
539
- break;
540
- case 'cn_color_heading':
541
- $options['design']['headingColor'] = esc_attr( $_POST[$field] );
542
- break;
543
- case 'cn_color_button_text':
544
- $options['design']['btnTextColor'] = esc_attr( $_POST[$field] );
545
- break;
546
- case 'cn_laws':
547
- $options['laws'] = array_map( 'esc_attr', $_POST[$field] );
548
- $new_options = array();
549
-
550
- foreach ( $options['laws'] as $law ) {
551
- $new_options[$law] = true;
552
- }
553
-
554
- $options['laws'] = $new_options;
555
-
556
- // GDPR
557
- if ( in_array( 'gdpr', $options['laws'] ) ) {
558
- $options['config']['privacyPolicyLink'] = true;
559
- } else {
560
- $options['config']['privacyPolicyLink'] = false;
561
- }
562
-
563
- // CCPA
564
- if ( in_array( 'ccpa', $options['laws'] ) ) {
565
- $options['config']['dontSellLink'] = true;
566
- } else {
567
- $options['config']['dontSellLink'] = false;
568
- }
569
- break;
570
- case 'cn_purposes':
571
- $options['text']['bodyText'] = Cookie_Notice()->settings->cookie_messages[absint( $_POST[$field] )];
572
- break;
573
- }
574
- }
575
- }
576
-
577
- // set options
578
- set_transient( 'cookie_notice_app_config', $options, 24 * HOUR_IN_SECONDS );
579
-
580
- break;
581
-
582
- case 'select_plan':
583
- break;
584
- }
585
-
586
- echo json_encode( $response );
587
- exit;
588
- }
589
-
590
- /**
591
- * API request.
592
- *
593
- * @param string $action The requested action.
594
- * @param array $_data Parameters for the API action.
595
- * @return false|object
596
- */
597
- private function request( $request = '', $params = '' ) {
598
- $api_args = array(
599
- 'timeout' => 60,
600
- 'sslverify' => false,
601
- 'headers' => array( 'x-api-key' => $this->x_api_key )
602
- );
603
- $api_params = array();
604
- $json = false;
605
-
606
- // get app token data
607
- $data_token = get_transient( 'cookie_notice_app_token' );
608
- $api_token = ! empty( $data_token->token ) ? $data_token->token : '';
609
- $admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
610
-
611
- switch ( $request ) {
612
- case 'register':
613
- $api_url = $this->account_api_url . '/api/account/account/registration';
614
- $api_args['method'] = 'POST';
615
- break;
616
-
617
- case 'login':
618
- $api_url = $this->account_api_url . '/api/account/account/login';
619
- $api_args['method'] = 'POST';
620
- break;
621
-
622
- case 'list_apps':
623
- $api_url = $this->account_api_url . '/api/account/app/list';
624
- $api_args['method'] = 'GET';
625
- $api_args['headers'] = array_merge(
626
- $api_args['headers'],
627
- array(
628
- 'Authorization' => 'Bearer ' . $api_token
629
- )
630
- );
631
- break;
632
-
633
- case 'app_create':
634
- $api_url = $this->account_api_url . '/api/account/app/add';
635
- $api_args['method'] = 'POST';
636
- $api_args['headers'] = array_merge(
637
- $api_args['headers'],
638
- array(
639
- 'Authorization' => 'Bearer ' . $api_token
640
- )
641
- );
642
- break;
643
-
644
- case 'get_config':
645
- $api_url = $this->designer_api_url . '/api/designer/user-design-live';
646
- $api_args['method'] = 'GET';
647
- break;
648
-
649
- case 'quick_config':
650
- $json = true;
651
- $api_url = $this->designer_api_url . '/api/designer/user-design/quick';
652
- $api_args['method'] = 'POST';
653
- $api_args['headers'] = array_merge(
654
- $api_args['headers'],
655
- array(
656
- 'Authorization' => 'Bearer ' . $api_token,
657
- 'Content-Type' => 'application/json; charset=utf-8'
658
- )
659
- );
660
- break;
661
-
662
- case 'notify_app':
663
- $json = true;
664
- $api_url = $this->account_api_url . '/api/account/app/notifyAppPublished';
665
- $api_args['method'] = 'POST';
666
- $api_args['headers'] = array_merge(
667
- $api_args['headers'],
668
- array(
669
- 'Authorization' => 'Bearer ' . $api_token,
670
- 'Content-Type' => 'application/json; charset=utf-8'
671
- )
672
- );
673
- break;
674
-
675
- // braintree init token
676
- case 'get_token':
677
- $api_url = $this->account_api_url . '/api/account/braintree';
678
- $api_args['method'] = 'GET';
679
- $api_args['headers'] = array_merge(
680
- $api_args['headers'],
681
- array(
682
- 'Authorization' => 'Bearer ' . $api_token
683
- )
684
- );
685
- break;
686
-
687
- // braintree get customer
688
- case 'get_customer':
689
- $json = true;
690
- $api_url = $this->account_api_url . '/api/account/braintree/findcustomer';
691
- $api_args['method'] = 'POST';
692
- $api_args['data_format'] = 'body';
693
- $api_args['headers'] = array_merge(
694
- $api_args['headers'],
695
- array(
696
- 'Authorization' => 'Bearer ' . $api_token,
697
- 'Content-Type' => 'application/json; charset=utf-8'
698
- )
699
- );
700
- break;
701
-
702
- // braintree create customer in vault
703
- case 'create_customer':
704
- $json = true;
705
- $api_url = $this->account_api_url . '/api/account/braintree/createcustomer';
706
- $api_args['method'] = 'POST';
707
- $api_args['headers'] = array_merge(
708
- $api_args['headers'],
709
- array(
710
- 'Authorization' => 'Bearer ' . $api_token,
711
- 'Content-Type' => 'application/json; charset=utf-8'
712
- )
713
- );
714
- break;
715
-
716
- // braintree assign subscription to the customer
717
- case 'create_subscription':
718
- $json = true;
719
- $api_url = $this->account_api_url . '/api/account/braintree/createsubscription';
720
- $api_args['method'] = 'POST';
721
- $api_args['headers'] = array_merge(
722
- $api_args['headers'],
723
- array(
724
- 'Authorization' => 'Bearer ' . $api_token,
725
- 'Content-Type' => 'application/json; charset=utf-8'
726
- )
727
- );
728
- break;
729
- }
730
-
731
- if ( ! empty( $params ) && is_array( $params ) ) {
732
- foreach ( $params as $key => $param ) {
733
- if ( is_object( $param ) )
734
- $api_params[$key] = $param;
735
- else
736
- $api_params[$key] = esc_attr( $param );
737
- }
738
-
739
- if ( $json )
740
- $api_args['body'] = json_encode( $api_params );
741
- else
742
- $api_args['body'] = $api_params;
743
- }
744
-
745
- $response = wp_remote_request( $api_url, $api_args );
746
-
747
- if ( is_wp_error( $response ) )
748
- $result = array( 'error' => $response->get_error_message() );
749
- else {
750
- $content_type = wp_remote_retrieve_header( $response, 'Content-Type' );
751
-
752
- // HTML response, means error
753
- if ( $content_type == 'text/html' ) {
754
- $result = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
755
- } else {
756
- $result = wp_remote_retrieve_body( $response );
757
- // detect json or array
758
- $result = is_array( $result ) ? $result : json_decode( $result );
759
- }
760
- }
761
-
762
- return $result;
763
- }
764
-
765
- /**
766
- * Ajax API request
767
- */
768
- public function get_app_status( $app_id ) {
769
- $result = '';
770
-
771
- if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
772
- return false;
773
-
774
- $params = array(
775
- 'AppID' => $app_id
776
- );
777
-
778
- $response = $this->request( 'get_config', $params );
779
-
780
- if ( ! empty( $response->data ) ) {
781
- $result = 'active';
782
- } else {
783
- if ( ! empty( $response->error ) ) {
784
- if ( $response->error == 'App is not puplised yet' )
785
- $result = 'pending';
786
- else
787
- $result = '';
788
- }
789
- }
790
-
791
- return $result;
792
- }
793
-
794
- /**
795
- * Defines the function used to initial the cURL library.
796
- *
797
- * @param string $url To URL to which the request is being made
798
- * @param string $params The URL query parameters
799
- * @return string $response The response, if available; otherwise, null
800
- */
801
- private function curl( $url, $args ) {
802
- $curl = curl_init( $url );
803
-
804
- $headers = array();
805
-
806
- foreach ( $args['headers'] as $header => $value ) {
807
- $headers[] = $header . ': ' . $value;
808
- }
809
-
810
- curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
811
- curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
812
- curl_setopt( $curl, CURLOPT_HEADER, false );
813
- curl_setopt( $curl, CURLOPT_USERAGENT, '' );
814
- curl_setopt( $curl, CURLOPT_HTTPGET, true );
815
- curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'GET' );
816
- curl_setopt( $curl, CURLOPT_POSTFIELDS, $args['body'] );
817
- curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
818
-
819
- $response = curl_exec( $curl );
820
-
821
- if ( 0 !== curl_errno( $curl ) || 200 !== curl_getinfo( $curl, CURLINFO_HTTP_CODE ) )
822
- $response = null;
823
-
824
- curl_close( $curl );
825
-
826
- return $response;
827
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
828
  }
1
+ <?php
2
+ // exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) )
4
+ exit;
5
+
6
+ /**
7
+ * Cookie_Notice_Welcome_API class.
8
+ *
9
+ * @class Cookie_Notice_Welcome_API
10
+ */
11
+ class Cookie_Notice_Welcome_API {
12
+ // api urls
13
+ private $account_api_url = '';
14
+ private $designer_api_url = '';
15
+ private $x_api_key = '';
16
+
17
+ /**
18
+ * Constructor.
19
+ *
20
+ * @return void
21
+ */
22
+ public function __construct() {
23
+ add_action( 'wp_ajax_cn_api_request', array( $this, 'api_request' ) );
24
+
25
+ $this->account_api_url = 'https://account-api.hu-manity.co';
26
+ $this->designer_api_url = 'https://designer-api.hu-manity.co';
27
+ $this->x_api_key = 'hudft60djisdusdjwek';
28
+ }
29
+
30
+ /**
31
+ * Ajax API request
32
+ */
33
+ public function api_request() {
34
+ if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
35
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
36
+
37
+ if ( ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
38
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
39
+
40
+ if ( empty( $_POST['request'] ) )
41
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
42
+
43
+ if ( ( $_POST['request'] === 'payment' && ! empty( $_POST['cn_payment_nonce'] ) && ! wp_verify_nonce( $_POST['cn_payment_nonce'], 'cn_api_payment' ) ) || ( ! empty( $_POST['cn_nonce'] ) && ! wp_verify_nonce( $_POST['cn_nonce'], 'cn_api_' . $_POST['request'] ) ) )
44
+ wp_die( __( 'You do not have permission to access this page.', 'cookie-notice' ) );
45
+
46
+ $request = in_array( $_POST['request'], array( 'register', 'login', 'configure', 'select_plan', 'payment', 'get_bt_init_token' ), true ) ? $_POST['request'] : '';
47
+ $errors = array();
48
+ $response = false;
49
+
50
+ if ( ! $request )
51
+ return false;
52
+
53
+ // get app token data
54
+ $data_token = get_transient( 'cookie_notice_app_token' );
55
+ $api_token = ! empty( $data_token->token ) ? $data_token->token : '';
56
+ $admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
57
+ $app_id = Cookie_Notice()->options['general']['app_id'];
58
+
59
+ $params = array();
60
+
61
+ switch ( $request ) {
62
+ case 'get_bt_init_token':
63
+ $result = $this->request( 'get_token' );
64
+
65
+ // is token available?
66
+ if ( ! empty( $result->token ) )
67
+ $response = array( 'token' => $result->token );
68
+ break;
69
+
70
+ case 'payment':
71
+ $error = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
72
+
73
+ // empty data?
74
+ if ( empty( $_POST['payment_nonce'] ) || empty( $_POST['plan'] ) || empty( $_POST['method'] ) ) {
75
+ $response = $error;
76
+ break;
77
+ }
78
+
79
+ // validate plan and payment method
80
+ $plan = in_array( $_POST['plan'], array( 'monthly', 'yearly' ), true ) ? $_POST['plan'] : false;
81
+ $plan = ! empty( $plan ) ? 'compliance_' . $plan . '_notrial' : false;
82
+
83
+ $method = in_array( $_POST['method'], array( 'credit_card', 'paypal' ), true ) ? $_POST['method'] : false;
84
+
85
+ // valid plan and payment method?
86
+ if ( empty( $plan ) || empty( $method ) ) {
87
+ $response = array( 'error' => __( 'Empty plan or payment method data.', 'cookie-notice' ) );
88
+ break;
89
+ }
90
+
91
+ $result = $this->request( 'get_customer', array( 'AppID' => $app_id ) );
92
+
93
+ // user found?
94
+ if ( ! empty( $result->id ) ) {
95
+ $customer = $result;
96
+ // create user
97
+ } else {
98
+ $result = $this->request(
99
+ 'create_customer',
100
+ array(
101
+ 'AppID' => $app_id,
102
+ 'AdminID' => $admin_id, // remove later - AdminID from API response
103
+ 'paymentMethodNonce' => esc_attr( $_POST['payment_nonce'] )
104
+ )
105
+ );
106
+
107
+ if ( ! empty( $result->success ) ) {
108
+ $customer = $result->customer;
109
+ } else {
110
+ $customer = $result;
111
+ }
112
+ }
113
+
114
+ // user created/received?
115
+ if ( empty( $customer->id ) ) {
116
+ $response = array( 'error' => __( 'Unable to create customer data.', 'cookie-notice' ) );
117
+ break;
118
+ }
119
+
120
+ // @todo: check if subscribtion exists
121
+ $subscription = $this->request(
122
+ 'create_subscription',
123
+ array(
124
+ 'AppID' => $app_id,
125
+ 'PlanId' => $plan,
126
+ 'paymentMethodToken' => $customer->paymentMethods[0]->token
127
+ )
128
+ );
129
+
130
+ // subscription assigned?
131
+ if ( ! empty( $subscription->error ) ) {
132
+ $response = $subscription->error;
133
+ break;
134
+ }
135
+
136
+ break;
137
+
138
+ case 'register':
139
+ $email = is_email( $_POST['email'] );
140
+ $pass = ! empty( $_POST['pass'] ) ? esc_attr( $_POST['pass'] ) : '';
141
+ $pass2 = ! empty( $_POST['pass2'] ) ? esc_attr( $_POST['pass2'] ) : '';
142
+ $terms = isset( $_POST['terms'] );
143
+ $language = ! empty( $_POST['language'] ) ? esc_attr( $_POST['language'] ) : 'en';
144
+
145
+ if ( ! $terms ) {
146
+ $response = array( 'error' => __( "Please accept the Terms of Service to proceed.", 'cookie-notice' ) );
147
+ break;
148
+ }
149
+
150
+ if ( ! $email ) {
151
+ $response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
152
+ break;
153
+ }
154
+
155
+ if ( ! $pass ) {
156
+ $response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
157
+ break;
158
+ }
159
+
160
+ if ( $pass !== $pass2 ) {
161
+ $response = array( 'error' => __( "Passwords do not match.", 'cookie-notice' ) );
162
+ break;
163
+ }
164
+
165
+ $params = array(
166
+ 'AdminID' => $email,
167
+ 'Password' => $pass,
168
+ 'Language' => $language
169
+ );
170
+
171
+ $response = $this->request( $request, $params );
172
+
173
+ // errors?
174
+ if ( ! empty( $response->error ) ) {
175
+ break;
176
+ }
177
+
178
+ // errors?
179
+ if ( ! empty( $response->message ) ) {
180
+ $response->error = $response->message;
181
+ break;
182
+ }
183
+
184
+ // ok, so log in now
185
+ $params = array(
186
+ 'AdminID' => $email,
187
+ 'Password' => $pass
188
+ );
189
+
190
+ $response = $this->request( 'login', $params );
191
+
192
+ // errors?
193
+ if ( ! empty( $response->error ) ) {
194
+ break;
195
+ }
196
+
197
+ // errors?
198
+ if ( ! empty( $response->message ) ) {
199
+ $response->error = $response->message;
200
+ break;
201
+ }
202
+ // token in response?
203
+ if ( empty( $response->data->token ) ) {
204
+ $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
205
+ break;
206
+ }
207
+
208
+ // set token
209
+ set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
210
+
211
+ // multisite?
212
+ if ( is_multisite() ) {
213
+ switch_to_blog( 1 );
214
+ $site_title = get_bloginfo( 'name' );
215
+ $site_url = network_site_url();
216
+ $site_description = get_bloginfo( 'description' );
217
+ restore_current_blog();
218
+ } else {
219
+ $site_title = get_bloginfo( 'name' );
220
+ $site_url = get_home_url();
221
+ $site_description = get_bloginfo( 'description' );
222
+ }
223
+
224
+ // create new app, no need to check existing
225
+ $params = array(
226
+ 'DomainName' => $site_title,
227
+ 'DomainUrl' => $site_url,
228
+ );
229
+
230
+ if ( ! empty( $site_description ) )
231
+ $params['DomainDescription'] = $site_description;
232
+
233
+ $response = $this->request( 'app_create', $params );
234
+
235
+ // errors?
236
+ if ( ! empty( $response->message ) ) {
237
+ $response->error = $response->message;
238
+ break;
239
+ }
240
+
241
+ // data in response?
242
+ if ( empty( $response->data->AppID ) || empty( $response->data->SecretKey ) ) {
243
+ $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
244
+ break;
245
+ } else {
246
+ $app_id = $response->data->AppID;
247
+ $secret_key = $response->data->SecretKey;
248
+ }
249
+
250
+ // update options: app ID and secret key
251
+ Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_id, 'app_key' => $secret_key ), Cookie_Notice()->options['general'] );
252
+
253
+ update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
254
+
255
+ // purge cache
256
+ delete_transient( 'cookie_notice_compliance_cache' );
257
+
258
+ // get options
259
+ // $app_config = get_transient( 'cookie_notice_app_config' );
260
+
261
+ // create quick config
262
+ $params = ! empty( $app_config ) && is_array( $app_config ) ? $app_config : array();
263
+
264
+ // cast to objects
265
+ if ( $params ) {
266
+ foreach ( $params as $key => $array ) {
267
+ $object = new stdClass();
268
+
269
+ foreach ( $array as $subkey => $value ) {
270
+ $new_params[$key] = $object;
271
+ $new_params[$key]->{$subkey} = $value;
272
+ }
273
+ }
274
+
275
+ $params = $new_params;
276
+ }
277
+
278
+ $params['AppID'] = $app_id;
279
+ // @todo When mutliple default languages are supported
280
+ $params['DefaultLanguage'] = 'en';
281
+
282
+ $response = $this->request( 'quick_config', $params );
283
+
284
+ if ( $response->status === 200 ) {
285
+ // notify publish app
286
+ $params = array(
287
+ 'AppID' => $app_id
288
+ );
289
+
290
+ $response = $this->request( 'notify_app', $params );
291
+
292
+ if ( $response->status === 200 ) {
293
+ $response = true;
294
+
295
+ // update app status
296
+ update_option( 'cookie_notice_status', 'active' );
297
+ } else {
298
+ // update app status
299
+ update_option( 'cookie_notice_status', 'pending' );
300
+
301
+ // errors?
302
+ if ( ! empty( $response->error ) ) {
303
+ break;
304
+ }
305
+
306
+ // errors?
307
+ if ( ! empty( $response->message ) ) {
308
+ $response->error = $response->message;
309
+ break;
310
+ }
311
+ }
312
+ } else {
313
+ // update app status
314
+ update_option( 'cookie_notice_status', 'pending' );
315
+
316
+ // errors?
317
+ if ( ! empty( $response->error ) ) {
318
+ $response->error = $response->error;
319
+ break;
320
+ }
321
+
322
+ // errors?
323
+ if ( ! empty( $response->message ) ) {
324
+ $response->error = $response->message;
325
+ break;
326
+ }
327
+ }
328
+
329
+ break;
330
+
331
+ case 'login':
332
+ $email = is_email( $_POST['email'] );
333
+ $pass = ! empty( $_POST['pass'] ) ? esc_attr( $_POST['pass'] ) : '';
334
+
335
+ if ( ! $email ) {
336
+ $response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
337
+ break;
338
+ }
339
+
340
+ if ( ! $pass ) {
341
+ $response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
342
+ break;
343
+ }
344
+
345
+ $params = array(
346
+ 'AdminID' => $email,
347
+ 'Password' => $pass
348
+ );
349
+
350
+ $response = $this->request( $request, $params );
351
+
352
+ // errors?
353
+ if ( ! empty( $response->error ) ) {
354
+ break;
355
+ }
356
+
357
+ // errors?
358
+ if ( ! empty( $response->message ) ) {
359
+ $response->error = $response->message;
360
+ break;
361
+ }
362
+
363
+ // token in response?
364
+ if ( empty( $response->data->token ) ) {
365
+ $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
366
+ break;
367
+ }
368
+
369
+ // set token
370
+ set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
371
+
372
+ // get apps and check if one for the current domain already exists
373
+ $response = $this->request( 'list_apps', array() );
374
+
375
+ // echo '<pre>'; print_r( $response ); echo '</pre>'; exit;
376
+
377
+ // errors?
378
+ if ( ! empty( $response->message ) ) {
379
+ $response->error = $response->message;
380
+ break;
381
+ }
382
+
383
+ $apps_list = array();
384
+ $app_exists = false;
385
+
386
+ // multisite?
387
+ if ( is_multisite() ) {
388
+ switch_to_blog( 1 );
389
+ $site_title = get_bloginfo( 'name' );
390
+ $site_url = network_site_url();
391
+ $site_description = get_bloginfo( 'description' );
392
+ restore_current_blog();
393
+ } else {
394
+ $site_title = get_bloginfo( 'name' );
395
+ $site_url = get_home_url();
396
+ $site_description = get_bloginfo( 'description' );
397
+ }
398
+
399
+ // apps added, check if current one exists
400
+ if ( ! empty( $response->data ) ) {
401
+ $apps_list = (array) $response->data;
402
+
403
+ foreach ( $apps_list as $index => $app ) {
404
+ $site_without_http = trim( str_replace( array( 'http://', 'https://' ), '', $site_url ), '/' );
405
+
406
+ if ( $app->DomainUrl === $site_without_http ) {
407
+ $app_exists = $app;
408
+
409
+ continue;
410
+ }
411
+ }
412
+ }
413
+
414
+ // if no app, create one
415
+ if ( ! $app_exists ) {
416
+
417
+ // create new app
418
+ $params = array(
419
+ 'DomainName' => $site_title,
420
+ 'DomainUrl' => $site_url,
421
+ );
422
+
423
+ if ( ! empty( $site_description ) )
424
+ $params['DomainDescription'] = $site_description;
425
+
426
+ $response = $this->request( 'app_create', $params );
427
+
428
+ // errors?
429
+ if ( ! empty( $response->message ) ) {
430
+ $response->error = $response->message;
431
+ break;
432
+ }
433
+
434
+ $app_exists = $response->data;
435
+ }
436
+
437
+ // check if we have the valid app data
438
+ if ( empty( $app_exists->AppID ) || empty( $app_exists->SecretKey ) ) {
439
+ $response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
440
+ break;
441
+ }
442
+
443
+ // update options: app ID and secret key
444
+ Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_exists->AppID, 'app_key' => $app_exists->SecretKey ), Cookie_Notice()->options['general'] );
445
+
446
+ update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
447
+
448
+ // purge cache
449
+ delete_transient( 'cookie_notice_compliance_cache' );
450
+
451
+ // create quick config
452
+ $params = array(
453
+ 'AppID' => $app_exists->AppID,
454
+ 'DefaultLanguage' => 'en'
455
+ );
456
+
457
+ $response = $this->request( 'quick_config', $params );
458
+
459
+ if ( $response->status === 200 ) {
460
+ // notify publish app
461
+ $params = array(
462
+ 'AppID' => $app_exists->AppID
463
+ );
464
+
465
+ $response = $this->request( 'notify_app', $params );
466
+
467
+ if ( $response->status === 200 ) {
468
+ $response = true;
469
+
470
+ // update app status
471
+ update_option( 'cookie_notice_status', 'active' );
472
+ } else {
473
+ // update app status
474
+ update_option( 'cookie_notice_status', 'pending' );
475
+
476
+ // errors?
477
+ if ( ! empty( $response->error ) ) {
478
+ break;
479
+ }
480
+
481
+ // errors?
482
+ if ( ! empty( $response->message ) ) {
483
+ $response->error = $response->message;
484
+ break;
485
+ }
486
+ }
487
+ } else {
488
+ // update app status
489
+ update_option( 'cookie_notice_status', 'pending' );
490
+
491
+ // errors?
492
+ if ( ! empty( $response->error ) ) {
493
+ $response->error = $response->error;
494
+ break;
495
+ }
496
+
497
+ // errors?
498
+ if ( ! empty( $response->message ) ) {
499
+ $response->error = $response->message;
500
+ break;
501
+ }
502
+ }
503
+
504
+ break;
505
+
506
+ case 'configure':
507
+ $fields = array(
508
+ 'cn_position',
509
+ 'cn_color_primary',
510
+ 'cn_color_background',
511
+ 'cn_color_border',
512
+ 'cn_color_text',
513
+ 'cn_color_heading',
514
+ 'cn_color_button_text',
515
+ 'cn_laws',
516
+ 'cn_purposes'
517
+ );
518
+
519
+ $options = array();
520
+
521
+ // loop through potential config form fields
522
+ foreach ( $fields as $field ) {
523
+ if ( isset( $_POST[$field] ) ) {
524
+ switch ( $field ) {
525
+ case 'cn_position':
526
+ // sanitize position
527
+ $position = sanitize_key( $_POST[$field] );
528
+
529
+ // valid position?
530
+ if ( in_array( $position, array( 'bottom', 'top', 'left', 'right', 'center' ), true ) )
531
+ $options['design']['position'] = $position;
532
+ else
533
+ $options['design']['position'] = 'bottom';
534
+ break;
535
+
536
+ case 'cn_color_primary':
537
+ // sanitize color
538
+ $color = sanitize_hex_color( $_POST[$field] );
539
+
540
+ // valid color?
541
+ if ( empty( $color ) )
542
+ $options['design']['primaryColor'] = '#20c19e';
543
+ else
544
+ $options['design']['primaryColor'] = $color;
545
+ break;
546
+
547
+ case 'cn_color_background':
548
+ // sanitize color
549
+ $color = sanitize_hex_color( $_POST[$field] );
550
+
551
+ // valid color?
552
+ if ( empty( $color ) )
553
+ $options['design']['bannerColor'] = '#ffffff';
554
+ else
555
+ $options['design']['bannerColor'] = $color;
556
+ break;
557
+
558
+ case 'cn_color_border':
559
+ // sanitize color
560
+ $color = sanitize_hex_color( $_POST[$field] );
561
+
562
+ // valid color?
563
+ if ( empty( $color ) )
564
+ $options['design']['borderColor'] = '#5e6a74';
565
+ else
566
+ $options['design']['borderColor'] = $color;
567
+ break;
568
+
569
+ case 'cn_color_text':
570
+ // sanitize color
571
+ $color = sanitize_hex_color( $_POST[$field] );
572
+
573
+ // valid color?
574
+ if ( empty( $color ) )
575
+ $options['design']['textColor'] = '#434f58';
576
+ else
577
+ $options['design']['textColor'] = $color;
578
+ break;
579
+
580
+ case 'cn_color_heading':
581
+ // sanitize color
582
+ $color = sanitize_hex_color( $_POST[$field] );
583
+
584
+ // valid color?
585
+ if ( empty( $color ) )
586
+ $options['design']['headingColor'] = '#434f58';
587
+ else
588
+ $options['design']['headingColor'] = $color;
589
+ break;
590
+
591
+ case 'cn_color_button_text':
592
+ // sanitize color
593
+ $color = sanitize_hex_color( $_POST[$field] );
594
+
595
+ // valid color?
596
+ if ( empty( $color ) )
597
+ $options['design']['headingColor'] = '#ffffff';
598
+ else
599
+ $options['design']['headingColor'] = $color;
600
+ break;
601
+
602
+ case 'cn_laws':
603
+ $new_options = array();
604
+
605
+ // any data?
606
+ if ( is_array( $_POST[$field] ) && ! empty( $_POST[$field] ) ) {
607
+ $options['laws'] = array_map( 'esc_attr', $_POST[$field] );
608
+
609
+ foreach ( $options['laws'] as $law ) {
610
+ if ( in_array( $law, array( 'gdpr', 'ccpa' ), true ) )
611
+ $new_options[$law] = true;
612
+ }
613
+ }
614
+
615
+ $options['laws'] = $new_options;
616
+
617
+ // GDPR
618
+ if ( array_key_exists( 'gdpr', $options['laws'] ) )
619
+ $options['config']['privacyPolicyLink'] = true;
620
+ else
621
+ $options['config']['privacyPolicyLink'] = false;
622
+
623
+ // CCPA
624
+ if ( array_key_exists( 'ccpa', $options['laws'] ) )
625
+ $options['config']['dontSellLink'] = true;
626
+ else
627
+ $options['config']['dontSellLink'] = false;
628
+ break;
629
+
630
+ case 'cn_purposes':
631
+ // sanitize purposes
632
+ $purposes = (int) $_POST[$field];
633
+
634
+ // get messages
635
+ $messages = Cookie_Notice()->settings->cookie_messages;
636
+
637
+ // valid purposes?
638
+ if ( array_key_exists( $purposes, $messages ) )
639
+ $options['text']['bodyText'] = $messages[$purposes];
640
+ else
641
+ $options['text']['bodyText'] = reset( $messages );
642
+ break;
643
+ }
644
+ }
645
+ }
646
+
647
+ // set options
648
+ set_transient( 'cookie_notice_app_config', $options, 24 * HOUR_IN_SECONDS );
649
+
650
+ break;
651
+
652
+ case 'select_plan':
653
+ break;
654
+ }
655
+
656
+ echo json_encode( $response );
657
+ exit;
658
+ }
659
+
660
+ /**
661
+ * API request.
662
+ *
663
+ * @param string $action The requested action.
664
+ * @param array $_data Parameters for the API action.
665
+ * @return false|object
666
+ */
667
+ private function request( $request = '', $params = '' ) {
668
+ $api_args = array(
669
+ 'timeout' => 60,
670
+ 'sslverify' => false,
671
+ 'headers' => array( 'x-api-key' => $this->x_api_key )
672
+ );
673
+ $api_params = array();
674
+ $json = false;
675
+
676
+ // get app token data
677
+ $data_token = get_transient( 'cookie_notice_app_token' );
678
+ $api_token = ! empty( $data_token->token ) ? $data_token->token : '';
679
+ $admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
680
+
681
+ switch ( $request ) {
682
+ case 'register':
683
+ $api_url = $this->account_api_url . '/api/account/account/registration';
684
+ $api_args['method'] = 'POST';
685
+ break;
686
+
687
+ case 'login':
688
+ $api_url = $this->account_api_url . '/api/account/account/login';
689
+ $api_args['method'] = 'POST';
690
+ break;
691
+
692
+ case 'list_apps':
693
+ $api_url = $this->account_api_url . '/api/account/app/list';
694
+ $api_args['method'] = 'GET';
695
+ $api_args['headers'] = array_merge(
696
+ $api_args['headers'],
697
+ array(
698
+ 'Authorization' => 'Bearer ' . $api_token
699
+ )
700
+ );
701
+ break;
702
+
703
+ case 'app_create':
704
+ $api_url = $this->account_api_url . '/api/account/app/add';
705
+ $api_args['method'] = 'POST';
706
+ $api_args['headers'] = array_merge(
707
+ $api_args['headers'],
708
+ array(
709
+ 'Authorization' => 'Bearer ' . $api_token
710
+ )
711
+ );
712
+ break;
713
+
714
+ case 'get_config':
715
+ $api_url = $this->designer_api_url . '/api/designer/user-design-live';
716
+ $api_args['method'] = 'GET';
717
+ break;
718
+
719
+ case 'quick_config':
720
+ $json = true;
721
+ $api_url = $this->designer_api_url . '/api/designer/user-design/quick';
722
+ $api_args['method'] = 'POST';
723
+ $api_args['headers'] = array_merge(
724
+ $api_args['headers'],
725
+ array(
726
+ 'Authorization' => 'Bearer ' . $api_token,
727
+ 'Content-Type' => 'application/json; charset=utf-8'
728
+ )
729
+ );
730
+ break;
731
+
732
+ case 'notify_app':
733
+ $json = true;
734
+ $api_url = $this->account_api_url . '/api/account/app/notifyAppPublished';
735
+ $api_args['method'] = 'POST';
736
+ $api_args['headers'] = array_merge(
737
+ $api_args['headers'],
738
+ array(
739
+ 'Authorization' => 'Bearer ' . $api_token,
740
+ 'Content-Type' => 'application/json; charset=utf-8'
741
+ )
742
+ );
743
+ break;
744
+
745
+ // braintree init token
746
+ case 'get_token':
747
+ $api_url = $this->account_api_url . '/api/account/braintree';
748
+ $api_args['method'] = 'GET';
749
+ $api_args['headers'] = array_merge(
750
+ $api_args['headers'],
751
+ array(
752
+ 'Authorization' => 'Bearer ' . $api_token
753
+ )
754
+ );
755
+ break;
756
+
757
+ // braintree get customer
758
+ case 'get_customer':
759
+ $json = true;
760
+ $api_url = $this->account_api_url . '/api/account/braintree/findcustomer';
761
+ $api_args['method'] = 'POST';
762
+ $api_args['data_format'] = 'body';
763
+ $api_args['headers'] = array_merge(
764
+ $api_args['headers'],
765
+ array(
766
+ 'Authorization' => 'Bearer ' . $api_token,
767
+ 'Content-Type' => 'application/json; charset=utf-8'
768
+ )
769
+ );
770
+ break;
771
+
772
+ // braintree create customer in vault
773
+ case 'create_customer':
774
+ $json = true;
775
+ $api_url = $this->account_api_url . '/api/account/braintree/createcustomer';
776
+ $api_args['method'] = 'POST';
777
+ $api_args['headers'] = array_merge(
778
+ $api_args['headers'],
779
+ array(
780
+ 'Authorization' => 'Bearer ' . $api_token,
781
+ 'Content-Type' => 'application/json; charset=utf-8'
782
+ )
783
+ );
784
+ break;
785
+
786
+ // braintree assign subscription to the customer
787
+ case 'create_subscription':
788
+ $json = true;
789
+ $api_url = $this->account_api_url . '/api/account/braintree/createsubscription';
790
+ $api_args['method'] = 'POST';
791
+ $api_args['headers'] = array_merge(
792
+ $api_args['headers'],
793
+ array(
794
+ 'Authorization' => 'Bearer ' . $api_token,
795
+ 'Content-Type' => 'application/json; charset=utf-8'
796
+ )
797
+ );
798
+ break;
799
+ }
800
+
801
+ if ( ! empty( $params ) && is_array( $params ) ) {
802
+ foreach ( $params as $key => $param ) {
803
+ if ( is_object( $param ) )
804
+ $api_params[$key] = $param;
805
+ else
806
+ $api_params[$key] = esc_attr( $param );
807
+ }
808
+
809
+ if ( $json )
810
+ $api_args['body'] = json_encode( $api_params );
811
+ else
812
+ $api_args['body'] = $api_params;
813
+ }
814
+
815
+ $response = wp_remote_request( $api_url, $api_args );
816
+
817
+ if ( is_wp_error( $response ) )
818
+ $result = array( 'error' => $response->get_error_message() );
819
+ else {
820
+ $content_type = wp_remote_retrieve_header( $response, 'Content-Type' );
821
+
822
+ // HTML response, means error
823
+ if ( $content_type == 'text/html' ) {
824
+ $result = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
825
+ } else {
826
+ $result = wp_remote_retrieve_body( $response );
827
+ // detect json or array
828
+ $result = is_array( $result ) ? $result : json_decode( $result );
829
+ }
830
+ }
831
+
832
+ return $result;
833
+ }
834
+
835
+ /**
836
+ * Ajax API request
837
+ */
838
+ public function get_app_status( $app_id ) {
839
+ $result = '';
840
+
841
+ if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
842
+ return false;
843
+
844
+ $params = array(
845
+ 'AppID' => $app_id
846
+ );
847
+
848
+ $response = $this->request( 'get_config', $params );
849
+
850
+ if ( ! empty( $response->data ) ) {
851
+ $result = 'active';
852
+ } else {
853
+ if ( ! empty( $response->error ) ) {
854
+ if ( $response->error == 'App is not puplised yet' )
855
+ $result = 'pending';
856
+ else
857
+ $result = '';
858
+ }
859
+ }
860
+
861
+ return $result;
862
+ }
863
+
864
+ /**
865
+ * Defines the function used to initial the cURL library.
866
+ *
867
+ * @param string $url To URL to which the request is being made
868
+ * @param string $params The URL query parameters
869
+ * @return string $response The response, if available; otherwise, null
870
+ */
871
+ private function curl( $url, $args ) {
872
+ $curl = curl_init( $url );
873
+
874
+ $headers = array();
875
+
876
+ foreach ( $args['headers'] as $header => $value ) {
877
+ $headers[] = $header . ': ' . $value;
878
+ }
879
+
880
+ curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
881
+ curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
882
+ curl_setopt( $curl, CURLOPT_HEADER, false );
883
+ curl_setopt( $curl, CURLOPT_USERAGENT, '' );
884
+ curl_setopt( $curl, CURLOPT_HTTPGET, true );
885
+ curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'GET' );
886
+ curl_setopt( $curl, CURLOPT_POSTFIELDS, $args['body'] );
887
+ curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
888
+
889
+ $response = curl_exec( $curl );
890
+
891
+ if ( 0 !== curl_errno( $curl ) || 200 !== curl_getinfo( $curl, CURLINFO_HTTP_CODE ) )
892
+ $response = null;
893
+
894
+ curl_close( $curl );
895
+
896
+ return $response;
897
+ }
898
  }
includes/welcome.php CHANGED
@@ -1,797 +1,794 @@
1
- <?php
2
- // exit if accessed directly
3
- if ( ! defined( 'ABSPATH' ) )
4
- exit;
5
-
6
- /**
7
- * Cookie_Notice_Welcome class.
8
- *
9
- * @class Cookie_Notice_Welcome
10
- */
11
- class Cookie_Notice_Welcome {
12
-
13
- private $app_login_url = '';
14
-
15
- public function __construct() {
16
- // actions
17
- add_action( 'admin_init', array( $this, 'welcome' ) );
18
- add_action( 'wp_ajax_cn_welcome_screen', array( $this, 'welcome_screen' ) );
19
-
20
- $this->app_login_url = 'https://app.hu-manity.co/#/en/cc2/login';
21
- }
22
-
23
- /**
24
- * Load scripts and styles - admin.
25
- */
26
- public function admin_enqueue_scripts( $page ) {
27
- if ( in_array( Cookie_Notice()->get_status(), array( 'active', 'pending' ) ) )
28
- return;
29
-
30
- wp_enqueue_style( 'dashicons' );
31
-
32
- wp_enqueue_style( 'cookie-notice-modaal', plugins_url( '../assets/modaal/css/modaal.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
33
- wp_enqueue_script( 'cookie-notice-modaal', plugins_url( '../assets/modaal/js/modaal.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
34
-
35
- wp_enqueue_style( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
36
-
37
- wp_enqueue_style( 'cookie-notice-microtip', plugins_url( '../assets/microtip/microtip.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
38
-
39
- wp_enqueue_script( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
40
- wp_enqueue_script( 'cookie-notice-welcome', plugins_url( '../js/admin-welcome.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-progressbar' ), Cookie_Notice()->defaults['version'] );
41
- wp_enqueue_script( 'cookie-notice-braintree-client', 'https://js.braintreegateway.com/web/3.71.0/js/client.min.js', array(), null, false );
42
- wp_enqueue_script( 'cookie-notice-braintree-hostedfields', 'https://js.braintreegateway.com/web/3.71.0/js/hosted-fields.min.js', array(), null, false );
43
- wp_enqueue_script( 'cookie-notice-braintree-paypal', 'https://js.braintreegateway.com/web/3.71.0/js/paypal-checkout.min.js', array(), null, false );
44
-
45
- $js_args = array(
46
- 'ajaxURL' => admin_url( 'admin-ajax.php' ),
47
- 'nonce' => wp_create_nonce( 'cookie-notice-welcome' ),
48
- 'initModal' => get_transient( 'cn_show_welcome' ), // welcome modal
49
- 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ),
50
- 'statusPassed' => __( 'Passed', 'cookie-notice' ),
51
- 'statusFailed' => __( 'Failed', 'cookie-notice' ),
52
- 'complianceStatus' => Cookie_Notice()->get_status(),
53
- 'complianceFailed' => __( '<em>Compliance Failed!</em>Your website does not achieve minimum viable compliance. <b><a href="#" class="cn-sign-up">Sign up to Cookie Compliance</a></b> to bring your site into compliance with the latest data privacy rules and regulations.', 'cookie-notice' ),
54
- 'compliancePassed' => __( '<em>Compliance Passed!</em>Congratulations. Your website meets minimum viable compliance.', 'cookie-notice' ),
55
- 'invalidFields' => __( 'Please fill all the required fields.', 'cookie-notice' )
56
- );
57
-
58
- // delete the show modal transient
59
- delete_transient( 'cn_show_welcome' );
60
-
61
- wp_localize_script(
62
- 'cookie-notice-welcome',
63
- 'cnWelcomeArgs',
64
- $js_args
65
- );
66
-
67
- wp_enqueue_style( 'cookie-notice-welcome', plugins_url( '../css/admin-welcome.css', __FILE__ ) );
68
- }
69
-
70
- /**
71
- * Add one or more classes to the body tag in the dashboard.
72
- *
73
- * @param string $classes
74
- * @return string
75
- */
76
- public function admin_body_class( $classes ) {
77
- if ( isset( $_GET['page'] ) && $_GET['page'] === 'cookie-notice-welcome' )
78
- $classes .= ' folded';
79
-
80
- return $classes;
81
- }
82
-
83
- /**
84
- * Send user to the welcome page on first activation.
85
- *
86
- * @return void
87
- */
88
- public function welcome() {
89
- global $pagenow;
90
-
91
- if ( $pagenow != 'admin.php' )
92
- return;
93
-
94
- if ( isset( $_GET['page'] ) && $_GET['page'] !== 'cookie-notice' )
95
- return;
96
-
97
- // bail if activating from network, or bulk, or within an iFrame
98
- if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
99
- return;
100
-
101
- if ( (isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action']) && (isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'cookie-notice.php' )) )
102
- return;
103
-
104
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
105
- add_action( 'admin_footer', array( $this, 'admin_footer' ) );
106
-
107
- add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
108
- }
109
-
110
- /**
111
- * Welcome modal container.
112
- */
113
- public function admin_footer() {
114
- echo '<button id="cn-modal-trigger" style="display:none;"></button>';
115
- }
116
-
117
- /**
118
- * Output the welcome screen.
119
- *
120
- * @return void
121
- */
122
- public function welcome_page() {
123
- // get plugin version
124
- $plugin_version = substr( Cookie_Notice()->defaults['version'], 0, 3 );
125
- $screen = ( isset( $_GET['screen'] ) ? (int) $_GET['screen'] : 1 );
126
-
127
- $this->welcome_screen( $screen );
128
- }
129
-
130
- /**
131
- * Render welcome screen sidebar step.
132
- *
133
- * @param int $step
134
- * @return mixed
135
- */
136
- public function welcome_screen( $screen, $echo = true ) {
137
- global $current_user;
138
-
139
- if ( ! current_user_can( 'install_plugins' ) )
140
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
141
-
142
- $sidebars = array( 'about', 'login', 'register', 'configure', 'select_plan', 'success' );
143
- $steps = array( 1, 2, 3, 4 );
144
- $screens = array_merge( $sidebars, $steps );
145
-
146
- $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
147
- $screen = ! empty( $screen ) && in_array( $screen, $screens ) ? $screen : ( isset( $_REQUEST['screen'] ) && in_array( $_REQUEST['screen'], $screens ) ? esc_attr( $_REQUEST['screen'] ) : '' );
148
-
149
- if ( empty( $screen ) )
150
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
151
-
152
- if ( $is_ajax && ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
153
- wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
154
-
155
- // get token data
156
- $token_data = get_transient( 'cookie_notice_app_token' );
157
-
158
- // step screens
159
- if ( in_array( $screen, $steps ) ) {
160
- $html = '
161
- <div class="wrap full-width-layout cn-welcome-wrap cn-welcome-step-' . $screen . ' has-loader">';
162
-
163
- if ( $screen == 1 ) {
164
- $html .= $this->welcome_screen( 'about', false );
165
-
166
- $html .= '
167
- <div class="cn-content cn-sidebar-visible">
168
- <div class="cn-inner">
169
- <div class="cn-content-full">
170
- <h1><b>Cookie Compliance&trade;</b></h1>
171
- <h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
172
- <div class="cn-lead">
173
- <p><b>' . __( 'Cookie Compliance is a free web application that enables websites to take a proactive approach to data protection and consent laws.', 'cookie-notice' ) . '</b></p>
174
- <div class="cn-hero-image">
175
- <div class="cn-flex-item">
176
- <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
177
- </div>
178
- </div>
179
- <p>' . __( 'It is the first solution to offer <b>intentional consent</b>, a new consent framework that incorporates the latest guidelines from over 100+ countries, and emerging standards from leading international organizations like the IEEE.', 'cookie-notice' ) . '</p>
180
- <p>' . __( 'Cookie Notice includes <b>seamless integration</b> with Cookie Compliance to help your site comply with the latest updates to existing consent laws and provide a beautiful, multi-level experience to engage visitors in data privacy decisions.', 'cookie-notice' ) . '</p>
181
- </div>';
182
- /*
183
- <div class="cn-lead">
184
- <p>' . __( 'Rules and regulations around cookie consent are <b>becoming more strict</b>, and enforcement of violations is rapidly increasing. So far in 2021, companies have paid fines totaling over €18M.', 'cookie-notice' ) . '</p>
185
- <p>' . __( 'If your website collects visitor data and does not (1) <b>Autoblock</b> cookies, (2) enable visitors to consent by <b>Cookie Category</b>, and/or (3) store <b>Proof-of-Consent</b>, your business is at risk.', 'cookie-notice' ) . '</p>
186
- <p>' . sprintf( __( 'Cookie Notice %s includes integration with <b>Cookie Compliance&trade;</b> web application that will help your site meet minimum viable compliance based on updates to existing laws (GDPR, CCPA) and introduction of new laws (ePrivacy, PECR).', 'cookie-notice' ), Cookie_Notice()->defaults['version'] ) . '</p>
187
- </div>
188
- */
189
- $html .= '
190
- <div class="cn-buttons">
191
- <button type="button" class="cn-btn cn-btn-lg cn-screen-button" data-screen="3"><span class="cn-spinner"></span>' . __( 'Sign up to Cookie Compliance', 'cookie-notice' ) . '</button><br />
192
- <button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</button>
193
- </div>
194
- ';
195
- /*
196
- $html .= '
197
- <div class="cn-hero-image">
198
- <div class="cn-flex-item">
199
- <div class="cn-logo-container">
200
- <img src="' . plugins_url( '../img/cookie-notice-logo-dark.png', __FILE__ ) . '">
201
- <span class="cn-badge">' . __( 'WP Plugin', 'cookie-notice' ) . '</span>
202
- </div>
203
- <img src="' . plugins_url( '../img/screen-notice.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
204
- <ul>
205
- <li><span>' . __( 'Customizable notice message', 'cookie-notice' ) . '</span></li>
206
- <li><span>' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '</span></li>
207
- <li><span>' . __( 'Multiple cookie expiry options', 'cookie-notice' ) . '</span></li>
208
- <li><span>' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '</span></li>
209
- </ul>
210
- </div>
211
- <div class="cn-flex-item">
212
- <img src="//cno0-53eb.kxcdn.com/screen-plus.png" alt="Cookie Notice + Compliance" />
213
- </div>
214
- <div class="cn-flex-item">
215
- <div class="cn-logo-container">
216
- <img src="' . plugins_url( '../img/cookie-compliance-logo-dark.png', __FILE__ ) . '">
217
- <span class="cn-badge">' . __( 'Web App', 'cookie-notice' ) . '</span>
218
- </div>
219
- <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '"alt="Cookie Compliance dashboard" />
220
- <ul>
221
- <li><span>' . __( 'Customizable <b>GDPR & CCPA</b> notice templates', 'cookie-notice' ) . '</span></li>
222
- <li><span>' . __( '<b>Consent Analytics</b> Dashboard', 'cookie-notice' ) . '</span></li>
223
- <li><span>' . __( 'Cookie <b>Autoblocking</b> (complies with GDPR Art.7)', 'cookie-notice' ) . '</span></li>
224
- <li><span>' . __( '<b>Cookie Categories</b> (complies with GDPR Art.32)', 'cookie-notice' ) . '</span></li>
225
- <li><span>' . __( '<b>Proof-of-Consent</b> Storage (complies with GDPR Art.30)', 'cookie-notice' ) . '</span></li>
226
- <li><span>' . __( "Link to <b>'Do Not Sell'</b> page (supports CCPA Sec.1798)", 'cookie-notice' ) . '</span></li>
227
- <li><span>' . __( 'Enhanced design controls and options', 'cookie-notice' ) . '</span></li>
228
- <li><span>' . __( 'Multiple new banner positions', 'cookie-notice' ) . '</span></li>
229
- <li><span>' . __( 'Custom language localization', 'cookie-notice' ) . '</span></li>
230
- </ul>
231
- </div>
232
- </div>
233
- */
234
-
235
- $html .= '
236
- </div>
237
- </div>
238
- </div>';
239
-
240
- } elseif ( $screen == 2 ) {
241
- $html .= $this->welcome_screen( 'configure', false );
242
-
243
- $html .= '
244
- <div id="cn_upgrade_iframe" class="cn-content cn-sidebar-visible has-loader cn-loading"><span class="cn-spinner"></span>
245
- <iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=1' ) . '"></iframe>
246
- </div>';
247
- } elseif ( $screen == 3 ) {
248
- // get options
249
- $app_config = get_transient( 'cookie_notice_app_config' );
250
-
251
- // echo '<pre>'; print_r( $app_config ); echo '</pre>';
252
-
253
- $html .= $this->welcome_screen( 'register', false );
254
-
255
- $html .= '
256
- <div class="cn-content cn-sidebar-visible">
257
- <div class="cn-inner">
258
- <div class="cn-content-full">
259
- <h1><b>Cookie Compliance&trade;</b></h1>
260
- <h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
261
- <div class="cn-lead">
262
- <p>' . __( 'Take a proactive approach to data protection and consent laws by signing up for Cookie Compliance account. Then select a limited Basic Plan for free or get one of the Professional Plans for unlimited visits, consent storage, languages and customizations.', 'cookie-notice' ) . '</p>
263
- </div>';
264
- /*
265
- <div class="cn-billing-wrapper cn-radio-wrapper">
266
- <label for="cn_billing_monthly"><input id="cn_billing_monthly" type="radio" name="cn_billing" value="monthly" checked><span><span>' . __( 'Billing Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label><label for="cn_billing_yearly"><input id="cn_billing_yearly" type="radio" name="cn_billing" value="yearly"><span><span>' . __( 'Billing Yearly', 'cookie-notice' ) . '</span> <span class="cn-price-off">(' . __( '15% off', 'cookie-notice' ) . ')</span><span class="cn-plan-overlay"></span></span></label>
267
- </div>
268
-
269
- $html .= '
270
- <div class="cn-hero-image">
271
- <div class="cn-flex-item">
272
- <div class="cn-logo-container">
273
- <img src="' . plugins_url( '../img/cookie-notice-logo-dark.png', __FILE__ ) . '">
274
- <span class="cn-badge">' . __( 'WP Plugin', 'cookie-notice' ) . '</span>
275
- </div>
276
- <img src="' . plugins_url( '../img/screen-notice.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
277
- <ul class="cn-features-list">
278
- <li><span>' . __( '<b>Free</b>', 'cookie-notice' ) . '</span></li>
279
- <li><span>' . __( 'Customizable notice message', 'cookie-notice' ) . '</span></li>
280
- <li><span>' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '</span></li>
281
- <li><span>' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '</span></li>
282
- </ul>
283
- </div>
284
- <div class="cn-flex-item">
285
- <img src="//cno0-53eb.kxcdn.com/screen-plus.png" alt="Cookie Notice + Compliance" />
286
- </div>
287
- <div class="cn-flex-item">
288
- <div class="cn-logo-container">
289
- <img src="' . plugins_url( '../img/cookie-compliance-logo-dark.png', __FILE__ ) . '">
290
- <span class="cn-badge">' . __( 'Web App', 'cookie-notice' ) . '</span>
291
- </div>
292
- <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '"alt="Cookie Compliance dashboard" />
293
- <ul class="cn-features-list">
294
- <li><span>' . __( '<b>Free plan</b>', 'cookie-notice' ) . '</span></li>
295
- <li><span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</span></li>
296
- <li><span>' . __( 'Cookie Autoblocking', 'cookie-notice' ) . '</span></li>
297
- <li><span>' . __( 'Cookie Categories', 'cookie-notice' ) . '</span></li>
298
- <li><span>' . __( 'Proof-of-Consent Storage', 'cookie-notice' ) . '</span></li>
299
- <li><span>' . __( "Link to 'Do Not Sell' page", 'cookie-notice' ) . '</span></li>
300
- </ul>
301
- </div>
302
- </div>';
303
- */
304
-
305
- $html .= '
306
- <h3 class="cn-pricing-select">' . __( 'Compliance Plans', 'cookie-notice' ) . ':</h3>
307
- <div class="cn-pricing-table">
308
- <label class="cn-pricing-item" for="cn_pricing_plan_free">
309
- <input id="cn_pricing_plan_free" type="radio" name="cn_pricing_plan" value="free">
310
- <div class="cn-pricing-info">
311
- <div class="cn-pricing-head">
312
- <h4>' . __( 'Basic', 'cookie-notice' ) . '</h4>
313
- <span class="cn-plan-pricing"><span class="cn-plan-price">' . __( 'Free', 'cookie-notice' ) . '</span></span>
314
- </div>
315
- <div class="cn-pricing-body">
316
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
317
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
318
- <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>10,000</b> visits', 'cookie-notice' ) . '</p>
319
- <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>30 days</b> consent storage', 'cookie-notice' ) . '</p>
320
- <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>1 additional</b> language', 'cookie-notice' ) . '</p>
321
- <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>Basic</b> Support', 'cookie-notice' ) . '</p>
322
- </div>
323
- <div class="cn-pricing-footer">
324
- <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
325
- </div>
326
- </div>
327
- </label>
328
- <label class="cn-pricing-item" for="cn_pricing_plan_monthly">
329
- <input id="cn_pricing_plan_monthly" type="radio" name="cn_pricing_plan" value="monthly">
330
- <div class="cn-pricing-info">
331
- <div class="cn-pricing-head">
332
- <h4>' . __( 'Professional Monthly', 'cookie-notice' ) . '</h4>
333
- <span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>14.95</span> / ' . __( 'month', 'cookie-notice' ) . '</span>
334
- </div>
335
- <div class="cn-pricing-body">
336
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
337
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
338
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
339
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
340
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
341
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Regular</b> Support', 'cookie-notice' ) . '</p>
342
- </div>
343
- <div class="cn-pricing-footer">
344
- <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
345
- </div>
346
- </div>
347
- </label>
348
- <label class="cn-pricing-item" for="cn_pricing_plan_yearly">
349
- <input id="cn_pricing_plan_yearly" type="radio" name="cn_pricing_plan" value="yearly">
350
- <div class="cn-pricing-info">
351
- <div class="cn-pricing-head">
352
- <h4>' . __( 'Professional Yearly', 'cookie-notice' ) . '</h4>
353
- <span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>149.50</span> / ' . __( 'year', 'cookie-notice' ) . '</span>
354
- <span class="cn-plan-promo">' . __( 'Best Value', 'cookie-notice' ) . '</span>
355
- </div>
356
- <div class="cn-pricing-body">
357
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
358
- <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
359
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
360
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
361
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
362
- <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Premium</b> Support', 'cookie-notice' ) . '</p>
363
- </div>
364
- <div class="cn-pricing-footer">
365
- <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
366
- </div>
367
- </div>
368
- </label>
369
- </div>
370
- <div class="cn-buttons">
371
- <button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( "I don’t want to create an account now", 'cookie-notice' ) . '</button>
372
- </div>';
373
-
374
-
375
- $html .= '
376
- </div>
377
- </div>
378
- </div>';
379
-
380
- } elseif ( $screen == 4 ) {
381
- $html .= $this->welcome_screen( 'success', false );
382
-
383
- $html .= '
384
- <div class="cn-content cn-sidebar-visible">
385
- <div class="cn-inner">
386
- <div class="cn-content-full">
387
- <h1><b>' . __( 'Congratulations', 'cookie-notice' ) . '</b></h1>
388
- <h2>' . __( 'You are now promoting privacy with Hu-manity.co', 'cookie-notice' ) . '</h2>
389
- <div class="cn-lead">
390
- <p>' . __( 'Log in to your Cookie Compliance&trade; account and continue configuring your Privacy Experience.', 'cookie-notice' ) . '</p>
391
- </div>
392
- <div class="cn-buttons">
393
- <a href="' . $this->app_login_url . '" class="cn-btn cn-btn-lg" target="_blank">' . __( 'Go to Application', 'cookie-notice' ) . '</a>
394
- </div>
395
- </div>
396
- </div>
397
- </div>';
398
- }
399
-
400
- $html .= '
401
- </div>';
402
- // sidebar screens
403
- } elseif ( in_array( $screen, $sidebars ) ) {
404
- $html = '';
405
-
406
- if ( $screen === 'about' ) {
407
-
408
- $theme = wp_get_theme();
409
-
410
- $html .= '
411
- <div class="cn-sidebar cn-sidebar-left has-loader">
412
- <div class="cn-inner">
413
- <div class="cn-header">
414
- <div class="cn-top-bar">
415
- <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
416
- </div>
417
- </div>
418
- <div class="cn-body">
419
- <h2>' . __( 'Compliance check', 'cookie-notice' ) . '</h2>
420
- <div class="cn-lead"><p>' . __( 'This is a Compliance Check to determine your site’s compliance with updated data processing and consent rules under GDPR, CCPA and other international data privacy laws.', 'cookie-notice' ) . '</p></div>
421
- <div id="cn_preview_about">
422
- <p>' . __( 'Site URL', 'cookie-notice' ) . ': <b>' . home_url() . '</b></p>
423
- <p>' . __( 'Site Name', 'cookie-notice' ) . ': <b>' . get_bloginfo( 'name' ) . '</b></p>
424
- </div>
425
- <div class="cn-compliance-check">
426
- <div class="cn-progressbar"><div class="cn-progress-label">' . __( 'Checking...', 'cookie-notice' ) . '</div></div>
427
- <div class="cn-compliance-feedback cn-hidden"></div>
428
- <div class="cn-compliance-results">
429
- <div class="cn-compliance-item"><p><span class="cn-compliance-label">' . __( 'Cookie Notice', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Notifies visitors that site uses cookies.', 'cookie-notice' ) . '</span></p></div>
430
- <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Autoblocking', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Non-essential cookies blocked until consent is registered.', 'cookie-notice' ) . '</span></p></div>
431
- <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Cookie Categories', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Separate consent requested per purpose of use.', 'cookie-notice' ) . '</span></p></div>
432
- <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Proof-of-Consent', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Proof-of-consent stored in secure audit format.', 'cookie-notice' ) . '</span></p></div>
433
- </div>
434
- </div>
435
- ' /* <div id="cn_preview_frame"><img src=" ' . esc_url( $theme->get_screenshot() ) . '" /></div>
436
- . '<div id="cn_preview_frame"><div id="cn_preview_frame_wrapper"><iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=0' ) . '" scrolling="no" frameborder="0"></iframe></div></div> */ . '
437
- </div>';
438
- } elseif ( $screen === 'configure' ) {
439
- $html .= '
440
- <div class="cn-sidebar cn-sidebar-left has-loader cn-theme-light">
441
- <div class="cn-inner">
442
- <div class="cn-header">
443
- <div class="cn-top-bar">
444
- <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
445
- </div>
446
- </div>
447
- <div class="cn-body">
448
- <h2>' . __( 'Live Setup', 'cookie-notice' ) . '</h2>
449
- <div class="cn-lead"><p>' . __( 'Configure your Cookie Notice & Compliance design and compliance features through the options below. Click Apply Setup to save the configuration and go to selecting your preferred cookie solution.', 'cookie-notice' ) . '</p></div>
450
- <form id="cn-form-configure" class="cn-form" action="" data-action="configure">
451
- <div class="cn-accordion">
452
- <div class="cn-accordion-item cn-form-container" tabindex="-1">
453
- <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Compliance', 'cookie-notice' ) . '</button></div>
454
- <div class="cn-accordion-collapse cn-form">
455
- <div class="cn-form-feedback cn-hidden"></div>' .
456
- /*
457
- <div class="cn-field cn-field-select">
458
- <label for="cn_location">' . __( 'What is the location of your business/organization?', 'cookie-notice' ) . '​</label>
459
- <div class="cn-select-wrapper">
460
- <select id="cn_location" name="cn_location">
461
- <option value="0">' . __( 'Select location', 'cookie-notice' ) . '</option>';
462
-
463
- foreach ( Cookie_Notice()->settings->countries as $country_code => $country_name ) {
464
- $html .= '<option value="' . $country_code . '">' . $country_name . '</option>';
465
- }
466
-
467
- $html .= '
468
- </select>
469
- </div>
470
- </div>
471
- */
472
- '
473
- <div id="cn_laws" class="cn-field cn-field-checkbox">
474
- <label>' . __( 'Select the laws that apply to your business', 'cookie-notice' ) . ':</label>
475
- <div class="cn-checkbox-image-wrapper">
476
- <label for="cn_laws_gdpr"><input id="cn_laws_gdpr" type="checkbox" name="cn_laws" value="gdpr" title="' . __( 'GDPR', 'cookie-notice' ) . '" checked><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoge2ZzZGjMBCFmcMet4rjHjlsANQmsGRgZ7BkMGRgZ7DOYMhgnME4A08GdgZ2AujbA41HiD8JEOawXUWVXUjd73WLVqsVBB4F+OlTv3cBciB7Ng4nAV6ADHjnSz6A7bOxPQQIh94Dd43AaSFodgKkFmNOGoHEYvwySw1IgJtFFHJgC6RD4GTJnedF2jQSAUfNqzfgMFFnAnxqOi9CvNc5UwzG1CWaQede03f1Bl6MhZqxz5l0Jot97BKBRH5nc3hLCETyO52qr1LqL4wjxWm5Akd/UMaJfOzdjpUs8xvYyXp8k//RcjA7Mf01MMVdE3IjyxyfvZyMLIVEIuoarGcZJhqOgY14bJITqO8VSd/AqobZy6T2UPUbi5RSH0op9EeW5igiguVAWZ50YxKvhRoZJ4MC/maCr56iKN5GEgi139EYHVailDpqYHMgKYpir5S6a5FIvQGYIuL9B3jjXapFYnUpOgiCIAC2mpcT872+lJ4Ab1hkqfQRuHslIB9wNHa+BYHrHAToOprKJuacJSgPLH+M1HmRtLkDdkqp95aU+tqb09tthcC5No/moeLcybKpMO5KmZbPydLON3HwzagSflQD9BIid/BI4gD2OpaA2DIbBan+8qC9sD5cOxD4FADZWAJir72kkAjE8sxN4FEGF0WRT4xAVtl1/X6sCQCZlpH6wDtHYHbpIFDVUskA+HUSUEqd9eKrB/xqCVQkNmb+X4SAy8fhmEYnEbDGJanKavDCBPoPWJSnsIvk2BvlAbr3RAaEssZPYx6blN2BK2obGFGX/bBf/EsLrm7SlL3J5k73ZMGmVS9MT5Qt8T0rulGhLHViyso3sZ20uvbif1kiKl5tuFSqI/WH+Gq78HUR4dytc7CRS86fLwo078YQQ5HFXKtLEOq3NMP53lVaNpPIcs4Fy0YB9S70LNdXpgGqjW5g3AvNlvgd+DUwb6vZmHT72aY8rtY+WgN4YI5+fh3cFPUNynqz8inUt//V7OpWAnwHNuZvH/IPPeDD9c6V9FUAAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'GDPR', 'cookie-notice' ) . '</span></label>
477
- <label for="cn_laws_ccpa"><input id="cn_laws_ccpa" type="checkbox" name="cn_laws" value="ccpa" title="' . __( 'CCPA', 'cookie-notice' ) . '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAwCAYAAACScGMWAAACPElEQVRYheXYvXHbMBTAcY7AEbSA79Smskp30QiqkyLaQPQE8Qb2BtEG4QZil3Ry5ZZaAO/vAqANIwSJD1LmXXD3ToVE8sf3hEcQRVEUBXADfE+Mu2LOAVSkj/q/xj0sGVcvEgeUGTAvDlgBP4CD+Vyl4HaZuNa9WRH5JSK4oZT6CZQxuN+ZOBzYqQ9mxSkYmAuzcUqpyoE0InIUkWcng1UoLresWFlrOwCwczLa2EAispczWzvcxs5YzzXWDm4bistpwk1RfCypr2yppc3BVUvDXYAtsO7OsSRcbY5bAbfArYicrYu36Ob7Fj297wx8Ncf7JwewScGJSD3S00LjOJa9p0/E1SHlDQWm4rqmHI+LAKbgGsx/y23IMbiQVUos7g2G04yjcOYEObga2InIxQNrc3FjK2MvDtP7DOQYAIvGlcBzYub+WRKNwOJw5oRDvW8Ih4icImDxOHNiX3nHcF0GDwGwZJyvvCG4aZuwB9i31lsMbu/DAXsD9IZS6kEpVQ0FoQvPHlxfaU/jR15peGbuGf3mlhqHKYF95c0dj1MCY5ZV1wUy/uT4dOB2BtykwDmyNw0QOM6EyweS9547L/AKOID7VNwcLcUdf1Jxa3T27MjaDOoZL0m4AXRJ3uZ3Pg69p9fy/pxssVYW6GdxbrvJwjXoUnZh40oTFXrT53q4EXiNtYltkCkTaDoc71v734B9z/ex7WdSXHfxzcBvYsbfKXHlECwAd0H/JZ7MjX6ZDBcy0DPYBmyHbugVe8KbbhsHbZ0AAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'CCPA', 'cookie-notice' ) . '</span></label>
478
- </div>
479
- </div>
480
- <div id="cn_purposes" class="cn-field cn-field-checkbox">
481
- <label>' . __( 'Select the type of of services your website is using', 'cookie-notice' ) . ':</label>
482
- <div class="cn-checkbox-wrapper">
483
- <label for="cn_purposes_functional"><input id="cn_purposes_functional" type="checkbox" name="cn_purposes" value="1" checked><span>' . __( 'I use personalization services on my site​', 'cookie-notice' ) . '</span></label>
484
- <label for="cn_purposes_analytics"><input id="cn_purposes_analytics" type="checkbox" name="cn_purposes" value="2"><span>' . __( 'I collect and analyse information about my website’s traffic', 'cookie-notice' ) . '</span></label>
485
- <label for="cn_purposes_marketing"><input id="cn_purposes_marketing" type="checkbox" name="cn_purposes" value="3"><span>' . __( 'I run targeted ads on my site using, for example, Google Adsense​', 'cookie-notice' ) . '</span></label>
486
- </div>
487
- </div>
488
- <div class="cn-field cn-field-checkbox">
489
- <label class="cn-asterix">' . __( 'Enable Cookie Categories (complies with GDPR Art.32)', 'cookie-notice' ) . '</label>
490
- <div class="cn-checkbox-wrapper">
491
- <label for="cn_customize_consent"><input id="cn_customize_consent" type="checkbox" name="cn_customize_consent" value="1" checked><span>' . __( 'Give your visitors the ability to customize their consent based on cookie purpose categories.', 'cookie-notice' ) . '</span></label>
492
- </div>
493
- </div>
494
- <div class="cn-field cn-field-checkbox">
495
- <label class="cn-asterix">' . __( 'Enable Autoblocking (complies with GDPR Art.7)', 'cookie-notice' ) . '</label>
496
- <div class="cn-checkbox-wrapper">
497
- <label for="cn_autoblocking"><input id="cn_customize_consent" type="checkbox" name="cn_autoblocking" value="1" checked><span>' . __( 'Automatically block 3rd party scripts before user consent.', 'cookie-notice' ) . '</span></label>
498
- </div>
499
- </div>
500
- <div class="cn-small">* ' . __( 'available in Cookie Compliance&trade; only', 'cookie-notice' ) . '</div>
501
- </div>
502
- </div>
503
- <div class="cn-accordion-item cn-form-container cn-collapsed" tabindex="-1">
504
- <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Design', 'cookie-notice' ) . '</button></div>
505
- <div class="cn-accordion-collapse cn-form">
506
- <div class="cn-form-feedback cn-hidden"></div>
507
- <div class="cn-field cn-field-radio-image">
508
- <label>' . __( 'Select your preferred display position', 'cookie-notice' ) . '​:</label>
509
- <div class="cn-radio-image-wrapper">
510
- <label for="cn_position_bottom"><input id="cn_position_bottom" type="radio" name="cn_position" value="bottom" title="' . __( 'Bottom', 'cookie-notice' ) . '" checked><img src="' . plugins_url( '../img/layout-bottom.png', __FILE__ ) . '" width="24" height="24"></label>
511
- <label for="cn_position_top"><input id="cn_position_top" type="radio" name="cn_position" value="top" title="' . __( 'Top', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-top.png', __FILE__ ) . '" width="24" height="24"></label>
512
- <label for="cn_position_left" class="cn-asterix"><input id="cn_position_left" type="radio" name="cn_position" value="left" title="' . __( 'Left', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-left.png', __FILE__ ) . '" width="24" height="24"></label>
513
- <label for="cn_position_right" class="cn-asterix"><input id="cn_position_right" type="radio" name="cn_position" value="right" title="' . __( 'Right', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-right.png', __FILE__ ) . '" width="24" height="24"></label>
514
- <label for="cn_position_center" class="cn-asterix"><input id="cn_position_center" type="radio" name="cn_position" value="center" title="' . __( 'Center', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-center.png', __FILE__ ) . '" width="24" height="24"></label>
515
- </div>
516
- </div>
517
- <div class="cn-field cn-fieldset">
518
- <label>' . __( 'Adjust the banner color scheme', 'cookie-notice' ) . '​:</label>
519
- <div class="cn-checkbox-wrapper cn-color-picker-wrapper">
520
- <label for="cn_color_primary"><input id="cn_color_primary" class="cn-color-picker" type="checkbox" name="cn_color_primary" value="#20c19e"><span>' . __( 'Color of the buttons and interactive elements.', 'cookie-notice' ) . '</span></label>
521
- <label for="cn_color_background"><input id="cn_color_background" class="cn-color-picker" type="checkbox" name="cn_color_background" value="#32323a"><span>' . __( 'Color of the banner background.', 'cookie-notice' ) . '</span></label>
522
- <label for="cn_color_border"><input id="cn_color_border" class="cn-color-picker" type="checkbox" name="cn_color_border" value="#86858b"><span class="cn-asterix">' . __( 'Color of the borders and inactive elements.', 'cookie-notice' ) . '</span></label>
523
- <label for="cn_color_text"><input id="cn_color_text" class="cn-color-picker" type="checkbox" name="cn_color_text" value="#ffffff"><span class="cn-asterix">' . __( 'Color of the body text.', 'cookie-notice' ) . '</span></label>
524
- <label for="cn_color_heading"><input id="cn_color_heading" class="cn-color-picker" type="checkbox" name="cn_color_heading" value="#86858b"><span class="cn-asterix">' . __( 'Color of the heading text.', 'cookie-notice' ) . '</span></label>
525
- <label for="cn_color_button_text"><input id="cn_color_button_text" class="cn-color-picker" type="checkbox" name="cn_color_button_text" value="#ffffff"><span class="cn-asterix">' . __( 'Color of the button text.', 'cookie-notice' ) . '</span></label>
526
- </div>
527
- </div>
528
- <div class="cn-small">* ' . __( 'available in Cookie Compliance&trade; only', 'cookie-notice' ) . '</div>
529
- </div>
530
- </div>
531
- </div>
532
- <div class="cn-field cn-field-submit cn-nav">
533
- <button type="button" class="cn-btn cn-screen-button" data-screen="3"><span class="cn-spinner"></span>' . __( 'Apply Setup', 'cookie-notice' ) . '</button>
534
- </div>';
535
-
536
- $html .= wp_nonce_field( 'cn_api_configure', 'cn_nonce', true, false );
537
-
538
- $html .= '
539
- </form>
540
- </div>';
541
- } elseif ( $screen === 'register' ) {
542
- $html .= '
543
- <div class="cn-sidebar cn-sidebar-left has-loader">
544
- <div class="cn-inner">
545
- <div class="cn-header">
546
- <div class="cn-top-bar">
547
- <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
548
- </div>
549
- </div>
550
- <div class="cn-body">
551
- <h2>' . __( 'Compliance account', 'cookie-notice' ) . '</h2>
552
- <div class="cn-lead">
553
- <p>' . __( 'Create a Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
554
- </div>
555
- <div class="cn-accordion">
556
- <div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
557
- <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Create Account', 'cookie-notice' ) . '</button></div>
558
- <div class="cn-accordion-collapse">
559
- <form class="cn-form" action="" data-action="register">
560
- <div class="cn-form-feedback cn-hidden"></div>
561
- <div class="cn-field cn-field-text">
562
- <input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
563
- </div>
564
- <div class="cn-field cn-field-text">
565
- <input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
566
- </div>
567
- <div class="cn-field cn-field-text">
568
- <input type="password" name="pass2" value="" tabindex="3" autocomplete="off" placeholder="' . __( 'Confirm Password', 'cookie-notice' ) . '">
569
- </div>
570
- <div class="cn-field cn-field-checkbox">
571
- <div class="cn-checkbox-wrapper">
572
- <label for="cn_terms"><input id="cn_terms" type="checkbox" name="terms" value="1"><span>' . sprintf( __( 'I have read and agree to the <a href="%s" target="_blank">Terms of Service', 'cookie-notice' ), 'https://hu-manity.co/cookiecompliance-terms/' ) . '</a></span></label>
573
- </div>
574
- </div>
575
- <div class="cn-field cn-field-submit cn-nav">
576
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Sign Up', 'cookie-notice' ) . '</button>
577
- </div>';
578
-
579
- // get site language
580
- $locale = get_locale();
581
- $locale_code = explode( '_', $locale );
582
-
583
- $html .= '
584
- <input type="hidden" name="language" value="' . $locale_code[0] . '" />';
585
-
586
- $html .= wp_nonce_field( 'cn_api_register', 'cn_nonce', true, false );
587
-
588
- $html .= '
589
- </form>
590
- <p>' . __( 'Already have an account?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="login">' . __( 'Sign in', 'cookie-notice' ). '</a></p>
591
- </div>
592
- </div>';
593
-
594
- $html .= '
595
- <div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
596
- <div class="cn-accordion-header cn-form-header">
597
- <button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
598
- </div>
599
- <form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
600
- <div class="cn-form-feedback cn-hidden"></div>
601
- <div class="cn-field cn-field-radio">
602
- <div class="cn-radio-wrapper cn-plan-wrapper">
603
- <label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
604
- <label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
605
- <label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
606
- </div>
607
- </div>
608
- <div class="cn-field cn-fieldset" id="cn_submit_free">
609
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
610
- </div>
611
- <div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
612
- <div class="cn-field cn-field-radio">
613
- <label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
614
- <div class="cn-radio-wrapper cn-horizontal-wrapper">
615
- <label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
616
- <label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
617
- </div>
618
- </div>
619
- <div class="cn-fieldset" id="cn_payment_method_credit_card">
620
- <input type="hidden" name="payment_nonce" value="" />
621
- <div class="cn-field cn-field-text">
622
- <label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
623
- <div id="cn_card_number"></div>
624
- </div>
625
- <div class="cn-field cn-field-text cn-field-half cn-field-first">
626
- <label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
627
- <div id="cn_expiration_date"></div>
628
- </div>
629
- <div class="cn-field cn-field-text cn-field-half cn-field-last">
630
- <label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
631
- <div id="cn_cvv"></div>
632
- </div>
633
- <div class="cn-field cn-field-submit cn-nav">
634
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
635
- </div>
636
- </div>
637
- <div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
638
- <div id="cn_paypal_button"></div>
639
- </div>
640
- </div>';
641
-
642
- $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
643
-
644
- $html .= '
645
- </form>
646
- </div>';
647
-
648
- $html .= '
649
- </div>
650
- </div>';
651
- } elseif ( $screen === 'login' ) {
652
- $html .= '
653
- <div class="cn-sidebar cn-sidebar-left has-loader">
654
- <div class="cn-inner">
655
- <div class="cn-header">
656
- <div class="cn-top-bar">
657
- <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
658
- </div>
659
- </div>
660
- <div class="cn-body">
661
- <h2>' . __( 'Compliance Sign in', 'cookie-notice' ) . '</h2>
662
- <div class="cn-lead">
663
- <p>' . __( 'Sign in to your existing Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
664
- </div>
665
- <div class="cn-accordion">
666
- <div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
667
- <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Account Login', 'cookie-notice' ) . '</button></div>
668
- <div class="cn-accordion-collapse">
669
- <form class="cn-form" action="" data-action="login">
670
- <div class="cn-form-feedback cn-hidden"></div>
671
- <div class="cn-field cn-field-text">
672
- <input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
673
- </div>
674
- <div class="cn-field cn-field-text">
675
- <input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
676
- </div>
677
- <div class="cn-field cn-field-submit cn-nav">
678
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" ' . /* data-screen="4" */ '><span class="cn-spinner"></span>' . __( 'Sign in', 'cookie-notice' ) . '</button>
679
- </div>';
680
-
681
- // get site language
682
- $locale = get_locale();
683
- $locale_code = explode( '_', $locale );
684
-
685
- $html .= '
686
- <input type="hidden" name="language" value="' . $locale_code[0] . '" />';
687
-
688
- $html .= wp_nonce_field( 'cn_api_login', 'cn_nonce', true, false );
689
-
690
- $html .= '
691
- </form>
692
- <p>' . __( 'Don\'t have an account yet?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="register">' . __( 'Sign up', 'cookie-notice' ) . '</a></p>
693
- </div>
694
- </div>';
695
-
696
- $html .= '
697
- <div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
698
- <div class="cn-accordion-header cn-form-header">
699
- <button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
700
- </div>
701
- <form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
702
- <div class="cn-form-feedback cn-hidden"></div>
703
- <div class="cn-field cn-field-radio">
704
- <div class="cn-radio-wrapper cn-plan-wrapper">
705
- <label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
706
- <label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
707
- <label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
708
- </div>
709
- </div>
710
- <div class="cn-field cn-fieldset" id="cn_submit_free">
711
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
712
- </div>
713
- <div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
714
- <div class="cn-field cn-field-radio">
715
- <label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
716
- <div class="cn-radio-wrapper cn-horizontal-wrapper">
717
- <label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
718
- <label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
719
- </div>
720
- </div>
721
- <div class="cn-fieldset" id="cn_payment_method_credit_card">
722
- <input type="hidden" name="payment_nonce" value="" />
723
- <div class="cn-field cn-field-text">
724
- <label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
725
- <div id="cn_card_number"></div>
726
- </div>
727
- <div class="cn-field cn-field-text cn-field-half cn-field-first">
728
- <label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
729
- <div id="cn_expiration_date"></div>
730
- </div>
731
- <div class="cn-field cn-field-text cn-field-half cn-field-last">
732
- <label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
733
- <div id="cn_cvv"></div>
734
- </div>
735
- <div class="cn-field cn-field-submit cn-nav">
736
- <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
737
- </div>
738
- </div>
739
- <div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
740
- <div id="cn_paypal_button"></div>
741
- </div>
742
- </div>';
743
-
744
- $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
745
-
746
- $html .= '
747
- </form>
748
- </div>
749
- </div>
750
- </div>';
751
- } elseif ( $screen === 'success' ) {
752
- $html .= '
753
- <div class="cn-sidebar cn-sidebar-left has-loader">
754
- <div class="cn-inner">
755
- <div class="cn-header">
756
- <div class="cn-top-bar">
757
- <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
758
- </div>
759
- </div>
760
- <div class="cn-body">
761
- <h2>' . __( 'Success!', 'cookie-notice' ) . '</h2>
762
- <div class="cn-lead"><p><b>' . __( 'You have successfully upgraded your website to Cookie Compliance&trade;', 'cookie-notice' ) . '</b></p><p>' . sprintf( __( 'Go to Cookie Compliance&trade; application now. Or access it anytime from your <a href="%s">Cookie Notice settings page</a>.', 'cookie-notice' ), esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) ) . '</p></div>
763
- </div>';
764
- }
765
-
766
-
767
- $html .= '
768
- <div class="cn-footer">';
769
- /*
770
- switch ( $screen ) {
771
- case 'about':
772
- $html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip Live Setup', 'cookie-notice' ) . '</a>';
773
- break;
774
- case 'success':
775
- $html .= '<a href="' . esc_url( get_dashboard_url() ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'WordPress Dashboard', 'cookie-notice' ) . '</a>';
776
- break;
777
- default:
778
- $html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</a>';
779
- break;
780
- }
781
- */
782
- $html .= '
783
- </div>
784
- </div>
785
- </div>';
786
-
787
- }
788
-
789
- if ( $echo )
790
- echo $html;
791
- else
792
- return $html;
793
-
794
- if ( $is_ajax )
795
- exit();
796
- }
797
  }
1
+ <?php
2
+ // exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) )
4
+ exit;
5
+
6
+ /**
7
+ * Cookie_Notice_Welcome class.
8
+ *
9
+ * @class Cookie_Notice_Welcome
10
+ */
11
+ class Cookie_Notice_Welcome {
12
+
13
+ private $app_login_url = '';
14
+
15
+ public function __construct() {
16
+ // actions
17
+ add_action( 'admin_init', array( $this, 'welcome' ) );
18
+ add_action( 'wp_ajax_cn_welcome_screen', array( $this, 'welcome_screen' ) );
19
+
20
+ $this->app_login_url = 'https://app.hu-manity.co/#/en/cc2/login';
21
+ }
22
+
23
+ /**
24
+ * Load scripts and styles - admin.
25
+ */
26
+ public function admin_enqueue_scripts( $page ) {
27
+ if ( in_array( Cookie_Notice()->get_status(), array( 'active', 'pending' ) ) )
28
+ return;
29
+
30
+ wp_enqueue_style( 'dashicons' );
31
+
32
+ wp_enqueue_style( 'cookie-notice-modaal', plugins_url( '../assets/modaal/css/modaal.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
33
+ wp_enqueue_script( 'cookie-notice-modaal', plugins_url( '../assets/modaal/js/modaal.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
34
+
35
+ wp_enqueue_style( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
36
+
37
+ wp_enqueue_style( 'cookie-notice-microtip', plugins_url( '../assets/microtip/microtip.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
38
+
39
+ wp_enqueue_script( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
40
+ wp_enqueue_script( 'cookie-notice-welcome', plugins_url( '../js/admin-welcome.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-progressbar' ), Cookie_Notice()->defaults['version'] );
41
+ wp_enqueue_script( 'cookie-notice-braintree-client', 'https://js.braintreegateway.com/web/3.71.0/js/client.min.js', array(), null, false );
42
+ wp_enqueue_script( 'cookie-notice-braintree-hostedfields', 'https://js.braintreegateway.com/web/3.71.0/js/hosted-fields.min.js', array(), null, false );
43
+ wp_enqueue_script( 'cookie-notice-braintree-paypal', 'https://js.braintreegateway.com/web/3.71.0/js/paypal-checkout.min.js', array(), null, false );
44
+
45
+ $js_args = array(
46
+ 'ajaxURL' => admin_url( 'admin-ajax.php' ),
47
+ 'nonce' => wp_create_nonce( 'cookie-notice-welcome' ),
48
+ 'initModal' => get_transient( 'cn_show_welcome' ), // welcome modal
49
+ 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ),
50
+ 'statusPassed' => __( 'Passed', 'cookie-notice' ),
51
+ 'statusFailed' => __( 'Failed', 'cookie-notice' ),
52
+ 'complianceStatus' => Cookie_Notice()->get_status(),
53
+ 'complianceFailed' => __( '<em>Compliance Failed!</em>Your website does not achieve minimum viable compliance. <b><a href="#" class="cn-sign-up">Sign up to Cookie Compliance</a></b> to bring your site into compliance with the latest data privacy rules and regulations.', 'cookie-notice' ),
54
+ 'compliancePassed' => __( '<em>Compliance Passed!</em>Congratulations. Your website meets minimum viable compliance.', 'cookie-notice' ),
55
+ 'invalidFields' => __( 'Please fill all the required fields.', 'cookie-notice' )
56
+ );
57
+
58
+ // delete the show modal transient
59
+ delete_transient( 'cn_show_welcome' );
60
+
61
+ wp_localize_script(
62
+ 'cookie-notice-welcome',
63
+ 'cnWelcomeArgs',
64
+ $js_args
65
+ );
66
+
67
+ wp_enqueue_style( 'cookie-notice-welcome', plugins_url( '../css/admin-welcome.css', __FILE__ ) );
68
+ }
69
+
70
+ /**
71
+ * Add one or more classes to the body tag in the dashboard.
72
+ *
73
+ * @param string $classes
74
+ * @return string
75
+ */
76
+ public function admin_body_class( $classes ) {
77
+ if ( isset( $_GET['page'] ) && $_GET['page'] === 'cookie-notice-welcome' )
78
+ $classes .= ' folded';
79
+
80
+ return $classes;
81
+ }
82
+
83
+ /**
84
+ * Send user to the welcome page on first activation.
85
+ *
86
+ * @return void
87
+ */
88
+ public function welcome() {
89
+ global $pagenow;
90
+
91
+ if ( $pagenow != 'admin.php' )
92
+ return;
93
+
94
+ if ( isset( $_GET['page'] ) && $_GET['page'] !== 'cookie-notice' )
95
+ return;
96
+
97
+ // bail if activating from network, or bulk, or within an iFrame
98
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
99
+ return;
100
+
101
+ if ( (isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action']) && (isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'cookie-notice.php' )) )
102
+ return;
103
+
104
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
105
+ add_action( 'admin_footer', array( $this, 'admin_footer' ) );
106
+
107
+ add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
108
+ }
109
+
110
+ /**
111
+ * Welcome modal container.
112
+ */
113
+ public function admin_footer() {
114
+ echo '<button id="cn-modal-trigger" style="display:none;"></button>';
115
+ }
116
+
117
+ /**
118
+ * Output the welcome screen.
119
+ *
120
+ * @return void
121
+ */
122
+ public function welcome_page() {
123
+ // get plugin version
124
+ $plugin_version = substr( Cookie_Notice()->defaults['version'], 0, 3 );
125
+ $screen = ( isset( $_GET['screen'] ) ? (int) $_GET['screen'] : 1 );
126
+
127
+ $this->welcome_screen( $screen );
128
+ }
129
+
130
+ /**
131
+ * Render welcome screen sidebar step.
132
+ *
133
+ * @param int $step
134
+ * @return mixed
135
+ */
136
+ public function welcome_screen( $screen, $echo = true ) {
137
+ global $current_user;
138
+
139
+ if ( ! current_user_can( 'install_plugins' ) )
140
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
141
+
142
+ $sidebars = array( 'about', 'login', 'register', 'configure', 'select_plan', 'success' );
143
+ $steps = array( 1, 2, 3, 4 );
144
+ $screens = array_merge( $sidebars, $steps );
145
+
146
+ $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
147
+ $screen = ! empty( $screen ) && in_array( $screen, $screens ) ? $screen : ( isset( $_REQUEST['screen'] ) && in_array( $_REQUEST['screen'], $screens ) ? $_REQUEST['screen'] : '' );
148
+
149
+ if ( empty( $screen ) )
150
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
151
+
152
+ if ( $is_ajax && ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
153
+ wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
154
+
155
+ // get token data
156
+ $token_data = get_transient( 'cookie_notice_app_token' );
157
+
158
+ // step screens
159
+ if ( in_array( $screen, $steps ) ) {
160
+ $html = '
161
+ <div class="wrap full-width-layout cn-welcome-wrap cn-welcome-step-' . esc_attr( $screen ) . ' has-loader">';
162
+
163
+ if ( $screen == 1 ) {
164
+ $html .= $this->welcome_screen( 'about', false );
165
+
166
+ $html .= '
167
+ <div class="cn-content cn-sidebar-visible">
168
+ <div class="cn-inner">
169
+ <div class="cn-content-full">
170
+ <h1><b>Cookie Compliance&trade;</b></h1>
171
+ <h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
172
+ <div class="cn-lead">
173
+ <p><b>' . __( 'Cookie Compliance is a free web application that enables websites to take a proactive approach to data protection and consent laws.', 'cookie-notice' ) . '</b></p>
174
+ <div class="cn-hero-image">
175
+ <div class="cn-flex-item">
176
+ <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
177
+ </div>
178
+ </div>
179
+ <p>' . __( 'It is the first solution to offer <b>intentional consent</b>, a new consent framework that incorporates the latest guidelines from over 100+ countries, and emerging standards from leading international organizations like the IEEE.', 'cookie-notice' ) . '</p>
180
+ <p>' . __( 'Cookie Notice includes <b>seamless integration</b> with Cookie Compliance to help your site comply with the latest updates to existing consent laws and provide a beautiful, multi-level experience to engage visitors in data privacy decisions.', 'cookie-notice' ) . '</p>
181
+ </div>';
182
+ /*
183
+ <div class="cn-lead">
184
+ <p>' . __( 'Rules and regulations around cookie consent are <b>becoming more strict</b>, and enforcement of violations is rapidly increasing. So far in 2021, companies have paid fines totaling over €18M.', 'cookie-notice' ) . '</p>
185
+ <p>' . __( 'If your website collects visitor data and does not (1) <b>Autoblock</b> cookies, (2) enable visitors to consent by <b>Cookie Category</b>, and/or (3) store <b>Proof-of-Consent</b>, your business is at risk.', 'cookie-notice' ) . '</p>
186
+ <p>' . sprintf( __( 'Cookie Notice %s includes integration with <b>Cookie Compliance&trade;</b> web application that will help your site meet minimum viable compliance based on updates to existing laws (GDPR, CCPA) and introduction of new laws (ePrivacy, PECR).', 'cookie-notice' ), Cookie_Notice()->defaults['version'] ) . '</p>
187
+ </div>
188
+ */
189
+ $html .= '
190
+ <div class="cn-buttons">
191
+ <button type="button" class="cn-btn cn-btn-lg cn-screen-button" data-screen="3"><span class="cn-spinner"></span>' . __( 'Sign up to Cookie Compliance', 'cookie-notice' ) . '</button><br />
192
+ <button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</button>
193
+ </div>
194
+ ';
195
+ /*
196
+ $html .= '
197
+ <div class="cn-hero-image">
198
+ <div class="cn-flex-item">
199
+ <div class="cn-logo-container">
200
+ <img src="' . plugins_url( '../img/cookie-notice-logo-dark.png', __FILE__ ) . '">
201
+ <span class="cn-badge">' . __( 'WP Plugin', 'cookie-notice' ) . '</span>
202
+ </div>
203
+ <img src="' . plugins_url( '../img/screen-notice.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
204
+ <ul>
205
+ <li><span>' . __( 'Customizable notice message', 'cookie-notice' ) . '</span></li>
206
+ <li><span>' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '</span></li>
207
+ <li><span>' . __( 'Multiple cookie expiry options', 'cookie-notice' ) . '</span></li>
208
+ <li><span>' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '</span></li>
209
+ </ul>
210
+ </div>
211
+ <div class="cn-flex-item">
212
+ <img src="//cno0-53eb.kxcdn.com/screen-plus.png" alt="Cookie Notice + Compliance" />
213
+ </div>
214
+ <div class="cn-flex-item">
215
+ <div class="cn-logo-container">
216
+ <img src="' . plugins_url( '../img/cookie-compliance-logo-dark.png', __FILE__ ) . '">
217
+ <span class="cn-badge">' . __( 'Web App', 'cookie-notice' ) . '</span>
218
+ </div>
219
+ <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '"alt="Cookie Compliance dashboard" />
220
+ <ul>
221
+ <li><span>' . __( 'Customizable <b>GDPR & CCPA</b> notice templates', 'cookie-notice' ) . '</span></li>
222
+ <li><span>' . __( '<b>Consent Analytics</b> Dashboard', 'cookie-notice' ) . '</span></li>
223
+ <li><span>' . __( 'Cookie <b>Autoblocking</b> (complies with GDPR Art.7)', 'cookie-notice' ) . '</span></li>
224
+ <li><span>' . __( '<b>Cookie Categories</b> (complies with GDPR Art.32)', 'cookie-notice' ) . '</span></li>
225
+ <li><span>' . __( '<b>Proof-of-Consent</b> Storage (complies with GDPR Art.30)', 'cookie-notice' ) . '</span></li>
226
+ <li><span>' . __( "Link to <b>'Do Not Sell'</b> page (supports CCPA Sec.1798)", 'cookie-notice' ) . '</span></li>
227
+ <li><span>' . __( 'Enhanced design controls and options', 'cookie-notice' ) . '</span></li>
228
+ <li><span>' . __( 'Multiple new banner positions', 'cookie-notice' ) . '</span></li>
229
+ <li><span>' . __( 'Custom language localization', 'cookie-notice' ) . '</span></li>
230
+ </ul>
231
+ </div>
232
+ </div>
233
+ */
234
+
235
+ $html .= '
236
+ </div>
237
+ </div>
238
+ </div>';
239
+
240
+ } elseif ( $screen == 2 ) {
241
+ $html .= $this->welcome_screen( 'configure', false );
242
+
243
+ $html .= '
244
+ <div id="cn_upgrade_iframe" class="cn-content cn-sidebar-visible has-loader cn-loading"><span class="cn-spinner"></span>
245
+ <iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=1' ) . '"></iframe>
246
+ </div>';
247
+ } elseif ( $screen == 3 ) {
248
+ // get options
249
+ $app_config = get_transient( 'cookie_notice_app_config' );
250
+
251
+ $html .= $this->welcome_screen( 'register', false );
252
+
253
+ $html .= '
254
+ <div class="cn-content cn-sidebar-visible">
255
+ <div class="cn-inner">
256
+ <div class="cn-content-full">
257
+ <h1><b>Cookie Compliance&trade;</b></h1>
258
+ <h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
259
+ <div class="cn-lead">
260
+ <p>' . __( 'Take a proactive approach to data protection and consent laws by signing up for Cookie Compliance account. Then select a limited Basic Plan for free or get one of the Professional Plans for unlimited visits, consent storage, languages and customizations.', 'cookie-notice' ) . '</p>
261
+ </div>';
262
+ /*
263
+ <div class="cn-billing-wrapper cn-radio-wrapper">
264
+ <label for="cn_billing_monthly"><input id="cn_billing_monthly" type="radio" name="cn_billing" value="monthly" checked><span><span>' . __( 'Billing Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label><label for="cn_billing_yearly"><input id="cn_billing_yearly" type="radio" name="cn_billing" value="yearly"><span><span>' . __( 'Billing Yearly', 'cookie-notice' ) . '</span> <span class="cn-price-off">(' . __( '15% off', 'cookie-notice' ) . ')</span><span class="cn-plan-overlay"></span></span></label>
265
+ </div>
266
+
267
+ $html .= '
268
+ <div class="cn-hero-image">
269
+ <div class="cn-flex-item">
270
+ <div class="cn-logo-container">
271
+ <img src="' . plugins_url( '../img/cookie-notice-logo-dark.png', __FILE__ ) . '">
272
+ <span class="cn-badge">' . __( 'WP Plugin', 'cookie-notice' ) . '</span>
273
+ </div>
274
+ <img src="' . plugins_url( '../img/screen-notice.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
275
+ <ul class="cn-features-list">
276
+ <li><span>' . __( '<b>Free</b>', 'cookie-notice' ) . '</span></li>
277
+ <li><span>' . __( 'Customizable notice message', 'cookie-notice' ) . '</span></li>
278
+ <li><span>' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '</span></li>
279
+ <li><span>' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '</span></li>
280
+ </ul>
281
+ </div>
282
+ <div class="cn-flex-item">
283
+ <img src="//cno0-53eb.kxcdn.com/screen-plus.png" alt="Cookie Notice + Compliance" />
284
+ </div>
285
+ <div class="cn-flex-item">
286
+ <div class="cn-logo-container">
287
+ <img src="' . plugins_url( '../img/cookie-compliance-logo-dark.png', __FILE__ ) . '">
288
+ <span class="cn-badge">' . __( 'Web App', 'cookie-notice' ) . '</span>
289
+ </div>
290
+ <img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '"alt="Cookie Compliance dashboard" />
291
+ <ul class="cn-features-list">
292
+ <li><span>' . __( '<b>Free plan</b>', 'cookie-notice' ) . '</span></li>
293
+ <li><span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</span></li>
294
+ <li><span>' . __( 'Cookie Autoblocking', 'cookie-notice' ) . '</span></li>
295
+ <li><span>' . __( 'Cookie Categories', 'cookie-notice' ) . '</span></li>
296
+ <li><span>' . __( 'Proof-of-Consent Storage', 'cookie-notice' ) . '</span></li>
297
+ <li><span>' . __( "Link to 'Do Not Sell' page", 'cookie-notice' ) . '</span></li>
298
+ </ul>
299
+ </div>
300
+ </div>';
301
+ */
302
+
303
+ $html .= '
304
+ <h3 class="cn-pricing-select">' . __( 'Compliance Plans', 'cookie-notice' ) . ':</h3>
305
+ <div class="cn-pricing-table">
306
+ <label class="cn-pricing-item" for="cn_pricing_plan_free">
307
+ <input id="cn_pricing_plan_free" type="radio" name="cn_pricing_plan" value="free">
308
+ <div class="cn-pricing-info">
309
+ <div class="cn-pricing-head">
310
+ <h4>' . __( 'Basic', 'cookie-notice' ) . '</h4>
311
+ <span class="cn-plan-pricing"><span class="cn-plan-price">' . __( 'Free', 'cookie-notice' ) . '</span></span>
312
+ </div>
313
+ <div class="cn-pricing-body">
314
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
315
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
316
+ <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>10,000</b> visits', 'cookie-notice' ) . '</p>
317
+ <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>30 days</b> consent storage', 'cookie-notice' ) . '</p>
318
+ <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>1 additional</b> language', 'cookie-notice' ) . '</p>
319
+ <p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>Basic</b> Support', 'cookie-notice' ) . '</p>
320
+ </div>
321
+ <div class="cn-pricing-footer">
322
+ <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
323
+ </div>
324
+ </div>
325
+ </label>
326
+ <label class="cn-pricing-item" for="cn_pricing_plan_monthly">
327
+ <input id="cn_pricing_plan_monthly" type="radio" name="cn_pricing_plan" value="monthly">
328
+ <div class="cn-pricing-info">
329
+ <div class="cn-pricing-head">
330
+ <h4>' . __( 'Professional Monthly', 'cookie-notice' ) . '</h4>
331
+ <span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>14.95</span> / ' . __( 'month', 'cookie-notice' ) . '</span>
332
+ </div>
333
+ <div class="cn-pricing-body">
334
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
335
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
336
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
337
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
338
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
339
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Regular</b> Support', 'cookie-notice' ) . '</p>
340
+ </div>
341
+ <div class="cn-pricing-footer">
342
+ <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
343
+ </div>
344
+ </div>
345
+ </label>
346
+ <label class="cn-pricing-item" for="cn_pricing_plan_yearly">
347
+ <input id="cn_pricing_plan_yearly" type="radio" name="cn_pricing_plan" value="yearly">
348
+ <div class="cn-pricing-info">
349
+ <div class="cn-pricing-head">
350
+ <h4>' . __( 'Professional Yearly', 'cookie-notice' ) . '</h4>
351
+ <span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>149.50</span> / ' . __( 'year', 'cookie-notice' ) . '</span>
352
+ <span class="cn-plan-promo">' . __( 'Best Value', 'cookie-notice' ) . '</span>
353
+ </div>
354
+ <div class="cn-pricing-body">
355
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
356
+ <p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
357
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
358
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
359
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
360
+ <p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Premium</b> Support', 'cookie-notice' ) . '</p>
361
+ </div>
362
+ <div class="cn-pricing-footer">
363
+ <button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
364
+ </div>
365
+ </div>
366
+ </label>
367
+ </div>
368
+ <div class="cn-buttons">
369
+ <button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( "I don’t want to create an account now", 'cookie-notice' ) . '</button>
370
+ </div>';
371
+
372
+
373
+ $html .= '
374
+ </div>
375
+ </div>
376
+ </div>';
377
+
378
+ } elseif ( $screen == 4 ) {
379
+ $html .= $this->welcome_screen( 'success', false );
380
+
381
+ $html .= '
382
+ <div class="cn-content cn-sidebar-visible">
383
+ <div class="cn-inner">
384
+ <div class="cn-content-full">
385
+ <h1><b>' . __( 'Congratulations', 'cookie-notice' ) . '</b></h1>
386
+ <h2>' . __( 'You are now promoting privacy with Hu-manity.co', 'cookie-notice' ) . '</h2>
387
+ <div class="cn-lead">
388
+ <p>' . __( 'Log in to your Cookie Compliance&trade; account and continue configuring your Privacy Experience.', 'cookie-notice' ) . '</p>
389
+ </div>
390
+ <div class="cn-buttons">
391
+ <a href="' . $this->app_login_url . '" class="cn-btn cn-btn-lg" target="_blank">' . __( 'Go to Application', 'cookie-notice' ) . '</a>
392
+ </div>
393
+ </div>
394
+ </div>
395
+ </div>';
396
+ }
397
+
398
+ $html .= '
399
+ </div>';
400
+ // sidebar screens
401
+ } elseif ( in_array( $screen, $sidebars ) ) {
402
+ $html = '';
403
+
404
+ if ( $screen === 'about' ) {
405
+ $theme = wp_get_theme();
406
+
407
+ $html .= '
408
+ <div class="cn-sidebar cn-sidebar-left has-loader">
409
+ <div class="cn-inner">
410
+ <div class="cn-header">
411
+ <div class="cn-top-bar">
412
+ <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
413
+ </div>
414
+ </div>
415
+ <div class="cn-body">
416
+ <h2>' . __( 'Compliance check', 'cookie-notice' ) . '</h2>
417
+ <div class="cn-lead"><p>' . __( 'This is a Compliance Check to determine your site’s compliance with updated data processing and consent rules under GDPR, CCPA and other international data privacy laws.', 'cookie-notice' ) . '</p></div>
418
+ <div id="cn_preview_about">
419
+ <p>' . __( 'Site URL', 'cookie-notice' ) . ': <b>' . home_url() . '</b></p>
420
+ <p>' . __( 'Site Name', 'cookie-notice' ) . ': <b>' . get_bloginfo( 'name' ) . '</b></p>
421
+ </div>
422
+ <div class="cn-compliance-check">
423
+ <div class="cn-progressbar"><div class="cn-progress-label">' . __( 'Checking...', 'cookie-notice' ) . '</div></div>
424
+ <div class="cn-compliance-feedback cn-hidden"></div>
425
+ <div class="cn-compliance-results">
426
+ <div class="cn-compliance-item"><p><span class="cn-compliance-label">' . __( 'Cookie Notice', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Notifies visitors that site uses cookies.', 'cookie-notice' ) . '</span></p></div>
427
+ <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Autoblocking', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Non-essential cookies blocked until consent is registered.', 'cookie-notice' ) . '</span></p></div>
428
+ <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Cookie Categories', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Separate consent requested per purpose of use.', 'cookie-notice' ) . '</span></p></div>
429
+ <div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Proof-of-Consent', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Proof-of-consent stored in secure audit format.', 'cookie-notice' ) . '</span></p></div>
430
+ </div>
431
+ </div>
432
+ ' /* <div id="cn_preview_frame"><img src=" ' . esc_url( $theme->get_screenshot() ) . '" /></div>
433
+ . '<div id="cn_preview_frame"><div id="cn_preview_frame_wrapper"><iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=0' ) . '" scrolling="no" frameborder="0"></iframe></div></div> */ . '
434
+ </div>';
435
+ } elseif ( $screen === 'configure' ) {
436
+ $html .= '
437
+ <div class="cn-sidebar cn-sidebar-left has-loader cn-theme-light">
438
+ <div class="cn-inner">
439
+ <div class="cn-header">
440
+ <div class="cn-top-bar">
441
+ <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
442
+ </div>
443
+ </div>
444
+ <div class="cn-body">
445
+ <h2>' . __( 'Live Setup', 'cookie-notice' ) . '</h2>
446
+ <div class="cn-lead"><p>' . __( 'Configure your Cookie Notice & Compliance design and compliance features through the options below. Click Apply Setup to save the configuration and go to selecting your preferred cookie solution.', 'cookie-notice' ) . '</p></div>
447
+ <form id="cn-form-configure" class="cn-form" action="" data-action="configure">
448
+ <div class="cn-accordion">
449
+ <div class="cn-accordion-item cn-form-container" tabindex="-1">
450
+ <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Compliance', 'cookie-notice' ) . '</button></div>
451
+ <div class="cn-accordion-collapse cn-form">
452
+ <div class="cn-form-feedback cn-hidden"></div>' .
453
+ /*
454
+ <div class="cn-field cn-field-select">
455
+ <label for="cn_location">' . __( 'What is the location of your business/organization?', 'cookie-notice' ) . '​</label>
456
+ <div class="cn-select-wrapper">
457
+ <select id="cn_location" name="cn_location">
458
+ <option value="0">' . __( 'Select location', 'cookie-notice' ) . '</option>';
459
+
460
+ foreach ( Cookie_Notice()->settings->countries as $country_code => $country_name ) {
461
+ $html .= '<option value="' . $country_code . '">' . $country_name . '</option>';
462
+ }
463
+
464
+ $html .= '
465
+ </select>
466
+ </div>
467
+ </div>
468
+ */
469
+ '
470
+ <div id="cn_laws" class="cn-field cn-field-checkbox">
471
+ <label>' . __( 'Select the laws that apply to your business', 'cookie-notice' ) . ':</label>
472
+ <div class="cn-checkbox-image-wrapper">
473
+ <label for="cn_laws_gdpr"><input id="cn_laws_gdpr" type="checkbox" name="cn_laws" value="gdpr" title="' . __( 'GDPR', 'cookie-notice' ) . '" checked><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoge2ZzZGjMBCFmcMet4rjHjlsANQmsGRgZ7BkMGRgZ7DOYMhgnME4A08GdgZ2AujbA41HiD8JEOawXUWVXUjd73WLVqsVBB4F+OlTv3cBciB7Ng4nAV6ADHjnSz6A7bOxPQQIh94Dd43AaSFodgKkFmNOGoHEYvwySw1IgJtFFHJgC6RD4GTJnedF2jQSAUfNqzfgMFFnAnxqOi9CvNc5UwzG1CWaQede03f1Bl6MhZqxz5l0Jot97BKBRH5nc3hLCETyO52qr1LqL4wjxWm5Akd/UMaJfOzdjpUs8xvYyXp8k//RcjA7Mf01MMVdE3IjyxyfvZyMLIVEIuoarGcZJhqOgY14bJITqO8VSd/AqobZy6T2UPUbi5RSH0op9EeW5igiguVAWZ50YxKvhRoZJ4MC/maCr56iKN5GEgi139EYHVailDpqYHMgKYpir5S6a5FIvQGYIuL9B3jjXapFYnUpOgiCIAC2mpcT872+lJ4Ab1hkqfQRuHslIB9wNHa+BYHrHAToOprKJuacJSgPLH+M1HmRtLkDdkqp95aU+tqb09tthcC5No/moeLcybKpMO5KmZbPydLON3HwzagSflQD9BIid/BI4gD2OpaA2DIbBan+8qC9sD5cOxD4FADZWAJir72kkAjE8sxN4FEGF0WRT4xAVtl1/X6sCQCZlpH6wDtHYHbpIFDVUskA+HUSUEqd9eKrB/xqCVQkNmb+X4SAy8fhmEYnEbDGJanKavDCBPoPWJSnsIvk2BvlAbr3RAaEssZPYx6blN2BK2obGFGX/bBf/EsLrm7SlL3J5k73ZMGmVS9MT5Qt8T0rulGhLHViyso3sZ20uvbif1kiKl5tuFSqI/WH+Gq78HUR4dytc7CRS86fLwo078YQQ5HFXKtLEOq3NMP53lVaNpPIcs4Fy0YB9S70LNdXpgGqjW5g3AvNlvgd+DUwb6vZmHT72aY8rtY+WgN4YI5+fh3cFPUNynqz8inUt//V7OpWAnwHNuZvH/IPPeDD9c6V9FUAAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'GDPR', 'cookie-notice' ) . '</span></label>
474
+ <label for="cn_laws_ccpa"><input id="cn_laws_ccpa" type="checkbox" name="cn_laws" value="ccpa" title="' . __( 'CCPA', 'cookie-notice' ) . '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAwCAYAAACScGMWAAACPElEQVRYheXYvXHbMBTAcY7AEbSA79Smskp30QiqkyLaQPQE8Qb2BtEG4QZil3Ry5ZZaAO/vAqANIwSJD1LmXXD3ToVE8sf3hEcQRVEUBXADfE+Mu2LOAVSkj/q/xj0sGVcvEgeUGTAvDlgBP4CD+Vyl4HaZuNa9WRH5JSK4oZT6CZQxuN+ZOBzYqQ9mxSkYmAuzcUqpyoE0InIUkWcng1UoLresWFlrOwCwczLa2EAispczWzvcxs5YzzXWDm4bistpwk1RfCypr2yppc3BVUvDXYAtsO7OsSRcbY5bAbfArYicrYu36Ob7Fj297wx8Ncf7JwewScGJSD3S00LjOJa9p0/E1SHlDQWm4rqmHI+LAKbgGsx/y23IMbiQVUos7g2G04yjcOYEObga2InIxQNrc3FjK2MvDtP7DOQYAIvGlcBzYub+WRKNwOJw5oRDvW8Ih4icImDxOHNiX3nHcF0GDwGwZJyvvCG4aZuwB9i31lsMbu/DAXsD9IZS6kEpVQ0FoQvPHlxfaU/jR15peGbuGf3mlhqHKYF95c0dj1MCY5ZV1wUy/uT4dOB2BtykwDmyNw0QOM6EyweS9547L/AKOID7VNwcLcUdf1Jxa3T27MjaDOoZL0m4AXRJ3uZ3Pg69p9fy/pxssVYW6GdxbrvJwjXoUnZh40oTFXrT53q4EXiNtYltkCkTaDoc71v734B9z/ex7WdSXHfxzcBvYsbfKXHlECwAd0H/JZ7MjX6ZDBcy0DPYBmyHbugVe8KbbhsHbZ0AAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'CCPA', 'cookie-notice' ) . '</span></label>
475
+ </div>
476
+ </div>
477
+ <div id="cn_purposes" class="cn-field cn-field-checkbox">
478
+ <label>' . __( 'Select the type of of services your website is using', 'cookie-notice' ) . ':</label>
479
+ <div class="cn-checkbox-wrapper">
480
+ <label for="cn_purposes_functional"><input id="cn_purposes_functional" type="checkbox" name="cn_purposes" value="1" checked><span>' . __( 'I use personalization services on my site​', 'cookie-notice' ) . '</span></label>
481
+ <label for="cn_purposes_analytics"><input id="cn_purposes_analytics" type="checkbox" name="cn_purposes" value="2"><span>' . __( 'I collect and analyse information about my website’s traffic', 'cookie-notice' ) . '</span></label>
482
+ <label for="cn_purposes_marketing"><input id="cn_purposes_marketing" type="checkbox" name="cn_purposes" value="3"><span>' . __( 'I run targeted ads on my site using, for example, Google Adsense​', 'cookie-notice' ) . '</span></label>
483
+ </div>
484
+ </div>
485
+ <div class="cn-field cn-field-checkbox">
486
+ <label class="cn-asterix">' . __( 'Enable Cookie Categories (complies with GDPR Art.32)', 'cookie-notice' ) . '</label>
487
+ <div class="cn-checkbox-wrapper">
488
+ <label for="cn_customize_consent"><input id="cn_customize_consent" type="checkbox" name="cn_customize_consent" value="1" checked><span>' . __( 'Give your visitors the ability to customize their consent based on cookie purpose categories.', 'cookie-notice' ) . '</span></label>
489
+ </div>
490
+ </div>
491
+ <div class="cn-field cn-field-checkbox">
492
+ <label class="cn-asterix">' . __( 'Enable Autoblocking (complies with GDPR Art.7)', 'cookie-notice' ) . '</label>
493
+ <div class="cn-checkbox-wrapper">
494
+ <label for="cn_autoblocking"><input id="cn_customize_consent" type="checkbox" name="cn_autoblocking" value="1" checked><span>' . __( 'Automatically block 3rd party scripts before user consent.', 'cookie-notice' ) . '</span></label>
495
+ </div>
496
+ </div>
497
+ <div class="cn-small">* ' . __( 'available in Cookie Compliance&trade; only', 'cookie-notice' ) . '</div>
498
+ </div>
499
+ </div>
500
+ <div class="cn-accordion-item cn-form-container cn-collapsed" tabindex="-1">
501
+ <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Design', 'cookie-notice' ) . '</button></div>
502
+ <div class="cn-accordion-collapse cn-form">
503
+ <div class="cn-form-feedback cn-hidden"></div>
504
+ <div class="cn-field cn-field-radio-image">
505
+ <label>' . __( 'Select your preferred display position', 'cookie-notice' ) . '​:</label>
506
+ <div class="cn-radio-image-wrapper">
507
+ <label for="cn_position_bottom"><input id="cn_position_bottom" type="radio" name="cn_position" value="bottom" title="' . __( 'Bottom', 'cookie-notice' ) . '" checked><img src="' . plugins_url( '../img/layout-bottom.png', __FILE__ ) . '" width="24" height="24"></label>
508
+ <label for="cn_position_top"><input id="cn_position_top" type="radio" name="cn_position" value="top" title="' . __( 'Top', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-top.png', __FILE__ ) . '" width="24" height="24"></label>
509
+ <label for="cn_position_left" class="cn-asterix"><input id="cn_position_left" type="radio" name="cn_position" value="left" title="' . __( 'Left', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-left.png', __FILE__ ) . '" width="24" height="24"></label>
510
+ <label for="cn_position_right" class="cn-asterix"><input id="cn_position_right" type="radio" name="cn_position" value="right" title="' . __( 'Right', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-right.png', __FILE__ ) . '" width="24" height="24"></label>
511
+ <label for="cn_position_center" class="cn-asterix"><input id="cn_position_center" type="radio" name="cn_position" value="center" title="' . __( 'Center', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-center.png', __FILE__ ) . '" width="24" height="24"></label>
512
+ </div>
513
+ </div>
514
+ <div class="cn-field cn-fieldset">
515
+ <label>' . __( 'Adjust the banner color scheme', 'cookie-notice' ) . '​:</label>
516
+ <div class="cn-checkbox-wrapper cn-color-picker-wrapper">
517
+ <label for="cn_color_primary"><input id="cn_color_primary" class="cn-color-picker" type="checkbox" name="cn_color_primary" value="#20c19e"><span>' . __( 'Color of the buttons and interactive elements.', 'cookie-notice' ) . '</span></label>
518
+ <label for="cn_color_background"><input id="cn_color_background" class="cn-color-picker" type="checkbox" name="cn_color_background" value="#32323a"><span>' . __( 'Color of the banner background.', 'cookie-notice' ) . '</span></label>
519
+ <label for="cn_color_border"><input id="cn_color_border" class="cn-color-picker" type="checkbox" name="cn_color_border" value="#86858b"><span class="cn-asterix">' . __( 'Color of the borders and inactive elements.', 'cookie-notice' ) . '</span></label>
520
+ <label for="cn_color_text"><input id="cn_color_text" class="cn-color-picker" type="checkbox" name="cn_color_text" value="#ffffff"><span class="cn-asterix">' . __( 'Color of the body text.', 'cookie-notice' ) . '</span></label>
521
+ <label for="cn_color_heading"><input id="cn_color_heading" class="cn-color-picker" type="checkbox" name="cn_color_heading" value="#86858b"><span class="cn-asterix">' . __( 'Color of the heading text.', 'cookie-notice' ) . '</span></label>
522
+ <label for="cn_color_button_text"><input id="cn_color_button_text" class="cn-color-picker" type="checkbox" name="cn_color_button_text" value="#ffffff"><span class="cn-asterix">' . __( 'Color of the button text.', 'cookie-notice' ) . '</span></label>
523
+ </div>
524
+ </div>
525
+ <div class="cn-small">* ' . __( 'available in Cookie Compliance&trade; only', 'cookie-notice' ) . '</div>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ <div class="cn-field cn-field-submit cn-nav">
530
+ <button type="button" class="cn-btn cn-screen-button" data-screen="3"><span class="cn-spinner"></span>' . __( 'Apply Setup', 'cookie-notice' ) . '</button>
531
+ </div>';
532
+
533
+ $html .= wp_nonce_field( 'cn_api_configure', 'cn_nonce', true, false );
534
+
535
+ $html .= '
536
+ </form>
537
+ </div>';
538
+ } elseif ( $screen === 'register' ) {
539
+ $html .= '
540
+ <div class="cn-sidebar cn-sidebar-left has-loader">
541
+ <div class="cn-inner">
542
+ <div class="cn-header">
543
+ <div class="cn-top-bar">
544
+ <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
545
+ </div>
546
+ </div>
547
+ <div class="cn-body">
548
+ <h2>' . __( 'Compliance account', 'cookie-notice' ) . '</h2>
549
+ <div class="cn-lead">
550
+ <p>' . __( 'Create a Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
551
+ </div>
552
+ <div class="cn-accordion">
553
+ <div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
554
+ <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Create Account', 'cookie-notice' ) . '</button></div>
555
+ <div class="cn-accordion-collapse">
556
+ <form class="cn-form" action="" data-action="register">
557
+ <div class="cn-form-feedback cn-hidden"></div>
558
+ <div class="cn-field cn-field-text">
559
+ <input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
560
+ </div>
561
+ <div class="cn-field cn-field-text">
562
+ <input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
563
+ </div>
564
+ <div class="cn-field cn-field-text">
565
+ <input type="password" name="pass2" value="" tabindex="3" autocomplete="off" placeholder="' . __( 'Confirm Password', 'cookie-notice' ) . '">
566
+ </div>
567
+ <div class="cn-field cn-field-checkbox">
568
+ <div class="cn-checkbox-wrapper">
569
+ <label for="cn_terms"><input id="cn_terms" type="checkbox" name="terms" value="1"><span>' . sprintf( __( 'I have read and agree to the <a href="%s" target="_blank">Terms of Service', 'cookie-notice' ), 'https://hu-manity.co/cookiecompliance-terms/' ) . '</a></span></label>
570
+ </div>
571
+ </div>
572
+ <div class="cn-field cn-field-submit cn-nav">
573
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Sign Up', 'cookie-notice' ) . '</button>
574
+ </div>';
575
+
576
+ // get site language
577
+ $locale = get_locale();
578
+ $locale_code = explode( '_', $locale );
579
+
580
+ $html .= '
581
+ <input type="hidden" name="language" value="' . esc_attr( $locale_code[0] ) . '" />';
582
+
583
+ $html .= wp_nonce_field( 'cn_api_register', 'cn_nonce', true, false );
584
+
585
+ $html .= '
586
+ </form>
587
+ <p>' . __( 'Already have an account?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="login">' . __( 'Sign in', 'cookie-notice' ). '</a></p>
588
+ </div>
589
+ </div>';
590
+
591
+ $html .= '
592
+ <div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
593
+ <div class="cn-accordion-header cn-form-header">
594
+ <button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
595
+ </div>
596
+ <form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
597
+ <div class="cn-form-feedback cn-hidden"></div>
598
+ <div class="cn-field cn-field-radio">
599
+ <div class="cn-radio-wrapper cn-plan-wrapper">
600
+ <label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
601
+ <label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
602
+ <label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
603
+ </div>
604
+ </div>
605
+ <div class="cn-field cn-fieldset" id="cn_submit_free">
606
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
607
+ </div>
608
+ <div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
609
+ <div class="cn-field cn-field-radio">
610
+ <label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
611
+ <div class="cn-radio-wrapper cn-horizontal-wrapper">
612
+ <label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
613
+ <label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
614
+ </div>
615
+ </div>
616
+ <div class="cn-fieldset" id="cn_payment_method_credit_card">
617
+ <input type="hidden" name="payment_nonce" value="" />
618
+ <div class="cn-field cn-field-text">
619
+ <label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
620
+ <div id="cn_card_number"></div>
621
+ </div>
622
+ <div class="cn-field cn-field-text cn-field-half cn-field-first">
623
+ <label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
624
+ <div id="cn_expiration_date"></div>
625
+ </div>
626
+ <div class="cn-field cn-field-text cn-field-half cn-field-last">
627
+ <label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
628
+ <div id="cn_cvv"></div>
629
+ </div>
630
+ <div class="cn-field cn-field-submit cn-nav">
631
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
632
+ </div>
633
+ </div>
634
+ <div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
635
+ <div id="cn_paypal_button"></div>
636
+ </div>
637
+ </div>';
638
+
639
+ $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
640
+
641
+ $html .= '
642
+ </form>
643
+ </div>';
644
+
645
+ $html .= '
646
+ </div>
647
+ </div>';
648
+ } elseif ( $screen === 'login' ) {
649
+ $html .= '
650
+ <div class="cn-sidebar cn-sidebar-left has-loader">
651
+ <div class="cn-inner">
652
+ <div class="cn-header">
653
+ <div class="cn-top-bar">
654
+ <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
655
+ </div>
656
+ </div>
657
+ <div class="cn-body">
658
+ <h2>' . __( 'Compliance Sign in', 'cookie-notice' ) . '</h2>
659
+ <div class="cn-lead">
660
+ <p>' . __( 'Sign in to your existing Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
661
+ </div>
662
+ <div class="cn-accordion">
663
+ <div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
664
+ <div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Account Login', 'cookie-notice' ) . '</button></div>
665
+ <div class="cn-accordion-collapse">
666
+ <form class="cn-form" action="" data-action="login">
667
+ <div class="cn-form-feedback cn-hidden"></div>
668
+ <div class="cn-field cn-field-text">
669
+ <input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
670
+ </div>
671
+ <div class="cn-field cn-field-text">
672
+ <input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
673
+ </div>
674
+ <div class="cn-field cn-field-submit cn-nav">
675
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" ' . /* data-screen="4" */ '><span class="cn-spinner"></span>' . __( 'Sign in', 'cookie-notice' ) . '</button>
676
+ </div>';
677
+
678
+ // get site language
679
+ $locale = get_locale();
680
+ $locale_code = explode( '_', $locale );
681
+
682
+ $html .= '
683
+ <input type="hidden" name="language" value="' . esc_attr( $locale_code[0] ) . '" />';
684
+
685
+ $html .= wp_nonce_field( 'cn_api_login', 'cn_nonce', true, false );
686
+
687
+ $html .= '
688
+ </form>
689
+ <p>' . __( 'Don\'t have an account yet?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="register">' . __( 'Sign up', 'cookie-notice' ) . '</a></p>
690
+ </div>
691
+ </div>';
692
+
693
+ $html .= '
694
+ <div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
695
+ <div class="cn-accordion-header cn-form-header">
696
+ <button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
697
+ </div>
698
+ <form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
699
+ <div class="cn-form-feedback cn-hidden"></div>
700
+ <div class="cn-field cn-field-radio">
701
+ <div class="cn-radio-wrapper cn-plan-wrapper">
702
+ <label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
703
+ <label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
704
+ <label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
705
+ </div>
706
+ </div>
707
+ <div class="cn-field cn-fieldset" id="cn_submit_free">
708
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
709
+ </div>
710
+ <div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
711
+ <div class="cn-field cn-field-radio">
712
+ <label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
713
+ <div class="cn-radio-wrapper cn-horizontal-wrapper">
714
+ <label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
715
+ <label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
716
+ </div>
717
+ </div>
718
+ <div class="cn-fieldset" id="cn_payment_method_credit_card">
719
+ <input type="hidden" name="payment_nonce" value="" />
720
+ <div class="cn-field cn-field-text">
721
+ <label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
722
+ <div id="cn_card_number"></div>
723
+ </div>
724
+ <div class="cn-field cn-field-text cn-field-half cn-field-first">
725
+ <label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
726
+ <div id="cn_expiration_date"></div>
727
+ </div>
728
+ <div class="cn-field cn-field-text cn-field-half cn-field-last">
729
+ <label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
730
+ <div id="cn_cvv"></div>
731
+ </div>
732
+ <div class="cn-field cn-field-submit cn-nav">
733
+ <button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
734
+ </div>
735
+ </div>
736
+ <div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
737
+ <div id="cn_paypal_button"></div>
738
+ </div>
739
+ </div>';
740
+
741
+ $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
742
+
743
+ $html .= '
744
+ </form>
745
+ </div>
746
+ </div>
747
+ </div>';
748
+ } elseif ( $screen === 'success' ) {
749
+ $html .= '
750
+ <div class="cn-sidebar cn-sidebar-left has-loader">
751
+ <div class="cn-inner">
752
+ <div class="cn-header">
753
+ <div class="cn-top-bar">
754
+ <div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
755
+ </div>
756
+ </div>
757
+ <div class="cn-body">
758
+ <h2>' . __( 'Success!', 'cookie-notice' ) . '</h2>
759
+ <div class="cn-lead"><p><b>' . __( 'You have successfully upgraded your website to Cookie Compliance&trade;', 'cookie-notice' ) . '</b></p><p>' . sprintf( __( 'Go to Cookie Compliance&trade; application now. Or access it anytime from your <a href="%s">Cookie Notice settings page</a>.', 'cookie-notice' ), esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) ) . '</p></div>
760
+ </div>';
761
+ }
762
+
763
+
764
+ $html .= '
765
+ <div class="cn-footer">';
766
+ /*
767
+ switch ( $screen ) {
768
+ case 'about':
769
+ $html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip Live Setup', 'cookie-notice' ) . '</a>';
770
+ break;
771
+ case 'success':
772
+ $html .= '<a href="' . esc_url( get_dashboard_url() ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'WordPress Dashboard', 'cookie-notice' ) . '</a>';
773
+ break;
774
+ default:
775
+ $html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</a>';
776
+ break;
777
+ }
778
+ */
779
+ $html .= '
780
+ </div>
781
+ </div>
782
+ </div>';
783
+
784
+ }
785
+
786
+ if ( $echo )
787
+ echo $html;
788
+ else
789
+ return $html;
790
+
791
+ if ( $is_ajax )
792
+ exit();
793
+ }
 
 
 
794
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: gdpr, ccpa, cookies, consent, compliance
4
  Requires at least: 4.3
5
  Requires PHP: 5.3
6
  Tested up to: 5.8
7
- Stable tag: 2.1.2
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -58,6 +58,10 @@ No questions yet.
58
 
59
  == Changelog ==
60
 
 
 
 
 
61
  = 2.1.2 =
62
  * Tweak: Improved escaping of button labels
63
 
@@ -324,5 +328,5 @@ Initial release
324
 
325
  == Upgrade Notice ==
326
 
327
- = 2.1.2 =
328
- * Tweak: Improved escaping of button labels
4
  Requires at least: 4.3
5
  Requires PHP: 5.3
6
  Tested up to: 5.8
7
+ Stable tag: 2.1.3
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 2.1.3 =
62
+ * Fix: HTML attributes removed from text strings
63
+ * Tweak: Improved sanitization of options
64
+
65
  = 2.1.2 =
66
  * Tweak: Improved escaping of button labels
67
 
328
 
329
  == Upgrade Notice ==
330
 
331
+ = 2.1.3 =
332
+ * Fix: HTML attributes removed from text strings