=== EONSR AEO Agent ===
Contributors: smitheonsr
Tags: ai, content generator, seo, aeo, writing assistant
Requires at least: 6.8
Tested up to: 6.9
Stable tag: 3.7.9
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate high-quality, SEO/AEO optimized long-form articles, images, and translations using Google Gemini AI via EONSR Cloud.

== Description ==

EONSR AEO Agent is a powerful content generation tool designed to help website owners automate the creation of SEO and AEO (Answer Engine Optimization) friendly articles.

Unlike generic AI writers, this plugin utilizes a specialized 2-pane UI workflow and structured prompt engineering to produce in-depth, formatted, and media-rich content directly within your WordPress dashboard.

**How it works (SaaS Service)**

This plugin operates as a connector (client) to the EONSR Cloud Platform. It sends your input (keywords, topics, settings) to our external Node.js processing servers to generate content using advanced AI models (Google Gemini API). This architecture ensures your WordPress site remains fast and is not burdened by heavy AI processing tasks.

All plugin features are fully functional. The plugin itself contains no locked or restricted functionality. API usage limits are managed entirely server-side by the EONSR Cloud service.

**Key Features**

*   **AI Article Generation:** Create comprehensive articles from a single keyword using advanced prompting.
*   **Dual-Pane Interface:** Edit content and prompts side-by-side before publishing.
*   **Image Generation:** Automatically create Featured Images and In-Content images with text overlays.
*   **Bulk Generation:** Upload an Excel (.xlsx) file to schedule and generate hundreds of posts automatically in the background.
*   **Smart Auto-Translation:** Generate content in one language and automatically translate/localize it into multiple languages.
*   **SEO Optimization:** Automatically fills Rank Math / Yoast SEO meta descriptions and focus keywords.
*   **YouTube Embedding:** Automatically finds and embeds relevant videos to increase time-on-site.

== External Services ==

This plugin connects to the following external services. By using this plugin, you agree to the terms of each service listed below.

= 1. EONSR Cloud API =

This plugin requires the EONSR Cloud API to function. All content generation, image creation, and translation features are processed on EONSR's external servers — no AI processing is done locally on your WordPress site.

*   **What it is:** A managed Node.js API platform that processes AI content generation requests using Google Gemini models.
*   **API Endpoint:** `https://commercial-api.congtyeon.com`
*   **What data is sent:** When you trigger a generation action, the plugin sends your input (keywords, language selection, writing style, tone settings, and your license key) to our servers. No WordPress user passwords or sensitive site credentials are transmitted.
*   **When data is sent:** Only when the user explicitly clicks "Generate", triggers bulk processing, or activates/syncs a license key.
*   **Service Provider:** Cong Ty EON (EONSR)
*   **Terms of Service:** https://aeo.eonsr.com/terms/
*   **Privacy Policy:** https://aeo.eonsr.com/privacy-policy/

= 2. YouTube Data API v3 (Google) =

This plugin optionally uses the YouTube Data API v3 to search for and embed relevant videos inside generated articles.

*   **What it is:** Google's public API for searching YouTube video content.
*   **API Endpoint:** `https://www.googleapis.com/youtube/v3/search`
*   **What data is sent:** The article keyword/topic is sent to YouTube's API to find a relevant video. No personal user data is transmitted.
*   **When data is sent:** Only when the YouTube embedding feature is enabled and a generation action is triggered.
*   **Service Provider:** Google LLC
*   **Terms of Service:** https://developers.google.com/youtube/terms/api-services-terms-of-service
*   **Privacy Policy:** https://policies.google.com/privacy

= REST API Endpoints (Inbound Webhooks) =

This plugin registers several REST API endpoints on your WordPress site. These are **not** outbound connections — they are inbound webhooks that allow the EONSR Cloud server to deliver generated content back to your site after processing is complete.

*   `POST /wp-json/eonsr-aeo-agent/v1/scheduled-post/create` — Receives the completed article from EONSR Cloud and creates/schedules the WordPress post. Authenticated via a shared secret key validated server-side.
*   `POST /wp-json/eonsr-aeo-agent/v1/sync-license` — Receives license status updates pushed from EONSR Cloud (e.g., after renewal or plan change).
*   `GET /wp-json/eonsr-aeo-agent/v1/languages` — Returns the list of active Polylang languages on your site, used by EONSR Cloud to correctly route translated content.
*   `GET /wp-json/eonsr-aeo-agent/v1/posts` — Returns a list of existing post titles/slugs, used by EONSR Cloud to avoid duplicate content during bulk generation.
*   `GET /wp-json/eonsr-aeo-agent/v1/keyphrases` — Returns existing focus keyphrases from your site's database, used to avoid keyword cannibalization during bulk generation.

No sensitive WordPress user data (passwords, emails, private meta) is exposed through these endpoints. The `/scheduled-post/create` and `/sync-license` endpoints validate a shared secret before accepting any data.

== Installation ==

1.  Log in to your WordPress Administration Panels.
2.  Go to **Plugins -> Add New**.
3.  Search for **EONSR AEO Agent**.
4.  Click **Install Now**, then click **Activate**.
5.  Go to the **AEO Agent** menu in your dashboard.
6.  Optionally, enter your License Key to connect your own third-party API quota (YouTube, Google Search). You can also proceed without a key using EONSR's shared default quota.
7.  Start generating content!

Alternatively, you can upload the plugin zip file via the **Plugins -> Add New -> Upload Plugin** screen.

== Frequently Asked Questions ==

= Do I need to pay to use this plugin? =
The plugin itself is free to download and all features are fully accessible without a license key. The plugin connects to the EONSR Cloud service for AI processing, which is available to all users using EONSR's default shared quota. A License Key is available for purchase at https://aeo.eonsr.com and grants you a dedicated, higher-volume quota for third-party integrations such as the YouTube Data API and Google Search API — resources that EONSR provisions and manages on your behalf.

= Where is my data sent? =
Your input data (keywords, article settings, license key) is sent to `https://commercial-api.congtyeon.com` for processing. We do not store your WordPress user passwords or sensitive site data. We only process the content generation requests.

= Why does it use an external server? =
AI content generation, especially image creation and long-form text processing, requires significant computational power. Running this directly on your WordPress hosting would likely cause timeout errors. Our Node.js cloud infrastructure handles the heavy lifting to ensure stability.

= Can I use my own Google Gemini API Key? =
No. To ensure quality consistency, structured prompt engineering security, and advanced features (like text-on-image generation), the system uses our managed API infrastructure.

= What are the REST API endpoints registered by this plugin? =
This plugin registers inbound webhook endpoints so that the EONSR Cloud server can deliver generated content back to your WordPress site. See the "External Services" section above for full details on each endpoint and what data flows through them.

== Screenshots ==

1.  **Main Dashboard:** The 2-pane interface for generating and reviewing content with AI.
2.  **Bulk Generator:** Interface for uploading Excel files for mass generation.
3.  **Image Results:** AI-generated images with automatic logo and text insertion.
4.  **License Activation:** Simple activation screen for connecting to EONSR Cloud.

== Changelog ==

= 3.7.7 =
*   Refactored codebase for better performance and security (Prefix Standardization).
*   Implemented WordPress Nonce verification for all AJAX actions.
*   Enhanced Bulk Processor with background processing logic.
*   Added DOMDocument handling for better image injection in translated posts.
*   Updated API endpoints to v1 structure.
*   Extracted all inline CSS and JavaScript into separate enqueued files per WordPress guidelines.

= 1.0.0 =
*   Initial release.

== Upgrade Notice ==

= 3.7.7 =
Major update with security improvements and code standardization. Please update to ensure API compatibility.