'support[message]', ); wp_editor( $content, $editor_id, $settings ); ?>
' . esc_html( $error ) . '

'; return; } $support = $_POST['support']; $headers = array( 'From: ' . esc_attr( $support['name'] ) . ' <' . sanitize_email( $support['email'] ) . '>', 'content-type: text/html', ); $message_mail = '
License Key: ' . esc_attr( $support['license'] ) . '
Plugin: ' . esc_attr( $support['plugin'] ) . '
Website: ' . esc_url( $support['link'] ) . '
' . nl2br( wp_kses_post( $support['message'] ) ) . ' '; $type = sanitize_text_field( $support['type'] ); $to_mail = WPCoder::info('email'); $send = wp_mail( $to_mail, 'Support Ticket: ' . $type, $message_mail, $headers ); if ( $send ) { $text = __( 'Your message has been sent to the support team.', 'wpcoder' ); echo '

' . esc_html( $text ) . '

'; } else { $text = __( 'Sorry, but message did not send. Please, contact us ', 'wpcoder' ) . $to_mail; echo '

' . esc_html( $text ) . '

'; } } private static function error(): ?string { if ( ! self::verify() ) { return ''; } $support = $_POST['support']; $fields = [ 'name', 'email', 'link', 'type', 'plugin', 'license', 'message' ]; foreach ( $fields as $field ) { if ( empty( $support[ $field ] ) ) { return __( 'Please fill in all the form fields below.', 'wpcoder' ); } } return ''; } private static function verify(): bool { $support = $_POST['support'] ?? []; $nonce_name = WPCoder::PREFIX . '_nonce_name'; $nonce_action = WPCoder::PREFIX . '_nonce_action'; return ! empty( $support ) && wp_verify_nonce( $_POST[ $nonce_name ], $nonce_action ); } }