Changeset 3042265
- Timestamp:
- 02/28/2024 02:42:25 AM (5 months ago)
- Location:
- carousel-slider
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
carousel-slider/trunk/carousel-slider.php
r3032738 r3042265 4 4 * Plugin URI: https://sayfulislam.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash 5 5 * 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. 66 * Version: 2.2. 7 7 * Author: Sayful Islam 8 8 * Author URI: https://sayfulislam.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash … … 53 53 * @var string 54 54 */ 55 private $version = '2.2. 4';55 private $version = '2.2.'; 56 56 57 57 /** -
carousel-slider/trunk/includes/Abstracts/OwlSetting.php
r2994748 r3042265 30 30 * Class constructor 31 31 * 32 * @param SliderSetting $slider_setting slider setting class.32 * @param SliderSetting $slider_setting slider setting class. 33 33 */ 34 34 public function __construct( SliderSetting $slider_setting ) { … … 40 40 * Read settings 41 41 * 42 * @param SliderSetting $setting slider setting class.42 * @param SliderSetting $setting slider setting class. 43 43 * 44 44 * @return void … … 75 75 */ 76 76 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' ); 78 80 } 79 81 } -
carousel-slider/trunk/includes/Abstracts/SliderSetting.php
r2994748 r3042265 34 34 */ 35 35 class SliderSetting extends Data implements SliderSettingInterface { 36 37 38 39 40 41 42 36 43 /** 37 44 * The slider id. … … 60 67 * @var array 61 68 */ 62 protected static $global_settings = [];69 protected static $global_settings = ; 63 70 64 71 /** 65 72 * Class constructor 66 73 * 67 * @param int $slider_idThe slider id.68 * @param bool $read_metadataShould read metadata immediately.74 * @param The slider id. 75 * @param Should read metadata immediately. 69 76 */ 70 77 public function __construct( int $slider_id, bool $read_metadata = true ) { … … 90 97 * Does this collection have a given key? 91 98 * 92 * @param string $keyThe data key.99 * @param The data key. 93 100 * 94 101 * @return bool … … 101 108 * Get option 102 109 * 103 * @param string $keyoption key.104 * @param mixed $defaultdefault value.110 * @param option key. 111 * @param default value. 105 112 * 106 113 * @return mixed … … 118 125 * If there is no option for key, return from global option. 119 126 * 120 * @param string $keyoption key.121 * @param mixed $defaultdefault 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. 122 129 * 123 130 * @return mixed The key's value, or the default value … … 157 164 * Set slider type 158 165 * 159 * @param mixed $typeThe slider type.166 * @param The slider type. 160 167 * 161 168 * @return void … … 194 201 * Set nav visibility 195 202 * 196 * @param mixed $valueThe navigation visibility.203 * @param The navigation visibility. 197 204 */ 198 205 public function set_nav_visibility( $value ) { 199 206 // 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 ) ) { 203 210 $this->data['nav_visibility'] = $value; 204 211 } … … 214 221 $value = $this->get_prop( 'nav_visibility' ); 215 222 // For backup compatability. 216 $value = str_replace( [ 'off', 'on' ], [ 'never', 'hover' ], $value );223 $value = str_replace( , $value ); 217 224 218 225 return $value; … … 222 229 * Set nav position 223 230 * 224 * @param mixed $valueThe navigation position.231 * @param The navigation position. 225 232 */ 226 233 public function set_nav_position( $value ) { 227 if ( in_array( $value, [ 'inside', 'outside' ], true ) ) {234 if ( in_array( $value, , true ) ) { 228 235 $this->data['nav_position'] = $value; 229 236 } … … 233 240 * Set nav steps 234 241 * 235 * @param mixed $valueThe navigation steps.242 * @param The navigation steps. 236 243 */ 237 244 public function set_nav_steps( $value ) { 238 if ( in_array( $value, [ 'page', '-1', - 1 ], true ) ) {245 if ( in_array( $value, , true ) ) { 239 246 $this->data['nav_steps'] = 'page'; 240 247 } else { … … 246 253 * Set pagination visibility 247 254 * 248 * @param mixed $valueThe pagination visibility value.255 * @param The pagination visibility value. 249 256 */ 250 257 public function set_pagination_visibility( $value ) { 251 258 // 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 ) ) { 255 262 $this->data['pagination_visibility'] = $value; 256 263 } … … 265 272 $value = $this->get_prop( 'pagination_visibility' ); 266 273 // For backup compatability. 267 $value = str_replace( [ 'off', 'on' ], [ 'never', 'always' ], $value );274 $value = str_replace( , $value ); 268 275 269 276 return $value; … … 278 285 $value = $this->get_prop( 'pagination_type', 'bullets' ); 279 286 280 return in_array( $value, [ 'bullets', 'fraction', 'progressbar', 'custom' ], true ) ? $value : 'bullets';287 return in_array( $value, , true ) ? $value : 'bullets'; 281 288 } 282 289 … … 299 306 return 'slide'; 300 307 } 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'; 305 311 } 306 312 … … 311 317 */ 312 318 public function get_slides_per_view(): array { 319 313 320 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; 326 338 } 327 339 … … 340 352 * @return bool 341 353 */ 342 public function is_using_swiper(): bool {354 public function is_using_swiper():bool { 343 355 return Helper::is_using_swiper(); 344 356 } … … 347 359 * Read setting from database 348 360 * 349 * @param array $valuesThe value to be read.361 * @param The value to be read. 350 362 * 351 363 * @return void 352 364 */ 353 public function read_metadata( array $values = []) {365 public function read_metadata( array $values = ) { 354 366 if ( $this->data_read ) { 355 367 return; … … 371 383 * Read data from HTTP POST variable 372 384 * 373 * @param array $valuesThe values from HTTP POST variables.385 * @param The values from HTTP POST variables. 374 386 * 375 387 * @return void 376 388 */ 377 public function read_http_post_variables( array $values = []) {389 public function read_http_post_variables( array $values = ) { 378 390 $fields_settings = self::get_fields_settings(); 379 391 foreach ( $fields_settings as $attribute => $config ) { … … 385 397 * Read single metadata 386 398 * 387 * @param string $attributeproperty name.388 * @param array $fieldThe field settings.389 * @param array $valuesThe values.399 * @param property name. 400 * @param The field settings. 401 * @param The values. 390 402 * 391 403 * @return void … … 415 427 $value = $this->get_prop( $prop_name ); 416 428 if ( 'nav_visibility' === $prop_name ) { 417 $value = str_replace( [ 'never', 'hover' ], [ 'off', 'on' ], $value );429 $value = str_replace( , $value ); 418 430 } 419 431 if ( 'pagination_visibility' === $prop_name ) { 420 $value = str_replace( [ 'never', 'always' ], [ 'off', 'on' ], $value );432 $value = str_replace( , $value ); 421 433 } 422 434 $sanitized_value = $this->prepare_item_for_database( $value, $field ); … … 428 440 * Sanitize value by data type 429 441 * 430 * @param string $typeThe type.431 * @param mixed $valueThe value.442 * @param The type. 443 * @param The value. 432 444 * 433 445 * @return mixed … … 440 452 $value = array_filter( array_map( 'intval', explode( ',', $value ) ) ); 441 453 } 442 if ( in_array( $type, [ 'int', 'number' ], true ) ) {454 if ( in_array( $type, , true ) ) { 443 455 $value = (int) $value; 444 456 } 445 if ( in_array( $type, [ 'bool', 'switch' ], true ) ) {457 if ( in_array( $type, , true ) ) { 446 458 $value = Validate::checked( $value ); 447 459 } … … 453 465 * Prepare item for database store 454 466 * 455 * @param mixed $valueThe value to be sanitized.456 * @param array $settingThe field setting.467 * @param The value to be sanitized. 468 * @param The field setting. 457 469 * 458 470 * @return mixed … … 465 477 return $this->sanitize_choices( $value, $setting ); 466 478 } 467 if ( in_array( $setting['type'], [ 'bool', 'switch' ], true ) ) {479 if ( in_array( $setting['type'], , true ) ) { 468 480 return Validate::checked( $value ) ? 'on' : 'off'; 469 481 } … … 475 487 * Sanitize choices value 476 488 * 477 * @param mixed $valueThe value to be sanitized.478 * @param array $settingThe field setting.489 * @param The value to be sanitized. 490 * @param The field setting. 479 491 * 480 492 * @return array|mixed|null 481 493 */ 482 494 public function sanitize_choices( $value, array $setting ) { 483 $enum = [];495 $enum = ; 484 496 foreach ( $setting['choices'] as $key => $choice ) { 485 497 if ( is_array( $choice ) && isset( $choice['value'] ) ) { … … 492 504 $default = $setting['default'] ?? null; 493 505 if ( isset( $setting['multiple'] ) ) { 494 $sanitized_value = [];506 $sanitized_value = ; 495 507 foreach ( (array) $value as $item ) { 496 508 if ( in_array( $item, $enum, true ) ) { … … 517 529 * Handle calling property via method 518 530 * 519 * @param string $nameThe name of the method being called.520 * @param array $argsAn 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. 521 533 * 522 534 * @return mixed … … 526 538 if ( preg_match( '/^(?P<prefix>get|is|has|should)_(?P<property>\s*.*)/', $name, $matches ) ) { 527 539 if ( $this->has_prop( $matches['property'] ) ) { 528 if ( in_array( $matches['prefix'], [ 'is', 'has', 'should' ], true ) ) {540 if ( in_array( $matches['prefix'], , true ) ) { 529 541 return Validate::checked( $this->get_prop( $matches['property'] ) ); 530 542 } -
carousel-slider/trunk/includes/Abstracts/SwiperSetting.php
r2994748 r3042265 27 27 * Class constructor 28 28 * 29 * @param SliderSetting $slider_setting slider setting class.29 * @param SliderSetting $slider_setting slider setting class. 30 30 */ 31 31 public function __construct( SliderSetting $slider_setting ) { … … 37 37 * Read settings 38 38 * 39 * @param SliderSetting $setting slider setting class.39 * @param SliderSetting $setting slider setting class. 40 40 * 41 41 * @return void … … 133 133 */ 134 134 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' ); 136 138 } 137 139 } -
carousel-slider/trunk/readme.txt
r3032738 r3042265 6 6 Tested up to: 6.4 7 7 Requires PHP: 7.0 8 Stable tag: 2.2. 68 Stable tag: 2.2. 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 97 97 == Changelog == 98 98 99 100 101 99 102 = version 2.2.6 - 2024-02-07 = 100 103 * Fix - Fix data sanitize issue for field 'Slides Per View' on admin edit page.
Note: See TracChangeset
for help on using the changeset viewer.