=== Ziba AI Content Creator ===
Contributors: ziba
Tags: ai, content generator, openai, pollinations, woocommerce, seo, mcp
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate SEO-friendly articles, product descriptions, and site content with AI — no OpenRouter required. Works with Pollinations (free) or any OpenAI-compatible endpoint.

== Description ==

Ziba AI Content Creator automates content creation for your WordPress site using modern AI models.

**Why Ziba AI?**
* **No OpenRouter dependency** — text generation now uses Pollinations' free OpenAI-compatible API out of the box.
* **Bring your own AI** — plug in any OpenAI-compatible endpoint (including self-hosted models) with the "Custom" provider.
* **MCP-ready** — optionally connect a Model Context Protocol endpoint to expose extra tools to the AI.
* **WooCommerce integration** — generate product titles, descriptions, and SEO meta from the product editor.
* **Site-wide generation** — works for posts, pages, and products.
* **Clean, modern UI** — progress bar, live logs, one-click runs.

**Content capabilities**
* Full article generation (title, body, excerpt, slug, tags, SEO meta).
* Featured image generation (Pollinations or local GD fallback).
* Topic scheduling (manual list or AI-generated topics).
* Internal linking suggestions.

**AI providers**
* Pollinations (default, free, no API key).
* Any custom OpenAI-compatible endpoint (user-supplied base URL + API key).
* Optional MCP endpoint for tool-augmented generation.

== Installation ==

1. Upload the `ziba-ai-content-creator` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen.
3. Go to **Ziba AI → Settings** and configure your provider.
4. Use the **Quick Run** button to generate your first article.

== Frequently Asked Questions ==

= Do I need an API key? =
No. Pollinations is free and works without a key. A key is only required if you choose a custom provider that requires one.

= Can I use my own AI model? =
Yes. Select "Custom OpenAI-compatible endpoint" and enter your base URL, API key, and model name.

= Does it work with WooCommerce? =
Yes. A meta box is added to the product editor for one-click product content generation.

= Is MCP supported? =
Yes. You can provide an MCP endpoint URL and the plugin will attempt to discover tools via `tools/list`.

== Screenshots ==

1. Quick Run panel with live progress.
2. AI Provider settings (Pollinations / Custom).
3. WooCommerce product AI meta box.
4. Live logs.

== Changelog ==

= 2.3.0 =
* Major Update: Revamped content generation pipeline.
* Added: Adaptive Backoff system for Pollinations API to automatically handle rate limits and optimize wait times.
* Fixed: Cron jobs now use the exact same expansion loop as manual generation to ensure full-length articles.
* Fixed: HTML structure is now bulletproof using DOMDocument and advanced regex to prevent broken tags, unclosed paragraphs, and stray headings.
* Improved: Prompt engineering now enforces strict chunking and prevents duplicate content.

= 2.2.3 =
* Fixed plugin header formatting.

= 2.2.2 =
* Fixed: Settings save button now uses AJAX and shows inline success/error notices.
* Fixed: Featured image prompt is now generated in English by the AI to prevent URL-encoded Persian garbage in image URLs.
* Fixed: Excerpts no longer leak [CATEGORY]/[IMAGE_PROMPT] tags.
* Improved: Added English-only safety net for image prompts at generation time.
* Removed: Redundant "Refresh" button next to "Copy" in Activity Logs (auto-refresh remains).
* Compatibility: Bumped tested-up-to WordPress version.

= 2.2.1 =
* Fixed: Fatal Error caused by undefined variable in class-generator.php.
* Fixed: 404 Model Not Found error by setting default model to "openai".
* Fixed: AJAX and Cron timeouts by removing hardcoded sleep() functions.
* Fixed: WordPress repository readme.txt formatting issues.
* Improved: Handled 402 Rate Limit retries gracefully.

= 2.2.0 =
* Replaced OpenRouter with Pollinations (OpenAI-compatible endpoint).
* Added "Custom AI Provider" support (any OpenAI-compatible endpoint).
* Added MCP endpoint discovery.
* Added WooCommerce product content generation.
* Added site-wide AI content helper.
* Refreshed admin UI with provider testing, model fetching, and MCP tool discovery.
* Prepared for WordPress.org submission (readme.txt, uninstall cleanup).

= 2.1.0 =
* Initial public release.

== Upgrade Notice ==

= 2.3.0 =
Major stability update. Fixes HTML truncation, cron generation issues, and API rate limits. Recommended for all users.

= 2.2.2 =
Fixes settings save reliability and image prompt language. Recommended update for all users.

= 2.2.1 =
Important bug fixes: Resolves fatal errors, 404 model errors, and server timeouts. Update immediately.
