=== CapaAviso ===
Contributors: carlesgarciamaestre
Tags: popup, overlay, notice, modal, announcement
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Overlay-based notices and announcements: pop-up blockers cannot stop them. Multiple fully configurable parallel notices.

== Description ==

**CapaAviso** displays notices, announcements and alerts on your website using **overlay layers** inside the page itself, instead of traditional pop-up windows. Since it never uses `window.open`, **no pop-up blocker can block them**.

The name CapaAviso is a coined Spanish word: «capa» (overlay layer) + «aviso» (notice).

The plugin interface is currently in Spanish; translations can be contributed via translate.wordpress.org.

= Features =

* **Master switch**: enable or disable all notices from the settings page, without deactivating the plugin.
* **Multiple parallel notices**: create as many as you need, each with its own configuration.
* **Scope per notice**: whole site, home page only, only on site entry (first page of the visit), or only via shortcode `[capav_aviso id="123"]`.
* **5 ready-made templates** (text-only, image-only, mixed with button & document, semi-transparent layer, multi-page with navigation) — self-contained with inline styles, so they look the same with any theme. Sample images are bundled, so they work out of the box.
* **One-click example notices**: create all 5 templates as deactivated notices from the Settings page — existing notices are never touched.
* **One-click actions in the notice list**: activate/deactivate without editing, and duplicate a notice (the copy starts as a deactivated draft).
* **Built-in instructions** page inside the WordPress admin.
* For each notice you can define:
  * **Ordinal** (display order when several notices are active).
  * **Internal name** (only visible in the back-end).
  * **Full HTML content** with a visual editor (Design) or code editor (HTML).
  * **Attached images and documents** uploaded from the media library and inserted into the content.
  * **Dimensions** in %, px, vw/vh, with optional automatic height.
  * **Position**: centered, top, bottom, left, right and the four corners.
  * **Display time** with configurable auto-close (seconds).
  * **Manual close** with an × button (and the Escape key).
  * **Sound alert** on open (upload your own mp3/ogg).
  * **Background color** with a visual color picker, plus a **transparent background** option (no color, no shadow) for glass-panel effects.
  * **Expiration date**: the notice switches itself off when the date is reached (site local time).
  * **"Do not show again" link**: visitors who click it will not see that notice again in their browser for 1 year (localStorage + cookie, no IPs stored).
* Notice list with status, position, scope, dimensions and ordinal columns.
* Lightweight: own CSS and JS, no external dependencies.

== Installation ==

1. Upload the `capaviso` folder to `/wp-content/plugins/` (or install the ZIP from *Plugins > Add New > Upload Plugin*).
2. Activate the plugin from the *Plugins* menu.
3. You will see the **Avisos emergentes** menu in the admin panel.
4. Create and enable notices; the master switch is under **Avisos emergentes > Ajustes**.

== Frequently Asked Questions ==

= Why can't pop-up blockers block it? =
Because it does not open new windows: it draws a layer (fixed div) over the page, just like a modal. Blockers only intercept `window.open`.

= Can I switch off all notices without deactivating the plugin? =
Yes: in **Avisos emergentes > Ajustes** uncheck the master switch.

= Does the sound always play? =
Modern browsers may block automatic audio until the user interacts with the page; that is a browser restriction, not a plugin limitation.

== Screenshots ==

1. Notice list with one-click activate/deactivate switches.
2. Editing a notice: visual editor and ready-made templates panel.
3. Individual notice configuration (scope, transparent background, expiration...).
4. Settings: master switch and one-click creation of the 5 example notices.
5. Frontend example: mixed notice with image, text and document button.
6. Frontend example: multi-page notice with Previous/Next navigation.

== Changelog ==

= 2.0.1 =
* Fixed: on sites coming from "Aviso Emergente" 1.x, legacy settings (master switch, z-index) are now migrated before default options are created on activation, so they are no longer overwritten.

= 2.0.0 =
* The plugin is now called **CapaAviso** (formerly "Aviso Emergente"). CapaAviso is a coined Spanish word: «capa» (layer) + «aviso» (notice) — overlay notices.
* All identifiers are now prefixed with `capav_` (functions, classes, options, post meta, shortcode, AJAX actions, script/style handles) to avoid any naming collision.
* The shortcode is now `[capav_aviso id="123"]` (formerly `[ae_aviso]`). If you used the old shortcode in any page, please update it.
* Existing notices, settings and metadata are migrated automatically on update — nothing is lost.
* Security hardening: notice content is now filtered through an allowlist (`wp_kses` with the post tags plus `<button>`) before output.

= 1.3.2 =
* New: the built-in instructions page now includes annotated screenshots of every screen and two published example notices.

= 1.3.1 =
* Improved: the activate/deactivate control in the notice list is now a visual switch (green = active, red = inactive).

= 1.3.0 =
* New: "Transparent background" option per notice (no color, no shadow) for glass-panel effects.
* New: templates now ship with bundled sample images — they work out of the box, nothing to upload.
* New: one-click button in Settings creates the 5 example notices (deactivated) in the list, never replacing existing notices.

= 1.2.0 =
* New: scope per notice — whole site, home page only, only on site entry (first page of the visit), or only via shortcode `[capav_aviso id="123"]`.
* New: 5 ready-made templates (text-only, image-only, mixed with button & document, semi-transparent layer, multi-page with navigation), self-contained so they survive any theme.
* New: activate/deactivate a notice with one click from the notice list (no need to edit it).
* New: duplicate a notice from the list (the copy starts as a deactivated draft).
* New: built-in instructions page inside the WordPress admin.

= 1.1.0 =
* New: per-notice expiration date (switches off automatically when the date is reached, in site local time).
* New: "Do not show again" option per notice; visitors who click it will not see that notice again in their browser for 1 year (localStorage + cookie, no IPs stored).

= 1.0.1 =
* Fixed: the z-index is now applied to the whole overlay layer, preventing themes with stacking contexts (WPBakery, sliders, fixed headers) from covering the notices.

= 1.0.0 =
* Initial release.
