<?php
  function unipixel_handle_send_event_result( $platform_id, $element_ref, $event_trigger, $event_name, $sendServerResultInfo, $method = null, $party = null, $event_order = null ) { $log = new UniPixelLog();  $wpRemotePostResult = $sendServerResultInfo["\x72\x65\x73\x70\x6F\x6E\x73\x65"] ?? []; $wpRemotePostSendArr = $sendServerResultInfo["\x61\x72\x67\x73"] ?? []; $eventInfoPayloadArr = $sendServerResultInfo["\x70\x61\x79\x6C\x6F\x61\x64"] ?? [];  if (is_wp_error($wpRemotePostResult)) { $wpRemotePostResult = [ 'error' => $wpRemotePostResult->get_error_message(), 'response' => ['code' => -1, 'message' => $wpRemotePostResult->get_error_message()], ]; }  $responseCode = isset($wpRemotePostResult["\x72\x65\x73\x70\x6F\x6E\x73\x65"]["\x63\x6F\x64\x65"]) ? $wpRemotePostResult["\x72\x65\x73\x70\x6F\x6E\x73\x65"]["\x63\x6F\x64\x65"] : -1; $responseMessage = isset($wpRemotePostResult["\x72\x65\x73\x70\x6F\x6E\x73\x65"]["\x6D\x65\x73\x73\x61\x67\x65"]) ? $wpRemotePostResult["\x72\x65\x73\x70\x6F\x6E\x73\x65"]["\x6D\x65\x73\x73\x61\x67\x65"] : "\x55\x6E\x6B\x6E\x6F\x77\x6E";  $responseLogMessage = "Code: $responseCode, $responseMessage"; if ($method === "\x63\x6C\x69\x65\x6E\x74") { $responseLogMessage = "Client-side event, no response"; } elseif (in_array((string)$responseCode, ["\x32\x30\x30", "\x32\x30\x34"])) { $responseLogMessage = "Successful: Code: $responseCode, Ok"; } elseif ((string)$responseCode === "\x30") { $responseLogMessage = "Response logging turned off for this event"; } elseif ((string)$responseCode === "\x31") { $responseLogMessage = "Event blocked: Consent not provided"; }  $wpRemotePostSendArr_AsJson = wp_json_encode($wpRemotePostSendArr);  $log->insert_log( $platform_id, $element_ref, $event_trigger, $event_name, $responseLogMessage, $wpRemotePostSendArr_AsJson, $method, $party, $event_order );  return wp_json_encode([ 'dataSent' => $wpRemotePostSendArr, 'platformResponse' => $wpRemotePostResult, ]); } 