=== Cache Purge for Azure Front Door ===
Contributors: hiberus, juanjoache, romerog, dromang, sllorentedev, javiermarin, jgmf
Tags: azure, cache, front door, purge, cdn
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage and execute Azure Front Door cache purges from your WordPress dashboard.

== Description ==

* **Manual Purge Control:** Execute a global cache purge (/*) at the click of a button from the admin interface.
* **Connection Validator:** Quickly verify if your Azure credentials (Tenant ID, Client ID, etc.) are correctly configured.
* **Detailed Activity Logs:** A comprehensive history of all purge actions, showing who triggered the purge, the result, and the API response time.
* **Security Focused:** Built using WordPress best practices, including Settings API and secure AJAX handlers.

This plugin uses Azure’s REST API to send cache invalidation requests. It is lightweight and non-intrusive.
This plugin is not affiliated with Microsoft. "Azure" and "Azure Front Door" are trademarks of Microsoft Corporation.
For more details, see the official [Azure Front Door Purge Content API documentation](https://learn.microsoft.com/en-us/rest/api/frontdoor/azurefrontdoorstandardpremium/afd-endpoints/purge-content).

== External Services ==

This plugin relies on the **Azure Management API** to perform cache purges.

* **Service:** Azure Management API (https://management.azure.com)
* **Purpose:** This service is used to send purge commands to your Azure Front Door profile.
* **Data Sent:** No user data is sent. The plugin only sends the content paths (URLs) to be purged and the authentication token provided by your Azure Tenant.
* **Terms of Service:** [Azure Legal Information](https://azure.microsoft.com/en-us/support/legal/)

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Azure Purge** menu and select **Settings** tab to enter your Azure credentials (Tenant ID, Client ID, Secret, etc.).
4. Go to **Azure Purge** menu and select **Activity** tab to verify the connection.

== Frequently Asked Questions ==
= Can I target specific URLs? =
Currently, the plugin purges /* (all cached content) by default. Custom patterns will be supported in a future version.

= Where are logs stored? =
The plugin creates a custom database table (wp_azure_cache_logs) to store purge attempts and their results.

= What permissions do I need in Azure? =
The App Registration used must have at least the "CDN Endpoint Contributor" role on your Azure Front Door resource.

== Screenshots ==
1. The Activity Log page with the "Manually Purge Cache" button.
2. The Settings page where Azure credentials are securely stored.

== Privacy ==
This plugin sends requests to the Azure API to purge cache. It does not transmit or store any personal user data. It is fully GDPR-compliant.

== Changelog ==

= 1.3 =
* Added filters to the logs table: date range (start and end), action, result contains, user, and duration range.
* Improved internationalization: Spanish translations for filter labels and buttons.
* Improved security in AJAX actions by enforcing nonce validation.
* Introduced a custom plugin capability (`access_azure_cache`) and replaced all usage of `manage_options`.
* Standardized activation and uninstall processes:
  - Activation: creates logs table and assigns the plugin capability to Administrators.
  - Uninstall: safely removes custom DB table and plugin options.
* Improved internationalization loading (textdomain) and added localized strings to JavaScript.
* Codebase hardening and structural cleanup, without modifying core purge logic.

= 1.2 =
* Unified menu structure: Single "Azure Purge" menu with "Activity" and "Settings" tabs.
* Added full internationalization (i18n) support.
* Added Spanish translations for all plugin text and JavaScript buttons.
* Added descriptive help text below all configuration inputs in Settings.

= 1.1 =
* Added Settings API for secure credential storage.
* Implemented Object Caching for log performance.
* Improved security with Nonces and SQL preparation.

= 1.0 =
* Initial release to the public repository.

== Upgrade Notice ==

= 1.3 =
Security improvements: AJAX actions are now protected with nonces, and a dedicated capability (`access_azure_cache`) has been added. It is recommended to update.
