=== BrainyPress ===
Contributors: mrnaveedshah
Tags: ai-auto-blogger, wordpress-automation, auto-blogging, content-automation, social-auto-posting
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

The Ultimate Fully Automated AI Blogger. Generates Human-Like, SEO-Ranked Content using Free Gemini API. Auto-shares to Pinterest and Twitter. Part of AlphaPost.

== Description ==

**Meet BrainyPress v3.1: Your Free Auto-Writer for WordPress.**

BrainyPress is a fully automated content machine designed to rank on Google. Schedule posts, generate content with Google Gemini AI, and auto-share to Pinterest and Twitter using browser cookies. No paid API subscriptions needed.

BrainyPress is part of the **AlphaPost** ecosystem. Visit [brainypress.net](https://www.brainypress.net) for plugin updates and [alphapost.io](https://alphapost.io) for more automation tools.

### Why is BrainyPress Different?

* **Fully Automated:** Set a schedule and BrainyPress runs in the background, generating fresh content while you sleep.
* **Liquid AI Logic:** No rigid templates. The AI adapts to ANY niche, from crypto to recipes to news.
* **Smart SEO Engine:** Auto-inserts internal links to your old posts. Adds high-authority external links.
* **Real-Time Search:** Uses Gemini's Google Search tool to fetch the latest data before writing.
* **Human-Style Writing:** Strict rules against AI-tell words and em-dashes. Content reads like a human wrote it.

### Key Features (v3.1)

* **Built-in Free Image Maker:** Every article gets an auto-generated featured image in Pinterest size (1000x1500). Made locally with PHP GD. No external API, no cost, no limits.

* **Auto-Pin to Pinterest:** Connect Pinterest using browser cookies. Auto-pins your new posts to your chosen board. 2 pins per day limit (safety).
* **Auto-Tweet on Twitter / X:** Connect using a single auth_token cookie. Auto-tweets your posts. 2 tweets per day limit (safety).
* **Per-Order Toggles:** Enable Pinterest and Twitter sharing per automation order. Full control.
* **Free Gemini AI:** Built on the free tier of Google Gemini API. 1500 requests per day for free.
* **Crash-Proof:** Optimized SQL logic ensures it handles 100+ posts without crashing your server.
* **Manual + Auto Modes:** Run instantly or schedule for daily auto-posting.

### Content Quality Rules (v3.1)

The AI follows strict rules to write like a real human:

* No AI-tell words (like delve, tapestry, navigate, realm, unveil, embark, leverage, etc.)
* No em-dashes or en-dashes. Plain punctuation only.
* Very easy English. Short sentences. Anyone can read.
* Real-time grounding for latest information.
* User prompt is the boss. If you specify a word count, AI follows it exactly.
* Default word count: 1000 to 1500 words if you do not specify.

### External Services Disclosure

This plugin connects to third-party services to function. All keys and cookies are stored securely in your WordPress database.

**1. Google Gemini API (by Google)**
* Usage: Generates article text and performs web searches.
* Privacy: [Google Privacy Policy](https://policies.google.com/privacy) | [Terms](https://ai.google.dev/terms)

**2. Twitter / X (by X Corp)**
* Usage: Posts tweets to your account when you enable Twitter sharing.
* Privacy: [Twitter Privacy Policy](https://twitter.com/en/privacy)

**3. Pinterest (by Pinterest, Inc.)**
* Usage: Creates pins on your account when you enable Pinterest sharing.
* Privacy: [Pinterest Privacy Policy](https://policy.pinterest.com/en/privacy-policy)

== Installation ==

1. Upload the `brainypress` folder to `/wp-content/plugins/` directory.
2. Activate the plugin from the WordPress Plugins menu.
3. Go to **BrainyPress** in the admin sidebar.
4. **Step 1:** Paste your free Google Gemini API Key.
5. **Step 2 (Optional):** Connect Pinterest and Twitter using browser cookies. See "How to Find Cookies" in the footer for full guide.
6. **Step 3:** Create an automation order. Pick category, write prompt, choose schedule.
7. The plugin runs automatically every hour and generates posts at your set time.

== Frequently Asked Questions ==

= How does auto-sharing work? =
The plugin uses your Pinterest and Twitter browser cookies (saved one time) to share new posts directly. We added a strict 2 per day limit to protect your accounts from spam flags.

= Is it safe to share my cookies? =
Cookies are stored on your own WordPress database. They are never sent to external servers. Only your site admins can access them. For extra safety, we recommend using a dedicated account.

= What if my cookies expire? =
You will need to log in again to Pinterest or x.com, copy the new cookie value, and update it in the BrainyPress settings. This usually happens every few months.

= How does Real-Time Grounding work? =
We use Gemini's built-in Google Search tool. Before writing, the AI searches Google for the latest information on your topic.

= Is any user data tracked? =
No. BrainyPress does not collect or track any user behavior. All API communications happen directly between your WordPress server and the respective service providers.

= Does this plugin use its own API keys? =
No. You must provide your own Gemini API key (free from Google). Pinterest and Twitter use your own browser cookies. Full ownership.

= What is Liquid AI Logic? =
The AI has no fixed structure. It decides format based on your prompt. Ask for a "Table" and it makes a table. Ask for a "List" and it makes a list. Ask for a "Story" and it writes a story.

= How does Smart Linking work? =
The plugin fetches a random old post from your blog and instructs the AI to weave that link naturally into the new article.

= Is it really free? =
Yes. The plugin is free. The Gemini API has a generous free tier (1500 requests per day). Pinterest and Twitter sharing uses cookies, no paid API access needed.

= Will it create duplicate content? =
No. v3.0 includes Variation IDs and an Avoid List. The AI is told which recent topics it covered so each post is unique.

= What changed from v2.8 to v3.0? =
Major update. Replaced Twitter API (which required developer account) with simple cookie-based auto-tweet. Added Pinterest cookie-based auto-pin. Added daily safety limits. Stronger AI content rules. Now part of AlphaPost ecosystem.

== Screenshots ==

1. **The Dashboard:** Clean neubrutalism design for managing tasks.
2. **Social Connections:** Easy one-cookie setup for Pinterest and Twitter.
3. **Order Creation:** Per-order auto-share toggles.
4. **Active Orders:** See all your automations with sharing badges.

== Changelog ==

= 3.1 =
* **NEW:** Built-in free image maker. Every new article now gets an auto-generated featured image (1000x1500 Pinterest size) made from the article title. No external API, no paid service. Uses PHP GD with the bundled Poppins font.
* **NEW:** 8 premium color themes for generated images. Each article picks a consistent theme based on its title.
* **FIXED:** Pinterest sharing failed with "No image found in post". Now the plugin generates an image on the spot if a post has none, so pins always go out.
* **FIXED:** New Gemini API keys (from new Google Cloud projects) returned model errors. Added the full free Gemini 3 line (gemini-3.1-flash-lite, gemini-3.5-flash-lite, gemini-3-flash, gemini-3.5-flash, gemini-3.6-flash) to the fallback chain. All are free tier Flash and Flash-Lite models, no paid model needed. Old keys keep working on the 2.5 line.
* **REMOVED:** Gemini 2.0 models from the fallback chain. Google shut them down, so they only wasted retry time.
* **FIXED:** Some new free API keys have zero quota for the Google Search grounding tool, which caused "You exceeded your current quota" errors on every model. The plugin now retries each model without the search tool. Article generation works on every free key, old or new.
* **IMPROVED:** The plugin now remembers which model works with your key and uses it directly on the next run. No more burning your daily quota on failed retries.
* **IMPROVED:** Error messages now show full details from Google instead of getting cut off, so problems are easier to diagnose.
* **IMPROVED:** Gemini 3 requests now use Google recommended default sampling settings for better output quality.

= 3.0 (Major Rewrite) =
* **NEW:** Twitter cookie-based auto-tweet. Just paste auth_token. No more OAuth setup, no developer account needed.
* **NEW:** Pinterest cookie-based auto-pin. Paste _pinterest_sess and csrftoken with board URL. Done.
* **NEW:** Per-order auto-share toggles. Choose which orders auto-share to Pinterest, Twitter, or both.
* **NEW:** Strict safety limits. 2 pins per day, 2 tweets per day (resets at midnight UTC).
* **NEW:** Stronger AI content rules. Bans AI-tell words like "delve", "tapestry", "embark". Bans em-dashes and en-dashes.
* **NEW:** Easy English mode. AI now writes very simple, readable content.
* **NEW:** Default word count (1000 to 1500 words) if user does not specify.
* **IMPROVED:** AI prompt is now stronger. User instruction is treated as the boss. AI must follow it exactly.
* **IMPROVED:** Real-time grounding. AI always searches for the latest information.
* **IMPROVED:** New "How to Find Cookies" help modal with step-by-step guide.
* **REMOVED:** Old Twitter OAuth fields (4 keys). No longer needed.
* **BRANDING:** Now part of the AlphaPost ecosystem (alphapost.io).

= 2.8 =
* Liquid AI Engine. AI obeys user prompt for formatting.
* Smart Linking System.
* Crash Protection with SQL queries.
* Avoidance Logic to prevent topic repetition.
* Fixed "Stuck at Posting" timeout issues.

= 2.7 =
* Added Post Status (Draft/Publish).
* Added Twitter Auto-Post (OAuth).
* Upgraded to Gemini 2.0.

== Upgrade Notice ==

= 3.1 =
Important fix release. New Gemini API keys now work (Gemini 3 models added). Pinterest sharing now always works thanks to the new built-in free image maker that creates a featured image for every article.

= 3.0 =
Major rewrite. Removes Twitter OAuth (no more developer account needed) and adds easier cookie-based sharing for both Pinterest and Twitter. Stronger AI content quality. Recommended for all users.
