=== Slide Crafter Reborn ===

Contributors: tlloancy
Donate link: https://donorbox.org/wordpress-plugins
Tags: slider, carousel, responsive, posts, dynamic
Requires at least: 5.0
Tested up to: 7.1
Stable tag: 1.7.0
Requires PHP: 7.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Create responsive sliders with a custom post type, shortcode, or Gutenberg block.

== Description ==
**Slide Crafter Reborn** lets you create and manage responsive sliders as a custom post type. Features include:
- **WordPress Posts Source**: Pull any public post type (posts, pages, custom types) into a fully dynamic slider — content updates automatically as you publish. Filter by category, choose ordering, and set the post count. No HTML required.
- **Parametric Customization**: Configure slides per view, spacing, loop, pagination, navigation, autoplay, speed, animation type, and custom CSS.
- **Responsive Sliders**: Powered by Swiper, ensuring compatibility across devices.
- **Dynamic Cards**: Add up to 10 cards with a user-friendly repeater interface.
- **WooCommerce Integration**: Automatically pull featured products into a slider.
- **Shortcode and block**: `[slidecrafterreborn_slide id="X"]` still works. From 1.7.0 you can also insert the **Slide Crafter** Gutenberg block and pick a slider.
- **Accessibility**: Keyboard navigation, labelled controls, and autoplay that pauses when the visitor prefers reduced motion.
- **Lazy-loaded images**: Off-screen slide images use `loading="lazy"` so the first visible slides load first.

== Installation ==
1. Upload the `slide-crafter-reborn` folder to `/wp-content/plugins/`.
2. Activate the plugin via the WordPress 'Plugins' page.
3. Create sliders under the "Slides" menu in the WordPress admin.

== Frequently Asked Questions ==
= How do I customize sliders? =
Open a slide under **Slides**. The settings sidebar controls slides per view, spacing, loop, pagination, navigation, autoplay, speed, and animation. Add up to 10 HTML cards (or use Posts / WooCommerce as the data source).

= How do I put a slider on a page? =
Use `[slidecrafterreborn_slide id="123"]` (the ID is shown in the Slides list and in the editor) or add the **Slide Crafter** block and choose that slide.

= Why did autoplay stop? =
If the operating system or browser has **prefers-reduced-motion** enabled, autoplay is disabled so the slider does not move on its own. Arrows, pagination, and keyboard still work.

= Do all slide images load at once? =
Images in the first visible slides (based on “slides per view”) load eagerly. Images further along the carousel use `loading="lazy"`. The Swiper library itself is unchanged.

= Is it secure? =
Card HTML is passed through `wp_kses_post`. Custom CSS is restricted to a property allow-list.

== Changelog ==
= 1.7.0 =
August 25, 2026:
* Compat: Tested up to WordPress 7.1.
* Performance: `loading="lazy"` (and `decoding="async"`) on slide images; the first visible slides stay eager so the carousel does not wait on every image.
* Accessibility: `prefers-reduced-motion` turns autoplay off; Swiper keyboard control; region/carousel ARIA and labelled prev/next.
* Editor: Gutenberg block `slide-crafter-reborn/slider` (`block.json`, dynamic render). The shortcode is unchanged.
* Design: Slide editor uses native WordPress admin controls (notices, `.button`, no purple/gold glow on admin chrome).
* Docs: `docs/USER-GUIDE.md` (English) and `docs/MODE-DEMPLOI.md` (French).
* The bundled Swiper build is not replaced or refactored.

= 1.6.0 =
June 2026:
* New Feature: **AI Card Generation**. When the WordPress "AI" plugin is active with a configured connector (OpenAI, Anthropic, or Google AI), a new panel appears above the card editor letting you describe your slider in plain language and generate all cards in one click.
* The panel gracefully falls back to a setup guide (with a direct link to install the AI plugin) when no AI connector is configured.
* Generated cards are sanitized through the same wp_kses pipeline as manually entered cards.

= 1.5.0 =
May 26, 2026 — WordPress 7.0 release:
* New Feature: **WordPress Posts as a dynamic source**. Any public post type (posts, pages, custom post types) can now feed a slider automatically. Configure post type, number of posts, ordering (date, title, random, recently modified), and optionally filter by category. The slider updates itself as you publish — zero HTML required.
* The Data Source selector now includes "WordPress Posts (dynamic)" alongside Manual and WooCommerce modes.
* Admin: new settings panel for post source (post type, count, order, category) with live preview that refreshes as you change options.
* Fix: Removed the redundant "Slide Title" sidebar field. The native WordPress title field is now the single source of truth; the AJAX save reads from it directly.
* Fix: Leaving the edit page after a successful AJAX save no longer triggers the "changes may not be saved" browser alert.
* Tags updated to reflect the new dynamic posts capability.
* Tested up to: WordPress 7.0.

= 1.4.4 =
April 29, 2026:
* Fix: Corrected AJAX product search filtering. The search term is now properly captured using $_REQUEST, ensuring results match the user's input (e.g., searching for "honey" no longer returns "carrots").
* Improvement: JavaScript Localization. Placeholders and messages are now dynamically handled via wp_localize_script for full translation support.

= 1.4.3 =
April 26:
* Fix: Woo Features on preview and shortcode are now correctly synchronized.

= 1.4.2 =
* Fix: Replaced obsolete copy clipboard API that is not compatible with Brave Browser

= 1.4.1 =
* New: Added a copy button to easily copy the shortcode

= 1.4.0 =
* New Feature: Added "Import WooCommerce Product" in Manual Mode. You can now fetch any product to generate a rich HTML card (title, image, price, and link) that remains fully editable.
* Fixed: Resolved rendering glitches and layout breaks when switching between transition effects (Fade, Cube, Slide) in the real-time preview.
* Improvement: Cleaned up the product HTML template to ensure consistent image sizing and proper link wrapping.

= 1.3.0 =
* New Feature: Added WooCommerce integration. You can now pull "Featured Products" automatically.
* New Feature: Real-time preview switching between manual HTML cards and dynamic products.
* Improvement: Deep refactor of the admin JS to handle Swiper instance destruction and reconstruction for a smoother UI.
* Fixed: Corrected CSS layout issues when switching slider sources without page refresh.

= 1.2.0 =
* Major architecture update: Migrated data storage from wp_options to wp_postmeta for better performance and scalability.

= 1.1.1 =
* Fixed a regression in shortcode result display.

= 1.1.0 =
* Improved code display.
* Simplify code especially for css encapsulation purposes.

= 1.0.5 =
* Removed or commented `wp_cache_flush()` in `includes/cpt.php` to prevent interference with WordPress cron tasks, improving reliability of scheduled tasks.

= 1.0.4 =
* Fixed debug log pollution by restricting logging to ERROR level by default, downgrading non-critical logs to DEBUG.

= 1.0.3 =
* Fixed fatal error caused by duplicate `slidecrafterreborn_unescape_html` function definition by removing it from `meta-boxes.php`.

= 1.0.2 =
* Fixed excessive escaping of special characters in card content, ensuring proper display (e.g., `d'affinage` instead of `d\'affinage`).
* Optimized debug logging to reduce log pollution by making logs conditional on WP_DEBUG and introducing log levels.
* Added cleanup for unnecessary HTML tags (<br>, empty <p>) in card content.
* Added database cleanup script to fix existing escaped content on plugin activation.

= 1.0.1 =
* Fixed shortcode is displayed properly as in the preview.

= 1.0.0 =
* Initial release with parametric slider creation and Swiper integration.
* Fixed missing form elements error in admin.js.
* Corrected CPT mismatch from scrslide to scr_slide.
* Ensured continuous preview looping with Swiper.
* Polished UI with gold accents and smooth transitions.
* Optimized save system using wp_options.

== Source Code ==
Non-minified source code is available at: https://github.com/tlloancy/slide-crafter-reborn
To build the plugin:
