=== Replai - Cookie Consent ===
Contributors: replai
Tags: cookies, gdpr, consent, cookie banner, consent mode
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.2
Stable tag: 1.0.26
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A self-hosted GDPR/CCPA cookie consent banner with prior blocking of third-party scripts, Google Consent Mode v2 and a local consent log.

== Description ==

**Replai - Cookie Consent** is a privacy-first cookie consent plugin — a self-hosted alternative to subscription-based consent services. The banner, the consent log and the prior blocking all run on your own WordPress by default: no external calls are made unless you explicitly connect the optional REPLAI service (see "External services").

* **Prior blocking (before consent):** the most common third-party scripts (Google Analytics, Google Tag Manager, Meta Pixel, Google Ads, LinkedIn, TikTok, Hotjar, Microsoft Clarity, Matomo, YouTube, Vimeo, Google Maps...) are automatically neutralized until the visitor consents. Add extra domains with one line each.
* **Google Consent Mode v2:** consent state is set to "denied" by default and updated automatically when the visitor chooses, so Google Analytics 4 and Google Ads receive the correct signals.
* **Granular categories:** Necessary (always on), Preferences, Statistics and Marketing, with an "Accept all", "Reject all" and "Customize" flow.
* **Consent log (GDPR proof):** every consent is stored locally (date, policy version, choices, hashed IP, page) and can be exported to CSV. IP addresses are never stored in plain text (hashed with a plugin-specific salt).
* **Fully customizable banner:** bottom bar or corner box, light/dark theme, accent color, custom title and message, links to your privacy and cookie policies.
* **Shortcodes:** `[replai_cookie_declaration]` for a cookie table and `[replai_cookie_settings]` to reopen preferences.
* **Optional REPLAI monitoring:** if you are a REPLAI customer, you can add a REPLAI token to monitor this installation from your REPLAI dashboard. This is off by default; nothing is sent unless you add a token.

== External services ==

This plugin can optionally connect to **REPLAI** (https://app.replai.net), a service by REPLAI, to let REPLAI customers monitor their cookie-consent installation from the REPLAI dashboard.

This connection is **optional and disabled by default**. No data is sent to REPLAI unless the site administrator explicitly enters a REPLAI token in Settings → Banner → "REPLAI connection". If the token field is empty, the plugin makes no external calls.

When a token is configured, the plugin contacts REPLAI in these cases:

* When you save or test the token: a request is sent to validate the token (the token/API key is sent).
* Periodically (a daily WordPress cron event) and in real time when a visitor gives consent: the plugin sends site information (site URL, site name, WordPress/PHP/plugin versions, locale and the banner settings), consent aggregates (totals and per-category opt-ins) and individual consent events (consent id, date, chosen categories, method, page URL, a hashed IP — never the raw IP — and the browser language).

REPLAI terms of service: https://replai.net/en/termsandconditions/
REPLAI privacy policy: https://replai.net/en/privacy-policy/

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate it.
3. Go to **Replai Cookies → Settings** and configure the banner, categories and policy links.
4. If you were using another cookie banner service, deactivate it and remove its header script — your third-party scripts will be blocked automatically until consent.

== Frequently Asked Questions ==

= Does it send data to any external service? =
By default, no — the plugin is fully self-hosted and consents are stored in your own database. It only connects to the optional REPLAI service if you explicitly add a REPLAI token (see "External services"). With no token, no data leaves your site.

= Does it work with Google Analytics 4 / Google Ads? =
Yes. Keep Google Consent Mode v2 enabled and the plugin will signal consent automatically.

= How do I add scripts that are not blocked by default? =
Settings → Scripts, add a line `domain|category` (category = preferences, statistics or marketing).

== Screenshots ==

1. General settings: enable the banner, Google Consent Mode v2, consent duration, privacy and cookie policy pages, GDPR consent log and re-ask on policy changes.
2. Banner appearance: position, light/dark theme, accent color, "Reject all" button and floating preferences button (style, side and size).
3. The consent banner on the front end, with cookie categories, per-provider detail and the "Accept all", "Reject all" and "Save preferences" actions.
4. Consent log stored locally as GDPR proof, with date, consent ID, policy version, method and per-category choices, exportable to CSV.

== Changelog ==

A full changelog is also available in CHANGELOG.md.

= 1.0.26 =
* Fixed the last Plugin Check notice: annotated the one-off schema migration query. The plugin now passes Plugin Check with no errors or warnings.

= 1.0.25 =
* Added a friendly, dismissible invitation on the plugin's Settings screen (shown after 30 days of use) to enable the optional "Powered by REPLAI" credit. The credit remains opt-in and disabled by default; enabling it is always an explicit admin action.
* Code quality pass (Plugin Check): all database queries now use $wpdb->prepare() with identifier placeholders, the CSV export no longer uses direct file handles, translator comments added, and template variables prefixed. Minimum WordPress version is now 6.2.

= 1.0.24 =
* Compliance and privacy pass: the optional "Powered by REPLAI" credit is opt-in and disabled by default; the optional REPLAI connection is documented under "External services" with terms and privacy links; IP hashing uses a plugin-specific salt; translations are served by WordPress.org.

= 1.0.23 =
* The banner and the floating button now render inside a Shadow DOM, providing full style isolation between the plugin and the site theme.

= 1.0.22 =
* Floating reopen button redesigned: cookie icon with side and bottom styles, three sizes and a styled tooltip.
* Banner buttons hardened against aggressive theme CSS.
* Consent aggregates are now kept accurate in real time.

= 1.0.16 =
* Cookie declaration: each category shows its cookie count and can be expanded by provider (name, description, storage duration and type), with a built-in catalog of common cookies and support for custom entries.
* The visitor's language is now recorded with each consent (locally and in the CSV export).
* Smoother preferences area: collapsible sections and internal scrolling for long cookie lists.

= 1.0.12 =
* Optional REPLAI connection for REPLAI customers: token validation, connection status card with on-demand test, and installation monitoring (site info, consent aggregates and events with hashed IPs, daily heartbeat).
* Optional "Powered by REPLAI" credit in the banner.
* Refreshed admin design aligned with the REPLAI plugin family; native WordPress color picker for the accent color.

= 1.0.6 =
* Initial public release: consent banner with granular categories, prior blocking of third-party scripts, Google Consent Mode v2, local consent log with CSV export and shortcodes.
* Banner as bottom bar or corner box (right/left) and floating reopen button with position and style options.
* Live page search for the privacy and cookie policy fields.
* Available in English, Spanish, French, Catalan, Italian and Portuguese.
