| @@ -1,171 +1,119 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Support Page | |
| 4 | - * | |
| 5 | - * @package Wow_Plugin | |
| 6 | - * @subpackage Admin/Support | |
| 7 | - * @author Dmytro Lobov <i@wpbiker.com> | |
| 8 | - * @copyright 2019 Wow-Company | |
| 9 | - * @license GNU Public License | |
| 10 | - * @version 1.0 | |
| 11 | - */ | |
| 12 | - | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | - exit; | |
| 15 | -} | |
| 16 | - | |
| 17 | -$plugin = $this->plugin_name . ' v.' . $this->plugin_version; | |
| 18 | -$website = get_option( 'home' ); | |
| 19 | -$license = get_option( 'wow_license_key_' . $this->plugin_pref, 'no' ); | |
| 20 | - | |
| 21 | -?> | |
| 22 | - | |
| 23 | - <div class="about-wrap wow-support"> | |
| 24 | - <div class="feature-section one-col"> | |
| 25 | - <div class="col"> | |
| 26 | - | |
| 27 | - <p>To get your support related question answered in the fastest timing, please send a message via the form below | |
| 28 | - or write to us on email <a href="mailto:support@wow-company.com">support@wow-company.com</a>.</p> | |
| 29 | - | |
| 30 | - <p>Also, you can send us your ideas and suggestions for improving the plugin.</p> | |
| 31 | - <?php $error = array(); | |
| 32 | - if ( ! empty( $_POST['action'] ) && ! empty( $_POST['wow_support_field'] ) ) { | |
| 33 | - if ( wp_verify_nonce( $_POST['wow_support_field'], 'wow_support_action' ) | |
| 34 | - && current_user_can( 'manage_options' ) | |
| 35 | - ) { | |
| 36 | - | |
| 37 | - $fname = ! empty( $_POST['wow-fname'] ) ? sanitize_text_field( $_POST['wow-fname'] ) : ''; | |
| 38 | - $lname = ! empty( $_POST['wow-lname'] ) ? sanitize_text_field( $_POST['wow-lname'] ) : ''; | |
| 39 | - $message = ! empty( $_POST['wow-message'] ) ? sanitize_text_field( $_POST['wow-message'] ) : ''; | |
| 40 | - $email = ! empty( $_POST['wow-email'] ) ? sanitize_email( $_POST['wow-email'] ) : ''; | |
| 41 | - $type | |
| 42 | - = ! empty( $_POST['wow-message-type'] ) ? sanitize_text_field( $_POST['wow-message-type'] ) | |
| 43 | - : ''; | |
| 44 | - | |
| 45 | - if ( empty( $fname ) ) { | |
| 46 | - $error[] = esc_attr__( 'Please, Enter your First Name.', 'wpcoder' ); | |
| 47 | - } | |
| 48 | - if ( empty( $lname ) ) { | |
| 49 | - $error[] = esc_attr__( 'Please, Enter your Last Name.', 'wpcoder' ); | |
| 50 | - } | |
| 51 | - if ( empty( $message ) ) { | |
| 52 | - $error[] = esc_attr__( 'Please, Enter your Message.', 'wpcoder' ); | |
| 53 | - } | |
| 54 | - if ( empty( $email ) ) { | |
| 55 | - $error[] = esc_attr__( 'Please, Enter your Email.', 'wpcoder' ); | |
| 56 | - } | |
| 57 | - if ( count( $error ) == 0 ) { | |
| 58 | - | |
| 59 | - | |
| 60 | - $headers = array( | |
| 61 | - 'From: ' . $fname . ' ' . $lname . ' <' . $email . '>', | |
| 62 | - 'content-type: text/html', | |
| 63 | - ); | |
| 64 | - $message = ' | |
| 65 | - <html> | |
| 66 | - <head></head> | |
| 67 | - <body> | |
| 68 | - <table> | |
| 69 | - <tr> | |
| 70 | - <td width="30%"><strong>License Key:</strong></td> | |
| 71 | - <td>' . $license . '</td> | |
| 72 | - </tr> | |
| 73 | - <tr> | |
| 74 | - <td><strong>Plugin:</strong></td> | |
| 75 | - <td>' . $plugin . '</td> | |
| 76 | - </tr> | |
| 77 | - <tr> | |
| 78 | - <td><strong>Website:</strong></td> | |
| 79 | - <td>' . $website . '</td> | |
| 80 | - </tr> | |
| 81 | - </table> | |
| 82 | - ' . $message . ' | |
| 83 | - </body> | |
| 84 | - </html>'; | |
| 85 | - wp_mail( 'support@wow-company.com', 'Support Ticket: ' . $type, $message, $headers ); | |
| 86 | - echo '<div class="wow-alert wow-alert-update "><p class="wow_error">' | |
| 87 | - . esc_attr__( 'Your Message sent to the Support.', 'wpcoder' ) . '</p></div>'; | |
| 88 | - | |
| 89 | - } | |
| 90 | - | |
| 91 | - | |
| 92 | - } else { | |
| 93 | - echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' | |
| 94 | - . esc_attr__( 'Sorry, but message did not send. Please, contact us support@wow-company.com', | |
| 95 | - 'wpcoder' ) . ' </p></div>'; | |
| 96 | - } | |
| 97 | - } | |
| 98 | - ?> | |
| 99 | - <?php if ( count( $error ) > 0 ) { | |
| 100 | - echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' . implode( "<br />", $error ) | |
| 101 | - . '</p></div>'; | |
| 102 | - } ?> | |
| 103 | - | |
| 104 | - | |
| 105 | - <form method="post" action="" class="wow-plugin"> | |
| 106 | - <div class="wow-container"> | |
| 107 | - <div class="wow-element"> | |
| 108 | - <label><?php esc_html_e( 'First Name', 'wpcoder' ); ?></label><br/> | |
| 109 | - <input type="text" name="wow-fname" value="" | |
| 110 | - placeholder="<?php esc_html_e( 'Enter Your First Name', 'wpcoder' ); ?>"> | |
| 111 | - </div> | |
| 112 | - <div class="wow-element"> | |
| 113 | - <label><?php esc_html_e( 'Last Name', 'wpcoder' ); ?></label><br/> | |
| 114 | - <input type="text" name="wow-lname" value="" | |
| 115 | - placeholder="<?php esc_html_e( 'Enter Your Last Name', 'wpcoder' ); ?>"> | |
| 116 | - </div> | |
| 117 | - </div> | |
| 118 | - <div class="wow-container"> | |
| 119 | - <div class="wow-element"> | |
| 120 | - <label><?php esc_html_e( 'WebSite', 'wpcoder' ); ?></label><br/> | |
| 121 | - <input type="text" disabled name="wow-website" value="<?php echo get_option( 'home' ); ?>"> | |
| 122 | - </div> | |
| 123 | - <div class="wow-element"> | |
| 124 | - <label><?php esc_html_e( 'Contact email', 'wpcoder' ); ?></label><br/> | |
| 125 | - <input type="text" name="wow-email" value="<?php echo get_option( 'admin_email' ); ?>"> | |
| 126 | - </div> | |
| 127 | - | |
| 128 | - </div> | |
| 129 | - | |
| 130 | - <div class="wow-container"> | |
| 131 | - <div class="wow-element"> | |
| 132 | - <label><?php esc_html_e( 'License Key', 'wpcoder' ); ?></label><br/> | |
| 133 | - <input type="text" disabled name="wow-license-key" value="<?php if ( ! empty( $license ) ) { | |
| 134 | - echo $license; | |
| 135 | - }; ?>"> | |
| 136 | - </div> | |
| 137 | - <div class="wow-element"> | |
| 138 | - <label><?php esc_html_e( 'Plugin', 'wpcoder' ); ?></label><br/> | |
| 139 | - <input type="text" disabled name="wow-plugin" value="<?php if ( ! empty( $name ) ) { | |
| 140 | - echo $plugin; | |
| 141 | - }; ?>"> | |
| 142 | - </div> | |
| 143 | - </div> | |
| 144 | - <div class="wow-container"> | |
| 145 | - <div class="wow-element"> | |
| 146 | - <label><?php esc_html_e( 'Message type', 'wpcoder' ); ?></label><br/> | |
| 147 | - <select name="wow-message-type"> | |
| 148 | - <option value="Issue"><?php esc_html_e( 'Issue', 'wpcoder' ); ?></option> | |
| 149 | - <option value="Idea"><?php esc_html_e( 'Idea', 'wpcoder' ); ?></option> | |
| 150 | - </select> | |
| 151 | - </div> | |
| 152 | - </div> | |
| 153 | - <div class="wow-container"> | |
| 154 | - <div class="wow-element"> | |
| 155 | - <textarea name="wow-message" rows="10" | |
| 156 | - placeholder="<?php esc_html_e( 'Enter Your Message', 'wpcoder' ); ?>"></textarea> | |
| 157 | - </div> | |
| 158 | - </div> | |
| 159 | - <div class="wow-container"> | |
| 160 | - <div class="wow-element"> | |
| 161 | - <input type="submit" class="add-item" name="action" | |
| 162 | - value="<?php esc_html_e( 'Send to Support', 'wpcoder' ); ?>"> | |
| 163 | - </div> | |
| 164 | - </div> | |
| 165 | - <?php wp_nonce_field( 'wow_support_action', 'wow_support_field' ); ?> | |
| 166 | - </form> | |
| 167 | - </div> | |
| 168 | - | |
| 169 | - </div> | |
| 170 | - </div> | |
| 171 | -<?php | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | + $error = array(); | |
| 3 | + if ( !empty( $_POST['action'] ) && !empty( $_POST['wow_support_field'] ) ) { | |
| 4 | + if (wp_verify_nonce($_POST['wow_support_field'],'wow_support_action') && current_user_can( 'manage_options' )) { | |
| 5 | + | |
| 6 | + $fname = !empty($_POST['wow-fname']) ? sanitize_text_field($_POST['wow-fname']) : ''; | |
| 7 | + $lname = !empty($_POST['wow-lname']) ? sanitize_text_field($_POST['wow-lname']) : ''; | |
| 8 | + $message = !empty($_POST['wow-message']) ? sanitize_text_field($_POST['wow-message']) : ''; | |
| 9 | + $email = !empty($_POST['wow-email']) ? sanitize_email($_POST['wow-email']) : ''; | |
| 10 | + $type = !empty($_POST['wow-message-type']) ? sanitize_text_field($_POST['wow-message-type']) : ''; | |
| 11 | + | |
| 12 | + if (empty($fname)) { | |
| 13 | + $error[] = 'Please, Enter your First Name.'; | |
| 14 | + } | |
| 15 | + if (empty($lname)) { | |
| 16 | + $error[] = 'Please, Enter your Last Name.'; | |
| 17 | + } | |
| 18 | + if (empty($message)) { | |
| 19 | + $error[] = 'Please, Enter your Message.'; | |
| 20 | + } | |
| 21 | + if (empty($email)) { | |
| 22 | + $error[] = 'Please, Enter your Email.'; | |
| 23 | + } | |
| 24 | + if ( count($error) == 0 ) { | |
| 25 | + | |
| 26 | + | |
| 27 | + $plugin = $name.' v.'.$version; | |
| 28 | + $website = get_option('home'); | |
| 29 | + | |
| 30 | + $headers = array( | |
| 31 | + 'From: '.$fname.' '.$lname.' <'.$email.'>', | |
| 32 | + 'content-type: text/html', | |
| 33 | + ); | |
| 34 | + $message = ' | |
| 35 | + <html> | |
| 36 | + <head></head> | |
| 37 | + <body> | |
| 38 | + <table> | |
| 39 | + <tr> | |
| 40 | + <td width="30%"><strong>License Key:</strong></td> | |
| 41 | + <td>'.$license.'</td> | |
| 42 | + </tr> | |
| 43 | + <tr> | |
| 44 | + <td><strong>Plugin:</strong></td> | |
| 45 | + <td>'.$plugin.'</td> | |
| 46 | + </tr> | |
| 47 | + <tr> | |
| 48 | + <td><strong>Website:</strong></td> | |
| 49 | + <td>'.$website.'</td> | |
| 50 | + </tr> | |
| 51 | + </table> | |
| 52 | + '.$message.' | |
| 53 | + </body> | |
| 54 | + </html>'; | |
| 55 | + wp_mail('support@wow-company.com', 'Support Ticket: '.$type, $message, $headers); | |
| 56 | + echo '<div class="wow-alert wow-alert-update "><p class="wow_error">Your Message sent to the Support</p></div>'; | |
| 57 | + | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + } | |
| 62 | + else { | |
| 63 | + echo '<div class="wow-alert wow-alert-error "><p class="wow_error">Sorry, but message did not send. Please, contact us support@wow-company.com </p></div>'; | |
| 64 | + } | |
| 65 | + } | |
| 66 | +?> | |
| 67 | + | |
| 68 | + | |
| 69 | +<?php if ( count($error) > 0 ) echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' . implode("<br />", $error) . '</p></div>'; ?> | |
| 70 | +<div class="wowbox" style="width:80%;"> | |
| 71 | + <form method="post" action=""> | |
| 72 | + <div class="wow-admin-col"> | |
| 73 | + <div class="wow-admin-col-6"> | |
| 74 | + First Name:<br/> | |
| 75 | + <input type="text" name="wow-fname" value="" placeholder="Enter Your First Name"> | |
| 76 | + </div> | |
| 77 | + <div class="wow-admin-col-6"> | |
| 78 | + Last Name:<br/> | |
| 79 | + <input type="text" name="wow-lname" value="" placeholder="Enter Your Last Name"> | |
| 80 | + </div> | |
| 81 | + </div> | |
| 82 | + <div class="wow-admin-col"> | |
| 83 | + <div class="wow-admin-col-6"> | |
| 84 | + WebSite:<br/> | |
| 85 | + <input type="text" disabled name="wow-website" value="<?php echo get_option('home'); ?>"> | |
| 86 | + </div> | |
| 87 | + <div class="wow-admin-col-6"> | |
| 88 | + Contact email:<br/> | |
| 89 | + <input type="text" name="wow-email" value="<?php echo get_option('admin_email'); ?>"> | |
| 90 | + </div> | |
| 91 | + | |
| 92 | + </div> | |
| 93 | + | |
| 94 | + <div class="wow-admin-col"> | |
| 95 | + <div class="wow-admin-col-6"> | |
| 96 | + Plugin:<br/> | |
| 97 | + <input type="text" disabled name="wow-plugin" value="<?php if(!empty($name)) { echo $name.' v.'.$version; };?>"> | |
| 98 | + </div> | |
| 99 | + <div class="wow-admin-col-6"> | |
| 100 | + Message type:<br/> | |
| 101 | + <select name="wow-message-type"> | |
| 102 | + <option value="Issue">Issue</option> | |
| 103 | + <option value="Idea">Idea</option> | |
| 104 | + </select> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + <div class="wow-admin-col"> | |
| 108 | + <div class="wow-admin-col-12"> | |
| 109 | + <textarea name="wow-message" placeholder="Enter Your Message"></textarea> | |
| 110 | + </div> | |
| 111 | + </div> | |
| 112 | + <div class="wow-admin-col"> | |
| 113 | + <div class="wow-admin-col-12 right"> | |
| 114 | + <input type="submit" class="wow-btn" name="action" value="Send a Message to Support"> | |
| 115 | + </div> | |
| 116 | + </div> | |
| 117 | + <?php wp_nonce_field('wow_support_action','wow_support_field'); ?> | |
| 118 | + </form> | |
| 119 | +</div> | |