';
},
3);
add_submenu_page(
'aesirx-consent-management-plugin',
'Geo-Handling',
'Geo-Handling',
'manage_options',
'aesirx-cmp-geo',
function () {
?>
';
},
4);
});
add_action('admin_enqueue_scripts', function ($hook) {
if ($hook === "aesirx-cmp_page_aesirx-cmp-geo") {
wp_register_script('aesirx_analytics_geo', plugins_url('assets/vendor/aesirx-consent-geo.js', __DIR__), array('jquery'), AESIRX_CONSENT_VERSION, true);
wp_enqueue_script('aesirx_analytics_geo');
}
if ($hook === "aesirx-cmp_page_aesirx-cmp-gpc") {
wp_register_script('aesirx_analytics_gpc', plugins_url('assets/vendor/aesirx-consent-gpc.js', __DIR__), array('jquery'), AESIRX_CONSENT_VERSION, true);
wp_enqueue_script('aesirx_analytics_gpc');
}
if ($hook === 'toplevel_page_aesirx-consent-management-plugin' || $hook === "aesirx-cmp_page_aesirx-cmp-modal") {
wp_enqueue_script('aesirx_analytics_ckeditor', 'https://api.aesirx.io/images/js/aesirx-consent-ckeditor.js', array('jquery'), true, true);
wp_enqueue_script('aesirx_analytics_select2', plugins_url('assets/vendor/aesirx-consent-select2.js', __DIR__), array('jquery'), true, true);
wp_register_script('aesirx_analytics_repeatable_fields', plugins_url('assets/vendor/aesirx-consent-repeatable-fields.js', __DIR__), array('jquery'), AESIRX_CONSENT_VERSION, true);
$translation_array = array(
'txt_shield_of_privacy' => __( 'Shield of Privacy', 'aesirx-consent' ),
'txt_you_can_revoke' => __( 'Revoke your consent for data use whenever you wish.', 'aesirx-consent' ),
'txt_manage_consent' => __( 'Manage Decentralized Consent', 'aesirx-consent' ),
'txt_revoke_consent' => __( 'Revoke Consent', 'aesirx-consent' ),
'txt_yes_i_consent' => __( 'Consent', 'aesirx-consent' ),
'txt_reject_consent' => __( 'Reject', 'aesirx-consent' ),
'txt_please_connect' => __( 'Please connect your Web3 wallet', 'aesirx-consent' ),
'txt_please_sign' => __( 'Please sign the message on your wallet twice and wait for it to be saved.', 'aesirx-consent' ),
'txt_saving' => __( 'Saving...', 'aesirx-consent' ),
'txt_please_connect_your_wallet' => __( 'Please connect to your wallet', 'aesirx-consent' ),
'txt_connecting' => __( 'Connecting', 'aesirx-consent' ),
'txt_tracking_data_privacy' => __( 'TRACKING AND DATA PRIVACY PREFERENCES', 'aesirx-consent' ),
'txt_about' => __( 'About', 'aesirx-consent' ),
'txt_detail' => __( 'Details', 'aesirx-consent' ),
'txt_change_consent' => __( 'Decentralized Consent', 'aesirx-consent' ),
'txt_manage_your_consent' => __( 'Manage Your Consent Preferences', 'aesirx-consent' ),
'txt_choose_how_we_use' => __( 'Choose how we use your data: "Reject" data collection, allow tracking ["Consent"], or use "Decentralized Consent" for more control over your personal data.', 'aesirx-consent' ),
'txt_choose_how_we_use_simple' => __( 'Choose how we use your data: "Reject" data collection, allow tracking ["Consent"].', 'aesirx-consent' ),
'txt_by_consenting' => __( 'By consenting, you allow us to collect & use your data for:', 'aesirx-consent' ),
'txt_analytics_behavioral' => __( 'Analytics & Behavioral Data: To improve our services & personalize your experience.', 'aesirx-consent' ),
'txt_form_data' => __( 'Form Data: When you contact us.', 'aesirx-consent' ),
'txt_please_note' => __( 'Please note', 'aesirx-consent' ),
'txt_we_do_not_share' => __( 'We do not share your data with third parties without your explicit consent.', 'aesirx-consent' ),
'txt_you_can_opt_in' => __( 'You can opt-in later for specific features without giving blanket consent.', 'aesirx-consent' ),
'txt_for_more_details' => __( "For more details, refer to our
privacy policy.", 'aesirx-consent' ),
'txt_benefit' => __( 'Benefits', 'aesirx-consent' ),
'txt_control_your_data' => __( "
Control your data: Choose your preferred level of data collection & tracking.", 'aesirx-consent' ),
'txt_earn_rewards' => __( "
Earn rewards: Participate in decentralized consent for privacy & rewards.", 'aesirx-consent' ),
'txt_transparent_data' => __( "
Transparent data collection practices: Understand how your data is collected & used.", 'aesirx-consent' ),
'txt_understanding_your_privacy' => __( "Understanding Your Privacy Choices", 'aesirx-consent' ),
'txt_reject_no_data' => __( "
Reject: No data will be collected or loaded except for anonymized page views & rejections. Some personalization features may be disabled.", 'aesirx-consent' ),
'txt_consent_first_third_party' => __( "
Consent: First & third-party tracking data will be collected to enhance your experience.", 'aesirx-consent' ),
'txt_decentralizered_consent_choose' => __( "
Decentralized Consent: Choose Decentralized Wallets or Decentralized Wallet + Shield of Privacy. Both options let you manage & revoke consent on-site or through AesirX dApp, plus earn rewards from digital marketing activities.", 'aesirx-consent' ),
'txt_our_commitment_in_action' => __( "Our Commitment in Action", 'aesirx-consent' ),
'txt_private_protection' => __( "
Privacy Protection: Users have full control over their data, ensuring maximum privacy.", 'aesirx-consent' ),
'txt_enables_compliance' => __( "
Enables Compliance: Using Shield of Privacy (SoP) ensures compliance with GDPR, CCPA, ePrivacy Directive, & other data protection regulations.", 'aesirx-consent' ),
'txt_proactive_protection' => __( "
Proactive Protection: We enhance privacy measures to safeguard your data integrity.", 'aesirx-consent' ),
'txt_flexible_consent' => __( "
Flexible Consent: You can withdraw your consent anytime on-site or via our
dApp (Decentralized Application).", 'aesirx-consent' ),
'txt_learn_more' => __( "
Learn More: Discover our approach to data processing in our
Privacy Policy.", 'aesirx-consent' ),
'txt_for_business' => __( "
For Businesses: Enhance trust, secure user identities, & prevent breaches.", 'aesirx-consent' ),
'txt_more_info_at' => __( "More info at
https://shield.aesirx.io.", 'aesirx-consent' ),
'txt_select_your_preferred' => __( "Select your preferred decentralized consent option:", 'aesirx-consent' ),
'txt_decentralized_wallet' => __( "Decentralized Consent", 'aesirx-consent' ),
'txt_decentralized_wallet_will_be_loaded' => __( "Decentralized consent will be loaded", 'aesirx-consent' ),
'txt_both_first_party_third_party' => __( "Both first-party & third-party tracking data will be activated.", 'aesirx-consent' ),
'txt_all_consented_data_will_be_collected' => __( "All consented data will be collected.", 'aesirx-consent' ),
'txt_users_can_revoke' => __( "Users can revoke consent on-site at any time.", 'aesirx-consent' ),
'txt_decentralized_wallet_shield' => __( "Decentralized Consent + Shield of Privacy", 'aesirx-consent' ),
'txt_users_can_revoke_dapp' => __( "Users can revoke consent on-site or from the AesirX dApp at any time.", 'aesirx-consent' ),
'txt_users_can_earn' => __( "Users can earn rewards from digital marketing activities.", 'aesirx-consent' ),
'txt_continue' => __( "Continue", 'aesirx-consent' ),
'txt_back' => __( "Back", 'aesirx-consent' ),
'txt_you_have_chosen' => __( "You've chosen to reject data collection:", 'aesirx-consent' ),
'txt_only_anonymized' => __( "Only anonymized page views & limited features will be available. To access all website features, including personalized content & enhanced functionality, please choose an option:", 'aesirx-consent' ),
'txt_consent_allow_data' => __( "
Consent: Allow data collection for analytics, form data (when you contact us), & behavioral & event tracking, with the option to opt-in for specific features.", 'aesirx-consent' ),
'txt_decentralized_consent_allow_data' => __( "
Decentralized Consent: Allow data collection for analytics, form data (when you contact us), & behavioral & event tracking, with the option to revoke consent, opt-in for specific features, & earn rewards from digital marketing activities.", 'aesirx-consent' ),
'txt_you_can_revoke_on_the_site' => __( "You can revoke consent on the site or any explicit opt-in consent, such as payment processing, at any time", 'aesirx-consent' ),
'txt_revoke_opt_in' => __( "Revoke Opt-In Consent", 'aesirx-consent' ),
'txt_revoke_opt_in_payment' => __( "Revoke Opt-In Consent for Payment Processing", 'aesirx-consent' ),
'txt_revoke_opt_in_advisor' => __( "Revoke Opt-In Consent for AesirX Privacy Advisor AI", 'aesirx-consent' ),
'txt_revoke_consent_for_the_site' => __( "Revoke Consent for the site", 'aesirx-consent' ),
'txt_consent_nanagement' => __( "Consent Management", 'aesirx-consent' ),
'txt_details' => __( "Details", 'aesirx-consent' )
);
wp_localize_script( 'aesirx_analytics_repeatable_fields', 'aesirx_analytics_translate', $translation_array );
wp_enqueue_script('aesirx_analytics_repeatable_fields');
}
if ($hook === 'aesirx-cmp_page_aesirx-consents' || $hook === 'aesirx-bi_page_aesirx-consents' || $hook === 'aesirx-cmp_page_aesirx-consents-advance') {
$options = get_option('aesirx_analytics_plugin_options');
$protocols = ['http://', 'https://'];
$domain = str_replace($protocols, '', site_url());
$streams = [['name' => get_bloginfo('name'), 'domain' => $domain]];
$origin = wp_parse_url( home_url(), PHP_URL_SCHEME ) . '://' . wp_parse_url( home_url(), PHP_URL_HOST );
$endpoint = $origin;
$manifest = json_decode(
file_get_contents(plugin_dir_path(__DIR__) . 'assets-manifest.json', true)
);
if ($manifest->entrypoints->bi->assets) {
foreach ($manifest->entrypoints->bi->assets->js as $js) {
wp_enqueue_script('aesrix_bi' . md5($js), plugins_url($js, __DIR__), false, '1.0', true);
}
}
wp_register_script( 'aesrix_bi_window', '', array(), '1.0', false );
wp_enqueue_script('aesrix_bi_window');
wp_add_inline_script(
'aesrix_bi_window',
'window.env = {};
window.env.REACT_APP_BI_ENDPOINT_URL = "' . esc_url($endpoint) . '";
window.env.REACT_APP_DATA_STREAM = JSON.stringify(' . wp_json_encode($streams) . ');
window.env.PUBLIC_URL= "' . esc_url(plugin_dir_url(__DIR__)) . '";
window.env.STORAGE= "internal";',
);
}
});
/**
* Custom escape function for Aesirx Analytics.
* Escapes HTML attributes in a string using a specified list of allowed HTML elements and attributes.
*
* @param string $string The input string to escape HTML attributes from.
* @return string The escaped HTML string.
*/
function aesirx_analytics_escape_html() {
$allowed_html = array(
'input' => array(
'type' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'class' => array(),
'checked' => array(),
'placeholder' => array(),
),
'select' => array(
'id' => array(),
'name' => array(),
'class' => array(),
'multiple' => array(),
),
'option' => array(
'name' => array(),
'value' => array(),
'class' => array(),
'selected' => array(),
'disabled' => array(),
'hidden' => array(),
),
'strong' => array(),
'a' => array(
'href' => array(),
'target' => array(),
'class' => array(),
'download' => array(),
),
'p' => array(
'class' => array(),
'span' => array(
'class' => array(),
),
),
'span' => array(
'class' => array(),
),
'h3' => array(
'class' => array(),
),
'h4' => array(
'class' => array(),
),
'ul' => array(
'class' => array(),
),
'li' => array(),
'br' => array(),
'label' => array(
'for' => array(),
'class' => array(),
),
'img' => array(
'src' => array(),
'class' => array(),
'width' => array(),
'height' => array(),
),
'iframe' => array(
'src' => array(),
),
'div' => array(
'id' => array(),
'class' => array(),
),
'button' => array(
'type' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'class' => array(),
),
'textarea' => array(
'id' => array(),
'class' => array(),
'rows' => array(),
'cols' => array(),
'readonly' => array(),
),
'code' => array(
'class' => array(),
)
);
return $allowed_html;
}
function aesirx_generate_gpc_json() {
$policy_url = get_option('aesirx_privacy_policy_url', get_site_url() . "/privacy-policy");
$gpc_data = array(
"gpc" => true,
"policy_url" => esc_url($policy_url)
);
return json_encode($gpc_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
}
function aesirx_analytics_allow_data_protocol($protocols) {
$protocols[] = 'data'; // Add "data" to the allowed protocols list
return $protocols;
}
add_filter('kses_allowed_protocols', 'aesirx_analytics_allow_data_protocol');