=== SmartFiles ===
Contributors: macas
Tags: downloads, files, file list, documents, secure downloads
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.3.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

File download lists with thumbnails, shortcode, and block. Pro adds secure storage, logs, and access controls.

== Description ==

Developed by [mc development](https://maca.se).

SmartFiles helps you publish **downloadable file lists** on your WordPress site. Organize files into lists, show them in a grid or list layout, and let visitors download files through WordPress-handled links.

This plugin is **free to use** on WordPress.org with a useful core feature set. **SmartFiles Pro** is an optional paid upgrade (license key from [mc development](https://maca.se/smartfiles/)) that unlocks advanced security, logging, and customization. Pro is not required to create lists, upload files, or display a list on the front end.

= Free version =

* Up to **2 file lists**
* Unlimited **files** with title, description, manual thumbnail, and download file (Media Library)
* **File type** label with icon on the front end
* Optional **More information** link per file
* **PDF** files: **View** (browser) and **Download** buttons
* **Drag-and-drop** upload for download files and thumbnails in admin
* **Grid** or **list** layout (default under **SmartFiles → Settings**)
* Shortcode: `[smartfiles list="your-list-slug"]`
* **SmartFiles List** Gutenberg block (single list)
* List display heading and intro text per list
* Built-in multilingual **user guide** in admin (eight languages)
* Admin and front-end translations: English, Swedish, Danish, Norwegian (Bokmål), Finnish, German, French, Spanish
* Small **Powered by SmartFiles** credit line on front-end lists (removable with Pro)

= SmartFiles Pro (optional) =

Purchase and activate a Pro license under **SmartFiles → Settings** to unlock:

* **Unlimited** file lists
* Show **all lists** on one page: `[smartfiles]` or `[smartfiles list="all"]` (shortcode and block)
* **Protected storage**: random paths under `uploads/smartfiles/`, blocked direct HTTP access where supported, delivery via tracked plugin links
* **Download log** in admin (date, file, visitor, IP, country when available, action)
* **Download counts** per file and per list in admin
* **Version number**, **Replace file**, and revision history per file
* **Access restrictions** by IP and/or country (optional hide lists from blocked visitors)
* **Visitor comments** per file with Google reCAPTCHA v2 or Cloudflare Turnstile
* **Link appearance**: custom colors, hover, font, size, underline, or theme default
* **Auto thumbnail** from image or video download files
* **Inline video player** option for video files
* **Configurable maximum upload size** in admin (within server PHP limits)
* Remove the front-end **Powered by** credit line

Pro license keys are validated against the developer license API on **maca.se** only when you activate, deactivate, or periodically check a key. No license call is made for sites using only the free version without a key.

= Privacy and external services =

**WordPress.org hosting (this plugin directory)**  
Only the plugin files you install from WordPress.org are distributed here. No account on maca.se is required for the free version.

**Pro license API (maca.se)** — *only if you enter a Pro license key*  
* **When:** Activate, deactivate, or periodic license check from wp-admin.  
* **What:** License key and your site URL (`home_url`).  
* **Why:** Verify Pro entitlement for this site.  
* **Terms:** [mc development](https://maca.se) — use the privacy policy published on that site for license purchases.

**Google reCAPTCHA v2** — *only if Pro comments are enabled and you choose reCAPTCHA*  
* **When:** A visitor submits a file comment.  
* **What:** CAPTCHA response token and related data per Google’s service.  
* **Why:** Spam protection. You must provide your own site and secret keys.  
* **Terms:** [Google Privacy Policy](https://policies.google.com/privacy) and [Google Terms of Service](https://policies.google.com/terms).

**Cloudflare Turnstile** — *only if Pro comments are enabled and you choose Turnstile*  
* **When:** A visitor submits a file comment.  
* **What:** Turnstile verification data per Cloudflare’s service.  
* **Why:** Spam protection. You must provide your own site and secret keys.  
* **Terms:** [Cloudflare Privacy Policy](https://www.cloudflare.com/privacypolicy/) and [Cloudflare Terms](https://www.cloudflare.com/website-terms/).

**Country detection for logs and access rules (Pro)**  
Country codes are read from common server headers (for example Cloudflare `CF-IPCONNECT`) when present. SmartFiles does not call a separate geo-IP API by default.

== Installation ==

1. Upload the `smartfiles` folder to `/wp-content/plugins/` or install via **Plugins → Add New**.
2. Activate the plugin through the **Plugins** menu.
3. Create lists under **SmartFiles → Lists** (up to 2 lists on the free version).
4. Add files under **SmartFiles → Add New**: title, description, thumbnail, download file, and assign at least one list.
5. Review **SmartFiles → Settings** (default layout; Pro options appear when a license is active).
6. Place `[smartfiles list="your-list-slug"]` on a page or use the **SmartFiles List** block.

For Pro comments, enable them under **SmartFiles → Settings**, configure CAPTCHA keys, and allow comments on each file.

== Frequently Asked Questions ==

= What is included in the free version? =

Up to two file lists, unlimited files, manual thumbnails, Media Library storage, grid/list layout, single-list shortcode and block, PDF view/download buttons, drag-and-drop admin upload, and the built-in guide. Advanced security, logging, comments, and styling require Pro.

= How do I upgrade to Pro? =

Visit [mc development](https://maca.se/smartfiles/) to purchase a license, then enter the key under **SmartFiles → Settings**. Pro features unlock after successful activation.

= How do I show a list on a page? =

Use `[smartfiles list="brochures"]` where `brochures` is your list slug, or add the **SmartFiles List** block. To show **every list** on one page, use `[smartfiles]` or `list="all"` — **Pro only**.

= Can a file belong to multiple lists? =

Yes. Assign multiple lists when editing a file.

= How do I change the layout? =

Add `layout="list"` or `layout="grid"` to the shortcode, or choose layout in the block. The default is under **SmartFiles → Settings**.

= How do I upload or replace a download file? =

Edit a file under **SmartFiles → Files**. Use **Select file** or **Replace file**, or drag and drop onto the download zone. **Replace file** with version history is a **Pro** feature.

= What is protected file storage? =

**Pro only.** When enabled under **SmartFiles → Settings**, download files are stored under `uploads/smartfiles/` with random folder and file names. Direct URLs are blocked where supported; visitors receive files through SmartFiles tracked links. Thumbnails stay in the Media Library.

= How does the download log work? =

**Pro only.** Each tracked view or download is listed under **SmartFiles → Download log** with date, file, visitor, IP, country (when available), and action. Filter by file or open the log from a file’s edit screen.

= How do I block downloads by country or IP? =

**Pro only.** Under **SmartFiles → Settings → Access restrictions**, enable blocking and enter IPs and/or country codes (for example `CN`, or `EU` for EU member states). Administrators are never blocked.

= How do file comments work? =

**Pro only.** Enable **File comments** under **SmartFiles → Settings**, choose reCAPTCHA or Turnstile, and save your keys. On each file, enable **Allow visitor comments**. Visitors use a **Comments (n)** button with an inline panel.

= How do I style download and information links? =

**Pro only.** Under **SmartFiles → Settings → Link appearance**, choose custom colors, hover, font, size, and underline, or **Theme default**.

= Are thumbnails created automatically? =

**Pro only**, when **Auto thumbnail** is enabled under **SmartFiles → Settings**. The free version supports manual thumbnails per file.

= How do PDF files behave on the front end? =

PDF downloads show **View** and **Download** buttons. Other file types show a single download button unless customized.

= Does the free version phone home? =

No. Remote requests to maca.se occur only when you activate or check a **Pro license key**. CAPTCHA providers are loaded only when Pro comments are enabled and configured.

== Screenshots ==

1. File list on the front end (list layout)
2. Edit file screen in wp-admin (drag-and-drop upload)
3. SmartFiles settings (layout; Pro options when licensed)
4. Download log in admin (Pro)
5. SmartFiles guide page

== Changelog ==

= 1.3.3 =
* Plugin header: distinct Plugin URI (product page) and Author URI (developer site) for WordPress.org

= 1.3.2 =
* Plugin Check: remove proc_open, fix CAPTCHA script versions, shorter readme description, WP_Filesystem for debug log

= 1.3.1 =
* WordPress.org Plugin Check: readme tested up to 7.0, custom updater excluded from distribution zip, i18n and script enqueue fixes

= 1.3.0 =
* Lists: custom SmartFiles admin page for creating lists (avoids WordPress edit-tags.php POST issues on some hosts); edit-tags overview redirects here

= 1.2.0 =
* Fix: earlier output buffering for list create; flush buffer on core redirect; admin “site check” URL to compare hosts

= 1.1.9 =
* Fix: output buffering on list create so PHP notices do not break the admin redirect (headers already sent)

= 1.1.8 =
* Fix: list add handler no longer depends on `$pagenow` (fixes blank screen on some hosts); defers license HTTP check during list POST; optional `smartfiles-list-add.log` when `WP_DEBUG` is on

= 1.1.7 =
* Fix: creating a list in admin (handles add-tag before HTML output; clean wp_insert_term args, no full $_POST)

= 1.1.6 =
* Fix: creating a list in admin no longer shows a blank page (uses WordPress default add-tag flow)

= 1.1.5 =
* Drag-and-drop upload for download files and thumbnails in admin
* File type label with icon shown under file description on the front end
* Configurable maximum upload size (Pro; can exceed WordPress default when PHP allows)
* IP and country/region access blacklist with optional hidden file lists (Pro)
* Admin download log (Pro)
* Protected storage: randomized paths under uploads/smartfiles/ (Pro)
* User guide updated in all eight languages
* Readme: clarify Free vs Pro, privacy, and external services for WordPress.org

= 1.1.0 =
* Auto thumbnails from image and video download files (Pro)
* Visitor comments on files with reCAPTCHA v2 or Cloudflare Turnstile (Pro)
* Single **Comments (n)** button with inline panel and **Close** control (Pro)
* Version numbers, **Replace file**, and download revision log (Pro)
* Download tracking visible in admin (Pro)
* List layout: thumbnail, content, and actions in one row; grid layout improvements
* Optional list display heading and intro text
* Shortcode/block: show all lists grouped — Pro (`[smartfiles]` or `list="all"`)
* **Link appearance** settings (Pro)
* Full-width / block theme wrapper classes
* Admin user guide in eight languages (profile language)
* Front-end and admin translations: Swedish, Danish, Norwegian, Finnish, German, French, Spanish
* Powered-by footer credit on file list output (removable with Pro)

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.3.3 =
Header URIs fixed for WordPress.org plugin review.

= 1.3.2 =
Further Plugin Check fixes (FFmpeg, CAPTCHA enqueue, readme length).

= 1.3.1 =
Compatibility and Plugin Check fixes for WordPress.org submission.

= 1.3.0 =
Lists screen uses a dedicated admin page for adding lists (same pattern as Settings).

= 1.2.0 =
Further fix for list-create redirect issues; site check tool for comparing installations.

= 1.1.9 =
Fix for “headers already sent” when creating a list in admin on some hosts.

= 1.1.8 =
Fix for blank admin screen when adding a list on some server configurations.

= 1.1.7 =
Fix for blank admin screen when adding a new list.

= 1.1.6 =
Fix for blank admin screen when adding a new list.

= 1.1.5 =
Readme updated for WordPress.org (Free vs Pro). Pro adds download log, protected storage, access rules, and related features.

= 1.1.0 =
Comments, CAPTCHA, auto thumbnails, download tracking, link appearance settings, and expanded translations (mostly Pro).

= 1.0.0 =
Initial release.
