PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.1
ووسلام – همگام سازی ووکامرس و باسلام v1.10.1
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
sync-basalam / includes / Actions / Controller / TicketActions / CreateTicket.php

CreateTicket.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.1, at includes/Actions/Controller/TicketActions/CreateTicket.php

37 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Actions\Controller\TicketActions;
4
5 use SyncBasalam\Actions\Controller\ActionController;
6 use SyncBasalam\Services\TicketServiceManager;
7 use SyncBasalam\Utilities\TicketExtraInfoFormatter;
8
9 defined('ABSPATH') || exit;
10
11 class CreateTicket extends ActionController
12 {
13 public function __invoke()
14 {
15 $ticketManager = new TicketServiceManager();
16
17 $title = isset($_POST['title']) ? \sanitize_text_field(\wp_unslash($_POST['title'])) : null;
18 $subject = isset($_POST['subject']) ? \sanitize_text_field(\wp_unslash($_POST['subject'])) : null;
19 $content = isset($_POST['content']) ? \sanitize_textarea_field(\wp_unslash($_POST['content'])) : '';
20 $content = TicketExtraInfoFormatter::appendFromRequest($content, $_POST);
21
22 $fileIds = isset($_POST['file_ids']) && is_array($_POST['file_ids'])
23 ? array_map('intval', $_POST['file_ids'])
24 : [];
25
26 $result = $ticketManager->createTicket($title, $subject, $content, $fileIds);
27 if (isset($result['body'])) $ticket = json_decode($result['body'], true);
28 else {
29 wp_die('خطایی در ارسال تیکت رخ داده است. لطفا �
30 جددا تلاش کنید.');
31 }
32
33 wp_safe_redirect(admin_url("admin.php?page=sync_basalam_ticket&ticket_id=" . $ticket['data']['id']));
34 exit();
35 }
36 }
37