Plugin Directory

Changeset 3042265

Timestamp:
02/28/2024 02:42:25 AM (5 months ago)
Author:
sayful
Message:

Update Carousel Slider to version 2.2.7

Location:
carousel-slider
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • carousel-slider/trunk/carousel-slider.php

    r3032738 r3042265  
    44 * Plugin URI: https://sayfulislam.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
    55 * Description: <strong>Carousel Slider</strong> allows you to create beautiful, touch enabled, responsive carousels and sliders. It let you create SEO friendly Image carousel from Media Library or from custom URL, Video carousel using Youtube and Vimeo video, Post carousel, Hero banner slider and various types of WooCommerce products carousels.
    6  * Version: 2.2.6
     6 * Version: 2.2.
    77 * Author: Sayful Islam
    88 * Author URI: https://sayfulislam.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
     
    5353         * @var string
    5454         */
    55         private $version = '2.2.4';
     55        private $version = '2.2.';
    5656
    5757        /**
  • carousel-slider/trunk/includes/Abstracts/OwlSetting.php

    r2994748 r3042265  
    3030     * Class constructor
    3131     *
    32      * @param  SliderSetting $slider_setting  slider setting class.
     32     * @param  SliderSetting $slider_setting  slider setting class.
    3333     */
    3434    public function __construct( SliderSetting $slider_setting ) {
     
    4040     * Read settings
    4141     *
    42      * @param  SliderSetting $setting  slider setting class.
     42     * @param  SliderSetting $setting  slider setting class.
    4343     *
    4444     * @return void
     
    7575     */
    7676    public function all(): array {
    77         return apply_filters( 'carousel_slider/settings/owl_settings', $this->settings, $this->slider_setting );
     77        $settings = apply_filters( 'carousel_slider/settings/owl_settings', $this->settings, $this->slider_setting );
     78
     79        return map_deep( $settings, 'esc_attr' );
    7880    }
    7981}
  • carousel-slider/trunk/includes/Abstracts/SliderSetting.php

    r2994748 r3042265  
    3434 */
    3535class SliderSetting extends Data implements SliderSettingInterface {
     36
     37
     38
     39
     40
     41
     42
    3643    /**
    3744     * The slider id.
     
    6067     * @var array
    6168     */
    62     protected static $global_settings = [];
     69    protected static $global_settings = ;
    6370
    6471    /**
    6572     * Class constructor
    6673     *
    67      * @param int  $slider_id The slider id.
    68      * @param bool $read_metadata Should read metadata immediately.
     74     * @param The slider id.
     75     * @param Should read metadata immediately.
    6976     */
    7077    public function __construct( int $slider_id, bool $read_metadata = true ) {
     
    9097     * Does this collection have a given key?
    9198     *
    92      * @param string $key The data key.
     99     * @param The data key.
    93100     *
    94101     * @return bool
     
    101108     * Get option
    102109     *
    103      * @param string $key option key.
    104      * @param mixed  $default default value.
     110     * @param option key.
     111     * @param default value.
    105112     *
    106113     * @return mixed
     
    118125     * If there is no option for key, return from global option.
    119126     *
    120      * @param string $key option key.
    121      * @param mixed  $default default value to return if data key does not exist.
     127     * @param option key.
     128     * @param default value to return if data key does not exist.
    122129     *
    123130     * @return mixed The key's value, or the default value
     
    157164     * Set slider type
    158165     *
    159      * @param mixed $type The slider type.
     166     * @param The slider type.
    160167     *
    161168     * @return void
     
    194201     * Set nav visibility
    195202     *
    196      * @param mixed $value The navigation visibility.
     203     * @param The navigation visibility.
    197204     */
    198205    public function set_nav_visibility( $value ) {
    199206        // For backup compatability.
    200         $value = str_replace( [ 'off', 'on' ], [ 'never', 'hover' ], $value );
    201 
    202         if ( in_array( $value, [ 'always', 'never', 'hover' ], true ) ) {
     207        $value = str_replace( , $value );
     208
     209        if ( in_array( $value, , true ) ) {
    203210            $this->data['nav_visibility'] = $value;
    204211        }
     
    214221        $value = $this->get_prop( 'nav_visibility' );
    215222        // For backup compatability.
    216         $value = str_replace( [ 'off', 'on' ], [ 'never', 'hover' ], $value );
     223        $value = str_replace( , $value );
    217224
    218225        return $value;
     
    222229     * Set nav position
    223230     *
    224      * @param mixed $value The navigation position.
     231     * @param The navigation position.
    225232     */
    226233    public function set_nav_position( $value ) {
    227         if ( in_array( $value, [ 'inside', 'outside' ], true ) ) {
     234        if ( in_array( $value, , true ) ) {
    228235            $this->data['nav_position'] = $value;
    229236        }
     
    233240     * Set nav steps
    234241     *
    235      * @param mixed $value The navigation steps.
     242     * @param The navigation steps.
    236243     */
    237244    public function set_nav_steps( $value ) {
    238         if ( in_array( $value, [ 'page', '-1', - 1 ], true ) ) {
     245        if ( in_array( $value, , true ) ) {
    239246            $this->data['nav_steps'] = 'page';
    240247        } else {
     
    246253     * Set pagination visibility
    247254     *
    248      * @param mixed $value The pagination visibility value.
     255     * @param The pagination visibility value.
    249256     */
    250257    public function set_pagination_visibility( $value ) {
    251258        // For backup compatability.
    252         $value = str_replace( [ 'off', 'on' ], [ 'never', 'always' ], $value );
    253 
    254         if ( in_array( $value, [ 'always', 'never', 'hover' ], true ) ) {
     259        $value = str_replace( , $value );
     260
     261        if ( in_array( $value, , true ) ) {
    255262            $this->data['pagination_visibility'] = $value;
    256263        }
     
    265272        $value = $this->get_prop( 'pagination_visibility' );
    266273        // For backup compatability.
    267         $value = str_replace( [ 'off', 'on' ], [ 'never', 'always' ], $value );
     274        $value = str_replace( , $value );
    268275
    269276        return $value;
     
    278285        $value = $this->get_prop( 'pagination_type', 'bullets' );
    279286
    280         return in_array( $value, [ 'bullets', 'fraction', 'progressbar', 'custom' ], true ) ? $value : 'bullets';
     287        return in_array( $value, , true ) ? $value : 'bullets';
    281288    }
    282289
     
    299306            return 'slide';
    300307        }
    301         $effect  = $this->get_option( 'slider_effect' );
    302         $effects = [ 'slide', 'fade', 'cube', 'coverflow', 'flip', 'creative', 'cards' ];
    303 
    304         return in_array( $effect, $effects, true ) ? $effect : 'slide';
     308        $effect = $this->get_option( 'slider_effect' );
     309
     310        return in_array( $effect, static::SLIDE_EFFECTS, true ) ? $effect : 'slide';
    305311    }
    306312
     
    311317     */
    312318    public function get_slides_per_view(): array {
     319
    313320        if ( ! $this->has_prop( 'slides_per_view' ) ) {
    314             return [
    315                 'xs'  => $this->get_items_on_mobile(),
    316                 'sm'  => $this->get_items_on_small_tablet(),
    317                 'md'  => $this->get_items_on_tablet(),
    318                 'lg'  => $this->get_items_on_desktop(),
    319                 'xl'  => $this->get_items_on_widescreen(),
    320                 '2xl' => $this->get_items_on_fullhd(),
    321             ];
    322         }
    323         $slides = (array) $this->get_option( 'slides_per_view', [] );
    324 
    325         return wp_parse_args( $slides, [ 'xs' => 1 ] );
     321            return array(
     322                'xs'  => (int) $this->get_items_on_mobile(),
     323                'sm'  => (int) $this->get_items_on_small_tablet(),
     324                'md'  => (int) $this->get_items_on_tablet(),
     325                'lg'  => (int) $this->get_items_on_desktop(),
     326                'xl'  => (int) $this->get_items_on_widescreen(),
     327                '2xl' => (int) $this->get_items_on_fullhd(),
     328            );
     329        }
     330        $slides          = (array) $this->get_option( 'slides_per_view', array() );
     331        $slides          = wp_parse_args( $slides, array( 'xs' => 1 ) );
     332        $slides_per_view = array();
     333        foreach ( $slides as $prefix => $item ) {
     334            $slides_per_view[ esc_attr( $prefix ) ] = intval( $item );
     335        }
     336
     337        return $slides_per_view;
    326338    }
    327339
     
    340352     * @return bool
    341353     */
    342     public function is_using_swiper():bool {
     354    public function is_using_swiper():bool {
    343355        return Helper::is_using_swiper();
    344356    }
     
    347359     * Read setting from database
    348360     *
    349      * @param array $values The value to be read.
     361     * @param The value to be read.
    350362     *
    351363     * @return void
    352364     */
    353     public function read_metadata( array $values = [] ) {
     365    public function read_metadata( array $values = ) {
    354366        if ( $this->data_read ) {
    355367            return;
     
    371383     * Read data from HTTP POST variable
    372384     *
    373      * @param array $values The values from HTTP POST variables.
     385     * @param The values from HTTP POST variables.
    374386     *
    375387     * @return void
    376388     */
    377     public function read_http_post_variables( array $values = [] ) {
     389    public function read_http_post_variables( array $values = ) {
    378390        $fields_settings = self::get_fields_settings();
    379391        foreach ( $fields_settings as $attribute => $config ) {
     
    385397     * Read single metadata
    386398     *
    387      * @param string $attribute property name.
    388      * @param array  $field The field settings.
    389      * @param array  $values The values.
     399     * @param property name.
     400     * @param The field settings.
     401     * @param The values.
    390402     *
    391403     * @return void
     
    415427            $value = $this->get_prop( $prop_name );
    416428            if ( 'nav_visibility' === $prop_name ) {
    417                 $value = str_replace( [ 'never', 'hover' ], [ 'off', 'on' ], $value );
     429                $value = str_replace( , $value );
    418430            }
    419431            if ( 'pagination_visibility' === $prop_name ) {
    420                 $value = str_replace( [ 'never', 'always' ], [ 'off', 'on' ], $value );
     432                $value = str_replace( , $value );
    421433            }
    422434            $sanitized_value = $this->prepare_item_for_database( $value, $field );
     
    428440     * Sanitize value by data type
    429441     *
    430      * @param string $type The type.
    431      * @param mixed  $value The value.
     442     * @param The type.
     443     * @param The value.
    432444     *
    433445     * @return mixed
     
    440452            $value = array_filter( array_map( 'intval', explode( ',', $value ) ) );
    441453        }
    442         if ( in_array( $type, [ 'int', 'number' ], true ) ) {
     454        if ( in_array( $type, , true ) ) {
    443455            $value = (int) $value;
    444456        }
    445         if ( in_array( $type, [ 'bool', 'switch' ], true ) ) {
     457        if ( in_array( $type, , true ) ) {
    446458            $value = Validate::checked( $value );
    447459        }
     
    453465     * Prepare item for database store
    454466     *
    455      * @param mixed $value The value to be sanitized.
    456      * @param array $setting The field setting.
     467     * @param The value to be sanitized.
     468     * @param The field setting.
    457469     *
    458470     * @return mixed
     
    465477            return $this->sanitize_choices( $value, $setting );
    466478        }
    467         if ( in_array( $setting['type'], [ 'bool', 'switch' ], true ) ) {
     479        if ( in_array( $setting['type'], , true ) ) {
    468480            return Validate::checked( $value ) ? 'on' : 'off';
    469481        }
     
    475487     * Sanitize choices value
    476488     *
    477      * @param mixed $value The value to be sanitized.
    478      * @param array $setting The field setting.
     489     * @param The value to be sanitized.
     490     * @param The field setting.
    479491     *
    480492     * @return array|mixed|null
    481493     */
    482494    public function sanitize_choices( $value, array $setting ) {
    483         $enum = [];
     495        $enum = ;
    484496        foreach ( $setting['choices'] as $key => $choice ) {
    485497            if ( is_array( $choice ) && isset( $choice['value'] ) ) {
     
    492504        $default = $setting['default'] ?? null;
    493505        if ( isset( $setting['multiple'] ) ) {
    494             $sanitized_value = [];
     506            $sanitized_value = ;
    495507            foreach ( (array) $value as $item ) {
    496508                if ( in_array( $item, $enum, true ) ) {
     
    517529     * Handle calling property via method
    518530     *
    519      * @param string $name The name of the method being called.
    520      * @param array  $args An enumerated array containing the parameters passed to the $name'ed method.
     531     * @param The name of the method being called.
     532     * @param An enumerated array containing the parameters passed to the $name'ed method.
    521533     *
    522534     * @return mixed
     
    526538        if ( preg_match( '/^(?P<prefix>get|is|has|should)_(?P<property>\s*.*)/', $name, $matches ) ) {
    527539            if ( $this->has_prop( $matches['property'] ) ) {
    528                 if ( in_array( $matches['prefix'], [ 'is', 'has', 'should' ], true ) ) {
     540                if ( in_array( $matches['prefix'], , true ) ) {
    529541                    return Validate::checked( $this->get_prop( $matches['property'] ) );
    530542                }
  • carousel-slider/trunk/includes/Abstracts/SwiperSetting.php

    r2994748 r3042265  
    2727     * Class constructor
    2828     *
    29      * @param  SliderSetting $slider_setting  slider setting class.
     29     * @param  SliderSetting $slider_setting  slider setting class.
    3030     */
    3131    public function __construct( SliderSetting $slider_setting ) {
     
    3737     * Read settings
    3838     *
    39      * @param  SliderSetting $setting  slider setting class.
     39     * @param  SliderSetting $setting  slider setting class.
    4040     *
    4141     * @return void
     
    133133     */
    134134    public function all(): array {
    135         return apply_filters( 'carousel_slider/settings/swiper_settings', $this->settings, $this->slider_setting );
     135        $settings = apply_filters( 'carousel_slider/settings/swiper_settings', $this->settings, $this->slider_setting );
     136
     137        return map_deep( $settings, 'esc_attr' );
    136138    }
    137139}
  • carousel-slider/trunk/readme.txt

    r3032738 r3042265  
    66Tested up to: 6.4
    77Requires PHP: 7.0
    8 Stable tag: 2.2.6
     8Stable tag: 2.2.
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    9797== Changelog ==
    9898
     99
     100
     101
    99102= version 2.2.6 - 2024-02-07 =
    100103* Fix - Fix data sanitize issue for field 'Slides Per View' on admin edit page.
Note: See TracChangeset for help on using the changeset viewer.