Add Cookie Notice Pro plugin with styles and Google Consent Mode integration
- Introduced Cookie Notice Pro plugin for GDPR compliance with a customizable cookie information popup. - Added CSS styles for the cookie notice, including light and dark themes, animations, and responsive design. - Implemented Google Consent Mode v2 with default denied settings and Google Tag Manager integration. - Created Elementor Webhook Relay plugin to handle form submissions and forward data to Google Apps Script.
This commit is contained in:
44
wp-content/mu-plugins/elementor-webhook-relay.php
Normal file
44
wp-content/mu-plugins/elementor-webhook-relay.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Elementor Webhook Relay → Apps Script
|
||||
* Description: Pośrednik między Elementor Form Webhook a Google Apps Script.
|
||||
* Apps Script zwraca redirect 302 którego Elementor nie obsługuje czysto;
|
||||
* ten relay przyjmuje POST, odsyła Elementorowi 200 OK,
|
||||
* a w tle (fire-and-forget) forwarduje payload do Apps Script.
|
||||
*
|
||||
* Endpoint: POST /wp-json/relay/v1/webhook
|
||||
*
|
||||
* Konfiguracja per-strona: zmień stałą APPS_SCRIPT_URL poniżej.
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) { exit; }
|
||||
|
||||
// ───── KONFIGURACJA — ZMIEŃ NA SWÓJ ─────
|
||||
const RELAY_APPS_SCRIPT_URL = 'https://script.google.com/macros/s/AKfycbyy5Ns3Ec2hbCwwaPBG57HHxsS2jvNxalznOPPfHiJT3aaa-w-YAkARprKt0Lrjr9c4/exec';
|
||||
// ────────────────────────────────────────
|
||||
|
||||
add_action('rest_api_init', function () {
|
||||
register_rest_route('relay/v1', '/webhook', [
|
||||
'methods' => 'POST',
|
||||
'callback' => 'relay_webhook_handler',
|
||||
'permission_callback' => '__return_true', // publiczny endpoint — Elementor woła bez auth
|
||||
]);
|
||||
});
|
||||
|
||||
function relay_webhook_handler(WP_REST_Request $request) {
|
||||
$params = $request->get_params();
|
||||
|
||||
// Fire-and-forget POST do Apps Script — nie czekamy na odpowiedź.
|
||||
// timeout 0.01 + blocking=false = wysyłamy i wracamy do Elementora natychmiast.
|
||||
wp_remote_post(RELAY_APPS_SCRIPT_URL, [
|
||||
'timeout' => 5,
|
||||
'blocking' => false,
|
||||
'body' => $params,
|
||||
'sslverify' => true,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
],
|
||||
]);
|
||||
|
||||
return new WP_REST_Response(['ok' => true], 200);
|
||||
}
|
||||
Reference in New Issue
Block a user