=== DWD Downloads ===
Contributors: dizwebdesign
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.5.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Downloads directory for WordPress: categories, files, mirrors, reviews, browse shortcodes, synced pages, and signed Hub REST tokens.

== Third-party reference ==

Functional parity targets legacy Dragonfly CMS Downloads Pro module patterns (categories, downloads, mirrors, screenshots, reviews, analytics-shaped stats tables). That upstream package historically shipped a separate license; this WordPress plugin is an independent GPLv2+ implementation and does not redistribute Dragonfly module PHP sources.

== Installation ==

1. Upload the `dwd-downloads` folder to `/wp-content/plugins/` or install the ZIP from Plugins → Add New → Upload.
2. Activate through the Plugins menu.
3. Under **DWD Plugins**, open **Downloads**, then use **Tools** on that dashboard if migrations need to be re-run; configure **Hub API** there before exposing REST consumers.

== Frequently Asked Questions ==

= tagDiv Composer (Newspaper / Newsmag) =

Add **`[dwdd_browse]`** or **`[dwdd_submit_form]`** with the Composer **External Shortcode** element (or any element that runs WordPress shortcodes). Public CSS loads automatically when those strings appear in the page body or in post meta (typical for Composer), on synced Downloads pages, or when the shortcode runs—override anytime with the **`dwdd_enqueue_front_assets`** filter.

= Does this delete data on uninstall? =

Only when `DWDD_DELETE_DATA_ON_UNINSTALL` is defined truthy in `wp-config.php` before uninstall runs.

= HTTPS for REST tokens? =

Signed download issuance requires HTTPS unless `WP_DEBUG` is enabled (local development relaxation).

== Changelog ==

= 1.5.5 =
* Multisite: network activation/deactivation runs per-site bootstrap; new sites get bootstrap when plugin is network-active; uninstall loops all blogs when data deletion is enabled.

= 1.4.9 =
* Plugin Check: remove phpcs.xml.dist from distribution (forbidden in plugin ZIP); suppress DirectDatabaseQuery on custom-table files; shorten readme description.

= 1.4.8 =
* Plugin Check: Dwdd_Request centralizes GET/POST/FILES for form handling.
* Security: all admin/front/pro form handlers route input through Dwdd_Request; wp_roles global override removed.

= 1.4.7 =
* Security: filter_input GET helpers for admin/front query args; %i SQL in Pro tables, storage, upgrades, and split migration.
* Plugin Check: PHP i18n translators comment; appearance color field escaping; load_plugin_textdomain note for private distribution.

= 1.4.6 =
* Security: centralized download/category DB queries using %i placeholders; escaped admin form output; validated upload moves via WP_Filesystem where applicable.
* Plugin Check: i18n translator comments; readme stable tag and tested-up-to aligned with header version.

= 1.4.4 =
* Browse: hierarchical categories — top level on root; subcategories and direct downloads on each category page.

= 1.4.1 =
* Fix PHP parse error in browse category query (mismatched SQL string quote).

= 1.4.0 =
* Admin: add/edit download opens in a modal; pending approval queue for user submissions and edits.
* Front-end: submit and edit own downloads (permission-controlled); new submissions and edits require admin approval before public listing.
* Permissions: submit_dwdd_downloads capability with role and user grants.

= 1.3.1 =
* Download items: optional icon image per download (upload or URL); shown on browse cards and detail page when icons are enabled.

= 1.3.0 =
* Front-end browse: WordPress Plugins–style card grid with pagination; admin Display settings for columns, per-page counts, colors, and borders.

= 1.2.6 =
* Front-end browse: hide categories that have no active downloads (including in subcategories). Use filter dwdd_show_empty_categories true to show all.

= 1.2.5 =
* Front-end admin: administration toolbar is built into Downloads pages (top of shortcode content), not a floating corner panel.

= 1.2.4 =
* Download items list: category column shows full path (Parent / Subcategory / …).

= 1.2.3 =
* Download items admin: titles link to the public download detail page on the synced Downloads browse page.

= 1.2.2 =
* Fix: deleting a download no longer lands on a blank admin-post page (registered missing delete handler).

= 1.2.1 =
* Download items: upload ZIP files; storage folders under wp-content/uploads/dwd-downloads/ mirror category/subcategory paths (created when categories are saved or on update/sync).

= 1.2.0 =
* Download items admin: current downloads table with activate/deactivate, clearer add/edit flow, and DB error feedback on save/toggle.
* Permissions settings (site admins): grant Downloads management by role, optional implicit grants for site administrators and hub parent capability, and explicit user IDs; front-end shortcut strip for managers.

= 1.1.6 =
* Front-end compatibility with **tagDiv Composer**: enqueue **`dwdd-front`** when downloads shortcodes appear in **post meta** (Composer layouts), literal **`post_content`**, synced plugin pages, or when shortcodes render (late enqueue fallback). Filters: **`dwdd_enqueue_front_assets`**, **`dwdd_enqueue_front_assets_fallback`**.

= 1.1.5 =
* Categories: **Edit** action opens the category form with existing title, description, and parent; invalid parent choices (self or a descendant) are ignored server-side.

= 1.1.4 =
* Categories: choose **parent category** by name (dropdown with hierarchy). Category list is tree-ordered with indentation and dash prefixes; parent column shows parent title. Download item category picker uses the same hierarchy.

= 1.1.3 =
* Tools / dashboard **Run update / sync**: show recorded vs uploaded plugin version and DB schema (Utilities-style). Pending work surfaces an **UPDATE** button; success redirect reports plugin and DB version transitions.

= 1.1.2 =
* Fix Categories / internal Downloads routes when nested under DWD Plugins: do not use `remove_submenu_page()` (WordPress then denies `admin.php?page=…` access). Hide extra submenu rows with CSS instead.

= 1.1.1 =
* Under **DWD Plugins**, hide routed Downloads screens from the sidebar fly-out (single **Downloads** row only; open Categories / Items / Tools / Mirrors / Reviews / Hub from the Downloads dashboard).
* Hub fly-out contrast fix for the Downloads submenu link when admin styles wash out link color.

= 1.1.0 =
* V1 split packaging: **DWD Downloads Base** (CPT `dwddb_dl` + importer) and **DWD Downloads Pro (split)** (`Requires Plugins: dwd-downloads-base`, `dwddp_*` tables keyed by `post_id`).
* Unified DB v4: optional one-time migration from split CPT + `dwddp_*` into `dwdd_*` (`Dwdd_Split_Migration`), plus admin notice when split plugins stay active beside unified.

= 1.0.3 =
* Run migrations when core tables are missing even if the DB version option is already current (fixes empty category lists after a partial install).
* Surface category save failures instead of always redirecting to success.

= 1.0.2 =
* Single visible menu entry for Downloads (under DWD Plugins when Hub is active, or one top-level menu otherwise). Categories, items, Tools, Mirrors, Reviews, and Hub API open from the dashboard only (hidden admin routes + back button).

= 1.0.1 =
* Register admin menus under the DWD Plugins hub (`dwd-plugins`) when DWD Plugins Hub is active; standalone top-level menu if not.

= 1.0.0 =
* Unified merged Core + Pro features into one plugin; schema migrations consolidated (dwdd_db_version 3).
* Hub REST dwdd/v1: ping, manifest, signed download-link route, serve-download redirect after verification.
