function __construct($id = '', $status = 'any', $output = 'OBJECT')
 {
     $continue = true;
     if ($status !== 'any') {
         if (get_post_status($id) == $status) {
             $continue = true;
         } else {
             $continue = false;
         }
     }
     if ($continue) {
         $this->id = $id;
         $this->output = $output;
         $this->details = get_post($this->id, $this->output);
         $tickets = new TC_Tickets();
         $fields = $tickets->get_ticket_fields();
         if (isset($this->details)) {
             if (!empty($fields)) {
                 foreach ($fields as $field) {
                     if (!isset($this->details->{$field['field_name']})) {
                         $this->details->{$field['field_name']} = get_post_meta($this->id, $field['field_name'], true);
                     }
                 }
             }
         }
     } else {
         $this->id = null;
     }
 }
<?php

$tickets = new TC_Tickets();
$page = $_GET['page'];
if (isset($_GET['restore_ticket_types'])) {
    $ticket_types = new TC_Tickets();
    $ticket_types->restore_all_ticket_types();
}
if (isset($_POST['add_new_ticket'])) {
    if (check_admin_referer('save_ticket')) {
        if (current_user_can('manage_options') || current_user_can('save_ticket_cap')) {
            $tickets->add_new_ticket();
            $message = __('Ticket Type data has been saved successfully.', 'tc');
        } else {
            $message = __('You do not have required permissions for this action.', 'tc');
        }
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
    $ticket = new TC_Ticket($_GET['ID']);
    $post_id = (int) $_GET['ID'];
}
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    if (!isset($_POST['_wpnonce'])) {
        check_admin_referer('delete_' . $_GET['ID']);
        if (current_user_can('manage_options') || current_user_can('delete_ticket_cap')) {
            $ticket = new TC_Ticket((int) $_GET['ID']);
            $ticket->delete_ticket();
            $message = __('Ticket Type has been successfully deleted.', 'tc');
        } else {
            $message = __('You do not have required permissions for this action.', 'tc');