=== Smart Convert – Currency & Unit Conversion ===
Contributors: PetrNovak
Tags: currency converter, unit converter, exchange rates, geoip, measurement
Requires at least: 5.4
Tested up to: 6.9
Requires PHP: 7.2
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The ultimate conversion engine: 153 Currencies, 105+ Units, Custom Unit Builder, GeoIP detection, and a native Gutenberg Block with live previews.

== Description ==

Smart Convert – Currency & Unit Conversion is not just another calculator, it is a complete conversion infrastructure for WordPress sites. Designed for performance and flexibility, it handles everything from simple currency exchanges to complex, non-linear physical unit conversions (like Temperature).

Whether you run a travel blog, or a technical documentation hub, this plugin ensures your visitors see accurate conversions in a format that fits your design.

🚀 My Ambition: Premium Features for Free With this initial release, my goal is to set a new standard for what a free plugin can offer. I believe advanced tools shouldn't be locked behind a paywall. That is why Smart Convert includes enterprise-grade features usually found only in paid versions: a Custom Unit Builder, a Template Engine, Import/Export capabilities, and Automatic Geolocation—all completely free.

=== 🌟 Key Features ===

**💰 Advanced Currency Engine**
* **Rates:** Supports 153 global currencies + cryptocurrencies (BTC, ETH, etc.).
* **Smart Geo-Location:** Automatically detects visitor IP to display their local currency (powered by ipinfo.io).
* **"Spread" & Fees:** Add a percentage markup (e.g., 2%) to exchange rates to simulate bank fees or retail pricing.
* **Smart Rounding:** Intelligently adjusts decimals (e.g., 0 decimals for JPY, 6 decimals for BTC).

**📏 Comprehensive Unit Converter**
* **105+ Built-in Units:** Covers 14 categories including Length, Mass, Volume, Temperature, Pressure, Energy, Speed, and Data.
* **Bi-Directional Custom Units:** Creating a unit like "Box" (e.g., 1 Box = 12 Items). The plugin automatically generates the reverse conversion logic for you.
* **Complex Math:** Handles non-linear conversions (like Fahrenheit to Celsius) with precision offset calculations.

**🎨 Visual & Editor Integration**
* **Native Gutenberg Block:** Visually configure conversions (Amount, From, To, Decimals) with a live backend preview.
* **Inline Toolbar Tool:** Select any text in your post and convert it instantly using the rich text toolbar button.
* **Interactive Tooltips:** Solves the common "overflow:hidden" clipping issue using a smart portal strategy to display rates on hover.
* **Template System:** Design your output using placeholders like `{FROM}`, `{TO}`, `{RATE}`, and `{DATE}`.

**⚙️ Performance & Workflow**
* **Zero Database Bloat:** Uses robust Object Caching and Transients.
* **Import/Export:** Transfer your custom templates and custom units between sites via JSON.
* **Privacy First:** External connections are disabled by default until explicit consent is given via the Onboarding Wizard.

=== 🌍 Internationalization & Translations ===

Smart Convert – Currency & Unit Conversion is fully localized and ready for global audiences. The plugin is translated into the following languages:

* English
* Spanish (Español)
* Japanese (日本語)
* German (Deutsch)
* French (Français)
* Russian (Русский)
* Brazilian Portuguese (Português do Brasil)
* Italian (Italiano)
* Czech (Čeština)
* Dutch (Nederlands)
* Turkish (Türkçe)
* Polish (Polski)
* Indonesian (Bahasa Indonesia)

=== ⚖️ Privacy & External Services Disclosure ===

To provide up-to-date exchange rates and geolocation features, this plugin may connect to selected third-party services.
**No data is sent without your explicit consent via the settings page.**

1.  **Currency & Unit Data (Google Sheets via Proxy)**
    * **Service:** Downloads conversion rates from public datasets.
    * **Mechanism:** Requests are routed through a static redirect wrapper on `petrnovak.cz` to ensure link stability.
    * **Data Sent:** Your server's IP address (standard HTTP request). No visitor data is sent.
    * **Policy:** [Google Privacy Policy](https://policies.google.com/privacy)
    * **Proxy Policy:** [PetrNovak.cz Privacy Policy](https://petrnovak.cz/plugins/smart-convert-currency-unit-conversion/privacy-policy.php)

2.  **Geolocation (IPinfo.io)**
    * **Service:** Used **only** if "Auto-detect currency from IP" is enabled in settings.
    * **Mechanism:** Sends the visitor's IP address to IPinfo.io to determine their country code (e.g., "US").
    * **Data Sent:** Visitor IP Address.
    * **Policy:** [IPinfo Privacy Policy](https://ipinfo.io/privacy)

== Installation ==

1.  Upload the plugin files to the `/wp-content/plugins/smart-convert-currency-unit-conversion` directory, or install the plugin through the WordPress plugins screen.
2.  Activate the plugin through the 'Plugins' screen in WordPress.
3.  **Onboarding:** You will be redirected to a setup wizard.
Click "Connect & Initialize" to download the latest rates and unit definitions.
4.  Navigate to **Settings → Smart Convert – Currency & Unit Conversion** to configure your default currency and display preferences.

== Frequently Asked Questions ==

= Can I add my own units (e.g., "Pallets" to "Kilograms")? =
Yes!
Go to the **Units** tab and scroll to "Add Custom Unit". You can define a name, symbol, and conversion factor.
The plugin handles the math for both directions automatically.

= How does the Gutenberg Inline Tool work? =
Highlight any number in your text editor (e.g., "100"), click the "Money/Convert" icon in the toolbar, and a popup will appear letting you choose the target currency or unit.

= Does this plugin slow down my site? =
No. Exchange rates are cached in your database (transients) and updated only once daily via WP-Cron.
The frontend shortcode uses these cached values, so no external API calls happen when a visitor loads your page.

= Can I use this for Cryptocurrencies? =
Yes. The plugin supports major crypto assets like Bitcoin (BTC) and Ethereum (ETH).
It also includes logic to handle high-precision decimals (up to 6 places) for small crypto amounts.

= What are the Shortcode Macros/Placeholders? =
When creating a custom output template, you can use:
* `{FROM}` - The source amount with symbol (e.g., $10)
* `{TO}` - The converted amount with symbol (e.g., €8.50)
* `{RATE}` - The exchange rate used (e.g., 0.85)
* `{DATE}` - The date the rate was last updated
* `{RATE_INFO}` - A formatted string showing rate + spread details (ideal for tooltips)

== Screenshots ==

1. **General Settings:** Configure update intervals, number formatting, and global exchange rate markups.
2. **Template Manager:** Manage default settings or export and import custom display formats via JSON.
3. **Live Rates Dashboard:** Monitor active exchange rates and their last update times in a clear table.
4. **Custom Unit Builder:** Create bidirectional custom units with equation previews (e.g., Pallet to Boxes).
5. **Conversion Modal:** Easily insert conversions with a smart popup that handles amounts, currencies, and formats.
6. **Interactive Tooltips:** Hover over a conversion to see the exact rate, timestamp, and markup details.
7. **Particle Update UI:** Visual feedback during manual rate updates and data synchronization.

== Changelog ==

= 1.0.2 =
* Updated: Translations were updated.

= 1.0.1 =
* Improved: Added translator comments to clarify string context for localization.

= 1.0.0 =
* Initial release.
* Added: 153 Currencies & 105 Physical Units.
* Added: Native Gutenberg Block & Inline Toolbar integration.
* Added: Custom Unit Builder with Import/Export.
* Added: Template Manager for custom output formatting.
* Added: Geolocation (IP-to-Currency) support via IPinfo.io.
* Added: "Spread" feature for exchange rate markup.
* Security: Implemented strict nonce checks and capability validation on all AJAX endpoints.
* Performance: Implemented Object Caching for rate lookups.

== Upgrade Notice ==

= 1.0.2 =
Translations were updated.

= 1.0.1 =
This update adds translator comments to improve clarity for localization tools and human translators.

= 1.0.0 =
This is the first stable release of Smart Convert – Currency & Unit Conversion.
Please ensure your server supports PHP 7.2 or higher.