=== STL3D_Gallery ===
Contributors: f4awz
Author: Emmanuel TANGUY F4AWZ
Author URI: https://maforge49.freeboxos.fr
Tags: stl, 3d, viewer, gallery, thumbnails
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A fully offline STL model library with thumbnails, interactive 3D viewing, search, filtering, and downloads.

== Description ==

STL3D_Gallery adds an STL file library to your WordPress site:

* 6 orthographic views and 4 isometric views generated automatically for each model;
* interactive 3D viewer with rotation, zoom, pan, quick views, and fullscreen mode;
* model search and filtering;
* PNG thumbnail and STL file downloads.

**For administrators** (the “STL Library” menu):

* bulk upload of `.stl` files and `.txt` descriptions;
* organization of models in a folder hierarchy;
* creation and editing of descriptions;
* file and folder deletion;
* STL validation and on-demand preview generation.

**For visitors** (the `[stl3d-gallery]` shortcode):

* read-only library browsing;
* no ability to add, modify, or delete library content.

== Installation ==

1. Upload the `stl3d-gallery` folder to `/wp-content/plugins/`.
2. Activate the plugin from the WordPress “Plugins” menu.
3. Open the “STL Library” menu to upload your first models.
4. Insert the `[stl3d-gallery]` shortcode into a page or post to display the library to visitors.

== Frequently Asked Questions ==

= Where are the files stored? =

In `wp-content/uploads/stl-library/`. The directory is protected against directory listing and script execution with an empty `index.php` file and `.htaccess` rules (`Options -Indexes` and blocking executable extensions).

**Important for Nginx servers:** `.htaccess` rules are interpreted only by Apache. On Nginx, this file is ignored and provides no additional protection. The plugin still accepts only `.stl` and `.txt` uploads and validates STL content, but if you use Nginx, it is recommended to add an equivalent server rule, for example:

`location ~* /wp-content/uploads/stl-library/.*\.(php|phtml|php[0-9]?|phar)$ { deny all; }`

= Is uploaded file content validated, or only the extension? =

Both. In addition to the extension allowlist (`.stl`, `.txt`), the plugin verifies that each STL file has valid STL content (ASCII starting with `solid` and containing `endsolid`, or a binary STL structure with a matching triangle count). Files with an invalid STL structure are rejected.

= Can visitors upload files? =

No. Only users with the `manage_options` capability (administrators by default, filterable through `stl_lib_capability`) can manage the library.

= Which browser is recommended for the 3D viewer? =

A recent browser with WebGL and ES module support, such as recent versions of Chrome, Edge, Firefox, or Safari.

= Does the plugin load external resources? =

No. Three.js (r180, MIT license) is bundled in `assets/js/vendor/three/` and served locally by WordPress. No request is made to a third-party CDN, so the site can operate on an intranet or fully offline.

== Changelog ==

= 1.2.6 =
* Correction de l’enregistrement du shortcode : `[stl3d-gallery]` est maintenant le shortcode actif.

= 1.2.5 =
* Moved the STL download button to the right of the 3D viewer button without changing plugin functionality.

= 1.2.2 =
* Security: replaced direct filesystem operations with the WordPress Filesystem API.
* Security: added input sanitization and explicit nonce verification handling for AJAX requests.
* Compatibility: removed the deprecated `load_plugin_textdomain()` call for WordPress.org-hosted translations.
* Documentation: converted the readme to standard English and shortened the short description to the WordPress.org limit.

= 1.2.1 =
* Fix: corrected the “Visit plugin site” link on the WordPress Plugins screen.
* Improvement: reserve space after the last model when a 3D viewer is open, preventing the last viewer from being clipped at the bottom of the page.

= 1.2.0 =
* Security: validate the actual content and structure of uploaded `.stl` files in addition to checking their extension.
* Security: resolve the required capability (`stl_lib_capability`) on the `plugins_loaded` hook so other plugins can reliably filter it.
* Documentation: clarify `.htaccess` protection (Apache only) and provide guidance for Nginx servers.
* Compatibility: tested up to WordPress 7.1.

= 1.1.0 =
* Three.js is now bundled locally with the plugin, removing the external CDN dependency.

= 1.0.0 =
* Initial release.

== Third-party libraries included ==

* Three.js 0.180.0 (MIT license) — https://threejs.org/ — see `assets/js/vendor/three/LICENSE`.
