Version Description
- Revert: Add the ability to include PP and TC buttons for default WP
Download this release
Release Info
Developer | iubenda |
Plugin | iubenda Cookie Solution for GDPR |
Version | 3.1.1 |
Comparing to | |
See all releases |
Code changes from version 3.1.0 to 3.1.1
- assets/js/legal_block.js +0 -64
- includes/ProductHelper.php +0 -35
- includes/QuickGeneratorService.php +3 -3
- includes/block/IubendaLegalBlock.php +0 -379
- includes/settings.php +5 -5
- includes/widget/IubendaLegalWidget.php +0 -15
- iubenda_cookie_solution.php +4 -38
- readme.txt +19 -5
- views/partials/buttonPosition.php +4 -10
- views/partials/modals/modal_almost_there.php +4 -10
- views/tc-configuration.php +4 -10
assets/js/legal_block.js
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
( function ( blocks, editor, i18n, element, components, _, blockEditor ) {
|
2 |
-
var __ = i18n.__;
|
3 |
-
var el = element.createElement;
|
4 |
-
var RichText = blockEditor.RichText;
|
5 |
-
var useBlockProps = blockEditor.useBlockProps;
|
6 |
-
|
7 |
-
const iconEl = el('svg', {},
|
8 |
-
el('path', {
|
9 |
-
fill:"#1CC691" ,
|
10 |
-
d: "M 11.6671 0 c 3.1311 0 5.6675 2.5268 5.6675 5.6464 c 0 1.3892 -0.5031 2.6608 -1.3408 3.6454 L 17.1974 25.5634 H 6.4376 l 1.1666 -15.9874 A 5.6025 5.6025 90 0 1 6 5.6468 C 6 2.5268 8.5364 0 11.6671 0 z m 1.0762 11.8411 l -1.865 1.8653 v 7.38 h 1.865 V 11.8411 z M 11.6671 4.1886 c -0.7528 0 -1.3628 0.6142 -1.3628 1.3723 c 0 0.7576 0.61 1.372 1.3628 1.372 s 1.3631 -0.6142 1.3631 -1.372 c 0 -0.7582 -0.6104 -1.3723 -1.3631 -1.3723 z"
|
11 |
-
} )
|
12 |
-
);
|
13 |
-
|
14 |
-
blocks.registerBlockType( iub_block_js_vars.block_name, {
|
15 |
-
title: __('Iubenda legal block', 'iubenda'),
|
16 |
-
icon: iconEl,
|
17 |
-
category: 'layout',
|
18 |
-
attributes: {
|
19 |
-
title: {
|
20 |
-
type: 'string',
|
21 |
-
default: __('Legal', 'iubenda')
|
22 |
-
},
|
23 |
-
},
|
24 |
-
edit: function ( props ) {
|
25 |
-
var attributes = props.attributes;
|
26 |
-
|
27 |
-
return el(
|
28 |
-
'div',
|
29 |
-
useBlockProps({ className: props.className }),
|
30 |
-
el( RichText, {
|
31 |
-
tagName: 'p',
|
32 |
-
placeholder: __('Iubenda legal block', 'iubenda'),
|
33 |
-
value: attributes.title,
|
34 |
-
onChange: function ( value ) {
|
35 |
-
props.setAttributes( { title: value } );
|
36 |
-
},
|
37 |
-
} ),
|
38 |
-
el( 'p', {}, '' ),
|
39 |
-
);
|
40 |
-
},
|
41 |
-
save: function ( props ) {
|
42 |
-
var attributes = props.attributes;
|
43 |
-
|
44 |
-
return el(
|
45 |
-
'div',
|
46 |
-
useBlockProps.save( { className: props.className } ),
|
47 |
-
el( RichText.Content, {
|
48 |
-
tagName: 'p',
|
49 |
-
value: attributes.title,
|
50 |
-
} ),
|
51 |
-
el( 'p', {}, '['+iub_block_js_vars.iub_legal_block_shortcode+']' ),
|
52 |
-
);
|
53 |
-
},
|
54 |
-
} );
|
55 |
-
} )(
|
56 |
-
window.wp.blocks,
|
57 |
-
window.wp.editor,
|
58 |
-
window.wp.i18n,
|
59 |
-
window.wp.element,
|
60 |
-
window.wp.components,
|
61 |
-
window._,
|
62 |
-
window.wp.blockEditor
|
63 |
-
);
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/ProductHelper.php
CHANGED
@@ -99,39 +99,4 @@ class ProductHelper
|
|
99 |
|
100 |
return boolval(trim($iubenda_code));
|
101 |
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Getting public id for current language if stored in database
|
105 |
-
* @return array|ArrayAccess|false|mixed
|
106 |
-
*/
|
107 |
-
public function get_public_id_for_current_language(){
|
108 |
-
// Checking if there is no public id for current language
|
109 |
-
if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
|
110 |
-
$lang_id = iubenda()->lang_current;
|
111 |
-
} else {
|
112 |
-
$lang_id = 'default';
|
113 |
-
}
|
114 |
-
|
115 |
-
return iub_array_get(iubenda()->options['global_options'], "public_ids.{$lang_id}", false) ?: false;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Check privacy policy and terms and condition services status and position and codes
|
120 |
-
*
|
121 |
-
* @return bool
|
122 |
-
*/
|
123 |
-
public function check_pp_tc_status_and_position(){
|
124 |
-
$ppStatus = iub_array_get(iubenda()->settings->services, 'pp.status') == 'true';
|
125 |
-
$ppPosition = iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic';
|
126 |
-
|
127 |
-
$tcStatus = iub_array_get(iubenda()->settings->services, 'tc.status') == 'true';
|
128 |
-
$tcPosition = iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic';
|
129 |
-
$quickGeneratorService = new QuickGeneratorService();
|
130 |
-
|
131 |
-
if (!($ppStatus && $ppPosition && boolval($quickGeneratorService->pp_button())) && !($tcStatus && $tcPosition && boolval($quickGeneratorService->tc_button()))) {
|
132 |
-
return false;
|
133 |
-
}
|
134 |
-
|
135 |
-
return true;
|
136 |
-
}
|
137 |
}
|
99 |
|
100 |
return boolval(trim($iubenda_code));
|
101 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
includes/QuickGeneratorService.php
CHANGED
@@ -275,7 +275,7 @@ class QuickGeneratorService
|
|
275 |
if($iubenda_section_name == 'iubenda_privacy_policy_solution') {
|
276 |
// Add a widget in the sidebar if the button is positioned automatically
|
277 |
if('automatic' === iub_array_get($section_new_option, 'button_position')){
|
278 |
-
|
279 |
}
|
280 |
|
281 |
// Merge old old PP options with new options to update codes with new style
|
@@ -290,7 +290,7 @@ class QuickGeneratorService
|
|
290 |
if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
|
291 |
// Add a widget in the sidebar if the button is positioned automatically
|
292 |
if('automatic' === iub_array_get($section_new_option, 'button_position')){
|
293 |
-
|
294 |
}
|
295 |
|
296 |
// Update TC codes with new button style
|
@@ -599,7 +599,7 @@ class QuickGeneratorService
|
|
599 |
|
600 |
// Add a widget in the sidebar if the button is positioned automatically
|
601 |
if('automatic' === iub_array_get($_POST, 'iubenda_privacy_policy_solution.button_position')){
|
602 |
-
|
603 |
}
|
604 |
|
605 |
// Set the version of PP service as Simplified
|
275 |
if($iubenda_section_name == 'iubenda_privacy_policy_solution') {
|
276 |
// Add a widget in the sidebar if the button is positioned automatically
|
277 |
if('automatic' === iub_array_get($section_new_option, 'button_position')){
|
278 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
279 |
}
|
280 |
|
281 |
// Merge old old PP options with new options to update codes with new style
|
290 |
if($iubenda_section_name == 'iubenda_terms_conditions_solution') {
|
291 |
// Add a widget in the sidebar if the button is positioned automatically
|
292 |
if('automatic' === iub_array_get($section_new_option, 'button_position')){
|
293 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
294 |
}
|
295 |
|
296 |
// Update TC codes with new button style
|
599 |
|
600 |
// Add a widget in the sidebar if the button is positioned automatically
|
601 |
if('automatic' === iub_array_get($_POST, 'iubenda_privacy_policy_solution.button_position')){
|
602 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
603 |
}
|
604 |
|
605 |
// Set the version of PP service as Simplified
|
includes/block/IubendaLegalBlock.php
DELETED
@@ -1,379 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class IubendaLegalBlock
|
5 |
-
{
|
6 |
-
const IUB_LEGAL_BLOCK_NAME = 'iubenda/legal-block'; // IUB legal block Name
|
7 |
-
const IUB_LEGAL_BLOCK_SHORTCODE = 'iub-wp-block-buttons'; // IUB legal block Shortcode
|
8 |
-
|
9 |
-
/**
|
10 |
-
* IubendaLegalBlock constructor.
|
11 |
-
*/
|
12 |
-
public function __construct()
|
13 |
-
{
|
14 |
-
add_action('iubenda_attach_block_in_footer', [$this, 'attach_legal_block_into_footer']);
|
15 |
-
|
16 |
-
// Attach IUB legal block into WP blocks area
|
17 |
-
add_action('init', [$this, 'attach_legal_block_into_block_area'], 10, 0);
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Attach iubenda legal block in footer
|
22 |
-
*/
|
23 |
-
public function attach_legal_block_into_footer()
|
24 |
-
{
|
25 |
-
// if current theme doesn't supports blocks -> return
|
26 |
-
if (!$this->check_current_theme_supports_blocks()) {
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
|
30 |
-
// Check if IUB short code exist in footer
|
31 |
-
if ($this->check_iub_block_shortcode_exists_in_the_footer()) {
|
32 |
-
return;
|
33 |
-
}
|
34 |
-
|
35 |
-
$this->force_append_legal_block_in_footer();
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Detach iubenda legal block from footer
|
40 |
-
*/
|
41 |
-
public function detach_legal_block_from_footer()
|
42 |
-
{
|
43 |
-
// if current theme doesn't supports blocks -> return
|
44 |
-
if (!$this->check_current_theme_supports_blocks()) {
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
|
48 |
-
// Check if IUB short code exist in footer
|
49 |
-
if ($this->check_iub_block_shortcode_exists_in_the_footer()) {
|
50 |
-
$this->force_detach_legal_block_from_footer();
|
51 |
-
return;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Attach iubenda legal block in WP blocks area
|
57 |
-
*/
|
58 |
-
public function attach_legal_block_into_block_area()
|
59 |
-
{
|
60 |
-
add_shortcode(static::IUB_LEGAL_BLOCK_SHORTCODE, [$this, 'render_iub_legal_block']);
|
61 |
-
|
62 |
-
// Register IUB js block
|
63 |
-
wp_register_script('iubenda-block-editor', IUBENDA_PLUGIN_URL . '/assets/js/legal_block.js', ['wp-blocks', 'wp-editor'], iubenda()->version);
|
64 |
-
register_block_type(static::IUB_LEGAL_BLOCK_NAME, ['editor_script' => 'iubenda-block-editor',]);
|
65 |
-
|
66 |
-
// Send iub vars from backend to JS file
|
67 |
-
wp_localize_script('iubenda-block-editor', 'iub_block_js_vars', ['block_name' => 'iubenda/legal-block', 'iub_legal_block_shortcode' => static::IUB_LEGAL_BLOCK_SHORTCODE]);
|
68 |
-
|
69 |
-
// Enqueued script with localized data.
|
70 |
-
wp_enqueue_script('iubenda-block-editor');
|
71 |
-
|
72 |
-
// Force attach legal block into WP_Block_Patterns as WP default footer
|
73 |
-
$this->change_pre_registered_default_footer_content(false);
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Render iubenda legal block and apply filters
|
78 |
-
* @return mixed
|
79 |
-
*/
|
80 |
-
public function render_iub_legal_block()
|
81 |
-
{
|
82 |
-
$html = '';
|
83 |
-
$html = apply_filters('before_iub_legal_block_section', $html);
|
84 |
-
$html .= '<section>' . $this->iub_legal_block_html($html) . '</section>';
|
85 |
-
$html = apply_filters('after_iub_legal_block_section', $html);
|
86 |
-
|
87 |
-
return $html;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Check if the current theme support WP blocks or not
|
92 |
-
* @return bool
|
93 |
-
*/
|
94 |
-
public function check_current_theme_supports_blocks()
|
95 |
-
{
|
96 |
-
// Condition if there is no sidebar and the activated theme is working by WP blocks
|
97 |
-
global $wp_registered_sidebars;
|
98 |
-
|
99 |
-
if (!boolval(iub_array_get($wp_registered_sidebars, 'sidebar-1'))) {
|
100 |
-
return true;
|
101 |
-
}
|
102 |
-
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Iubenda legal block html
|
108 |
-
* @param $html
|
109 |
-
* @return mixed|string
|
110 |
-
*/
|
111 |
-
private function iub_legal_block_html($html)
|
112 |
-
{
|
113 |
-
$quick_generator_service = new QuickGeneratorService();
|
114 |
-
|
115 |
-
$pp_status = iub_array_get(iubenda()->settings->services, 'pp.status') == 'true';
|
116 |
-
$pp_position = iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic';
|
117 |
-
$tc_status = iub_array_get(iubenda()->settings->services, 'tc.status') == 'true';
|
118 |
-
$tc_position = iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic';
|
119 |
-
|
120 |
-
if ($pp_status && $pp_position) {
|
121 |
-
$html .= $quick_generator_service->pp_button();
|
122 |
-
}
|
123 |
-
|
124 |
-
if (($pp_status && $pp_position) && ($tc_status && $tc_position)) {
|
125 |
-
$html .= '<br>';
|
126 |
-
}
|
127 |
-
|
128 |
-
if (($tc_status == 'true') && ($tc_position == 'automatic')) {
|
129 |
-
$html .= $quick_generator_service->tc_button();
|
130 |
-
}
|
131 |
-
|
132 |
-
return $html;
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Get footer post from database
|
137 |
-
* @return mixed|null
|
138 |
-
*/
|
139 |
-
private function get_footer_from_database()
|
140 |
-
{
|
141 |
-
// Default arguments
|
142 |
-
$args = [
|
143 |
-
'post_type' => 'wp_template_part',
|
144 |
-
'post_status' => 'publish',
|
145 |
-
'tax_query' => [
|
146 |
-
[
|
147 |
-
'taxonomy' => 'wp_theme',
|
148 |
-
'field' => 'slug',
|
149 |
-
'terms' => [ get_stylesheet() ],
|
150 |
-
],
|
151 |
-
],
|
152 |
-
'posts_per_page' => 1,
|
153 |
-
'no_found_rows' => true,
|
154 |
-
];
|
155 |
-
|
156 |
-
// Search for footer in database
|
157 |
-
$args['name'] = 'footer';
|
158 |
-
|
159 |
-
// Run WP Query with new args
|
160 |
-
$footer_query = new WP_Query($args);
|
161 |
-
$footer = $footer_query->have_posts() ? $footer_query->next_post() : null;
|
162 |
-
|
163 |
-
// Footer exist in database
|
164 |
-
if ($footer) {
|
165 |
-
return $footer;
|
166 |
-
}
|
167 |
-
|
168 |
-
// Search if it is inserted as a default footer in the database
|
169 |
-
$args['name'] = 'default-footer';
|
170 |
-
|
171 |
-
// Run WP Query with new args
|
172 |
-
$footer_query = new WP_Query($args);
|
173 |
-
$footer = $footer_query->have_posts() ? $footer_query->next_post() : null;
|
174 |
-
|
175 |
-
return $footer;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Check if IUB short code exist in footer
|
180 |
-
* @return bool
|
181 |
-
*/
|
182 |
-
private function check_iub_block_shortcode_exists_in_the_footer()
|
183 |
-
{
|
184 |
-
$footer = $this->get_footer_from_database();
|
185 |
-
|
186 |
-
if ($footer && strpos($footer->post_content, '[iub-wp-block-buttons]') !== false) {
|
187 |
-
return true;
|
188 |
-
}
|
189 |
-
|
190 |
-
return false;
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Force append IUB legal block in footer
|
195 |
-
*/
|
196 |
-
private function force_append_legal_block_in_footer()
|
197 |
-
{
|
198 |
-
$footer = $this->get_footer_from_database();
|
199 |
-
|
200 |
-
if ($footer) {
|
201 |
-
$footer->post_content = $this->insert_iub_block_shortcode_into_footer_by_dom($footer->post_content);
|
202 |
-
|
203 |
-
$this->update_the_footer_into_database($footer);
|
204 |
-
}
|
205 |
-
|
206 |
-
// There is no footer stored in database then
|
207 |
-
// Attach legal block into WP_Block_Patterns as WP default footer and insert this footer into database
|
208 |
-
$this->change_pre_registered_default_footer_content();
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Insert Legal block into WP content by php DOMDocument
|
213 |
-
*
|
214 |
-
* @param $footer_content
|
215 |
-
* @return false|string
|
216 |
-
*/
|
217 |
-
private function insert_iub_block_shortcode_into_footer_by_dom($footer_content)
|
218 |
-
{
|
219 |
-
$dom = new DOMDocument();
|
220 |
-
$previous_value = libxml_use_internal_errors(TRUE);
|
221 |
-
$dom->loadHTML((string)$footer_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
222 |
-
libxml_clear_errors();
|
223 |
-
libxml_use_internal_errors($previous_value);
|
224 |
-
|
225 |
-
$target_div = $dom->getElementsByTagName('div')->item(1);
|
226 |
-
|
227 |
-
if(!$target_div){
|
228 |
-
return '';
|
229 |
-
}
|
230 |
-
|
231 |
-
// insert End of Iubenda legal block before start
|
232 |
-
$template = $dom->createDocumentFragment();
|
233 |
-
$template->appendXML(' <!-- /wp:'. static::IUB_LEGAL_BLOCK_NAME .' --> ');
|
234 |
-
$target_div->insertBefore($template, $target_div->firstChild);
|
235 |
-
|
236 |
-
// Create container div with class 'wp-block-iubenda-legal-block'
|
237 |
-
$div = $dom->createElement("div");
|
238 |
-
$div->setAttribute("class", "wp-block-iubenda-legal-block");
|
239 |
-
|
240 |
-
// Append the block title
|
241 |
-
$div->appendChild($dom->createElement('p', __('Legal', 'iubenda')));
|
242 |
-
|
243 |
-
// Append the block content
|
244 |
-
$div->appendChild($dom->createElement('p', '[iub-wp-block-buttons]'));
|
245 |
-
|
246 |
-
// Insert the block into the footer
|
247 |
-
$target_div->insertBefore($div, $target_div->firstChild);
|
248 |
-
|
249 |
-
// Append Start of Iubenda legal block
|
250 |
-
$template = $dom->createDocumentFragment();
|
251 |
-
$template->appendXML(' <!-- wp:'. static::IUB_LEGAL_BLOCK_NAME .' --> ');
|
252 |
-
$target_div->insertBefore($template, $target_div->firstChild);
|
253 |
-
|
254 |
-
return $dom->saveHTML();
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Remove Legal block from WP content
|
259 |
-
*
|
260 |
-
* @param $footer_content
|
261 |
-
* @return false|string
|
262 |
-
*/
|
263 |
-
private function remove_iub_block_shortcode_from_footer($footer_content)
|
264 |
-
{
|
265 |
-
$start_of_iub_legal_block = '<!-- wp:'. static::IUB_LEGAL_BLOCK_NAME .' -->';
|
266 |
-
$end_of_iub_legal_block = '<!-- /wp:'. static::IUB_LEGAL_BLOCK_NAME .' -->';
|
267 |
-
|
268 |
-
return $this->iub_delete_in_between($start_of_iub_legal_block, $end_of_iub_legal_block, $footer_content);
|
269 |
-
}
|
270 |
-
|
271 |
-
/**
|
272 |
-
* Update the current footer
|
273 |
-
*
|
274 |
-
* @param $footer
|
275 |
-
*/
|
276 |
-
private function update_the_footer_into_database($footer)
|
277 |
-
{
|
278 |
-
return wp_update_post($footer);
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Attach legal block into WP_Block_Patterns as WP default footer
|
283 |
-
* if $insert_into_database is true insert default footer into database
|
284 |
-
*
|
285 |
-
* @param bool $insert_into_database
|
286 |
-
* @return void
|
287 |
-
*/
|
288 |
-
private function change_pre_registered_default_footer_content($insert_into_database = true)
|
289 |
-
{
|
290 |
-
$public_id = (new ProductHelper())->get_public_id_for_current_language();
|
291 |
-
|
292 |
-
// Return false if there is no public id for current language
|
293 |
-
if (!($public_id)) {
|
294 |
-
return;
|
295 |
-
}
|
296 |
-
|
297 |
-
// Check for PP & TC service status and codes
|
298 |
-
if (!(new ProductHelper())->check_pp_tc_status_and_position()) {
|
299 |
-
return;
|
300 |
-
}
|
301 |
-
|
302 |
-
$block_registry = WP_Block_Patterns_Registry::get_instance();
|
303 |
-
|
304 |
-
foreach ( $block_registry->get_all_registered() as $block) {
|
305 |
-
$block_name = iub_array_get($block, 'name') ?: null;
|
306 |
-
|
307 |
-
if (strpos($block_name, 'footer-default') !== false) {
|
308 |
-
// Unregister default footer
|
309 |
-
$block_registry->unregister(iub_array_get($block, 'name'));
|
310 |
-
|
311 |
-
// Attach Iubenda legal block in footer content
|
312 |
-
$block['content'] = $this->insert_iub_block_shortcode_into_footer_by_dom(iub_array_get($block, 'content'));
|
313 |
-
|
314 |
-
// Register footer after attached Iubenda legal block on it
|
315 |
-
$block_registry->register(iub_array_get($block, 'name'), $block);
|
316 |
-
|
317 |
-
if ($insert_into_database) {
|
318 |
-
// Insert the footer into database
|
319 |
-
$this->insert_default_footer_into_database($block);
|
320 |
-
}
|
321 |
-
}
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Insert default footer into database
|
327 |
-
*
|
328 |
-
* @param $block
|
329 |
-
* @return int|WP_Error
|
330 |
-
*/
|
331 |
-
private function insert_default_footer_into_database($block)
|
332 |
-
{
|
333 |
-
// taxonomies
|
334 |
-
$taxonomies = [
|
335 |
-
'wp_template_part_area' => 'footer',
|
336 |
-
'wp_theme' => get_stylesheet(), // Current active theme slug
|
337 |
-
];
|
338 |
-
|
339 |
-
// New footer data
|
340 |
-
$footer = [
|
341 |
-
'post_title' => 'Footer',
|
342 |
-
'post_content' => $block['content'],
|
343 |
-
'post_status' => 'publish',
|
344 |
-
'post_author' => 1,
|
345 |
-
'post_type' => 'wp_template_part',
|
346 |
-
'post_category' => [ 'footer' ],
|
347 |
-
'tax_input' => $taxonomies
|
348 |
-
];
|
349 |
-
|
350 |
-
// Insert the new footer into the database
|
351 |
-
wp_insert_post($footer);
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* Force detach IUB legal block from footer
|
356 |
-
*/
|
357 |
-
private function force_detach_legal_block_from_footer()
|
358 |
-
{
|
359 |
-
$footer = $this->get_footer_from_database();
|
360 |
-
|
361 |
-
if ($footer) {
|
362 |
-
$footer->post_content = $this->remove_iub_block_shortcode_from_footer($footer->post_content);
|
363 |
-
|
364 |
-
$this->update_the_footer_into_database($footer);
|
365 |
-
}
|
366 |
-
}
|
367 |
-
|
368 |
-
private function iub_delete_in_between($beginning, $end, $string) {
|
369 |
-
$beginning_pos = strpos($string, $beginning);
|
370 |
-
$end_pos = strpos($string, $end);
|
371 |
-
if ($beginning_pos === false || $end_pos === false) {
|
372 |
-
return $string;
|
373 |
-
}
|
374 |
-
|
375 |
-
$text_to_delete = substr($string, $beginning_pos, ($end_pos + strlen($end)) - $beginning_pos);
|
376 |
-
|
377 |
-
return $this->iub_delete_in_between($beginning, $end, str_replace($text_to_delete, '', $string)); // recursion to ensure occurrences are removed
|
378 |
-
}
|
379 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/settings.php
CHANGED
@@ -63,7 +63,7 @@ class iubenda_Settings {
|
|
63 |
add_shortcode( 'iub-tc-button', array( new QuickGeneratorService(), 'tc_button_shortcode' ) );
|
64 |
add_shortcode( 'iub-pp-button', array( new QuickGeneratorService(), 'pp_button_shortcode' ) );
|
65 |
|
66 |
-
|
67 |
|
68 |
/**
|
69 |
* Load default settings.
|
@@ -1273,7 +1273,7 @@ class iubenda_Settings {
|
|
1273 |
$product_option['button_position'] = 'automatic';
|
1274 |
|
1275 |
// Add a widget in the sidebar
|
1276 |
-
|
1277 |
}
|
1278 |
|
1279 |
$product_option["code_{$lang_id}"] = stripslashes($code);
|
@@ -1284,7 +1284,7 @@ class iubenda_Settings {
|
|
1284 |
|
1285 |
if (in_array($product_key, ['pp', 'tc'])) {
|
1286 |
// Add a widget in the sidebar if the button is positioned automatically
|
1287 |
-
|
1288 |
}
|
1289 |
|
1290 |
//add version if Iubenda privacy policy solution activated
|
@@ -1364,7 +1364,7 @@ class iubenda_Settings {
|
|
1364 |
$product_option['button_position'] = 'automatic';
|
1365 |
|
1366 |
// Add a widget in the sidebar
|
1367 |
-
|
1368 |
}
|
1369 |
|
1370 |
$product_option["code_{$lang_id}"] = stripslashes($code);
|
@@ -1375,7 +1375,7 @@ class iubenda_Settings {
|
|
1375 |
|
1376 |
if (in_array($product_key, ['pp', 'tc'])) {
|
1377 |
// Add a widget in the sidebar if the button is positioned automatically
|
1378 |
-
|
1379 |
}
|
1380 |
|
1381 |
//add version if Iubenda privacy policy solution activated
|
63 |
add_shortcode( 'iub-tc-button', array( new QuickGeneratorService(), 'tc_button_shortcode' ) );
|
64 |
add_shortcode( 'iub-pp-button', array( new QuickGeneratorService(), 'pp_button_shortcode' ) );
|
65 |
|
66 |
+
}
|
67 |
|
68 |
/**
|
69 |
* Load default settings.
|
1273 |
$product_option['button_position'] = 'automatic';
|
1274 |
|
1275 |
// Add a widget in the sidebar
|
1276 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
1277 |
}
|
1278 |
|
1279 |
$product_option["code_{$lang_id}"] = stripslashes($code);
|
1284 |
|
1285 |
if (in_array($product_key, ['pp', 'tc'])) {
|
1286 |
// Add a widget in the sidebar if the button is positioned automatically
|
1287 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
1288 |
}
|
1289 |
|
1290 |
//add version if Iubenda privacy policy solution activated
|
1364 |
$product_option['button_position'] = 'automatic';
|
1365 |
|
1366 |
// Add a widget in the sidebar
|
1367 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
1368 |
}
|
1369 |
|
1370 |
$product_option["code_{$lang_id}"] = stripslashes($code);
|
1375 |
|
1376 |
if (in_array($product_key, ['pp', 'tc'])) {
|
1377 |
// Add a widget in the sidebar if the button is positioned automatically
|
1378 |
+
do_action('iubenda_assign_widget_to_first_sidebar');
|
1379 |
}
|
1380 |
|
1381 |
//add version if Iubenda privacy policy solution activated
|
includes/widget/IubendaLegalWidget.php
CHANGED
@@ -218,21 +218,6 @@ class IubendaLegalWidget extends WP_Widget
|
|
218 |
public function register_widget() {
|
219 |
register_widget(__CLASS__);
|
220 |
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Check current theme supports widget
|
224 |
-
*/
|
225 |
-
public function check_current_theme_supports_widget()
|
226 |
-
{
|
227 |
-
global $wp_registered_sidebars;
|
228 |
-
|
229 |
-
// If sidebar-1 registered and activated
|
230 |
-
if (iub_array_get($wp_registered_sidebars, 'sidebar-1')) {
|
231 |
-
return true;
|
232 |
-
}
|
233 |
-
|
234 |
-
return false;
|
235 |
-
}
|
236 |
}
|
237 |
|
238 |
|
218 |
public function register_widget() {
|
219 |
register_widget(__CLASS__);
|
220 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
|
223 |
|
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.1.
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
@@ -32,11 +32,9 @@ define( 'IUB_DEBUG', false );
|
|
32 |
* iubenda final class.
|
33 |
*
|
34 |
* @property-read iubenda_Settings $settings
|
35 |
-
* @property IubendaLegalWidget $widget
|
36 |
-
* @property IubendaLegalBlock $block
|
37 |
*
|
38 |
* @class iubenda
|
39 |
-
* @version 3.1.
|
40 |
*/
|
41 |
class iubenda {
|
42 |
|
@@ -94,7 +92,7 @@ class iubenda {
|
|
94 |
)
|
95 |
);
|
96 |
public $base_url;
|
97 |
-
public $version = '3.1.
|
98 |
public $activation = array(
|
99 |
'update_version' => 0,
|
100 |
'update_notice' => true,
|
@@ -168,7 +166,6 @@ class iubenda {
|
|
168 |
self::$instance->forms = new iubenda_Forms();
|
169 |
self::$instance->settings = new iubenda_Settings();
|
170 |
self::$instance->widget = new IubendaLegalWidget();
|
171 |
-
self::$instance->block = new IubendaLegalBlock();
|
172 |
}
|
173 |
|
174 |
return self::$instance;
|
@@ -239,6 +236,7 @@ class iubenda {
|
|
239 |
return $actions;
|
240 |
}
|
241 |
|
|
|
242 |
/**
|
243 |
* Setup plugin constants.
|
244 |
*
|
@@ -265,7 +263,6 @@ class iubenda {
|
|
265 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/PrivacyPolicyGenerator.php' );
|
266 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/ServiceRating.php' );
|
267 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/widget/IubendaLegalWidget.php' );
|
268 |
-
include_once( IUBENDA_PLUGIN_PATH . 'includes/block/IubendaLegalBlock.php' );
|
269 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/ProductHelper.php' );
|
270 |
}
|
271 |
|
@@ -369,9 +366,6 @@ class iubenda {
|
|
369 |
delete_option( 'iubenda_tc_page_configuration' );
|
370 |
delete_option( 'iubenda_terms_conditions_solution' );
|
371 |
delete_option( iubenda_Settings::IUB_NOTIFICATIONS );
|
372 |
-
|
373 |
-
// Detach iubenda legal block from footer
|
374 |
-
$this->block->detach_legal_block_from_footer();
|
375 |
}
|
376 |
|
377 |
// remove radar options from database
|
@@ -1210,34 +1204,6 @@ class iubenda {
|
|
1210 |
return version_compare( $db_version, $this->version, '<' );
|
1211 |
}
|
1212 |
|
1213 |
-
/**
|
1214 |
-
* Decide which will be included into footer (Block or Widget)
|
1215 |
-
*/
|
1216 |
-
public function assign_legal_block_or_widget()
|
1217 |
-
{
|
1218 |
-
// If current theme supports widget
|
1219 |
-
if ($this->widget->check_current_theme_supports_widget()) {
|
1220 |
-
do_action('iubenda_assign_widget_to_first_sidebar');
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
// if current theme supports blocks
|
1224 |
-
if ($this->block->check_current_theme_supports_blocks()) {
|
1225 |
-
do_action('iubenda_attach_block_in_footer');
|
1226 |
-
}
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
/**
|
1230 |
-
* Check if we support current theme to attach legal
|
1231 |
-
*/
|
1232 |
-
public function check_if_we_support_current_theme_to_attach_legal()
|
1233 |
-
{
|
1234 |
-
if ($this->widget->check_current_theme_supports_widget() || $this->block->check_current_theme_supports_blocks()) {
|
1235 |
-
return true;
|
1236 |
-
}
|
1237 |
-
|
1238 |
-
return false;
|
1239 |
-
}
|
1240 |
-
|
1241 |
}
|
1242 |
|
1243 |
if (!function_exists('iub_array_get')) {
|
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.1.1
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
32 |
* iubenda final class.
|
33 |
*
|
34 |
* @property-read iubenda_Settings $settings
|
|
|
|
|
35 |
*
|
36 |
* @class iubenda
|
37 |
+
* @version 3.1.1
|
38 |
*/
|
39 |
class iubenda {
|
40 |
|
92 |
)
|
93 |
);
|
94 |
public $base_url;
|
95 |
+
public $version = '3.1.1';
|
96 |
public $activation = array(
|
97 |
'update_version' => 0,
|
98 |
'update_notice' => true,
|
166 |
self::$instance->forms = new iubenda_Forms();
|
167 |
self::$instance->settings = new iubenda_Settings();
|
168 |
self::$instance->widget = new IubendaLegalWidget();
|
|
|
169 |
}
|
170 |
|
171 |
return self::$instance;
|
236 |
return $actions;
|
237 |
}
|
238 |
|
239 |
+
|
240 |
/**
|
241 |
* Setup plugin constants.
|
242 |
*
|
263 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/PrivacyPolicyGenerator.php' );
|
264 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/ServiceRating.php' );
|
265 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/widget/IubendaLegalWidget.php' );
|
|
|
266 |
include_once( IUBENDA_PLUGIN_PATH . 'includes/ProductHelper.php' );
|
267 |
}
|
268 |
|
366 |
delete_option( 'iubenda_tc_page_configuration' );
|
367 |
delete_option( 'iubenda_terms_conditions_solution' );
|
368 |
delete_option( iubenda_Settings::IUB_NOTIFICATIONS );
|
|
|
|
|
|
|
369 |
}
|
370 |
|
371 |
// remove radar options from database
|
1204 |
return version_compare( $db_version, $this->version, '<' );
|
1205 |
}
|
1206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1207 |
}
|
1208 |
|
1209 |
if (!function_exists('iub_array_get')) {
|
readme.txt
CHANGED
@@ -5,13 +5,13 @@ 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: 6.0
|
8 |
-
Stable tag: 3.1.
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
|
15 |
|
16 |
It allows you to:
|
17 |
|
@@ -183,6 +183,18 @@ A good rule of thumb is to always comply with the laws of the region where you a
|
|
183 |
|
184 |
If you’re based in Europe – including the UK – or target European users, and your website uses [cookies or trackers](https://www.iubenda.com/en/help/22419-how-to-identify-the-cookies-used-by-your-website) (which it most likely does), then, yes, you do need a cookie notice.
|
185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
= What is the GDPR and UK-GDPR (DSGVO & RGPD) =
|
188 |
|
@@ -242,6 +254,9 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
|
|
242 |
|
243 |
== Changelog ==
|
244 |
|
|
|
|
|
|
|
245 |
= 3.1.0 =
|
246 |
* Move plugin settings to a separate page
|
247 |
* Add the ability to include PP and TC buttons for default WP
|
@@ -686,6 +701,5 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
|
|
686 |
|
687 |
== Upgrade Notice ==
|
688 |
|
689 |
-
= 3.1.
|
690 |
-
*
|
691 |
-
* Add the ability to include PP and TC buttons for default WP
|
5 |
Requires at least: 5.0
|
6 |
Requires PHP: 7.0.0
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 3.1.1
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
The solution for GDPR compliance + more. Get your cookie banner, privacy policy, terms and conditions and handle cookie consent in just one plugin.
|
15 |
|
16 |
It allows you to:
|
17 |
|
183 |
|
184 |
If you’re based in Europe – including the UK – or target European users, and your website uses [cookies or trackers](https://www.iubenda.com/en/help/22419-how-to-identify-the-cookies-used-by-your-website) (which it most likely does), then, yes, you do need a cookie notice.
|
185 |
|
186 |
+
= Why do I need a privacy policy? =
|
187 |
+
|
188 |
+
A privacy policy is a legal requirement almost everywhere in the world. You need it because under most countries’ laws, you’re legally required to inform your users about the data you’re collecting and how you’re processing them.
|
189 |
+
|
190 |
+
Find out what should be in a privacy policy [here](https://www.iubenda.com/en/help/6187-what-should-be-in-a-privacy-policy).
|
191 |
+
|
192 |
+
= Are terms and conditions necessary? =
|
193 |
+
|
194 |
+
While Terms and conditions aren’t always legally mandatory, they’re [always recommended](https://www.iubenda.com/en/help/2859-terms-and-conditions-when-are-they-needed). They help you protect you and your business from legal liabilities.
|
195 |
+
|
196 |
+
However, please note that if you run an **e-commerce, then you’ll most likely need terms and conditions**, as they usually contain legally mandatory information related to commerce.
|
197 |
+
|
198 |
|
199 |
= What is the GDPR and UK-GDPR (DSGVO & RGPD) =
|
200 |
|
254 |
|
255 |
== Changelog ==
|
256 |
|
257 |
+
= 3.1.1 =
|
258 |
+
* Revert: Add the ability to include PP and TC buttons for default WP
|
259 |
+
|
260 |
= 3.1.0 =
|
261 |
* Move plugin settings to a separate page
|
262 |
* Add the ability to include PP and TC buttons for default WP
|
701 |
|
702 |
== Upgrade Notice ==
|
703 |
|
704 |
+
= 3.1.1 =
|
705 |
+
* Revert: Add the ability to include PP and TC buttons for default WP
|
|
views/partials/buttonPosition.php
CHANGED
@@ -11,21 +11,15 @@
|
|
11 |
</label>
|
12 |
</div>
|
13 |
<?php
|
14 |
-
|
15 |
-
if (!iubenda()->check_if_we_support_current_theme_to_attach_legal()) {
|
16 |
-
$url = 'javascript:void(0)';
|
17 |
-
|
18 |
-
if(iubenda()->widget->check_current_theme_supports_widget()){
|
19 |
-
$url = admin_url( 'widgets.php' );
|
20 |
-
}elseif(iubenda()->block->check_current_theme_supports_blocks()){
|
21 |
-
$url = admin_url( 'site-editor.php' );
|
22 |
-
}
|
23 |
|
|
|
|
|
24 |
?>
|
25 |
<section id="pp_button_position_automatically" class="pp_button_position <?php echo iub_array_get(iubenda()->options['pp'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
|
26 |
<div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
|
27 |
<img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
|
28 |
-
<p><?php echo sprintf( __( 'We were not able to add a "Legal" widget
|
29 |
</div>
|
30 |
</section>
|
31 |
<?php
|
11 |
</label>
|
12 |
</div>
|
13 |
<?php
|
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>
|
23 |
</div>
|
24 |
</section>
|
25 |
<?php
|
views/partials/modals/modal_almost_there.php
CHANGED
@@ -46,20 +46,14 @@
|
|
46 |
<section id="section-<?php echo $key; ?>" class="<?php echo $service['status']=='true' ? '':'hidden'; ?>">
|
47 |
<h4 class="mb-3"><?php echo $service['label']; ?></h4>
|
48 |
<?php
|
49 |
-
|
50 |
-
if (!iubenda()->check_if_we_support_current_theme_to_attach_legal()) {
|
51 |
-
$url = 'javascript:void(0)';
|
52 |
-
|
53 |
-
if(iubenda()->widget->check_current_theme_supports_widget()){
|
54 |
-
$url = admin_url( 'widgets.php' );
|
55 |
-
}elseif(iubenda()->block->check_current_theme_supports_blocks()){
|
56 |
-
$url = admin_url( 'site-editor.php' );
|
57 |
-
}
|
58 |
|
|
|
|
|
59 |
?>
|
60 |
<div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
|
61 |
<img class="mr-2" style="width: 3rem !important" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
|
62 |
-
<p><?php echo sprintf( __( 'We were not able to add a "Legal" widget
|
63 |
</div>
|
64 |
<?php
|
65 |
}
|
46 |
<section id="section-<?php echo $key; ?>" class="<?php echo $service['status']=='true' ? '':'hidden'; ?>">
|
47 |
<h4 class="mb-3"><?php echo $service['label']; ?></h4>
|
48 |
<?php
|
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">
|
56 |
+
<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>
|
57 |
</div>
|
58 |
<?php
|
59 |
}
|
views/tc-configuration.php
CHANGED
@@ -66,21 +66,15 @@
|
|
66 |
</label>
|
67 |
</div>
|
68 |
<?php
|
69 |
-
|
70 |
-
if (!iubenda()->check_if_we_support_current_theme_to_attach_legal()) {
|
71 |
-
$url = 'javascript:void(0)';
|
72 |
-
|
73 |
-
if(iubenda()->widget->check_current_theme_supports_widget()){
|
74 |
-
$url = admin_url( 'widgets.php' );
|
75 |
-
}elseif(iubenda()->block->check_current_theme_supports_blocks()){
|
76 |
-
$url = admin_url( 'site-editor.php' );
|
77 |
-
}
|
78 |
|
|
|
|
|
79 |
?>
|
80 |
<section id="tc_button_position_automatic" class="tc_button_position <?php echo iub_array_get(iubenda()->options['tc'], 'button_position') == 'automatic' ?:'hidden' ; ?>">
|
81 |
<div class="notice notice--warning mt-2 mb-4 p-3 d-flex align-items-center text-warning text-xs">
|
82 |
<img class="mr-2" src="<?php echo IUBENDA_PLUGIN_URL ?>/assets/images/warning-icon.svg">
|
83 |
-
<p><?php echo sprintf( __( 'We were not able to add a "Legal" widget
|
84 |
</div>
|
85 |
</section>
|
86 |
<?php
|
66 |
</label>
|
67 |
</div>
|
68 |
<?php
|
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>
|
78 |
</div>
|
79 |
</section>
|
80 |
<?php
|