admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('sistema_arte_nonce') ]); } add_action('wp_enqueue_scripts', 'sistema_arte_enqueue_assets'); // Register shortcode function sistema_arte_shortcode($atts) { // Start output buffering ob_start(); // Load config variables global $apiBase, $token, $projectId; // Process form submission $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sistema_arte_nonce']) && wp_verify_nonce($_POST['sistema_arte_nonce'], 'sistema_arte_nonce')) { $title = isset($_POST['title']) ? sanitize_text_field(trim($_POST['title'])) : ''; $full_name = isset($_POST['full_name']) ? sanitize_text_field(trim($_POST['full_name'])) : ''; $department = isset($_POST['department']) ? sanitize_text_field(trim($_POST['department'])) : ''; $phone = isset($_POST['phone']) ? sanitize_text_field(trim($_POST['phone'])) : ''; $additional_info = isset($_POST['additional_info']) ? sanitize_textarea_field(trim($_POST['additional_info'])) : ''; $due_date = isset($_POST['due_date']) ? sanitize_text_field(trim($_POST['due_date'])) : ''; $priority = isset($_POST['priority']) ? absint($_POST['priority']) : null; // Validações $errors = []; if (empty($title)) { $errors[] = 'O título é obrigatório.'; } if (empty($full_name)) { $errors[] = 'O nome completo é obrigatório.'; } if (empty($department)) { $errors[] = 'A secretaria é obrigatória.'; } if (empty($phone)) { $errors[] = 'O telefone/WhatsApp é obrigatório.'; } if (empty($additional_info)) { $errors[] = 'Os detalhes da solicitação são obrigatórios.'; } if ($due_date) { try { $date = new DateTime($due_date); $due_date = $date->format('c'); // Formato ISO 8601 } catch (Exception $e) { $errors[] = 'Data de vencimento inválida.'; } } if ($priority !== null && ($priority < 1 || $priority > 5)) { $errors[] = 'Prioridade deve ser entre 1 e 5.'; } if (empty($errors)) { // Format description $description = "
" . esc_html($additional_info) . "
" . "