| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | class SupportForm { |
| 10 | 10 | |
| 11 | 11 | public static function init(): void { |
| 12 | 12 | |
| 13 | - $plugin = WPCoder::info( 'name' ) . ' v.' . WPCoder::info( 'version' ); | |
| 13 | + $plugin = WPCoder::info('name') . ' v.' . WPCoder::info('version'); | |
| 14 | 14 | $license = get_option( 'wow_license_key_' . WPCoder::PREFIX, 'no' ); |
| 15 | 15 | |
| 16 | 16 | self::send(); |
| 17 | 17 | |
| @@ -16,85 +16,69 @@ | ||
| 16 | 16 | self::send(); |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | |
| 20 | - <form method="post" class="wowp-fields__group column-3"> | |
| 21 | - <div class="wowp-field"> | |
| 22 | - <label> | |
| 23 | - <span class="label"> | |
| 24 | - <?php esc_html_e( 'Your Name', 'wp-coder' ); ?> | |
| 25 | - </span> | |
| 20 | + <form method="post"> | |
| 21 | + | |
| 22 | + <fieldset> | |
| 23 | + <legend> | |
| 24 | + <?php esc_html_e( 'Support Form', 'wpcoder' ); ?> | |
| 25 | + </legend> | |
| 26 | + | |
| 27 | + <div class="wowp-field"> | |
| 28 | + <label for="support-name" class="label"><?php esc_html_e( 'Your Name', 'wpcoder' ); ?></label> | |
| 26 | 29 | <input type="text" name="support[name]" id="support-name"> |
| 27 | - </label> | |
| 30 | + </div> | |
| 28 | 31 | |
| 29 | - </div> | |
| 30 | - | |
| 31 | - <div class="wowp-field"> | |
| 32 | - <label> | |
| 33 | - <span class="label"> | |
| 34 | - <?php esc_html_e( 'Contact email', 'wp-coder' ); ?> | |
| 35 | - </span> | |
| 32 | + <div class="wowp-field"> | |
| 33 | + <label for="support-email" class="label"><?php esc_html_e( 'Contact email', 'wpcoder' ); ?></label> | |
| 36 | 34 | <input type="text" name="support[email]" id="support-email" |
| 37 | - value="<?php echo esc_attr( get_option( 'admin_email' ) ); ?>"> | |
| 38 | - </label> | |
| 39 | - </div> | |
| 35 | + value="<?php echo sanitize_email( get_option( 'admin_email' ) ); ?>"> | |
| 36 | + </div> | |
| 40 | 37 | |
| 41 | - <div class="wowp-field"> | |
| 42 | - <label> | |
| 43 | - <span class="label"><?php esc_html_e( 'Link to the issue', 'wp-coder' ); ?></span> | |
| 38 | + <div class="wowp-field"> | |
| 39 | + <label for="support-link" | |
| 40 | + class="label"><?php esc_html_e( 'Link to the issue', 'wpcoder' ); ?></label> | |
| 44 | 41 | <input type="text" name="support[link]" id="support-link" |
| 45 | 42 | value="<?php echo esc_url( get_option( 'home' ) ); ?>"> |
| 46 | - </label> | |
| 43 | + </div> | |
| 47 | 44 | |
| 48 | - </div> | |
| 49 | - | |
| 50 | - <div class="wowp-field"> | |
| 51 | - <label> | |
| 52 | - <span class="label"><?php esc_html_e( 'Message type', 'wp-coder' ); ?></span> | |
| 45 | + <div class="wowp-field"> | |
| 46 | + <label for="support-type" class="label"><?php esc_html_e( 'Message type', 'wpcoder' ); ?></label> | |
| 53 | 47 | <select name="support[type]" id="support-type"> |
| 54 | - <option value="Bug"><?php esc_html_e( 'Bug', 'wp-coder' ); ?></option> | |
| 55 | - <option value="Question"><?php esc_html_e( 'Question', 'wp-coder' ); ?></option> | |
| 56 | - <option value="Idea"><?php esc_html_e( 'Idea', 'wp-coder' ); ?></option> | |
| 57 | - <option value="Other"><?php esc_html_e( 'Other', 'wp-coder' ); ?></option> | |
| 48 | + <option value="Issue"><?php esc_html_e( 'Issue', 'wpcoder' ); ?></option> | |
| 49 | + <option value="Idea"><?php esc_html_e( 'Idea', 'wpcoder' ); ?></option> | |
| 58 | 50 | </select> |
| 59 | - </label> | |
| 51 | + </div> | |
| 60 | 52 | |
| 61 | - </div> | |
| 62 | - | |
| 63 | - <div class="wowp-field"> | |
| 64 | - <label> | |
| 65 | - <span class="label"><?php esc_html_e( 'Plugin', 'wp-coder' ); ?></span> | |
| 53 | + <div class="wowp-field"> | |
| 54 | + <label for="support-plugin" class="label"><?php esc_html_e( 'Plugin', 'wpcoder' ); ?></label> | |
| 66 | 55 | <input type="text" readonly name="support[plugin]" id="support-plugin" |
| 67 | 56 | value="<?php echo esc_attr( $plugin ); ?>"> |
| 68 | - </label> | |
| 57 | + </div> | |
| 69 | 58 | |
| 70 | - </div> | |
| 71 | - | |
| 72 | - <div class="wowp-field"> | |
| 73 | - <label> | |
| 74 | - <span class="label"><?php esc_html_e( 'License Key', 'wp-coder' ); ?></span> | |
| 59 | + <div class="wowp-field"> | |
| 60 | + <label for="support-license" class="label"><?php esc_html_e( 'License Key', 'wpcoder' ); ?></label> | |
| 75 | 61 | <input type="text" readonly name="support[license]" id="support-license" |
| 76 | 62 | value="<?php echo esc_attr( $license ); ?>"> |
| 77 | - </label> | |
| 63 | + </div> | |
| 78 | 64 | |
| 79 | - </div> | |
| 65 | + <div class="wowp-field is-full"> | |
| 66 | + <?php | |
| 67 | + $content = esc_attr__( 'Enter Your Message', 'wpcoder' ); | |
| 68 | + $editor_id = 'support-message'; | |
| 69 | + $settings = array( | |
| 70 | + 'textarea_name' => 'support[message]', | |
| 71 | + ); | |
| 72 | + wp_editor( $content, $editor_id, $settings ); ?> | |
| 73 | + </div> | |
| 80 | 74 | |
| 81 | - <div class="wowp-field is-full"> | |
| 82 | - <?php | |
| 83 | - $content = esc_attr__( 'Briefly describe your issue, idea, or question...', 'wp-coder' ); | |
| 84 | - $editor_id = 'support-message'; | |
| 85 | - $settings = array( | |
| 86 | - 'textarea_name' => 'support[message]', | |
| 87 | - ); | |
| 88 | - wp_editor( $content, $editor_id, $settings ); ?> | |
| 89 | - </div> | |
| 75 | + <div class="wowp-field"> | |
| 76 | + <?php submit_button( __( 'Send to Support', 'wpcoder' ), 'primary', 'submit', false ); ?> | |
| 77 | + </div> | |
| 90 | 78 | |
| 91 | - <div class="wowp-field"> | |
| 92 | - <?php submit_button( __( 'Submit Request', 'wp-coder' ), 'primary', 'submit', false ); ?> | |
| 93 | - </div> | |
| 94 | - | |
| 95 | - <?php wp_nonce_field( WPCoder::PREFIX . '_nonce_action', WPCoder::PREFIX . '_nonce_name' ); ?> | |
| 96 | - | |
| 79 | + <?php wp_nonce_field( WPCoder::PREFIX . '_nonce_action', WPCoder::PREFIX . '_nonce_name' ); ?> | |
| 80 | + </fieldset> | |
| 97 | 81 | </form> |
| 98 | 82 | |
| 99 | 83 | <?php |
| 100 | 84 | |
| @@ -108,9 +92,9 @@ | ||
| 108 | 92 | |
| 109 | 93 | |
| 110 | 94 | $error = self::error(); |
| 111 | 95 | if ( ! empty( $error ) ) { |
| 112 | - echo '<p class="wowp-notification notification-error notice is-dismissible">' . esc_html( $error ) . '</p>'; | |
| 96 | + echo '<p class="wowp-notice wowp-error">' . esc_html( $error ) . '</p>'; | |
| 113 | 97 | |
| 114 | 98 | return; |
| 115 | 99 | } |
| 116 | 100 | |
| @@ -141,17 +125,17 @@ | ||
| 141 | 125 | ' . nl2br( wp_kses_post( $support['message'] ) ) . ' |
| 142 | 126 | </body> |
| 143 | 127 | </html>'; |
| 144 | 128 | $type = sanitize_text_field( $support['type'] ); |
| 145 | - $to_mail = WPCoder::info( 'email' ); | |
| 129 | + $to_mail = WPCoder::info('email'); | |
| 146 | 130 | $send = wp_mail( $to_mail, 'Support Ticket: ' . $type, $message_mail, $headers ); |
| 147 | 131 | |
| 148 | 132 | if ( $send ) { |
| 149 | - $text = __( 'Your message has been sent successfully! We will respond soon.', 'wp-coder' ); | |
| 150 | - echo '<p class="wowp-notification notification-success notice is-dismissible">' . esc_html( $text ) . '</p>'; | |
| 133 | + $text = __( 'Your message has been sent to the support team.', 'wpcoder' ); | |
| 134 | + echo '<p class="wowp-notice wowp-success">' . esc_html( $text ) . '</p>'; | |
| 151 | 135 | } else { |
| 152 | - $text = __( 'Sorry, but message did not send. Please, contact us ', 'wp-coder' ) . $to_mail; | |
| 153 | - echo '<p class="wowp-notification notification-error notice is-dismissible">' . esc_html( $text ) . '</p>'; | |
| 136 | + $text = __( 'Sorry, but message did not send. Please, contact us ', 'wpcoder' ) . $to_mail; | |
| 137 | + echo '<p class="wowp-notice wowp-error">' . esc_html( $text ) . '</p>'; | |
| 154 | 138 | } |
| 155 | 139 | |
| 156 | 140 | } |
| 157 | 141 | |
| @@ -163,9 +147,9 @@ | ||
| 163 | 147 | $fields = [ 'name', 'email', 'link', 'type', 'plugin', 'license', 'message' ]; |
| 164 | 148 | |
| 165 | 149 | foreach ( $fields as $field ) { |
| 166 | 150 | if ( empty( $support[ $field ] ) ) { |
| 167 | - return __( 'Please complete all required fields before submitting.', 'wp-coder' ); | |
| 151 | + return __( 'Please fill in all the form fields below.', 'wpcoder' ); | |
| 168 | 152 | } |
| 169 | 153 | } |
| 170 | 154 | |
| 171 | 155 | return ''; |