=== Pewit AI Image Optimizer ===
Contributors: michalczajka, pewitlabs
Tags: compression, webp, avif, performance, images
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Smart JPEG/PNG compression with WebP/AVIF sidecars, AV1 WebM video sidecars (ffmpeg) and backup-first bulk jobs. Every feature is free.

== Description ==

Plugin homepage, documentation and paid plans: https://pewitlabs.com/product-ai-image-optimizer.html

Pewit AI Image Optimizer compresses JPEG and PNG images using the WordPress image editor (no external binaries), optionally writes WebP and AVIF sidecars next to the original, and can create AV1 WebM sidecars for video via ffmpeg. It scans your library for heavy and LCP-critical images, previews savings per file, and processes bulk jobs in the background with automatic backups and one-click rollback.

= Fully functional and free =
Every feature in this plugin is free and fully functional: scan your library, preview and apply compression one image at a time, find LCP-critical images over a size budget, create WebP/AVIF sidecars, create AV1 WebM video sidecars (ffmpeg), run bulk background optimization jobs, auto-optimize on upload, back up originals before changes and roll back with one click. Nothing is locked behind a license.

Optionally, you can subscribe to priority support at https://pewitlabs.com/product-ai-image-optimizer.html — this is a paid external service, not a requirement to use the plugin.

= Compression =
* JPEG quality and PNG compression level controls.
* WebP sidecar with compression priority presets.
* AVIF sidecar with configurable quality.
* AV1 WebM video sidecar via ffmpeg (libsvtav1 / libaom-av1).
* Before/after size preview — you approve each save.

= Scanning =
* Library scan with a configurable size threshold.
* PageSpeed Budget: find LCP-critical images (featured + first in content) over a KB budget.
* Used-images-only filter and filename exclude patterns.
* EtchWP-aware scanning when EtchWP is active.

= Background jobs & safety =
* Bulk background optimization via WP-Cron, one image at a time.
* Auto-optimize JPEG/PNG and video on upload.
* Backup-first snapshots of originals with one-click rollback.
* Optional email report when a bulk job completes.

== Installation ==

1. Upload the plugin ZIP through Plugins -> Add New -> Upload Plugin, or extract it to wp-content/plugins/pewit-ai-image-optimizer/.
2. Activate the plugin.
3. Open Pewit AI Image Optimizer -> Settings, set JPEG quality and PNG compression.
4. Run a library scan, preview savings and apply.

The plugin folder must always be pewit-ai-image-optimizer/ and the main file pewit-ai-image-optimizer.php.

== External services ==

This plugin compresses and converts media locally on your own server using the WordPress image editor and (optionally) a locally installed ffmpeg binary. It does not send your images or media to any third-party AI provider, and no API key is required.

The only third-party service the plugin can connect to is Freemius, used for licensing and updates:

Freemius (licensing & updates — https://freemius.com):
* What and when: used for license activation, plugin updates and, for any optional paid plan, checkout as Merchant of Record. Opt-in diagnostic data sharing is optional and only sent if you agree during activation.
* Data sent: when opted in, basic site/environment and plugin usage data for license validation and update delivery.
* Terms: https://freemius.com/terms/ — Privacy: https://freemius.com/privacy/

== Source code ==

All JavaScript and CSS shipped in this plugin (in assets/js and assets/css) is the original, hand-written, human-readable source. Nothing is minified, compiled, transpiled or generated by a build tool, so no separate source files are required — what you read in the plugin is the source. The only bundled third-party library is the Freemius SDK (vendor/freemius), whose source is available at https://github.com/Freemius/wordpress-sdk

== Frequently Asked Questions ==

= Is everything really free? =
Yes. Every feature — including bulk jobs, WebP/AVIF sidecars, AV1 video sidecars, auto-on-upload, backups and rollback — works without a paid license.

= Do I need OpenAI or another AI API? =
No. This plugin compresses images locally with the WordPress image editor — no API key and no AI provider calls.

= Do I need ffmpeg? =
Only for AV1 WebM video sidecars. Image compression and WebP/AVIF work without it (subject to your server's GD/Imagick support).

== Changelog ==

= 1.1.3 =
* Changed: Tested up to WordPress 7.1.
* Fixed: hide third-party admin notices (license nags from other plugins) on PEWIT admin screens.

= 1.1.2 =
* Fixed: Plugin Check escaping and AJAX nonce/sanitization hygiene for wordpress.org directory publish.

= 1.1.1 =
* Changed: the wordpress.org build now physically ships with zero license/plan feature gating — every feature is unconditionally available in the source. Plan checks live only in the separate Freemius premium build.
* Fixed: prefixed remaining globals (AIIO_DeactivatePrompt, aiio_backup_root/aiio_backup_base_dir) to avoid collisions.
* Added: "Source code" section documenting that all JS/CSS is hand-written, unminified source.

= 1.1.0 =
* Changed: renamed to "Pewit AI Image Optimizer" (new slug pewit-ai-image-optimizer) for a distinctive directory name.
* Changed: every feature is now free and fully functional — no license gating of built-in features. Optional paid support remains available as an external service.
* Added: External services documentation (Freemius) with terms/privacy links.
* Fixed: removed Google Fonts (no external font requests); admin uses a system font stack.
* Fixed: all admin styles/scripts are enqueued with the plugin version constant.

= 1.0.2 =
* Fixed: Plugin Check advisory warnings — annotated direct DB cleanup queries and the shared suite backup helper/hook.

= 1.0.1 =
* Fixed: WordPress Plugin Check — i18n translators comments, filesystem helpers (wp_delete_file, annotated CSV/backup writes), removed manual textdomain loading.

= 1.0.0 =
* First stable public release: compression, WebP + AVIF sidecars, video AV1 WebM sidecar (ffmpeg), LCP scan, bulk jobs, backups, rollback, auto-on-upload.

= 0.5.0 =
* Optimize LCP over budget — one-click bulk job for LCP-critical images above KB budget.

= 0.1.0 =
* Beta: scan, single optimize, WebP sidecars, backups, bulk cron jobs, rollback.
