Plugin Directory

Changeset 3333374


Ignore:
Timestamp:
07/24/2025 08:40:07 AM (8 months ago)
Author:
wijnbergdevelopments
Message:
  • Added new rendering filters/actions for third party compatibility adjustments
  • Added helper functions for cleaner code organization and better maintainability
  • Updated code structure with better method organization and documentation
  • Updated theme compatibility handling with more modular approach
Location:
product-gallery-swiper-for-woocommerce
Files:
39 added
6 edited

Legend:

Unmodified
Added
Removed
  • product-gallery-swiper-for-woocommerce/trunk/README.txt

    r3333160 r3333374  
    44Requires at least: 6.0
    55Tested up to: 6.8
    6 Stable tag: 1.5.7
     6Stable tag: 1.5.8
    77Requires PHP: 7.2
    88License: GPL-2.0+
     
    6565
    6666== Changelog ==
     67= 1.5.8 =
     68* Added new rendering filters/actions for third party compatibility adjustments
     69* Added helper functions for cleaner code organization and better maintainability
     70* Updated code structure with better method organization and documentation
     71* Updated theme compatibility handling with more modular approach
     72
    6773= 1.5.7 =
    6874* Added option to enable/disable hover functionality when slider is disabled above breakpoint
  • product-gallery-swiper-for-woocommerce/trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.l10n.php

    r3313906 r3333374  
    11<?php
    22// generated by Poedit from product-gallery-swiper-for-woocommerce-nl_NL.po, do not edit directly
    3 return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=(n != 1);','language'=>'nl_NL','pot-creation-date'=>'2025-06-18 15:48+0200','po-revision-date'=>'2025-06-18 15:51+0200','translation-revision-date'=>'2025-06-18 15:51+0200','project-id-version'=>'Product Gallery Slider for WooCommerce','x-generator'=>'Poedit 3.6','messages'=>['Settings'=>'Instellingen','This plugin requires WooCommerce. Please install and activate WooCommerce before activating this plugin.'=>'Deze plugin vereist WooCommerce. Installeer en activeer WooCommerce voordat u deze plugin activeert.','Gallery Swiper'=>'Galerij Swiper','Gallery Swiper settings'=>'Galerij Swiper instellingen','Customize the Gallery slider settings.'=>'Pas de instellingen van de Gallery Slider aan.','Enable scrollbar'=>'Schakel scrollbalk in','Enable scrollbar for the slider'=>'Schakel scrollbalk in voor de slider','Enable pagination'=>'Schakel paginering in','Enable pagination for the slider'=>'Schakel paginering in voor de slider','Enable navigation'=>'Schakel navigatie in','Enable navigation for the slider'=>'Schakel navigatie in voor de slider','Enable variation images'=>'Schakel variatie-afbeeldingen in','Display variation images in the slider'=>'Variatie-afbeeldingen weergeven in de slider','Disable slider from'=>'Schakel slider uit vanaf','When set, the slider will be disabled from the specified breakpoint upwards, and the second product image will be displayed on mouse hover.'=>'Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde breekpunt en hoger, en wordt de tweede productafbeelding weergegeven bij het hoveren met de muis.','Always enabled'=>'Altijd ingeschakeld','Disabled from 480px and up'=>'Uitgeschakeld vanaf 480px en hoger','Disabled from 768px and up'=>'Uitgeschakeld vanaf 768px en hoger','Disabled from 992px and up'=>'Uitgeschakeld vanaf 992px en hoger','Disabled from 1200px and up'=>'Uitgeschakeld vanaf 1200px en hoger','Theme color'=>'Themakleur','Choose the Swiper theme color'=>'Kies de Swiper themakleur','Product Gallery Swiper for WooCommerce is developed by %s. Your trusted WordPress & WooCommerce plugin partner from the Netherlands.'=>'Product Gallery Swiper for WooCommerce is ontwikkeld door %s. Uw betrouwbare WordPress & WooCommerce pluginpartner uit Nederland.','Documentation'=>'Documentatie','Product Gallery Swiper for WooCommerce'=>'Productgalerij Swiper voor WooCommerce','https://products.wijnberg.dev'=>'https://products.wijnberg.dev','Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper.'=>'Verbetert de weergave van WooCommerce productafbeeldingen in productoverzichten, met een responsieve en gebruiksvriendelijke slider.','Wijnberg Developments'=>'Wijnberg Developments']];
     3return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=(n != 1);','language'=>'nl_NL','pot-creation-date'=>'2025-07-23 22:38+0200','po-revision-date'=>'2025-07-23 22:40+0200','translation-revision-date'=>'2025-07-23 22:40+0200','project-id-version'=>'Product Gallery Slider for WooCommerce','x-generator'=>'Poedit 3.6','messages'=>['Settings'=>'Instellingen','This plugin requires WooCommerce. Please install and activate WooCommerce before activating this plugin.'=>'Deze plugin vereist WooCommerce. Installeer en activeer WooCommerce voordat u deze plugin activeert.','Gallery Swiper'=>'Galerij Swiper','Gallery Swiper settings'=>'Galerij Swiper instellingen','Customize the Gallery slider settings.'=>'Pas de instellingen van de Gallery Slider aan.','Enable scrollbar'=>'Schakel scrollbalk in','Enable scrollbar for the slider'=>'Schakel scrollbalk in voor de slider','Enable pagination'=>'Schakel paginering in','Enable pagination for the slider'=>'Schakel paginering in voor de slider','Enable navigation'=>'Schakel navigatie in','Enable navigation for the slider'=>'Schakel navigatie in voor de slider','Enable variation images'=>'Schakel variatie-afbeeldingen in','Display variation images in the slider'=>'Variatie-afbeeldingen weergeven in de slider','Disable slider from'=>'Schakel slider uit vanaf','When set, the slider will be disabled from the specified breakpoint upwards.'=>'Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde breekpunt en hoger.','Always enabled'=>'Altijd ingeschakeld','Disabled from 480px and up'=>'Uitgeschakeld vanaf 480px en hoger','Disabled from 768px and up'=>'Uitgeschakeld vanaf 768px en hoger','Disabled from 992px and up'=>'Uitgeschakeld vanaf 992px en hoger','Disabled from 1200px and up'=>'Uitgeschakeld vanaf 1200px en hoger','Enable hover on disabled slider'=>'Schakel muisbeweging in bij uitgeschakelde slider','When the slider is disabled (above breakpoint), show the second image on mouse hover.'=>'Wanneer de slider is uitgeschakeld (boven breekpunt), de tweede productafbeelding weergegeven bij het hoveren met de muis.','Theme color'=>'Themakleur','Choose the Swiper theme color'=>'Kies de Swiper themakleur','Product Gallery Swiper for WooCommerce is developed by %s. Your trusted WordPress & WooCommerce plugin partner from the Netherlands.'=>'Product Gallery Swiper for WooCommerce is ontwikkeld door %s. Uw betrouwbare WordPress & WooCommerce pluginpartner uit Nederland.','Documentation'=>'Documentatie','Product Gallery Swiper for WooCommerce'=>'Productgalerij Swiper voor WooCommerce','https://products.wijnberg.dev'=>'https://products.wijnberg.dev','Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper.'=>'Verbetert de weergave van WooCommerce productafbeeldingen in productoverzichten, met een responsieve en gebruiksvriendelijke slider.','Wijnberg Developments'=>'Wijnberg Developments']];
  • product-gallery-swiper-for-woocommerce/trunk/languages/product-gallery-swiper-for-woocommerce-nl_NL.po

    r3313906 r3333374  
    33msgstr ""
    44"Project-Id-Version: Product Gallery Slider for WooCommerce\n"
    5 "POT-Creation-Date: 2025-06-18 15:48+0200\n"
    6 "PO-Revision-Date: 2025-06-18 15:51+0200\n"
     5"POT-Creation-Date: 2025-07-23 22:38+0200\n"
     6"PO-Revision-Date: 2025-07-23 22:40+0200\n"
    77"Last-Translator: \n"
    88"Language-Team: \n"
     
    2323"X-Poedit-SearchPathExcluded-2: public/vendor\n"
    2424
    25 #: admin/class-wdevs-gallery-swiper-admin.php:62
    26 #: includes/class-wdevs-gallery-swiper-woocommerce.php:271
     25#: admin/class-wdevs-gallery-swiper-admin.php:83
     26#: includes/class-wdevs-gallery-swiper-woocommerce.php:282
    2727msgid "Settings"
    2828msgstr "Instellingen"
     
    3636"u deze plugin activeert."
    3737
    38 #: includes/class-wdevs-gallery-swiper-woocommerce.php:93
     38#: includes/class-wdevs-gallery-swiper-woocommerce.php:96
    3939msgid "Gallery Swiper"
    4040msgstr "Galerij Swiper"
    4141
    42 #: includes/class-wdevs-gallery-swiper-woocommerce.php:107
     42#: includes/class-wdevs-gallery-swiper-woocommerce.php:110
    4343msgid "Gallery Swiper settings"
    4444msgstr "Galerij Swiper instellingen"
    4545
    46 #: includes/class-wdevs-gallery-swiper-woocommerce.php:109
     46#: includes/class-wdevs-gallery-swiper-woocommerce.php:112
    4747msgid "Customize the Gallery slider settings."
    4848msgstr "Pas de instellingen van de Gallery Slider aan."
    4949
    50 #: includes/class-wdevs-gallery-swiper-woocommerce.php:113
     50#: includes/class-wdevs-gallery-swiper-woocommerce.php:116
    5151msgid "Enable scrollbar"
    5252msgstr "Schakel scrollbalk in"
    5353
    54 #: includes/class-wdevs-gallery-swiper-woocommerce.php:115
     54#: includes/class-wdevs-gallery-swiper-woocommerce.php:118
    5555msgid "Enable scrollbar for the slider"
    5656msgstr "Schakel scrollbalk in voor de slider"
    5757
    58 #: includes/class-wdevs-gallery-swiper-woocommerce.php:120
     58#: includes/class-wdevs-gallery-swiper-woocommerce.php:123
    5959msgid "Enable pagination"
    6060msgstr "Schakel paginering in"
    6161
    62 #: includes/class-wdevs-gallery-swiper-woocommerce.php:122
     62#: includes/class-wdevs-gallery-swiper-woocommerce.php:125
    6363msgid "Enable pagination for the slider"
    6464msgstr "Schakel paginering in voor de slider"
    6565
    66 #: includes/class-wdevs-gallery-swiper-woocommerce.php:127
     66#: includes/class-wdevs-gallery-swiper-woocommerce.php:130
    6767msgid "Enable navigation"
    6868msgstr "Schakel navigatie in"
    6969
    70 #: includes/class-wdevs-gallery-swiper-woocommerce.php:129
     70#: includes/class-wdevs-gallery-swiper-woocommerce.php:132
    7171msgid "Enable navigation for the slider"
    7272msgstr "Schakel navigatie in voor de slider"
    7373
    74 #: includes/class-wdevs-gallery-swiper-woocommerce.php:134
     74#: includes/class-wdevs-gallery-swiper-woocommerce.php:137
    7575msgid "Enable variation images"
    7676msgstr "Schakel variatie-afbeeldingen in"
    7777
    78 #: includes/class-wdevs-gallery-swiper-woocommerce.php:136
     78#: includes/class-wdevs-gallery-swiper-woocommerce.php:139
    7979msgid "Display variation images in the slider"
    8080msgstr "Variatie-afbeeldingen weergeven in de slider"
    8181
    82 #: includes/class-wdevs-gallery-swiper-woocommerce.php:141
     82#: includes/class-wdevs-gallery-swiper-woocommerce.php:144
    8383msgid "Disable slider from"
    8484msgstr "Schakel slider uit vanaf"
    8585
    86 #: includes/class-wdevs-gallery-swiper-woocommerce.php:143
     86#: includes/class-wdevs-gallery-swiper-woocommerce.php:146
    8787msgid ""
    88 "When set, the slider will be disabled from the specified breakpoint upwards, "
    89 "and the second product image will be displayed on mouse hover."
     88"When set, the slider will be disabled from the specified breakpoint upwards."
    9089msgstr ""
    9190"Indien ingesteld, wordt de slider uitgeschakeld vanaf het gespecificeerde "
    92 "breekpunt en hoger, en wordt de tweede productafbeelding weergegeven bij het "
    93 "hoveren met de muis."
     91"breekpunt en hoger."
    9492
    95 #: includes/class-wdevs-gallery-swiper-woocommerce.php:146
     93#: includes/class-wdevs-gallery-swiper-woocommerce.php:149
    9694msgid "Always enabled"
    9795msgstr "Altijd ingeschakeld"
    9896
    99 #: includes/class-wdevs-gallery-swiper-woocommerce.php:147
     97#: includes/class-wdevs-gallery-swiper-woocommerce.php:150
    10098msgid "Disabled from 480px and up"
    10199msgstr "Uitgeschakeld vanaf 480px en hoger"
    102100
    103 #: includes/class-wdevs-gallery-swiper-woocommerce.php:148
     101#: includes/class-wdevs-gallery-swiper-woocommerce.php:151
    104102msgid "Disabled from 768px and up"
    105103msgstr "Uitgeschakeld vanaf 768px en hoger"
    106104
    107 #: includes/class-wdevs-gallery-swiper-woocommerce.php:149
     105#: includes/class-wdevs-gallery-swiper-woocommerce.php:152
    108106msgid "Disabled from 992px and up"
    109107msgstr "Uitgeschakeld vanaf 992px en hoger"
    110108
    111 #: includes/class-wdevs-gallery-swiper-woocommerce.php:150
     109#: includes/class-wdevs-gallery-swiper-woocommerce.php:153
    112110msgid "Disabled from 1200px and up"
    113111msgstr "Uitgeschakeld vanaf 1200px en hoger"
    114112
    115 #: includes/class-wdevs-gallery-swiper-woocommerce.php:155
     113#: includes/class-wdevs-gallery-swiper-woocommerce.php:158
     114msgid "Enable hover on disabled slider"
     115msgstr "Schakel muisbeweging in bij uitgeschakelde slider"
     116
     117#: includes/class-wdevs-gallery-swiper-woocommerce.php:160
     118msgid ""
     119"When the slider is disabled (above breakpoint), show the second image on "
     120"mouse hover."
     121msgstr ""
     122"Wanneer de slider is uitgeschakeld (boven breekpunt), de tweede "
     123"productafbeelding weergegeven bij het hoveren met de muis."
     124
     125#: includes/class-wdevs-gallery-swiper-woocommerce.php:166
    116126msgid "Theme color"
    117127msgstr "Themakleur"
    118128
    119 #: includes/class-wdevs-gallery-swiper-woocommerce.php:157
     129#: includes/class-wdevs-gallery-swiper-woocommerce.php:168
    120130msgid "Choose the Swiper theme color"
    121131msgstr "Kies de Swiper themakleur"
    122132
    123133#. translators: %s: Link to author site.
    124 #: includes/class-wdevs-gallery-swiper-woocommerce.php:196
     134#: includes/class-wdevs-gallery-swiper-woocommerce.php:207
    125135#, php-format
    126136msgid ""
     
    131141"WordPress & WooCommerce pluginpartner uit Nederland."
    132142
    133 #: includes/class-wdevs-gallery-swiper-woocommerce.php:245
     143#: includes/class-wdevs-gallery-swiper-woocommerce.php:256
    134144msgid "Documentation"
    135145msgstr "Documentatie"
  • product-gallery-swiper-for-woocommerce/trunk/public/class-wdevs-gallery-swiper-public.php

    r3333160 r3333374  
    119119
    120120    /**
     121     * Initialize the plugin's public-facing functionality.
     122     *
     123     * This function is called when WooCommerce is initialized. It sets up all necessary
     124     * actions and filters for the plugin to function properly.
     125     *
     126     * @since    1.0.0
     127     */
     128    public function on_woocommerce_init() {
     129        $this->setup_default_woocommerce_integration();
     130
     131        // Hooks for external developers to call our methods
     132        add_action( 'wdevs_gallery_swiper_start_gallery_rendering', [ $this, 'start_gallery_rendering' ] );
     133        add_action( 'wdevs_gallery_swiper_finish_gallery_rendering', [ $this, 'finish_gallery_rendering' ] );
     134        add_action( 'wdevs_gallery_swiper_render_gallery', [ $this, 'render_full_gallery' ], 10, 1 );
     135
     136        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ] );
     137        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
     138
     139        $this->add_themes_compatibility();
     140        $this->add_plugins_compatibility();
     141    }
     142
     143    /**
     144     * Setup default WooCommerce integration.
     145     *
     146     * This method sets up the default gallery rendering hooks for WooCommerce product loops.
     147     * External developers can disable this via the 'wdevs_gallery_swiper_enable_default_integration' filter.
     148     *
     149     * @since 1.5.8
     150     */
     151    public function setup_default_woocommerce_integration() {
     152        if ( apply_filters( 'wdevs_gallery_swiper_enable_default_integration', true ) ) {
     153            add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN );
     154            add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX );
     155        }
     156    }
     157
     158    /**
    121159     * Add compatibility fixes for various themes.
    122160     *
    123      * Currently, this function removes the secondary product image functionality
    124      * from the GeneratePress theme to avoid conflicts.
     161     * Handles compatibility with various themes including GeneratePress, Blocksy, and XStore.
     162     * Removes conflicting elements and adjusts rendering behavior as needed.
    125163     *
    126164     * @since    1.0.0
     
    201239        } );
    202240
    203         // GeneratePress Premium compatibility. Adjust gallery rendering timing for image wrapper conflict
    204         if ( function_exists( 'generatepress_wc_image_wrapper_close' ) ) {
    205             remove_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN );
    206             add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], 9 );
    207             remove_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX );
    208             add_action( 'woocommerce_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], 7 );
    209         }
    210     }
    211 
    212     /**
    213      * Initialize the plugin's public-facing functionality.
    214      *
    215      * This function is called when WooCommerce is initialized. It sets up all necessary
    216      * actions and filters for the plugin to function properly.
    217      *
    218      * @since    1.0.0
    219      */
    220     public function on_woocommerce_init() {
    221 
    222         add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'start_gallery_rendering' ], PHP_INT_MIN );
    223         add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'finish_gallery_rendering' ], PHP_INT_MAX );
    224 
    225         add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ] );
    226         add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
    227 
    228         $this->add_themes_compatibility();
    229         $this->add_plugins_compatibility();
    230 
    231     }
    232 
    233     /**
    234      * Parse the breakpoint value from the settings.
    235      *
    236      * This function converts the breakpoint setting to an integer and validates it.
    237      *
    238      * @param string $breakpoint The breakpoint value from the settings.
    239      *
    240      * @return   int|null                 The parsed breakpoint value or null if invalid.
    241      * @since    1.1.0
    242      */
    243     private function parse_breakpoint( $breakpoint ) {
    244         $value = intval( $breakpoint );
    245 
    246         return $value > 0 ? $value : null;
    247     }
     241        // GeneratePress Premium WooCommerce compatibility. Adjust gallery rendering timing for image wrapper conflict
     242        if ( function_exists( 'generatepress_is_module_active' ) ) {
     243            if ( generatepress_is_module_active( 'generate_package_woocommerce', 'GENERATE_WOOCOMMERCE' ) ) {
     244                $this->disable_default_thumbnail();
     245               
     246                // Use filter to disable default integration instead of remove_action
     247                add_filter( 'wdevs_gallery_swiper_enable_default_integration', '__return_false' );
     248                add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'render_gallery_with_default_thumbnail' ], 10 );
     249            }
     250        }
     251    }
     252
    248253
    249254    /**
     
    259264    public function start_gallery_rendering() {
    260265        if ( $this->should_display_gallery() ) {
    261             echo '<div class="swiper">';
     266            $extra_classes = apply_filters( 'wdevs_gallery_swiper_container_extra_classes', '' );
     267            $container_classes = trim( 'swiper ' . $extra_classes );
     268            echo '<div class="' . esc_attr( $container_classes ) . '">';
    262269            echo '<div class="swiper-wrapper">';
    263270            echo '<div class="swiper-slide">';
     
    281288            $product = wc_get_product();
    282289            foreach ( $product->get_gallery_image_ids() as $attachment_id ) {
    283                 echo '<div class="swiper-slide">' . $this->get_product_image( $product, $attachment_id ) . '</div>';
     290                echo $this->wrap_in_slide( $this->get_product_image( $product, $attachment_id ) );
    284291            }
    285292
     
    292299                    foreach ( $variations as $variation ) {
    293300                        if ( ! empty( $variation['image_id'] ) && ! in_array( $variation['image_id'], $variation_images, true ) ) {
    294                             echo '<div class="swiper-slide">' . $this->get_product_image( $product, $variation['image_id'] ) . '</div>';
     301                            echo $this->wrap_in_slide( $this->get_product_image( $product, $variation['image_id'] ) );
    295302                            $variation_images[] = $variation['image_id'];
    296303                        }
     
    309316
    310317    /**
     318     * Render the complete gallery with optional default thumbnail inclusion.
     319     *
     320     * Renders the full Swiper gallery structure, optionally including the default
     321     * product thumbnail as the first slide. Used for theme compatibility adjustments.
     322     *
     323     * @param bool $include_default Whether to include the default thumbnail as first slide.
     324     *
     325     * @since 1.5.8
     326     */
     327    public function render_full_gallery( $include_default = false ) {
     328        $this->start_gallery_rendering();
     329        if ( $include_default ) {
     330            $this->render_default_thumbnail_slide();
     331        }
     332        $this->finish_gallery_rendering();
     333    }
     334
     335    /**
     336     * Render the default product thumbnail as a Swiper slide.
     337     *
     338     * Creates a Swiper slide containing the default WooCommerce product thumbnail.
     339     * Only renders if the gallery should be displayed for the current product.
     340     *
     341     * @since 1.5.8
     342     */
     343    public function render_default_thumbnail_slide() {
     344        if ( $this->should_display_gallery() ) {
     345            echo $this->wrap_in_slide( woocommerce_get_product_thumbnail() );
     346        }
     347    }
     348
     349    /**
    311350     * Determines if the gallery should be displayed.
    312351     *
     
    317356     * @since    1.4.0
    318357     */
    319     private function should_display_gallery(): bool {
     358    public function should_display_gallery(): bool {
    320359        if ('product' !== get_post_type()) {
    321360            return false;
     
    340379        $consider_variation_images = (get_option('wdevs_gallery_swiper_variation_images', 'no') === 'yes');
    341380        if($consider_variation_images){
    342             return $this->product_has_variation_images($product);
    343         }
    344 
    345         return false;
     381            return apply_filters( 'wdevs_gallery_swiper_should_display_gallery', $this->product_has_variation_images($product) );
     382        }
     383
     384        return apply_filters( 'wdevs_gallery_swiper_should_display_gallery', false );
    346385    }
    347386
     
    357396     * @since    1.4.0
    358397     */
    359     private function get_product_image( $product, $attachment_id ) {
     398    public function get_product_image( $product, $attachment_id ) {
    360399        if ( ! isset( $product ) ) {
    361400            return '';
     
    426465
    427466    /**
    428      * Checks if the product has a variation with an image
    429      *
    430      * @param $product
    431      *
    432      * @return bool
    433      *
    434      * @since    1.5.2
     467     * Checks if the product has a variation with an image.
     468     *
     469     * @param WC_Product $product The product object to check.
     470     *
     471     * @return bool True if product has variations with images, false otherwise.
     472     *
     473     * @since 1.5.2
    435474     */
    436475    private function product_has_variation_images($product): bool {
     
    447486        return false;
    448487    }
     488
     489    /**
     490     * Disable the default WooCommerce product thumbnail.
     491     *
     492     * Removes the default WooCommerce product thumbnail from the shop loop
     493     * to prevent conflicts with the gallery swiper.
     494     *
     495     * @since 1.5.8
     496     */
     497    public function disable_default_thumbnail() {
     498        remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
     499    }
     500
     501    /**
     502     * Parse the breakpoint value from the settings.
     503     *
     504     * This function converts the breakpoint setting to an integer and validates it.
     505     *
     506     * @param string $breakpoint The breakpoint value from the settings.
     507     *
     508     * @return int|null The parsed breakpoint value or null if invalid.
     509     *
     510     * @since 1.1.0
     511     */
     512    private function parse_breakpoint( $breakpoint ) {
     513        $value = intval( $breakpoint );
     514
     515        return $value > 0 ? $value : null;
     516    }
     517
     518    /**
     519     * Wrap content in a Swiper slide div.
     520     *
     521     * Creates a div element with the swiper-slide class and wraps the provided content.
     522     *
     523     * @param string $content The content to wrap in the slide.
     524     *
     525     * @return string The HTML for the Swiper slide with content.
     526     *
     527     * @since 1.5.8
     528     */
     529    public function wrap_in_slide( $content ) {
     530        $extra_classes = apply_filters( 'wdevs_gallery_swiper_slide_extra_classes', '' );
     531        $slide_classes = trim( 'swiper-slide ' . $extra_classes );
     532        return '<div class="' . esc_attr( $slide_classes ) . '">' . $content . '</div>';
     533    }
     534
     535    /**
     536     * Render gallery with default thumbnail as first slide.
     537     *
     538     * This method is used as a callback for theme/plugin compatibility adjustments
     539     * where the default gallery rendering needs to be replaced with a version
     540     * that includes the default thumbnail as the first slide.
     541     *
     542     * @since 1.5.8
     543     */
     544    public function render_gallery_with_default_thumbnail() {
     545        $this->render_full_gallery( true );
     546    }
    449547}
  • product-gallery-swiper-for-woocommerce/trunk/wdevs-gallery-swiper.php

    r3333160 r3333374  
    1717 * Plugin URI:           https://products.wijnberg.dev
    1818 * Description:          Enhances WooCommerce product images display on product listing sections, providing a responsive and touch-friendly swiper.
    19  * Version:              1.5.7
     19 * Version:              1.5.8
    2020 * Author:               Wijnberg Developments
    2121 * License:              GPL-2.0+
     
    4141 * Rename this for your plugin and update it as you release new versions.
    4242 */
    43 define( 'WDEVS_GALLERY_SWIPER_VERSION', '1.5.7' );
     43define( 'WDEVS_GALLERY_SWIPER_VERSION', '1.5.8' );
    4444
    4545/**
Note: See TracChangeset for help on using the changeset viewer.