Przechowywanie tekstów UX w bazie danych
This commit is contained in:
@@ -43,6 +43,13 @@ class AdminMenu
|
|||||||
update_option('incontact-site-key', $_POST['incontact-site-key']);
|
update_option('incontact-site-key', $_POST['incontact-site-key']);
|
||||||
update_option('incontact-secret-key', $_POST['incontact-secret-key']);
|
update_option('incontact-secret-key', $_POST['incontact-secret-key']);
|
||||||
update_option('incontact-target-mail', $_POST['incontact-target-mail']);
|
update_option('incontact-target-mail', $_POST['incontact-target-mail']);
|
||||||
|
update_option('incontact-form-ph-name', $_POST['incontact-form-ph-name']);
|
||||||
|
update_option('incontact-form-ph-email', $_POST['incontact-form-ph-email']);
|
||||||
|
update_option('incontact-form-ph-message', $_POST['incontact-form-ph-message']);
|
||||||
|
update_option('incontact-form-name', $_POST['incontact-form-name']);
|
||||||
|
update_option('incontact-form-email', $_POST['incontact-form-email']);
|
||||||
|
update_option('incontact-form-message', $_POST['incontact-form-message']);
|
||||||
|
update_option('incontact-form-snd-ok', $_POST['incontact-form-snd-ok']);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="updated">
|
<div class="updated">
|
||||||
@@ -73,6 +80,44 @@ class AdminMenu
|
|||||||
<td><input name="incontact-target-mail" id="incontact-target-mail" type="text"
|
<td><input name="incontact-target-mail" id="incontact-target-mail" type="text"
|
||||||
value="<?php echo get_option('incontact-target-mail'); ?>" class="regular-text"/></td>
|
value="<?php echo get_option('incontact-target-mail'); ?>" class="regular-text"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-ph-name">Formularz - placeholder nazwa</label></th>
|
||||||
|
<td><input name="incontact-form-ph-name" id="incontact-form-ph-name" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-ph-name'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-ph-email">Formularz - placeholder email</label></th>
|
||||||
|
<td><input name="incontact-form-ph-email" id="incontact-form-ph-email" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-ph-email'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-ph-message">Formularz - placeholder wiadomość</label></th>
|
||||||
|
<td><input name="incontact-form-ph-message" id="incontact-form-ph-message" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-ph-message'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-name">Formularz - nazwa nazwa</label></th>
|
||||||
|
<td><input name="incontact-form-name" id="incontact-form-name" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-name'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-email">Formularz - nazwa email</label></th>
|
||||||
|
<td><input name="incontact-form-email" id="incontact-form-email" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-email'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-message">Formularz - nazwa wiadomość</label></th>
|
||||||
|
<td><input name="incontact-form-message" id="incontact-form-message" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-message'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><label for="incontact-form-snd-ok">Formularz - wiadomość wysłana popprawnie</label></th>
|
||||||
|
<td><input name="incontact-form-snd-ok" id="incontact-form-snd-ok" type="text"
|
||||||
|
value="<?php echo get_option('incontact-form-snd-ok'); ?>" class="regular-text"/></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|||||||
@@ -162,13 +162,8 @@ class Shortcode
|
|||||||
[$em_name, $em_mail, $telefon, str_replace(array("\r\n", "\r", "\n"), "<br />", $em_message), date("Y")],
|
[$em_name, $em_mail, $telefon, str_replace(array("\r\n", "\r", "\n"), "<br />", $em_message), date("Y")],
|
||||||
$body
|
$body
|
||||||
) ;
|
) ;
|
||||||
//$gRecaptchaResponse = (isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : '');
|
$gRecaptchaResponse = (isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : '');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*if (!empty($atts['class'])) {
|
|
||||||
$class = $atts['class'];
|
|
||||||
}*/
|
|
||||||
if (!empty($error)) {
|
if (!empty($error)) {
|
||||||
$html .= '<div class="alert alert-success" role="alert">' . $error . '</div>';
|
$html .= '<div class="alert alert-success" role="alert">' . $error . '</div>';
|
||||||
|
|
||||||
@@ -177,30 +172,43 @@ class Shortcode
|
|||||||
|
|
||||||
$secret = get_option('incontact-secret-key');
|
$secret = get_option('incontact-secret-key');
|
||||||
$response = null;
|
$response = null;
|
||||||
/*$reCaptcha = new \ReCaptcha\ReCaptcha($secret);
|
if (get_option('incontact-site-key') != '')
|
||||||
$resp = $reCaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])->verify($gRecaptchaResponse, $_SERVER['REMOTE_ADDR']);
|
|
||||||
if ($resp->isSuccess())
|
|
||||||
{*/
|
|
||||||
$mailResult = wp_mail($targetEmail, $em_name, $body, $headers);
|
|
||||||
/*}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$errors = $resp->getErrorCodes();
|
$reCaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||||
}*/
|
$resp = $reCaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])->verify($gRecaptchaResponse, $_SERVER['REMOTE_ADDR']);
|
||||||
|
if ($resp->isSuccess())
|
||||||
|
{
|
||||||
|
$canSend = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors = $resp->getErrorCodes();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$canSend = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($canSend) {
|
||||||
|
$mailResult = wp_mail($targetEmail, $em_name, $body, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wp_enqueue_style('ContactCss', plugins_url( '/css/cform.css', __FILE__ ));
|
wp_enqueue_style('ContactCss', plugins_url( '/css/cform.css', __FILE__ ));
|
||||||
|
|
||||||
/*$html .= '<script src="https://www.google.com/recaptcha/api.js"></script>
|
if (get_option('incontact-site-key') != '')
|
||||||
<script>
|
{
|
||||||
$(document).ready(function(){window.setTimeout(function(){$(".alert").fadeTo(500,0).slideUp(500,function(){$(this).remove()})},2e3)}),$(document).ready(function(){"use strict";window.addEventListener("load",function(){var t=document.getElementsByClassName("needs-validation");Array.prototype.filter.call(t,function(t){t.addEventListener("submit",function(e){!1===t.checkValidity()&&(e.preventDefault(),e.stopPropagation()),t.classList.add("was-validated")},!1)})},!1)})();
|
$html .= '<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||||
</script>'."\n";*/
|
<script>
|
||||||
|
$(document).ready(function(){window.setTimeout(function(){$(".alert").fadeTo(500,0).slideUp(500,function(){$(this).remove()})},2e3)}),$(document).ready(function(){"use strict";window.addEventListener("load",function(){var t=document.getElementsByClassName("needs-validation");Array.prototype.filter.call(t,function(t){t.addEventListener("submit",function(e){!1===t.checkValidity()&&(e.preventDefault(),e.stopPropagation()),t.classList.add("was-validated")},!1)})},!1)})();
|
||||||
|
</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
$html .= '<div class="row justify-content-md-center">
|
$html .= '<div class="row justify-content-md-center">
|
||||||
<div class="col-12">';
|
<div class="col-12">';
|
||||||
if ($mailResult == 1)
|
if ($mailResult == 1)
|
||||||
{
|
{
|
||||||
$html .= '<div class="alert alert-success" role="alert">Thanks! Your message was sent.</div>';
|
$html .= '<div class="alert alert-success" role="alert">' . get_option('incontact-form-snd-ok') . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<div class="jumbotron"><form action="" class="needs-validation" novalidate method="post" id="demo-form">
|
$html .= '<div class="jumbotron"><form action="" class="needs-validation" novalidate method="post" id="demo-form">
|
||||||
@@ -208,27 +216,27 @@ class Shortcode
|
|||||||
<input type="text" id="website" name="website" />
|
<input type="text" id="website" name="website" />
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name" class="col-2 control-label">Name</label>
|
<label for="name" class="col-2 control-label">' . get_option('incontact-form-name') . '</label>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<input type="text" class="form-control" id="name" name="em_name" placeholder="Full name" value="" required>
|
<input type="text" class="form-control" id="name" name="em_name" placeholder="' . get_option('incontact-form-ph-name') . '" value="" required>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Please enter your name!
|
Please enter your name!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-2 control-label">Email</label>
|
<label for="email" class="col-2 control-label">' . get_option('incontact-form-email') . '</label>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<input type="email" class="form-control" id="email" name="em_mail" placeholder="you@example.com" value="" required>
|
<input type="email" class="form-control" id="email" name="em_mail" placeholder="' . get_option('incontact-form-ph-email') . '" value="" required>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Please enter your email address!
|
Please enter your email address!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<p class="col-2 control-label">Message</p>
|
<p class="col-2 control-label">' . get_option('incontact-form-message') . '</p>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<textarea class="form-control" rows="4" name="em_message" placeholder="Write your message here..." required></textarea>
|
<textarea class="form-control" rows="4" name="em_message" placeholder="' . get_option('incontact-form-ph-message') . '" required></textarea>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Please enter your message!
|
Please enter your message!
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user