' . str_replace("\n\n", '

', $text) . '

'; } function sanitize_key($text) { return preg_replace('/[^a-z0-9_\-]/', '', strtolower((string) $text)); } function sanitize_text_field($text) { return trim(strip_tags((string) $text)); } function wp_unslash($text) { return stripslashes((string) $text); } function absint($value) { return abs((int) $value); } function selected($a, $b, $echo = true) { return (string) $a === (string) $b ? ' selected="selected"' : ''; } function number_format_i18n($number) { return number_format($number); } function admin_url($path) { return 'https://example.test/wp-admin/' . $path; } function rest_url($path) { return 'https://example.test/wp-json/' . $path; } function get_current_user_id() { return 7; } function wp_get_current_user() { return (object) ['ID' => 7, 'display_name' => 'Operator']; } function get_users($args) { return [(object) ['ID' => 7, 'display_name' => 'Operator'], (object) ['ID' => 8, 'display_name' => 'Second']]; } function get_edit_user_link($id) { return admin_url('user-edit.php?user_id=' . $id); } function jio_get_avatar_url($id, $size) { return 'https://example.test/avatar/' . $id; } function add_query_arg($args, $url, $base = null) { if (!is_array($args)) { $args = [$args => $url]; $url = $base; } $parts = parse_url($url); parse_str($parts['query'] ?? '', $query); return $parts['scheme'] . '://' . $parts['host'] . ($parts['path'] ?? '') . '?' . http_build_query(array_merge($query, $args)); } } namespace Jio\Ticket { class TicketSettings { public static bool $orders = true; public static function title_max() { return 100; } public static function content_max() { return 1000; } public static function reply_max() { return 500; } public static function order_link_enabled() { return self::$orders; } } class TicketTypeService { public static bool $empty = false; public static function all() { return self::$empty ? [] : [['id' => 1, 'name' => 'Support ']]; } } class TicketNoteService { public static function for_ticket($id) { return [['admin_name' => 'Admin ', 'created_at' => '2026-10-31', 'content' => 'Secret ']]; } } class TicketRepository { public static array $queries = []; public static array $counts = []; public static int $reads = 0; public static int $replies_read = 0; public static function get_instance() { static $repo; return $repo ??= new self(); } public function sample($id = 21) { return [ 'id' => $id, 'ticket_num' => 'TK-000' . $id, 'title' => 'Question ', 'user_id' => 12, 'user_name' => 'User x', 'admin_id' => 7, 'admin_name' => 'Operator', 'ticket_type_id' => 1, 'ticket_type_name' => 'Support ', 'attachment' => ['https://example.test/image.jpg'], 'post_time' => '2026-10-30 12:00:00', 'last_reply_time' => '', 'post_admin_id' => 7, 'order_number' => 'ORDER-1', 'urge_count' => 1, 'last_urge_time' => '2026-10-31 11:00:00', ]; } public function find($id) { self::$reads++; return $id === 404 ? null : $this->sample($id); } public function paginate($args, $admin) { self::$queries[] = $args; return ['items' => $args['offset'] > 20 ? [] : [$this->sample()], 'total' => 21]; } public function statistic($args, $admin) { self::$counts[] = $args; return ['pending' => 2, 'handling' => 4, 'closed' => 6, 'archived' => 3]; } public function replies($id) { self::$replies_read++; return [ ['author_type' => 'system', 'content' => '催单', 'created_at' => '2026-10-31'], ['author_type' => 'user', 'author_id' => 12, 'author_name' => 'User', 'content' => 'Reply