, 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; } $from = isset( $_POST['support']['name'] ) ? sanitize_text_field( wp_unslash( $_POST['support']['name'] ) ) : ''; $email = isset( $_POST['support']['email'] ) ? sanitize_email( wp_unslash( $_POST['support']['email'] ) ) : ''; $license = isset( $_POST['support']['license'] ) ? sanitize_text_field( wp_unslash( $_POST['support']['license'] ) ) : ''; $plugin = isset( $_POST['support']['plugin'] ) ? sanitize_text_field( wp_unslash( $_POST['support']['plugin'] ) ) : ''; $link = isset( $_POST['support']['link'] ) ? sanitize_url( wp_unslash( $_POST['support']['link'] ) ) : ''; $message = isset( $_POST['support']['message'] ) ? wp_kses_post( wp_unslash( $_POST['support']['message'] ) ) : ''; $type = isset( $_POST['support']['type'] ) ? sanitize_text_field( wp_unslash( $_POST['support']['type'] ) ) : ''; $headers = array( 'From: ' . esc_attr( $from ) . ' <' . esc_attr( $email ) . '>', 'content-type: text/html', ); $message_mail = '| License Key: | ' . esc_attr( $license ) . ' |
| Plugin: | ' . esc_attr( $plugin ) . ' |
| Website: | ' . esc_url( $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 { $fields = [ 'name', 'email', 'link', 'type', 'plugin', 'license', 'message' ]; foreach ( $fields as $field ) { if ( empty( $_POST['support'][ $field ] ) ) { return __( 'Please fill in all the form fields below.', 'float-menu' ); } } return ''; } }