=== Datoden Page Cache ===
Contributors: datoden
Tags: cache, page cache, performance, speed
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.0.15
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Makes the website fast: every page is saved as a finished HTML file and served directly and emptied by itself when something changes.

== Description ==

In the WordPress admin the plugin is shown as "DT-cache" in the DT-addons menu (Datoden's menu).

* Page cache: every page is saved as a finished HTML file the first time it is visited. On Apache and LiteSpeed the server sends the file directly through .htaccess, without starting WordPress. On other servers (for example Nginx) the plugin sends it before the rest of WordPress loads.
* The website's own domain is cached. Other domains (for example language domains in DT-language) are shown live, never mixed up.
* Never cached: logged-in users, commenters, password-protected pages, search, 404, previews, shop cart and checkout, pages marked DONOTCACHEPAGE and responses that set cookies. Tracking parameters (utm_*, fbclid, gclid …) share the page's cache.
* Lifetime from 1 hour to 1 week, or until something changes.
* Never save chosen pages: one address per line, or everything that starts with or contains a word.
* Empties itself when pages, posts, menus, widgets, the Customizer, the theme or plugins change – and when other plugins ask for it (do_action('datoden_cache_purge') and the common litespeed_purge_all signal both work).
* Check: shows whether the front page comes from the server, from the plugin or not from the cache – and why.
* Empty all cache or just the page you are looking at from the admin bar.
* Move from WP Fastest Cache with one click: settings and excluded pages are taken over, WP Fastest Cache is turned off and its cache and .htaccess rules are removed.

= Pro add-on =

In the separate paid add-on Datoden Page Cache Pro (from Datoden, not part of this plugin): filling the cache in the background, a separate cache for every domain and language and for mobiles, smaller HTML, CSS and JavaScript, gzip, browser cache and no emoji script.

= Free Datoden account (optional) =

Everything in the plugin works without an account. A free Datoden account adds DT-website-guard, an overview of all your websites and settings profiles you can use on other websites.

== Frequently Asked Questions ==

= Where are the files? =

In wp-content/cache/dt-cache/<domain>/<address>/index.html.

= How do I stop a page from being cached? =

Add it under Never save these pages, or define DONOTCACHEPAGE in the code that shows it.

== External services ==

This plugin can connect to Datoden (https://datoden.com), a service run by Responsit AB, Sweden. The connection is optional – everything in the plugin works without it. Nothing is sent to Datoden until an administrator clicks "Start DT-website-guard" (or "Connect") in the WordPress admin and approves the connection on datoden.se or datoden.com. You can disconnect at any time with "Disconnect" (or by turning DT-website-guard off) on the DT-website-guard page; then nothing more is sent.

What is sent to Datoden, and when (only while the website is connected, except the connection itself):

* When you connect: the website address, the administrator's language (Swedish or English), the WordPress address that Datoden returns to and a random check value. After you approve on Datoden, the website sends the one-time code it got back, together with the website address and the language, and receives a website key that is stored in your database.
* Once a day (WordPress cron), and when an administrator opens a DT plugin page and the last contact is more than six hours old: the website key, the language, and the folder names, versions and active state of the installed Datoden plugins (for example datoden-cookie-consent). The answer can contain short messages from Datoden and updated wording for the DT plugins' texts, which are shown on the plugins' pages.
* When an administrator opens the DT-website-guard page or a DT plugin page (at most every five minutes), or clicks "Check again": the website key, to get the latest result of Datoden's monitoring (up or down, response time, and the expiry dates of the SSL certificate and the domain). "Check again" also asks Datoden to check the website once more.
* When the DT-website-guard page is shown and the DT-website-guard plugin is installed: the list of Datoden's plugins and their versions is fetched from datoden.se, at most every six hours. No data about the website is sent.
* When you click "My websites": the website key, the language and the email address of the logged-in WordPress user, so that Datoden can sign you in directly if it is the same address as your Datoden account.
* When you save, use or delete a settings profile: the website key, and when saving the settings of DT-cookie and DT-darkmode (no personal data; website-specific values such as the logo and the privacy page are left out). They are stored in or read from your Datoden account.
* When you disconnect: the website key, so that Datoden can remove it.
* While connected, Datoden visits the public website every five minutes (like any visitor) to check that it is up, reads its SSL certificate and looks up the domain's public registration data to find when it expires. The plugin shows the dates as Datoden reports them; the website does not contact any other service for this.

Datoden terms: https://datoden.com/terms/
Datoden privacy policy: https://datoden.com/privacy-policy/

== Source code ==

Everything in this plugin is the original, human-readable source code. The PHP, JavaScript and CSS files are written by hand and are neither minified nor generated by a build tool, so there is no build step: the files in the plugin folder are the source and can be read and edited directly.

== Changelog ==

= 3.0.15 =
Scheduled events also run when pages are served from the cache: a cached page asks the visitor's browser to start WP-Cron when the next event is due (at most every five minutes, nothing when a server cron job is used). Before, e.g. the WooCommerce queue could stall on sites with little traffic.

= 3.0.14 =
Core 3.0.8: the return from Datoden (Connect) is also checked with a WordPress nonce (WordPress.org review); the readme describes the source code.

= 3.0.13 =
The admin bar icon is the DT-cache logo instead of the WordPress speedometer.

= 3.0.12 =
Datoden-core 3.0.7: the plugins' settings are checked with a single database query when the page loads – missing or non-autoloaded settings used to cost one query each on every page.

= 3.0.11 =
* Shop mode now also finds translated addresses (e.g. /en/product/ instead of /produkt/): the saved pages are found in the cache by the product, category and shop page names, on every language and domain.

= 3.0.10 =
* Shop mode (WooCommerce, on by default when WooCommerce is active): when a product changes – price, stock or text – only its own pages are emptied (the product, its categories, the shop page and the front page, on every language) instead of the whole cache. Price and stock changes saved by WooCommerce are now caught too. Pages are kept at most 12 hours. Pro: the emptied pages are filled again straight away, and products and product categories are filled in advance.

= 3.0.9 =
* Fix: with WordPress in a subdirectory (e.g. /shop/) the server rule sent visitors to a cache file in the wrong folder (404 from the second visit). The rule now includes the subdirectory, and the file check (-f) path is back, so the server serves saved pages directly again.

= 3.0.8 =
* Review fixes in all plugins: prefixed JavaScript names, the WordPress 6.9 template enhancement output buffer (older WordPress: the buffer is closed explicitly), cache paths from content_url(). Dark Mode: block theme palettes are converted per use. SVG Support: steps back while the SVG Support plugin is active. Code Snippets: the WPCode switch button is shown for all imported snippets.

= 3.0.7 =
* Datoden-core 3.0.5: the plugin icon shows its symbol at full size, cut by the corner with the Datoden logo.

= 3.0.6 =
* Datoden-core 3.0.4: plugin icons without the white background – the cut corner is transparent and the Datoden logo uses the icon's light colour.

= 3.0.5 =
* Datoden-core 3.0.3: new plugin icon design – a cut white corner with the Datoden logo.

= 3.0.4 =
* Datoden-core 3.0.2: the plugin's own icon (the same as on WordPress.org) is shown in the DT-addons overview and in the header of the plugin's page.

= 3.0.3 =
* Datoden-core 3.0.1: the header on the plugin's page shows the plugin's name as on WordPress.org.

= 3.0.2 =
* Fix: since the rename, DT-cache loads before plugins that change its settings. The settings and domains are now read again once all plugins have loaded.

= 3.0.1 =
* Fix: with the Datoden names DT-cache loads after DT-language, so /en/ pages could be cached and shown as the page without /en/. The cache now uses the address as it came in.

= 3.0.0 =
* New name on WordPress.org: Datoden Page Cache (shown as DT-cache in the DT-addons menu). The free plugin contains no locked Pro features – they are only in the separate Datoden Page Cache Pro. Websites with the earlier version are moved to the new folder automatically; settings are kept.

= 2.0.1 =
* Plugin Check: redirects to Datoden use wp_safe_redirect, and the descriptions on the Datoden plugins overview are translated with WordPress' own function. Datoden-core 2.0.1.

= 2.0.0 =
* New prefix datoden_ instead of dt_ (WordPress.org). Settings and data are moved automatically on the first load; the old [dt_…] shortcodes, hooks and REST routes keep working. Works together with older DT plugins until they are updated. Datoden-core 2.0.0.

= 1.2.10 =
* Ready for WordPress.org: Plugin Check rules (sanitising, nonces, WordPress file functions), no inline scripts in admin pages, DT-core 1.17.22.

= 1.2.9 =
* DT-core 1.17.21: shared core cleaned up (unused code removed) – the same core in every plugin, no change in behaviour.

= 1.2.8 =
* DT-core 1.17.12: the menu heading is called DT-addons and the overview section Datoden plugins.

= 1.2.7 =
* DT-core 1.17.11: the Pro features require a licence – the website must be connected to Datoden and have a purchased licence or be activated by Datoden. Without a licence the base plugin runs without Pro, with a notice saying why (three days to connect after installing or updating).

= 1.2.6 =
* DT-core 1.17.10: DT-website-guard includes itself in the list sent to Datoden – Control the website, Health and Updates show again in My websites, and DT-website-guard gets its updates from Datoden.

= 1.2.5 =
* DT-core 1.17.9: the menu heading is called Datoden Addons (DT-datoden-addons wrapped onto two lines).

= 1.2.4 =
* DT-core 1.17.8: the menu heading is called DT-datoden-addons (without the Pro badge); the first row in the menu and the overview are still called DT-website-guard.

= 1.2.3 =
* DT-core 1.17.7: the DT-website-guard overview shows every DT plugin – the ones that are not installed with Install (downloaded from Datoden) and Read more; deactivated ones with Activate.

= 1.2.2 =
* DT-addons is now called DT-website-guard (the menu, the overview, the plugins list and the texts in every DT plugin). The folder and the settings stay the same (dt-addons), so updates and everything saved work as before. DT-core 1.17.6.

= 1.2.1 =
* DT-core 1.17.5: the card about what Pro adds is shown at the top of the sidebar (only without Pro) – in every DT plugin.

= 1.2.0 =
* Free and Pro in one: Pro is now an add-on to DT-cache instead of a separate version that replaces it. DT-cache (the base plugin, free on WordPress.org) stays installed and active, keeps the settings and is updated from there; DT-cache Pro adds the Pro features and requires DT-cache. Upgrade, go back or remove Pro – settings and data stay. If DT-cache is newer than Pro, DT-cache runs without the Pro features until Pro has been updated. DT-core 1.17.0.

= 1.1.1 =
* Fix: critical error when DT-cache Pro was installed while an older free version was active. Pro now turns the free version off immediately and starts from the next request.

= 1.1.0 =
* Free and Pro: built as a free version (WordPress.org) and DT-cache Pro (Datoden). Pro takes over the free version and keeps the settings, is updated from Datoden while connected and shows Pro in the header. Nothing stops working when switching either way. DT-core 1.16.0.

= 1.0.28 =
* DT-core 1.15.1: the header (logo, Datoden badge, buttons, language switch, Saved) and the Made by Datoden line are rendered by the core – the plugin only provides its name, version, description and any tabs. The collapse/expand arrow always sits at the far right of the card.

= 1.0.27 =
* DT-core 1.14.0: the header, the DT-addons menu and everything else shared (dt-hub.php, dt-autosave.js, dt-admin.css and Datoden images) live in the dt-core/ folder. Of all active DT plugins only the newest copy is used – updating one plugin with a newer core gives every plugin the new header, and all pages load the same files (cached once by the browser).

= 1.0.26 =
* Shared header script: in DT-addons, Messages go below Install or update in the sidebar.

= 1.0.25 =
* The tab row sits at the top of the main column – above the main cards only, so the sidebar starts at the top beside it.

= 1.0.24 =
* Tabs (e.g. Languages | Menus in DT-language) are a full-width row right below the header, above the cards – no longer small inside the header, so they are not missed.

= 1.0.23 =
* Every card – also in the main column and the cards above it – collapses and expands with a click on its heading. The arrow sits right after the heading, so switches and buttons on the right stay visible when the card is collapsed.

= 1.0.22 =
* Sidebar cards collapse and expand with a click on their heading – remembered per card. Collapsed Messages shows the count. In DT-addons the Datoden account is at the top of the sidebar (DT-hub 1.13.2).

= 1.0.21 =
* Closed messages stay closed after reloading the page.

= 1.0.20 =
* Messages are shown in the sidebar (Messages card) instead of the header.

= 1.0.19 =
* The first item under DT-addons in the menu is called DT-addons instead of Overview.

= 1.0.18 =
* The admin bar menu is called DT-cache. The Datoden menu is now called DT-addons; the overview has a larger DT-website-guard panel.

= 1.0.17 =
* Undo/Redo tooltips say what will be undone or redone. Undo, Redo and Saved are always in the same place, greyed out when there is nothing to do.

= 1.0.16 =
* Header: subtle dividers between the groups of controls.

= 1.0.15 =
* Undo now works everywhere, also right after a change, for added/removed rows, the form builder and the code editor.

= 1.0.14 =
* Undo / Redo in the header of every DT plugin. The save status keeps its width; other messages are shown on top so nothing moves.

= 1.0.13 =
* Header rearranged: version next to the plugin name, buttons top right, Saved after the language switch, the Datoden logo links to Datoden's apps.

= 1.0.12 =
* The Datoden overview page has the same header as the plugins.

= 1.0.11 =
* Dark mode: the header shows the light Datoden logo (datoden-logo-darkmode.svg).

= 1.0.10 =
* The sidebar toggle moved into the header; when hidden the content uses the full width. The collapsed header shows the Datoden logo.

= 1.0.9 =
* The sidebar now lines up with the content (no extra gap at the top).

= 1.0.8 =
* The sidebar toggle sits in the top right corner with a sidebar icon.

= 1.0.7 =
* Header buttons: keep the header at the top while scrolling (pin) and collapse it so only Saved and the language switch show. The sidebar can be collapsed to a small button. The language switch is greyed out on pages without texts to translate.

= 1.0.6 =
* Shared stylesheet updated, same as the other DT plugins.

= 1.0.5 =
* The plugin header now stays at the top when you scroll. Saved status and the SV | EN language switch moved from the admin bar into the header, below the badges.

= 1.0.4 =
* Unified names: the plugin is now called DT-cache - datoden (lowercase after DT, like all DT plugins). The folder, settings and shortcodes are unchanged.

= 1.0.3 =
* Fix: the "Move from WP Fastest Cache" box stayed after the move.

= 1.0.2 =
* Fix: WP Fastest Cache could not be deleted while DT-cache was active (both defined wpfc_clear_all_cache()). DT-cache now listens to litespeed_purge_all and dt_cache_purge instead.

= 1.0.1 =
* Smaller CSS and JavaScript (on from the start): the theme's and plugins' CSS and JS files get minified copies. Careful minification – line breaks in JavaScript are kept, already minified files and files on other websites are left as they are, and a changed original gets a new copy automatically.

= 1.0.0 =
* First version: page cache per domain served by the server or the plugin, lifetime, automatic emptying, preload, mobile cache, smaller HTML, gzip, browser cache, no emoji script, check, admin bar and moving from WP Fastest Cache.

== Upgrade Notice ==

= 2.0.0 =
Install all DT plugins together; settings are moved automatically.
