=== Dropndot AI Content Checker ===
Contributors: dropndot
Tags: ai detection, ai content, gptzero, content checker, editorial
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Check posts and pages for likely AI-generated text with the GPTZero API, from the block editor or the Posts list.

== Description ==

Dropndot AI Content Checker connects WordPress to the GPTZero AI-detection API so editors can check content before publishing.

AI detection is probabilistic and can be wrong. Results are an editorial signal, not proof of authorship.

**Features**

* "AI Content Check" panel in the block editor. Checks the current text, including unsaved changes, only when you click the button.
* GPTZero's classification (likely AI, likely human, or mixed), class probabilities, confidence category and per-sentence AI scores: a ranked list of sentences to revise and the full text colour-coded by score. In the editor, clicking a sentence selects its block.
* GPTZero's own result message and AI subclass (pure AI, AI-paraphrased, polished, combined); sentences GPTZero excludes (references, tables, code) are left out.
* Optional GPTZero multilingual detection (French and Spanish).
* Plan usage (words left, cycle end) via GPTZero's usage-statistics endpoint, which uses no words.
* Low credit email alert: one email per billing cycle when usage reaches a percentage you choose, sent to the admin email or custom addresses, with a test-email button.
* Last-checked time, plus a warning when content has changed since the check.
* "AI Check" column, row action and bounded bulk action (up to 20 items, one at a time) on Posts and Pages lists.
* API key encrypted at rest and shown masked, optional `wp-config.php` constant, and a connection test.
* Lightweight scan history that stores a content fingerprint, never the content, with automatic cleanup. The sentence scores of each post's latest check are kept in post meta (replaced on every check) so reports can be reopened later.
* Enable the checker per post type.

This plugin is developed by Dropndot Solutions and is not affiliated with or endorsed by GPTZero.

== External services ==

This plugin connects to the **GPTZero API**, provided by GPTZero, at two endpoints. Nothing is sent until an administrator saves a GPTZero API key.

**1. AI detection** (https://api.gptzero.me/v2/predict/text), to estimate whether text was written by AI.

* **What is sent:** the plain-text body of the post or page being checked (HTML, block markup and shortcodes removed), your GPTZero API key, and two settings flags (`multilingual`, `apiVersion`). No title, author, URL, comments, visitor or user data, or other site information is sent.
* **When:** only when a user who can edit that content clicks a check button or runs a bulk check. Content is never sent automatically.

**2. Plan usage** (https://api.gptzero.me/v3/usage-stats), to read your plan name, words used and left, and billing-cycle dates. It uses no words.

* **What is sent:** your GPTZero API key only. No content or site information is sent.
* **When:** when an administrator clicks "Test connection", and, while the "Low credit email" setting is on (the default), automatically twice a day and a few minutes after a check runs. Turn off "Low credit email" under Settings → AI Content Checker → General to stop the automatic requests.

GPTZero: [Terms of use](https://gptzero.me/terms-of-use.html), [Privacy policy](https://gptzero.me/privacy-policy.html).

A GPTZero account whose plan includes API access is required. API usage may be billed by GPTZero.

== Installation ==

1. Upload the `dropndot-ai-content-checker` folder to `/wp-content/plugins/`, or install the zip via Plugins → Add New → Upload Plugin.
2. Activate the plugin.
3. Get an API key from your GPTZero dashboard (https://app.gptzero.me/api).
4. Go to Settings → AI Content Checker, paste the key, click "Save key", then "Test connection".

Optionally, define the key in `wp-config.php` instead of storing it in the database:

`define( 'DNDAICC_GPTZERO_API_KEY', 'your-key-here' );`

== Frequently Asked Questions ==

= Does a result prove who wrote the text? =

No. Detectors make mistakes, especially on short, edited or non-English text. Use results as one signal in editorial review.

= Is my content sent anywhere automatically? =

No. Text is sent to GPTZero only when someone clicks a check button or runs a bulk check.

= Where is the API key stored? =

Encrypted in the `wp_options` table (libsodium XSalsa20-Poly1305), using a key derived from `DNDAICC_ENCRYPTION_KEY` or your site's salts in `wp-config.php`. This protects the key in database dumps and backups, but not against anyone who can read `wp-config.php` or run code on the server. You can also define `DNDAICC_GPTZERO_API_KEY` in `wp-config.php` to keep it out of the database entirely. The key is never sent to browsers.

= What happens if a check fails? =

An error is shown and no score is recorded. A failed check is never treated as "human-written".

= Does it work with the Classic Editor? =

There is no Classic Editor panel. Use the row or bulk action on the Posts / Pages list, which checks saved content.

= Who can run checks? =

Any user who can edit the specific post. Only administrators can manage the API key and settings.

= What happens to data when I delete the plugin? =

Deleting the plugin removes its database table, options, transients and scheduled event. Deactivating keeps them.

== Screenshots ==

1. The "AI Content Check" panel in the block editor: classification, class probabilities, confidence and the sentences GPTZero highlighted as AI.
2. Full text colour-coded by each sentence's AI score.
3. The "AI Check" column on the Posts list.
4. The AI Check report, opened from the Posts list.
5. A bulk check running on the Posts list.
6. Settings → Connection: encrypted API key, connection test and plan usage.
7. Settings → General: content types, multilingual detection, history retention and low credit email alerts.
8. Settings → Scan history.
9. Settings → Privacy & data: what is sent to GPTZero, and when.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
 