public static function process_email_form() { $post = array_map('stripslashes_deep', $_POST); $step = absint($post['step']); $id = isset($post['id']) ? $post['id'] : ''; $data = array(); $new = empty($id) || isset($_POST['new']) && $_POST['new'] == 1 ? '&new=1' : ''; if ($step == 1) { $data['name'] = $post['name']; $data['email_type'] = $post['email_type']; } elseif ($step == 2) { $data['always_send'] = isset($post['always_send']) ? $post['always_send'] : 0; $data['meta'] = $post['meta']; $data['subject'] = $post['email_subject']; $data['interval_num'] = $post['interval']; $data['interval_duration'] = $post['interval_duration']; $data['interval_type'] = isset($post['interval_type']) ? $post['interval_type'] : ''; $data['send_date'] = $post['send_date']; $data['send_date_hour'] = $post['send_date_hour']; $data['send_date_minute'] = $post['send_date_minute']; $data['tracking_on'] = isset($post['tracking_on']) ? $post['tracking_on'] : 0; $data['tracking_code'] = $post['tracking']; $data['product_id'] = isset($post['product_id']) ? $post['product_id'] : 0; $data['category_id'] = isset($post['category_id']) ? $post['category_id'] : 0; } elseif ($step == 3) { $data['message'] = $post['email_message']; $data['meta'] = $post['meta']; } $data = apply_filters('fue_pre_save_data', $data, $post); $id = FUE::save_email($data, $id); $step++; $total_steps = apply_filters('fue_form_total_steps', 3); if ($step > $total_steps) { // process is complete $save_type = empty($new) ? 'updated' : 'created'; wp_redirect('admin.php?page=followup-emails&' . $save_type . '=1'); } else { // load next step $params = array('step' => $step, 'id' => $id); wp_redirect('admin.php?page=followup-emails-form&step=' . $step . '&id=' . $id . $new); } exit; }