=== ClevRank ===
Contributors:      grupo26
Tags:              seo, content, autopilot, ai, publishing
Requires at least: 6.0
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        1.0.0
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Connects your WordPress site to the ClevRank content autopilot platform.

== Description ==

ClevRank is the companion WordPress plugin for the [ClevRank](https://clevrank.com)
content autopilot platform. ClevRank is a product developed, owned and operated by
Grupo26 ([grupo26.com](https://grupo26.com)), which also maintains this plugin.
It allows the ClevRank backend to publish AI-generated, SEO-optimized articles directly to
your site, manage featured images, set Yoast SEO / Rank Math metadata, and monitor site
health — all via a secure REST API authenticated with your personal API key.

**This plugin requires an active account on [ClevRank](https://clevrank.com).** It communicates
with the ClevRank backend at `https://app.clevrank.com` to verify your API key and report
site health. The ClevRank backend also calls into this plugin's REST API to publish and
update articles on your site. See the Privacy section below for full details.

= Features =

* Secure REST API — all endpoints require a secret API key sent via X-ClevRank-Key header
* Publish articles — full HTML content, categories, tags, featured image, and SEO meta in one call
* Update articles — partial updates (content, meta, featured image) without touching slug or date
* Category and tag auto-creation — missing terms are created on the fly
* SEO plugin support — Yoast SEO, Rank Math, SEOPress, All in One SEO, The SEO Framework, Squirrly SEO
* Site status endpoint — reports WP version, PHP version, plugin state, post count
* Activity log — every action is recorded in a dedicated database table
* Rate limiting — max 60 requests per minute per IP to prevent abuse
* Health check cron — pings the ClevRank backend every 6 hours to confirm connectivity

= Requirements =

* WordPress 6.0 or higher
* PHP 7.4 or higher
* An active ClevRank account with a valid API key

= REST API Endpoints =

All endpoints live under the `/wp-json/clevrank/v1/` namespace and require the
`X-ClevRank-Key` header to equal the API key stored in Settings.

| Method  | Path              | Description                                          |
|---------|-------------------|------------------------------------------------------|
| POST    | /posts            | Create a new post with content, images, and SEO meta |
| GET     | /posts            | List posts (query: limit, offset, category)          |
| PATCH   | /posts/{postId}   | Partially update a post                              |
| GET     | /categories       | List all categories                                  |
| GET     | /status           | Full site status snapshot                            |
| POST    | /verify           | Verify connection (used by Settings page)            |

= Privacy =

This plugin communicates with the ClevRank backend at `https://app.clevrank.com` in the
following ways:

Outgoing requests (from your site to ClevRank):

* Test Connection (manual, from Settings page): sends your API key, site URL, WordPress
  version, detected SEO plugins, and published post count.
* Health check ping (automatic, every 6 hours via WordPress cron): sends your API key,
  site URL, WordPress version, and connection status.

Incoming requests (from ClevRank to your site):

* The ClevRank backend calls this plugin's REST API to publish articles, update existing
  posts, retrieve post lists, and check site status. All incoming requests are authenticated
  with your API key via the X-ClevRank-Key header.

No personal user data (names, emails, IP addresses) is transmitted in any direction.

See the [ClevRank Terms of Service](https://clevrank.com/terms) and the
[ClevRank Privacy Policy](https://clevrank.com/privacy).

== Installation ==

1. Download the plugin zip from your ClevRank dashboard.
2. In WordPress admin go to Plugins, Add New, Upload Plugin.
3. Select the zip file and click Install Now.
4. Activate the plugin.
5. Navigate to Settings, ClevRank and enter your API key.

== Frequently Asked Questions ==

= Where do I find my API key? =

Log in to [app.clevrank.com](https://app.clevrank.com), open your workspace settings, and copy
the WordPress API Key for the site you want to connect.

= Is my API key stored securely? =

The API key is stored in the WordPress options table using the standard update_option function.
We recommend using an SSL certificate (HTTPS) on your WordPress site to protect the key in transit.

= Does the plugin support multisite? =

Not at this time. It is designed for single-site installations.

= What happens to my data if I uninstall the plugin? =

Uninstalling the plugin removes the activity log table and all stored options.
Published posts are not affected.

= Does it work without Yoast or Rank Math? =

Yes. SEO meta fields are simply not written if no supported SEO plugin is active. You can
install one at any time and the meta will be written on the next article update.

== Changelog ==

= 1.0.0 =
* Initial release.
* REST endpoints: POST /posts, GET /posts, PATCH /posts/{id}, GET /categories, GET /status, POST /verify.
* SEO support: Yoast SEO, Rank Math, SEOPress, All in One SEO, The SEO Framework, Squirrly SEO.
* Focus keyword, OG meta, and Twitter meta written automatically.
* Activity log table with indexed columns.
* Rate limiting (60 req/min per IP via transients).
* WordPress cron health-check every 6 hours.
* Settings page under Settings, ClevRank with Test Connection button.

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade needed.
