iubenda Cookie Solution for GDPR - Version 1.10.8

Version Description

  • Fixed problems with WPML and with using the shortcode
Download this release

Release Info

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

Code changes from version 1.10.7 to 1.10.8

Files changed (2) hide show
  1. iubenda_cookie_solution.php +86 -77
  2. readme.txt +3 -0
iubenda_cookie_solution.php CHANGED
@@ -4,24 +4,25 @@
4
  * Plugin URI: https://www.iubenda.com
5
  * Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
6
  * Author: iubenda
7
- * Version: 1.10.7
8
  * Text Domain: iubenda-cookie-wp-plugin
9
  * Author URI: https://www.iubenda.com
10
  */
11
 
12
  define('DEBUG', 0);
13
  define('IUB_NO_PARSE_GET_PARAM', isset($_GET['iub_no_parse']));
 
14
 
15
  /**/
16
 
17
- function iubenda_load_admin_panel()
18
- {
19
- /**/
20
-
21
- if(!is_admin()) {
22
  ob_start("__iubenda_final_output");
23
  }
24
-
 
 
25
  /*
26
  * Check for WPML
27
  */
@@ -51,72 +52,17 @@
51
  if(is_admin()) add_action('admin_menu', 'iub_admin');
52
  }
53
 
54
- add_action("registered_taxonomy", "iubenda_load_admin_panel", -PHP_INT_MAX);
 
 
 
55
 
56
- function __iubenda_buffer_head()
57
- {
58
- /*
59
- * __iubenda_buffer_head
60
- */
61
-
62
- /**/
63
-
64
- $iubenda_code = "";
65
-
66
- /**/
67
-
68
- if(get_option("iub_code")) {
69
- $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
70
-
71
- $iubenda_languages = array("it", "de", "en", "es", "br", "ru");
72
-
73
- foreach($iubenda_languages as $iubenda_language)
74
- {
75
- if(strpos($wpml_old, 'lang: "'.$iubenda_language) !== false) {
76
- $language_tag = $iubenda_language;
77
-
78
- break;
79
- }
80
- }
81
-
82
- update_option("iubenda-code-$language_tag", $wpml_old);
83
- update_option("iubenda-code-default", $wpml_old);
84
- update_option("iub_code", false);
85
- }
86
-
87
- if(defined("IUBENDA_WPML") && get_option("iubenda-code-".ICL_LANGUAGE_CODE)) {
88
- $iubenda_code .= get_option("iubenda-code-".ICL_LANGUAGE_CODE);
89
- }
90
- else {
91
- $iubenda_code .= get_option("iubenda-code-default");
92
- }
93
-
94
- $iubenda_code .= "\n
95
- <script>
96
- var iCallback = function(){};
97
-
98
- if('callback' in _iub.csConfiguration) {
99
- if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
100
-
101
- _iub.csConfiguration.callback.onConsentGiven = function()
102
- {
103
- iCallback();
104
-
105
- /*
106
- * Separator
107
- */
108
-
109
- jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
110
- };
111
- };
112
- </script>";
113
-
114
-
115
- /**/
116
-
117
- echo $iubenda_code;
118
  }
119
-
 
 
120
  /**/
121
 
122
  function __iubenda_final_output($output)
@@ -128,16 +74,79 @@ if('callback' in _iub.csConfiguration) {
128
  $page = new Page($output);
129
  $page->parse();
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /**/
132
 
133
- return $page->get_converted_page();
134
  }
135
 
136
- if(!is_admin()) {
137
- add_action("wp_head", "__iubenda_buffer_head");
138
- }
139
-
140
-
141
  /***********************************
142
  *
143
  * Add menù item on the admin
4
  * Plugin URI: https://www.iubenda.com
5
  * Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
6
  * Author: iubenda
7
+ * Version: 1.10.8
8
  * Text Domain: iubenda-cookie-wp-plugin
9
  * Author URI: https://www.iubenda.com
10
  */
11
 
12
  define('DEBUG', 0);
13
  define('IUB_NO_PARSE_GET_PARAM', isset($_GET['iub_no_parse']));
14
+ define("IUB_REGEX_PATTERN", "/<!--IUB_COOKIE_POLICY_START-->(.*)<!--IUB_COOKIE_POLICY_END-->/sU");
15
 
16
  /**/
17
 
18
+ function iubenda_load_output_buffer()
19
+ {
20
+ if(!is_admin()) {
 
 
21
  ob_start("__iubenda_final_output");
22
  }
23
+ }
24
+ function iubenda_load_admin_panel()
25
+ {
26
  /*
27
  * Check for WPML
28
  */
52
  if(is_admin()) add_action('admin_menu', 'iub_admin');
53
  }
54
 
55
+ add_action("registered_taxonomy", "iubenda_load_output_buffer", -PHP_INT_MAX);
56
+ add_action("plugins_loaded", "iubenda_load_admin_panel", 0);
57
+
58
+ /**/
59
 
60
+ function iub_func($atts, $content = "") {
61
+ return '<!--IUB_COOKIE_POLICY_START-->'.do_shortcode($content).'<!--IUB_COOKIE_POLICY_END-->';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
+
64
+ add_shortcode('iub-cookie-policy', 'iub_func');
65
+
66
  /**/
67
 
68
  function __iubenda_final_output($output)
74
  $page = new Page($output);
75
  $page->parse();
76
 
77
+ $output = $page->get_converted_page();
78
+
79
+ /**/
80
+
81
+ if(ob_get_level() == 1) {
82
+
83
+ /*
84
+ * __iubenda_buffer_head
85
+ */
86
+
87
+ /**/
88
+
89
+ $iubenda_code = "";
90
+
91
+ /**/
92
+
93
+ if(get_option("iub_code")) {
94
+ $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
95
+
96
+ $iubenda_languages = array("it", "de", "en", "es", "br", "ru");
97
+
98
+ foreach($iubenda_languages as $iubenda_language)
99
+ {
100
+ if(strpos($wpml_old, 'lang: "'.$iubenda_language) !== false) {
101
+ $language_tag = $iubenda_language;
102
+
103
+ break;
104
+ }
105
+ }
106
+
107
+ update_option("iubenda-code-$language_tag", $wpml_old);
108
+ update_option("iubenda-code-default", $wpml_old);
109
+ update_option("iub_code", false);
110
+ }
111
+
112
+ if(defined("IUBENDA_WPML") && get_option("iubenda-code-".ICL_LANGUAGE_CODE)) {
113
+ $iubenda_code .= get_option("iubenda-code-".ICL_LANGUAGE_CODE);
114
+ }
115
+ else {
116
+ $iubenda_code .= get_option("iubenda-code-default");
117
+ }
118
+
119
+ $iubenda_code .= "\n
120
+ <script>
121
+ var iCallback = function(){};
122
+
123
+ if('callback' in _iub.csConfiguration) {
124
+ if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
125
+
126
+ _iub.csConfiguration.callback.onConsentGiven = function()
127
+ {
128
+ iCallback();
129
+
130
+ /*
131
+ * Separator
132
+ */
133
+
134
+ jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
135
+ };
136
+ };
137
+ </script>";
138
+
139
+
140
+ /**/
141
+
142
+ $output = str_replace("</head>", $iubenda_code."</head>", $output);
143
+ }
144
+
145
  /**/
146
 
147
+ return $output;
148
  }
149
 
 
 
 
 
 
150
  /***********************************
151
  *
152
  * Add menù item on the admin
readme.txt CHANGED
@@ -122,6 +122,9 @@ Il plugin Wordpress di iubenda permette di semplificare l’adeguamento del prop
122
 
123
  == Changelog ==
124
 
 
 
 
125
  = 1.10.7 =
126
  * Further work on resolving any conflicts with other plugins
127
  * Fixed a problem with the Media library
122
 
123
  == Changelog ==
124
 
125
+ = 1.10.8 =
126
+ * Fixed problems with WPML and with using the shortcode
127
+
128
  = 1.10.7 =
129
  * Further work on resolving any conflicts with other plugins
130
  * Fixed a problem with the Media library