From 029e5fdec9a76af36632af79328ec28998a9487d Mon Sep 17 00:00:00 2001 From: Krzysztof Turek Date: Tue, 20 May 2025 23:22:49 +0200 Subject: [PATCH] =?UTF-8?q?Przechowywanie=20tekst=C3=B3w=20UX=20=20w=20baz?= =?UTF-8?q?ie=20danych?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/classes/inContact/AdminMenu.php | 45 ++++++++++++++++++++ inc/classes/inContact/Shortcode.php | 64 ++++++++++++++++------------- 2 files changed, 81 insertions(+), 28 deletions(-) diff --git a/inc/classes/inContact/AdminMenu.php b/inc/classes/inContact/AdminMenu.php index 1a95873..5a33b59 100644 --- a/inc/classes/inContact/AdminMenu.php +++ b/inc/classes/inContact/AdminMenu.php @@ -43,6 +43,13 @@ class AdminMenu update_option('incontact-site-key', $_POST['incontact-site-key']); update_option('incontact-secret-key', $_POST['incontact-secret-key']); 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']); ?>
@@ -73,6 +80,44 @@ class AdminMenu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

diff --git a/inc/classes/inContact/Shortcode.php b/inc/classes/inContact/Shortcode.php index 7808817..bce9fbd 100644 --- a/inc/classes/inContact/Shortcode.php +++ b/inc/classes/inContact/Shortcode.php @@ -162,13 +162,8 @@ class Shortcode [$em_name, $em_mail, $telefon, str_replace(array("\r\n", "\r", "\n"), "
", $em_message), date("Y")], $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)) { $html .= '

'; @@ -177,30 +172,43 @@ class Shortcode $secret = get_option('incontact-secret-key'); $response = null; - /*$reCaptcha = new \ReCaptcha\ReCaptcha($secret); - $resp = $reCaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])->verify($gRecaptchaResponse, $_SERVER['REMOTE_ADDR']); - if ($resp->isSuccess()) - {*/ - $mailResult = wp_mail($targetEmail, $em_name, $body, $headers); - /*} - else + if (get_option('incontact-site-key') != '') { - $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__ )); - /*$html .= ' - '."\n";*/ + if (get_option('incontact-site-key') != '') + { + $html .= ' + '."\n"; + } - $html .= '
-
'; + $html .= '
+
'; if ($mailResult == 1) { - $html .= ''; + $html .= ''; } $html .= '
@@ -208,27 +216,27 @@ class Shortcode
- +
- +
Please enter your name!
- +
- +
Please enter your email address!
-

Message

+

' . get_option('incontact-form-message') . '

- +
Please enter your message!