=== WP ShrtFly Integration ===
Contributors: vluongo
Tags: shrtfly, url shortener, link shortener, monetize links, full page script
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 3.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Earn from the links on your site: ShrtFly turns them into short links that show an ad before the destination. No code needed.

== Description ==

Turn the links on your site into ShrtFly links and earn when visitors open them. Visitors see a ShrtFly page with ads, then reach the original destination.

= How it works =

1. Copy your API token from your ShrtFly account.
2. Paste it in Settings > ShrtFly Settings and turn the integration on.
3. Choose which links to convert and save.

Your posts are not modified: links are converted in the visitor's browser when the page opens.

= Features =

* One switch to turn link conversion on or off.
* Choose the ad type: Mainstream or Adult.
* Convert only the links to the domains you list (Include), or all links except those domains (Exclude). Wildcards like `*.example.com` are supported.
* Optional support for AMP pages made with AMP for WP.
* Nothing is loaded on your pages until the integration is on and the API token is set.
* Available in English and Italian.

This is not an official ShrtFly plugin.

== External services ==

When the integration is enabled, the plugin loads the ShrtFly Full Page Script (`https://shrtfly.com/js/full-page-script.js`) on the public pages of your site. The script receives your API token, the ads type and the domain list you configured, and turns the links of the page into ShrtFly short links: visitors who open them go through ShrtFly.

The service is provided by ShrtFly: [terms of use](https://shrtfly.com/pages/terms), [privacy policy](https://shrtfly.com/pages/privacy).

== Installation ==

1. Install the plugin from Plugins > Add New, or upload the `shrtfly-integration` folder to `/wp-content/plugins/`.
2. Activate it.
3. Go to Settings > ShrtFly Settings, enter your API token and enable the integration.

== Frequently Asked Questions ==

= Is this an official ShrtFly plugin? =

No.

= Where do I find the API token? =

Log in to ShrtFly and open the [Developer API](https://shrtfly.com/publisher/developer-api) page.

= Which links are converted? =

With Exclude (the default), every link except those to the listed domains. With Include, only the links to the listed domains.

= My own internal links are converted too. How do I stop it? =

With Exclude, every link that is not on the list is converted, and WordPress writes links to your own pages as full addresses. Add your domain to the list (for example `example.com, *.example.com`), or switch to Include and list only the domains you want to convert.

= What happens to my settings when I delete the plugin? =

They are removed together with the plugin. Deactivating it keeps them.

== Screenshots ==

1. Settings page.

== Changelog ==

= 3.0.0 =
* Tested up to WordPress 7.1.
* Fix: the AMPforWP integration never loaded since 1.6.0.
* Fix: deleting the plugin from the admin stopped halfway, leaving its settings behind.
* Fix: error messages on the settings page were shown twice.
* Fix: the ShrtFly script was loaded with an invalid token when the API token was empty.
* Fix: the ads type and domain mode choices could not be reached with the keyboard.
* New: Italian translation.
* The settings page moved to `options-general.php?page=shrtfly-integration`; its styles are now a cacheable file loaded only there.

= 2.0.0 =
* Requires PHP 8.0. Tested up to WordPress 7.0.
* Redesigned settings page, without jQuery.
* Wildcard domains (`*.example.com`) accepted; ads type and domain mode values validated.

= 1.6.0 =
* The script is loaded through the WordPress script API, always deferred.
* The demo domain list is read as a text file instead of being included as PHP.
* Input sanitization and output escaping.

= 1.5.0 =
* New ads type option: Mainstream or Adult.

= 1.4.0 =
* Tested up to WordPress 6.1.

= 1.3.0 =
* New option to load the script in defer mode.

= 1.2.0 =
* Compatibility update.

= 1.1.0 =
* Tested up to WordPress 5.9, minor fixes.

= 1.0.0 =
* First release.
