=== Altvisor — Alt Text for WooCommerce ===
Contributors: altvisor
Tags: accessibility, alt text, woocommerce, wcag, eaa
Requires at least: 6.8
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 9.0
WC tested up to: 11.2
Stable tag: 1.0.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate WCAG 2.1 AA alt-text for your product and media images in 24 EU languages with EU-hosted AI, and write it back automatically.

== Description ==

Altvisor helps EU e-commerce shops comply with the European Accessibility Act (Directive 2019/882). This plugin connects your WordPress/WooCommerce store to your Altvisor account and:

* **Sign in with Altvisor** — approve access once in your browser (OAuth 2.1 + PKCE). No API keys to copy or paste.
* **One-click import** — scans your shop, generates alt-text for every product/media image, and writes it back to each image automatically.
* **EU-hosted AI** — generation runs on EU-hosted models; no US data transfer.
* **24 EU languages** — pick a language or use your site default.
* **Usage + history** — see how much of your monthly quota you've used and exactly which images were processed, right inside wp-admin.

Decorative images are written with an empty alt (`alt=""`), and images that already have alt-text are skipped unless you opt to overwrite.

== Installation ==

1. Install and activate the plugin.
2. Open **Altvisor** in the wp-admin menu and click **Connect to Altvisor**.
3. Sign in / sign up and approve access. You'll be returned to your site.
4. Open **Altvisor → Generate alt-text**, choose your scope and language, and click **Start import**.

Your site must be served over HTTPS for the connect flow (OAuth requires it).

== Frequently Asked Questions ==

= Do I need an Altvisor account? =
Yes. The plugin connects to your Altvisor account, which holds your plan and quota. You can create one during the connect flow.

= Does it overwrite existing alt-text? =
No, not by default. Existing non-empty alt-text is preserved unless you enable "Overwrite".

= What happens when I run out of quota? =
The import pauses and shows an upgrade link. Resume after upgrading and it continues where it stopped.


= Host time limits =

Every generation call contains one image. A monotonic whole-operation deadline covers proactive token refresh, connection/read waits, one refresh after a 401, and its single replay. Each confirmed result and queue checkpoint persists before the next operation; normal budget exhaustion yields to another tick without announcing a pause.

Host limits are operator-qualified wall seconds, never inferred from unlimited PHP execution. Set `define('ALTVISOR_HOST_TIME_LIMIT', 90);` in `wp-config.php` only after confirming PHP, FPM `request_terminate_timeout`, web-server/proxy and CDN limits all allow that duration for both `admin-ajax.php` and `wp-cron.php`. A positive integer constant declares the limit; absent/invalid values use 30 seconds. A smaller positive PHP `max_execution_time` caps it, and never raises it.

| Effective host limit | Tick / operation / checkpoint margin (seconds) |
| --- | --- |
| At least 90 seconds | 70/60/10 |
| 30 to less than 90 seconds | host limit minus 10 / host limit minus 15 / 5 |
| Default 30 seconds | 20/15/5 |
| Below 30 seconds | Unsupported: pause before sending any request |

These are default safety allowances, not measured latency guarantees. A slow response can outlast the operation allowance even on a supported host. Shorter hosts yield safely or pause; the plugin never assumes a 70-second runtime or changes the host's execution limit.

`host_limit_unsupported` means the effective host limit is below 30 seconds; qualify a supported host before resuming. `reauthorization_required` or `not_connected` means reconnect Altvisor. `quota_exceeded` retains unfinished images until quota is available. Definitive API rejection also preserves unfinished work.

`uncertain_result` means a response was lost, unreadable, missing its image result, or PHP stopped with generation in flight. The image remains queued without increasing confirmed counters; it may already have used quota. Reloads and cron never automatically retry it. To resend, explicitly check “Retry that image; I understand this may use additional quota” and choose Resume. This is permission to resend, not a refund promise. Reset discards the queue and uncertainty marker; it does not cancel server work or refund quota. Server reconciliation remains a separate contract.

== Changelog ==

= 1.0.4 =
* Declare the installed plugin version and distribution channel during connection and generation.

= 1.0.3 =
* Include the current bulk-import guidance and recovery handling in the downloadable release.

= 1.0.2 =
* Preserve literal failure messages and pause reasons during live bulk-import polling.

= 1.0.1 =
* Show the error code and safe message for failed image generations.

= 1.0.0 =
* Initial release: connect with Altvisor, bulk import, automatic alt write-back, usage and history.
