=== Shrtlnk Link Shortener ===
Contributors: shrtlnkeu
Tags: link shortener, short links, qr code, redirect, privacy
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Short links on your own domain – or via a shrtlnk.eu account. With QR codes and anonymous, privacy-friendly click statistics.

== Description ==

Shrtlnk Link Shortener turns your WordPress site into a privacy-friendly link shortener – no external service required. Alternatively, it connects to [shrtlnk.eu](https://shrtlnk.eu/) or any self-hosted shrtlnk server via its REST API.

Shrtlnk and this plugin are developed by [cx42.de](https://cx42.de/), the company behind shrtlnk.eu.

**Two modes**

* **Own domain** – short links like `https://example.com/go/abc4` live in your WordPress database. Visitors are redirected directly by your site; no third party is involved.
* **shrtlnk account** – manage the short links of your shrtlnk.eu account (or your self-hosted shrtlnk server) right from the WordPress dashboard, using your personal API token.

**Features**

* Create short links with a random or custom code, an optional note and an optional expiry date ("valid until").
* Bulk import: paste many target addresses at once (one per line, or with a custom separator) and get a short link for each – including a "copy all" button for the results.
* Pause and re-activate links at any time. Paused or expired links show a neutral notice page (HTTP 410).
* QR code for every short link as SVG (vector, print-ready) and PNG – generated in pure PHP, no external service, no PHP extensions required. The QR code points to the short link, so the target stays editable even after printing.
* Anonymous click statistics: daily totals only (day, referrer domain, device class). No IP addresses, no user agents, no individual visitors, no cookies. Optional retention limit and CSV export.
* "Create short link" row action for published posts and pages; the short link is also used as the post's shortlink (`wp_get_shortlink()`).
* Configurable path prefix (default `go`), redirect type (302/301) and length of random codes.
* Clean uninstall: data is only removed if you explicitly opt in under Shrtlnk → Settings.

**Privacy**

In "own domain" mode everything stays on your server. The redirect sends a `Referrer-Policy: no-referrer` header, and the optional statistics store aggregated daily counts only – designed with the GDPR in mind.

== External services ==

This plugin can optionally connect to a shrtlnk link shortener server. This happens **only** if you select the "shrtlnk account" mode in the settings and enter a server address and API token – in the default "own domain" mode no external requests are made at all.

When the "shrtlnk account" mode is active, the plugin sends requests to the configured server (by default `https://shrtlnk.eu`) to create, read, update and delete the short links of your account. Transmitted data: your API token (as an authorization header) and the link data you enter (target URL, code, note, expiry date). No visitor data of your WordPress site is ever transmitted.

shrtlnk.eu is operated by cx42.de in Germany. Terms and privacy policy: [Imprint](https://shrtlnk.eu/impressum), [Privacy policy](https://shrtlnk.eu/datenschutz). If you connect a self-hosted shrtlnk server instead, the terms of that server's operator apply.

== Installation ==

1. Install and activate the plugin.
2. Go to **Shrtlnk → Settings** and choose a mode:
   * **Own domain**: optionally adjust the path prefix (default `go`). Done.
   * **shrtlnk account**: enter the server address and your API token (created in the shrtlnk customer area under "API access"). The connection is tested when you save.
3. Create your first short link under **Shrtlnk → Short links** – or directly from the posts list via the "Create short link" row action.

== Frequently Asked Questions ==

= Do I need a shrtlnk.eu account? =

No. In the default "own domain" mode the plugin is completely self-contained and stores everything in your WordPress database. The shrtlnk account mode is optional.

= Can short links live directly below my domain, without a prefix? =

Yes – leave the path prefix empty in the settings. The plugin then answers `https://example.com/abc4` directly. It never hijacks existing content: codes that would hide an existing page or post are rejected, and unknown paths are handed back to WordPress as usual.

= What exactly do the statistics store? =

Per link and day: the number of clicks, the referrer domain (never the full address) and a rough device class (desktop, mobile, tablet, bot). No IP addresses, no user agents, no cookies, no individual visitors. You can switch statistics off entirely or limit their retention.

= Does the QR code use an external service? =

No. QR codes are generated in pure PHP on your server (in "shrtlnk account" mode they are fetched from your shrtlnk server, which also generates them itself).

== Screenshots ==

1. Link list with status, clicks and actions
2. QR code and anonymous statistics for a short link
3. Settings: own domain or shrtlnk account

== Changelog ==

= 1.0.0 =
* First release: short links on your own domain or via a shrtlnk account, QR codes (SVG/PNG), anonymous daily statistics with CSV export, expiry dates, pause/activate, post integration, bulk import.

== Upgrade Notice ==

= 1.0.0 =
First release.
