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