=== DMS3 QR Manager ===
Contributors: marcqueralt, demomentsomtres
Tags: qr code, redirect, analytics, utm, svg
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 20260712.2127
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage QR codes as a custom post type with trackable redirects, visit statistics, and SVG download.

== Description ==

DMS3 QR Manager lets you create and manage QR codes in WordPress. Each QR points to a URL on your own site (`/qr/{slug}`) that records visits and redirects visitors to a final destination. Printed QR codes stay valid when you change the destination in the admin.

**Features**

* Custom post type `qr-code` with slug, destination URL, and optional UTM campaign per QR
* Public redirect URLs: `{home_url}/qr/{slug}?utm_...`
* Bridge page before redirect (default 1 second) so Google Analytics can load via `wp_head()`
* Manual fallback link: “Skip to …” if automatic redirect fails
* Internal visit tracking with date-range statistics (anonymous scan timestamps only)
* Global UTM defaults (`utm_source`, `utm_medium`, default campaign)
* `utm_content` is always set automatically to the QR slug
* SVG QR preview and download from the list screen and single QR edit screen
* Bulk SVG download as a ZIP file (`{slug}.svg` per code)
* WPML: `qr-code` is excluded from translation

**How redirects work**

Scanned URL example:

`https://example.com/qr/wikipedia?utm_source=qr&utm_medium=offline&utm_campaign=port_vendrell&utm_content=wikipedia`

1. Visitor hits `/qr/wikipedia`
2. A lightweight bridge page loads (HTTP 200) with analytics scripts
3. After the configured delay, the browser redirects to the destination URL
4. The visit is logged in the plugin database

Temporary client-side redirects are used instead of HTTP 301 so every scan hits your server and destination URLs can be updated without reprinting QR codes.

**Privacy**

When someone scans a published QR code, the plugin stores only the internal QR identifier and the scan timestamp. It does not store IP addresses, HTTP referrers, or plugin-specific cookies. Visit data is used for admin statistics only.

**Third-party libraries**

QR images are generated with bundled PHP libraries (MIT licensed):

* [chillerlan/php-qrcode](https://github.com/chillerlan/php-qrcode) (MIT)
* [chillerlan/php-settings-container](https://github.com/chillerlan/php-settings-container) (MIT)

The `vendor/` directory is included in the plugin package.

**Uninstall**

When the plugin is deleted (not merely deactivated), the visit statistics table and plugin options are removed. QR code posts (`qr-code`) are kept as regular WordPress content.

== Installation ==

1. Upload the `dms3-qr-manager` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **QR Manager → Settings** and configure global UTM parameters and redirect delay
4. Create QR codes under **QR Manager → All QR**
5. **Publish** each QR — draft codes return 404 on the public URL
6. If `/qr/{slug}` URLs do not work, visit **Settings → Permalinks** and click **Save Changes** to flush rewrite rules

**Composer dependency**

If you build from source, run `composer install --no-dev` inside the plugin folder to populate `vendor/`.

== Frequently Asked Questions ==

= Why is my QR URL returning 404? =

The QR must be **Published** (not draft). The slug in the admin must match the URL path. Flush permalinks under **Settings → Permalinks**.

= Can I change the destination without reprinting the QR? =

Yes. Update the destination URL in the admin. The public `/qr/{slug}` URL stays the same.

= Does Google Analytics track QR scans? =

The bridge page loads your theme/plugin analytics scripts before redirecting. For same-site destinations with “Forward UTM” enabled, UTM parameters are also appended to the final URL. Internal statistics are always recorded by the plugin regardless of GA.

= What data does the plugin collect? =

Each scan logs the QR post ID and timestamp. No IP address or HTTP referrer is stored. See **Settings → Privacy** in WordPress for the full policy text added by this plugin.

= Is the QR post type translatable with WPML? =

No. QR codes are language-independent by design.

= What happens when I uninstall the plugin? =

The statistics table and plugin settings are deleted. Your `qr-code` posts remain in WordPress unless you delete them manually.

= What PHP extensions are required? =

PHP 8.2+ and ZipArchive for bulk SVG download.

== Screenshots ==

1. QR list with thumbnail, public URL, and visit counts
2. QR edit screen with bridge preview and SVG download
3. Statistics page with date range filter
4. Global UTM and redirect settings

== Changelog ==

= 20260712.2127 =
* Bundled Catalan (ca_ES) and Spanish (es_ES) translation files in the plugin package

= 20260712.2112 =
* Internationalization: English source strings with bundled Catalan (ca_ES) and Spanish (es_ES) translations
* Added load_plugin_textdomain() for admin and frontend strings

= 20260710.1000 =
* WordPress.org review: unified class prefixes under Dms3_Qr_Manager_*
* Updated chillerlan/php-qrcode to 6.0.1; minimum PHP is now 8.2
* Removed non-essential vendor files from distribution package

= 20260707.1200 =
* Plugin Check compliance: literal i18n text domain, SVG escaping, WP_Filesystem for ZIP downloads
* Tested up to WordPress 7.0

= 20260707.1100 =
* WordPress.org compliance: GPL license file, ABSPATH guards, privacy policy integration
* Removed HTTP referrer from visit logging
* Clean uninstall (database table and options)
* Bridge page assets enqueued via WordPress APIs

= 20260607.1730 =
* Bridge redirect page with configurable delay (default 1 second)
* “Skip to …” manual fallback button
* Google Analytics support via `wp_head()` on bridge page
* Per-QR UTM campaign with global fallback; `utm_content` auto-set to slug
* SVG preview and download on list and edit screens
* Bulk SVG download as ZIP
* Visit statistics with date range filter
* WPML exclusion for `qr-code` post type

== Upgrade Notice ==

= 20260712.2127 =
Includes complete Catalan and Spanish language packs for the admin interface.

= 20260712.2112 =
Adds Catalan and Spanish translations. Admin UI now uses English as the default source language.

= 20260710.1000 =
WordPress.org review fixes: class prefix updates, chillerlan 6.0.1, PHP 8.2 required.

= 20260707.1200 =
Plugin Check and WordPress 7.0 compatibility updates.

= 20260707.1100 =
Privacy and uninstall improvements. Referrer data is no longer stored for new scans.

= 20260607.1730 =
Initial public release. Publish QR codes before sharing public URLs.
