=== HiOptimize ===
Contributors: hitheme04
Tags: performance, cache, optimization, pagespeed, minify
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Plugin URI: https://hiclassic.site/plugins/hioptimize/
Author URI: https://hiclassic.site/

Lightweight page caching and frontend performance optimization for WordPress.

== Description ==

HiOptimize provides configurable performance improvements while keeping site owners in control.

Features include:

* Anonymous page caching with configurable cache lifetime.
* HTML compression and inline CSS minification.
* Optional JavaScript defer with exclusion rules.
* Optional asynchronous CSS loading with stylesheet exclusions.
* Local font preloading for selected above-the-fold fonts.
* Native lazy loading for eligible images and iframes.
* WordPress frontend cleanup.
* URL-based cache exclusions.
* Full-cache and current-page purge controls.
* Safe Test mode for logged-in administrators.
* Optional Google PageSpeed Insights testing with your own API key.

Test mode applies optimizations only for logged-in administrators and leaves the public website unchanged. Page caching is paused while Test mode is active.

Asynchronous CSS is an advanced option and can cause a temporary unstyled display or broken layout when critical styles are not excluded. Test it with Test mode before enabling it for public visitors.

== Installation ==

1. Upload the `hioptimize` folder to `/wp-content/plugins/` or install the plugin ZIP through WordPress.
2. Activate HiOptimize from the Plugins screen.
3. Open HiOptimize from the WordPress admin menu.
4. Select an optimization mode, review the individual settings, and save.
5. Use Test mode before enabling aggressive options on a live website.

== Screenshots ==

1. HiOptimize dashboard with cache status, safe Test mode, branded optimization modes, cache lifetime, and performance controls.
2. Cache exclusions, Google PageSpeed Insights, cache diagnostics, asynchronous CSS exclusions, and local font preloading.
3. Cache diagnostics and JavaScript defer exclusions with handle, filename, and URL-fragment examples.

== Frequently Asked Questions ==

= Why does the cache show zero pages? =

Logged-in users bypass the normal public page cache. Visit an eligible page while logged out or in a private browser window to generate its cached version.

= What does Test mode do? =

Test mode applies frontend optimizations only to logged-in administrators. Public visitors receive the unchanged website, and page caching is temporarily paused.

= Does CSS minification modify my theme files? =

No. HiOptimize minifies CSS found inside inline `style` blocks in the generated page output. It does not rewrite theme or plugin files.

= Why are WooCommerce pages excluded? =

Cart, checkout, account, and active customer-session pages contain personalized content and should not be stored in a shared page cache.

= What happens when I delete HiOptimize? =

Deleting the plugin removes its saved settings, PageSpeed test result, and generated HTML cache files. Deactivation alone keeps the settings so they are available if the plugin is activated again.

= Where can I get support? =

Use the HiOptimize support forum at https://wordpress.org/support/plugin/hioptimize/ after the plugin is published in the WordPress.org Plugin Directory.

== External services ==

HiOptimize can optionally connect to the Google PageSpeed Insights API when an administrator enters an API key and clicks "Run test."

The request sends the website homepage URL, the selected mobile or desktop strategy, the performance category, and the administrator-provided API key to Google. This data is sent only when an administrator explicitly runs a test. HiOptimize does not use this service when no test is requested.

This service is provided by Google and is subject to Google's policies:

* PageSpeed Insights API documentation: https://developers.google.com/speed/docs/insights/v5/get-started
* Google Privacy Policy: https://policies.google.com/privacy
* Google Terms of Service: https://policies.google.com/terms


== Changelog ==

= 0.1.2 =
* Fixed cache exclusions and WooCommerce session detection to prevent personalized pages from being cached.
* Run frontend condition checks after the main query and preserve meaningful HTML whitespace.
* Restrict admin assets to the HiOptimize settings screen and normalize multiline settings.

= 0.1.1 =

* Replaced the plugin-owned output buffer with the WordPress template enhancement output buffer.

= 0.1.0 =

* Initial release.
* Added page caching, frontend optimization, safe testing, cache controls, and PageSpeed Insights integration.
