=== WP AI Poster ===
Contributors: velosodev
Tags: ai, auto-post, content generation, openai, claude, scheduling
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
Stable tag: 0.13.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI auto-poster: scheduled and manual AI-generated posts with research/web search, DOI review mode, auto categories/tags, and generated featured images.

== Description ==

WP AI Poster generates WordPress posts with Claude or ChatGPT — manually on demand (free) or automatically on a schedule (paid). Bullet-point-first writing, smart category/tag assignment, and an auto-generated featured image with full metadata (title, alt, caption, description).

Free tier:
* Manual "Generate now"
* Claude and/or OpenAI (bring your own API key)
* Category (frozen or AI-chosen), tag reuse + new tags
* Featured image (OpenAI) with full metadata
* Brand-voice controls, cost tracking

Paid tier (subscription):
* Auto-mode on a drag-and-drop calendar (default 06:00 / 12:00 / 18:00)
* Research databases (Google Scholar, Scopus, Crossref, Semantic Scholar, OpenAlex, arXiv) + Google web search
* DOI / ISBN review mode
* Social cross-posting to LinkedIn, Facebook, X, Mastodon and Bluesky (multiple pages/accounts each)
* Daily licence validation with offline grace period

== Installation ==

1. `composer install` inside the plugin folder (pulls Action Scheduler + php-jwt).
2. Upload the `wp-ai-poster` folder to `/wp-content/plugins/`.
3. Activate. Add an Anthropic and/or OpenAI API key under AI Poster → Settings.
4. For reliable auto-mode, add a server cron: `*/5 * * * * wget -q -O - https://SITE/wp-cron.php?doing_wp_cron`.

== Changelog ==

= 0.13.0 =
* One-click social connect (Jetpack-style): when the veloso.dev hub has social apps configured, the "Add a connection" box shows big Connect buttons — sign in, pick your Pages/profiles, done. No developer app, no token/ID pasting. Uses a secure brokered flow (the token is exchanged server-to-server, never exposed in a browser URL).
* UX: "Add a connection" now leads with one-click connect; your-own-app setup is tucked into an "advanced" section; manual entry stays as a fallback. Added "where to find this / get a key" links throughout (social, AI keys, search providers) and sensible pre-filled defaults (e.g. Bluesky PDS). Less clutter, fewer blank fields.

= 0.12.0 =
* Social: OAuth "Connect" buttons for Facebook & LinkedIn. Register your own developer app, paste its ID + secret, and click Connect — no token pasting. The plugin runs the OAuth flow, gets a long-lived token, and creates a connection with its Pages/organizations already listed. Manual token connections still work.
* Default author: generated posts now always get an author. New "Default author" setting; scheduled/auto posts (which previously had no author because they run under cron with no logged-in user) use it, falling back to the site administrator.

= 0.11.0 =
* Social: multiple destinations per connection (Jetpack-Social-style). Facebook and LinkedIn connections now have a "Fetch destinations" button that lists every Page (Facebook) or your profile + admin organizations (LinkedIn) the token can post to; tick the ones to use. One publish fans out to every enabled destination. Facebook Pages keep their own per-Page tokens automatically. Existing single-destination connections keep working unchanged.

= 0.10.3 =
* Prompt fix: removed the last conflicting citation instruction. The research prompt no longer forces inline [n] markers regardless of settings — inline-citation behaviour is now governed solely by the system prompt (and your Citations settings), so the two prompts can't contradict each other.

= 0.10.2 =
* References are now rendered by the plugin only — no more duplicate lists. The model is instructed not to write its own, and any list it writes anyway is stripped before saving.
* References appear only when the post has sources (research / DOI is on). They render when the "References section at the end" setting is on, or when a manual generation explicitly ticks the new "Include a references section" box. Scheduled/auto posts follow the setting alone.

= 0.10.1 =
* Excerpts: the AI now writes a comprehensive, self-contained excerpt, with a body-text fallback so it's never empty. New "Excerpt length" setting (50 / 100 / 200 / 300 words).
* Post length: replaced the single length target with configurable Min words / Max words.
* Social sharing: the featured image is now pushed to each network as real media — LinkedIn (native image), Facebook (photo post), X (media upload), Mastodon (media attachment), Bluesky (blob / link-card thumbnail). Falls back to the previous link/text behaviour if no image or the upload fails. Egress hardened with wp_safe_remote_* (SSRF guard).
* Admin: settings, schedule and editor screens restyled to match the Systems Not Silos theme (accent, typography, cards, pill buttons).

= 0.10.0 =
* Social cross-posting (paid), Jetpack-Social-style: automatically share every published post to LinkedIn, Facebook Pages, X (Twitter), Mastodon and Bluesky.
* Multiple connections per network — fan a post out to several LinkedIn pages/profiles, several Facebook Pages, several accounts, each with its own credentials and optional message template.
* Per-post controls in the editor: choose which connections to share to, a custom message, a "don't auto-share" switch, and a "Share now" button; per-target results (with links) are shown after sharing.
* Message templates with {title} {url} {excerpt} {site} {tags} placeholders (global default, overridable per connection). Async delivery via Action Scheduler so publishing is never blocked. Live "Test" button per connection.

= 0.9.1 =
* Fix: OpenAI generation failed with "temperature does not support 0.7" when using GPT-5 or o-series models (including the default gpt-5). The plugin now omits the temperature parameter for models that only accept the default value, so generation works out of the box.

= 0.9.0 =
* Zero-touch owner setup: when the container defines WPAIP_OWNER_KEY (+ optional WPAIP_HUB_URL, WPAIP_OPENAI_KEY, WPAIP_SERPAPI_KEY, WPAIP_SCOPUS_KEY), the plugin self-configures the paid tier, shared keys, on-brand subjects, and fully-automatic 3x/day publishing on first run.

= 0.8.0 =
* Self-hosted auto-updates: the plugin now checks the veloso.dev hub for new versions and opts into WordPress background auto-updates (no manual re-upload).
* Settings UX: a provider or engine's config fields (API key, model, etc.) stay hidden until you tick its "enabled" box.

= 0.7.0 =
* Recommended settings presets for the free and paid tiers, with a "Reset to recommended settings" button (keeps your API keys, licence, subjects and hub URL). Fresh installs start on the ideal free preset.
* Free-tier donation nudge: a dismissible WordPress admin notice inviting a PayPal donation from $1 (re-shows monthly). Donation link is configurable, or auto-fetched from the hub.

= 0.6.0 =
* Cost controls now enforced: monthly USD spend cap blocks generation when reached; per-post output-token cap applied to the AI call. Settings show month-to-date spend.

= 0.5.1 =
* Security: update bundled firebase/php-jwt 6.11.1 -> 7.1.0 (CVE-2025-45769).

= 0.5.0 =
* Licence client: set a licensing-hub URL and "Verify now" against it; daily re-check with a 7-day offline grace period; auto-mode switches off automatically if the licence lapses.

= 0.4.0 =
* Auto-mode scheduling engine (Action Scheduler): per-day time slots fire automatic post generation.
* Drag-and-drop weekly calendar to arrange posting times (auto-saves); subject rotation with de-duplication; daily cap; blackout dates; auto-publish option.
* "Generate one now" test button and an activity log.
* Fix: settings list values (schedule times/days, subjects, blackout, categories) no longer leak stale default entries when you save fewer items.

= 0.3.0 =
* Native editor integration: an "AI Poster" panel in the post sidebar generates content directly into the current post (subject or DOI/ISBN, research, featured image) via AJAX.

= 0.2.1 =
* Citation styles: choose APA 7 / MLA / Chicago / IEEE for inline markers and the References section (ported from ResearchBoss references.py).
* Upgraded the hover tooltip to a viewport-aware floating card (verbatim source + formatted reference + open link), adapted from the ResearchCatalogue review UI.
* Colour-coded inline markers by source kind (verified DOI / web / unlinked).

= 0.2.0 =
* Search providers: SerpApi (Google web), Scopus, Crossref, Semantic Scholar, OpenAlex, arXiv, Google Programmable Search.
* Research enrichment: posts grounded in searched sources with inline [n] citations + References section.
* DOI / ISBN review mode: resolve a document (Crossref → Semantic Scholar; OpenLibrary → Google Books) and generate a structured review post.
* Citations (three independent paid sub-options): inline [n] markers, a References section, and a verbatim source tooltip on hover.
* Settings: paid-gated "Research & web search" section (disabled when unlicensed).

= 0.1.0 =
* Plugin core: settings, Claude+OpenAI text engines, manual generation, category/tag resolution, featured image, licence gate scaffold.
