<?php
 add_action('wp_ajax_unipixel_update_consent_settings', "\x75\x6E\x69\x70\x69\x78\x65\x6C\x5F\x68\x61\x6E\x64\x6C\x65\x5F\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x75\x70\x64\x61\x74\x65"); function unipixel_handle_consent_update() { check_ajax_referer("\x75\x6E\x69\x70\x69\x78\x65\x6C\x5F\x61\x6A\x61\x78\x5F\x6E\x6F\x6E\x63\x65", "\x6E\x6F\x6E\x63\x65"); $consent_honour = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x68\x6F\x6E\x6F\x75\x72"]) ? intval($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x68\x6F\x6E\x6F\x75\x72"]) : 0; $consent_ui = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x75\x69"]) ? sanitize_text_field($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x75\x69"]) : "\x75\x6E\x69\x70\x69\x78\x65\x6C"; $consent_ui_style = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x75\x69\x5F\x73\x74\x79\x6C\x65"]) ? intval($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x75\x69\x5F\x73\x74\x79\x6C\x65"]) : 1; $consent_locale_override = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x6C\x6F\x63\x61\x6C\x65\x5F\x6F\x76\x65\x72\x72\x69\x64\x65"]) ? sanitize_text_field(wp_unslash($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x6C\x6F\x63\x61\x6C\x65\x5F\x6F\x76\x65\x72\x72\x69\x64\x65"])) : "\x61\x75\x74\x6F"; if ($consent_locale_override !== "\x61\x75\x74\x6F" && !unipixel_consent_is_valid_locale($consent_locale_override)) { $consent_locale_override = 'auto'; } $consent_show_reject = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x73\x68\x6F\x77\x5F\x72\x65\x6A\x65\x63\x74"]) ? intval($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x73\x68\x6F\x77\x5F\x72\x65\x6A\x65\x63\x74"]) : 0; $consent_popup_style = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x70\x6F\x70\x75\x70\x5F\x73\x74\x79\x6C\x65"]) ? unipixel_consent_normalise_popup_style(sanitize_text_field(wp_unslash($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x70\x6F\x70\x75\x70\x5F\x73\x74\x79\x6C\x65"]))) : "\x63\x65\x6E\x74\x72\x65\x64";  $consent_force_choice = isset($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x66\x6F\x72\x63\x65\x5F\x63\x68\x6F\x69\x63\x65"]) ? intval($_POST["\x63\x6F\x6E\x73\x65\x6E\x74\x5F\x66\x6F\x72\x63\x65\x5F\x63\x68\x6F\x69\x63\x65"]) : 0; $newOptions = array( 'consent_honour' => $consent_honour, 'consent_ui' => $consent_ui, 'consent_ui_style' => $consent_ui_style, 'consent_locale_override' => $consent_locale_override, 'consent_show_reject' => $consent_show_reject, 'consent_popup_style' => $consent_popup_style, 'consent_force_choice' => $consent_force_choice, ); $defaults = array( 'consent_honour' => 0, 'consent_ui' => "\x75\x6E\x69\x70\x69\x78\x65\x6C", 'consent_ui_style' => 1, 'consent_locale_override' => "\x61\x75\x74\x6F", 'consent_show_reject' => 0, 'consent_popup_style' => "\x63\x65\x6E\x74\x72\x65\x64", 'consent_force_choice' => 1, ); $current_options = get_option('unipixel_consent_settings', $defaults); if ($current_options === $newOptions) { wp_send_json_success(['message' => "\x4E\x6F\x20\x63\x68\x61\x6E\x67\x65\x73\x20\x65\x6E\x74\x65\x72\x65\x64"]); return; } $updated = update_option('unipixel_consent_settings', $newOptions); unipixel_metric_log( "\x43\x6F\x6E\x73\x65\x6E\x74\x20\x53\x65\x74\x74\x69\x6E\x67\x73\x20\x55\x70\x64\x61\x74\x65\x64", "\x43\x6F\x6E\x73\x65\x6E\x74\x20\x50\x72\x65\x66\x65\x72\x65\x6E\x63\x65\x73", $newOptions ); if ($updated) { wp_send_json_success(['message' => "\x43\x6F\x6E\x73\x65\x6E\x74\x20\x73\x65\x74\x74\x69\x6E\x67\x73\x20\x75\x70\x64\x61\x74\x65\x64\x20\x73\x75\x63\x63\x65\x73\x73\x66\x75\x6C\x6C\x79"]); } else { wp_send_json_error(['message' => 'Failed to update consent settings']); } } 