'. esc_html__('Note: ', 'aesirx-analytics') . '' . esc_html__('Please set Permalink Settings in WP so it is NOT set as plain.', 'aesirx-analytics') .'

') ); }, 'aesirx_analytics_plugin' ); function aesirx_analytics_warning_missing_license() { $options = get_option('aesirx_analytics_plugin_options'); if (!$options || (empty($options['license']) && $options['storage'] === "internal")) { ?> ' . esc_html__('Internal', 'aesirx-analytics') . ' '); echo aesirx_analytics_escape_html('

'.esc_html__('Internal Storage', 'aesirx-analytics').': '.esc_html__('Stores analytics data directly within the WordPress database (WP DB). This option does not offer additional control over the data, as it is part of the core website infrastructure. It may be less secure since it shares space with other WordPress data and could impact performance, especially with high traffic or large datasets.', 'aesirx-analytics').'

'); echo aesirx_analytics_escape_html('

'.esc_html__('External Storage (First-Party Server)', 'aesirx-analytics').': '.esc_html__('Stores analytics data on a dedicated first-party server, isolating the data from the WordPress database. This improves security and performance by keeping analytics data separate, reducing the load on the WordPress site. It also supports enhanced Web3 functionality, making it a more secure and efficient solution for handling data.', 'aesirx-analytics').'

'); echo ''; $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', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_domain', __('Domain (Use next format: http://example.com:1000/)', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); // using custom function to escape HTML echo aesirx_analytics_escape_html("" /* translators: %s: URL to aesir.io */ /* translators: %s: URL to aesir.io */ . sprintf(__("

You can setup 1st party server at %2\$s.

", 'aesirx-analytics'), 'https://aesirx.io/documentation/first-party-server/install-guide/1st-party', 'https://aesirx.io/documentation/first-party-server/install-guide/1st-party') ); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_clientid', esc_html__('Client ID', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); echo aesirx_analytics_escape_html(""); echo aesirx_analytics_escape_html("

".esc_html__('Description', 'aesirx-analytics').": ".sprintf(__("

Provided SSO CLIENT ID from %1\$s.

", 'aesirx-analytics'), 'https://dapp.shield.aesirx.io/licenses')."

"); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_secret', esc_html__('Client Secret', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); // using custom function to escape HTML echo aesirx_analytics_escape_html(""); echo aesirx_analytics_escape_html("

".esc_html__('Description', 'aesirx-analytics').": ".sprintf(__("

Provided SSO Client Secret from %1\$s.

", 'aesirx-analytics'), 'https://dapp.shield.aesirx.io/licenses')."

"); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_consent', __('Consent Management', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $checked = 'checked="checked"'; $storage = $options['consent'] ?? 'true'; // using custom function to escape HTML echo aesirx_analytics_escape_html(' '); echo aesirx_analytics_escape_html("

".esc_html__('Description', 'aesirx-analytics').": ".esc_html__("This option lets website owners enable or disable the consent popup. If enabled, visitors must give consent for data collection and third-party services. If disabled, tracking and analytics won't run without consent, and the popup won't be displayed.", 'aesirx-analytics')."

"); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_license', esc_html__('License', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); // using custom function to escape HTML echo aesirx_analytics_escape_html("

".esc_html__('Description', 'aesirx-analytics').": ".sprintf(__("

Sign up on the AesirX platform to obtain your Shield of Privacy ID and free license, and activate support for decentralized consent at %1\$s.

", 'aesirx-analytics'), 'https://signup.aesirx.io')."

"); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); if (is_plugin_active('wp-crontrol/wp-crontrol.php')) { add_settings_field( 'aesirx_analytics_enable_cronjob', esc_html__('Enable cronjob', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $checked = 'checked="checked"'; $storage = $options['enable_cronjob'] ?? 'true'; // using custom function to escape HTML echo aesirx_analytics_escape_html(' '); echo aesirx_analytics_escape_html('

'.esc_html__('Description', 'aesirx-analytics').': '.esc_html__('This setting allows you to capture the geographic location of users when tracking their activity. The location data can be used to improve personalized experiences or for location-based analytics.', 'aesirx-analytics').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_geo_cron_time', esc_html__('Geo cron time', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); // using custom function to escape HTML echo aesirx_analytics_escape_html(""); echo aesirx_analytics_escape_html('

'.esc_html__('Description', 'aesirx-analytics').': '.esc_html__('This function runs a cron job at set intervals ("X" time) to refresh and update the user’s location data. This ensures that location tracking remains accurate over time without requiring manual intervention.', 'aesirx-analytics').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); } add_settings_field( 'aesirx_analytics_track_ecommerce', esc_html__('Track Ecommerce', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $checked = 'checked="checked"'; $storage = $options['track_ecommerce'] ?? 'true'; // using custom function to escape HTML echo aesirx_analytics_escape_html(' '); echo aesirx_analytics_escape_html('

'.esc_html__('Description', 'aesirx-analytics').': '.esc_html__('If enabled, this feature will track key Woo events, including Add to Cart, Checkout, and Search Product. This allows website owners to gather data on shopping behaviors and optimize the eCommerce experience.', 'aesirx-analytics').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_cache_query', esc_html__('Cache Query', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); // using custom function to escape HTML echo aesirx_analytics_escape_html("

".esc_html__('Description', 'aesirx-analytics').": ".esc_html__("This option allows you to cache tracking data for a specified amount of time ('X' time). Caching improves the speed of data retrieval and reduces the load on your server by temporarily storing data before it is refreshed.", 'aesirx-analytics')."

"); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_blocking_cookies_plugins', esc_html__('AesirX Consent Shield for Third-Party Plugins ', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); $installed_plugins = get_plugins(); $active_plugins = get_option('active_plugins'); echo ''; foreach ($installed_plugins as $path => $plugin) { if ($plugin['TextDomain'] === 'aesirx-analytics' || $plugin['TextDomain'] === '' || !in_array($path, $active_plugins)) { continue; } echo ''; echo ''; echo ''; echo ''; } echo ''; echo aesirx_analytics_escape_html('

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

'); echo aesirx_analytics_escape_html(''); echo aesirx_analytics_escape_html('

'.sprintf(__("

For detailed guides, how-to videos, and API documentation, visit our Documentation Hub: %1\$s.

", 'aesirx-analytics'), 'https://aesirx.io/documentation').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_blocking_cookies', esc_html__('AesirX Consent Shield for Domain/Path-Based Blocking', 'aesirx-analytics'), function () { $options = get_option('aesirx_analytics_plugin_options', []); echo ''; if (isset($options['blocking_cookies'])) { foreach ($options['blocking_cookies'] as $field) { echo ''; echo ''; echo ''; echo ''; } } else { echo ''; echo ''; echo ''; echo ''; } echo '
'; echo aesirx_analytics_escape_html(''); echo aesirx_analytics_escape_html('

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

'); echo aesirx_analytics_escape_html(""); echo aesirx_analytics_escape_html('

'.esc_html__('Disclaimer', 'aesirx-analytics').': '.esc_html__('The AesirX Consent Shield has only just been released and still being adopted based on feedback and inputs from agencies, developers and users, if you experience any issues please contact our support.', 'aesirx-analytics').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_field( 'aesirx_analytics_blocking_cookies_mode', esc_html__('Script Blocking Options', 'aesirx-analytics'), 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 aesirx_analytics_escape_html('
'); echo aesirx_analytics_escape_html('

'.esc_html__('Description', 'aesirx-analytics').': '.esc_html__('Blocks JavaScript from third-party domains, allowing first-party scripts to run normally and keep essential site functions intact.', 'aesirx-analytics').'

'); echo aesirx_analytics_escape_html('

'); echo aesirx_analytics_escape_html('
'); echo aesirx_analytics_escape_html('

'.esc_html__('Description', 'aesirx-analytics').': '.esc_html__('Blocks JavaScript from both first-party and third-party domains for comprehensive script control, giving you the ability to block any JavaScript from internal or external sources based on user consent.', 'aesirx-analytics').'

'); }, 'aesirx_analytics_plugin', 'aesirx_analytics_settings' ); add_settings_section( 'aesirx_analytics_info', '', function () { // using custom function to escape HTML echo aesirx_analytics_escape_html("
".esc_html__("Need Help? Access Our Comprehensive Documentation Hub", 'aesirx-analytics')."
".esc_html__('ACCESS THE DOCUMENTATION HUB', 'aesirx-analytics')."
"); }, 'aesirx_analytics_info' ); }); add_action('admin_menu', function () { add_options_page( esc_html__('Aesirx Analytics', 'aesirx-analytics'), esc_html__('Aesirx Analytics', 'aesirx-analytics'), 'manage_options', 'aesirx-analytics-plugin', function () { ?>
get_bloginfo('name'), 'domain' => $domain]]; $endpoint = ($options['storage'] ?? 'internal') == 'internal' ? get_bloginfo('url') : rtrim($options['domain'] ?? '', '/'); $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); } } $clientId = $options['clientid']; $clientSecret = $options['secret']; $jwt = $options['storage'] === "external" ? 'window.env.REACT_APP_HEADER_JWT="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.aesirxClientID = "' . esc_html($clientId) . '"; window.aesirxClientSecret = "' . esc_html($clientSecret) . '"; 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= "' . esc_html($options['storage']) . '"; window.env.REACT_APP_WOOCOMMERCE_MENU= "' . esc_html($options['track_ecommerce']) . '"; ' . htmlspecialchars($jwt, ENT_NOQUOTES), ); } }); /** * 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($string) { $allowed_html = array( 'input' => array( 'type' => array(), 'id' => array(), 'name' => array(), 'value' => array(), 'class' => array(), 'placeholder' => array(), 'checked' => array(), ), 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array(), ), 'p' => array( 'class' => array(), ), 'h3' => array(), 'ul' => array( 'class' => array(), ), 'li' => array(), 'br' => array(), 'img' => array( 'src' => array(), ), 'div' => array( 'class' => array(), ), 'button' => array( 'type' => array(), 'id' => array(), 'name' => array(), 'value' => array(), 'class' => array(), ), ); return wp_kses($string, $allowed_html); } function aesirx_analytics_add_nonce_menu_item() { ?>