=== Sogo Consent ===
Contributors: sogodigital
Tags: cookie consent, privacy, gdpr, cookie notice, consent banner
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.1.2
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight cookie consent banner with full admin control. Supports Hebrew and English. No external services. No tracking.

== Description ==

Sogo Consent adds a customisable cookie consent banner to your WordPress site. All settings are managed from the WordPress admin. No external services are used. No visitor data is sent anywhere.

**Consent modes**

* **Full consent mode** — shows Accept All, Reject Non-Essential, and Preferences buttons. The Preferences button opens a modal where visitors can toggle Analytics and Marketing cookie categories individually.
* **Simple notice mode** — shows a single acknowledgement button. Clicking it records that the visitor saw the notice. It does not enable analytics or marketing cookies.

**Layout options**

Four layout options are available: bottom full-width strip, bottom centre card, bottom right card, bottom left card. On mobile and tablet (992px and below) all layouts automatically become a centred floating card.

**Behaviour options**

* Show or hide the banner without deactivating the plugin
* Auto-hide the banner after a configurable number of seconds (1–60)
* Set how long to remember the visitor's choice (1–730 days)
* Bump the policy version to ask visitors to choose again after a policy change

**Appearance options**

Customise background colour, text colour, title colour, primary and secondary button colours, corner radius, and box shadow — all from the Appearance tab in admin.

**Consent storage**

Consent is stored as a first-party browser cookie named `sogo_consent`. It uses `SameSite=Lax` and `Secure` (HTTPS only). The cookie contains the consent status, timestamp, policy version, banner mode, and category choices. No consent data is stored in the WordPress database.

**Developer integration**

A public JavaScript API is available on every page after the plugin loads:

* `window.SogoConsent.getConsent()` — returns the current consent object or null
* `window.SogoConsent.hasConsented()` — returns true if valid consent exists
* `window.SogoConsent.resetConsent()` — clears the cookie and re-shows the banner

A DOM event fires whenever consent changes:

`document.addEventListener('sogoconsent:change', function(e) { console.log(e.detail); });`

Use this event to activate or deactivate analytics or marketing scripts based on the visitor's choice.

**Cache compatibility**

The banner HTML is always present in the page source (hidden via the `hidden` attribute). JavaScript reads the consent cookie on `DOMContentLoaded` and decides whether to show the banner. This approach works with full-page caching plugins.

**RTL and Hebrew support**

The plugin auto-detects the WordPress admin language via `is_rtl()`. On Hebrew installs, all admin labels and default banner text are in Hebrew. The frontend CSS includes scoped RTL layout rules for the modal, toggle, and card positioning.

**What this plugin does NOT do**

* It does not automatically block third-party scripts. It provides a JavaScript API and DOM event so your code or a tag manager can act on consent.
* It does not guarantee legal compliance with GDPR, CCPA, or any other privacy regulation. Consult a qualified legal or privacy professional for your specific situation.
* It does not scan or detect which cookies your site sets.
* It does not store per-visitor consent records in the WordPress database.

== Installation ==

1. Upload the `sogo-consent` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen in WordPress admin.
3. Go to **Settings → Cookie Consent** to configure the banner.
4. Visit the **Content** tab to set banner text and button labels.
5. Visit the **Behaviour** tab to choose banner mode, layout, and dismiss settings.
6. Visit the **Appearance** tab to customise colours and shape.

== Frequently Asked Questions ==

= Does this plugin block analytics or marketing scripts automatically? =

No. The plugin shows a consent banner and records the visitor's choice in a browser cookie. It provides a public JavaScript API (`window.SogoConsent`) and a DOM event (`sogoconsent:change`) so your own code, Google Tag Manager, or another tool can activate or deactivate scripts based on the visitor's consent. Script blocking is not handled by this plugin.

= Where is visitor consent stored? =

Consent is stored entirely in the visitor's browser as a first-party cookie named `sogo_consent`. No consent data is stored in the WordPress database.

= Does the plugin work with caching plugins? =

Yes. The banner HTML is always rendered in the page source and hidden with the `hidden` attribute. JavaScript reads the consent cookie client-side on page load. This approach is compatible with full-page caching plugins.

= What happens when I update my privacy policy? =

Update the **Policy Update Version** value in the Behaviour tab (for example, change `1.0` to `1.1`). Any visitor whose saved consent was recorded under the old version will see the banner again the next time they visit.

= Does the plugin support Hebrew? =

Yes. Hebrew translations are bundled with the plugin. On Hebrew installs, admin labels and default banner text are displayed in Hebrew automatically. No additional translation files need to be installed.

= How do I add a "reset consent" link to a page? =

Add the shortcode `[sogo_consent_reset]` to any page, post, or widget. Clicking it clears the visitor's consent cookie and shows the banner again.

= Does this plugin guarantee GDPR or legal compliance? =

No. The plugin provides a consent interface as a starting point. Whether your implementation meets legal requirements depends on your region, audience, and the specific cookies your site sets. Consult a qualified legal or privacy professional.

= What is the auto-hide feature? =

When auto-hide is enabled, the banner closes automatically after the number of seconds you set. The consent record is saved with `status: auto_dismissed`. This is not treated as consent to analytics or marketing cookies — those remain false in the consent record.

== Changelog ==

= 1.1.2 =
* Internal identifiers were updated to use the final Sogo Consent prefix required by WordPress.org review. No effect on the public JS API (`window.SogoConsent`) or the `sogoconsent:change` event.

= 1.1.1 =
* Fixed mobile and tablet banner layout: all layout variants now display as a centred floating card at 992px and below.
* Fixed RTL desktop layout: bottom-right and bottom-left card options now correctly appear on their labelled physical side on RTL sites.

= 1.1.0 =
* Initial public release.
* Full consent mode with Accept All, Reject Non-Essential, and Preferences modal.
* Simple notice mode with single acknowledgement button.
* Four layout options: bottom full-width, bottom centre, bottom right, bottom left.
* Appearance, Behaviour, and Content settings tabs.
* Public JavaScript API and DOM event for third-party integrations.
* RTL and Hebrew support built in.
* Cache-compatible output.

== Upgrade Notice ==

= 1.1.2 =
Internal identifiers were updated to use the final Sogo Consent prefix required by WordPress.org review. No visible changes; no action required.

= 1.1.1 =
Fixes mobile and tablet banner layout for all four layout options. No settings changes required after upgrading.
