=== GDPR Consent Manager ===
Contributors: aiwpcoder
Tags: gdpr, cookie consent, privacy, PECR, uk gdpr, cookie banner, consent management
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Complete UK GDPR, GDPR, and PECR compliant consent management with granular categories, script blocking, WCAG 2.1 AA banner, and audit-ready consent log.

== Description ==

GDPR Consent Manager delivers legally compliant cookie consent without wrecking page speed or design.

**Core Features:**

* **Granular categories** – Strictly necessary, functional, analytics, advertising, and personalisation by default. Add custom categories with descriptions and legal basis.
* **Script blocking until consent** – Scripts tagged with `data-cm-category` are blocked at render time. Scripts fire the moment consent is granted, with no page reload required.
* **Equal-prominence banner** – Accept, Reject, and Customise buttons of equal visual weight. Configurable position (bottom bar, top bar, bottom-left corner, bottom-right corner), colours, and copy.
* **WCAG 2.1 AA compliant** – Fully keyboard navigable, screen-reader friendly, focus-trapped modals, minimum 44px touch targets.
* **Preference centre** – Floating re-open icon plus a `[cm_preference_centre]` shortcode for users to revisit and withdraw consent at any time.
* **Consent log** – Every consent event is logged with timestamp, hashed IP, user agent, banner version, chosen categories, and exact consent text. Viewable in admin, exportable as CSV or JSON for DPA requests and audits.
* **Admin UI** – Settings under Privacy > Consent Manager with tabs for Categories, Scripts, Banner Design, Behaviour, Log, and Integrations.
* **Live preview pane** – See banner changes in real time before saving.
* **Block report** – Scans your site and flags untagged third-party scripts.
* **Google Consent Mode v2** – Automatically sends `gtag` consent signals for `analytics_storage`, `ad_storage`, `ad_user_data`, `ad_personalization`, `functionality_storage`, and `personalization_storage`.
* **PHP API** – `cm_has_consent('analytics')` for theme and plugin developers.
* **No external calls** – Everything runs locally. No CDN dependencies.

== Installation ==

1. Upload the `gdpr-consent-manager` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Privacy > Consent Manager** to configure your banner.

== Frequently Asked Questions ==

= How do I block a third-party script? =

Add `data-cm-category="analytics"` (or whichever category) to your `<script>` tag, or add a URL pattern under the Scripts tab in the admin.

= How do I let users re-open the preference centre? =

Use the `[cm_preference_centre]` shortcode anywhere on your site, or use the floating cookie icon that appears after consent is given.

= Can I add custom consent categories? =

Yes. Go to Privacy > Consent Manager > Categories and fill in the "Add Custom Category" form.

= How do I export consent records for a DPA request? =

Go to Privacy > Consent Manager > Consent Log and click Export CSV or Export JSON.

= How do I use the PHP API? =

`<?php if ( cm_has_consent( 'analytics' ) ) { /* output analytics script */ } ?>`

== Screenshots ==

1. Consent banner with equal-prominence Accept, Reject, and Customise buttons.
2. Preference centre modal with category toggles.
3. Admin settings - Banner Design tab with live preview.
4. Admin settings - Consent Log tab with export options.
5. Admin settings - Categories tab.

== Changelog ==

= 1.0.0 =
* Initial release.
* Granular consent categories (strictly necessary, functional, analytics, advertising, personalisation).
* Script blocking via output buffer and data-cm-category attribute.
* WCAG 2.1 AA compliant banner with equal-prominence buttons.
* Preference centre modal with category toggles.
* Floating re-open button and [cm_preference_centre] shortcode.
* Consent log with CSV/JSON export.
* Google Consent Mode v2 signals.
* PHP developer API: cm_has_consent().
* Admin UI with live preview and block report.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
