=== BEST IMG Optimizer ===
Contributors: banso
Tags: images, compression, webp, avif, performance
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Compress and optimize your WordPress media library images 100% locally on your own server. Free tier included, Premium optional.

== Description ==

BEST IMG Optimizer compresses your images (JPEG, PNG, WebP) directly on your own WordPress server, using Imagick or GD. No image is ever sent to an external service.

**Free:**

* One-click compression from the media library (single button or bulk action)
* 20 free optimizations per day (sitewide)

**Premium — €8.90/month, €49.90/year, or €190/year for the Agency plan (unlimited sites):**

* Unlimited images
* WebP + AVIF conversion, replacing the original file
* Automatic optimization on upload
* Bulk-optimize the entire media library in one click
* Automatic resizing of oversized images
* Before/after statistics (total size saved)
* Automatic backup + one-click restore of originals

The Premium license is the same one used for the best-img.com web tool — retrieve your key from your account once subscribed.

== Installation ==

1. Upload the `best-img-optimizer` folder to `/wp-content/plugins/`
2. Activate the plugin from the Plugins menu
3. Go to Settings > BEST IMG Optimizer to configure the compression quality and, if you have one, activate your license

== External services ==

This plugin communicates with the best-img.com API (Banso) in two specific cases, only if you enter a license key in Settings > BEST IMG Optimizer:

* **License activation/verification**: when you paste a license key, that key and your site's URL are sent to `https://best-img.com/api/license/verify` to check the subscription's validity and enforce the site lock (1 site for the Monthly/Yearly plans, unlimited for Agency). No image is ever transmitted to this service — all compression happens locally on your server.
* **Daily re-check**: a scheduled task (WP-Cron) sends the same license key to the same endpoint once a day, to keep the Premium status up to date (renewal, cancellation).

Without a license key entered, the plugin does not contact any external service: all free features run 100% locally.

Service: best-img.com (Banso)
Terms of service: https://best-img.com/cgu.html
Privacy policy: https://best-img.com/privacy.html

== Frequently Asked Questions ==

= Are my images sent anywhere? =

No. All compression happens on your own WordPress server via Imagick or GD.

= Is WebP/AVIF conversion reversible? =

Only with a Premium license: the original image is automatically backed up before any change and can be restored in one click. Without a Premium license, only same-format recompression is available.

= How do I get an unlimited license? =

Subscribe on best-img.com (Monthly, Yearly, or Agency), then grab your license key from your account and paste it into Settings > BEST IMG Optimizer.

== Changelog ==

= 2.2.0 =
* Added: proper translation support. Added a Domain Path header and French (fr_FR) and Italian (it_IT) translation files in /languages, so the plugin now displays correctly in French and Italian, with English as the default source language.

= 2.1.2 =
* WordPress.org Plugin Check compliance pass: sanitized/escaped remaining inputs and outputs, added missing translator comments, replaced direct unlink() calls with wp_delete_file(), removed the now-unnecessary load_plugin_textdomain() call, and translated readme.txt to English (required for the WordPress.org listing).

= 2.1.1 =
* Critical fix: a PHP fatal error occurred on EVERY WordPress admin page (an admin_footer hook pointed to a method removed by mistake during a previous cleanup). Fixed.

= 2.1.0 =
* WordPress.org submission prep: removed the custom update checker (per guidelines, updates now go through WordPress.org). Added the required "External services" section.

= 2.0.0 =
* New pricing model: 3 plans (Monthly €8.90, Yearly €49.90, Agency €190/year unlimited sites).
* Monthly/Yearly licenses are now locked to 1 site — manageable from the best-img.com/account customer area.
* Simplified: the license key is now stable, no more token rotation.

= 1.3.0 =
* Added: basic browser alerts replaced with a proper modal, highlighting Premium (with an "Upgrade" button) when the free daily quota is reached.

= 1.2.3 =
* Final fix for the duplicate confirmation message: dropped WordPress's native Settings API (settings_errors) in favor of a plugin-specific notice system — eliminates the duplicate "Settings saved" box caused by a collision on the shared settings_errors channel.

= 1.2.2 =
* Hardening: confirmation messages (settings/license) are now deduplicated before display, regardless of the exact cause of a potential double emission on the hosting side.

= 1.2.1 =
* Fix: the file size shown in the media library and the "Edit" screen still reflected the pre-optimization size (WordPress caches it in the attachment metadata) — now updated after every compression.

= 1.2.0 =
* Added: automatic detection of new versions directly in Plugins > Installed Plugins (one-click update, like any standard plugin).

= 1.1.4 =
* Renamed: "best-img Optimizer" is now "BEST IMG Optimizer".

= 1.1.3 =
* Fix: the confirmation message stopped appearing after saving (the redirect was missing the settings-updated=true parameter WordPress needs to re-read the message).

= 1.1.2 =
* Fix: the "Settings saved" / "License activated" message could appear twice, and refreshing the page (F5) after saving would resubmit the form. Switched to WordPress's standard Post/Redirect/Get pattern.

= 1.1.1 =
* Fix: broken thumbnails after WebP/AVIF conversion when two WordPress image sizes shared the same physical file (common on small images) — the reference is no longer lost.

= 1.1.0 =
* Added: AVIF conversion (in addition to WebP), automatic resizing, bulk media library optimization, before/after statistics, backup + restore of originals (Premium).
* Fix: the optimization status and "Optimize" button now also show up in the media library's Grid view (previously List view only).

= 1.0.0 =
* Initial release.
