Plugin Directory

Changeset 3413265


Ignore:
Timestamp:
12/06/2025 10:17:47 PM (2 months ago)
Author:
tlloancy
Message:

no regressions here

Location:
slide-crafter-reborn
Files:
3 edited
8 copied

Legend:

Unmodified
Added
Removed
  • slide-crafter-reborn/tags/1.1.1/includes/shortcodes.php

    r3413240 r3413265  
    55    $atts = shortcode_atts(['id' => ''], $atts, 'slidecrafterreborn_slide');
    66    $post_id = absint($atts['id']);
    7 
    87    if (!$post_id || get_post_type($post_id) !== 'slcr_reborn_slide') {
     8        error_log('Slide Crafter Reborn: Invalid or missing slide ID: ' . $post_id);
    99        return '<p>' . esc_html__('Invalid or missing slide ID.', 'slide-crafter-reborn') . '</p>';
    1010    }
    1111
    1212    $slide_data = get_option('slidecrafterreborn_slide_' . $post_id);
    13     if (!$slide_data) return '<p>' . esc_html__('Slide not found.', 'slide-crafter-reborn') . '</p>';
     13    if (!$slide_data) {
     14        error_log('Slide Crafter Reborn: Slide not found for ID: ' . $post_id);
     15        return '<p>' . esc_html__('Slide not found.', 'slide-crafter-reborn') . '</p>';
     16    }
    1417
    1518    $slide = json_decode($slide_data, true);
    16     if (!$slide || empty($slide['cards'])) return '<p>' . esc_html__('No cards defined for this slide.', 'slide-crafter-reborn') . '</p>';
     19    if (!$slide || !isset($slide['cards']) || empty($slide['cards'])) {
     20        error_log('Slide Crafter Reborn: No cards defined for slide ID ' . $post_id);
     21        return '<p>' . esc_html__('No cards defined for this slide.', 'slide-crafter-reborn') . '</p>';
     22    }
    1723
    1824    $settings = $slide['settings'] ?? [];
    19     $cards    = $slide['cards'];
    20 
    21     $slides_per_view = ($settings['animation_type'] ?? 'slide') === 'cube' ? 1 : ($settings['slides_per_view'] ?? 3);
    22     if (count($cards) < $slides_per_view) $slides_per_view = count($cards);
    23 
     25    $cards = $slide['cards'];
     26    $slides_per_view = $settings['animation_type'] === 'cube' ? 1 : ($settings['slides_per_view'] ?? 3);
     27    if (count($cards) < $slides_per_view) {
     28        $slides_per_view = count($cards);
     29    }
    2430    $unique_id = 'swiper-' . wp_generate_uuid4();
    2531
    2632    wp_enqueue_style('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../css/swiper-bundle.css', [], '8.4.7');
    27     wp_enqueue_script('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../js/swiper-bundle.js', [], '8.4.ConcurrentLinkedDeque4.7', true);
     33    wp_enqueue_script('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../js/swiper-bundle.js', [], '8.4.7', true);
    2834
    29     // CORRECTION CSS : appliqué au conteneur
    30     $custom_css = '';
    3135    if (!empty($settings['custom_css'])) {
    32         $css = str_replace(
    33             ['body ', 'html ', 'body>', 'html>'],
    34             ['#' . $unique_id . ' ', '#' . $unique_id . ' ', '#' . $unique_id . '>', '#' . $unique_id . '>'],
    35             $settings['custom_css']
    36         );
    37         $css = preg_replace('/^\s*body\s*\{.*?\}\s*/is', '', $css);
    38         $sanitized = slidecrafterreborn_sanitize_css($css);
    39         if ($sanitized) $custom_css = "<style>#{$unique_id} { {$sanitized} }</style>";
     36        $sanitized_css = slidecrafterreborn_sanitize_css($settings['custom_css']);
     37        if (!empty($sanitized_css)) {
     38            $custom_css_style = "<style>#$unique_id .swiper-slide { $sanitized_css }</style>";
     39        } else {
     40            $custom_css_style = '';
     41        }
     42    } else {
     43        $custom_css_style = '';
    4044    }
     45
     46    error_log('Slide Crafter Reborn: Rendering slide ID ' . $post_id . ', cards count: ' . count($cards) . ', settings: ' . json_encode($settings));
    4147
    4248    ob_start();
    4349    ?>
    44     <div class="swiper slidecrafterreborn-slider slidecrafterreborn-slider-<?php echo esc_attr($post_id); ?>"
    45          id="<?php echo esc_attr($unique_id); ?>"
    46          data-swiper-initialized="false">
    47 
    48         <div class="swiper-wrapper">
    49             <?php foreach ($cards as $index => $card) : ?>
    50                 <div class="swiper-slide"
    51                      style="display:flex;justify-content:center;align-items:center;">
    52                     <?php echo wp_kses_post(slidecrafterreborn_unescape_html($card)); ?>
    53                 </div>
     50    <div class="swiper slidecrafterreborn-slider slidecrafterreborn-slider-<?php echo esc_attr($post_id); ?>" id="<?php echo esc_attr($unique_id); ?>" data-swiper-initialized="false">
     51        <div class="swiper-wrapper" style="display:flex;" id="swiper-wrapper-<?php echo esc_attr(wp_generate_uuid4()); ?>" aria-live="off">
     52            <?php foreach ($cards as $index => $card): ?>
     53                <div class="swiper-slide" style="display:flex;justify-content:center;" role="group" aria-label="<?php echo esc_attr(($index + 1) . ' / ' . count($cards)); ?>" data-swiper-slide-index="<?php echo esc_attr($index); ?>"><?php echo wp_kses_post($card); ?></div>
    5454            <?php endforeach; ?>
    5555        </div>
    56 
    57         <?php if (!empty($settings['pagination'])) : ?>
    58             <div class="swiper-pagination slidecrafterreborn-pagination active-bullet-gold"></div>
    59         <?php endif; ?>
    60 
    61         <?php if (!empty($settings['navigation'])) : ?>
    62             <div class="swiper-button-prev"></div>
    63             <div class="swiper-button-next"></div>
    64         <?php endif; ?>
     56        <div class="swiper-pagination slidecrafterreborn-pagination active-bullet-gold" style="display:<?php echo esc_attr(($settings['pagination'] ?? true) ? 'block' : 'none'); ?>;margin-top:10px;"></div>
     57        <div class="swiper-button-prev" style="display:<?php echo esc_attr(($settings['navigation'] ?? false) ? 'block' : 'none'); ?>;"></div>
     58        <div class="swiper-button-next" style="display:<?php echo esc_attr(($settings['navigation'] ?? false) ? 'block' : 'none'); ?>;"></div>
    6559    </div>
    66 
    67     <?php echo $custom_css; ?>
    68 
     60    <?php echo $custom_css_style; ?>
    6961    <style>
    7062        #<?php echo esc_attr($unique_id); ?>.slidecrafterreborn-slider {
    71             padding:20px;
    72             background:#fafafa;
    73             border-radius:8px;
    74             box-shadow:0 2px 4px rgba(0,0,0,0.1);
    75             overflow:hidden;
     63            padding:20px;background:#fafafa;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,0.1);
    7664        }
    77         #<?php echo esc_attr($unique_id); ?> .swiper-pagination-bullet-active { background:gold; }
     65        #<?php echo esc_attr($unique_id); ?> .swiper-pagination-bullet-active {
     66            background:gold;
     67        }
     68        #<?php echo esc_attr($unique_id); ?> .swiper-slide {
     69            width:405px;text-align:center;display:flex;justify-content:center;align-items:center;
     70        }
     71        #<?php echo esc_attr($unique_id); ?> .swiper-wrapper {
     72            display:flex;
     73        }
    7874        #<?php echo esc_attr($unique_id); ?> .swiper-button-prev,
    7975        #<?php echo esc_attr($unique_id); ?> .swiper-button-next {
    80             color:gold;
    81             background:rgba(0,0,0,0.5);
    82             border-radius:50%;
    83             width:40px;
    84             height:40px;
     76            color:gold;background:rgba(0,0,0,0.5);border-radius:50%;width:40px;height:40px;opacity:1;transition:opacity 0.3s;z-index:10;
     77        }
     78        #<?php echo esc_attr($unique_id); ?> .swiper-button-prev:hover,
     79        #<?php echo esc_attr($unique_id); ?> .swiper-button-next:hover {
     80            opacity:0.8;
     81        }
     82        @media (max-width:768px) {
     83            #<?php echo esc_attr($unique_id); ?> .swiper-slide {
     84                width:300px;
     85            }
    8586        }
    8687    </style>
    87 
    88     <!-- LE SCRIPT MANQUANT — C’EST LUI QUI FAIT TOUT DÉFILER -->
    8988    <script>
    90     document.addEventListener('DOMContentLoaded', function () {
    91         const container = document.getElementById('<?php echo esc_js($unique_id); ?>');
    92         if (!container || container.getAttribute('data-swiper-initialized') === 'true') return;
    93 
    94         container.setAttribute('data-swiper-initialized', 'true');
    95 
    96         if (typeof Swiper === 'undefined') {
    97             console.error('Swiper non chargé');
    98             return;
    99         }
    100 
    101         new Swiper('#<?php echo esc_js($unique_id); ?>', {
    102             slidesPerView: <?php echo esc_js($slides_per_view); ?>,
    103             spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?>,
    104             loop: <?php echo (!empty($settings['loop'])) ? 'true' : 'false'; ?>,
    105             autoplay: <?php echo (!empty($settings['autoplay'])) ? '{ delay: ' . esc_js($settings['transition_speed'] ?? 3000) . ' }' : 'false'; ?>,
    106             pagination: <?php echo (!empty($settings['pagination'])) ? "{ el: '#" . esc_js($unique_id) . " .swiper-pagination', clickable: true }" : 'false'; ?>,
    107             navigation: <?php echo (!empty($settings['navigation'])) ? "{ nextEl: '#" . esc_js($unique_id) . " .swiper-button-next', prevEl: '#" . esc_js($unique_id) . " .swiper-button-prev' }" : 'false'; ?>,
    108             effect: '<?php echo esc_js($settings['animation_type'] ?? 'slide'); ?>',
    109             breakpoints: {
    110                 480: { slidesPerView: 1, spaceBetween: 10 },
    111                 768: { slidesPerView: 2, spaceBetween: 15 },
    112                 1024: { slidesPerView: <?php echo esc_js($slides_per_view); ?>, spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?> }
     89        document.addEventListener('DOMContentLoaded', function() {
     90            function initSwiper() {
     91                var swiperContainer = document.getElementById('<?php echo esc_js($unique_id); ?>');
     92                if (swiperContainer && swiperContainer.getAttribute('data-swiper-initialized') === 'false') {
     93                    swiperContainer.setAttribute('data-swiper-initialized', 'true');
     94                }
     95                if (typeof Swiper === 'undefined') {
     96                    console.error('Swiper is not loaded for frontend, retrying...');
     97                    setTimeout(initSwiper, 100);
     98                    return;
     99                }
     100                new Swiper('#<?php echo esc_js($unique_id); ?>', {
     101                    slidesPerView: <?php echo esc_js($slides_per_view); ?>,
     102                    slidesPerGroup: 1,
     103                    spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?>,
     104                    loop: <?php echo ($settings['loop'] ?? true) ? 'true' : 'false'; ?>,
     105                    loopAdditionalSlides: 1,
     106                    initialSlide: 0,
     107                    watchOverflow: true,
     108                    watchSlidesProgress: true,
     109                    preventClicks: false,
     110                    updateOnWindowResize: true,
     111                    observer: true,
     112                    observeParents: true,
     113                    effect: '<?php echo esc_js($settings['animation_type'] ?? 'slide'); ?>',
     114                    pagination: <?php echo ($settings['pagination'] ?? true) ? "{ el: '#" . esc_js($unique_id) . " .slidecrafterreborn-pagination', clickable: true }" : 'false'; ?>,
     115                    navigation: <?php echo ($settings['navigation'] ?? false) ? "{ nextEl: '#" . esc_js($unique_id) . " .swiper-button-next', prevEl: '#" . esc_js($unique_id) . " .swiper-button-prev' }" : 'false'; ?>,
     116                    autoplay: <?php echo ($settings['autoplay'] ?? true) ? "{ delay: " . esc_js($settings['transition_speed'] ?? 3000) . ", disableOnInteraction: false, pauseOnMouseEnter: false }" : 'false'; ?>,
     117                    cubeEffect: { shadow: false, slideShadows: false },
     118                    fadeEffect: { crossFade: true },
     119                    breakpoints: {
     120                        480: { slidesPerView: 1, spaceBetween: 10 },
     121                        768: { slidesPerView: 2, spaceBetween: 15 },
     122                        1024: { slidesPerView: <?php echo esc_js($slides_per_view); ?>, spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?> }
     123                    }
     124                });
    113125            }
     126            initSwiper();
    114127        });
    115     });
    116128    </script>
    117129    <?php
  • slide-crafter-reborn/tags/1.1.1/readme.txt

    r3413240 r3413265  
    55Requires at least: 5.0
    66Tested up to: 6.9
    7 Stable tag: 1.1.0
     7Stable tag: 1.1.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    3333
    3434== Changelog ==
     35= 1.1.1 =
     36* Fixed a regression in shortcode result display.
     37
    3538= 1.1.0 =
    3639* Improved code display.
  • slide-crafter-reborn/tags/1.1.1/slide-crafter-reborn.php

    r3413240 r3413265  
    44 * Plugin URI: https://github.com/tlloancy/slide-crafter-reborn
    55 * Description: Create responsive slider carousels with dynamic cards, real-time preview, and shortcode output.
    6  * Version: 1.1.0
     6 * Version: 1.1.1
    77 * Author: Thomas Lloancy
    88 * Author URI: https://github.com/tlloancy
  • slide-crafter-reborn/trunk/includes/shortcodes.php

    r3413240 r3413265  
    55    $atts = shortcode_atts(['id' => ''], $atts, 'slidecrafterreborn_slide');
    66    $post_id = absint($atts['id']);
    7 
    87    if (!$post_id || get_post_type($post_id) !== 'slcr_reborn_slide') {
     8        error_log('Slide Crafter Reborn: Invalid or missing slide ID: ' . $post_id);
    99        return '<p>' . esc_html__('Invalid or missing slide ID.', 'slide-crafter-reborn') . '</p>';
    1010    }
    1111
    1212    $slide_data = get_option('slidecrafterreborn_slide_' . $post_id);
    13     if (!$slide_data) return '<p>' . esc_html__('Slide not found.', 'slide-crafter-reborn') . '</p>';
     13    if (!$slide_data) {
     14        error_log('Slide Crafter Reborn: Slide not found for ID: ' . $post_id);
     15        return '<p>' . esc_html__('Slide not found.', 'slide-crafter-reborn') . '</p>';
     16    }
    1417
    1518    $slide = json_decode($slide_data, true);
    16     if (!$slide || empty($slide['cards'])) return '<p>' . esc_html__('No cards defined for this slide.', 'slide-crafter-reborn') . '</p>';
     19    if (!$slide || !isset($slide['cards']) || empty($slide['cards'])) {
     20        error_log('Slide Crafter Reborn: No cards defined for slide ID ' . $post_id);
     21        return '<p>' . esc_html__('No cards defined for this slide.', 'slide-crafter-reborn') . '</p>';
     22    }
    1723
    1824    $settings = $slide['settings'] ?? [];
    19     $cards    = $slide['cards'];
    20 
    21     $slides_per_view = ($settings['animation_type'] ?? 'slide') === 'cube' ? 1 : ($settings['slides_per_view'] ?? 3);
    22     if (count($cards) < $slides_per_view) $slides_per_view = count($cards);
    23 
     25    $cards = $slide['cards'];
     26    $slides_per_view = $settings['animation_type'] === 'cube' ? 1 : ($settings['slides_per_view'] ?? 3);
     27    if (count($cards) < $slides_per_view) {
     28        $slides_per_view = count($cards);
     29    }
    2430    $unique_id = 'swiper-' . wp_generate_uuid4();
    2531
    2632    wp_enqueue_style('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../css/swiper-bundle.css', [], '8.4.7');
    27     wp_enqueue_script('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../js/swiper-bundle.js', [], '8.4.ConcurrentLinkedDeque4.7', true);
     33    wp_enqueue_script('slidecrafterreborn-swiper', plugin_dir_url(__FILE__) . '../js/swiper-bundle.js', [], '8.4.7', true);
    2834
    29     // CORRECTION CSS : appliqué au conteneur
    30     $custom_css = '';
    3135    if (!empty($settings['custom_css'])) {
    32         $css = str_replace(
    33             ['body ', 'html ', 'body>', 'html>'],
    34             ['#' . $unique_id . ' ', '#' . $unique_id . ' ', '#' . $unique_id . '>', '#' . $unique_id . '>'],
    35             $settings['custom_css']
    36         );
    37         $css = preg_replace('/^\s*body\s*\{.*?\}\s*/is', '', $css);
    38         $sanitized = slidecrafterreborn_sanitize_css($css);
    39         if ($sanitized) $custom_css = "<style>#{$unique_id} { {$sanitized} }</style>";
     36        $sanitized_css = slidecrafterreborn_sanitize_css($settings['custom_css']);
     37        if (!empty($sanitized_css)) {
     38            $custom_css_style = "<style>#$unique_id .swiper-slide { $sanitized_css }</style>";
     39        } else {
     40            $custom_css_style = '';
     41        }
     42    } else {
     43        $custom_css_style = '';
    4044    }
     45
     46    error_log('Slide Crafter Reborn: Rendering slide ID ' . $post_id . ', cards count: ' . count($cards) . ', settings: ' . json_encode($settings));
    4147
    4248    ob_start();
    4349    ?>
    44     <div class="swiper slidecrafterreborn-slider slidecrafterreborn-slider-<?php echo esc_attr($post_id); ?>"
    45          id="<?php echo esc_attr($unique_id); ?>"
    46          data-swiper-initialized="false">
    47 
    48         <div class="swiper-wrapper">
    49             <?php foreach ($cards as $index => $card) : ?>
    50                 <div class="swiper-slide"
    51                      style="display:flex;justify-content:center;align-items:center;">
    52                     <?php echo wp_kses_post(slidecrafterreborn_unescape_html($card)); ?>
    53                 </div>
     50    <div class="swiper slidecrafterreborn-slider slidecrafterreborn-slider-<?php echo esc_attr($post_id); ?>" id="<?php echo esc_attr($unique_id); ?>" data-swiper-initialized="false">
     51        <div class="swiper-wrapper" style="display:flex;" id="swiper-wrapper-<?php echo esc_attr(wp_generate_uuid4()); ?>" aria-live="off">
     52            <?php foreach ($cards as $index => $card): ?>
     53                <div class="swiper-slide" style="display:flex;justify-content:center;" role="group" aria-label="<?php echo esc_attr(($index + 1) . ' / ' . count($cards)); ?>" data-swiper-slide-index="<?php echo esc_attr($index); ?>"><?php echo wp_kses_post($card); ?></div>
    5454            <?php endforeach; ?>
    5555        </div>
    56 
    57         <?php if (!empty($settings['pagination'])) : ?>
    58             <div class="swiper-pagination slidecrafterreborn-pagination active-bullet-gold"></div>
    59         <?php endif; ?>
    60 
    61         <?php if (!empty($settings['navigation'])) : ?>
    62             <div class="swiper-button-prev"></div>
    63             <div class="swiper-button-next"></div>
    64         <?php endif; ?>
     56        <div class="swiper-pagination slidecrafterreborn-pagination active-bullet-gold" style="display:<?php echo esc_attr(($settings['pagination'] ?? true) ? 'block' : 'none'); ?>;margin-top:10px;"></div>
     57        <div class="swiper-button-prev" style="display:<?php echo esc_attr(($settings['navigation'] ?? false) ? 'block' : 'none'); ?>;"></div>
     58        <div class="swiper-button-next" style="display:<?php echo esc_attr(($settings['navigation'] ?? false) ? 'block' : 'none'); ?>;"></div>
    6559    </div>
    66 
    67     <?php echo $custom_css; ?>
    68 
     60    <?php echo $custom_css_style; ?>
    6961    <style>
    7062        #<?php echo esc_attr($unique_id); ?>.slidecrafterreborn-slider {
    71             padding:20px;
    72             background:#fafafa;
    73             border-radius:8px;
    74             box-shadow:0 2px 4px rgba(0,0,0,0.1);
    75             overflow:hidden;
     63            padding:20px;background:#fafafa;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,0.1);
    7664        }
    77         #<?php echo esc_attr($unique_id); ?> .swiper-pagination-bullet-active { background:gold; }
     65        #<?php echo esc_attr($unique_id); ?> .swiper-pagination-bullet-active {
     66            background:gold;
     67        }
     68        #<?php echo esc_attr($unique_id); ?> .swiper-slide {
     69            width:405px;text-align:center;display:flex;justify-content:center;align-items:center;
     70        }
     71        #<?php echo esc_attr($unique_id); ?> .swiper-wrapper {
     72            display:flex;
     73        }
    7874        #<?php echo esc_attr($unique_id); ?> .swiper-button-prev,
    7975        #<?php echo esc_attr($unique_id); ?> .swiper-button-next {
    80             color:gold;
    81             background:rgba(0,0,0,0.5);
    82             border-radius:50%;
    83             width:40px;
    84             height:40px;
     76            color:gold;background:rgba(0,0,0,0.5);border-radius:50%;width:40px;height:40px;opacity:1;transition:opacity 0.3s;z-index:10;
     77        }
     78        #<?php echo esc_attr($unique_id); ?> .swiper-button-prev:hover,
     79        #<?php echo esc_attr($unique_id); ?> .swiper-button-next:hover {
     80            opacity:0.8;
     81        }
     82        @media (max-width:768px) {
     83            #<?php echo esc_attr($unique_id); ?> .swiper-slide {
     84                width:300px;
     85            }
    8586        }
    8687    </style>
    87 
    88     <!-- LE SCRIPT MANQUANT — C’EST LUI QUI FAIT TOUT DÉFILER -->
    8988    <script>
    90     document.addEventListener('DOMContentLoaded', function () {
    91         const container = document.getElementById('<?php echo esc_js($unique_id); ?>');
    92         if (!container || container.getAttribute('data-swiper-initialized') === 'true') return;
    93 
    94         container.setAttribute('data-swiper-initialized', 'true');
    95 
    96         if (typeof Swiper === 'undefined') {
    97             console.error('Swiper non chargé');
    98             return;
    99         }
    100 
    101         new Swiper('#<?php echo esc_js($unique_id); ?>', {
    102             slidesPerView: <?php echo esc_js($slides_per_view); ?>,
    103             spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?>,
    104             loop: <?php echo (!empty($settings['loop'])) ? 'true' : 'false'; ?>,
    105             autoplay: <?php echo (!empty($settings['autoplay'])) ? '{ delay: ' . esc_js($settings['transition_speed'] ?? 3000) . ' }' : 'false'; ?>,
    106             pagination: <?php echo (!empty($settings['pagination'])) ? "{ el: '#" . esc_js($unique_id) . " .swiper-pagination', clickable: true }" : 'false'; ?>,
    107             navigation: <?php echo (!empty($settings['navigation'])) ? "{ nextEl: '#" . esc_js($unique_id) . " .swiper-button-next', prevEl: '#" . esc_js($unique_id) . " .swiper-button-prev' }" : 'false'; ?>,
    108             effect: '<?php echo esc_js($settings['animation_type'] ?? 'slide'); ?>',
    109             breakpoints: {
    110                 480: { slidesPerView: 1, spaceBetween: 10 },
    111                 768: { slidesPerView: 2, spaceBetween: 15 },
    112                 1024: { slidesPerView: <?php echo esc_js($slides_per_view); ?>, spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?> }
     89        document.addEventListener('DOMContentLoaded', function() {
     90            function initSwiper() {
     91                var swiperContainer = document.getElementById('<?php echo esc_js($unique_id); ?>');
     92                if (swiperContainer && swiperContainer.getAttribute('data-swiper-initialized') === 'false') {
     93                    swiperContainer.setAttribute('data-swiper-initialized', 'true');
     94                }
     95                if (typeof Swiper === 'undefined') {
     96                    console.error('Swiper is not loaded for frontend, retrying...');
     97                    setTimeout(initSwiper, 100);
     98                    return;
     99                }
     100                new Swiper('#<?php echo esc_js($unique_id); ?>', {
     101                    slidesPerView: <?php echo esc_js($slides_per_view); ?>,
     102                    slidesPerGroup: 1,
     103                    spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?>,
     104                    loop: <?php echo ($settings['loop'] ?? true) ? 'true' : 'false'; ?>,
     105                    loopAdditionalSlides: 1,
     106                    initialSlide: 0,
     107                    watchOverflow: true,
     108                    watchSlidesProgress: true,
     109                    preventClicks: false,
     110                    updateOnWindowResize: true,
     111                    observer: true,
     112                    observeParents: true,
     113                    effect: '<?php echo esc_js($settings['animation_type'] ?? 'slide'); ?>',
     114                    pagination: <?php echo ($settings['pagination'] ?? true) ? "{ el: '#" . esc_js($unique_id) . " .slidecrafterreborn-pagination', clickable: true }" : 'false'; ?>,
     115                    navigation: <?php echo ($settings['navigation'] ?? false) ? "{ nextEl: '#" . esc_js($unique_id) . " .swiper-button-next', prevEl: '#" . esc_js($unique_id) . " .swiper-button-prev' }" : 'false'; ?>,
     116                    autoplay: <?php echo ($settings['autoplay'] ?? true) ? "{ delay: " . esc_js($settings['transition_speed'] ?? 3000) . ", disableOnInteraction: false, pauseOnMouseEnter: false }" : 'false'; ?>,
     117                    cubeEffect: { shadow: false, slideShadows: false },
     118                    fadeEffect: { crossFade: true },
     119                    breakpoints: {
     120                        480: { slidesPerView: 1, spaceBetween: 10 },
     121                        768: { slidesPerView: 2, spaceBetween: 15 },
     122                        1024: { slidesPerView: <?php echo esc_js($slides_per_view); ?>, spaceBetween: <?php echo esc_js($settings['space_between'] ?? 20); ?> }
     123                    }
     124                });
    113125            }
     126            initSwiper();
    114127        });
    115     });
    116128    </script>
    117129    <?php
  • slide-crafter-reborn/trunk/readme.txt

    r3413240 r3413265  
    55Requires at least: 5.0
    66Tested up to: 6.9
    7 Stable tag: 1.1.0
     7Stable tag: 1.1.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    3333
    3434== Changelog ==
     35= 1.1.1 =
     36* Fixed a regression in shortcode result display.
     37
    3538= 1.1.0 =
    3639* Improved code display.
  • slide-crafter-reborn/trunk/slide-crafter-reborn.php

    r3413240 r3413265  
    44 * Plugin URI: https://github.com/tlloancy/slide-crafter-reborn
    55 * Description: Create responsive slider carousels with dynamic cards, real-time preview, and shortcode output.
    6  * Version: 1.1.0
     6 * Version: 1.1.1
    77 * Author: Thomas Lloancy
    88 * Author URI: https://github.com/tlloancy
Note: See TracChangeset for help on using the changeset viewer.