=== Gu&Co AI Blog Writer ===
Contributors: krzysztofsarna, freemius
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manages topics, generates SEO briefs and AI article drafts, runs quality checks, and automatically schedules WordPress draft posts.

== Description ==

Gu&Co AI Blog Writer is a powerful AI companion designed to streamline your content creation process directly inside WordPress using the native WordPress AI Client. 

= Free Features =

* **Topic Queue Management:** Easily add, edit, and manage your topic queue with priority levels, keywords, category, risk level, and target audience.
* **Native SEO Brief Generation:** Automatically create article outlines and structures.
* **Article Draft Generation:** Generate full-length, HTML-formatted article drafts based on prepared briefs.
* **Multi-criteria AI Quality Check:** Validate generated drafts with automated quality scores (0-100), risk levels, detected issue lists, and recommended actions.
* **Article Preview Screen:** Review AI-generated content and quality metrics before converting them to WordPress posts.
* **WordPress Draft Creation:** Save articles directly as WP drafts with automated categories, tags, excerpts, slugs, and SEO metadata.
* **Test Mode:** Test your full workflow locally with built-in mock responses without consuming API limits.
* **Log Tracker:** Track all key system operations, background processes, and errors in a dedicated log panel.
* **Polish Language Support:** Full support for generating content in Polish.

= Pro Features =

Upgrade to **Gu&Co AI Blog Writer Pro** to unlock advanced automation and intelligence features:

* **AI Featured Image Generator:** Automatically generate high-quality featured images for blog post titles with customizable styles (photorealistic, vector illustration, 3D render, minimalist), multiple aspect ratios (16:9, 4:3, 1:1), and web-optimized formats (WebP, JPEG).
* **AI Title & Topic Suggestions:** Analyze published content to find content gaps and suggest new topics automatically.
* **Bulk CSV Topic Import:** Import topics in bulk from CSV files with automatic field mapping.
* **WP-Cron Automation:** Schedule background tasks for fully automated draft generation.
* **Autopublishing:** Automatically publish posts that pass strict quality checks and low-risk rules.
* **Multilingual Support:** Generate topics, briefs, and articles in multiple foreign languages (English, German, Spanish, etc.).
* **Automation Rate Limits:** Set daily throttles for max generated articles and AI API requests.
* **Custom Quality Score Thresholds:** Fine-tune required quality scores (e.g., minimum 90/100) before auto-publishing.

== Installation ==

1. Copy the plugin folder to your `wp-content/plugins/` directory (or install directly via the WordPress plugin dashboard).
2. Activate "Gu&Co AI Blog Writer" in WordPress.
3. Ensure you have configured an active AI provider and connector under WordPress Settings -> Connectors (requires WordPress 7.0+).
4. (Optional) Enable "Test Mode" in Gu&Co AI Blog Writer -> Settings to test the workflow locally with sample responses without connecting to an external AI API.
5. Add topics manually and start generating briefs and articles!

== Privacy and External Services ==

This plugin utilizes the native **WordPress AI Client** to connect to generative AI services. No direct API connections are initiated by the plugin itself; all requests are routed through the AI provider and credentials configured globally by the site administrator on the WordPress **Settings > Connectors** screen.

Depending on the connector you enable in WordPress, the following external services may be utilized:

= OpenAI =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, executing quality checks, and generating featured images.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, quality check, or image generation manually, or when scheduled cron tasks run.
* **OpenAI Terms of Service**: https://openai.com/policies/terms-of-use
* **OpenAI Privacy Policy**: https://openai.com/policies/privacy-policy

= Google Gemini =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, and executing quality checks.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, or quality check manually, or when scheduled cron tasks run.
* **Google Terms of Service**: https://policies.google.com/terms
* **Google Privacy Policy**: https://policies.google.com/privacy

= Anthropic Claude =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, and executing quality checks.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, or quality check manually, or when scheduled cron tasks run.
* **Anthropic Terms of Service**: https://www.anthropic.com/legal/consumer-terms
* **Anthropic Privacy Policy**: https://www.anthropic.com/legal/privacy

= Freemius =
* **Purpose**: Used for plugin licensing, updates, and optional usage telemetry/opt-in diagnostic data.
* **Data Sent**: Site URL, WordPress version, plugin version, license status.
* **Freemius Terms of Service**: https://freemius.com/terms/
* **Freemius Privacy Policy**: https://freemius.com/privacy/

== Security Notes ==

All generated HTML content is sanitized with `wp_kses_post()` before being saved to WordPress draft posts. Autopublishing (Pro feature) requires explicit enablement in settings, a low-risk topic classification, a recommended action of 'publish', and a quality check score meeting the configured threshold (default 90).

== Changelog ==

= 1.1.2 =
* Added Featured Image AI Model selection setting with support for Google Gemini (`gemini-3.1-flash-image`, `gemini-3.0-flash-image`, `gemini-3-pro-image`, `imagen-3.0`) and OpenAI (`gpt-image-2`, `gpt-image-1.5`, `gpt-image-1-mini`, `gpt-image-1`, `chatgpt-image-latest`, `dall-e-3`).
* Removed explicit API Key input fields from Settings: API keys are now auto-detected from WordPress 7.0 Connectors (`connectors_ai_google_api_key`, `connectors_ai_openai_api_key`), WordPress AI Client Registry, PHP constants (`GOOGLE_API_KEY`, `OPENAI_API_KEY`), and environment variables.
* Added standalone Featured Image regeneration action and buttons in Generated Drafts list and preview toolbar.
* Updated settings page UI to clarify global AI Connector configuration and image model selection.

= 1.1.1 =
* Added support for OpenAI and Google Gemini image generation fallbacks.
* Added standalone Featured Image regeneration action.

= 1.1.0 =
* Added PRO Featured Image Generator for blog post titles with custom style selection, aspect ratios (16:9, 4:3, 1:1), and web optimization (WebP/JPEG).
* Improved UX: Replaced open text input for Search Intent with a predefined SEO select dropdown (informational, commercial, transactional, navigational).
* Bug fix: Expanded database search_intent column from VARCHAR(100) to TEXT to prevent database errors on long inputs.

= 1.0.0 =
* Initial release. Powered by the native WordPress AI Client.
