=== OmniWrite AI ===
Contributors:      arnabdev1305
Tags:              ai, chatgpt, openai, image generation, writing assistant
Requires at least: 6.0
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        1.0.1
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

AI-powered text and image generation inside every WordPress editor — Gutenberg blocks and Classic Editor toolbar, both fully supported.

== Description ==

**OmniWrite AI** brings the power of ChatGPT and DALL·E directly into your WordPress editor — no copy-pasting, no switching tabs. Whether you use the modern Gutenberg block editor or the Classic Editor plugin, OmniWrite AI works seamlessly in both.

Type a short prompt, choose your tone and length, and get professional, publish-ready content or stunning AI-generated images in seconds — all without leaving your post or page.

= ✍ Text Generation =
Generate full blog posts, introductions, product descriptions, landing page copy, FAQs, and more. Choose from five tones (professional, friendly, persuasive, informative, creative) and three length options (short, medium, long). Powered by GPT-4o and GPT-4o Mini.

= 🖼 Image Generation =
Describe any image and get a high-quality result from DALL·E 3. Generated images are automatically saved to your WordPress Media Library so they are part of your site permanently.

= ⚡ Works in Every Editor =
Most AI writing plugins only support Gutenberg. OmniWrite AI is built differently:

* **Gutenberg** — Two dedicated, searchable blocks appear in the block inserter. Type `/write` or `/image` to find them instantly. The full prompt UI appears inline inside the block — no popups required.
* **Classic Editor** — Two separate toolbar buttons with distinct icons sit right in the TinyMCE toolbar. Click one to open a clean modal and generate content without leaving the editor.

= 🔌 Provider-Ready Architecture =
OmniWrite AI launches with OpenAI (ChatGPT + DALL·E). The plugin is architected to support additional AI providers — Anthropic Claude, Google Gemini, and Mistral — in upcoming releases.

= 🔒 Secure & Role-Controlled =
All API calls are made server-side through a secured WordPress REST endpoint — your API key is never exposed in the browser. Role-based access control lets you decide which user roles (Administrator, Editor, Author, etc.) can access the AI tools.

= 🛠 Simple Setup =
1. Install and activate
2. Paste your OpenAI API key in Settings → OmniWrite AI
3. Open any post or page and start generating

No coding, no configuration complexity — just install and write.

== Installation ==

1. Upload the `omniwrite-ai` folder to `/wp-content/plugins/`
2. Activate the plugin from **Plugins → Installed Plugins**
3. Go to **Settings → OmniWrite AI** and enter your OpenAI API key
4. Click **Test Connection** to verify everything works
5. Open any post or page — the AI tools are ready

== Frequently Asked Questions ==

= Do I need an OpenAI account? =
Yes. You need an OpenAI account and API key from [platform.openai.com/api-keys](https://platform.openai.com/api-keys). Standard OpenAI API usage fees apply based on usage. The plugin itself is free.

= Does it work with the Classic Editor plugin? =
Yes — this is one of OmniWrite AI's key strengths. Two separate toolbar buttons with distinct icons appear right in the TinyMCE toolbar, fully compatible with the Classic Editor plugin.

= How do I find the blocks in Gutenberg? =
Click the `+` button or type `/write` to find the **Write with AI** block, or `/image` to find the **Generate Image with AI** block. You can also search "ai", "chatgpt", "dalle", or "generate" in the block inserter.

= Which AI models are supported? =
**Text:** GPT-4o, GPT-4o Mini, GPT-3.5 Turbo
**Images:** DALL·E 3, DALL·E 2
More providers (Anthropic Claude, Google Gemini, Mistral) are planned for upcoming versions.

= Where are generated images stored? =
Images generated by DALL·E are automatically downloaded and added to your WordPress Media Library. They are stored on your own server and remain permanently available even if the OpenAI URL expires.

= Is my API key stored securely? =
Your API key is stored in the WordPress options table using the standard WordPress API — the same way all other plugin settings are stored. All API calls are made from the server side via a secured REST endpoint, so your key is never exposed in the browser or to end users.

= Can I control who has access to the AI tools? =
Yes. In **Settings → OmniWrite AI → Access Control** you can choose which user roles can see and use the AI writing tools. Only selected roles will see the toolbar buttons or blocks.

= Will this work with page builders like Elementor or Divi? =
The Classic Editor TinyMCE integration is compatible with most page builders that use a standard TinyMCE textarea. The Gutenberg blocks work with the standard WordPress block editor.

== Screenshots ==

1. **Gutenberg — Write with AI block** — the prompt UI appears inline inside the block
2. **Gutenberg — Generate Image block** — create DALL·E images without leaving the editor
3. **Classic Editor toolbar** — two separate buttons with distinct icons
4. **Classic Editor — text modal** — clean prompt interface with tone and length options
5. **Classic Editor — image modal** — image prompt with model and size options
6. **Settings page** — configure API key, model, and role-based access control

== External services ==

This plugin sends data to the OpenAI API in order to generate text content and images. This happens only when a logged-in user with the appropriate role actively clicks the Generate button inside the editor. No data is sent automatically, on page load, or without explicit user action.

= What is sent and why =

**Text generation:** The prompt text entered by the user (along with selected tone and length preferences) is sent to OpenAI's Chat Completions API endpoint (`https://api.openai.com/v1/chat/completions`) to generate written content.

**Image generation:** The prompt text entered by the user is sent to OpenAI's Images API endpoint (`https://api.openai.com/v1/images/generations`) to generate an AI image. The returned image data is saved to your WordPress Media Library and is not stored by this plugin.

= Data sent to OpenAI =

* The text prompt written by the user
* Selected options (tone, length, image size, model)
* Your OpenAI API key (sent as an Authorization header — never logged or stored beyond your WordPress database)

No personally identifiable user data (name, email, IP address) is included in API requests.

= Service provider =

This plugin uses the OpenAI API, provided by OpenAI, L.L.C., 3180 18th St, San Francisco, CA 94110, USA.

* [OpenAI Terms of use](https://openai.com/policies/terms-of-use/)
* [OpenAI Privacy policy](https://openai.com/policies/privacy-policy/)
* [OpenAI API documentation](https://platform.openai.com/docs/)

= WordPress AI Client (WordPress 7.0+) =

On sites running WordPress 7.0 or later, this plugin will automatically use the built-in WordPress AI Client (`wp_ai_client_prompt()`) as the primary interface for AI requests. When the WP AI Client is active, API credentials are managed centrally by WordPress (Settings → Connectors) and not by this plugin. The direct OpenAI API integration remains available as a fallback for sites running WordPress 6.x.

== Changelog ==

= 1.0.0 =
* Initial release
* Text generation: GPT-4o, GPT-4o Mini, GPT-3.5 Turbo
* Image generation: DALL·E 3 and DALL·E 2
* Automatic Media Library upload for generated images
* Gutenberg: two dedicated searchable blocks (Write with AI, Generate Image with AI)
* Classic Editor / TinyMCE: two separate toolbar buttons with distinct icons
* Five tone options: Professional, Friendly, Persuasive, Informative, Creative
* Three length options: Short, Medium, Long
* Role-based access control
* Admin settings page with live API connection test
* Fully translatable (i18n ready)

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade steps required.
