| 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 |
| 28 |
form below |
| 29 |
or write to us on email <a href="mailto:yoda@wow-company.com">yoda@wow-company.com</a>.</p> |
| 30 |
|
| 31 |
<p>Also, you can send us your ideas and suggestions for improving the plugin.</p> |
| 32 |
<?php $error = array(); |
| 33 |
if ( ! empty( $_POST['action'] ) && ! empty( $_POST['wow_support_field'] ) ) { |
| 34 |
if ( wp_verify_nonce( $_POST['wow_support_field'], 'wow_support_action' ) |
| 35 |
&& current_user_can( 'manage_options' ) |
| 36 |
) { |
| 37 |
|
| 38 |
$fname = ! empty( $_POST['wow-fname'] ) ? sanitize_text_field( $_POST['wow-fname'] ) : ''; |
| 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'] ) ? wp_kses_post( $_POST['wow-message-type'] ) |
| 43 |
: ''; |
| 44 |
|
| 45 |
if ( empty( $fname ) ) { |
| 46 |
$error[] = esc_attr__( 'Please, Enter your Name.', 'wpcoder' ); |
| 47 |
} |
| 48 |
|
| 49 |
if ( empty( $message ) ) { |
| 50 |
$error[] = esc_attr__( 'Please, Enter your Message.', 'wpcoder' ); |
| 51 |
} |
| 52 |
if ( empty( $email ) ) { |
| 53 |
$error[] = esc_attr__( 'Please, Enter your Email.', 'wpcoder' ); |
| 54 |
} |
| 55 |
if ( count( $error ) == 0 ) { |
| 56 |
|
| 57 |
|
| 58 |
$headers = array( |
| 59 |
'From: ' . $fname . ' <' . $email . '>', |
| 60 |
'content-type: text/html', |
| 61 |
); |
| 62 |
$message = ' |
| 63 |
<html> |
| 64 |
<head></head> |
| 65 |
<body> |
| 66 |
<table> |
| 67 |
<tr> |
| 68 |
<td width="30%"><strong>License Key:</strong></td> |
| 69 |
<td>' . esc_attr( $license ) . '</td> |
| 70 |
</tr> |
| 71 |
<tr> |
| 72 |
<td><strong>Plugin:</strong></td> |
| 73 |
<td>' . esc_attr( $plugin ) . '</td> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<td><strong>Website:</strong></td> |
| 77 |
<td>' . esc_url( $website ) . '</td> |
| 78 |
</tr> |
| 79 |
</table> |
| 80 |
' . nl2br( wp_kses_post( $message ) ) . ' |
| 81 |
</body> |
| 82 |
</html>'; |
| 83 |
wp_mail( 'yoda@wow-company.com', 'Support Ticket: ' . $type, $message, $headers ); |
| 84 |
echo '<div class="wow-alert wow-alert-update "><p class="wow_error">' |
| 85 |
. esc_attr__( 'Your Message sent to the Support.', 'wpcoder' ) . '</p></div>'; |
| 86 |
|
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
} else { |
| 91 |
echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' |
| 92 |
. esc_attr__( 'Sorry, but message did not send. Please, contact us yoda@wow-company.com', |
| 93 |
'wpcoder' ) . ' </p></div>'; |
| 94 |
} |
| 95 |
} |
| 96 |
?> |
| 97 |
<?php if ( count( $error ) > 0 ) { |
| 98 |
echo '<div class="wow-alert wow-alert-error "><p class="wow_error">' . implode( "<br />", $error ) |
| 99 |
. '</p></div>'; |
| 100 |
} ?> |
| 101 |
|
| 102 |
|
| 103 |
<form method="post" action="" class="wow-plugin"> |
| 104 |
<div class="wow-container"> |
| 105 |
<div class="wow-element"> |
| 106 |
<label><?php esc_html_e( 'First Name', 'wpcoder' ); ?></label><br/> |
| 107 |
<input type="text" name="wow-fname" value="" |
| 108 |
placeholder="<?php esc_attr_e( 'Enter Your First Name', 'wpcoder' ); ?>"> |
| 109 |
</div> |
| 110 |
<div class="wow-element"> |
| 111 |
<label><?php esc_html_e( 'Contact email', 'wpcoder' ); ?></label><br/> |
| 112 |
<input type="text" name="wow-email" |
| 113 |
value="<?php echo sanitize_email( get_option( 'admin_email' ) ); ?>"> |
| 114 |
</div> |
| 115 |
|
| 116 |
</div> |
| 117 |
<div class="wow-container"> |
| 118 |
<div class="wow-element"> |
| 119 |
<label><?php esc_html_e( 'WebSite', 'wpcoder' ); ?></label><br/> |
| 120 |
<input type="text" disabled name="wow-website" |
| 121 |
value="<?php echo esc_url( get_option( 'home' ) ); ?>"> |
| 122 |
</div> |
| 123 |
<div class="wow-element"> |
| 124 |
<label><?php esc_html_e( 'License Key', 'wpcoder' ); ?></label><br/> |
| 125 |
<input type="text" disabled name="wow-license-key" value="<?php if ( ! empty( $license ) ) { |
| 126 |
echo esc_attr( $license ); |
| 127 |
}; ?>"> |
| 128 |
</div> |
| 129 |
|
| 130 |
|
| 131 |
</div> |
| 132 |
|
| 133 |
<div class="wow-container"> |
| 134 |
|
| 135 |
<div class="wow-element"> |
| 136 |
<label><?php esc_html_e( 'Plugin', 'wpcoder' ); ?></label><br/> |
| 137 |
<input type="text" disabled name="wow-plugin" value="<?php if ( ! empty( $name ) ) { |
| 138 |
echo esc_attr($plugin); |
| 139 |
}; ?>"> |
| 140 |
</div> |
| 141 |
<div class="wow-element"> |
| 142 |
<label><?php esc_html_e( 'Message type', 'wpcoder' ); ?></label><br/> |
| 143 |
<select name="wow-message-type"> |
| 144 |
<option value="Issue"><?php esc_html_e( 'Issue', 'wpcoder' ); ?></option> |
| 145 |
<option value="Idea"><?php esc_html_e( 'Idea', 'wpcoder' ); ?></option> |
| 146 |
</select> |
| 147 |
</div> |
| 148 |
</div> |
| 149 |
|
| 150 |
<div class="wow-container"> |
| 151 |
<div class="wow-element"> |
| 152 |
<textarea name="wow-message" rows="10" |
| 153 |
placeholder="<?php esc_html_e( 'Enter Your Message', 'wpcoder' ); ?>"></textarea> |
| 154 |
</div> |
| 155 |
</div> |
| 156 |
<div class="wow-container"> |
| 157 |
<div class="wow-element"> |
| 158 |
<input type="submit" class="add-item" name="action" |
| 159 |
value="<?php esc_html_e( 'Send to Support', 'wpcoder' ); ?>"> |
| 160 |
</div> |
| 161 |
</div> |
| 162 |
<?php wp_nonce_field( 'wow_support_action', 'wow_support_field' ); ?> |
| 163 |
</form> |
| 164 |
</div> |
| 165 |
|
| 166 |
</div> |
| 167 |
</div> |
| 168 |
<?php |
| 169 |
|