<?php
if ( ! defined( "\x41\x42\x53\x50\x41\x54\x48" ) ) exit;  class UniPixelDB { private $wpdb; private $table_name; public function __construct() { global $wpdb; $this->wpdb = $wpdb; $this->table_name = $wpdb->prefix . "\x75\x6E\x69\x70\x69\x78\x65\x6C\x5F\x65\x76\x65\x6E\x74\x73\x5F\x73\x65\x74\x74\x69\x6E\x67\x73"; } public function create_event($platform_id, $element_ref, $event_trigger, $event_name, $event_description) { $data = [ 'platform_id' => $platform_id, 'element_ref' => $element_ref, 'event_trigger' => $event_trigger, 'event_name' => $event_name, 'event_description' => $event_description, ]; $format = ["\x25\x64", "\x25\x73", "\x25\x73", "\x25\x73", "\x25\x73"]; return $this->wpdb->insert($this->table_name, $data, $format); } public function get_event($id) {   $query = $this->wpdb->prepare( "SELECT * FROM %i WHERE id = %d", $this->table_name, $id );  return $this->wpdb->get_row($query, ARRAY_A); } public function update_event($id, $data) { $format = []; foreach ($data as $key => $value) { $format[] = is_int($value) ? "\x25\x64" : "\x25\x73"; } $where = ['id' => $id]; $where_format = ["\x25\x64"]; return $this->wpdb->update($this->table_name, $data, $where, $format, $where_format); } public function delete_event($id) { $where = ['id' => $id]; $where_format = ["\x25\x64"]; return $this->wpdb->delete($this->table_name, $where, $where_format); } public function get_events_by_platform($platform_id) {  $query = $this->wpdb->prepare( "SELECT * FROM %i WHERE platform_id = %d", $this->table_name, $platform_id );  return $this->wpdb->get_results($query, ARRAY_A); } } 