=== PostRefiner ===
Requires at least: 6.0
Requires PHP: 7.4
Stable tag: 0.7.0
License: GPLv2 or later

Build affiliate reviews, repurpose posts into social and email content, refresh and audit your articles with AI, and track affiliate clicks.

== Description ==

PostRefiner is an AI content assistant for affiliate websites. It works with your own Claude, ChatGPT or Gemini API key, so you pay your AI provider directly for what you use.

* Review Builder (Front End): turn a keyword and an Amazon (or any shop) link into an honest review or comparison with your affiliate link, product image and buy button, comparison table, pros & cons, FAQs and SEO title/description. You read and approve everything before it goes on your site.
* Scheduler and Bulk Reviews (OTO1): write many reviews at once from a list or CSV file and post them automatically at the times you choose on a calendar.
* Repurpose (OTO2): turn any post into posts for Facebook, Instagram, LinkedIn, Pinterest and X, carousels, short-video scripts, emails and hooks, with images in every platform size: text cards, AI images (free with Cloudflare) or free stock photos from Pexels, Unsplash and Pixabay. Share, copy, download, or add the pictures to your post.
* Content Refresh (OTO3): find outdated posts and update their titles, descriptions, introductions, headings, FAQs and internal links, with a side-by-side comparison and one-click restore.
* Content Audit (OTO3): scan every published article for missing buy buttons, weak calls to action, incomplete product comparisons, missing FAQs, outdated information, unclear buyer guidance, missing recommendations and missing disclosures. Each article gets an improvement score and a ready-made fix for every problem; you review, edit and approve fixes before WordPress is updated (one-click undo).
* Click Tracking (OTO4): count clicks on your affiliate links without changing them, grouped by article, button or link wording, product, shop and placement. Compare calls to action fairly (clicks per 100 views), see high-click and low-click articles, and get suggested tests for button wording, positioning and comparison layouts. No cookies, no IP addresses stored, bots and your own visits ignored. Clicks are not sales: sales and commissions are only known from your affiliate network's reports.

== Changelog ==

= 0.7.0 =
* Content Audit (part of OTO3): scans published articles (no AI, free) and scores them by improvement opportunities, with filters by score, problem and title. "Get fixes" writes one fix per problem in a single AI request using only facts from the article and your existing affiliate links: buy buttons (named per product), clearer link text, a closing call to action, a comparison table, FAQs, a "Who should buy it?" section, "Our pick", your disclosure, and the year in the title. Edit or untick any fix, preview before/after, then apply. Saved in History with Undo; fixes for parts of the article you changed since are skipped safely.
* Click Tracking (new OTO4): counts affiliate link clicks and article views; reports by article, wording, button vs text link, placement (top, middle, bottom, comparison table, product box), product, shop and device; high-click and popular-but-low-click articles; "What to test next" suggestions; per-article link detail; CSV download; pause, keep-for period and delete-all settings. Privacy-friendly: no cookies, no IP addresses, bots ignored, logged-in editors not counted, signed reports, flood protection.
* Settings → Affiliate: "My other affiliate links" for link types PostRefiner doesn't recognise yet.
* The Dashboard's About box, menu tags and Licence page include the new parts.

= 0.6.2 =
* "About PostRefiner" box at the top of the Dashboard: what PostRefiner does and the four parts (Front End, OTO1, OTO2, OTO3), each linking to its tool. Parts not owned show a lock.

= 0.6.1 =
* "Add to post" has three more places: after the 2nd paragraph, after the 3rd paragraph, and in the middle of the article. Only the article's own paragraphs are counted (never text inside product boxes or columns); short posts get a clear message.
* A description of PostRefiner on the WordPress Plugins page and in the readme.
* Menu items show which upgrade they belong to (OTO1, OTO2, OTO3).

= 0.6.0 =
* Stage 6: licences and plan parts. Front End (Review Builder, Products), OTO1 (Scheduler, Bulk Reviews), OTO2 (Repurpose, social posts, all image options) and OTO3 (Content Refresh) unlock separately.
* Licence page: activate, "Check now", remove from this site (frees the slot), what's included with Upgrade buttons, sites used, lost-key link and support email from the seller.
* Locked pages show which part they belong to and an Upgrade button; locked menu items show a lock. Server-side checks on every action.
* Daily background licence check; upgrades and refunds apply automatically. If the seller's licence site is down, everything keeps working for 30 days.
* Copies without a licence server built in are development copies with everything unlocked. Use "Prepare PostRefiner" in the Licence Manager to make the copy you sell.

= 0.5.0 =
* Stage 5: Bulk Reviews. Paste rows or import a CSV (keyword, product name, product link, product details, image link); the same keyword on several rows makes a comparison review. Reviews are written in the background one step at a time (faster while the page is open) and either held for approval or scheduled automatically, per batch. Rows without enough real product facts are marked "Needs product details" instead of guessed; Retry after adding them. Pause, resume, approve all, skip, delete.
* Stage 5: Scheduler. Month calendar (list view on phones) of scheduled, published and planned bulk posts; drag drafts or posts to another day, click to change the time, publish now or unschedule; auto-schedule drafts over your usual posting times and days (taken times are skipped). Uses WordPress's own Scheduled status, plus a safety net that publishes any post WordPress missed.
* Social images: new "Text size on images" setting (Small is the new default). Small and Medium shade only behind the words so the picture stays visible; Large keeps the previous look. Pinterest pins get a bigger photo.
* "Add to post" button under every AI picture and stock photo: insert it at the top, after the introduction or at the end of the article (stock photos get a photographer credit caption). Saved in History with Undo.
* Fix: test screenshots were accidentally included in some earlier zips.

= 0.4.5 =
* "Use as featured image" button under every AI picture and stock photo in Repurpose (shows a "Featured image" badge on the one in use).
* "Replace first image in post" button: swaps the first image inside the article for the clean picture. Works with the block editor (stays valid, keeps the caption, updates the image link) and the classic editor.
* Both are saved in History with one-click Undo on the Repurpose page and "Restore version before this" in History, including on sites with revisions switched off. Restores now also bring back the old featured image.

= 0.4.4 =
* Free stock photos in Repurpose: a third image option, "Stock photos", using the buyer's own free Pexels, Unsplash and/or Pixabay API keys. PostRefiner finds a matching square, tall and wide photo (search words written by the AI or typed by you), crops them to all 9 social sizes and the carousel cover, and puts your headline on top.
* Photo picker: "Change photo" lets you search all connected sources (or one) and swap any photo in one click; images rebuild automatically.
* Photographer credits shown with links, a "Copy photo credits" button, credits saved as the Media Library caption and as photo-credits.txt in the download pack.
* Settings: "Free stock photos" card with encrypted keys, a Test button for each, and step-by-step guides to get each free key.
* Follows each site's rules: photos are downloaded to your site (Pixabay), Unsplash is told when a photo is used, searches are cached for 24 hours, and photos are only ever downloaded from Pexels, Unsplash or Pixabay.

= 0.4.3 =
* Free AI images with Cloudflare Workers AI (now the recommended image option): a free daily allowance, enough for roughly 20+ posts a day with FLUX.2 [klein] 4B, or about 50 with FLUX.1 [schnell]. Both models allow commercial use.
* Settings: Cloudflare Account ID and API token boxes (token stored encrypted, never shown in full), a "Test Cloudflare connection" button, and a built-in 7-step guide to getting both.
* Clear messages when the token is wrong or the day's free allowance is used up (with the reset time).

= 0.4.2 =
* Two image options per post in Repurpose: "Text cards" (headline on the featured image) or "AI images" (a new picture created to match the post title, with the headline on top), for every platform size and the carousel cover.
* AI images use the buyer's ChatGPT (GPT Image) or Gemini (Gemini Image) key, chosen in Settings, with picture style and quality options. Three pictures per post (square, tall, wide) are cropped to all sizes; they can be reused for free when rebuilding.
* Editable picture description (written by the AI from the post title if left blank).

= 0.4.1 =
* Fetch details: a clear, specific message for each situation (Amazon's block, shop bot protection, page not found, connection problems, missing server module) instead of one general warning. Amazon and bot-protection messages show as a tip.
* Fetch details now reads the standard product data most shops include (name, description, image, brand, SKU, specifications), filling the Key features and image URL boxes too.

= 0.4.0 =
* Stage 4: Content Refresh. Scan for posts not updated in X months (filter by category or keyword), flag them, and get AI suggestions for the title, meta description, introduction, headings, new FAQs and internal links to your other posts.
* Side-by-side comparison with highlighted differences; tick, untick or edit each change.
* Save as a draft copy (live post untouched until you publish the copy) or update the post now.
* Existing links, including affiliate links, are always kept exactly. Changes to parts of a post edited since the suggestions were made are skipped, never guessed.
* History page: every change, with Compare and one-click Restore (restores the SEO description and FAQs too; restores can be undone).

= 0.3.1 =
* Product image URL box: paste an image address and it shows in the review's product box (preview and published article). A Media Library image, if chosen, takes priority.
* Fix: some hidden buttons could appear before they were needed.

= 0.3.0 =
* Stage 3: Repurpose. Turns any post into posts for Facebook, Instagram, LinkedIn, Pinterest and X, with images in every platform size (9 sizes), carousel outline + slide images + caption + script, two short-video scripts, an email promotion, a newsletter intro, hooks and calls to action.
* Share buttons for every platform (Pinterest and LinkedIn open pre-filled), Copy and Download on everything, "Download everything" as a .zip.
* Option to use an affiliate link from the post exactly as written, with automatic #ad disclosure.
* Asset Library page, and a PostRefiner panel in the post editor.
* Bundles the Inter font (SIL Open Font License, see assets/fonts/Inter-LICENSE.txt).

= 0.2.1 =
* Product image box (image, name and buy button) after the review introduction; one box per product in comparisons.
* Amazon-style buy button (yellow, rounded) for Amazon links, with an option to use the theme's style.
* Product image picker from the Media Library; images from non-Amazon product pages can be imported. Images are never copied from Amazon.

= 0.2.0 =
* Stage 2: Review Builder (keyword + products, outline, step-by-step AI writing, pros/cons with evidence, comparison/spec tables, SEO title, meta description, FAQs), review & approve screen, save as draft or publish, product library with Amazon tracking ID and Fetch details.

= 0.1.0 =
* Stage 1: settings, encrypted AI keys, connection test for Claude, ChatGPT and Gemini, licence and plan system, dashboard.
