=== AbleGuard Accessibility Toolkit ===
Contributors: itsdpegg, smub
Tags: accessibility, wcag, ada, eaa, compliance
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.4.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Applies the accessibility fixes you approve in your AbleGuard account on your server, as each page is served. Not an overlay.

== Description ==

AbleGuard fixes common accessibility problems on your WordPress site at the source. The fixes are applied on your server, in the HTML of each page, before the page is sent to the visitor. There is no overlay, no widget and no extra JavaScript added to your pages.

AbleGuard is a service with a plugin that runs on your site. In your AbleGuard account you scan your site, review the suggested fixes and approve the ones you want. This plugin downloads the fixes you approved and applies them to your pages. It needs an AbleGuard account to do anything, and it contacts the AbleGuard service to do its job. Read the "External services" section below to see exactly what is sent and when.

What the plugin does:

* Sets attributes on your pages: aria-label, alt, title, role, tabindex, lang and the viewport meta tag
* Fixes text contrast and link visibility with one small injected stylesheet
* Saves approved AI alt text into your Media Library for images that have no alt text yet
* Shows your AbleGuard accessibility statement wherever you add the [ableguard_statement] shortcode
* Fails open: if anything goes wrong while a page is being fixed, visitors get your original page
* Lets an administrator turn fixes off for one page by adding ?ableguard_off=1 to its address
* Has a setting to pause all fixes at any time

== Installation ==

1. In WordPress, go to Plugins, then Add New, search for AbleGuard, and click Install Now, then Activate. You can also upload the plugin zip file with Plugins, Add New, Upload Plugin.
2. In WordPress, open AbleGuard in the admin menu (or click Settings on the AbleGuard row of the Plugins screen) and press "Connect to AbleGuard".
3. On the AbleGuard website, sign in or create a free account and approve your site. You come straight back to WordPress, connected, and the first sync runs by itself. The screen then shows how many approved fixes are being applied to your pages, and which AbleGuard account the site is connected to.
4. If one-click connect is not available on your site, open "Connect manually (advanced)" on the same screen. Paste in the API address, Site ID and Site token that your AbleGuard dashboard (https://app.ableguard.com) shows for your website, press Save connection details, then press Sync now.
5. Optional: add the shortcode [ableguard_statement] to a page to publish your accessibility statement.

== Frequently Asked Questions ==

= Do I need an AbleGuard account? =

Yes. The plugin only applies fixes that you approve in your AbleGuard account, so without an account it has nothing to apply. You can create an account at https://ableguard.com. Some features need a paid plan, including applying fixes to your pages. See https://ableguard.com/pricing.html for what each plan includes.

= Is this an accessibility overlay? =

No. An overlay adds a script that changes your pages in the visitor's browser. AbleGuard applies approved fixes on your server, in the HTML itself, before the page is sent. Visitors get the fixed page whether or not their browser runs JavaScript, and the plugin adds no script to your pages.

= What happens if AbleGuard is unreachable? =

Your site keeps working. The plugin applies fixes from the copy it already downloaded, so your pages do not wait on AbleGuard, and it syncs again the next time it can. If something goes wrong while a fix is being applied, the plugin fails open and serves your original page unchanged. The one exception to not waiting is a page that shows the [ableguard_statement] shortcode: it asks AbleGuard for the statement when none has been downloaded yet.

= How do I bypass the plugin in an emergency? =

Log in as an administrator and add ?ableguard_off=1 to the address of the page (or &ableguard_off=1 if the address already has a query string). That page is then served without any AbleGuard fixes. To stop fixes for everyone, untick "Apply approved fixes to my pages" on the AbleGuard settings screen, or deactivate the plugin.

= Does the plugin change my content? =

Fixes are applied to each page as it is served, and the content of your posts and pages is not edited. The one exception is image alt text. When you approve AI-generated alt text, the plugin saves it into your Media Library for images that have no alt text yet. It never replaces alt text you wrote, and the saved text stays if you deactivate the plugin.

= Does my theme need to do anything for the CSS fixes to apply? =
The CSS fixes are printed through `wp_head()`, which WordPress themes are required to call. A theme that does not call it still gets the attribute fixes, but not the CSS fixes.

= Does the plugin track my visitors? =

No. The plugin adds no tracking code or third-party scripts to your pages, and it does not send information about your visitors to AbleGuard. See "External services" for exactly what is sent.

= Will this make my site compliant with the ADA, the EAA or WCAG? =

No tool can promise that. AbleGuard applies the fixes that can be made safely and automatically, and some problems need a person to fix them. AbleGuard is not legal advice and does not guarantee compliance with any law or standard.

== External services ==

This plugin connects your site to the AbleGuard service, a hosted accessibility service at https://ableguard.com. It is the only outside service the plugin contacts. An AbleGuard account is needed to use the plugin.

The plugin contacts only AbleGuard's own addresses: https://app.ableguard.com, and https://app-staging.ableguard.com if you choose it under "Connect manually (advanced)". It does not follow redirects, and it refuses any other address unless a developer has allowed one by defining the ABLEGUARD_ALLOW_CUSTOM_API constant in wp-config.php. Nothing is sent until you press "Connect to AbleGuard", or save a Site ID and a Site token.

What the service is used for:

* To connect your site to your AbleGuard account when you press "Connect to AbleGuard".
* To download the accessibility fixes you approved in your AbleGuard account, so the plugin can apply them to your pages.
* To download your accessibility statement, so the [ableguard_statement] shortcode can show it on your site.
* To tell AbleGuard about your site's setup, so your dashboard can show which theme or plugin an accessibility problem comes from, and so your statement describes your site accurately.

What is sent and when. Connecting happens only when you press "Connect to AbleGuard" on the settings screen, and takes four steps:

1. Availability check: a GET request that asks whether one-click connect is switched on. Nothing about your site is sent.
2. Your browser opens the AbleGuard website. The address it opens carries your site's address, the address WordPress should return your browser to, and values that tie the request to this one click (a one-time code challenge and a hash of a secret). The secret itself is kept in your browser's address after the "#", which a browser never sends to any website, and so it is in no request.
3. While you approve, AbleGuard's server makes one request to your site, to a short address that only exists while the request is open: https://your-site/wp-json/ableguard/v1/connect-challenge, or your site's address with ?ableguard_connect_challenge= added. It checks that the plain text your site answers with is the one it expects, which shows that you control the site. Nothing about your site is revealed to anyone else by it.
4. When you approve, your site sends AbleGuard the one-time code and a verifier it has kept secret, with your site's address, and AbleGuard answers with your Site ID, your Site token and a masked version of your account's email address, for example d***@example.com. The plugin stores the masked address and shows it on the settings screen, so that you can see which account the site is connected to.

Each sync makes up to three requests. The second and third are only made if the first succeeds.

1. Approved fixes: a GET request that sends your Site ID (in the request address) and your Site token (in an Authorization header). Nothing else is sent.
2. Accessibility statement: a GET request that sends the same two things and nothing else.
3. Site setup report: a POST request that sends the same two things plus a short report containing your WordPress version, your site language (locale), the name and version of your active theme, the list of your active plugins (each plugin's folder and file name, for example akismet/akismet.php), the AbleGuard plugin version, and whether "Apply approved fixes to my pages" is ticked.

As with any request made by WordPress, the service can also see your server's IP address and WordPress's standard User-Agent header, which contains your WordPress version and your site address.

No page content, posts, user accounts or visitor information is sent.

When a sync runs:

* Right after you connect the site.
* When you press Sync now on the AbleGuard settings screen.
* Automatically twice a day, from a WordPress scheduled event that is added when you activate the plugin and removed when you deactivate it.
* When a page that shows the [ableguard_statement] shortcode is viewed and no statement has been downloaded yet. This sync runs during that page view, and at most once every five minutes for the whole site, however many people visit. Other views in that time send nothing to AbleGuard.

Also, if you have no approved fixes, a page that shows the same shortcode repeats request 2 only, to refresh the stored statement. It counts toward the same five-minute limit.

The AbleGuard service: https://ableguard.com. Terms of service: https://ableguard.com/terms.html. Privacy policy: https://ableguard.com/privacy.html.

== Changelog ==

= 0.4.1 =
* Styles are added through the WordPress enqueue API: the settings screen's stylesheet loads only on the AbleGuard screen, and the approved CSS fixes are printed with the rest of your page's styles. The fixes now arrive through the standard WordPress stylesheet mechanism and print at the end of the head.

= 0.4.0 =
* One-click connect. Press "Connect to AbleGuard" on the settings screen, sign in or create a free account, approve your site, and you come straight back to WordPress connected. The three values you used to paste are still there, under "Connect manually (advanced)", for sites where one-click connect is not available.
* The settings screen now says which AbleGuard account the site is connected to, as a masked address, and has Reconnect and Disconnect buttons. The saved site token is no longer printed into the page.
* The plugin now only talks to https://app.ableguard.com and https://app-staging.ableguard.com, and its requests no longer follow redirects. A site saved with any other API address stops syncing, but keeps applying the fixes it has already downloaded, until it is connected again.
* Your connection details and your synced fixes are now kept in two records that are only ever changed together, under a lock. They are moved across from the old options on the first request after the update, and your fixes stay applied while that happens.
* Fixes and your accessibility statement now stop being applied when the connection is removed, instead of staying in place.

= 0.3.1 =
* The stylesheet the plugin adds to your pages is now identified as `ableguard-fixes`, and the settings screen's markup uses AbleGuard names throughout. If a caching or optimization plugin on your site refers to the id that stylesheet had before, update it to `ableguard-fixes-inline-css`, the id WordPress prints for the stylesheet with the handle `ableguard-fixes`. Nothing else changes in how fixes are applied.

= 0.3.0 =
* The accessibility statement shown by the [ableguard_statement] shortcode now names AbleGuard in plain text and no longer links to the AbleGuard website.
* The twice-daily sync now tells AbleGuard whether "Apply approved fixes to my pages" is ticked. Unticking it stops every fix, but the sync kept running and said nothing about it, so a paused site's published accessibility statement went on claiming its pages were being corrected. A paused site now says so.

= 0.2.0 =
* Verification can now measure a real "before": AbleGuard can request one unfixed copy of a single page with a short-lived, single-use value signed with your site token. Nothing else can strip your fixes, and requests that fail any check are served exactly like a normal visit.

= 0.1.0 =
* Initial release: rule sync, server-side fix application, settings screen.
