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