=== Slide Crafter Reborn ===

Contributors: tlloancy
Donate link: https://donorbox.org/wordpress-plugins
Tags: slider, carousel, responsive, posts, dynamic
Requires at least: 6.3
Tested up to: 7.1
Stable tag: 2.1.0
Requires PHP: 7.4
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 20 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.
- **Export / import**: Download a slider as a zip (settings, cards, and its media-library images) and import it as a new slider on another site.

== 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 20 HTML cards (or use Posts / WooCommerce as the data source).

= How do I copy a slider to another site? =
Open the slider and click **Export**. On the other site, open **Slides** and use **Import a slider**. A new slider is created, with the images that this site accepts. SVG files are included in the zip; if the site blocks SVG uploads, those names are listed so you can replace them.

= 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 ==
= 2.1.0 =
* New: export a slider as a zip (settings, cards, and the media-library images used in the cards) from the slider screen or the slides list.
* New: import that zip from the slides list. A new slider is created. An image already in the library with the same bytes is reused. SVG is included; if this site refuses it, the file name is listed. Posts and products copy the settings only.

= 2.0.1 =
* Fix: the Slider block no longer collapses or overflows when placed inside a flex/grid parent (Group, Columns): its wrapper now has a definite, shrinkable width.
* Fix: Plugin Check findings (output escaping note, load_plugin_textdomain, tax_query, post__not_in).

= 2.0.0 =
October 2026 — major rework of the display engine and of the editor.
* Fix: fade, cube (and now flip / stacked cards) are pinned to one card at every breakpoint. Before, tablet breakpoints forced two cards per view, which made cards overlap.
* Fix: removed a stray `.swiper-slide { width: 300px }` rule on small screens.
* Responsive: breakpoints are measured on the slider's own width (container based), with separate cards-per-view for desktop, tablet and mobile.
* New effects: coverflow, flip, stacked cards. New looks: clean (default for new sliders), classic (kept for existing sliders), dark. Accent colour setting and CSS custom properties.
* Front-end: one shared script instead of an inline script per slider; styles moved to a stylesheet (no layout shift before the slider starts); Swiper updated to 11.2.10 (minified, MIT, source: https://github.com/nolimits4web/swiper).
* Accessibility: autoplay pause button, autoplay pauses on hover, on focus and when off-screen; keyboard arrows only act when the slider has focus; native buttons for arrows.
* Editor: live preview rendered by the real front-end renderer with a Desktop / Tablet / Mobile switch; card templates, media-library button, drag-and-drop and move up/down, duplicate / collapse cards, syntax-highlighted HTML and CSS editors, Ctrl/Cmd+S, unsaved-changes warning, up to 20 cards.
* Slides list: shortcode copy button, content and effect columns, Duplicate action.
* Block: server-side preview in the block editor, link to edit the slider.
* Security: capability checks on every AJAX endpoint; slides in draft or trash are never shown to visitors; no WooCommerce call when WooCommerce is inactive; escaped product names in the picker.
* Fix: rewrite rules were flushed on every request; sliders no longer register public URLs.
* Fix: backslashes in cards / CSS were lost on save; excerpts were cut in the middle of accented characters; `display:flex`, `transform`, `box-shadow` and other inline styles were stripped from cards; `:hover`, `,` and `>` were stripped from custom CSS selectors (custom CSS is now scoped per slider).
* Dynamic sources: up to 20 posts, several categories, optional "hide current page", excerpt toggle, custom button label, password-protected posts skipped.
* French translation included.
* Removed the "plugin is active" notice displayed on every admin page.

= 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:
