", aesirx_analytics_escape_html()); $manifest = json_decode( file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true) ); if ($manifest->entrypoints->plugin->assets) { foreach ($manifest->entrypoints->plugin->assets->js as $js) { wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true); } } }, 'aesirx_analytics_plugin' ); add_settings_field( 'aesirx_analytics_consent_template', __('Choose your tailored template', 'aesirx-consent'), function () { $template = get_option('aesirx_consent_modal_plugin_options', []); $datastream_template = $template['datastream_template'] ?? ''; // using custom function to escape HTML echo "'; }, 'aesirx_consent_modal_plugin', 'aesirx_consent_modal_settings', [ 'class' => 'aesirx_analytics_consent_template_row', ] ); add_settings_field( 'aesirx_analytics_plugin_options_datastream_gtag_id', esc_html__('Gtag ID', 'aesirx-consent'), function () { $options = get_option('aesirx_analytics_plugin_options',[]); echo "
"; echo wp_kses("", aesirx_analytics_escape_html()); echo wp_kses("
".sprintf(__("
Remember to include the explicit purpose (e.g., analytics, marketing) in the consent text to inform users why GTM is being used.
", 'aesirx-consent'))."
", aesirx_analytics_escape_html()); echo "
"; }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_plugin_options_datastream_gtag_id_row', ] ); add_settings_field( 'aesirx_analytics_plugin_options_datastream_gtm_id', esc_html__('GTM ID', 'aesirx-consent'), function () { $options = get_option('aesirx_analytics_plugin_options',[]); echo '
'; echo wp_kses("", aesirx_analytics_escape_html()); echo wp_kses("
".sprintf(__("
Remember to include the explicit purpose (e.g., analytics, marketing) in the consent text to inform users why GTM is being used.
", 'aesirx-consent'))."
", aesirx_analytics_escape_html()); echo '
'; }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_plugin_options_datastream_gtm_id_row', ] ); add_settings_field( 'aesirx_analytics_plugin_options_datastream_gtm_id_general', esc_html__('GTM General', 'aesirx-consent'), function () { echo wp_kses('

'.esc_html__('To configure, input your Google Tag Manager Gtag ID & GTM ID in the designated fields. Once set up, Google Tag Manager will only load after the user provides consent.', 'aesirx-consent').'

', aesirx_analytics_escape_html()); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_plugin_options_datastream_gtm_id_general', ] ); add_settings_section( 'aesirx_consent_modal_settings', 'Consent Modal Management', function () { $manifest = json_decode( file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true) ); if ($manifest->entrypoints->plugin->assets) { foreach ($manifest->entrypoints->plugin->assets->js as $js) { wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true); } } }, 'aesirx_consent_modal_plugin' ); add_settings_field( 'aesirx_consent_modal_datastream_consent', esc_html__('Customize Consent Management Text ', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_modal_plugin_options', []); $datastream_consent = $options['datastream_consent'] ?? ''; $decodedHtml = html_entity_decode($datastream_consent, ENT_QUOTES, 'UTF-8'); echo wp_kses('', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_modal_plugin', 'aesirx_consent_modal_settings', [ 'class' => 'aesirx_consent_modal_datastream_consent_row', ] ); add_settings_field( 'aesirx_consent_modal_datastream_cookie', esc_html__('Customize Cookie Declaration Text', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_modal_plugin_options', []); $datastream_cookie = $options['datastream_cookie'] ?? ''; $decodedHtml = html_entity_decode($datastream_cookie, ENT_QUOTES, 'UTF-8'); echo wp_kses('', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_modal_plugin', 'aesirx_consent_modal_settings', [ 'class' => 'aesirx_consent_modal_datastream_cookie_row', ] ); add_settings_field( 'aesirx_consent_modal_datastream_detail', esc_html__('Customize Details Text ', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_modal_plugin_options', []); $datastream_detail = $options['datastream_detail'] ?? ''; $decodedHtml = html_entity_decode($datastream_detail, ENT_QUOTES, 'UTF-8'); echo wp_kses('', aesirx_analytics_escape_html()); echo wp_kses('
'.$decodedHtml.'
'.'
', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_modal_plugin', 'aesirx_consent_modal_settings', [ 'class' => 'aesirx_consent_modal_datastream_detail_row', ] ); add_settings_field( 'aesirx_consent_modal_datastream_reject', esc_html__('Customize Reject Text ', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_modal_plugin_options', []); $datastream_reject = $options['datastream_reject'] ?? ''; $decodedHtml = html_entity_decode($datastream_reject, ENT_QUOTES, 'UTF-8'); echo wp_kses('', aesirx_analytics_escape_html()); echo wp_kses('
'.$decodedHtml.'
'.'
', aesirx_analytics_escape_html()); echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_modal_plugin', 'aesirx_consent_modal_settings', [ 'class' => 'aesirx_consent_modal_datastream_reject_row', ] ); add_settings_field( 'aesirx_analytics_blocking_cookies_plugins', esc_html__('AesirX Consent Shield for Third-Party Plugins ', 'aesirx-consent'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $installed_plugins = aesirx_get_installed_plugins(); $active_plugins = get_option('active_plugins'); echo wp_kses('

'.esc_html__('Blocks selected third-party plugins from loading until user consent is given.', 'aesirx-consent').'

', aesirx_analytics_escape_html()); echo wp_kses("", aesirx_analytics_escape_html()); echo ''; echo wp_kses(" ", aesirx_analytics_escape_html()); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_blocking_cookies_plugins_row', ] ); add_settings_field( 'aesirx_analytics_blocking_cookies', esc_html__('AesirX Consent Shield for Domain/Path-Based Blocking', 'aesirx-consent'), function () { $options = get_option('aesirx_analytics_plugin_options', []); echo wp_kses('

'.esc_html__('Removes scripts matching specified domains or paths from the browser until user consent is given.', 'aesirx-consent').'

', aesirx_analytics_escape_html()); echo ''; echo wp_kses(" ", aesirx_analytics_escape_html()); echo wp_kses(" ", aesirx_analytics_escape_html()); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_blocking_cookies_row', ] ); add_settings_field( 'aesirx_analytics_blocking_cookies_mode', esc_html__('Script Blocking Options', 'aesirx-consent'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $checked = 'checked="checked"'; $mode = $options['blocking_cookies_mode'] ?? '3rd_party'; // using custom function to escape HTML echo wp_kses('

'.esc_html__('Configure how JavaScript is blocked based on user consent preferences.', 'aesirx-consent').'

', aesirx_analytics_escape_html()); echo wp_kses('
', aesirx_analytics_escape_html()); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings', [ 'class' => 'aesirx_analytics_blocking_cookies_mode_row', ] ); add_settings_section( 'aesirx_consent_gpc_settings', 'Consent Modal Management', function () { $manifest = json_decode( file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true) ); if ($manifest->entrypoints->plugin->assets) { foreach ($manifest->entrypoints->plugin->assets->js as $js) { wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true); } } }, 'aesirx_consent_gpc_plugin' ); add_settings_field( 'aesirx_consent_config_consent', esc_html__('Configurable Consent Logic', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_gpc_plugin_options', []); $checked = 'checked="checked"'; $mode = $options['gpc_consent'] ?? 'opt-in'; // using custom function to escape HTML echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_gpc_plugin', 'aesirx_consent_gpc_settings', [ 'class' => 'aesirx_consent_gpc_consent_row', ] ); add_settings_field( 'aesirx_consent_config_consent_donotsell', esc_html__('Do not sell or share options', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_gpc_plugin_options', []); $checked = 'checked="checked"'; $mode = $options['gpc_consent_donotsell'] ?? 'yes'; // using custom function to escape HTML echo wp_kses(' ', aesirx_analytics_escape_html()); }, 'aesirx_consent_gpc_plugin', 'aesirx_consent_gpc_settings', [ 'class' => 'aesirx_consent_gpc_consent_donotsell_row', ] ); add_settings_field( 'aesirx_analytics_gpc', esc_html__('GPC Compliance', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_gpc_plugin_options', []); $checked = 'checked="checked"'; $mode = $options['gpc_support'] ?? 'yes'; // using custom function to escape HTML echo wp_kses('
', aesirx_analytics_escape_html()); $json_content = aesirx_generate_gpc_json(); $policy_url = get_option('aesirx_privacy_policy_url', get_site_url() . "/privacy-policy"); echo wp_kses('

'.esc_html__('To comply with Global Privacy Control (GPC), please download and upload the following file:', 'aesirx-consent').'

', aesirx_analytics_escape_html()); echo wp_kses('
'.$json_content.'
', aesirx_analytics_escape_html()); echo wp_kses("
Download gpc.json
", aesirx_analytics_escape_html()); echo wp_kses('

'.esc_html__('Upload Instructions:', 'aesirx-consent').'

', aesirx_analytics_escape_html()); echo wp_kses('
  1. '.esc_html__('Download the gpc.json file.', 'aesirx-consent').'
  2. '.esc_html__('Connect to your website via FTP or File Manager.', 'aesirx-consent').'
  3. '.sprintf(__('Upload the file to: /public_html/.well-known/gpc.json', 'aesirx-consent')).'
  4. ' . sprintf( /* translators: 1: URL to the gpc.json file (href attribute), 2: URL displayed as link text. */ __( 'Ensure the file is accessible by visiting: %2$s', 'aesirx-consent' ), esc_url( get_site_url() . '/.well-known/gpc.json' ), esc_html( get_site_url() . '/.well-known/gpc.json' ) ) . '
', aesirx_analytics_escape_html()); echo wp_kses('

Privacy Policy Update

', aesirx_analytics_escape_html()); echo wp_kses('

You must update your Privacy Policy to reflect GPC compliance. Below is a suggested update:

', aesirx_analytics_escape_html()); echo wp_kses("
Global Privacy Control (GPC)
Compliance Our website respects the Global Privacy Control (GPC) signal. If your browser sends a GPC signal, we automatically disable non-essential cookies and opt you out of data sharing. For more details, please visit our Privacy Policy: $policy_url.
", aesirx_analytics_escape_html()); }, 'aesirx_consent_gpc_plugin', 'aesirx_consent_gpc_settings', [ 'class' => 'aesirx_analytics_gpc_row', ] ); add_settings_section( 'aesirx_consent_geo_settings', 'Consent GEO', function () { $manifest = json_decode( file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true) ); if ($manifest->entrypoints->plugin->assets) { foreach ($manifest->entrypoints->plugin->assets->js as $js) { wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true); } } }, 'aesirx_consent_geo_plugin' ); add_settings_field( 'aesirx_consent_geo_handling', esc_html__('Enable Geo-handling for Consent Mode', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_geo_plugin_options', []); $checked = 'checked="checked"'; $mode = $options['geo_handling'] ?? 'yes'; // using custom function to escape HTML echo wp_kses('
', aesirx_analytics_escape_html()); }, 'aesirx_consent_geo_plugin', 'aesirx_consent_geo_settings', [ 'class' => 'aesirx_consent_geo_handling_row', ] ); add_settings_field( 'aesirx_consent_geo_rules', esc_html__('Geo-Based Consent Rules', 'aesirx-consent'), function () { $options = get_option('aesirx_consent_geo_plugin_options', []); // Define your option values $languages = [ 'en-US' => 'en-US', 'ar-SA' => 'ar-SA', 'cs-CZ' => 'cs-CZ', 'el-GR' => 'el-GR', 'es-ES' => 'es-ES', 'de-DE' => 'de-DE', 'da-DK' => 'da-DK', 'fr-FR' => 'fr-FR', 'fi-FI' => 'fi-FI', 'he-IL' => 'he-IL', 'hu-HU' => 'hu-HU', 'id-ID' => 'id-ID', 'it-IT' => 'it-IT', 'ja-JP' => 'ja-JP', 'ko-KR' => 'ko-KR', 'nl-NL' => 'nl-NL', 'no-NO' => 'no-NO', 'pl-PL' => 'pl-PL', 'pt-PT' => 'pt-PT', 'ms-MY' => 'ms-MY', 'ro-RO' => 'ro-RO', 'sv-SE' => 'sv-SE', 'th-TH' => 'th-TH', 'tr-TR' => 'tr-TR', 'vi-VN' => 'vi-VN', ]; $timezones = [ 'america/new_york' => 'America/New_York', // en-US 'asia/riyadh' => 'Asia/Riyadh', // ar-SA 'europe/prague' => 'Europe/Prague', // cs-CZ 'europe/athens' => 'Europe/Athens', // el-GR 'europe/madrid' => 'Europe/Madrid', // es-ES 'europe/berlin' => 'Europe/Berlin', // de-DE 'europe/copenhagen' => 'Europe/Copenhagen', // da-DK 'europe/paris' => 'Europe/Paris', // fr-FR 'europe/helsinki' => 'Europe/Helsinki', // fi-FI 'asia/jerusalem' => 'Asia/Jerusalem', // he-IL 'europe/budapest' => 'Europe/Budapest', // hu-HU 'asia/jakarta' => 'Asia/Jakarta', // id-ID 'europe/rome' => 'Europe/Rome', // it-IT 'asia/tokyo' => 'Asia/Tokyo', // ja-JP 'asia/seoul' => 'Asia/Seoul', // ko-KR 'europe/amsterdam' => 'Europe/Amsterdam', // nl-NL 'europe/oslo' => 'Europe/Oslo', // no-NO 'europe/warsaw' => 'Europe/Warsaw', // pl-PL 'europe/lisbon' => 'Europe/Lisbon', // pt-PT 'asia/kuala_lumpur' => 'Asia/Kuala_Lumpur', // ms-MY 'europe/bucharest' => 'Europe/Bucharest', // ro-RO 'europe/stockholm' => 'Europe/Stockholm', // sv-SE 'asia/bangkok' => 'Asia/Bangkok', // th-TH 'europe/istanbul' => 'Europe/Istanbul', // tr-TR 'asia/ho_chi_minh' => 'Asia/Ho_Chi_Minh', // vi-VN 'asia/saigon' => 'Asia/Saigon', // vi-VN ]; $logics = [ 'and' => 'AND', 'or' => 'OR', ]; $modes = [ 'opt-in' => 'Opt-In', 'opt-out' => 'Opt-Out', ]; $overrides = [ 'yes' => 'Yes', 'no' => 'No', ]; function aesirx_analytics_render_select($name, $values, $selected = '', $placeholder = null, $allowPlaceholder = false) { $html = "'; return wp_kses($html, aesirx_analytics_escape_html()); } if (empty($options['geo_rules_language'])) { $options['geo_rules_language'] = array_keys($languages); $options['geo_rules_timezone'] = array_fill(0, count($languages), ''); // empty timezone $options['geo_rules_logic'] = array_fill(0, count($languages), 'and'); $options['geo_rules_consent_mode'] = array_fill(0, count($languages), ''); // empty consent mode $options['geo_rules_override'] = array_fill(0, count($languages), 'no'); update_option('aesirx_consent_geo_plugin_options', $options); } echo ''; echo wp_kses( "", aesirx_analytics_escape_html() ); }, 'aesirx_consent_geo_plugin', 'aesirx_consent_geo_settings', ['class' => 'aesirx_consent_geo_rules_row'] ); add_settings_section( 'aesirx_consent_info', '', function () { // using custom function to escape HTML echo wp_kses(" ", aesirx_analytics_escape_html()); }, 'aesirx_consent_info' ); add_settings_section( 'aesirx_consent_scanner', '', function () { // using custom function to escape HTML $urlScanner = esc_url(add_query_arg('page', 'aesirx-cmp-scanner', get_admin_url() . 'admin.php')); echo wp_kses(" ", aesirx_analytics_escape_html()); }, 'aesirx_consent_scanner' ); add_settings_section( 'aesirx_consent_ai_settings', '', function () { $manifest = json_decode( file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true) ); if ($manifest->entrypoints->plugin->assets) { foreach ($manifest->entrypoints->plugin->assets->js as $js) { wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true); } } }, 'aesirx_consent_ai_plugin' ); }); add_action('admin_menu', function () { add_menu_page( 'AesirX CMP', 'AesirX CMP', 'manage_options', 'aesirx-consent-management-plugin', function () { ?>

AesirX Consent Management

'; echo ''; }, plugins_url('assets/images-plugin/AesirX_BI_icon.png', __DIR__), 75 ); add_submenu_page( 'aesirx-consent-management-plugin', 'Consent Shield', 'Consent Shield', 'manage_options', 'aesirx-consent-management-plugin', function () { ?>

Consent Modal Management