=== GateForm ===
Contributors: gateform
Tags: captcha, spam, contact-form-7, comments, woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.2.3
License: MIT
License URI: https://opensource.org/licenses/MIT

GateForm CAPTCHA for WordPress and Contact Form 7, plus a contact widget for the site footer.

== Description ==

The plugin loads `client.js` from the [GateForm](https://gateform.ru) service into
WordPress forms and validates a one-time token on the server. The secret key is
stored only in the WordPress database and is never printed into HTML.

**Website:** [gateform.ru](https://gateform.ru)  
**Documentation:** [gateform.ru/docs](https://gateform.ru/docs)  
**Support:** [info@gateform.ru](mailto:info@gateform.ru)

Protected forms:

* comment form;
* login to the dashboard and the site through `wp-login.php`;
* registration form;
* Contact Form 7 (CAPTCHA and the `[gateform]` tag);
* WPForms;
* Gravity Forms;
* Ninja Forms;
* Elementor Pro Forms;
* Formidable Forms;
* Fluent Forms;
* WooCommerce: checkout, login, and registration;
* custom forms by CSS selectors.

Contact widget (does not require a secret key):

* when a **widget ID** (`w_...`) is set in the settings, the widget code is added
  to the site footer (`wp_footer`) automatically;
* the `[gateform_widget]` shortcode is also supported.

The "Protected by GateForm" label with a link to the website and the logo is
displayed in Contact Form 7 forms and can be disabled with the
`gateform_cf7_branding` filter.

Form field values are not sent to the validation service. Visitor IP addresses
are not stored by the plugin.

== External services ==

This plugin connects to the external GateForm service at https://gateform.ru
to provide CAPTCHA protection for WordPress forms and an optional contact widget.

GateForm is used for:

* Loading the CAPTCHA client script (`client.js`) on pages with protected forms.
* Loading the contact widget script (`widget.js`) when a widget ID is configured.
* Validating a one-time CAPTCHA token when a protected form is submitted.

The service is required for the CAPTCHA and contact-widget features.

**CAPTCHA validation**

When a visitor opens a page with a protected form, the browser loads
`https://gateform.ru/client.js`. The script may collect behavioral signals needed
to distinguish human visitors from automated requests.

When a visitor submits a protected form, the plugin sends the public site key,
the secret key, and the one-time CAPTCHA token to
`https://gateform.ru/api/v1/validate` over HTTPS.

The plugin does not send form field values, comments, message content, or visitor
IP addresses to GateForm.

**Contact widget**

When a widget ID is configured, the browser loads `https://gateform.ru/widget.js`.
The widget may display a contact form, chat, links to social networks, or other
contact options, depending on the website owner’s GateForm widget settings.

If the website owner enables a contact form or chat, information entered by the
visitor in that widget — for example, name, email address, phone number, or
message — may be sent to GateForm to process and deliver the contact request.
No visitor data is sent by this plugin itself; data handling depends on the
widget configuration selected by the website owner.

**Service terms and privacy**

* Terms of Service: https://gateform.ru/agreement
* Privacy Policy for website visitors: https://gateform.ru/privacy/visitors
* GateForm website: https://gateform.ru

== Installation ==

1. Upload the `gateform` folder to `/wp-content/plugins/` or install the ZIP file
   through "Plugins → Add New → Upload Plugin".
2. Activate the plugin on the "Plugins" screen.
3. Open "Settings → GateForm".
4. Enter the public key (`site_key`) and the secret key (`secret_key`).
5. Select the forms you want to protect.
6. Optionally enter the **widget ID** (`w_...`) — the widget code appears in the
   site footer immediately.

Keys are created in the GateForm dashboard. The site domain must be specified in
the key settings.

== Frequently Asked Questions ==

= How do I add the CAPTCHA to Contact Form 7? =

Enable "Contact Form 7" in the plugin settings. You can add the `[gateform]` tag
to the form — it prints the hidden token field and the GateForm label. If the tag
is not added, `client.js` connects to the form automatically and adds the field
itself.

= Why is the CAPTCHA not visible in the Contact Form 7 form? =

GateForm uses an invisible behavioral check and shows the "I am not a robot"
button only when a bot is suspected. The hidden `gf_token` field and the GateForm
label are added automatically.

= Does the plugin need external services or a CDN? =

No. Only the script from your GateForm instance is loaded.

= What happens if the validation service is unavailable? =

Forms are rejected by default (secure mode). Enable "Accept forms without
validation (fail-open)" if not losing submissions is more important.

= Is the plugin compatible with page caching? =

Yes. The script is added to the page footer, and the token is requested at the
moment the form is submitted.

= Where is the secret key stored? =

In the `wp_options` table. It is not printed into HTML and is not passed to
JavaScript.

= Can I use only the contact widget? =

Yes. Enter only the widget ID `w_...` in the settings — the widget script is
printed in the site footer immediately. No secret key is required for it.

== Changelog ==
= 1.2.2 =
* Release fixes and version update.

= 1.2.1 =
* Initial tagged release.

= 1.2.0 =
* Unified plugin: CAPTCHA plus the contact widget.
* Full Contact Form 7 integration: the `[gateform]` tag, validation through
  `wpcf7_validate`, the hidden token field, and branding with a link to
  gateform.ru.
* The `[gateform_widget]` shortcode for placing the contact widget anywhere on
  the site.
* Logo and website link in the admin screen and in Contact Form 7 forms.
* Validation result caching within a single request.

= 1.1.0 =
* Contact Form 7, WPForms, Gravity Forms, Ninja Forms, Elementor Pro,
  Formidable Forms, Fluent Forms, and WooCommerce support.
* Login protection through `wp-login.php`.
* Custom form CSS selectors and the `gateform_validate_token` filter.
* Fail-open mode and per-integration settings.

= 1.0.0 =
* First release: comments, login, registration, and fail-open mode.

== Upgrade Notice ==

= 1.2.0 =
Unified plugin: Contact Form 7 CAPTCHA and the contact widget. Check the widget
settings in "Settings → GateForm" after the update.
