=== agent-mark — маркировка иноагентов ===
Contributors: agentmark
Tags: foreign agents, compliance, russia, marking, law
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.4.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically marks mentions of foreign agents, extremist and terrorist organizations in posts as required by Russian law.

== Description ==

Russian law (Article 4 of the Mass Media Law) requires publications to state the status of foreign agents and to note that an extremist or terrorist organization is banned whenever they are mentioned.

The plugin finds such mentions in your posts — in any grammatical case, by pseudonyms and abbreviations — and adds marks right into the page HTML:

* a marker after each mention with a tooltip and a footnotes block at the end of the post;
* or the status in brackets right after the name;
* or both at once.

Marks are added to the post pages, to RSS feeds (the full text and the excerpt) and to post excerpts.

With the optional "drug warning" service, a warning about the harm of illegal drugs is added before the text of posts that mention narcotic drugs or psychotropic substances from the official list (Government Decree No. 681).

Marks are cached in the post, so pages stay fast. When the official registries are updated, marks are recalculated automatically in the background.

The data comes from the official registries of the Ministry of Justice of Russia, the FSB of Russia and Rosfinmonitoring.

== External services ==

This plugin connects to the agent-mark.ru service (https://agent-mark.ru) to find and mark mentions. It is required for the plugin to work.

* **What is sent:** the HTML of published posts of the selected post types, when a post is displayed and its marks are not cached yet, or after the registries are updated; and the site secret key for authorization. Visitor data is never sent.
* **When:** only after the site administrator enters a secret key and explicitly gives consent on the plugin settings page. Without consent the plugin makes no external requests.
* **JavaScript widget (optional):** if the "JavaScript widget" mode or the fallback option is enabled, the page loads the script https://agent-mark.ru/widget.js, which sends the text of the post to agent-mark.ru from the visitor's browser.

Service terms: https://agent-mark.ru/legal/offer
Privacy policy: https://agent-mark.ru/legal/privacy

== Installation ==

1. Install and activate the plugin.
2. Sign in at https://agent-mark.ru/cabinet, add your site and copy its secret key (starts with `sk_`).
3. Open Settings → agent-mark, paste the key, give consent and save.
4. Press "Check connection".

== Frequently Asked Questions ==

= Will it slow down my site? =

No. A post is sent to the service once; afterwards its marked version is taken from the cache stored in the post.

= Can I exclude a post? =

Yes, use the "Do not mark this post" checkbox in the editor sidebar.

= Are RSS feeds marked? =

Yes, both the full text and the excerpt. Feeds are marked on the server even in the JavaScript widget mode, because feed readers do not run scripts. This can be turned off in the settings.

= What happens if the service is unavailable? =

The post is shown without changes. Optionally, the JavaScript widget can be used as a fallback.

== Changelog ==

= 1.4.2 =
* Only published posts are sent to agent-mark.ru: drafts, private posts and previews are not.
* Posts loaded by the theme via admin-ajax.php ("load more") are marked too.
* A post the server declined (too long, plan not paid) is shown without marks and is not requested again on every view; the reason is shown on the settings page. A temporary failure still pauses requests for a few minutes.
* Fewer requests to agent-mark.ru: a post is not re-marked after saving when its text did not change, and the background refresh skips posts that are already up to date.
* The secret key is no longer shown on the settings page; leave the field empty to keep it.
* Uninstalling cleans up every site of a multisite network.

= 1.4.1 =
* The "registry data updated" date on the settings page is taken from a separate API field; with namesakes excluded on the "media" plan it used to show a wrong date.

= 1.4.0 =
* The post address is sent along with the text: namesakes excluded in the agent-mark.ru dashboard (the "media" plan) are not marked on that post.

= 1.3.0 =
* Settings for the status in brackets: highlight in red (on by default, as before) and italics.
* The status in brackets is styled right in the HTML, so it looks the same in RSS feeds and with any theme.

= 1.2.1 =
* Consent is required: settings are not saved without it, with a clear error message.
* A warning on the settings page, the plugins page and the dashboard while the plugin is not marking posts.

= 1.2.0 =
* Styles for the drug warning (the optional agent-mark.ru service): it is added before the post text.
* No drug warning in post excerpts.

= 1.1.0 =
* New mark style: the status in brackets and footnotes at once.
* Post excerpts and the RSS feed excerpt are marked with the status in brackets.
* RSS feeds are marked in the JavaScript widget mode too; feed marking can be turned off.

= 1.0.0 =
* First release.
