| @@ -1,30 +1,119 @@ | ||
| 1 | -<?php | |
| 2 | - /** | |
| 3 | - * Support Page | |
| 4 | - * | |
| 5 | - * @package Wow Plugin | |
| 6 | - * @copyright Copyright (c) 2018, Dmytro Lobov | |
| 7 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 8 | - * @since 1.0 | |
| 9 | - */ | |
| 10 | - | |
| 11 | - if ( ! defined( 'ABSPATH' ) ) exit; | |
| 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 | + } | |
| 12 | 66 | ?> |
| 13 | 67 | |
| 14 | -<style> | |
| 15 | - .feature-section.one-col p { | |
| 16 | - font-size: 16px; | |
| 17 | - } | |
| 18 | -</style> | |
| 19 | -<div class="about-wrap"> | |
| 20 | - <div class="feature-section one-col"> | |
| 21 | - <div class="col"> | |
| 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> | |
| 22 | 91 | |
| 23 | - <p>To get your support related question answered in the fastest timing, please head over to our <a href="https://wow-estore.com/questions/" target="_blank">Support Forum</a> page and send your Question.</p> | |
| 24 | - | |
| 25 | - <p>Also, you can send us your ideas and suggestions for improving the plugin.</p> | |
| 26 | - | |
| 27 | 92 | </div> |
| 28 | 93 | |
| 29 | - </div> | |
| 30 | -</div> | |
| 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> | |