=== AltForge ===
Contributors: fletcherdigital
Tags: accessibility, alt text, seo, ai, media library
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
Stable tag: 2.0.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI-powered alt text generator for WordPress. Pay-as-you-go credit packs — no subscription. Two modes: bulk Library Scan for accessibility coverage, and Page Analyser for SEO-optimised alt text.

== Description ==

AltForge generates high-quality alt text for your WordPress media library using AI. Buy credits in packs — 100, 500, 2000 or 10,000 at a time — no subscription, no expiry. One credit = one image.

Two complementary modes:

* **Library Scan** — bulk process every image in your media library that is missing alt text. Ideal for accessibility compliance on large existing libraries.
* **Page Analyser** — fetch live page HTML, extract SEO keywords from Rank Math / Yoast / SEO Press / AIOSEO, and generate context-aware alt text that weaves target keywords in naturally. Ideal for commercial pages where SEO matters.

All suggestions land in a unified review queue where you approve, edit, or reject before anything is written to the media library.

**Key promises:**

* *Uninstall us and your alt text stays with your site.* Approved alt text is written to native WordPress attachment post meta (`_wp_attachment_image_alt`) — never locked behind a plugin filter or private table.
* Alt text reads like a human wrote it. Keyword integration is subtle and natural. No keyword stuffing, ever.

== Installation ==

1. Upload the `altforge` folder to `/wp-content/plugins/`.
2. Activate through the Plugins menu in WordPress.
3. Sign up at https://altforge.app (10 free credits included).
4. Paste your AltForge API key in AltForge > Settings.
5. Go to AltForge > Library Scan or Page Analyser to begin.

== Frequently Asked Questions ==

= Where do I get an AltForge API key? =

Sign up at https://altforge.app — 10 free credits included. Create a key in **My account → API keys**.

= How much does it cost? =

Pay-as-you-go credit packs. 100 credits for £5, 500 for £20, 2,000 for £60, 10,000 for £200. One credit = one image. No subscription, credits never expire.

= Does this plugin send image data to a third party? =

Yes. Images are sent to the AltForge API (altforge.app), which proxies them to an AI provider for analysis. The AltForge backend does not retain your images after the generation completes. See https://altforge.app/privacy for details.

= What happens if the AI call fails? =

Your credit is automatically refunded. The server only charges for successful generations.

= Do my generated alt text entries go away if I uninstall the plugin? =

No. Approved alt text is written directly to the WordPress `_wp_attachment_image_alt` post meta, which is core WordPress storage. Uninstalling the plugin does not remove it.

== Changelog ==

= 1.0.6 =
* Change: Review queue "Suggested alt" textarea now opens at ~5 visible lines (was ~2), so the full generated text is readable without needing to drag the corner on every row. Still vertically resizable.

= 1.0.5 =
* Change: "Primary keyword override" is now "Primary keyword fallback". Previously, a value entered there was applied to every page in the run, clobbering each page's own SEO-plugin keyword. It now only fills in for pages where no keyword was detected from Rank Math / Yoast / SEO Press / AIOSEO (or the H1/title fallback). Scan a whole sitemap and every page uses its own keyword automatically — only pages with genuinely no keyword use the fallback.
* Change: Same fallback behaviour applied to secondary keywords.

= 1.0.4 =
* New: "Keyword integration style" setting (Subtle / Balanced / Assertive). Controls how aggressively Page Analyser weaves the primary keyword into alt text. Balanced is the new default: the model is told to frame the image within the page's context (service, location, subject type) rather than just describing pixels in isolation. Subtle preserves the original 1.0.0–1.0.3 behaviour. Assertive treats the primary keyword as the framing concept for every image on the page.
* All three styles keep the anti-stuffing safeguards (no keyword lists, no pipes/colons/em-dashes, must read like a human sentence).

= 1.0.3 =
* Fix: Page Analyser now maps page-builder images (Elementor, Bricks, Divi, Beaver Builder, Oxygen, etc) that don't carry a `wp-image-{ID}` class. Extracts URLs from srcset, data-src, data-lazy-src, data-original, data-bg, data-srcset; skips placeholder pixels and base64 data-URIs.
* Fix: Added a fuzzy filename fallback to the image mapper. When path-based URL resolution fails (common with CDNs and builder-rewritten URLs), the mapper now matches by filename against `_wp_attached_file` so images still link back to the media library.
* Logs: "unmappable image" entries now list up to 4 candidate URLs so you can see what the mapper actually tried.

= 1.0.2 =
* New: "Override existing alt text" checkbox on Page Analyser — per-run opt-in to ignore first-context-wins so you can upgrade Library Scan alt text to SEO-aware versions. Suggestions still go through the review queue.
* New: "Regenerate" button on each review-queue row — re-runs the AI with the same context for a different phrasing without re-crawling the page.

= 1.0.1 =
* Fix: Page Analyser now allows fetching the site's own hostname even when it resolves to a private/loopback IP, which is a common hosting pattern. SSRF guard still active for external URLs.

= 1.0.0 =
* Initial release.
