PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.2.8
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.2.8
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / src / addons / config / Settings_Config.php
cookiebot / src / addons / config Last commit date
Settings_Config.php 3 years ago
Settings_Config.php
693 lines
1 <?php
2
3 namespace cybot\cookiebot\addons\config;
4
5 use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
6 use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
7 use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Theme_Addon;
8 use cybot\cookiebot\addons\controller\addons\jetpack\Jetpack;
9 use cybot\cookiebot\addons\controller\addons\jetpack\widget\Base_Jetpack_Widget;
10 use cybot\cookiebot\lib\Settings_Page_Tab;
11 use cybot\cookiebot\lib\Settings_Service_Interface;
12 use cybot\cookiebot\lib\Cookiebot_WP;
13 use Exception;
14 use InvalidArgumentException;
15 use ReflectionClass;
16 use function cybot\cookiebot\lib\asset_url;
17 use function cybot\cookiebot\lib\cookiebot_addons_get_dropdown_languages;
18 use function cybot\cookiebot\lib\get_view_html;
19 use function cybot\cookiebot\lib\include_view;
20
21 class Settings_Config {
22
23
24
25 /**
26 * @var Settings_Service_Interface
27 */
28 protected $settings_service;
29
30 const ADMIN_SLUG = 'cookiebot-addons';
31 const LANGUAGE_DROPDOWN_OPTION_REPLACE = '%optionname%';
32 const JETPACK_DEFAULT_LANGUAGE_DROPDOWN = 'cookiebot_jetpack_addon[%optionname%][placeholder][languages][site-default]';
33 const ADDONS_DEFAULT_LANGUAGE_DROPDOWN = 'cookiebot_available_addons[%optionname%][placeholder][languages][site-default]';
34 // Templates
35 const INFO_HEADER_TEMPLATE = 'admin/settings/prior-consent/partials/info-tab-header.php';
36 const EXTRA_INFO_TEMPLATE = 'admin/settings/prior-consent/partials/extra-information.php';
37 const JETPACK_TAB_HEADER_TEMPLATE = 'admin/settings/prior-consent/jetpack-widgets/tab-header.php';
38 const JETPACK_WIDGET_TAB_TEMPLATE = 'admin/settings/prior-consent/jetpack-widgets/tab.php';
39 const PLACEHOLDER_TEMPLATE = 'admin/settings/prior-consent/partials/placeholder-submitboxes.php';
40 const DEFAULT_PLACEHOLDER_TEMPLATE = 'admin/settings/prior-consent/partials/placeholder-submitbox-default.php';
41 const AVAILABLE_TAB_HEADER_TEMPLATE = 'admin/settings/prior-consent/available-addons/tab-header.php';
42 const AVAILABLE_ADDONS_TAB_TEMPLATE = 'admin/settings/prior-consent/available-addons/tab.php';
43 const UNAVAILABLE_TAB_HEADER_TEMPLATE = 'admin/settings/prior-consent/unavailable-addons/tab-header.php';
44 const UNAVAILABLE_ADDONS_TAB_TEMPLATE = 'admin/settings/prior-consent/unavailable-addons/field.php';
45
46 /**
47 * Settings_Config constructor.
48 *
49 * @param Settings_Service_Interface $settings_service
50 *
51 * @since 1.3.0
52 */
53 public function __construct( Settings_Service_Interface $settings_service ) {
54 $this->settings_service = $settings_service;
55 }
56
57 /**
58 * Load data for settings page
59 *
60 * @since 1.3.0
61 */
62 public function load() {
63 add_action( 'admin_menu', array( $this, 'add_submenu' ), 2 );
64 add_action( 'admin_init', array( $this, 'register_settings' ) );
65 add_action( 'admin_enqueue_scripts', array( $this, 'add_wp_admin_style_script' ) );
66 add_action(
67 'update_option_cookiebot_available_addons',
68 array(
69 $this,
70 'post_hook_available_addons_update_option',
71 ),
72 10,
73 3
74 );
75 }
76
77 /**
78 * Registers submenu in options menu.
79 *
80 * @since 1.3.0
81 */
82 public function add_submenu() {
83 add_submenu_page(
84 'cookiebot',
85 esc_html__( 'Plugins', 'cookiebot' ),
86 esc_html__( 'Plugins', 'cookiebot' ),
87 'manage_options',
88 'cookiebot-addons',
89 array(
90 $this,
91 'setting_page',
92 ),
93 2
94 );
95 }
96
97 /**
98 * Load css styling to the settings page
99 *
100 * @throws InvalidArgumentException
101 * @since 1.3.0
102 */
103 public function add_wp_admin_style_script( $hook ) {
104 if ( $hook !== 'cookiebot_page_cookiebot-addons' ) {
105 return;
106 }
107
108 wp_enqueue_script(
109 'cookiebot_tiptip_js',
110 asset_url( 'js/backend/jquery.tipTip.js' ),
111 array( 'jquery' ),
112 '1.8',
113 true
114 );
115 wp_enqueue_script(
116 'cookiebot_addons_custom_js',
117 asset_url( 'js/backend/prior-consent-settings.js' ),
118 array( 'jquery' ),
119 '1.8',
120 true
121 );
122 wp_localize_script(
123 'cookiebot_addons_custom_js',
124 'php',
125 array( 'remove_link' => ' <a href="" class="submitdelete deletion">' . esc_html__( 'Remove language', 'cookiebot' ) . '</a>' )
126 );
127 wp_enqueue_style(
128 'cookiebot_addons_custom_css',
129 asset_url( 'css/backend/addons_page.css' ),
130 null,
131 Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
132 );
133 wp_enqueue_style(
134 'cookiebot_admin_css',
135 asset_url( 'css/backend/cookiebot_admin_main.css' ),
136 null,
137 Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
138 );
139 }
140
141 /**
142 * Registers addons for settings page.
143 *
144 * @throws Exception
145 * @since 1.3.0
146 */
147 public function register_settings() {
148 global $pagenow;
149
150 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
151 if ( ( isset( $_GET['page'] ) && $_GET['page'] === 'cookiebot-addons' ) || $pagenow === 'options.php' ) {
152 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
153 if ( isset( $_GET['tab'] ) && 'unavailable_addons' === $_GET['tab'] ) {
154 $this->register_unavailable_addons();
155 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
156 } elseif ( isset( $_GET['tab'] ) && 'available_addons' === $_GET['tab'] ) {
157 $this->register_available_addons();
158 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
159 } elseif ( isset( $_GET['tab'] ) && 'jetpack' === $_GET['tab'] ) {
160 $this->register_jetpack_addon();
161 } else {
162 $this->register_addons_info();
163 }
164
165 if ( $pagenow === 'options.php' ) {
166 $this->register_jetpack_addon();
167 $this->register_available_addons();
168 }
169 }
170 }
171
172 /**
173 * Register addons info
174 *
175 * @throws Exception
176 * @since 1.3.0
177 */
178 private function register_addons_info() {
179 add_settings_section(
180 'info_addons',
181 '',
182 array(
183 $this,
184 'header_addons_info',
185 ),
186 'cookiebot-addons'
187 );
188 }
189
190 /**
191 * Returns header for info tab
192 *
193 * @since 1.3.0
194 */
195 public function header_addons_info() {
196 include_view( self::INFO_HEADER_TEMPLATE );
197 }
198
199 /**
200 * Register available addons
201 *
202 * @throws Exception
203 * @since 1.3.0
204 */
205 private function register_available_addons() {
206 add_settings_section(
207 'available_addons',
208 '',
209 array(
210 $this,
211 'header_available_addons',
212 ),
213 'cookiebot-addons'
214 );
215
216 /** @var Base_Cookiebot_Addon $addon */
217 foreach ( $this->settings_service->get_addons() as $addon ) {
218 if ( $addon->is_addon_installed() && $addon->is_addon_activated() ) {
219 add_settings_field(
220 $addon::OPTION_NAME,
221 get_view_html(
222 $this::EXTRA_INFO_TEMPLATE,
223 array(
224 'label' => $addon::ADDON_NAME,
225 'extra_information_lines' => $addon->get_extra_information(),
226 )
227 ),
228 array(
229 $this,
230 'available_addon_callback',
231 ),
232 'cookiebot-addons',
233 'available_addons',
234 array(
235 'addon' => $addon,
236 )
237 );
238
239 register_setting(
240 'cookiebot_available_addons',
241 'cookiebot_available_addons',
242 array(
243 $this,
244 'sanitize_cookiebot',
245 )
246 );
247 }
248 }
249 }
250
251 /**
252 * Register jetpack addon - new tab for jetpack specific settings
253 *
254 * @throws Exception
255 * @since 1.3.0
256 */
257 private function register_jetpack_addon() {
258 add_settings_section(
259 'jetpack_addon',
260 '',
261 array(
262 $this,
263 'jetpack_addons_header_callback',
264 ),
265 'cookiebot-addons'
266 );
267
268 /** @var Jetpack $addon */
269 foreach ( $this->settings_service->get_addons() as $addon ) {
270 if ( 'Jetpack' === ( new ReflectionClass( $addon ) )->getShortName() &&
271 $addon->is_addon_installed() && $addon->is_addon_activated() ) {
272 foreach ( $addon->get_widgets() as $widget ) {
273 add_settings_field(
274 $widget->get_widget_option_name(),
275 get_view_html(
276 $this::EXTRA_INFO_TEMPLATE,
277 array(
278 'label' => $widget->get_label(),
279 'extra_information_lines' => $widget->get_extra_information(),
280 )
281 ),
282 array(
283 $this,
284 'jetpack_addon_callback',
285 ),
286 'cookiebot-addons',
287 'jetpack_addon',
288 array(
289 'widget' => $widget,
290 'addon' => $addon,
291 )
292 );
293
294 register_setting( 'cookiebot_jetpack_addon', 'cookiebot_jetpack_addon' );
295 }
296 }
297 }
298 }
299
300 /**
301 * Registers unavailabe addons
302 *
303 * @throws Exception
304 * @version 2.1.3
305 * @since 1.3.0
306 */
307 private function register_unavailable_addons() {
308 add_settings_section(
309 'unavailable_addons',
310 '',
311 array(
312 $this,
313 'unavailable_addons_header_callback',
314 ),
315 'cookiebot-addons'
316 );
317
318 $addons = $this->settings_service->get_addons();
319
320 /** @var Base_Cookiebot_Addon $addon */
321 foreach ( $addons as $addon ) {
322 if ( ! $addon->is_addon_installed() || ! $addon->is_addon_activated() ) {
323 // not installed plugins
324 add_settings_field(
325 $addon::ADDON_NAME,
326 get_view_html(
327 $this::EXTRA_INFO_TEMPLATE,
328 array(
329 'label' => $addon::ADDON_NAME,
330 'extra_information_lines' => $addon->get_extra_information(),
331 )
332 ),
333 array(
334 $this,
335 'unavailable_addon_settings_field_callback',
336 ),
337 'cookiebot-addons',
338 'unavailable_addons',
339 array( 'addon' => $addon )
340 );
341 register_setting( $addon::OPTION_NAME, 'cookiebot_unavailable_addons' );
342 }
343 }
344 }
345
346 /**
347 * Jetpack tab - header
348 *
349 * @throws InvalidArgumentException
350 * @since 1.3.0
351 */
352 public function jetpack_addons_header_callback() {
353 include_view( self::JETPACK_TAB_HEADER_TEMPLATE );
354 }
355
356 /**
357 * Jetpack tab - widget callback
358 *
359 * @param $args array Information about the widget addon and the option
360 *
361 * @throws InvalidArgumentException
362 * @since 1.3.0
363 */
364 public function jetpack_addon_callback( $args ) {
365 $widget = isset( $args['widget'] ) ? $args['widget'] : null;
366 $addon = isset( $args['addon'] ) ? $args['addon'] : null;
367
368 if ( ! is_a( $widget, Base_Jetpack_Widget::class ) ) {
369 throw new InvalidArgumentException();
370 }
371
372 if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
373 throw new InvalidArgumentException();
374 }
375
376 $widget_is_enabled = $widget->is_widget_enabled();
377 $widget_placeholder_is_enabled = $widget->is_widget_placeholder_enabled();
378 $widget_default_placeholder = $widget->get_widget_default_placeholder();
379 $widget_option_name = $widget->get_widget_option_name();
380 $widget_placeholders_array = $widget->get_widget_placeholders();
381 $widget_placeholders_array_keys = array_keys( $widget_placeholders_array );
382 $first_placeholder_language = isset( $widget_placeholders_array_keys[0] )
383 ? $widget_placeholders_array_keys[0]
384 : null;
385 $site_default_languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
386 'placeholder_select_language',
387 str_replace(
388 self::LANGUAGE_DROPDOWN_OPTION_REPLACE,
389 $widget_option_name,
390 self::JETPACK_DEFAULT_LANGUAGE_DROPDOWN
391 ),
392 'site-default'
393 );
394 $widget_placeholders = array_map(
395 function (
396 $language,
397 $placeholder
398 ) use (
399 $widget_option_name,
400 $first_placeholder_language
401 ) {
402 $removable = $first_placeholder_language !== $language;
403 $option_name = str_replace(
404 array( self::LANGUAGE_DROPDOWN_OPTION_REPLACE, 'site-default' ),
405 array( $widget_option_name, $language ),
406 self::JETPACK_DEFAULT_LANGUAGE_DROPDOWN
407 );
408 $languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
409 'placeholder_select_language',
410 $option_name,
411 $language
412 );
413 return array(
414 'name' => $option_name,
415 'removable' => $removable,
416 'language' => $language,
417 'placeholder' => $placeholder,
418 'languages_dropdown_html' => $languages_dropdown_html,
419 );
420 },
421 array_keys( $widget_placeholders_array ),
422 array_values( $widget_placeholders_array )
423 );
424 $placeholder_helper = $addon->get_placeholder_helper();
425 $placeholders_html = $widget->widget_has_placeholder()
426 ? get_view_html(
427 self::PLACEHOLDER_TEMPLATE,
428 array(
429 'placeholders' => $widget_placeholders,
430 'placeholder_helper' => $placeholder_helper,
431 )
432 )
433 : get_view_html(
434 self::DEFAULT_PLACEHOLDER_TEMPLATE,
435 array(
436 'site_default_languages_dropdown_html' => $site_default_languages_dropdown_html,
437 'name' => str_replace(
438 self::LANGUAGE_DROPDOWN_OPTION_REPLACE,
439 $widget_option_name,
440 self::JETPACK_DEFAULT_LANGUAGE_DROPDOWN
441 ),
442 'default_placeholder' => $widget_default_placeholder,
443 'placeholder_helper' => $placeholder_helper,
444 )
445 );
446
447 $view_args = array(
448 'widget_option_name' => $widget_option_name,
449 'widget_is_enabled' => $widget_is_enabled,
450 'widget_cookie_types' => $widget->get_widget_cookie_types(),
451 'widget_placeholder_is_enabled' => $widget_placeholder_is_enabled,
452 'placeholders_html' => $placeholders_html,
453 );
454
455 include_view( self::JETPACK_WIDGET_TAB_TEMPLATE, $view_args );
456 }
457
458 /**
459 * Returns header for installed plugins
460 *
461 * @since 1.3.0
462 */
463 public function header_available_addons() {
464 include_view( self::AVAILABLE_TAB_HEADER_TEMPLATE );
465 }
466
467 /**
468 * Available addon callback:
469 * - checkbox to enable
470 * - select field for cookie type
471 *
472 * @param $args
473 *
474 * @throws InvalidArgumentException
475 * @since 1.3.0
476 */
477 public function available_addon_callback( $args ) {
478 $addon = isset( $args['addon'] ) ? $args['addon'] : null;
479
480 if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
481 throw new InvalidArgumentException();
482 }
483
484 $site_default_languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
485 'placeholder_select_language',
486 str_replace(
487 self::LANGUAGE_DROPDOWN_OPTION_REPLACE,
488 $addon::OPTION_NAME,
489 self::ADDONS_DEFAULT_LANGUAGE_DROPDOWN
490 ),
491 'site-default'
492 );
493 $addon_placeholders_array = $addon->get_placeholders();
494 $addon_placeholders_array_keys = array_keys( $addon_placeholders_array );
495 $first_placeholder_language = isset( $addon_placeholders_array_keys[0] )
496 ? $addon_placeholders_array_keys[0]
497 : null;
498 $addon_placeholders = array_map(
499 function (
500 $language,
501 $placeholder
502 ) use (
503 $addon,
504 $first_placeholder_language
505 ) {
506 $removable = $first_placeholder_language !== $language;
507 $option_name = str_replace(
508 array( self::LANGUAGE_DROPDOWN_OPTION_REPLACE, 'site-default' ),
509 array( $addon::OPTION_NAME, $language ),
510 self::ADDONS_DEFAULT_LANGUAGE_DROPDOWN
511 );
512 $languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
513 'placeholder_select_language',
514 $option_name,
515 $language
516 );
517 return array(
518 'name' => $option_name,
519 'removable' => $removable,
520 'language' => $language,
521 'placeholder' => $placeholder,
522 'languages_dropdown_html' => $languages_dropdown_html,
523 );
524 },
525 $addon_placeholders_array_keys,
526 $addon_placeholders_array
527 );
528 $placeholder_helper = $addon->get_placeholder_helper();
529 $addon_extra_options_html = $addon->get_extra_addon_options_html();
530 $placeholders_html = $addon->has_placeholder()
531 ? get_view_html(
532 self::PLACEHOLDER_TEMPLATE,
533 array(
534 'placeholders' => $addon_placeholders,
535 'placeholder_helper' => $placeholder_helper,
536 )
537 )
538 : get_view_html(
539 self::DEFAULT_PLACEHOLDER_TEMPLATE,
540 array(
541 'site_default_languages_dropdown_html' => $site_default_languages_dropdown_html,
542 'name' => str_replace(
543 self::LANGUAGE_DROPDOWN_OPTION_REPLACE,
544 $addon::OPTION_NAME,
545 self::ADDONS_DEFAULT_LANGUAGE_DROPDOWN
546 ),
547 'default_placeholder' => $addon::DEFAULT_PLACEHOLDER_CONTENT,
548 'placeholder_helper' => $placeholder_helper,
549 )
550 );
551
552 $view_args = array(
553 'addon_option_name' => $addon::OPTION_NAME,
554 'addon_is_enabled' => $addon->is_addon_enabled(),
555 'addon_cookie_types' => $addon->get_cookie_types(),
556 'addon_placeholder_is_enabled' => $addon->is_placeholder_enabled(),
557 'placeholders_html' => $placeholders_html,
558 'addon_extra_options_html' => $addon_extra_options_html,
559 );
560
561 include_view( self::AVAILABLE_ADDONS_TAB_TEMPLATE, $view_args );
562 }
563
564 /**
565 * Returns header for unavailable plugins
566 *
567 * @throws InvalidArgumentException
568 * @since 1.3.0
569 */
570 public function unavailable_addons_header_callback() {
571 include_view( self::UNAVAILABLE_TAB_HEADER_TEMPLATE );
572 }
573
574 /**
575 * @param $args
576 *
577 * @throws InvalidArgumentException
578 */
579 public function unavailable_addon_settings_field_callback( $args ) {
580 $addon = $args['addon'];
581
582 if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
583 throw new InvalidArgumentException();
584 }
585
586 $message = '';
587 if ( ! $addon->is_addon_installed() ) {
588 if ( is_a( $addon, Base_Cookiebot_Plugin_Addon::class ) ) {
589 $message = __( 'The plugin is not installed.', 'cookiebot' );
590 }
591 if ( is_a( $addon, Base_Cookiebot_Theme_Addon::class ) ) {
592 $message = __( 'The theme is not installed.', 'cookiebot' );
593 }
594 } elseif ( ! $addon->is_addon_activated() ) {
595 if ( is_a( $addon, Base_Cookiebot_Plugin_Addon::class ) ) {
596 $message = __( 'The plugin is not activated.', 'cookiebot' );
597 }
598 if ( is_a( $addon, Base_Cookiebot_Theme_Addon::class ) ) {
599 $message = __( 'The theme is not activated.', 'cookiebot' );
600 }
601 }
602
603 $view_args = array(
604 'message' => $message,
605 );
606 include_view( self::UNAVAILABLE_ADDONS_TAB_TEMPLATE, $view_args );
607 }
608
609 /**
610 * Build up settings page
611 *
612 * @throws InvalidArgumentException
613 * @since 1.3.0
614 */
615 public function setting_page() {
616 $addons_info_tab = new Settings_Page_Tab(
617 'addons_info',
618 esc_html__( 'Info', 'cookiebot' ),
619 'info_addons',
620 'cookiebot-addons',
621 false
622 );
623 $available_addons_tab = new Settings_Page_Tab(
624 'available_addons',
625 esc_html__( 'Available Add-ons', 'cookiebot' ),
626 'cookiebot_available_addons',
627 'cookiebot-addons'
628 );
629 $unavailable_addons_tab = new Settings_Page_Tab(
630 'unavailable_addons',
631 esc_html__( 'Unavailable Add-ons', 'cookiebot' ),
632 'cookiebot_not_installed_options',
633 'cookiebot-addons',
634 false
635 );
636 $settings_page_tabs = array(
637 $addons_info_tab,
638 $available_addons_tab,
639 $unavailable_addons_tab,
640 );
641 if ( is_plugin_active( Jetpack::PLUGIN_FILE_PATH ) ) {
642 $settings_page_tabs[] = new Settings_Page_Tab(
643 'jetpack',
644 esc_html__( 'Jetpack', 'cookiebot' ),
645 'cookiebot_jetpack_addon',
646 'cookiebot-addons'
647 );
648 }
649 $active_tab = array_reduce(
650 $settings_page_tabs,
651 function ( $active_tab, Settings_Page_Tab $settings_page_tab ) {
652 if ( ! is_null( $active_tab ) ) {
653 return $active_tab;
654 }
655 if ( $settings_page_tab->is_active() ) {
656 return $settings_page_tab;
657 }
658 return null;
659 },
660 null
661 );
662 if ( ! $active_tab ) {
663 $addons_info_tab->set_is_active( true );
664 $active_tab = $addons_info_tab;
665 }
666 $view_args = array(
667 'settings_page_tabs' => $settings_page_tabs,
668 'active_tab' => $active_tab,
669 );
670 include_view( 'admin/settings/prior-consent/page.php', $view_args );
671 }
672
673 /**
674 * Post action hook after enabling the addon on the settings page.
675 *
676 * @param $old_value
677 * @param $value
678 * @param $option_name
679 *
680 * @throws Exception
681 * @since 2.2.0
682 */
683 public function post_hook_available_addons_update_option( $value ) {
684 if ( is_array( $value ) ) {
685 foreach ( $value as $addon_option_name => $addon_settings ) {
686 if ( isset( $addon_settings['enabled'] ) ) {
687 $this->settings_service->post_hook_after_enabling_addon_on_settings_page( $addon_option_name );
688 }
689 }
690 }
691 }
692 }
693