form_config(); ?>

📋

passenger_form_settings($forms, true); ?>

📋

passenger_form_settings($client_forms); ?>
0) { foreach ($passenger_forms as $id => $form) { $this->form_item($form, $id); } } ?>
* * * * *
form_item(); ?>
(isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_text_field', wp_unslash($_POST[$key])) : []; $post_textarea_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_textarea_field', wp_unslash($_POST[$key])) : []; $form_ids = $post_array('client_form_id'); $form_title = $post_array('client_form_title'); $types = $post_array('client_form_type'); $option = $post_array('client_form_option'); $d_value = $post_array('client_form_value'); $required = $post_array('client_form_required'); $date_value = $post_textarea_array('client_form_value_date'); if (!empty($form_ids)) { foreach ($form_ids as $key => $form_id) { $title = $form_title[$key] ?? ''; $type = $types[$key] ?? ''; if ($form_id && $title && $type) { $value = ($type === 'date') ? ($date_value[$key] ?? '') : ($d_value[$key] ?? ''); $form_infos[$form_id] = [ 'label' => $title, 'type' => $type, 'option' => $option[$key] ?? '', 'd_value' => $value, 'required' => $required[$key] ?? 'off', ]; } } } } return $form_infos; } public function save_form_config(): void { if (!check_ajax_referer('abpet_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $form_infos = $this->get_form_array(); update_option('abpet_form', $form_infos); wp_send_json_success(['msg' => __('Client Form Configuration Saved Successfully..... !! ', 'abp-event-ticket'), 'type' => 'success']); } public function import_client_form_content(): void { if (!check_ajax_referer('abpet_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $default_form = ABPET_Static::form(); $forms = ABPET_Function::get_option('abpet_form', $default_form) ?? []; $forms = is_array($forms) ? $forms : []; ob_start(); $this->passenger_form_settings($forms); $html_content = ob_get_clean(); wp_send_json_success(['html' => $html_content, 'msg' => __('Global Client Form Imported Successfully ..... !! ', 'abp-event-ticket'), 'type' => 'success']); } } new ABPET_Form(); }