| 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 |
|
| 11 |
if (empty($fname)) { |
| 12 |
$error[] = 'Please, Enter your First Name.'; |
| 13 |
} |
| 14 |
if (empty($lname)) { |
| 15 |
$error[] = 'Please, Enter your Last Name.'; |
| 16 |
} |
| 17 |
if (empty($message)) { |
| 18 |
$error[] = 'Please, Enter your Message.'; |
| 19 |
} |
| 20 |
if (empty($email)) { |
| 21 |
$error[] = 'Please, Enter your Email.'; |
| 22 |
} |
| 23 |
if ( count($error) == 0 ) { |
| 24 |
|
| 25 |
|
| 26 |
$plugin = $name.' v.'.$version; |
| 27 |
$website = get_option('home'); |
| 28 |
$message = $_POST['wow-message']; |
| 29 |
$type = $_POST['wow-message-type']; |
| 30 |
|
| 31 |
$headers = array( |
| 32 |
'From: '.$fname.' '.$lname.' <'.$email.'>', |
| 33 |
'content-type: text/html', |
| 34 |
); |
| 35 |
$message = '<html> |
| 36 |
<head></head> |
| 37 |
<body> |
| 38 |
<table> |
| 39 |
<tr> |
| 40 |
<th>Plugin:</th> |
| 41 |
<td>'.$plugin.'</td> |
| 42 |
</tr> |
| 43 |
<tr> |
| 44 |
<th>Website:</th> |
| 45 |
<td>'.$website.'</td> |
| 46 |
</tr> |
| 47 |
</table> |
| 48 |
'.$message.' |
| 49 |
</body> |
| 50 |
</html>'; |
| 51 |
wp_mail('support@wow-company.com', 'Support Ticket (free): '.$type, $message, $headers); |
| 52 |
echo '<div class="wow-alert wow-alert-update "><p class="wow_error">Your Message sent to the Support</p></div>'; |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
} |
| 58 |
else { |
| 59 |
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>'; |
| 60 |
} |
| 61 |
} |
| 62 |
?> |
| 63 |
|
| 64 |
|
| 65 |
<?php if ( count($error) > 0 ) echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' . implode("<br />", $error) . '</p></div>'; ?> |
| 66 |
<div class="wowbox" style="width:80%;"> |
| 67 |
<form method="post" action=""> |
| 68 |
<div class="wow-admin-col"> |
| 69 |
<div class="wow-admin-col-6"> |
| 70 |
First Name:<br/> |
| 71 |
<input type="text" name="wow-fname" value="" placeholder="Enter Your First Name"> |
| 72 |
</div> |
| 73 |
<div class="wow-admin-col-6"> |
| 74 |
Last Name:<br/> |
| 75 |
<input type="text" name="wow-lname" value="" placeholder="Enter Your Last Name"> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
<div class="wow-admin-col"> |
| 79 |
<div class="wow-admin-col-6"> |
| 80 |
WebSite:<br/> |
| 81 |
<input type="text" disabled name="wow-website" value="<?php echo get_option('home'); ?>"> |
| 82 |
</div> |
| 83 |
<div class="wow-admin-col-6"> |
| 84 |
Contact email:<br/> |
| 85 |
<input type="text" name="wow-email" value="<?php echo get_option('admin_email'); ?>"> |
| 86 |
</div> |
| 87 |
|
| 88 |
</div> |
| 89 |
|
| 90 |
<div class="wow-admin-col"> |
| 91 |
<div class="wow-admin-col-6"> |
| 92 |
Plugin:<br/> |
| 93 |
<input type="text" disabled name="wow-plugin" value="<?php if(!empty($name)) { echo $name.' v.'.$version; };?>"> |
| 94 |
</div> |
| 95 |
<div class="wow-admin-col-6"> |
| 96 |
Message type:<br/> |
| 97 |
<select name="wow-message-type"> |
| 98 |
<option value="Discount for rating">Discount for rating</option> |
| 99 |
<option value="Issue">Issue</option> |
| 100 |
<option value="Idea">Idea</option> |
| 101 |
</select> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
<div class="wow-admin-col"> |
| 105 |
<div class="wow-admin-col-12"> |
| 106 |
<textarea name="wow-message" placeholder="Enter Your Message"></textarea> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
<div class="wow-admin-col"> |
| 110 |
<div class="wow-admin-col-12 right"> |
| 111 |
<input type="submit" class="wow-btn" name="action" value="Send a Message to Support"> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
<?php wp_nonce_field('wow_support_action','wow_support_field'); ?> |
| 115 |
</form> |
| 116 |
</div> |
| 117 |
|