=== Pinery Static — Static Export to Cloudflare Pages ===
Contributors: pinerypicks, freemius
Tags: static site, cloudflare pages, headless, performance, seo
Requires at least: 5.6
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Export your WordPress site to a static build and deploy it to Cloudflare Pages — while comments, search and contact forms keep working via WordPress.

== Description ==

Pinery Static turns your dynamic WordPress site into a fast, secure static site hosted on Cloudflare Pages, and keeps the dynamic bits working by proxying them back to WordPress. No Node.js, no wrangler, no build server — the export and Direct Upload run in pure PHP, so it works on ordinary hosting.

**Free plan** — the full static pipeline, no limits on size:

* One-click export of the whole site and deploy to Cloudflare Pages (pure-PHP Direct Upload, unlimited pages)
* Incremental exports — only changed pages are re-crawled; batched to survive shared-hosting timeouts
* Content scope and exclude-path filters
* SEO intact: canonical/og rewriting, sitemap.xml, robots.txt, 404 page, _redirects
* Cloudflare connection test, bilingual admin (EN/中文)

**Pro** — run the static site as production ($299, one-time, per site):

* Auto-deploy on publish: edit in WordPress, the edge updates itself
* Comments, live search and contact forms keep working on the static site (proxied to WordPress)
* WooCommerce live hydration: real-time prices, stock and add-to-cart on static pages
* Seamless same-domain migration: bundled Cloudflare Worker router, environment detector and origin verifier — zero-downtime cutover and instant rollback to WordPress
* Deployment history with one-click rollback
* Priority support

**What it does**

* Crawls your published content and writes a static build (HTML + localized assets).
* Deploys straight to Cloudflare Pages via Direct Upload (pure-PHP BLAKE3 hashing + dedup) — batched and resumable, so large sites don't time out.
* Incremental exports: after the first build, only changed content is re-crawled.
* Auto-deploy: publishing or editing content rebuilds and redeploys in the background.

**Keeps working after static export (proxied to WordPress)**

* **Comments** — read and post via the WordPress REST API; moderation, spam filtering and the wp-admin comment screen are unchanged.
* **Search** — your theme's search box queries WordPress live and links to the static pages.
* **Contact form** — the `[wp2cf_contact_form]` shortcode submits to WordPress, which emails you and stores each message under *Contact Messages*.

**Built for content sites (and shops)**

* Choose which content types to export; leave `product` out to keep your WooCommerce shop dynamic.
* Exclude paths (cart / checkout / account are excluded by default).

**SEO**

* Absolute `canonical` / `og:url` tags, generated `sitemap.xml` (with lastmod) and `robots.txt`.
* Theme / Yoast / Rank Math meta and structured data carry over in the static HTML.

**Seamless domain migration**

* A migration wizard detects your hosting architecture and gives tailored, step-by-step instructions.
* Optional Cloudflare Worker routes your existing domain so visitors get the static site while `/wp-admin` still works on the same domain.

**Bilingual admin** — English / 中文, switchable per user.

*Not affiliated with, or endorsed by, Cloudflare or WordPress.*

== Installation ==

1. Install and activate the plugin.
2. Go to **Tools → Pinery Static**.
3. Enter your Cloudflare **Account ID**, an **API Token** (permission: `Account › Cloudflare Pages › Edit`), and a **Project** name.
4. Click **Export & Deploy to Pages**.
5. (Optional) Use **Tools → Pinery Migration** to point your real domain at the static site.

For maximum security, define the token in `wp-config.php` instead of the database:
`define( 'WP2CF_API_TOKEN', 'your-token' );`

== Frequently Asked Questions ==

= Does it need Node.js or wrangler? =
No. Export and Cloudflare Direct Upload are implemented in pure PHP.

= Do comments / search / forms still work? =
Yes — they are proxied to your WordPress via its REST API, so WordPress must stay online and reachable.

= Can I use it with WooCommerce? =
Yes. Export product and shop pages statically for SEO, and (Pro) live-hydrate prices, stock and add-to-cart from the Store API so they stay accurate. Cart, checkout and account always remain dynamic on WordPress.

= Is my API token stored safely? =
It is encrypted at rest using your site's keys, or you can keep it entirely out of the database with the `WP2CF_API_TOKEN` constant.

== Changelog ==

= 0.2.1 =
* Freemius licensing integrated (in-dashboard checkout, license activation, opt-in analytics — skippable); activating a Pro license instantly unlocks premium features

= 0.2.0 =
* Freemium: the full unlimited static export + deploy pipeline is now the Free plan; Pro ($299 one-time per site) unlocks auto-deploy on publish, comments/search/contact proxies, WooCommerce live hydration, seamless-domain migration and one-click rollback
* Settings preserved across plans — activating a license instantly unlocks Pro features

= 0.1.0 =
* Initial release: crawl, pure-PHP Direct Upload to Cloudflare Pages, incremental + batched deploy, auto-deploy, comments/search/contact proxy, content scope, SEO (sitemap/robots/canonical), migration wizard, bilingual admin.
