iubenda Cookie Solution for GDPR - Version 3.0.3

Version Description

  • Tweak: Prefix array_get with iub_ to avoid break comptability with other plugins
Download this release

Release Info

Developer iubenda
Plugin Icon 128x128 iubenda Cookie Solution for GDPR
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

includes/CookieSolutionGenerator.php CHANGED
@@ -48,7 +48,7 @@ class CookieSolutionGenerator {
48
  ];
49
  $csConfiguration['banner']['closeButtonDisplay'] = false;
50
 
51
- $legislation = array_get($args, 'legislation');
52
 
53
  // If legislation is GDPR or Both
54
  if ($legislation == 'gdpr' || $legislation == 'both'){
@@ -58,19 +58,19 @@ class CookieSolutionGenerator {
58
  $csConfiguration['banner']['listPurposes'] = true;
59
  $csConfiguration['banner']['explicitWithdrawal'] = true;
60
 
61
- $explicit_reject = array_get($args, 'explicit_reject');
62
- if ($explicit_reject || true == array_get($args, 'tcf')) {
63
  $csConfiguration['banner']['rejectButtonDisplay'] = true;
64
  }
65
 
66
- $explicit_accept = array_get($args, 'explicit_accept');
67
- if ($explicit_accept || true == array_get($args, 'tcf')) {
68
  $csConfiguration['banner']['acceptButtonDisplay'] = true;
69
  $csConfiguration['banner']['customizeButtonDisplay'] = true;
70
  }
71
 
72
  // If Require Consent is EU Only
73
- if(array_get($args, 'require_consent') == 'eu_only'){
74
  $csConfiguration['countryDetection'] = true;
75
  $csConfiguration['gdprAppliesGlobally'] = false;
76
  }
@@ -81,7 +81,7 @@ class CookieSolutionGenerator {
81
  $csConfiguration['enableCcpa'] = true;
82
 
83
  // If Require Consent is Worldwide
84
- if(array_get($args, 'require_consent') == 'worldwide'){
85
  $csConfiguration['ccpaApplies'] = true;
86
  }
87
  $afterConfiguration .= '
@@ -92,13 +92,13 @@ class CookieSolutionGenerator {
92
  // If legislation is CCPA
93
  if ($legislation == 'ccpa'){
94
  // If Require Consent is Worldwide
95
- if(array_get($args, 'require_consent') == 'worldwide'){
96
  $csConfiguration['enableGdpr'] = false;
97
  }
98
  }
99
 
100
  // conditions on TCF is enabled
101
- if (($legislation == 'gdpr' || $legislation == 'both') && true == array_get($args, 'tcf')){
102
  $csConfiguration['enableTcf'] = true;
103
  $csConfiguration['banner']['closeButtonRejects'] = true;
104
  $csConfiguration['tcfPurposes']['1'] = true;
@@ -117,9 +117,9 @@ class CookieSolutionGenerator {
117
  <script type="text/javascript" src="//cdn.iubenda.com/cs/tcf/safe-tcf-v2.js"></script>
118
  ';
119
  }
120
- $csConfiguration['banner']['position'] = str_replace('full-', '', array_get($args, 'position'));
121
 
122
- $bannerStyle = array_get($args, 'banner_style');
123
  if ('light' == $bannerStyle) {
124
  $csConfiguration['banner']['style'] = 'light';
125
  $csConfiguration['banner']['textColor'] = '#000000';
@@ -130,7 +130,7 @@ class CookieSolutionGenerator {
130
  $csConfiguration['banner']['style'] = 'dark';
131
  }
132
 
133
- $background_overlay = array_get($args, 'background_overlay');
134
  if ($background_overlay) {
135
  $csConfiguration['banner']['backgroundOverlay'] = true;
136
  }
48
  ];
49
  $csConfiguration['banner']['closeButtonDisplay'] = false;
50
 
51
+ $legislation = iub_array_get($args, 'legislation');
52
 
53
  // If legislation is GDPR or Both
54
  if ($legislation == 'gdpr' || $legislation == 'both'){
58
  $csConfiguration['banner']['listPurposes'] = true;
59
  $csConfiguration['banner']['explicitWithdrawal'] = true;
60
 
61
+ $explicit_reject = iub_array_get($args, 'explicit_reject');
62
+ if ($explicit_reject || true == iub_array_get($args, 'tcf')) {
63
  $csConfiguration['banner']['rejectButtonDisplay'] = true;
64
  }
65
 
66
+ $explicit_accept = iub_array_get($args, 'explicit_accept');
67
+ if ($explicit_accept || true == iub_array_get($args, 'tcf')) {
68
  $csConfiguration['banner']['acceptButtonDisplay'] = true;
69
  $csConfiguration['banner']['customizeButtonDisplay'] = true;
70
  }
71
 
72
  // If Require Consent is EU Only
73
+ if(iub_array_get($args, 'require_consent') == 'eu_only'){
74
  $csConfiguration['countryDetection'] = true;
75
  $csConfiguration['gdprAppliesGlobally'] = false;
76
  }
81
  $csConfiguration['enableCcpa'] = true;
82
 
83
  // If Require Consent is Worldwide
84
+ if(iub_array_get($args, 'require_consent') == 'worldwide'){
85
  $csConfiguration['ccpaApplies'] = true;
86
  }
87
  $afterConfiguration .= '
92
  // If legislation is CCPA
93
  if ($legislation == 'ccpa'){
94
  // If Require Consent is Worldwide
95
+ if(iub_array_get($args, 'require_consent') == 'worldwide'){
96
  $csConfiguration['enableGdpr'] = false;
97
  }
98
  }
99
 
100
  // conditions on TCF is enabled
101
+ if (($legislation == 'gdpr' || $legislation == 'both') && true == iub_array_get($args, 'tcf')){
102
  $csConfiguration['enableTcf'] = true;
103
  $csConfiguration['banner']['closeButtonRejects'] = true;
104
  $csConfiguration['tcfPurposes']['1'] = true;
117
  <script type="text/javascript" src="//cdn.iubenda.com/cs/tcf/safe-tcf-v2.js"></script>
118
  ';
119
  }
120
+ $csConfiguration['banner']['position'] = str_replace('full-', '', iub_array_get($args, 'position'));
121
 
122
+ $bannerStyle = iub_array_get($args, 'banner_style');
123
  if ('light' == $bannerStyle) {
124
  $csConfiguration['banner']['style'] = 'light';
125
  $csConfiguration['banner']['textColor'] = '#000000';
130
  $csConfiguration['banner']['style'] = 'dark';
131
  }
132
 
133
+ $background_overlay = iub_array_get($args, 'background_overlay');
134
  if ($background_overlay) {
135
  $csConfiguration['banner']['backgroundOverlay'] = true;
136
  }
includes/PrivacyPolicyGenerator.php CHANGED
@@ -20,7 +20,7 @@ class PrivacyPolicyGenerator {
20
  return null;
21
  }
22
 
23
- $privacyTitle = $language == 'default' ? __2('Privacy Policy', 'iubenda', $language) : __('Privacy Policy', 'iubenda');
24
 
25
  $ppConfiguration = '
26
  <a href="https://www.iubenda.com/privacy-policy/'.$cookiePolicyId.'" class="iubenda-'.$buttonStyle.' no-brand iubenda-noiframe iubenda-embed iubenda-noiframe " title="'.$privacyTitle.'">'.$privacyTitle.'</a><script type="text/javascript">(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);</script>
20
  return null;
21
  }
22
 
23
+ $privacyTitle = $language == 'default' ? iub__2('Privacy Policy', 'iubenda', $language) : __('Privacy Policy', 'iubenda');
24
 
25
  $ppConfiguration = '
26
  <a href="https://www.iubenda.com/privacy-policy/'.$cookiePolicyId.'" class="iubenda-'.$buttonStyle.' no-brand iubenda-noiframe iubenda-embed iubenda-noiframe " title="'.$privacyTitle.'">'.$privacyTitle.'</a><script type="text/javascript">(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);</script>
includes/ProductHelper.php CHANGED
@@ -14,9 +14,9 @@ class ProductHelper
14
  */
15
  public function get_cs_embed_code_by_lang($lang_id): string
16
  {
17
- $code = array_get(iubenda()->options['cs'], "manual_code_{$lang_id}");
18
  if (!$code) {
19
- $code = array_get(iubenda()->options['cs'], "code_{$lang_id}");
20
  }
21
 
22
  return html_entity_decode(iubenda()->parse_code($code));
@@ -62,7 +62,7 @@ class ProductHelper
62
  */
63
  private function get_embed_code($key, $lang_id): string
64
  {
65
- $code = array_get(iubenda()->options[$key], "code_{$lang_id}");
66
 
67
  return html_entity_decode(iubenda()->parse_code($code));
68
  }
14
  */
15
  public function get_cs_embed_code_by_lang($lang_id): string
16
  {
17
+ $code = iub_array_get(iubenda()->options['cs'], "manual_code_{$lang_id}");
18
  if (!$code) {
19
+ $code = iub_array_get(iubenda()->options['cs'], "code_{$lang_id}");
20
  }
21
 
22
  return html_entity_decode(iubenda()->parse_code($code));
62
  */
63
  private function get_embed_code($key, $lang_id): string
64
  {
65
+ $code = iub_array_get(iubenda()->options[$key], "code_{$lang_id}");
66
 
67
  return html_entity_decode(iubenda()->parse_code($code));
68
  }
includes/QuickGeneratorService.php CHANGED
@@ -73,15 +73,15 @@ class QuickGeneratorService
73
  $privacy_policies = [];
74
  $site_id = null;
75
 
76
- $body = array_get($_POST, 'payload');
77
- $user = array_get($body, 'user');
78
 
79
  $multi_lang = boolval(iubenda()->multilang && !empty(iubenda()->languages));
80
 
81
- foreach (array_get($body, 'privacy_policies', []) ?? [] as $key => $privacy_policy) {
82
  //getting site id to save it into Iubenda global option
83
  if(!$site_id){
84
- $site_id = array_get($privacy_policy, 'site_id');
85
  }
86
 
87
  if($multi_lang){
@@ -90,22 +90,22 @@ class QuickGeneratorService
90
  $privacy_policies[$local_lang_code] = $privacy_policy;
91
 
92
  //getting public id to save it into Iubenda global option default lang
93
- $public_ids[$local_lang_code] = array_get($privacy_policy, 'public_id');
94
  }
95
  }
96
  }else{
97
  $privacy_policies['default'] = $privacy_policy;
98
 
99
  //getting public id to save it into Iubenda global option default lang
100
- $public_ids['default'] = array_get($privacy_policy, 'public_id');
101
  }
102
  }
103
 
104
  $configuration = [
105
- 'website' => array_get($_POST, 'website'),
106
  'user' => [
107
- 'id' => array_get($user, 'id'),
108
- 'email' => array_get($user, 'email'),
109
  ],
110
  'privacy_policies' => $privacy_policies,
111
  ];
@@ -124,17 +124,17 @@ class QuickGeneratorService
124
 
125
  public function integrate_setup()
126
  {
127
- if(array_get($_POST, 'cookie_law') == 'on'){
128
  // Saving CS data with CS function
129
  $this->cs_save_options();
130
  }
131
 
132
- if(array_get($_POST, 'privacy_policy') == 'on'){
133
  // Saving PP data with PP function
134
  $this->pp_save_options();
135
  }
136
 
137
- if (array_get($_POST, 'cookie_law') == 'on' || array_get($_POST, 'privacy_policy') == 'on') {
138
  //add notice that`s notice user the integrate has been done successfully
139
  iubenda()->settings->add_notice('iub_integrated_success', __('Our products has been integrated successfully, now customize all products to increase the compliance rating and make your website fully compliant.', 'iubenda'), 'success');
140
  }
@@ -145,11 +145,11 @@ class QuickGeneratorService
145
 
146
  public function save_public_api_key()
147
  {
148
- if(empty(array_get($_POST, 'public_api_key'))){
149
  echo json_encode(['status' => 'error', 'responseText' => "invalid public API key" ]);
150
  wp_die();
151
  }
152
- update_option('iubenda_consent_solution', ['public_api_key' => array_get($_POST, 'public_api_key')]);
153
 
154
  $iubenda_activated_products = get_option('iubenda_activated_products');
155
  $iubenda_activated_products['iubenda_consent_solution'] = 'true';
@@ -170,16 +170,16 @@ class QuickGeneratorService
170
 
171
  public function add_footer()
172
  {
173
- if(array_get(iubenda()->settings->services, 'pp.status') == 'true' && array_get(iubenda()->options['pp'], 'button_position') == 'automatic'){
174
  echo $this->pp_button();
175
  }
176
- if(array_get(iubenda()->settings->services, 'tc.status') == 'true' && array_get(iubenda()->options['tc'], 'button_position') == 'automatic'){
177
  echo $this->tc_button();
178
  }
179
  }
180
 
181
  public function tc_button_shortcode(){
182
- if ((array_get(iubenda()->settings->services, 'tc.status') == 'true') && (array_get(iubenda()->options['tc'], 'button_position') == 'manual')) {
183
  return $this->tc_button();
184
  }
185
  return "[iub-tc-button]";
@@ -187,16 +187,16 @@ class QuickGeneratorService
187
 
188
  public function tc_button(){
189
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
190
- $code = array_get(iubenda()->options, 'tc.code_'.iubenda()->lang_current) ?? null;
191
  } else {
192
- $code = array_get(iubenda()->options, 'tc.code_default') ?? null;
193
  }
194
 
195
  return $code;
196
  }
197
 
198
  public function pp_button_shortcode(){
199
- if (array_get(iubenda()->settings->services, 'pp.status') == 'true' && array_get(iubenda()->options['pp'], 'button_position') != 'automatic') {
200
  return $this->pp_button();
201
  }
202
  return "[iub-pp-button]";
@@ -206,19 +206,19 @@ class QuickGeneratorService
206
  $privacy_policy_generator = new PrivacyPolicyGenerator();
207
 
208
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
209
- $code = array_get(iubenda()->options, 'pp.code_'.iubenda()->lang_current) ?? null;
210
  } else {
211
- $code = array_get(iubenda()->options, 'pp.code_default') ?? null;
212
  }
213
 
214
  if (!$code){
215
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
216
- $public_id = array_get(iubenda()->options['global_options'], 'public_ids.'.iubenda()->lang_current);
217
  } else {
218
- $public_id = array_get(iubenda()->options['global_options'], 'public_ids.default');
219
  }
220
 
221
- $code = $privacy_policy_generator->handle('default', $public_id, array_get(iubenda()->options, 'pp.button_style'));
222
  }
223
 
224
  return $code;
@@ -226,8 +226,8 @@ class QuickGeneratorService
226
 
227
  public function ajax_save_options()
228
  {
229
- $iubenda_section_name = array_get($_POST, 'iubenda_section_name');
230
- $iubenda_section_key = array_get($_POST, 'iubenda_section_key');
231
 
232
  // If section == CS save by CS function
233
  if($iubenda_section_key == 'cs'){
@@ -237,7 +237,7 @@ class QuickGeneratorService
237
  $codes_statues = [];
238
  $global_options = iubenda()->options['global_options'];
239
 
240
- $section_new_option = array_get($_POST, $iubenda_section_name);
241
  $old_section_options = iubenda()->options[$iubenda_section_key];
242
 
243
  if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
@@ -247,7 +247,7 @@ class QuickGeneratorService
247
 
248
  if ($parsed_code) {
249
  $codes_statues["{$iubenda_section_name}_codes"][] = true;
250
- $global_options['public_ids'][substr($index, 5)] = array_get($parsed_code, 'cookie_policy_id');
251
  }else{
252
  $codes_statues["{$iubenda_section_name}_codes"][] = false;
253
  }
@@ -265,7 +265,7 @@ class QuickGeneratorService
265
  // Privacy policy Button
266
  if($iubenda_section_name == 'iubenda_privacy_policy_solution') {
267
  // Add a widget in the sidebar if the button is positioned automatically
268
- if('automatic' === array_get($section_new_option, 'button_position')){
269
  do_action('iubenda_assign_widget_to_first_sidebar');
270
  }
271
 
@@ -280,7 +280,7 @@ class QuickGeneratorService
280
  // Terms and conditions Button
281
  if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
282
  // Add a widget in the sidebar if the button is positioned automatically
283
- if('automatic' === array_get($section_new_option, 'button_position')){
284
  do_action('iubenda_assign_widget_to_first_sidebar');
285
  }
286
 
@@ -312,8 +312,8 @@ class QuickGeneratorService
312
 
313
  private function prepare_custom_scripts_iframes($data, $flag ) {
314
  return array_combine(
315
- array_get($data, $flag),
316
- array_get($data, 'type')
317
  );
318
  }
319
 
@@ -340,7 +340,7 @@ class QuickGeneratorService
340
  }
341
 
342
  $new_options = [];
343
- $button_style = array_get($options, 'button_style');
344
 
345
  foreach($options as $key => $index){
346
  $new_options[$key] = $index;
@@ -348,7 +348,7 @@ class QuickGeneratorService
348
  if(substr( $key, 0, 5 ) === "code_"){
349
  if($service == 'pp'){
350
  // Get public_id for this language
351
- $public_id = array_get(iubenda()->options['global_options'], "public_ids.".substr( $key, 5 ), false) ?: false;
352
 
353
  if ((!$index || empty($index)) && $public_id) {
354
  $index = $privacy_policy_generator->handle(substr( $key, 5 ), $public_id, iubenda()->options['pp']);
@@ -373,7 +373,7 @@ class QuickGeneratorService
373
 
374
  $codes_statues = [];
375
  $site_id = null;
376
- $new_cs_option = array_get($_POST, 'iubenda_cookie_law_solution');
377
 
378
  if (!$default_options) {
379
  //CS plugin general options
@@ -384,12 +384,12 @@ class QuickGeneratorService
384
  $new_cs_option['output_feed'] = (bool)isset($new_cs_option['output_feed']);
385
  $new_cs_option['output_post'] = (bool)isset($new_cs_option['output_post']);
386
  $new_cs_option['menu_position'] = isset($new_cs_option['menu_position']) && in_array($new_cs_option['menu_position'], ['topmenu', 'submenu']) ? $new_cs_option['menu_position'] : iubenda()->defaults['cs']['menu_position'];
387
- $new_cs_option['amp_support'] = array_get($new_cs_option, 'amp_support', false) ?: false;
388
  $new_cs_option['deactivation'] = (bool)isset($new_cs_option['deactivation']);
389
  }
390
 
391
  if(isset($new_cs_option['custom_scripts'])){
392
- $new_cs_option['custom_scripts'] = $this->prepare_custom_scripts_iframes( array_get($new_cs_option, 'custom_scripts'), 'script');
393
 
394
  // Set all selected values Int to not break compatibility with old version
395
  $new_cs_option['custom_scripts'] = array_map('intval' , $new_cs_option['custom_scripts']);
@@ -398,7 +398,7 @@ class QuickGeneratorService
398
  }
399
 
400
  if(isset($new_cs_option['custom_iframes'])){
401
- $new_cs_option['custom_iframes'] = $this->prepare_custom_scripts_iframes( array_get($new_cs_option, 'custom_iframes'), 'iframe');
402
 
403
  // Set all selected values Int to not break compatibility with old version
404
  $new_cs_option['custom_iframes'] = array_map('intval' , $new_cs_option['custom_iframes']);
@@ -406,25 +406,25 @@ class QuickGeneratorService
406
  $new_cs_option['custom_iframes'] = [];
407
  }
408
 
409
- if ('simplified' === array_get($new_cs_option, 'configuration_type')) {
410
  // Check explicit accept & reject forced on if TCF is on
411
- if(true == array_get($new_cs_option, 'simplified.tcf')){
412
  $new_cs_option['simplified']['explicit_accept'] = 'on';
413
  $new_cs_option['simplified']['explicit_reject'] = 'on';
414
  }
415
  $languages = (new ProductHelper())->get_languages();
416
  // loop on iubenda->>language
417
  foreach ($languages as $lang_id => $lang_name) {
418
- $privacy_policy_id = array_get($global_options, "public_ids.{$lang_id}");
419
 
420
  if(!$privacy_policy_id){
421
  continue;
422
  }
423
 
424
- $site_id = array_get(iubenda()->options, 'global_options.site_id') ?: null;
425
 
426
  // Generating CS Simplified code
427
- $cs_embed_code = $iubenda_cookie_solution_generator->handle($lang_id, $site_id, $privacy_policy_id, array_get($new_cs_option, 'simplified'));
428
 
429
  $new_cs_option["code_{$lang_id}"] = $this->stripslashes_deep($cs_embed_code);
430
 
@@ -461,7 +461,7 @@ class QuickGeneratorService
461
  }
462
  }
463
  }
464
- elseif('manual' === array_get($new_cs_option, 'configuration_type')){
465
  foreach($new_cs_option as $index => $option) {
466
  //check code if valid or not
467
  if (substr($index, 0, 5) === "code_" && !empty($option)) {
@@ -477,11 +477,11 @@ class QuickGeneratorService
477
  $codes_statues[substr($index, 5)] = true;
478
 
479
  //getting cookiePolicyId to save it into Iubenda global option
480
- $global_options['public_ids'][substr($index, 5)] = array_get($parsed_code, 'cookiePolicyId');
481
 
482
  //getting site id to save it into Iubenda global option
483
  if(!$site_id){
484
- $site_id = array_get($parsed_code, 'siteId');
485
  }
486
 
487
  // generate amp template file
@@ -561,14 +561,14 @@ class QuickGeneratorService
561
  $privacy_policy_id = null;
562
 
563
  // getting privacy policy id from saved QG response
564
- $privacy_policy_id = array_get($global_options, "public_ids.{$lang_id}");
565
 
566
  if(!$privacy_policy_id){
567
  continue;
568
  }
569
 
570
  // Insert PP Simplified code into options
571
- $pp_embed_code = $privacy_policy_generator->handle($lang_id, $privacy_policy_id, array_get($_POST, 'iubenda_privacy_policy_solution.button_style'));
572
 
573
  $pp_data["code_{$lang_id}"] = $pp_embed_code;
574
 
@@ -577,7 +577,7 @@ class QuickGeneratorService
577
  }
578
 
579
  // Add a widget in the sidebar if the button is positioned automatically
580
- if('automatic' === array_get($_POST, 'iubenda_privacy_policy_solution.button_position')){
581
  do_action('iubenda_assign_widget_to_first_sidebar');
582
  }
583
 
@@ -587,7 +587,7 @@ class QuickGeneratorService
587
  // Set the configured status as true
588
  $pp_data["configured"] = 'true';
589
 
590
- update_option("iubenda_privacy_policy_solution", array_merge($pp_data, array_get($_POST, 'iubenda_privacy_policy_solution')));
591
 
592
  // update only pp make it activated service
593
  iubenda()->options['activated_products']['iubenda_privacy_policy_solution'] = 'true';
73
  $privacy_policies = [];
74
  $site_id = null;
75
 
76
+ $body = iub_array_get($_POST, 'payload');
77
+ $user = iub_array_get($body, 'user');
78
 
79
  $multi_lang = boolval(iubenda()->multilang && !empty(iubenda()->languages));
80
 
81
+ foreach (iub_array_get($body, 'privacy_policies', []) ?? [] as $key => $privacy_policy) {
82
  //getting site id to save it into Iubenda global option
83
  if(!$site_id){
84
+ $site_id = iub_array_get($privacy_policy, 'site_id');
85
  }
86
 
87
  if($multi_lang){
90
  $privacy_policies[$local_lang_code] = $privacy_policy;
91
 
92
  //getting public id to save it into Iubenda global option default lang
93
+ $public_ids[$local_lang_code] = iub_array_get($privacy_policy, 'public_id');
94
  }
95
  }
96
  }else{
97
  $privacy_policies['default'] = $privacy_policy;
98
 
99
  //getting public id to save it into Iubenda global option default lang
100
+ $public_ids['default'] = iub_array_get($privacy_policy, 'public_id');
101
  }
102
  }
103
 
104
  $configuration = [
105
+ 'website' => iub_array_get($_POST, 'website'),
106
  'user' => [
107
+ 'id' => iub_array_get($user, 'id'),
108
+ 'email' => iub_array_get($user, 'email'),
109
  ],
110
  'privacy_policies' => $privacy_policies,
111
  ];
124
 
125
  public function integrate_setup()
126
  {
127
+ if(iub_array_get($_POST, 'cookie_law') == 'on'){
128
  // Saving CS data with CS function
129
  $this->cs_save_options();
130
  }
131
 
132
+ if(iub_array_get($_POST, 'privacy_policy') == 'on'){
133
  // Saving PP data with PP function
134
  $this->pp_save_options();
135
  }
136
 
137
+ if (iub_array_get($_POST, 'cookie_law') == 'on' || iub_array_get($_POST, 'privacy_policy') == 'on') {
138
  //add notice that`s notice user the integrate has been done successfully
139
  iubenda()->settings->add_notice('iub_integrated_success', __('Our products has been integrated successfully, now customize all products to increase the compliance rating and make your website fully compliant.', 'iubenda'), 'success');
140
  }
145
 
146
  public function save_public_api_key()
147
  {
148
+ if(empty(iub_array_get($_POST, 'public_api_key'))){
149
  echo json_encode(['status' => 'error', 'responseText' => "invalid public API key" ]);
150
  wp_die();
151
  }
152
+ update_option('iubenda_consent_solution', ['public_api_key' => iub_array_get($_POST, 'public_api_key')]);
153
 
154
  $iubenda_activated_products = get_option('iubenda_activated_products');
155
  $iubenda_activated_products['iubenda_consent_solution'] = 'true';
170
 
171
  public function add_footer()
172
  {
173
+ if(iub_array_get(iubenda()->settings->services, 'pp.status') == 'true' && iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic'){
174
  echo $this->pp_button();
175
  }
176
+ if(iub_array_get(iubenda()->settings->services, 'tc.status') == 'true' && iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic'){
177
  echo $this->tc_button();
178
  }
179
  }
180
 
181
  public function tc_button_shortcode(){
182
+ if ((iub_array_get(iubenda()->settings->services, 'tc.status') == 'true') && (iub_array_get(iubenda()->options['tc'], 'button_position') == 'manual')) {
183
  return $this->tc_button();
184
  }
185
  return "[iub-tc-button]";
187
 
188
  public function tc_button(){
189
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
190
+ $code = iub_array_get(iubenda()->options, 'tc.code_'.iubenda()->lang_current) ?? null;
191
  } else {
192
+ $code = iub_array_get(iubenda()->options, 'tc.code_default') ?? null;
193
  }
194
 
195
  return $code;
196
  }
197
 
198
  public function pp_button_shortcode(){
199
+ if (iub_array_get(iubenda()->settings->services, 'pp.status') == 'true' && iub_array_get(iubenda()->options['pp'], 'button_position') != 'automatic') {
200
  return $this->pp_button();
201
  }
202
  return "[iub-pp-button]";
206
  $privacy_policy_generator = new PrivacyPolicyGenerator();
207
 
208
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
209
+ $code = iub_array_get(iubenda()->options, 'pp.code_'.iubenda()->lang_current) ?? null;
210
  } else {
211
+ $code = iub_array_get(iubenda()->options, 'pp.code_default') ?? null;
212
  }
213
 
214
  if (!$code){
215
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
216
+ $public_id = iub_array_get(iubenda()->options['global_options'], 'public_ids.'.iubenda()->lang_current);
217
  } else {
218
+ $public_id = iub_array_get(iubenda()->options['global_options'], 'public_ids.default');
219
  }
220
 
221
+ $code = $privacy_policy_generator->handle('default', $public_id, iub_array_get(iubenda()->options, 'pp.button_style'));
222
  }
223
 
224
  return $code;
226
 
227
  public function ajax_save_options()
228
  {
229
+ $iubenda_section_name = iub_array_get($_POST, 'iubenda_section_name');
230
+ $iubenda_section_key = iub_array_get($_POST, 'iubenda_section_key');
231
 
232
  // If section == CS save by CS function
233
  if($iubenda_section_key == 'cs'){
237
  $codes_statues = [];
238
  $global_options = iubenda()->options['global_options'];
239
 
240
+ $section_new_option = iub_array_get($_POST, $iubenda_section_name);
241
  $old_section_options = iubenda()->options[$iubenda_section_key];
242
 
243
  if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
247
 
248
  if ($parsed_code) {
249
  $codes_statues["{$iubenda_section_name}_codes"][] = true;
250
+ $global_options['public_ids'][substr($index, 5)] = iub_array_get($parsed_code, 'cookie_policy_id');
251
  }else{
252
  $codes_statues["{$iubenda_section_name}_codes"][] = false;
253
  }
265
  // Privacy policy Button
266
  if($iubenda_section_name == 'iubenda_privacy_policy_solution') {
267
  // Add a widget in the sidebar if the button is positioned automatically
268
+ if('automatic' === iub_array_get($section_new_option, 'button_position')){
269
  do_action('iubenda_assign_widget_to_first_sidebar');
270
  }
271
 
280
  // Terms and conditions Button
281
  if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
282
  // Add a widget in the sidebar if the button is positioned automatically
283
+ if('automatic' === iub_array_get($section_new_option, 'button_position')){
284
  do_action('iubenda_assign_widget_to_first_sidebar');
285
  }
286
 
312
 
313
  private function prepare_custom_scripts_iframes($data, $flag ) {
314
  return array_combine(
315
+ iub_array_get($data, $flag),
316
+ iub_array_get($data, 'type')
317
  );
318
  }
319
 
340
  }
341
 
342
  $new_options = [];
343
+ $button_style = iub_array_get($options, 'button_style');
344
 
345
  foreach($options as $key => $index){
346
  $new_options[$key] = $index;
348
  if(substr( $key, 0, 5 ) === "code_"){
349
  if($service == 'pp'){
350
  // Get public_id for this language
351
+ $public_id = iub_array_get(iubenda()->options['global_options'], "public_ids.".substr( $key, 5 ), false) ?: false;
352
 
353
  if ((!$index || empty($index)) && $public_id) {
354
  $index = $privacy_policy_generator->handle(substr( $key, 5 ), $public_id, iubenda()->options['pp']);
373
 
374
  $codes_statues = [];
375
  $site_id = null;
376
+ $new_cs_option = iub_array_get($_POST, 'iubenda_cookie_law_solution');
377
 
378
  if (!$default_options) {
379
  //CS plugin general options
384
  $new_cs_option['output_feed'] = (bool)isset($new_cs_option['output_feed']);
385
  $new_cs_option['output_post'] = (bool)isset($new_cs_option['output_post']);
386
  $new_cs_option['menu_position'] = isset($new_cs_option['menu_position']) && in_array($new_cs_option['menu_position'], ['topmenu', 'submenu']) ? $new_cs_option['menu_position'] : iubenda()->defaults['cs']['menu_position'];
387
+ $new_cs_option['amp_support'] = iub_array_get($new_cs_option, 'amp_support', false) ?: false;
388
  $new_cs_option['deactivation'] = (bool)isset($new_cs_option['deactivation']);
389
  }
390
 
391
  if(isset($new_cs_option['custom_scripts'])){
392
+ $new_cs_option['custom_scripts'] = $this->prepare_custom_scripts_iframes( iub_array_get($new_cs_option, 'custom_scripts'), 'script');
393
 
394
  // Set all selected values Int to not break compatibility with old version
395
  $new_cs_option['custom_scripts'] = array_map('intval' , $new_cs_option['custom_scripts']);
398
  }
399
 
400
  if(isset($new_cs_option['custom_iframes'])){
401
+ $new_cs_option['custom_iframes'] = $this->prepare_custom_scripts_iframes( iub_array_get($new_cs_option, 'custom_iframes'), 'iframe');
402
 
403
  // Set all selected values Int to not break compatibility with old version
404
  $new_cs_option['custom_iframes'] = array_map('intval' , $new_cs_option['custom_iframes']);
406
  $new_cs_option['custom_iframes'] = [];
407
  }
408
 
409
+ if ('simplified' === iub_array_get($new_cs_option, 'configuration_type')) {
410
  // Check explicit accept & reject forced on if TCF is on
411
+ if(true == iub_array_get($new_cs_option, 'simplified.tcf')){
412
  $new_cs_option['simplified']['explicit_accept'] = 'on';
413
  $new_cs_option['simplified']['explicit_reject'] = 'on';
414
  }
415
  $languages = (new ProductHelper())->get_languages();
416
  // loop on iubenda->>language
417
  foreach ($languages as $lang_id => $lang_name) {
418
+ $privacy_policy_id = iub_array_get($global_options, "public_ids.{$lang_id}");
419
 
420
  if(!$privacy_policy_id){
421
  continue;
422
  }
423
 
424
+ $site_id = iub_array_get(iubenda()->options, 'global_options.site_id') ?: null;
425
 
426
  // Generating CS Simplified code
427
+ $cs_embed_code = $iubenda_cookie_solution_generator->handle($lang_id, $site_id, $privacy_policy_id, iub_array_get($new_cs_option, 'simplified'));
428
 
429
  $new_cs_option["code_{$lang_id}"] = $this->stripslashes_deep($cs_embed_code);
430
 
461
  }
462
  }
463
  }
464
+ elseif('manual' === iub_array_get($new_cs_option, 'configuration_type')){
465
  foreach($new_cs_option as $index => $option) {
466
  //check code if valid or not
467
  if (substr($index, 0, 5) === "code_" && !empty($option)) {
477
  $codes_statues[substr($index, 5)] = true;
478
 
479
  //getting cookiePolicyId to save it into Iubenda global option
480
+ $global_options['public_ids'][substr($index, 5)] = iub_array_get($parsed_code, 'cookiePolicyId');
481
 
482
  //getting site id to save it into Iubenda global option
483
  if(!$site_id){
484
+ $site_id = iub_array_get($parsed_code, 'siteId');
485
  }
486
 
487
  // generate amp template file
561
  $privacy_policy_id = null;
562
 
563
  // getting privacy policy id from saved QG response
564
+ $privacy_policy_id = iub_array_get($global_options, "public_ids.{$lang_id}");
565
 
566
  if(!$privacy_policy_id){
567
  continue;
568
  }
569
 
570
  // Insert PP Simplified code into options
571
+ $pp_embed_code = $privacy_policy_generator->handle($lang_id, $privacy_policy_id, iub_array_get($_POST, 'iubenda_privacy_policy_solution.button_style'));
572
 
573
  $pp_data["code_{$lang_id}"] = $pp_embed_code;
574
 
577
  }
578
 
579
  // Add a widget in the sidebar if the button is positioned automatically
580
+ if('automatic' === iub_array_get($_POST, 'iubenda_privacy_policy_solution.button_position')){
581
  do_action('iubenda_assign_widget_to_first_sidebar');
582
  }
583
 
587
  // Set the configured status as true
588
  $pp_data["configured"] = 'true';
589
 
590
+ update_option("iubenda_privacy_policy_solution", array_merge($pp_data, iub_array_get($_POST, 'iubenda_privacy_policy_solution')));
591
 
592
  // update only pp make it activated service
593
  iubenda()->options['activated_products']['iubenda_privacy_policy_solution'] = 'true';
includes/RadarService.php CHANGED
@@ -64,13 +64,13 @@ class RadarService {
64
  'body' => ['url' => $website, 'detectLegalDocuments' => 'true'],
65
  ];
66
 
67
- $response = wp_remote_get(array_get($this->url, 'match-async'), $data);
68
  $responseCode = wp_remote_retrieve_response_code($response);
69
 
70
  //check response code
71
  $this->checkResponse($response, $responseCode);
72
 
73
- $body = json_decode(array_get($response, 'body'), true);
74
 
75
  $body['trial_num'] = 1;
76
  $body['next_trial'] = time();
@@ -90,7 +90,7 @@ class RadarService {
90
  $iubendaRadarApiConfiguration = $this->apiConfiguration;
91
 
92
 
93
- if (array_get($iubendaRadarApiConfiguration, 'status') == 'completed') {
94
  if (defined('DOING_AJAX') && DOING_AJAX) {
95
  wp_send_json(['code' => '200', 'status' => 'complete', 'data' => $this->calculate_radar_percentage(),]);
96
  wp_die();
@@ -100,15 +100,15 @@ class RadarService {
100
  }
101
 
102
  // Check if the next trial is not now
103
- if(intval(array_get($iubendaRadarApiConfiguration, 'next_trial')) > time()){
104
- $nextRequestInSec = intval(array_get($iubendaRadarApiConfiguration, 'next_trial')) - (time());
105
 
106
  wp_send_json(['code' => '200', 'status' => 'timeout', 'data' => $nextRequestInSec,]);
107
  wp_die();
108
  }
109
 
110
  $nextTrial = time();
111
- $trialNum = intval(array_get($iubendaRadarApiConfiguration, 'trial_num', 1) ?? 1);
112
 
113
  // Check if 3 trials were made in this round
114
  if(is_int($trialNum / 3)){
@@ -117,7 +117,7 @@ class RadarService {
117
  }
118
  $trialNum++;
119
 
120
- $id = array_get($iubendaRadarApiConfiguration, 'id');
121
 
122
  $data = [
123
  'timeout' => 30,
@@ -127,13 +127,13 @@ class RadarService {
127
  'body' => ['id' => $id],
128
  ];
129
 
130
- $response = wp_remote_get(array_get($this->url, 'match-progress'), $data);
131
  $responseCode = wp_remote_retrieve_response_code($response);
132
 
133
  //check response code
134
  $this->checkResponse($response, $responseCode);
135
 
136
- $body = json_decode(array_get($response, 'body'), true);
137
  $body['trial_num'] = $trialNum;
138
  $body['next_trial'] = $nextTrial;
139
 
64
  'body' => ['url' => $website, 'detectLegalDocuments' => 'true'],
65
  ];
66
 
67
+ $response = wp_remote_get(iub_array_get($this->url, 'match-async'), $data);
68
  $responseCode = wp_remote_retrieve_response_code($response);
69
 
70
  //check response code
71
  $this->checkResponse($response, $responseCode);
72
 
73
+ $body = json_decode(iub_array_get($response, 'body'), true);
74
 
75
  $body['trial_num'] = 1;
76
  $body['next_trial'] = time();
90
  $iubendaRadarApiConfiguration = $this->apiConfiguration;
91
 
92
 
93
+ if (iub_array_get($iubendaRadarApiConfiguration, 'status') == 'completed') {
94
  if (defined('DOING_AJAX') && DOING_AJAX) {
95
  wp_send_json(['code' => '200', 'status' => 'complete', 'data' => $this->calculate_radar_percentage(),]);
96
  wp_die();
100
  }
101
 
102
  // Check if the next trial is not now
103
+ if(intval(iub_array_get($iubendaRadarApiConfiguration, 'next_trial')) > time()){
104
+ $nextRequestInSec = intval(iub_array_get($iubendaRadarApiConfiguration, 'next_trial')) - (time());
105
 
106
  wp_send_json(['code' => '200', 'status' => 'timeout', 'data' => $nextRequestInSec,]);
107
  wp_die();
108
  }
109
 
110
  $nextTrial = time();
111
+ $trialNum = intval(iub_array_get($iubendaRadarApiConfiguration, 'trial_num', 1) ?? 1);
112
 
113
  // Check if 3 trials were made in this round
114
  if(is_int($trialNum / 3)){
117
  }
118
  $trialNum++;
119
 
120
+ $id = iub_array_get($iubendaRadarApiConfiguration, 'id');
121
 
122
  $data = [
123
  'timeout' => 30,
127
  'body' => ['id' => $id],
128
  ];
129
 
130
+ $response = wp_remote_get(iub_array_get($this->url, 'match-progress'), $data);
131
  $responseCode = wp_remote_retrieve_response_code($response);
132
 
133
  //check response code
134
  $this->checkResponse($response, $responseCode);
135
 
136
+ $body = json_decode(iub_array_get($response, 'body'), true);
137
  $body['trial_num'] = $trialNum;
138
  $body['next_trial'] = $nextTrial;
139
 
includes/ServiceRating.php CHANGED
@@ -15,7 +15,7 @@ class ServiceRating {
15
  }
16
 
17
  public function isCookieSolutionActivated(){
18
- if(array_get(iubenda()->settings->services, 'cs.status') == 'true'){
19
  return true;
20
  }
21
 
@@ -26,7 +26,7 @@ class ServiceRating {
26
  }
27
 
28
  public function isCookieSolutionConfigured(){
29
- if(array_get(iubenda()->settings->services, 'cs.configured') == 'true'){
30
  return true;
31
  }
32
 
@@ -37,7 +37,7 @@ class ServiceRating {
37
  }
38
 
39
  public function isPrivacyPolicyActivated(){
40
- if(array_get(iubenda()->settings->services, 'pp.status') == 'true'){
41
  return true;
42
  }
43
 
@@ -48,7 +48,7 @@ class ServiceRating {
48
  }
49
 
50
  public function isTermsConditionsActivated(){
51
- if(array_get(iubenda()->settings->services, 'tc.status') == 'true'){
52
  return true;
53
  }
54
 
@@ -59,8 +59,8 @@ class ServiceRating {
59
  }
60
 
61
  private function isServiceInstalledByRadar($service){
62
- if(array_get($this->radarApiConfiguration, 'status') == 'completed'){
63
- return array_get($this->radarApiConfiguration, 'result.meta.'.$service.'_installed');
64
  }
65
  return false;
66
  }
15
  }
16
 
17
  public function isCookieSolutionActivated(){
18
+ if(iub_array_get(iubenda()->settings->services, 'cs.status') == 'true'){
19
  return true;
20
  }
21
 
26
  }
27
 
28
  public function isCookieSolutionConfigured(){
29
+ if(iub_array_get(iubenda()->settings->services, 'cs.configured') == 'true'){
30
  return true;
31
  }
32
 
37
  }
38
 
39
  public function isPrivacyPolicyActivated(){
40
+ if(iub_array_get(iubenda()->settings->services, 'pp.status') == 'true'){
41
  return true;
42
  }
43
 
48
  }
49
 
50
  public function isTermsConditionsActivated(){
51
+ if(iub_array_get(iubenda()->settings->services, 'tc.status') == 'true'){
52
  return true;
53
  }
54
 
59
  }
60
 
61
  private function isServiceInstalledByRadar($service){
62
+ if(iub_array_get($this->radarApiConfiguration, 'status') == 'completed'){
63
+ return iub_array_get($this->radarApiConfiguration, 'result.meta.'.$service.'_installed');
64
  }
65
  return false;
66
  }
includes/forms.php CHANGED
@@ -46,7 +46,7 @@ class iubenda_Forms {
46
  return;
47
  }
48
 
49
- $form_id = $this->array_get( $_POST, 'wpforms.id' );
50
  $form_args = array(
51
  'post_status' => array('mapped'),
52
  'source' => 'wpforms',
@@ -468,7 +468,7 @@ class iubenda_Forms {
468
  // Is multi dimensions array
469
  // Check if the existing form fields is not equal the new form fields
470
  if ( is_array( current( $formdata['form_fields'] ) ) ) {
471
- $new_fields = md5( json_encode( $this->array_dot( $formdata['form_fields'] ) ) ) !== md5( json_encode( $this->array_dot( $exists->form_fields ) ) );
472
  }else{
473
  // check for fields changes
474
  $new_fields = array_merge( array_diff( $formdata['form_fields'], $exists->form_fields ), array_diff( $exists->form_fields, $formdata['form_fields'] ) );
@@ -754,7 +754,7 @@ class iubenda_Forms {
754
 
755
  // Integrate with mailchimp
756
  $mc_integration = get_option( 'mc4wp_integrations' );
757
- if ( is_array( $mc_integration ) && '1' === $this->array_get( $mc_integration, 'woocommerce.enabled' ) ) {
758
  do_action( 'woocommerce_review_order_before_submit' );
759
  }
760
 
@@ -1033,12 +1033,12 @@ class iubenda_Forms {
1033
  *
1034
  * @return array
1035
  */
1036
- public function array_dot( $array, $prepend = '' ) {
1037
  $results = array();
1038
 
1039
  foreach ( $array as $key => $value ) {
1040
  if ( is_array( $value ) && ! empty( $value ) ) {
1041
- $results = array_merge( $results, $this->array_dot( $value, $prepend . $key . '.' ) );
1042
  } else {
1043
  $results[ $prepend . $key ] = $value;
1044
  }
@@ -1108,35 +1108,6 @@ class iubenda_Forms {
1108
  return $args;
1109
  }
1110
 
1111
- private function array_get( $array, $key, $default = null ) {
1112
- $value = $default;
1113
- if ( ! is_array( $array ) ) {
1114
- return $value( $array );
1115
- }
1116
-
1117
- if ( is_null( $key ) ) {
1118
- return $array;
1119
- }
1120
-
1121
- if ( array_key_exists( $key, $array ) ) {
1122
- return $array[ $key ];
1123
- }
1124
-
1125
- if ( strpos( $key, '.' ) === false ) {
1126
- return $array[ $key ] ?: $default;
1127
- }
1128
-
1129
- foreach ( explode( '.', $key ) as $segment ) {
1130
- if ( ( is_array( $array ) || $array instanceof ArrayAccess ) && array_key_exists( $segment, $array ) ) {
1131
- $array = $array[ $segment ];
1132
- } else {
1133
- return $default;
1134
- }
1135
- }
1136
-
1137
- return $array;
1138
- }
1139
-
1140
  /**
1141
  * Prepare data for subject and preferences
1142
  *
@@ -1172,13 +1143,13 @@ class iubenda_Forms {
1172
  $array_key .= '0';
1173
  }
1174
 
1175
- $data[ $key ][ $map_key ] = $this->array_get( $entry, $array_key );
1176
 
1177
  // Special handling for preferences to cast into boolean if the field type is checkbox
1178
  if ( 'preferences' == $key && 'checkbox' == $form->form_fields[ $index ]['type'] ) {
1179
  $wpform_content = wpforms()->form->get( $form->object_id )->post_content;
1180
  $wpform_content = json_decode( $wpform_content, true );
1181
- $choices = $this->array_get( $wpform_content, substr( $array_key, 0, - 2 ) . '.choices' );
1182
 
1183
  $index = null;
1184
  // Check preference field is entered
46
  return;
47
  }
48
 
49
+ $form_id = iub_array_get( $_POST, 'wpforms.id' );
50
  $form_args = array(
51
  'post_status' => array('mapped'),
52
  'source' => 'wpforms',
468
  // Is multi dimensions array
469
  // Check if the existing form fields is not equal the new form fields
470
  if ( is_array( current( $formdata['form_fields'] ) ) ) {
471
+ $new_fields = md5( json_encode( $this->iub_array_dot( $formdata['form_fields'] ) ) ) !== md5( json_encode( $this->iub_array_dot( $exists->form_fields ) ) );
472
  }else{
473
  // check for fields changes
474
  $new_fields = array_merge( array_diff( $formdata['form_fields'], $exists->form_fields ), array_diff( $exists->form_fields, $formdata['form_fields'] ) );
754
 
755
  // Integrate with mailchimp
756
  $mc_integration = get_option( 'mc4wp_integrations' );
757
+ if ( is_array( $mc_integration ) && '1' === iub_array_get( $mc_integration, 'woocommerce.enabled' ) ) {
758
  do_action( 'woocommerce_review_order_before_submit' );
759
  }
760
 
1033
  *
1034
  * @return array
1035
  */
1036
+ public function iub_array_dot( $array, $prepend = '' ) {
1037
  $results = array();
1038
 
1039
  foreach ( $array as $key => $value ) {
1040
  if ( is_array( $value ) && ! empty( $value ) ) {
1041
+ $results = array_merge( $results, $this->iub_array_dot( $value, $prepend . $key . '.' ) );
1042
  } else {
1043
  $results[ $prepend . $key ] = $value;
1044
  }
1108
  return $args;
1109
  }
1110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
  /**
1112
  * Prepare data for subject and preferences
1113
  *
1143
  $array_key .= '0';
1144
  }
1145
 
1146
+ $data[ $key ][ $map_key ] = iub_array_get( $entry, $array_key );
1147
 
1148
  // Special handling for preferences to cast into boolean if the field type is checkbox
1149
  if ( 'preferences' == $key && 'checkbox' == $form->form_fields[ $index ]['type'] ) {
1150
  $wpform_content = wpforms()->form->get( $form->object_id )->post_content;
1151
  $wpform_content = json_decode( $wpform_content, true );
1152
+ $choices = iub_array_get( $wpform_content, substr( $array_key, 0, - 2 ) . '.choices' );
1153
 
1154
  $index = null;
1155
  // Check preference field is entered
includes/settings.php CHANGED
@@ -20,7 +20,7 @@ class iubenda_Settings {
20
 
21
 
22
  public function __construct() {
23
- if(array_get($_GET, 'page') == 'iubenda'){
24
  add_action('admin_head', array( $this, 'iubdena_hide_notices_wp' ));
25
  }
26
 
@@ -105,7 +105,7 @@ class iubenda_Settings {
105
  4 => __( 'Analytics', 'iubenda' ),
106
  5 => __( 'Targeting & Advertising', 'iubenda' )
107
  );
108
- $siteId = array_get(iubenda()->options['global_options'], 'site_id');
109
 
110
  $QG_Response = (new QuickGeneratorService())->QG_Response;
111
 
@@ -129,8 +129,8 @@ class iubenda_Settings {
129
  'amp_support' => 'https://www.iubenda.com/en/help/22135-cookie-solution-amp-wordpress#amp-domain',
130
  'enable_amp_support' => 'https://www.iubenda.com/en/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
131
  'wordpress_support' => 'https://www.iubenda.com/en/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
132
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.en.edit_url', '') ?? '',
133
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.en.setup_url', '') ?? '',
134
  'automatic_block_scripts' => 'https://www.iubenda.com/en/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
135
  ),
136
  'it' => array(
@@ -152,8 +152,8 @@ class iubenda_Settings {
152
  'amp_support' => 'https://www.iubenda.com/it/help/22135-cookie-solution-amp-wordpress#amp-domain',
153
  'enable_amp_support' => 'https://www.iubenda.com/it/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
154
  'wordpress_support' => 'https://www.iubenda.com/it/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
155
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.it.edit_url', '') ?? '',
156
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.it.setup_url', '') ?? '',
157
  'automatic_block_scripts' => 'https://www.iubenda.com/it/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
158
  ),
159
  'de' => array(
@@ -175,8 +175,8 @@ class iubenda_Settings {
175
  'amp_support' => 'https://www.iubenda.com/de/help/22135-cookie-solution-amp-wordpress#amp-domain',
176
  'enable_amp_support' => 'https://www.iubenda.com/de/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
177
  'wordpress_support' => 'https://www.iubenda.com/de/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
178
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.de.edit_url', '') ?? '',
179
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.de.setup_url', '') ?? '',
180
  'automatic_block_scripts' => 'https://www.iubenda.com/de/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
181
  ),
182
  'es' => array(
@@ -198,8 +198,8 @@ class iubenda_Settings {
198
  'amp_support' => 'https://www.iubenda.com/es/help/22135-cookie-solution-amp-wordpress#amp-domain',
199
  'enable_amp_support' => 'https://www.iubenda.com/es/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
200
  'wordpress_support' => 'https://www.iubenda.com/es/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
201
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.es.edit_url', '') ?? '',
202
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.es.setup_url', '') ?? '',
203
  'automatic_block_scripts' => 'https://www.iubenda.com/es/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
204
  ),
205
  'fr' => array(
@@ -221,8 +221,8 @@ class iubenda_Settings {
221
  'amp_support' => 'https://www.iubenda.com/fr/help/22135-cookie-solution-amp-wordpress#amp-domain',
222
  'enable_amp_support' => 'https://www.iubenda.com/fr/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
223
  'wordpress_support' => 'https://www.iubenda.com/fr/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
224
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.fr.edit_url', '') ?? '',
225
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.fr.setup_url', '') ?? '',
226
  'automatic_block_scripts' => 'https://www.iubenda.com/fr/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
227
  ),
228
  'pt-br' => array(
@@ -244,14 +244,14 @@ class iubenda_Settings {
244
  'amp_support' => 'https://www.iubenda.com/pt-br/help/22135-cookie-solution-amp-wordpress#amp-domain',
245
  'enable_amp_support' => 'https://www.iubenda.com/pt-br/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
246
  'wordpress_support' => 'https://www.iubenda.com/pt-br/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
247
- 'privacy_policy_generator_edit' => array_get($QG_Response, 'privacy_policies.pt-br.edit_url', '') ?? '',
248
- 'privacy_policy_generator_setup' => array_get($QG_Response, 'privacy_policies.pt-br.setup_url', '') ?? '',
249
  'automatic_block_scripts' => 'https://www.iubenda.com/pt-br/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
250
  )
251
  );
252
 
253
  foreach ($this->services as $name => $service) {
254
- $this->services[$name]['status'] = array_get(iubenda()->options, "activated_products.{$service['key']}", 'false');
255
  }
256
  $this->quick_generator = get_option(static::IUB_QG_Response) ?: [];
257
 
@@ -327,7 +327,7 @@ class iubenda_Settings {
327
  }elseif(!empty((new QuickGeneratorService())->QG_Response)){
328
  $default = 'integrate-setup';
329
  }
330
- $view = array_get($_GET, 'view', $default);
331
 
332
  switch ($view) {
333
  case "integrate-setup":
@@ -339,19 +339,19 @@ class iubenda_Settings {
339
  case "tc-configuration":
340
  $pageLabels = [['title' => __('Terms and condition', 'iubenda')]];
341
  $key = 'tc';
342
- $service = array_get(iubenda()->settings->services, $key);
343
  require_once IUBENDA_PLUGIN_PATH . 'views/tc-configuration.php';
344
  break;
345
  case "pp-configuration":
346
  $pageLabels = [['title' => __('Privacy and Cookie Policy', 'iubenda')]];
347
  $key = 'pp';
348
- $service = array_get(iubenda()->settings->services, $key);
349
  require_once IUBENDA_PLUGIN_PATH . 'views/pp-configuration.php';
350
  break;
351
  case "cs-configuration":
352
  $pageLabels = [['title' => __('Cookie Solution', 'iubenda')]];
353
  $key = 'cs';
354
- $service = array_get(iubenda()->settings->services, $key);
355
  require_once IUBENDA_PLUGIN_PATH . 'views/cs-configuration.php';
356
  break;
357
  case "cons-configuration":
@@ -395,7 +395,7 @@ class iubenda_Settings {
395
  // Localize the script with new data
396
  $iub_js_vars = [
397
  'site_url' => get_site_url(),
398
- 'radar_status' => array_get($iubendaRadarApiConfiguration, 'status'),
399
  'form_id' => $_GET['form_id'] ?? 0,
400
  ];
401
  wp_localize_script( 'iubenda-admin', 'iub_js_vars', $iub_js_vars );
@@ -473,20 +473,20 @@ class iubenda_Settings {
473
  $result = $this->init_prepare_product_options($products, $data);
474
 
475
  // Validate whether the product (CS) is active or not
476
- $iubenda_cookie_law_solution_status = array_get($result, 'iubenda_activated_products.iubenda_cookie_law_solution', 'false') ?: 'false';
477
  if($iubenda_cookie_law_solution_status != 'true'){
478
  echo json_encode(['status' => 'error', 'responseText' => "( CS ) must be activated."]);
479
  wp_die();
480
  }
481
 
482
  // validating Embed Codes of product contains at least one valid code if the product is activated
483
- foreach (array_get($result, 'iubenda_activated_products', []) ?: [] as $product_name => $product_status) {
484
  if($product_status == 'false' || $product_name == 'iubenda_consent_solution'){
485
  continue;
486
  }
487
 
488
  // Count valid codes per $product_name and return error if doesn't have at least 1 valid code
489
- if(count(array_filter(array_get($result, "codes_statues.{$product_name}_codes", []) ?: [])) == 0){
490
  echo json_encode(['status' => 'error', 'responseText' => "( {$product_name} ) At least one code must be valid."]);
491
  wp_die();
492
  }
@@ -502,8 +502,8 @@ class iubenda_Settings {
502
  }
503
 
504
  public function toggle_services(){
505
- $name = array_get($_POST, 'name');
506
- $status = array_get($_POST, 'status');
507
 
508
  if($status != 'true'){
509
  $status = 'false';
@@ -983,25 +983,25 @@ class iubenda_Settings {
983
 
984
  private function services_option() {
985
  $cs_settings = [];
986
- if(array_get(iubenda()->options['cs'], 'configuration_type') == 'simplified'){
987
- $legislation = array_get(iubenda()->options['cs'], 'simplified.legislation') == 'both' ? 'GDPR/CCPA' : strtoupper(array_get(iubenda()->options['cs'], 'simplified.legislation'));
988
  $cs_settings = [
989
- ['label' => __('Style', 'iubenda'), 'value' => ucwords(array_get(iubenda()->options['cs'], 'simplified.banner_style'))],
990
- ['label' => __('Position', 'iubenda'), 'value' => ucwords(array_get(iubenda()->options['cs'], 'simplified.position'))],
991
  ['label' => __('legislation', 'iubenda'), 'value' => $legislation],
992
  ];
993
  }else{
994
  $languages = (new ProductHelper())->get_languages();
995
  foreach ($languages as $k => $v) {
996
- $code = array_get(iubenda()->options['cs'], "code_{$k}");
997
  if($code){
998
  $banner = iubenda()->parse_configuration($code, ['mode' => 'banner']);
999
  $options = iubenda()->parse_configuration($code);
1000
 
1001
- $style = array_get($banner, 'backgroundColor') ? 'White' : 'Dark';
1002
- if(array_get($options, 'enableGdpr') === null && array_get($options, 'ccpaApplies') == 1){
1003
  $legislation = 'GDPR/CCPA';
1004
- }elseif(array_get($options, 'enableGdpr') === null){
1005
  $legislation = 'GDPR';
1006
  }else{
1007
  $legislation = 'CCPA';
@@ -1009,7 +1009,7 @@ class iubenda_Settings {
1009
 
1010
  $cs_settings = [
1011
  ['label' => __('Style', 'iubenda'), 'value' => $style],
1012
- ['label' => __('Position', 'iubenda'), 'value' => ucwords(array_get($banner, 'position'))],
1013
  ['label' => __('legislation', 'iubenda'), 'value' => $legislation],
1014
  ];
1015
  break;
@@ -1021,19 +1021,19 @@ class iubenda_Settings {
1021
  return [
1022
  'pp' => [
1023
  'status' => false,
1024
- 'configured' => array_get(iubenda()->options['pp'], 'configured'),
1025
  'label' => __('Privacy and Cookie Policy', 'iubenda'),
1026
  'name' => 'privacy_policy',
1027
  'key' => 'iubenda_privacy_policy_solution',
1028
  'settings' => [
1029
- ['label' => __('Version', 'iubenda'), 'value' => array_get(iubenda()->options['pp'], 'version')],
1030
- ['label' => __('Style', 'iubenda'), 'value' => array_get(iubenda()->options['pp'], 'button_style')],
1031
- ['label' => __('Position', 'iubenda'), 'value' => array_get(iubenda()->options['pp'], 'button_position')]
1032
  ]
1033
  ],
1034
  'cs' => [
1035
  'status' => false,
1036
- 'configured' => array_get(iubenda()->options['cs'], 'configured'),
1037
  'label' => __('Cookie Solution', 'iubenda'),
1038
  'name' => 'cookie_law',
1039
  'key' => 'iubenda_cookie_law_solution',
@@ -1041,19 +1041,19 @@ class iubenda_Settings {
1041
  ],
1042
  'tc' => [
1043
  'status' => false,
1044
- 'configured' => array_get(iubenda()->options['tc'], 'configured'),
1045
  'label' => __('Terms and Conditions', 'iubenda'),
1046
  'name' => 'terms_conditions',
1047
  'key' => 'iubenda_terms_conditions_solution',
1048
  'settings' => [
1049
  ['label' => __('Version', 'iubenda'), 'value' => '1.5.0'],
1050
- ['label' => __('Style', 'iubenda'), 'value' => array_get(iubenda()->options['tc'], 'button_style')],
1051
- ['label' => __('Position', 'iubenda'), 'value' => array_get(iubenda()->options['tc'], 'button_position')]
1052
  ]
1053
  ],
1054
  'cons' => [
1055
  'status' => false,
1056
- 'configured' => array_get(iubenda()->options['cons'], 'configured'),
1057
  'label' => __('Consent Solution', 'iubenda'),
1058
  'name' => 'consent',
1059
  'key' => 'iubenda_consent_solution',
@@ -1138,15 +1138,15 @@ class iubenda_Settings {
1138
  foreach ($products as $product_name => $product_key) {
1139
  $product_option = [];
1140
 
1141
- if(array_get($data, "{$product_name}_status") && array_get($data, "{$product_name}_status") == 'true'){
1142
  $result['iubenda_activated_products'][$product_name] = 'true';
1143
  $product_option['configured'] = 'true';
1144
 
1145
  // Check if product is CONS
1146
  if ($product_key == 'cons') {
1147
  // iubenda_consent_solution saving data
1148
- if(array_get($data, "{$product_name}.public_api_key") ?: null){
1149
- $product_option = ['public_api_key' => array_get($data, "{$product_name}.public_api_key")];
1150
  }else{
1151
  $result['iubenda_activated_products'][$product_name] = 'false';
1152
  }
@@ -1156,7 +1156,7 @@ class iubenda_Settings {
1156
  if (in_array($product_key, ['pp', 'cs', 'tc'])) {
1157
  $languages = (new ProductHelper())->get_languages();
1158
  foreach ( $languages as $lang_id => $lang_name ) {
1159
- $code = array_get($data, "{$product_name}.code_{$lang_id}");
1160
 
1161
  //check if code is empty or code is invalid
1162
  $result['codes_statues']["{$product_name}_codes"][] = $this->check_embed_code("code_{$lang_id}", $code , $product_name);
@@ -1164,12 +1164,12 @@ class iubenda_Settings {
1164
  //get public_id & site_id if only the product key is CS and had a valid embed code
1165
  if ($product_key == 'cs' && $parsed_code = iubenda()->parse_configuration(stripslashes_deep($code))) {
1166
  //getting site id to save it into Iubenda global option
1167
- if (!array_get($result, 'site_id') ?: null) {
1168
- $result['site_id'] = array_get($parsed_code, 'siteId');
1169
  }
1170
 
1171
  //getting public id to save it into Iubenda global option by lang
1172
- $result['public_ids'][$lang_id] = (array_get($parsed_code, 'cookiePolicyId') ?: null);
1173
  }
1174
 
1175
  if (in_array($product_key, ['pp', 'tc'])) {
@@ -1177,8 +1177,8 @@ class iubenda_Settings {
1177
 
1178
  //getting public id to save it into Iubenda global option lang
1179
  if ($parsed_code) {
1180
- $result['public_ids'][$lang_id] = array_get($parsed_code, 'cookie_policy_id');
1181
- $product_option['button_style'] = array_get($parsed_code, 'button_style');
1182
  }
1183
 
1184
  //to make tc/pp button appear in footer by default
@@ -1218,12 +1218,12 @@ class iubenda_Settings {
1218
  {
1219
  // Getting product option to save it
1220
  foreach ($products as $product_name => $product_key) {
1221
- $product_status = array_get($result, "iubenda_activated_products.{$product_name}", 'false') ?: 'false';
1222
  if($product_status == 'false'){
1223
  continue;
1224
  }
1225
 
1226
- $product_option = array_get($result, "products_option.{$product_key}", []) ?: [];
1227
 
1228
  // Merging old $product_name options with new options
1229
  update_option( $product_name, array_merge(iubenda()->options[$product_key] ?: [], $product_option));
@@ -1232,7 +1232,7 @@ class iubenda_Settings {
1232
  iubenda()->options[$product_key] = array_merge(iubenda()->options[$product_key] ?: [], $product_option);
1233
  }
1234
 
1235
- update_option( 'iubenda_activated_products', array_get($result, 'iubenda_activated_products', []) ?: [] );
1236
- update_option( 'iubenda_global_options', ['site_id' => array_get($result, 'site_id', '') ?: '', 'public_ids' => array_get($result, 'public_ids', []) ?: []] );
1237
  }
1238
  }
20
 
21
 
22
  public function __construct() {
23
+ if(iub_array_get($_GET, 'page') == 'iubenda'){
24
  add_action('admin_head', array( $this, 'iubdena_hide_notices_wp' ));
25
  }
26
 
105
  4 => __( 'Analytics', 'iubenda' ),
106
  5 => __( 'Targeting & Advertising', 'iubenda' )
107
  );
108
+ $siteId = iub_array_get(iubenda()->options['global_options'], 'site_id');
109
 
110
  $QG_Response = (new QuickGeneratorService())->QG_Response;
111
 
129
  'amp_support' => 'https://www.iubenda.com/en/help/22135-cookie-solution-amp-wordpress#amp-domain',
130
  'enable_amp_support' => 'https://www.iubenda.com/en/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
131
  'wordpress_support' => 'https://www.iubenda.com/en/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
132
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.en.edit_url', '') ?? '',
133
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.en.setup_url', '') ?? '',
134
  'automatic_block_scripts' => 'https://www.iubenda.com/en/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
135
  ),
136
  'it' => array(
152
  'amp_support' => 'https://www.iubenda.com/it/help/22135-cookie-solution-amp-wordpress#amp-domain',
153
  'enable_amp_support' => 'https://www.iubenda.com/it/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
154
  'wordpress_support' => 'https://www.iubenda.com/it/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
155
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.it.edit_url', '') ?? '',
156
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.it.setup_url', '') ?? '',
157
  'automatic_block_scripts' => 'https://www.iubenda.com/it/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
158
  ),
159
  'de' => array(
175
  'amp_support' => 'https://www.iubenda.com/de/help/22135-cookie-solution-amp-wordpress#amp-domain',
176
  'enable_amp_support' => 'https://www.iubenda.com/de/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
177
  'wordpress_support' => 'https://www.iubenda.com/de/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
178
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.de.edit_url', '') ?? '',
179
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.de.setup_url', '') ?? '',
180
  'automatic_block_scripts' => 'https://www.iubenda.com/de/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
181
  ),
182
  'es' => array(
198
  'amp_support' => 'https://www.iubenda.com/es/help/22135-cookie-solution-amp-wordpress#amp-domain',
199
  'enable_amp_support' => 'https://www.iubenda.com/es/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
200
  'wordpress_support' => 'https://www.iubenda.com/es/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
201
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.es.edit_url', '') ?? '',
202
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.es.setup_url', '') ?? '',
203
  'automatic_block_scripts' => 'https://www.iubenda.com/es/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
204
  ),
205
  'fr' => array(
221
  'amp_support' => 'https://www.iubenda.com/fr/help/22135-cookie-solution-amp-wordpress#amp-domain',
222
  'enable_amp_support' => 'https://www.iubenda.com/fr/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
223
  'wordpress_support' => 'https://www.iubenda.com/fr/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
224
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.fr.edit_url', '') ?? '',
225
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.fr.setup_url', '') ?? '',
226
  'automatic_block_scripts' => 'https://www.iubenda.com/fr/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
227
  ),
228
  'pt-br' => array(
244
  'amp_support' => 'https://www.iubenda.com/pt-br/help/22135-cookie-solution-amp-wordpress#amp-domain',
245
  'enable_amp_support' => 'https://www.iubenda.com/pt-br/help/22135-cookie-solution-amp-wordpress#step-2-enable-the-google-amp-support',
246
  'wordpress_support' => 'https://www.iubenda.com/pt-br/help/370-how-to-use-iubenda-privacy-and-cookie-policy-on-a-wordpress-website',
247
+ 'privacy_policy_generator_edit' => iub_array_get($QG_Response, 'privacy_policies.pt-br.edit_url', '') ?? '',
248
+ 'privacy_policy_generator_setup' => iub_array_get($QG_Response, 'privacy_policies.pt-br.setup_url', '') ?? '',
249
  'automatic_block_scripts' => 'https://www.iubenda.com/pt-br/help/1215-cookie-solution-wordpress-plugin-installation-guide#functionality',
250
  )
251
  );
252
 
253
  foreach ($this->services as $name => $service) {
254
+ $this->services[$name]['status'] = iub_array_get(iubenda()->options, "activated_products.{$service['key']}", 'false');
255
  }
256
  $this->quick_generator = get_option(static::IUB_QG_Response) ?: [];
257
 
327
  }elseif(!empty((new QuickGeneratorService())->QG_Response)){
328
  $default = 'integrate-setup';
329
  }
330
+ $view = iub_array_get($_GET, 'view', $default);
331
 
332
  switch ($view) {
333
  case "integrate-setup":
339
  case "tc-configuration":
340
  $pageLabels = [['title' => __('Terms and condition', 'iubenda')]];
341
  $key = 'tc';
342
+ $service = iub_array_get(iubenda()->settings->services, $key);
343
  require_once IUBENDA_PLUGIN_PATH . 'views/tc-configuration.php';
344
  break;
345
  case "pp-configuration":
346
  $pageLabels = [['title' => __('Privacy and Cookie Policy', 'iubenda')]];
347
  $key = 'pp';
348
+ $service = iub_array_get(iubenda()->settings->services, $key);
349
  require_once IUBENDA_PLUGIN_PATH . 'views/pp-configuration.php';
350
  break;
351
  case "cs-configuration":
352
  $pageLabels = [['title' => __('Cookie Solution', 'iubenda')]];
353
  $key = 'cs';
354
+ $service = iub_array_get(iubenda()->settings->services, $key);
355
  require_once IUBENDA_PLUGIN_PATH . 'views/cs-configuration.php';
356
  break;
357
  case "cons-configuration":
395
  // Localize the script with new data
396
  $iub_js_vars = [
397
  'site_url' => get_site_url(),
398
+ 'radar_status' => iub_array_get($iubendaRadarApiConfiguration, 'status'),
399
  'form_id' => $_GET['form_id'] ?? 0,
400
  ];
401
  wp_localize_script( 'iubenda-admin', 'iub_js_vars', $iub_js_vars );
473
  $result = $this->init_prepare_product_options($products, $data);
474
 
475
  // Validate whether the product (CS) is active or not
476
+ $iubenda_cookie_law_solution_status = iub_array_get($result, 'iubenda_activated_products.iubenda_cookie_law_solution', 'false') ?: 'false';
477
  if($iubenda_cookie_law_solution_status != 'true'){
478
  echo json_encode(['status' => 'error', 'responseText' => "( CS ) must be activated."]);
479
  wp_die();
480
  }
481
 
482
  // validating Embed Codes of product contains at least one valid code if the product is activated
483
+ foreach (iub_array_get($result, 'iubenda_activated_products', []) ?: [] as $product_name => $product_status) {
484
  if($product_status == 'false' || $product_name == 'iubenda_consent_solution'){
485
  continue;
486
  }
487
 
488
  // Count valid codes per $product_name and return error if doesn't have at least 1 valid code
489
+ if(count(array_filter(iub_array_get($result, "codes_statues.{$product_name}_codes", []) ?: [])) == 0){
490
  echo json_encode(['status' => 'error', 'responseText' => "( {$product_name} ) At least one code must be valid."]);
491
  wp_die();
492
  }
502
  }
503
 
504
  public function toggle_services(){
505
+ $name = iub_array_get($_POST, 'name');
506
+ $status = iub_array_get($_POST, 'status');
507
 
508
  if($status != 'true'){
509
  $status = 'false';
983
 
984
  private function services_option() {
985
  $cs_settings = [];
986
+ if(iub_array_get(iubenda()->options['cs'], 'configuration_type') == 'simplified'){
987
+ $legislation = iub_array_get(iubenda()->options['cs'], 'simplified.legislation') == 'both' ? 'GDPR/CCPA' : strtoupper(iub_array_get(iubenda()->options['cs'], 'simplified.legislation'));
988
  $cs_settings = [
989
+ ['label' => __('Style', 'iubenda'), 'value' => ucwords(iub_array_get(iubenda()->options['cs'], 'simplified.banner_style'))],
990
+ ['label' => __('Position', 'iubenda'), 'value' => ucwords(iub_array_get(iubenda()->options['cs'], 'simplified.position'))],
991
  ['label' => __('legislation', 'iubenda'), 'value' => $legislation],
992
  ];
993
  }else{
994
  $languages = (new ProductHelper())->get_languages();
995
  foreach ($languages as $k => $v) {
996
+ $code = iub_array_get(iubenda()->options['cs'], "code_{$k}");
997
  if($code){
998
  $banner = iubenda()->parse_configuration($code, ['mode' => 'banner']);
999
  $options = iubenda()->parse_configuration($code);
1000
 
1001
+ $style = iub_array_get($banner, 'backgroundColor') ? 'White' : 'Dark';
1002
+ if(iub_array_get($options, 'enableGdpr') === null && iub_array_get($options, 'ccpaApplies') == 1){
1003
  $legislation = 'GDPR/CCPA';
1004
+ }elseif(iub_array_get($options, 'enableGdpr') === null){
1005
  $legislation = 'GDPR';
1006
  }else{
1007
  $legislation = 'CCPA';
1009
 
1010
  $cs_settings = [
1011
  ['label' => __('Style', 'iubenda'), 'value' => $style],
1012
+ ['label' => __('Position', 'iubenda'), 'value' => ucwords(iub_array_get($banner, 'position'))],
1013
  ['label' => __('legislation', 'iubenda'), 'value' => $legislation],
1014
  ];
1015
  break;
1021
  return [
1022
  'pp' => [
1023
  'status' => false,
1024
+ 'configured' => iub_array_get(iubenda()->options['pp'], 'configured'),
1025
  'label' => __('Privacy and Cookie Policy', 'iubenda'),
1026
  'name' => 'privacy_policy',
1027
  'key' => 'iubenda_privacy_policy_solution',
1028
  'settings' => [
1029
+ ['label' => __('Version', 'iubenda'), 'value' => iub_array_get(iubenda()->options['pp'], 'version')],
1030
+ ['label' => __('Style', 'iubenda'), 'value' => iub_array_get(iubenda()->options['pp'], 'button_style')],
1031
+ ['label' => __('Position', 'iubenda'), 'value' => iub_array_get(iubenda()->options['pp'], 'button_position')]
1032
  ]
1033
  ],
1034
  'cs' => [
1035
  'status' => false,
1036
+ 'configured' => iub_array_get(iubenda()->options['cs'], 'configured'),
1037
  'label' => __('Cookie Solution', 'iubenda'),
1038
  'name' => 'cookie_law',
1039
  'key' => 'iubenda_cookie_law_solution',
1041
  ],
1042
  'tc' => [
1043
  'status' => false,
1044
+ 'configured' => iub_array_get(iubenda()->options['tc'], 'configured'),
1045
  'label' => __('Terms and Conditions', 'iubenda'),
1046
  'name' => 'terms_conditions',
1047
  'key' => 'iubenda_terms_conditions_solution',
1048
  'settings' => [
1049
  ['label' => __('Version', 'iubenda'), 'value' => '1.5.0'],
1050
+ ['label' => __('Style', 'iubenda'), 'value' => iub_array_get(iubenda()->options['tc'], 'button_style')],
1051
+ ['label' => __('Position', 'iubenda'), 'value' => iub_array_get(iubenda()->options['tc'], 'button_position')]
1052
  ]
1053
  ],
1054
  'cons' => [
1055
  'status' => false,
1056
+ 'configured' => iub_array_get(iubenda()->options['cons'], 'configured'),
1057
  'label' => __('Consent Solution', 'iubenda'),
1058
  'name' => 'consent',
1059
  'key' => 'iubenda_consent_solution',
1138
  foreach ($products as $product_name => $product_key) {
1139
  $product_option = [];
1140
 
1141
+ if(iub_array_get($data, "{$product_name}_status") && iub_array_get($data, "{$product_name}_status") == 'true'){
1142
  $result['iubenda_activated_products'][$product_name] = 'true';
1143
  $product_option['configured'] = 'true';
1144
 
1145
  // Check if product is CONS
1146
  if ($product_key == 'cons') {
1147
  // iubenda_consent_solution saving data
1148
+ if(iub_array_get($data, "{$product_name}.public_api_key") ?: null){
1149
+ $product_option = ['public_api_key' => iub_array_get($data, "{$product_name}.public_api_key")];
1150
  }else{
1151
  $result['iubenda_activated_products'][$product_name] = 'false';
1152
  }
1156
  if (in_array($product_key, ['pp', 'cs', 'tc'])) {
1157
  $languages = (new ProductHelper())->get_languages();
1158
  foreach ( $languages as $lang_id => $lang_name ) {
1159
+ $code = iub_array_get($data, "{$product_name}.code_{$lang_id}");
1160
 
1161
  //check if code is empty or code is invalid
1162
  $result['codes_statues']["{$product_name}_codes"][] = $this->check_embed_code("code_{$lang_id}", $code , $product_name);
1164
  //get public_id & site_id if only the product key is CS and had a valid embed code
1165
  if ($product_key == 'cs' && $parsed_code = iubenda()->parse_configuration(stripslashes_deep($code))) {
1166
  //getting site id to save it into Iubenda global option
1167
+ if (!iub_array_get($result, 'site_id') ?: null) {
1168
+ $result['site_id'] = iub_array_get($parsed_code, 'siteId');
1169
  }
1170
 
1171
  //getting public id to save it into Iubenda global option by lang
1172
+ $result['public_ids'][$lang_id] = (iub_array_get($parsed_code, 'cookiePolicyId') ?: null);
1173
  }
1174
 
1175
  if (in_array($product_key, ['pp', 'tc'])) {
1177
 
1178
  //getting public id to save it into Iubenda global option lang
1179
  if ($parsed_code) {
1180
+ $result['public_ids'][$lang_id] = iub_array_get($parsed_code, 'cookie_policy_id');
1181
+ $product_option['button_style'] = iub_array_get($parsed_code, 'button_style');
1182
  }
1183
 
1184
  //to make tc/pp button appear in footer by default
1218
  {
1219
  // Getting product option to save it
1220
  foreach ($products as $product_name => $product_key) {
1221
+ $product_status = iub_array_get($result, "iubenda_activated_products.{$product_name}", 'false') ?: 'false';
1222
  if($product_status == 'false'){
1223
  continue;
1224
  }
1225
 
1226
+ $product_option = iub_array_get($result, "products_option.{$product_key}", []) ?: [];
1227
 
1228
  // Merging old $product_name options with new options
1229
  update_option( $product_name, array_merge(iubenda()->options[$product_key] ?: [], $product_option));
1232
  iubenda()->options[$product_key] = array_merge(iubenda()->options[$product_key] ?: [], $product_option);
1233
  }
1234
 
1235
+ update_option( 'iubenda_activated_products', iub_array_get($result, 'iubenda_activated_products', []) ?: [] );
1236
+ update_option( 'iubenda_global_options', ['site_id' => iub_array_get($result, 'site_id', '') ?: '', 'public_ids' => iub_array_get($result, 'public_ids', []) ?: []] );
1237
  }
1238
  }
includes/widget/IubendaLegalWidget.php CHANGED
@@ -108,11 +108,11 @@ class IubendaLegalWidget extends WP_Widget
108
  // Creating widget front-end
109
  public function widget($args, $instance)
110
  {
111
- $ppStatus = array_get(iubenda()->settings->services, 'pp.status') == 'true';
112
- $ppPosition = array_get(iubenda()->options['pp'], 'button_position') == 'automatic';
113
 
114
- $tcStatus = array_get(iubenda()->settings->services, 'tc.status') == 'true';
115
- $tcPosition = array_get(iubenda()->options['tc'], 'button_position') == 'automatic';
116
 
117
  // Checking if there is no public id for current language
118
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
@@ -121,7 +121,7 @@ class IubendaLegalWidget extends WP_Widget
121
  $lang_id = 'default';
122
  }
123
 
124
- $public_id = array_get(iubenda()->options['global_options'], "public_ids.{$lang_id}", false) ?: false;
125
 
126
  // Return false if there is no public id for current language
127
  if (!($public_id)) {
@@ -133,7 +133,7 @@ class IubendaLegalWidget extends WP_Widget
133
  return false;
134
  }
135
 
136
- $title = apply_filters('widget_title', array_get($instance, 'title') ?? 'Legal');
137
 
138
  // before and after widget arguments are defined by themes
139
  echo $args['before_widget'];
@@ -202,7 +202,7 @@ class IubendaLegalWidget extends WP_Widget
202
  }
203
 
204
  // If sidebar-1 not registered or not activated
205
- if (!array_get($wp_registered_sidebars, 'sidebar-1')) {
206
  return;
207
  }
208
 
108
  // Creating widget front-end
109
  public function widget($args, $instance)
110
  {
111
+ $ppStatus = iub_array_get(iubenda()->settings->services, 'pp.status') == 'true';
112
+ $ppPosition = iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic';
113
 
114
+ $tcStatus = iub_array_get(iubenda()->settings->services, 'tc.status') == 'true';
115
+ $tcPosition = iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic';
116
 
117
  // Checking if there is no public id for current language
118
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
121
  $lang_id = 'default';
122
  }
123
 
124
+ $public_id = iub_array_get(iubenda()->options['global_options'], "public_ids.{$lang_id}", false) ?: false;
125
 
126
  // Return false if there is no public id for current language
127
  if (!($public_id)) {
133
  return false;
134
  }
135
 
136
+ $title = apply_filters('widget_title', iub_array_get($instance, 'title') ?? 'Legal');
137
 
138
  // before and after widget arguments are defined by themes
139
  echo $args['before_widget'];
202
  }
203
 
204
  // If sidebar-1 not registered or not activated
205
+ if (!iub_array_get($wp_registered_sidebars, 'sidebar-1')) {
206
  return;
207
  }
208
 
iubenda_cookie_solution.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
4
  Plugin URI: https://www.iubenda.com
5
  Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
6
- Version: 3.0.2
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
@@ -34,7 +34,7 @@ define( 'IUB_DEBUG', false );
34
  * @property-read iubenda_Settings $settings
35
  *
36
  * @class iubenda
37
- * @version 3.0.1
38
  */
39
  class iubenda {
40
 
@@ -92,7 +92,7 @@ class iubenda {
92
  )
93
  );
94
  public $base_url;
95
- public $version = '3.0.2';
96
  public $activation = array(
97
  'update_version' => 0,
98
  'update_notice' => true,
@@ -314,8 +314,8 @@ class iubenda {
314
  $this->lang_current = $sitepress->get_current_language();
315
  }else{
316
  // if no plugin for multi lang installed
317
- $this->lang_default = array_get(iubenda()->lang_mapping, get_locale(), 'en');
318
- $this->lang_current = array_get(iubenda()->lang_mapping, get_locale());
319
  }
320
 
321
  // load iubenda parser
@@ -453,7 +453,7 @@ class iubenda {
453
  */
454
  public function wp_head_cs() {
455
  // Check if cookie solution service is activated and configured
456
- if(boolval(array_get($this->settings->services, 'cs.status') !== 'true') || boolval(array_get($this->settings->services, 'cs.configured') !== 'true')){
457
  return;
458
  }
459
 
@@ -802,7 +802,7 @@ class iubenda {
802
  update_option( 'iubenda_cookie_law_version', $this->version, 'no' );
803
 
804
  // Version 3.0.0 and above
805
- if ( version_compare( $db_version, '3.0.1', '<' ) ) {
806
  $this->upgrading_to_ver_3_process();
807
  }
808
  }
@@ -900,7 +900,7 @@ class iubenda {
900
  }
901
 
902
  preg_match_all('/<a[^>]+href=([\'"])(?<href>.+?)\1[^>]*>/i', $code, $result);
903
- $url = array_get($result, 'href.0');
904
 
905
  if (!$url) {
906
  return false;
@@ -1103,14 +1103,14 @@ class iubenda {
1103
  $result = $this->settings->init_prepare_product_options($products, $old_data);
1104
 
1105
  // Count valid codes for iubenda cookie law solution codes and set the service inactive
1106
- if(count(array_filter(array_get($result, "codes_statues.iubenda_cookie_law_solution_codes", []) ?: [])) == 0){
1107
  $result['iubenda_activated_products']['iubenda_cookie_law_solution'] = 'false';
1108
  }
1109
 
1110
  $this->settings->save_init_prepared_product_options($products, $result);
1111
 
1112
  // Reload Options and activated products
1113
- iubenda()->options['activated_products'] = array_get($result, 'iubenda_activated_products', []) ?: [];
1114
  $this->settings->load_defaults();
1115
  }
1116
 
@@ -1158,8 +1158,8 @@ class iubenda {
1158
 
1159
  }
1160
 
1161
- if (!function_exists('array_get')) {
1162
- function array_get($array, $key, $default = null) {
1163
  if (!(is_array($array) || $array instanceof ArrayAccess)) {
1164
  return $default instanceof Closure ? $default() : $default;
1165
  }
@@ -1188,14 +1188,14 @@ if (!function_exists('array_get')) {
1188
  }
1189
  }
1190
 
1191
- if (!function_exists('__2')) {
1192
  /**
1193
  * @param $string
1194
  * @param $textDomain
1195
  * @param $locale
1196
  * @return string|void
1197
  */
1198
- function __2($string, $textDomain, $locale): string
1199
  {
1200
  global $l10n;
1201
  if(isset($l10n[$textDomain])) $backup = $l10n[$textDomain];
@@ -1206,19 +1206,6 @@ if (!function_exists('__2')) {
1206
  }
1207
  }
1208
 
1209
- if (!function_exists('_e2')) {
1210
- /**
1211
- * @param $string
1212
- * @param $textDomain
1213
- * @param $locale
1214
- * @return string|void
1215
- */
1216
- function _e2($string, $textDomain, $locale): string
1217
- {
1218
- return __2($string, $textDomain, $locale);
1219
- }
1220
- }
1221
-
1222
  /**
1223
  * add stars in iubenda plugin meta
1224
  */
3
  Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
4
  Plugin URI: https://www.iubenda.com
5
  Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
6
+ Version: 3.0.3
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
34
  * @property-read iubenda_Settings $settings
35
  *
36
  * @class iubenda
37
+ * @version 3.0.3
38
  */
39
  class iubenda {
40
 
92
  )
93
  );
94
  public $base_url;
95
+ public $version = '3.0.3';
96
  public $activation = array(
97
  'update_version' => 0,
98
  'update_notice' => true,
314
  $this->lang_current = $sitepress->get_current_language();
315
  }else{
316
  // if no plugin for multi lang installed
317
+ $this->lang_default = iub_array_get(iubenda()->lang_mapping, get_locale(), 'en');
318
+ $this->lang_current = iub_array_get(iubenda()->lang_mapping, get_locale());
319
  }
320
 
321
  // load iubenda parser
453
  */
454
  public function wp_head_cs() {
455
  // Check if cookie solution service is activated and configured
456
+ if(boolval(iub_array_get($this->settings->services, 'cs.status') !== 'true') || boolval(iub_array_get($this->settings->services, 'cs.configured') !== 'true')){
457
  return;
458
  }
459
 
802
  update_option( 'iubenda_cookie_law_version', $this->version, 'no' );
803
 
804
  // Version 3.0.0 and above
805
+ if ( version_compare( $db_version, '3.0.2', '<' ) ) {
806
  $this->upgrading_to_ver_3_process();
807
  }
808
  }
900
  }
901
 
902
  preg_match_all('/<a[^>]+href=([\'"])(?<href>.+?)\1[^>]*>/i', $code, $result);
903
+ $url = iub_array_get($result, 'href.0');
904
 
905
  if (!$url) {
906
  return false;
1103
  $result = $this->settings->init_prepare_product_options($products, $old_data);
1104
 
1105
  // Count valid codes for iubenda cookie law solution codes and set the service inactive
1106
+ if(count(array_filter(iub_array_get($result, "codes_statues.iubenda_cookie_law_solution_codes", []) ?: [])) == 0){
1107
  $result['iubenda_activated_products']['iubenda_cookie_law_solution'] = 'false';
1108
  }
1109
 
1110
  $this->settings->save_init_prepared_product_options($products, $result);
1111
 
1112
  // Reload Options and activated products
1113
+ iubenda()->options['activated_products'] = iub_array_get($result, 'iubenda_activated_products', []) ?: [];
1114
  $this->settings->load_defaults();
1115
  }
1116
 
1158
 
1159
  }
1160
 
1161
+ if (!function_exists('iub_array_get')) {
1162
+ function iub_array_get($array, $key, $default = null) {
1163
  if (!(is_array($array) || $array instanceof ArrayAccess)) {
1164
  return $default instanceof Closure ? $default() : $default;
1165
  }
1188
  }
1189
  }
1190
 
1191
+ if (!function_exists('iub__2')) {
1192
  /**
1193
  * @param $string
1194
  * @param $textDomain
1195
  * @param $locale
1196
  * @return string|void
1197
  */
1198
+ function iub__2($string, $textDomain, $locale): string
1199
  {
1200
  global $l10n;
1201
  if(isset($l10n[$textDomain])) $backup = $l10n[$textDomain];
1206
  }
1207
  }
1208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1209
  /**
1210
  * add stars in iubenda plugin meta
1211
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: cookie banner, cookie law, eprivacy, gdpr, ukgdpr, ccpa, caloppa, lgpd, ds
5
  Requires at least: 5.0
6
  Requires PHP: 7.0.0
7
  Tested up to: 5.9
8
- Stable tag: 3.0.2
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
@@ -28,7 +28,7 @@ It allows you to:
28
 
29
  And of course, basic set-up is completely free.
30
 
31
- [[video](https://iubenda.wistia.com/medias/iejo0ldhkt)]
32
 
33
 
34
  == Features ==
@@ -242,6 +242,9 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
242
 
243
  == Changelog ==
244
 
 
 
 
245
  = 3.0.2 =
246
  * Bugfix: remove data on plugin deactivation
247
 
@@ -653,5 +656,5 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
653
 
654
  == Upgrade Notice ==
655
 
656
- = 3.0.2 =
657
- * Bugfix: remove data on plugin deactivation
5
  Requires at least: 5.0
6
  Requires PHP: 7.0.0
7
  Tested up to: 5.9
8
+ Stable tag: 3.0.3
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
28
 
29
  And of course, basic set-up is completely free.
30
 
31
+ [youtube https://www.youtube.com/watch?v=ZmUC66etPbk]
32
 
33
 
34
  == Features ==
242
 
243
  == Changelog ==
244
 
245
+ = 3.0.3 =
246
+ * Tweak: Prefix array_get with iub_ to avoid break comptability with other plugins
247
+
248
  = 3.0.2 =
249
  * Bugfix: remove data on plugin deactivation
250
 
656
 
657
  == Upgrade Notice ==
658
 
659
+ = 3.0.3 =
660
+ * Tweak: Prefix array_get with iub_ to avoid break comptability with other plugins
views/cons-configuration.php CHANGED
@@ -26,7 +26,7 @@
26
 
27
  <div class="subOptions">
28
  <div class="paste-api-form" tabindex="0">
29
- <input class="paste-api-input" id="public_api_key" name="iubenda_consent_solution[public_api_key]" type="text" placeholder="<?php _e('Your iubenda Javascript library public API key', 'iubenda'); ?>" value="<?php echo array_get(iubenda()->options['cons'], 'public_api_key') ? array_get(iubenda()->options['cons'], 'public_api_key') : false ?>" required>
30
  <button type="submit" id="public_api_button" class="btn btn-xs btn-green-secondary">
31
  <span class="button__text"><?php _e('Confirm API', 'iubenda') ?></span>
32
  </button>
@@ -37,7 +37,7 @@
37
  <a target="_blank" href="<?php echo iubenda()->settings->links['how_generate_cons']; ?>" class="link link-helper"><span class="tooltip-icon mr-2">?</span><?php _e('Where can I find this code?', 'iubenda') ?></a>
38
  </div>
39
 
40
- <div id="public-api-key-div" class="<?php echo array_get(iubenda()->options['cons'], 'public_api_key') ?: 'hidden'; ?>">
41
  <div class="d-flex align-items-center">
42
  <div class="steps flex-shrink mr-3">3</div>
43
  <p class="text-bold">
26
 
27
  <div class="subOptions">
28
  <div class="paste-api-form" tabindex="0">
29
+ <input class="paste-api-input" id="public_api_key" name="iubenda_consent_solution[public_api_key]" type="text" placeholder="<?php _e('Your iubenda Javascript library public API key', 'iubenda'); ?>" value="<?php echo iub_array_get(iubenda()->options['cons'], 'public_api_key') ? iub_array_get(iubenda()->options['cons'], 'public_api_key') : false ?>" required>
30
  <button type="submit" id="public_api_button" class="btn btn-xs btn-green-secondary">
31
  <span class="button__text"><?php _e('Confirm API', 'iubenda') ?></span>
32
  </button>
37
  <a target="_blank" href="<?php echo iubenda()->settings->links['how_generate_cons']; ?>" class="link link-helper"><span class="tooltip-icon mr-2">?</span><?php _e('Where can I find this code?', 'iubenda') ?></a>
38
  </div>
39
 
40
+ <div id="public-api-key-div" class="<?php echo iub_array_get(iubenda()->options['cons'], 'public_api_key') ?: 'hidden'; ?>">
41
  <div class="d-flex align-items-center">
42
  <div class="steps flex-shrink mr-3">3</div>
43
  <p class="text-bold">
views/integrate-setup.php CHANGED
@@ -55,7 +55,7 @@
55
  // multilang support
56
  if (iubenda()->multilang && !empty(iubenda()->languages)) {
57
  foreach (iubenda()->languages as $lang_id => $lang_name) {
58
- if(!array_get(iubenda()->options['cs']['amp_template_done'], $lang_id, false) ?: false){
59
  continue;
60
  }
61
  ?>
@@ -84,7 +84,7 @@
84
  </div>
85
  <p class="px-3 mx-4"><?php _e('Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly?', 'iubenda') ?> <a target="_blank" href="<?php echo iubenda()->settings->links["amp_support"]; ?>" class="link-underline"><?php _e('Learn how to fix it', 'iubenda') ?></a></p>
86
  </section>
87
- <section id="custom_conf_file" class="text-xs text-gray amp_configuration_file <?php echo array_get(iubenda()->options['cs'], 'amp_source') == 'remote' ?: 'hidden' ?>">
88
  <table class="table">
89
  <tbody>
90
  <?php
@@ -93,7 +93,7 @@
93
  ?>
94
  <tr>
95
  <td><label class="text-bold" for="iub_amp_template-<?php echo $lang_id; ?>"><?php echo $lang_name; ?></label></td>
96
- <td><input id="iub_amp_template-<?php echo $lang_id; ?>" type="text" class="regular-text" name="iubenda_cookie_law_solution[amp_template][<?php echo $lang_id; ?>]" value="<?php echo array_get(iubenda()->options['cs'], "amp_template.{$lang_id}") ?>"/></td>
97
  </tr>
98
  <?php } ?>
99
  </tbody>
55
  // multilang support
56
  if (iubenda()->multilang && !empty(iubenda()->languages)) {
57
  foreach (iubenda()->languages as $lang_id => $lang_name) {
58
+ if(!iub_array_get(iubenda()->options['cs']['amp_template_done'], $lang_id, false) ?: false){
59
  continue;
60
  }
61
  ?>
84
  </div>
85
  <p class="px-3 mx-4"><?php _e('Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly?', 'iubenda') ?> <a target="_blank" href="<?php echo iubenda()->settings->links["amp_support"]; ?>" class="link-underline"><?php _e('Learn how to fix it', 'iubenda') ?></a></p>
86
  </section>
87
+ <section id="custom_conf_file" class="text-xs text-gray amp_configuration_file <?php echo iub_array_get(iubenda()->options['cs'], 'amp_source') == 'remote' ?: 'hidden' ?>">
88
  <table class="table">
89
  <tbody>
90
  <?php
93
  ?>
94
  <tr>
95
  <td><label class="text-bold" for="iub_amp_template-<?php echo $lang_id; ?>"><?php echo $lang_name; ?></label></td>
96
+ <td><input id="iub_amp_template-<?php echo $lang_id; ?>" type="text" class="regular-text" name="iubenda_cookie_law_solution[amp_template][<?php echo $lang_id; ?>]" value="<?php echo iub_array_get(iubenda()->options['cs'], "amp_template.{$lang_id}") ?>"/></td>
97
  </tr>
98
  <?php } ?>
99
  </tbody>
views/partials/auto_detect_forms.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  $cons_page_configuration = get_option('iubenda_consent_solution');
3
 
4
- if ($cons_page_configuration && array_get($cons_page_configuration, 'public_api_key')){
5
 
6
  $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
7
  $form = ! empty( $form_id ) ? iubenda()->forms->get_form( $form_id ) : false;
1
  <?php
2
  $cons_page_configuration = get_option('iubenda_consent_solution');
3
 
4
+ if ($cons_page_configuration && iub_array_get($cons_page_configuration, 'public_api_key')){
5
 
6
  $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
7
  $form = ! empty( $form_id ) ? iubenda()->forms->get_form( $form_id ) : false;
views/partials/bannerPosition.php CHANGED
@@ -25,7 +25,7 @@ $positions = [
25
 
26
  <?php foreach($positions as $v): ?>
27
  <input type="radio" class="position-select-radio" name="iubenda_cookie_law_solution[simplified][position]" value="<?php echo $v; ?>" id="<?php echo $v ; ?>" <?php
28
- checked( $v, array_get(iubenda()->options['cs'], 'simplified.position'), true);
29
  ?> >
30
  <label for="<?php echo $v ; ?>">
31
  <div>
@@ -37,7 +37,7 @@ $positions = [
37
  <div class="overlaybox p-0">
38
  <div class="p-3">
39
  <label class="checkbox-regular">
40
- <input type="checkbox" class="mr-2" name="iubenda_cookie_law_solution[simplified][background_overlay]" <?php echo checked( true, (bool) array_get(iubenda()->options['cs'], 'simplified.background_overlay'), false); ?>>
41
  <span><?php _e('Background-overlay', 'iubenda') ?></span>
42
  </label>
43
  </div>
25
 
26
  <?php foreach($positions as $v): ?>
27
  <input type="radio" class="position-select-radio" name="iubenda_cookie_law_solution[simplified][position]" value="<?php echo $v; ?>" id="<?php echo $v ; ?>" <?php
28
+ checked( $v, iub_array_get(iubenda()->options['cs'], 'simplified.position'), true);
29
  ?> >
30
  <label for="<?php echo $v ; ?>">
31
  <div>
37
  <div class="overlaybox p-0">
38
  <div class="p-3">
39
  <label class="checkbox-regular">
40
+ <input type="checkbox" class="mr-2" name="iubenda_cookie_law_solution[simplified][background_overlay]" <?php echo checked( true, (bool) iub_array_get(iubenda()->options['cs'], 'simplified.background_overlay'), false); ?>>
41
  <span><?php _e('Background-overlay', 'iubenda') ?></span>
42
  </label>
43
  </div>
views/partials/bannerStyle.php CHANGED
@@ -4,13 +4,13 @@
4
  <fieldset class="theme-select d-flex">
5
  <div class="mr-2">
6
  <label class="radio-theme radio-theme-dark">
7
- <input type="radio" name="iubenda_cookie_law_solution[simplified][banner_style]" value="dark" <?php echo checked( 'dark', array_get(iubenda()->options['cs'], 'simplified.banner_style'), false) ?>>
8
  </label>
9
  <p class="text-xs text-center"><?php _e('Dark', 'iubenda') ?></p>
10
  </div>
11
  <div class="mr-2">
12
  <label class="radio-theme radio-theme-light">
13
- <input type="radio" name="iubenda_cookie_law_solution[simplified][banner_style]" value="light" <?php echo checked( 'light', array_get(iubenda()->options['cs'], 'simplified.banner_style'), false) ?>>
14
  </label>
15
  <p class="text-xs text-center"><?php _e('Light', 'iubenda') ?></p>
16
  </div>
4
  <fieldset class="theme-select d-flex">
5
  <div class="mr-2">
6
  <label class="radio-theme radio-theme-dark">
7
+ <input type="radio" name="iubenda_cookie_law_solution[simplified][banner_style]" value="dark" <?php echo checked( 'dark', iub_array_get(iubenda()->options['cs'], 'simplified.banner_style'), false) ?>>
8
  </label>
9
  <p class="text-xs text-center"><?php _e('Dark', 'iubenda') ?></p>
10
  </div>
11
  <div class="mr-2">
12
  <label class="radio-theme radio-theme-light">
13
+ <input type="radio" name="iubenda_cookie_law_solution[simplified][banner_style]" value="light" <?php echo checked( 'light', iub_array_get(iubenda()->options['cs'], 'simplified.banner_style'), false) ?>>
14
  </label>
15
  <p class="text-xs text-center"><?php _e('Light', 'iubenda') ?></p>
16
  </div>
views/partials/breadcrumb.php CHANGED
@@ -8,8 +8,8 @@
8
  $textStyle = '';
9
  }
10
 
11
- $href = array_get($pageLabel, 'href') ?? 'javascript:void(0)';
12
- echo "<li class='breadcrumb__item {$textStyle}'><a href='{$href}'>".array_get($pageLabel, 'title')."</a></li>";
13
  }
14
  ?>
15
  </ul>
8
  $textStyle = '';
9
  }
10
 
11
+ $href = iub_array_get($pageLabel, 'href') ?? 'javascript:void(0)';
12
+ echo "<li class='breadcrumb__item {$textStyle}'><a href='{$href}'>".iub_array_get($pageLabel, 'title')."</a></li>";
13
  }
14
  ?>
15
  </ul>
views/partials/buttonPosition.php CHANGED
@@ -1,11 +1,11 @@
1
  <h4><?php _e('Button position', 'iubenda') ?></h4>
2
  <div class="mb-2 d-flex align-items-center flex-wrap">
3
  <label class="radio-regular mr-3">
4
- <input type="radio" name="iubenda_privacy_policy_solution[button_position]" value="automatic" class="mr-2 section-radio-control" data-section-group=".pp_button_position" data-section-name="#pp_button_position_automatically" <?php checked( 'automatic', array_get(iubenda()->options['pp'], 'button_position')) ?>>
5
  <span><?php _e('Add to the footer automatically', 'iubenda') ?></span>
6
  </label>
7
  <label class="mr-4 radio-regular text-xs">
8
- <input type="radio" name="iubenda_privacy_policy_solution[button_position]" value="manual" class="mr-2 section-radio-control" data-section-group=".pp_button_position" data-section-name="#pp_button_position_manually" <?php checked( 'manual', array_get(iubenda()->options['pp'], 'button_position')) ?>>
9
 
10
  <span><?php _e('Integrate manually', 'iubenda') ?></span>
11
  </label>
@@ -14,9 +14,9 @@
14
  global $wp_registered_sidebars;
15
 
16
  // If sidebar-1 not registered or not activated
17
- if (!boolval(array_get($wp_registered_sidebars, 'sidebar-1'))) {
18
  ?>
19
- <section id="pp_button_position_automatically" class="pp_button_position <?php echo array_get(iubenda()->options['pp'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
20
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
21
  <img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
22
  <p><?php echo sprintf( __( 'We were not able to add a "Legal" widget to the footer as your theme is not compatible, you can position the "Legal" widget manually from <a href="%s" target="_blank">here</a>.', 'iubenda' ), esc_url( admin_url( 'widgets.php' ) ) ) ?></p>
@@ -25,7 +25,7 @@ if (!boolval(array_get($wp_registered_sidebars, 'sidebar-1'))) {
25
  <?php
26
  }
27
  ?>
28
- <section id="pp_button_position_manually" class="pp_button_position <?php echo array_get(iubenda()->options['pp'], 'button_position') == 'manual' ?:'hidden' ; ?>">
29
  <div class="mb-3 p-0">
30
  <div class="my-5">
31
  <h4><?php _e('HTML', 'iubenda') ?></h4>
@@ -43,12 +43,12 @@ if (!boolval(array_get($wp_registered_sidebars, 'sidebar-1'))) {
43
 
44
  $languages = (new ProductHelper())->get_languages();
45
  foreach($languages as $lang_id => $v):
46
- $code = array_get(iubenda()->options['pp'], "code_{$lang_id}");
47
 
48
  // if there is no embed code saved generate embed code
49
  if(!$code){
50
- $publicIds = array_get($globalOptions, 'public_ids');
51
- $publicId = array_get($publicIds, $lang_id);
52
 
53
  $code = $privacyPolicyGenerator->handle($lang_id, $publicId, 'white');
54
  }
1
  <h4><?php _e('Button position', 'iubenda') ?></h4>
2
  <div class="mb-2 d-flex align-items-center flex-wrap">
3
  <label class="radio-regular mr-3">
4
+ <input type="radio" name="iubenda_privacy_policy_solution[button_position]" value="automatic" class="mr-2 section-radio-control" data-section-group=".pp_button_position" data-section-name="#pp_button_position_automatically" <?php checked( 'automatic', iub_array_get(iubenda()->options['pp'], 'button_position')) ?>>
5
  <span><?php _e('Add to the footer automatically', 'iubenda') ?></span>
6
  </label>
7
  <label class="mr-4 radio-regular text-xs">
8
+ <input type="radio" name="iubenda_privacy_policy_solution[button_position]" value="manual" class="mr-2 section-radio-control" data-section-group=".pp_button_position" data-section-name="#pp_button_position_manually" <?php checked( 'manual', iub_array_get(iubenda()->options['pp'], 'button_position')) ?>>
9
 
10
  <span><?php _e('Integrate manually', 'iubenda') ?></span>
11
  </label>
14
  global $wp_registered_sidebars;
15
 
16
  // If sidebar-1 not registered or not activated
17
+ if (!boolval(iub_array_get($wp_registered_sidebars, 'sidebar-1'))) {
18
  ?>
19
+ <section id="pp_button_position_automatically" class="pp_button_position <?php echo iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
20
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
21
  <img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
22
  <p><?php echo sprintf( __( 'We were not able to add a "Legal" widget to the footer as your theme is not compatible, you can position the "Legal" widget manually from <a href="%s" target="_blank">here</a>.', 'iubenda' ), esc_url( admin_url( 'widgets.php' ) ) ) ?></p>
25
  <?php
26
  }
27
  ?>
28
+ <section id="pp_button_position_manually" class="pp_button_position <?php echo iub_array_get(iubenda()->options['pp'], 'button_position') == 'manual' ?:'hidden' ; ?>">
29
  <div class="mb-3 p-0">
30
  <div class="my-5">
31
  <h4><?php _e('HTML', 'iubenda') ?></h4>
43
 
44
  $languages = (new ProductHelper())->get_languages();
45
  foreach($languages as $lang_id => $v):
46
+ $code = iub_array_get(iubenda()->options['pp'], "code_{$lang_id}");
47
 
48
  // if there is no embed code saved generate embed code
49
  if(!$code){
50
+ $publicIds = iub_array_get($globalOptions, 'public_ids');
51
+ $publicId = iub_array_get($publicIds, $lang_id);
52
 
53
  $code = $privacyPolicyGenerator->handle($lang_id, $publicId, 'white');
54
  }
views/partials/buttonStyle.php CHANGED
@@ -3,7 +3,7 @@
3
  <div class="button-style mb-3 d-flex">
4
  <div class="m-1 mr-2">
5
  <label class="radio-btn-style radio-btn-style-light">
6
- <input type="radio" class="update-button-style" name="iubenda_privacy_policy_solution[button_style]" value="white" <?php echo checked( 'white', array_get(iubenda()->options['pp'], 'button_style'), false) ?>>
7
  <div>
8
  <div class="btn-fake"></div>
9
  </div>
@@ -12,7 +12,7 @@
12
  </div>
13
  <div class="m-1 mr-2">
14
  <label class="radio-btn-style radio-btn-style-dark">
15
- <input type="radio" class="update-button-style" name="iubenda_privacy_policy_solution[button_style]" value="black" <?php echo checked( 'black', array_get(iubenda()->options['pp'], 'button_style'), false) ?>>
16
  <div>
17
  <div class="btn-fake"></div>
18
  </div>
3
  <div class="button-style mb-3 d-flex">
4
  <div class="m-1 mr-2">
5
  <label class="radio-btn-style radio-btn-style-light">
6
+ <input type="radio" class="update-button-style" name="iubenda_privacy_policy_solution[button_style]" value="white" <?php echo checked( 'white', iub_array_get(iubenda()->options['pp'], 'button_style'), false) ?>>
7
  <div>
8
  <div class="btn-fake"></div>
9
  </div>
12
  </div>
13
  <div class="m-1 mr-2">
14
  <label class="radio-btn-style radio-btn-style-dark">
15
+ <input type="radio" class="update-button-style" name="iubenda_privacy_policy_solution[button_style]" value="black" <?php echo checked( 'black', iub_array_get(iubenda()->options['pp'], 'button_style'), false) ?>>
16
  <div>
17
  <div class="btn-fake"></div>
18
  </div>
views/partials/csGeneralSettings.php CHANGED
@@ -5,10 +5,10 @@
5
  <fieldset class="radio-large">
6
  <div class="d-flex tabs__nav">
7
  <?php
8
- if (array_get(iubenda()->options['global_options'], 'site_id')) {
9
  ?>
10
- <div class="m-1 mr-2 tabs__nav__item <?php echo array_get(iubenda()->options['cs'], 'configuration_type') == 'simplified' ?: 'active' ?>" data-target="configuration-type-simplified-tab" data-group="configuration-type">
11
- <input class="section-radio-control cs-configuration-type" type="radio" id="radioSimplified" name="iubenda_cookie_law_solution[configuration_type]" value="simplified" <?php checked('simplified', array_get(iubenda()->options['cs'], 'configuration_type')) ?>>
12
  <label for="radioSimplified">
13
  <div class=" d-flex align-items-center">
14
  <svg xmlns="http://www.w3.org/2000/svg" width="29" height="27" viewBox="0 0 29 27">
@@ -28,8 +28,8 @@
28
  <?php
29
  }
30
  ?>
31
- <div class="m-1 mr-2 tabs__nav__item <?php echo array_get(iubenda()->options['cs'], 'configuration_type') == 'manual' ?: 'active' ?>" data-target="configuration-type-manual-tab" data-group="configuration-type">
32
- <input type="radio" id="radioManual" class="section-radio-control cs-configuration-type" name="iubenda_cookie_law_solution[configuration_type]" value="manual" <?php checked( 'manual', array_get(iubenda()->options['cs'], 'configuration_type') ) ?>>
33
  <label for="radioManual">
34
  <div class="d-flex align-items-center">
35
  <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25">
@@ -50,15 +50,15 @@
50
  </div>
51
  <div class="my-4 subOptions">
52
  <?php
53
- if (array_get(iubenda()->options['global_options'], 'site_id')) {
54
  ?>
55
- <section class="tabs__target <?php echo array_get(iubenda()->options['cs'], 'configuration_type') != 'simplified' ?: 'active' ?>" data-target="configuration-type-simplified-tab" data-group="configuration-type">
56
  <?php require_once IUBENDA_PLUGIN_PATH . 'views/partials/csSimplifiedConfiguration.php'; ?>
57
  </section>
58
  <?php
59
  }
60
  ?>
61
- <section class="tabs__target <?php echo array_get(iubenda()->options['cs'], 'configuration_type') != 'manual' ?: 'active' ?>" data-target="configuration-type-manual-tab" data-group="configuration-type">
62
  <?php require_once IUBENDA_PLUGIN_PATH . 'views/partials/csManualConfiguration.php'; ?>
63
  </section>
64
  </div>
@@ -74,16 +74,16 @@
74
  <h4><?php _e('Select the iubenda AMP configuration file location.', 'iubenda') ?></h4>
75
  <div class="mb-2 d-flex flex-wrap align-items-center">
76
  <label class="radio-regular mr-4">
77
- <input type="radio" name="iubenda_cookie_law_solution[amp_source]" value="local" class="mr-2 section-radio-control" data-section-name="#auto_generated_conf_file" data-section-group=".amp_configuration_file" <?php checked( 'local', array_get(iubenda()->options['cs'], 'amp_source')) ?>>
78
  <span><?php _e('Auto-generated configuration file', 'iubenda') ?></span>
79
  </label>
80
  <label class="mr-4 radio-regular text-xs">
81
- <input type="radio" name="iubenda_cookie_law_solution[amp_source]" value="remote" class="mr-2 section-radio-control" data-section-name="#custom_conf_file" data-section-group=".amp_configuration_file" <?php checked( 'remote', array_get(iubenda()->options['cs'], 'amp_source')) ?>>
82
  <span><?php _e('Custom configuration file', 'iubenda') ?></span>
83
  </label>
84
  </div>
85
 
86
- <section id="auto_generated_conf_file" class="text-xs text-gray amp_configuration_file <?php echo array_get(iubenda()->options['cs'], 'amp_source') == 'local' ?: 'hidden' ?>">
87
  <div class="notice notice--general mt-2 p-3 d-flex flex-wrap align-items-center">
88
  <?php
89
 
@@ -98,7 +98,7 @@
98
  // multilang support
99
  if (iubenda()->multilang && !empty(iubenda()->languages)) {
100
  foreach (iubenda()->languages as $lang_id => $lang_name) {
101
- if(!array_get(iubenda()->options['cs']['amp_template_done'], $lang_id, false) ?: false){
102
  continue;
103
  }
104
  ?>
@@ -127,7 +127,7 @@
127
  </div>
128
  <p class="px-3 mx-4"><?php _e('Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly?', 'iubenda') ?> <a target="_blank" href="<?php echo iubenda()->settings->links["amp_support"]; ?>" class="link-underline"><?php _e('Learn how to fix it', 'iubenda') ?></a></p>
129
  </section>
130
- <section id="custom_conf_file" class="text-xs text-gray amp_configuration_file <?php echo array_get(iubenda()->options['cs'], 'amp_source') == 'remote' ?: 'hidden' ?>">
131
  <table class="table">
132
  <tbody>
133
  <?php
@@ -136,7 +136,7 @@
136
  ?>
137
  <tr>
138
  <td><label class="text-bold" for="iub_amp_template-<?php echo $lang_id; ?>"><?php echo $lang_name; ?></label></td>
139
- <td><input id="iub_amp_template-<?php echo $lang_id; ?>" type="text" class="regular-text" name="iubenda_cookie_law_solution[amp_template][<?php echo $lang_id; ?>]" value="<?php echo array_get(iubenda()->options['cs'], "amp_template.{$lang_id}") ?>"/></td>
140
  </tr>
141
  <?php } ?>
142
  </tbody>
5
  <fieldset class="radio-large">
6
  <div class="d-flex tabs__nav">
7
  <?php
8
+ if (iub_array_get(iubenda()->options['global_options'], 'site_id')) {
9
  ?>
10
+ <div class="m-1 mr-2 tabs__nav__item <?php echo iub_array_get(iubenda()->options['cs'], 'configuration_type') == 'simplified' ?: 'active' ?>" data-target="configuration-type-simplified-tab" data-group="configuration-type">
11
+ <input class="section-radio-control cs-configuration-type" type="radio" id="radioSimplified" name="iubenda_cookie_law_solution[configuration_type]" value="simplified" <?php checked('simplified', iub_array_get(iubenda()->options['cs'], 'configuration_type')) ?>>
12
  <label for="radioSimplified">
13
  <div class=" d-flex align-items-center">
14
  <svg xmlns="http://www.w3.org/2000/svg" width="29" height="27" viewBox="0 0 29 27">
28
  <?php
29
  }
30
  ?>
31
+ <div class="m-1 mr-2 tabs__nav__item <?php echo iub_array_get(iubenda()->options['cs'], 'configuration_type') == 'manual' ?: 'active' ?>" data-target="configuration-type-manual-tab" data-group="configuration-type">
32
+ <input type="radio" id="radioManual" class="section-radio-control cs-configuration-type" name="iubenda_cookie_law_solution[configuration_type]" value="manual" <?php checked( 'manual', iub_array_get(iubenda()->options['cs'], 'configuration_type') ) ?>>
33
  <label for="radioManual">
34
  <div class="d-flex align-items-center">
35
  <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25">
50
  </div>
51
  <div class="my-4 subOptions">
52
  <?php
53
+ if (iub_array_get(iubenda()->options['global_options'], 'site_id')) {
54
  ?>
55
+ <section class="tabs__target <?php echo iub_array_get(iubenda()->options['cs'], 'configuration_type') != 'simplified' ?: 'active' ?>" data-target="configuration-type-simplified-tab" data-group="configuration-type">
56
  <?php require_once IUBENDA_PLUGIN_PATH . 'views/partials/csSimplifiedConfiguration.php'; ?>
57
  </section>
58
  <?php
59
  }
60
  ?>
61
+ <section class="tabs__target <?php echo iub_array_get(iubenda()->options['cs'], 'configuration_type') != 'manual' ?: 'active' ?>" data-target="configuration-type-manual-tab" data-group="configuration-type">
62
  <?php require_once IUBENDA_PLUGIN_PATH . 'views/partials/csManualConfiguration.php'; ?>
63
  </section>
64
  </div>
74
  <h4><?php _e('Select the iubenda AMP configuration file location.', 'iubenda') ?></h4>
75
  <div class="mb-2 d-flex flex-wrap align-items-center">
76
  <label class="radio-regular mr-4">
77
+ <input type="radio" name="iubenda_cookie_law_solution[amp_source]" value="local" class="mr-2 section-radio-control" data-section-name="#auto_generated_conf_file" data-section-group=".amp_configuration_file" <?php checked( 'local', iub_array_get(iubenda()->options['cs'], 'amp_source')) ?>>
78
  <span><?php _e('Auto-generated configuration file', 'iubenda') ?></span>
79
  </label>
80
  <label class="mr-4 radio-regular text-xs">
81
+ <input type="radio" name="iubenda_cookie_law_solution[amp_source]" value="remote" class="mr-2 section-radio-control" data-section-name="#custom_conf_file" data-section-group=".amp_configuration_file" <?php checked( 'remote', iub_array_get(iubenda()->options['cs'], 'amp_source')) ?>>
82
  <span><?php _e('Custom configuration file', 'iubenda') ?></span>
83
  </label>
84
  </div>
85
 
86
+ <section id="auto_generated_conf_file" class="text-xs text-gray amp_configuration_file <?php echo iub_array_get(iubenda()->options['cs'], 'amp_source') == 'local' ?: 'hidden' ?>">
87
  <div class="notice notice--general mt-2 p-3 d-flex flex-wrap align-items-center">
88
  <?php
89
 
98
  // multilang support
99
  if (iubenda()->multilang && !empty(iubenda()->languages)) {
100
  foreach (iubenda()->languages as $lang_id => $lang_name) {
101
+ if(!iub_array_get(iubenda()->options['cs']['amp_template_done'], $lang_id, false) ?: false){
102
  continue;
103
  }
104
  ?>
127
  </div>
128
  <p class="px-3 mx-4"><?php _e('Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly?', 'iubenda') ?> <a target="_blank" href="<?php echo iubenda()->settings->links["amp_support"]; ?>" class="link-underline"><?php _e('Learn how to fix it', 'iubenda') ?></a></p>
129
  </section>
130
+ <section id="custom_conf_file" class="text-xs text-gray amp_configuration_file <?php echo iub_array_get(iubenda()->options['cs'], 'amp_source') == 'remote' ?: 'hidden' ?>">
131
  <table class="table">
132
  <tbody>
133
  <?php
136
  ?>
137
  <tr>
138
  <td><label class="text-bold" for="iub_amp_template-<?php echo $lang_id; ?>"><?php echo $lang_name; ?></label></td>
139
+ <td><input id="iub_amp_template-<?php echo $lang_id; ?>" type="text" class="regular-text" name="iubenda_cookie_law_solution[amp_template][<?php echo $lang_id; ?>]" value="<?php echo iub_array_get(iubenda()->options['cs'], "amp_template.{$lang_id}") ?>"/></td>
140
  </tr>
141
  <?php } ?>
142
  </tbody>
views/partials/csPluginSettings.php CHANGED
@@ -112,7 +112,7 @@
112
  </section>
113
  <div id="custom-iframe-fields">
114
  <?php
115
- foreach (array_get(iubenda()->options['cs'],'custom_iframes') as $iframe => $type){
116
  ?>
117
  <section id="custom-iframe-field" class="custom-iframe-field">
118
  <input type="text" class="regular-text" name="iubenda_cookie_law_solution[custom_iframes][iframe][]" placeholder="Enter custom iframe" value='<?php echo esc_attr( stripslashes($iframe) ); ?>'>
112
  </section>
113
  <div id="custom-iframe-fields">
114
  <?php
115
+ foreach (iub_array_get(iubenda()->options['cs'],'custom_iframes') as $iframe => $type){
116
  ?>
117
  <section id="custom-iframe-field" class="custom-iframe-field">
118
  <input type="text" class="regular-text" name="iubenda_cookie_law_solution[custom_iframes][iframe][]" placeholder="Enter custom iframe" value='<?php echo esc_attr( stripslashes($iframe) ); ?>'>
views/partials/csSimplifiedConfiguration.php CHANGED
@@ -10,15 +10,15 @@
10
  <div class="scrollable gap-fixer">
11
  <fieldset class="d-flex radio-large">
12
  <div class="radio-controller">
13
- <input type="radio" id="radioGdpr" name="iubenda_cookie_law_solution[simplified][legislation]" value="gdpr" <?php checked( 'gdpr', array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
14
  <label for="radioGdpr"><?php _e('GDPR Only', 'iubenda') ?></label>
15
  </div>
16
  <div class="radio-controller">
17
- <input type="radio" id="radioCcpa" name="iubenda_cookie_law_solution[simplified][legislation]" value="ccpa" <?php checked( 'ccpa', array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
18
  <label for="radioCcpa"><?php _e('CCPA Only', 'iubenda') ?></label>
19
  </div>
20
  <div class="radio-controller">
21
- <input type="radio" id="radioBoth" name="iubenda_cookie_law_solution[simplified][legislation]" value="both" <?php checked( 'both', array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
22
  <label for="radioBoth"><?php _e('Both', 'iubenda') ?></label>
23
  </div>
24
  </fieldset>
@@ -30,7 +30,7 @@
30
  <div class="scrollable gap-fixer">
31
  <fieldset class="d-flex radio-large">
32
  <div class="radio-controller">
33
- <input type="radio" id="radioWorldwide" name="iubenda_cookie_law_solution[simplified][require_consent]" value="worldwide" <?php checked( 'worldwide', array_get(iubenda()->options['cs'], 'simplified.require_consent') ) ?>>
34
  <label for="radioWorldwide">
35
  <div class="d-flex align-items-center">
36
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="30" viewBox="0 0 32 30">
@@ -45,7 +45,7 @@
45
  </label>
46
  </div>
47
  <div class="radio-controller">
48
- <input type="radio" id="radioEU" name="iubenda_cookie_law_solution[simplified][require_consent]" value="eu_only" <?php checked( 'eu_only', array_get(iubenda()->options['cs'], 'simplified.require_consent'), true ) ?>>
49
  <label for="radioEU">
50
  <div class=" d-flex align-items-center">
51
  <svg xmlns="http://www.w3.org/2000/svg" width="30" height="28" viewBox="0 0 30 28">
@@ -68,12 +68,12 @@
68
  <h4><?php _e('Banner buttons', 'iubenda') ?></h4>
69
  <fieldset>
70
  <label class="checkbox-regular">
71
- <input type="checkbox" class="mr-2 tcf-dependency" name="iubenda_cookie_law_solution[simplified][explicit_accept]" <?php checked( true, (bool) array_get(iubenda()->options['cs'], 'simplified.explicit_accept')); ?> <?php echo true == (bool) array_get(iubenda()->options['cs'], 'simplified.tcf') ? 'disabled':null ?>>
72
  <span><?php _e('Explicit Accept and Customize buttons', 'iubenda') ?></span>
73
  </label>
74
 
75
  <label class="checkbox-regular">
76
- <input type="checkbox" class="mr-2 tcf-dependency" name="iubenda_cookie_law_solution[simplified][explicit_reject]" <?php checked( true, (bool) array_get(iubenda()->options['cs'], 'simplified.explicit_reject')); ?> <?php echo true == (bool) array_get(iubenda()->options['cs'], 'simplified.tcf') ? 'disabled':null ?>>
77
  <span><?php _e('Explicit Reject button', 'iubenda') ?></span>
78
  </label>
79
  </fieldset>
@@ -82,7 +82,7 @@
82
  <div class="my-5">
83
  <h4><?php _e('Other options', 'iubenda') ?></h4>
84
  <label class="checkbox-regular">
85
- <input type="checkbox" class="mr-2 iub-toggle-elements-status" data-group=".tcf-dependency" name="iubenda_cookie_law_solution[simplified][tcf]" <?php checked( true, (bool) array_get(iubenda()->options['cs'], 'simplified.tcf')); ?>>
86
  <span>
87
  <div>
88
  <?php _e('Enable IAB Transparency and Consent Framework', 'iubenda') ?> - <a target="_blank" href="<?php echo iubenda()->settings->links['enable_iab']; ?>" class="link-underline"><?php _e('Learn More', 'iubenda') ?></a></div>
10
  <div class="scrollable gap-fixer">
11
  <fieldset class="d-flex radio-large">
12
  <div class="radio-controller">
13
+ <input type="radio" id="radioGdpr" name="iubenda_cookie_law_solution[simplified][legislation]" value="gdpr" <?php checked( 'gdpr', iub_array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
14
  <label for="radioGdpr"><?php _e('GDPR Only', 'iubenda') ?></label>
15
  </div>
16
  <div class="radio-controller">
17
+ <input type="radio" id="radioCcpa" name="iubenda_cookie_law_solution[simplified][legislation]" value="ccpa" <?php checked( 'ccpa', iub_array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
18
  <label for="radioCcpa"><?php _e('CCPA Only', 'iubenda') ?></label>
19
  </div>
20
  <div class="radio-controller">
21
+ <input type="radio" id="radioBoth" name="iubenda_cookie_law_solution[simplified][legislation]" value="both" <?php checked( 'both', iub_array_get(iubenda()->options['cs'], 'simplified.legislation'), true ) ?>>
22
  <label for="radioBoth"><?php _e('Both', 'iubenda') ?></label>
23
  </div>
24
  </fieldset>
30
  <div class="scrollable gap-fixer">
31
  <fieldset class="d-flex radio-large">
32
  <div class="radio-controller">
33
+ <input type="radio" id="radioWorldwide" name="iubenda_cookie_law_solution[simplified][require_consent]" value="worldwide" <?php checked( 'worldwide', iub_array_get(iubenda()->options['cs'], 'simplified.require_consent') ) ?>>
34
  <label for="radioWorldwide">
35
  <div class="d-flex align-items-center">
36
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="30" viewBox="0 0 32 30">
45
  </label>
46
  </div>
47
  <div class="radio-controller">
48
+ <input type="radio" id="radioEU" name="iubenda_cookie_law_solution[simplified][require_consent]" value="eu_only" <?php checked( 'eu_only', iub_array_get(iubenda()->options['cs'], 'simplified.require_consent'), true ) ?>>
49
  <label for="radioEU">
50
  <div class=" d-flex align-items-center">
51
  <svg xmlns="http://www.w3.org/2000/svg" width="30" height="28" viewBox="0 0 30 28">
68
  <h4><?php _e('Banner buttons', 'iubenda') ?></h4>
69
  <fieldset>
70
  <label class="checkbox-regular">
71
+ <input type="checkbox" class="mr-2 tcf-dependency" name="iubenda_cookie_law_solution[simplified][explicit_accept]" <?php checked( true, (bool) iub_array_get(iubenda()->options['cs'], 'simplified.explicit_accept')); ?> <?php echo true == (bool) iub_array_get(iubenda()->options['cs'], 'simplified.tcf') ? 'disabled':null ?>>
72
  <span><?php _e('Explicit Accept and Customize buttons', 'iubenda') ?></span>
73
  </label>
74
 
75
  <label class="checkbox-regular">
76
+ <input type="checkbox" class="mr-2 tcf-dependency" name="iubenda_cookie_law_solution[simplified][explicit_reject]" <?php checked( true, (bool) iub_array_get(iubenda()->options['cs'], 'simplified.explicit_reject')); ?> <?php echo true == (bool) iub_array_get(iubenda()->options['cs'], 'simplified.tcf') ? 'disabled':null ?>>
77
  <span><?php _e('Explicit Reject button', 'iubenda') ?></span>
78
  </label>
79
  </fieldset>
82
  <div class="my-5">
83
  <h4><?php _e('Other options', 'iubenda') ?></h4>
84
  <label class="checkbox-regular">
85
+ <input type="checkbox" class="mr-2 iub-toggle-elements-status" data-group=".tcf-dependency" name="iubenda_cookie_law_solution[simplified][tcf]" <?php checked( true, (bool) iub_array_get(iubenda()->options['cs'], 'simplified.tcf')); ?>>
86
  <span>
87
  <div>
88
  <?php _e('Enable IAB Transparency and Consent Framework', 'iubenda') ?> - <a target="_blank" href="<?php echo iubenda()->settings->links['enable_iab']; ?>" class="link-underline"><?php _e('Learn More', 'iubenda') ?></a></div>
views/partials/frontpage_main_box.php CHANGED
@@ -14,23 +14,23 @@
14
  $radar = new RadarService();
15
 
16
  $services['cs'] = [
17
- 'status' => array_get($radar->apiConfiguration, 'result.meta.cp_installed'),
18
  'label' => __('Set up a cookie banner', 'iubenda')
19
  ];
20
  $services['cons'] = [
21
- 'status' => array_get($radar->apiConfiguration, 'result.meta.cp_installed'),
22
  'label' => __('Only track users that give consent', 'iubenda')
23
  ];
24
  $services['pp'] = [
25
- 'status' => array_get($radar->apiConfiguration, 'result.meta.pp_installed'),
26
  'label' => __('Set up a privacy policy', 'iubenda')
27
  ];
28
  $services['tc'] = [
29
- 'status' => array_get($radar->apiConfiguration, 'result.meta.tc_installed'),
30
  'label' => __('Set up terms and conditions', 'iubenda')
31
  ];
32
 
33
- if (!empty($radar->apiConfiguration) && array_get($radar->apiConfiguration, 'status') == 'completed') {
34
  require_once IUBENDA_PLUGIN_PATH . '/views/partials/header_scanned.php';
35
  } else {
36
  ?>
@@ -50,7 +50,7 @@ if (!empty($radar->apiConfiguration) && array_get($radar->apiConfiguration, 'sta
50
  <div>
51
  <ul class="list_radar m-0 mt-4 px-4">
52
  <?php foreach ($services as $key => $service) : ?>
53
- <li id="<?php echo $key ?>-item" class="list_radar__item my-5 my-lg-0 mx-lg-3 list_radar__item--<?php echo array_get($radar->apiConfiguration, 'status') == 'completed' ? array_get($service, 'status') == true ? 'on':'off' : null; ?>">
54
  <figure><img src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/list_radar_<?php echo $key; ?>.svg"></figure>
55
  <p class="text-bold m-0 mx-4"><?php echo $service['label']; ?></p>
56
  </li>
14
  $radar = new RadarService();
15
 
16
  $services['cs'] = [
17
+ 'status' => iub_array_get($radar->apiConfiguration, 'result.meta.cp_installed'),
18
  'label' => __('Set up a cookie banner', 'iubenda')
19
  ];
20
  $services['cons'] = [
21
+ 'status' => iub_array_get($radar->apiConfiguration, 'result.meta.cp_installed'),
22
  'label' => __('Only track users that give consent', 'iubenda')
23
  ];
24
  $services['pp'] = [
25
+ 'status' => iub_array_get($radar->apiConfiguration, 'result.meta.pp_installed'),
26
  'label' => __('Set up a privacy policy', 'iubenda')
27
  ];
28
  $services['tc'] = [
29
+ 'status' => iub_array_get($radar->apiConfiguration, 'result.meta.tc_installed'),
30
  'label' => __('Set up terms and conditions', 'iubenda')
31
  ];
32
 
33
+ if (!empty($radar->apiConfiguration) && iub_array_get($radar->apiConfiguration, 'status') == 'completed') {
34
  require_once IUBENDA_PLUGIN_PATH . '/views/partials/header_scanned.php';
35
  } else {
36
  ?>
50
  <div>
51
  <ul class="list_radar m-0 mt-4 px-4">
52
  <?php foreach ($services as $key => $service) : ?>
53
+ <li id="<?php echo $key ?>-item" class="list_radar__item my-5 my-lg-0 mx-lg-3 list_radar__item--<?php echo iub_array_get($radar->apiConfiguration, 'status') == 'completed' ? iub_array_get($service, 'status') == true ? 'on':'off' : null; ?>">
54
  <figure><img src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/list_radar_<?php echo $key; ?>.svg"></figure>
55
  <p class="text-bold m-0 mx-4"><?php echo $service['label']; ?></p>
56
  </li>
views/partials/modals/modal_almost_there.php CHANGED
@@ -49,7 +49,7 @@
49
  global $wp_registered_sidebars;
50
 
51
  // If sidebar-1 not registered or not activated
52
- if (in_array($key, ['pp', 'tc']) && !boolval(array_get($wp_registered_sidebars, 'sidebar-1'))) {
53
  ?>
54
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
55
  <img class="mr-2" style="width: 3rem !important" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
49
  global $wp_registered_sidebars;
50
 
51
  // If sidebar-1 not registered or not activated
52
+ if (in_array($key, ['pp', 'tc']) && !boolval(iub_array_get($wp_registered_sidebars, 'sidebar-1'))) {
53
  ?>
54
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
55
  <img class="mr-2" style="width: 3rem !important" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
views/partials/modals/modal_select_language.php CHANGED
@@ -14,7 +14,7 @@
14
 
15
  $iubenda_intersect_supported_langs = array_intersect($local_languages, array_keys(iubenda()->supported_languages)) ?: [];
16
  } else {
17
- $iubenda_intersect_supported_langs = array_intersect([array_get(iubenda()->lang_mapping, get_locale())], array_values(iubenda()->lang_mapping)) ?: [];
18
  }
19
 
20
  // Check if the current language is supported from Iubenda or not
14
 
15
  $iubenda_intersect_supported_langs = array_intersect($local_languages, array_keys(iubenda()->supported_languages)) ?: [];
16
  } else {
17
+ $iubenda_intersect_supported_langs = array_intersect([iub_array_get(iubenda()->lang_mapping, get_locale())], array_values(iubenda()->lang_mapping)) ?: [];
18
  }
19
 
20
  // Check if the current language is supported from Iubenda or not
views/partials/product-card.php CHANGED
@@ -14,7 +14,7 @@
14
  <?php if(isset($serviceOptions['settings'])): ?>
15
  <ul id="configiration-iubenda-<?php echo $serviceKey ?>" class="service-on text-gray text-xs " <?php echo $serviceOptions['status']!='true' ? 'style="display: none;"':''; ?> id="toggleServiceOn">
16
  <?php
17
- foreach (array_get($serviceOptions, 'settings') as $setting) {
18
  $value = '';
19
  if ($setting['label'] === 'Version') {
20
  continue;
14
  <?php if(isset($serviceOptions['settings'])): ?>
15
  <ul id="configiration-iubenda-<?php echo $serviceKey ?>" class="service-on text-gray text-xs " <?php echo $serviceOptions['status']!='true' ? 'style="display: none;"':''; ?> id="toggleServiceOn">
16
  <?php
17
+ foreach (iub_array_get($serviceOptions, 'settings') as $setting) {
18
  $value = '';
19
  if ($setting['label'] === 'Version') {
20
  continue;
views/pp-configuration.php CHANGED
@@ -14,7 +14,7 @@
14
 
15
  if (!empty(iubenda()->settings->links['privacy_policy_generator_edit'])) {
16
  $url = iubenda()->settings->links['privacy_policy_generator_edit'];
17
- }elseif(array_get(iubenda()->options['global_options'], 'site_id')){
18
  $url = iubenda()->settings->links['flow_page'];
19
  }
20
  ?>
14
 
15
  if (!empty(iubenda()->settings->links['privacy_policy_generator_edit'])) {
16
  $url = iubenda()->settings->links['privacy_policy_generator_edit'];
17
+ }elseif(iub_array_get(iubenda()->options['global_options'], 'site_id')){
18
  $url = iubenda()->settings->links['flow_page'];
19
  }
20
  ?>
views/tc-configuration.php CHANGED
@@ -34,7 +34,7 @@
34
  <div class="button-style mb-3 d-flex">
35
  <div class="m-1 mr-2">
36
  <label class="radio-btn-style radio-btn-style-light">
37
- <input type="radio" class="update-button-style" name="iubenda_terms_conditions_solution[button_style]" value="white" <?php echo checked( 'white', array_get(iubenda()->options['tc'], 'button_style'), false) ?>>
38
  <div>
39
  <div class="btn-fake"></div>
40
  </div>
@@ -43,7 +43,7 @@
43
  </div>
44
  <div class="m-1 mr-2">
45
  <label class="radio-btn-style radio-btn-style-dark">
46
- <input type="radio" class="update-button-style" name="iubenda_terms_conditions_solution[button_style]" value="black" <?php echo checked( 'black', array_get(iubenda()->options['tc'], 'button_style'), false) ?>>
47
  <div>
48
  <div class="btn-fake"></div>
49
  </div>
@@ -57,11 +57,11 @@
57
  <h4><?php _e('Button position', 'iubenda') ?></h4>
58
  <div class="mb-2 d-flex align-items-center flex-wrap">
59
  <label class="radio-regular mr-3">
60
- <input type="radio" name="iubenda_terms_conditions_solution[button_position]" value="automatic" class="mr-2 section-radio-control" data-section-group=".tc_button_position" data-section-name="#tc_button_position_automatic" <?php checked( 'automatic', array_get(iubenda()->options['tc'], 'button_position')) ?>>
61
  <span><?php _e('Add to the footer automatically', 'iubenda') ?></span>
62
  </label>
63
  <label class="mr-4 radio-regular text-xs">
64
- <input type="radio" name="iubenda_terms_conditions_solution[button_position]" value="manual" class="mr-2 section-radio-control" data-section-group=".tc_button_position" data-section-name="#tc_button_position_manually" <?php checked( 'manual', array_get(iubenda()->options['tc'], 'button_position')) ?>>
65
  <span><?php _e('Integrate manually', 'iubenda') ?></span>
66
  </label>
67
  </div>
@@ -69,9 +69,9 @@
69
  global $wp_registered_sidebars;
70
 
71
  // If sidebar-1 not registered or not activated
72
- if (!boolval(array_get($wp_registered_sidebars, 'sidebar-1'))){
73
  ?>
74
- <section id="tc_button_position_automatic" class="tc_button_position <?php echo array_get(iubenda()->options['tc'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
75
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
76
  <img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
77
  <p><?php echo sprintf( __( 'We were not able to add a "Legal" widget to the footer as your theme is not compatible, you can position the "Legal" widget manually from <a href="%s" target="_blank">here</a>.', 'iubenda' ), esc_url( admin_url( 'widgets.php' ) ) ) ?></p>
@@ -80,7 +80,7 @@
80
  <?php
81
  }
82
  ?>
83
- <section id="tc_button_position_manually" class="tc_button_position <?php echo array_get(iubenda()->options['tc'], 'button_position') == 'manual' ?:'hidden' ; ?>">
84
  <div class="mb-3 p-0">
85
  <div class="my-5">
86
  <h4><?php _e('HTML', 'iubenda') ?></h4>
@@ -95,7 +95,7 @@
95
  <?php
96
  $languages = (new ProductHelper())->get_languages();
97
  foreach($languages as $lang_id => $v):
98
- $code = array_get(iubenda()->options['tc'], "code_{$lang_id}");
99
  $code = html_entity_decode(iubenda()->parse_code($code));
100
  ?>
101
  <div data-target="tab-<?php echo $lang_id ; ?>" class="tabs__target <?php echo $lang_id == iubenda()->lang_default || $lang_id == 'default'? 'active': '' ; ?>" data-group="language-tabs">
34
  <div class="button-style mb-3 d-flex">
35
  <div class="m-1 mr-2">
36
  <label class="radio-btn-style radio-btn-style-light">
37
+ <input type="radio" class="update-button-style" name="iubenda_terms_conditions_solution[button_style]" value="white" <?php echo checked( 'white', iub_array_get(iubenda()->options['tc'], 'button_style'), false) ?>>
38
  <div>
39
  <div class="btn-fake"></div>
40
  </div>
43
  </div>
44
  <div class="m-1 mr-2">
45
  <label class="radio-btn-style radio-btn-style-dark">
46
+ <input type="radio" class="update-button-style" name="iubenda_terms_conditions_solution[button_style]" value="black" <?php echo checked( 'black', iub_array_get(iubenda()->options['tc'], 'button_style'), false) ?>>
47
  <div>
48
  <div class="btn-fake"></div>
49
  </div>
57
  <h4><?php _e('Button position', 'iubenda') ?></h4>
58
  <div class="mb-2 d-flex align-items-center flex-wrap">
59
  <label class="radio-regular mr-3">
60
+ <input type="radio" name="iubenda_terms_conditions_solution[button_position]" value="automatic" class="mr-2 section-radio-control" data-section-group=".tc_button_position" data-section-name="#tc_button_position_automatic" <?php checked( 'automatic', iub_array_get(iubenda()->options['tc'], 'button_position')) ?>>
61
  <span><?php _e('Add to the footer automatically', 'iubenda') ?></span>
62
  </label>
63
  <label class="mr-4 radio-regular text-xs">
64
+ <input type="radio" name="iubenda_terms_conditions_solution[button_position]" value="manual" class="mr-2 section-radio-control" data-section-group=".tc_button_position" data-section-name="#tc_button_position_manually" <?php checked( 'manual', iub_array_get(iubenda()->options['tc'], 'button_position')) ?>>
65
  <span><?php _e('Integrate manually', 'iubenda') ?></span>
66
  </label>
67
  </div>
69
  global $wp_registered_sidebars;
70
 
71
  // If sidebar-1 not registered or not activated
72
+ if (!boolval(iub_array_get($wp_registered_sidebars, 'sidebar-1'))){
73
  ?>
74
+ <section id="tc_button_position_automatic" class="tc_button_position <?php echo iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
75
  <div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
76
  <img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
77
  <p><?php echo sprintf( __( 'We were not able to add a "Legal" widget to the footer as your theme is not compatible, you can position the "Legal" widget manually from <a href="%s" target="_blank">here</a>.', 'iubenda' ), esc_url( admin_url( 'widgets.php' ) ) ) ?></p>
80
  <?php
81
  }
82
  ?>
83
+ <section id="tc_button_position_manually" class="tc_button_position <?php echo iub_array_get(iubenda()->options['tc'], 'button_position') == 'manual' ?:'hidden' ; ?>">
84
  <div class="mb-3 p-0">
85
  <div class="my-5">
86
  <h4><?php _e('HTML', 'iubenda') ?></h4>
95
  <?php
96
  $languages = (new ProductHelper())->get_languages();
97
  foreach($languages as $lang_id => $v):
98
+ $code = iub_array_get(iubenda()->options['tc'], "code_{$lang_id}");
99
  $code = html_entity_decode(iubenda()->parse_code($code));
100
  ?>
101
  <div data-target="tab-<?php echo $lang_id ; ?>" class="tabs__target <?php echo $lang_id == iubenda()->lang_default || $lang_id == 'default'? 'active': '' ; ?>" data-group="language-tabs">