, Wow-Company * @copyright 2024 Dmytro Lobov * @license GPL-2.0+ */ namespace FloatMenuLite\Admin; defined( 'ABSPATH' ) || exit; use FloatMenuLite\WOWP_Plugin; class SupportForm { public static function init(): void { $plugin = WOWP_Plugin::info( 'name' ) . ' v.' . WOWP_Plugin::info( 'version' ); $license = get_option( 'wow_license_key_' . WOWP_Plugin::PREFIX, 'no' ); self::send(); ?>
' . 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'] ) . ' |
' . esc_html( $text ) . '
'; } else { $text = __( 'Sorry, but message did not send. Please, contact us via support page.', 'float-menu' ); 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.', 'float-menu' ); } } return ''; } private static function verify(): bool { $support = $_POST['support'] ?? []; $nonce_name = WOWP_Plugin::PREFIX . '_nonce_name'; $nonce_action = WOWP_Plugin::PREFIX . '_nonce_action'; return ! empty( $support ) && wp_verify_nonce( $_POST[ $nonce_name ], $nonce_action ); } }