YITH WooCommerce Ajax Product Filter - Version 3.8.0

Version Description

  • Released on 30 October 2019 =

  • New: Support for WordPress 5.3

  • New: Support for WooCommerce 3.8

  • Update: plugin framework

  • Fix: Call get_query_object() on null

  • Dev: New filter 'yith_wcan_skip_check_on_product_in_term'

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Product Filter
Version 3.8.0
Comparing to
See all releases

Code changes from version 3.7.1 to 3.8.0

README.txt CHANGED
@@ -3,8 +3,8 @@
3
  Contributors: yithemes
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
- Tested up to: 5.2
7
- Stable tag: 3.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,6 +159,14 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
 
 
162
  = 3.7.1 - Released on 27th August, 2019 =
163
 
164
  * Fix: curl_init() doesn't exist
3
  Contributors: yithemes
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
+ Tested up to: 5.3
7
+ Stable tag: 3.8.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.8.0 - Released on 30 October 2019 =
163
+
164
+ * New: Support for WordPress 5.3
165
+ * New: Support for WooCommerce 3.8
166
+ * Update: plugin framework
167
+ * Fix: Call get_query_object() on null
168
+ * Dev: New filter 'yith_wcan_skip_check_on_product_in_term'
169
+
170
  = 3.7.1 - Released on 27th August, 2019 =
171
 
172
  * Fix: curl_init() doesn't exist
assets/css/frontend.css CHANGED
@@ -18,6 +18,10 @@
18
  cursor: not-allowed;
19
  }
20
 
 
 
 
 
21
  /* Colors Type */
22
  ul.yith-wcan-color.yith-wcan.yith-wcan-group,
23
  ul.yith-wcan-list {
@@ -190,6 +194,21 @@ ul.yith-wcan-list {
190
  padding-left: 90px;
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  /* === Sort By === */
194
 
195
  .yith-wcan-sort-by ul.orderby {
@@ -201,11 +220,11 @@ ul.yith-wcan-list {
201
  margin-bottom: 5px;
202
  }
203
 
204
- .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
205
  a.yith-wcan-onsale-button.active:before,
206
  a.yith-wcan-instock-button.active:before,
207
  a.yith-wcan-price-link.active:before,
208
- ul.yith-wcan-list li.chosen a:before{
209
  font-family: WooCommerce;
210
  speak: none;
211
  font-variant: normal;
@@ -282,14 +301,14 @@ ul.yith-wcan-list li.chosen a:before{
282
  background-image: url("../images/radio_sprite.png");
283
  }
284
 
285
- .yith-woocommerce-ajax-product-filter.with-checkbox ul li a.active:before,
286
- .yith-woocommerce-ajax-product-filter.with-checkbox ul li a.chosen:before,
287
- .yith-woocommerce-ajax-product-filter.with-checkbox ul li.active a:before,
288
- .yith-woocommerce-ajax-product-filter.with-checkbox ul li.chosen a:before,
289
  .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li a.active:before,
290
  .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li a.chosen:before,
291
- .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li.active a:before,
292
- .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li.chosen a:before,
293
  .widget_layered_nav.with-checkbox .chosen::before{
294
  content: '';
295
  background-position: bottom center;
@@ -332,12 +351,24 @@ ul.yith-wcan-list li.chosen a:before{
332
  font-size: 12px;
333
  }
334
 
 
 
 
 
335
  /*-------------------------------
336
  STOREFRONT SUPPORT
337
  --------------------------------*/
338
 
339
- .theme-storefront .widget_layered_nav .yith-wcan-list li::before{width: 0;content: "" !important;float: none;padding-left: 0 !important;}
340
- .theme-storefront .widget_layered_nav .yith-wcan-list li{padding-left: 0;}
 
 
 
 
 
 
 
 
341
 
342
  .theme-storefront .yith-woocommerce-ajax-product-filter ul li.chosen a:before,
343
  .theme-storefront .yith-woocommerce-ajax-product-filter.yith-wcan-sort-by ul li a.active:before{
@@ -353,4 +384,17 @@ ul.yith-wcan-list li.chosen a:before{
353
  .theme-storefront .widget-area .yith-woocommerce-ajax-product-filter a:not(.button):before {
354
  text-decoration: none;
355
  display: inline-block
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  }
18
  cursor: not-allowed;
19
  }
20
 
21
+ .yith-wcan-list-price-filter{
22
+ margin-left: 0;
23
+ }
24
+
25
  /* Colors Type */
26
  ul.yith-wcan-color.yith-wcan.yith-wcan-group,
27
  ul.yith-wcan-list {
194
  padding-left: 90px;
195
  }
196
 
197
+ .yit-wcan-parent-terms ul.yith-child-terms.level-0 {
198
+ padding-left: 20px;
199
+ }
200
+
201
+ .yit-wcan-parent-terms ul.yith-child-terms.level-1 {
202
+ padding-left: 40px;
203
+ }
204
+
205
+ .yit-wcan-parent-terms ul.yith-child-terms.level-2 {
206
+ padding-left: 60px;
207
+ }
208
+
209
+ .yit-wcan-parent-terms ul.yith-child-terms.level-3 {
210
+ padding-left: 80px;
211
+ }
212
  /* === Sort By === */
213
 
214
  .yith-wcan-sort-by ul.orderby {
220
  margin-bottom: 5px;
221
  }
222
 
223
+ .yith-wcan-sort-by ul.orderby li.orderby-wrapper > a.active:before,
224
  a.yith-wcan-onsale-button.active:before,
225
  a.yith-wcan-instock-button.active:before,
226
  a.yith-wcan-price-link.active:before,
227
+ ul.yith-wcan-list li.chosen > a:before{
228
  font-family: WooCommerce;
229
  speak: none;
230
  font-variant: normal;
301
  background-image: url("../images/radio_sprite.png");
302
  }
303
 
304
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul li > a.active:before,
305
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul li > a.chosen:before,
306
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul li.active > a:before,
307
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul li.chosen > a:before,
308
  .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li a.active:before,
309
  .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li a.chosen:before,
310
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li.active > a:before,
311
+ .yith-woocommerce-ajax-product-filter.with-checkbox ul.orderby li.chosen > a:before,
312
  .widget_layered_nav.with-checkbox .chosen::before{
313
  content: '';
314
  background-position: bottom center;
351
  font-size: 12px;
352
  }
353
 
354
+ .yith-woocommerce-ajax-product-filter ul li{
355
+ list-style: none;
356
+ }
357
+
358
  /*-------------------------------
359
  STOREFRONT SUPPORT
360
  --------------------------------*/
361
 
362
+ .theme-storefront .widget_layered_nav .yith-wcan-list li::before{
363
+ width: 0;content: "" !important;
364
+ float: none;
365
+ padding-left: 0 !important;
366
+ }
367
+
368
+ .theme-storefront .widget_layered_nav .yith-wcan-list li,
369
+ .theme-storefront .yith-woocommerce-ajax-product-filter.widget_layered_nav ul li{
370
+ padding-left: 0 !important;
371
+ }
372
 
373
  .theme-storefront .yith-woocommerce-ajax-product-filter ul li.chosen a:before,
374
  .theme-storefront .yith-woocommerce-ajax-product-filter.yith-wcan-sort-by ul li a.active:before{
384
  .theme-storefront .widget-area .yith-woocommerce-ajax-product-filter a:not(.button):before {
385
  text-decoration: none;
386
  display: inline-block
387
+ }
388
+
389
+ /*-------------------------------
390
+ FLATSOME SUPPORT
391
+ --------------------------------*/
392
+
393
+ .theme-flatsome .yith-woocommerce-ajax-product-filter ul.yith-child-terms{
394
+ display: block;
395
+ }
396
+
397
+ .theme-flatsome .yith-woocommerce-ajax-product-filter ul li.yit-wcan-parent-terms,
398
+ .theme-flatsome .yith-woocommerce-ajax-product-filter ul.yith-child-terms li{
399
+ display: inline;
400
  }
includes/class.yith-wcan-frontend.php CHANGED
@@ -401,7 +401,8 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
401
 
402
  $args = yit_product_visibility_meta( $args );
403
 
404
- $queried_object = is_object( get_queried_object() ) ? get_queried_object() : false;
 
405
 
406
  $taxonomy = $queried_object && property_exists( $queried_object, 'taxonomy' ) ? $queried_object->taxonomy : false;
407
  $slug = $queried_object && property_exists( $queried_object, 'slug' ) ? $queried_object->slug : false;
401
 
402
  $args = yit_product_visibility_meta( $args );
403
 
404
+ global $wp_query;
405
+ $queried_object = function_exists( 'get_queried_object' ) && is_callable( array( $wp_query, 'get_queried_object' ) ) ? get_queried_object() : false;
406
 
407
  $taxonomy = $queried_object && property_exists( $queried_object, 'taxonomy' ) ? $queried_object->taxonomy : false;
408
  $slug = $queried_object && property_exists( $queried_object, 'slug' ) ? $queried_object->slug : false;
includes/functions.yith-wcan.php CHANGED
@@ -396,6 +396,11 @@ if ( ! function_exists( 'yit_term_has_child' ) ) {
396
  $child_terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $term->term_id ) );
397
 
398
  if( ! is_wp_error( $child_terms ) ){
 
 
 
 
 
399
  foreach ( $child_terms as $child_term ) {
400
  $_products_in_term = get_objects_in_term( $child_term->term_id, $taxonomy );
401
  $count += sizeof( array_intersect( $_products_in_term, YITH_WCAN()->frontend->layered_nav_product_ids ) );
@@ -789,8 +794,16 @@ if( ! function_exists( 'yith_wcan_wp_get_terms' ) ) {
789
  */
790
  function yith_wcan_wp_get_terms( $args ) {
791
  global $wp_version;
792
-
793
- if( version_compare( $wp_version, '4.6', '<' ) ){
 
 
 
 
 
 
 
 
794
  $terms = get_terms( $args['taxonomy'], $args );
795
  }
796
 
396
  $child_terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $term->term_id ) );
397
 
398
  if( ! is_wp_error( $child_terms ) ){
399
+
400
+ if( apply_filters( 'yith_wcan_skip_check_on_product_in_term',false, $child_terms ) ){
401
+ return true;
402
+ }
403
+
404
  foreach ( $child_terms as $child_term ) {
405
  $_products_in_term = get_objects_in_term( $child_term->term_id, $taxonomy );
406
  $count += sizeof( array_intersect( $_products_in_term, YITH_WCAN()->frontend->layered_nav_product_ids ) );
794
  */
795
  function yith_wcan_wp_get_terms( $args ) {
796
  global $wp_version;
797
+
798
+ $pre_terms = apply_filters( 'pre_yith_wcan_wp_get_terms', false, $args );
799
+
800
+ if( false !== $pre_terms ){
801
+ return $pre_terms;
802
+ }
803
+
804
+ $terms = array();
805
+
806
+ if( version_compare( $wp_version, '4.6', '<' ) ){
807
  $terms = get_terms( $args['taxonomy'], $args );
808
  }
809
 
init.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
5
  * Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
6
- * Version: 3.7.1
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
10
  * Domain Path: /languages/
11
  *
12
- * WC requires at least: 3.0
13
- * WC tested up to: 3.7
14
  *
15
  * @author Your Inspiration Themes
16
  * @package YITH WooCommerce Ajax Navigation
@@ -67,7 +67,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
67
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
68
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
70
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.7.1' );
71
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
72
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
73
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
5
  * Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
6
+ * Version: 3.8.0
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
10
  * Domain Path: /languages/
11
  *
12
+ * WC requires at least: 3.3
13
+ * WC tested up to: 3.8
14
  *
15
  * @author Your Inspiration Themes
16
  * @package YITH WooCommerce Ajax Navigation
67
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
68
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
70
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.8.0' );
71
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
72
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
73
 
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -35,6 +35,12 @@
35
  float: left;
36
  }
37
 
 
 
 
 
 
 
38
  .yith-plugin-fw input[type=email],
39
  .yith-plugin-fw input[type=number],
40
  .yith-plugin-fw input[type=text]:not(.select2-search__field),
@@ -48,6 +54,7 @@
48
  max-width: 100%;
49
  height: 30px;
50
  padding: 5px;
 
51
  }
52
 
53
  .woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
@@ -60,6 +67,10 @@
60
  padding: 3px 5px;
61
  }
62
 
 
 
 
 
63
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
64
  .yith-plugin-fw input[type=text].colorpick {
65
  width: 6em;
@@ -408,6 +419,18 @@ ul.yit-icons-manager-list li.active {
408
  margin: 0 auto;
409
  }
410
 
 
 
 
 
 
 
 
 
 
 
 
 
411
  /****************
412
  YITH UI
413
  ****************/
@@ -819,7 +842,9 @@ YITH UI
819
  .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
820
  border: 0;
821
  height: 30px;
822
- max-width: 60px;
 
 
823
 
824
  }
825
 
@@ -1583,8 +1608,10 @@ DATEPICKER
1583
  display: none !important;
1584
  }
1585
 
1586
- .yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap {
1587
- display: inline !important;
 
 
1588
  }
1589
 
1590
  .yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
@@ -1607,6 +1634,14 @@ DATEPICKER
1607
  display: none;
1608
  }
1609
 
 
 
 
 
 
 
 
 
1610
  .yith-plugin-ui .wp-picker-container .wp-color-result.button {
1611
  width: 30px;
1612
  height: 30px;
@@ -2119,4 +2154,4 @@ DATEPICKER
2119
  clear: initial;
2120
  }
2121
 
2122
- }
35
  float: left;
36
  }
37
 
38
+ .yith-plugin-fw span.color-alpha {
39
+ height: 23px!important;
40
+ }
41
+ .yith-plugin-fw .wp-color-result-text{
42
+ height: 100%;
43
+ }
44
  .yith-plugin-fw input[type=email],
45
  .yith-plugin-fw input[type=number],
46
  .yith-plugin-fw input[type=text]:not(.select2-search__field),
54
  max-width: 100%;
55
  height: 30px;
56
  padding: 5px;
57
+ line-height: 1;
58
  }
59
 
60
  .woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
67
  padding: 3px 5px;
68
  }
69
 
70
+ .wp-core-ui .yith-plugin-fw-colorpicker-field-wrapper button{
71
+ border-color: #7e8993;
72
+ }
73
+
74
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
75
  .yith-plugin-fw input[type=text].colorpick {
76
  width: 6em;
419
  margin: 0 auto;
420
  }
421
 
422
+ /****************
423
+ WordPress 5.3 with old panel fixes
424
+ ****************/
425
+ .yith-plugin-fw-field-wrapper .select2-container .select2-selection--single {
426
+ height: auto;
427
+ line-height: 1;
428
+ }
429
+
430
+ .yith-plugin-fw-field-wrapper .select2-container .select2-selection--single .select2-selection__arrow{
431
+ height: 100%;
432
+ }
433
+
434
  /****************
435
  YITH UI
436
  ****************/
842
  .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
843
  border: 0;
844
  height: 30px;
845
+ max-width: 121px;
846
+ font-size: 11px;
847
+ padding: 0;
848
 
849
  }
850
 
1608
  display: none !important;
1609
  }
1610
 
1611
+ .yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap,
1612
+ .yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap > * {
1613
+ display: inline-block !important;
1614
+ vertical-align: middle;
1615
  }
1616
 
1617
  .yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
1634
  display: none;
1635
  }
1636
 
1637
+ .yith-plugin-ui .wp-picker-container .wp-color-result.button{
1638
+ height: 30px!important;
1639
+ }
1640
+
1641
+ .yith-plugin-ui .wp-picker-container .color-alpha {
1642
+ height: 28px!important;
1643
+ }
1644
+
1645
  .yith-plugin-ui .wp-picker-container .wp-color-result.button {
1646
  width: 30px;
1647
  height: 30px;
2154
  clear: initial;
2155
  }
2156
 
2157
+ }
plugin-fw/assets/js/yit-cpt-unlimited.js CHANGED
@@ -51,12 +51,13 @@
51
  // Do something with attachment.id and/or attachment.url here
52
  images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
53
  });
54
-
55
  // make AJAX request
56
  $.post( ajaxurl, {
57
  images: images,
58
  post_type: typenow,
59
- action: 'yit_cptu_multiuploader'
 
60
  }, function( data ){
61
  location.reload();
62
  });
51
  // Do something with attachment.id and/or attachment.url here
52
  images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
53
  });
54
+ console.log( button.data('nonce') );
55
  // make AJAX request
56
  $.post( ajaxurl, {
57
  images: images,
58
  post_type: typenow,
59
+ action: 'yit_cptu_multiuploader',
60
+ _ajax_nonce: button.data('nonce')
61
  }, function( data ){
62
  location.reload();
63
  });
plugin-fw/assets/js/yit-cpt-unlimited.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(d){d(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(g){g.preventDefault();var b=d(this),e=!1;b.next("span.spinner").css("display","inline-block");if(!c){var c=wp.media.frames.file_frame=wp.media({title:b.data("uploader_title"),button:{text:b.data("uploader_button_text")},library:{type:"image"},multiple:!0});c.on("select",function(){var f=[];c.state().get("selection").map(function(a){a=a.toJSON();f.push({id:a.id,url:a.url,title:a.title})});d.post(ajaxurl,{images:f,post_type:typenow,
2
- action:"yit_cptu_multiuploader"},function(a){location.reload()});b.next("span.spinner").css("display","inline-block");e=!0});c.on("close",function(){e||b.next("span.spinner").hide()})}c.open()})})(jQuery);
1
+ (function(c){c(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a=c(this),d=!1;a.next("span.spinner").css("display","inline-block");if(!b){var b=wp.media.frames.file_frame=wp.media({title:a.data("uploader_title"),button:{text:a.data("uploader_button_text")},library:{type:"image"},multiple:!0});b.on("select",function(){var e=[];b.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,
2
+ action:"yit_cptu_multiuploader",_ajax_nonce:a.data("nonce")},function(a){location.reload()});a.next("span.spinner").css("display","inline-block");d=!0});b.on("close",function(){d||a.next("span.spinner").hide()})}b.open()})})(jQuery);
plugin-fw/assets/js/yith-colorpicker.min.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**!
2
+ * wp-color-picker-alpha
3
+ *
4
+ * Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
5
+ * Only run in input and is defined data alpha in true
6
+ *
7
+ * Version: 2.1.3
8
+ * https://github.com/kallookoo/wp-color-picker-alpha
9
+ * Licensed under the GPLv2 license or later.
10
+ */
11
+ !function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
plugin-fw/assets/js/yith-fields.js CHANGED
@@ -434,9 +434,12 @@ jQuery( function ( $ ) {
434
  var toggle = $( this ),
435
  action = 'yith_plugin_fw_save_toggle_element',
436
  formdata = toggle.serializeToggleElement(),
437
- id = toggle.find( '.yith-toggle_wrapper' ).attr( 'id' ),
 
438
  current_tab = $.urlParam( 'tab' );
439
 
 
 
440
  if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
441
  formdata.append( 'yith_toggle_elements_order_keys', array_keys );
442
  }
434
  var toggle = $( this ),
435
  action = 'yith_plugin_fw_save_toggle_element',
436
  formdata = toggle.serializeToggleElement(),
437
+ wrapper = toggle.find( '.yith-toggle_wrapper' ),
438
+ id = wrapper.attr( 'id' ),
439
  current_tab = $.urlParam( 'tab' );
440
 
441
+ formdata.append( 'security', wrapper.data('nonce') );
442
+
443
  if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
444
  formdata.append( 'yith_toggle_elements_order_keys', array_keys );
445
  }
plugin-fw/assets/js/yith-fields.min.js CHANGED
@@ -1 +1,25 @@
1
- jQuery(function(g){function h(){var e=g(".yith-plugin-fw-datepicker"),t=g(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:g(".yith-plugin-fw-upload-img-url")},i=g(".add_media"),a={sliderWrapper:g(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},l=g(".yith-plugin-fw-sidebar-layout"),o=g(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=g(".codemirror"),d=g(".yit-icons-manager-wrapper");if(g(".yith-plugin-ui td.forminp-checkbox"),e.each(function(){var e=g(this).data();g(this).datepicker(e)}),t.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var e=g(this);e.val(e.data("default-color")),e.change()}}),t.each(function(){var e=g(this).data("variations-label"),t=g(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),i=g(this).closest(".yith-single-colorpicker"),a=t.find(".wp-picker-input-wrap"),l=i.find(".wp-picker-input-wrap");if(a.length&&t.find("a.wp-color-result").attr("title",e),i.length&&i.find("a.wp-color-result").attr("title",e),!a.find(".wp-picker-clear-custom").length){var n=g("<span/>").attr({class:"wp-picker-default-custom"});a.find(".wp-picker-default").wrap(n)}if(!l.find(".wp-picker-clear-custom").length){n=g("<span/>").attr({class:"wp-picker-default-custom"});l.find(".wp-picker-default").wrap(n)}}),"undefined"!=typeof wp&&void 0!==wp.media){n.imgUrl.change(function(){var e=g(this).val(),t=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),i=g(this).parent().find(n.imgPreviewHandler).first();i.length<1&&(i=g(this).parent().parent().find(n.imgPreviewHandler).first()),t.test(e)?i.html('<img src="'+e+'" style="max-width:100px; max-height:100px;" />'):i.html("")}).trigger("change"),g(document).on("click",n.uploadButtonHandler,function(e){e.preventDefault();var t,i=g(this).attr("id").replace(/-button$/,"");if(t)t.open();else{var a=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(t=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:a})).on("select",function(){var e=t.state().get("selection").first().toJSON();g("#"+i).val(e.url),g("#"+i+"-yith-attachment-id")&&g("#"+i+"-yith-attachment-id").val(e.id),n.imgUrl.trigger("change")}),t.open()}}),g(document).on("click",n.resetButtonHandler,function(e){var t=g(this),i=t.attr("id"),a=t.attr("id").replace(/-button-reset$/,""),l=g("#"+i).data("default");g("#"+a).val(l),n.imgUrl.trigger("change")})}i.on("click",function(){!1}),"undefined"!=typeof wp&&void 0!==wp.media&&(g(document).on("click",a.buttonHandler,function(e){var t=g(this),i=t.closest(".image-gallery"),a=i.find(".image_gallery_ids"),l=a.val(),n=i.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:t.data("choose"),button:{text:t.data("update")},states:[new wp.media.controller.Library({title:t.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,n.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+t.data("delete")+'">x</a></li></ul></li>'))}),a.val(l)}),o.open()}),a.sliderWrapper.each(function(){var a=g(this);a.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(e,t){var i="";a.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");i=i+e+","}),a.closest(".image-gallery").find(".image_gallery_ids").val(i)}})}),a.sliderWrapper.on("click","a.delete",function(){var e=g(this).closest(".image-gallery"),t=g(this).closest(".image-gallery ul.slides-wrapper"),i=e.find(".image_gallery_ids"),a="";g(this).closest("li.image").remove(),t.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");a=a+e+","}),i.val(a)})),l.each(function(){g(this).find("img").on("click",function(){var e=g(this).closest(".yith-plugin-fw-sidebar-layout"),t=e.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),i=e.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=g(this).data("type");if(g(this).parent().children(":radio").attr("checked",!1),g(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":t.show(),i.hide();break;case"right":i.show(),t.hide();break;case"double":t.show(),i.show();break;default:t.hide(),i.hide()}})}),o.each(function(){var e=g(this).data("val"),t=g(this).data("min"),i=g(this).data("max"),a=g(this).data("step"),l=g(this).data("labels");g(this).slider({value:e,min:t,max:i,range:"min",step:a,create:function(){g(this).find(".ui-slider-handle").text(g(this).slider("value"))},slide:function(e,t){g(this).find("input").val(t.value),g(this).find(".ui-slider-handle").text(t.value),g(this).siblings(".feedback").find("strong").text(t.value+l)}})}),r.each(function(e,t){var i=CodeMirror.fromTextArea(t,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});g(t).data("codemirrorInstance",i)}),g(document).on("click",".yith-plugin-fw-select-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),g(document).on("click",".yith-plugin-fw-deselect-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var o=g(this),r=o.find(".yit-icons-manager-icon-preview").first(),d=o.find(".yit-icons-manager-icon-text");o.on("click",".yit-icons-manager-list li",function(e){var t=g(e.target).closest("li"),i=t.data("font"),a=t.data("icon"),l=t.data("key"),n=t.data("name");r.attr("data-font",i),r.attr("data-icon",a),r.attr("data-key",l),r.attr("data-name",n),d.val(i+":"+n),o.find(".yit-icons-manager-list li").removeClass("active"),t.addClass("active")}),o.on("click",".yit-icons-manager-action-set-default",function(){o.find(".yit-icons-manager-list li.default").trigger("click")})}),g(document).on("click",".yith-plugin-fw-select-images__item",function(){var e=g(this),t=e.data("key"),i=e.closest(".yith-plugin-fw-select-images__wrapper"),a=i.find(".yith-plugin-fw-select-images__item"),l=i.find("select").first();l.length&&(l.val(t),a.removeClass("yith-plugin-fw-select-images__item--selected"),e.addClass("yith-plugin-fw-select-images__item--selected"))}),g(document.body).trigger("wc-enhanced-select-init"),g(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(e,t){var i=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<i.length;a++)l[a]=g(i[a]).data("item_key");0<l.length&&g(this).closest(".toggle-element").saveToggleElement(null,l)}}),g(document.body).trigger("yith-framework-enhanced-select-init")}h(),g(document).on("click",".yith-plugin-fw-onoff-container span",function(){var e=g(this).prev("input");e.prop("checked")?e.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):e.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),e.change()}),g.fn.saveToggleElement=function(t,e){var i=g(this),a="yith_plugin_fw_save_toggle_element",l=i.serializeToggleElement(),n=i.find(".yith-toggle_wrapper").attr("id"),o=g.urlParam("tab");void 0!==e&&0<e.length&&l.append("yith_toggle_elements_order_keys",e),i.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=g(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=g(this).closest("form#post").find("#yit_metaboxes_nonce").val(),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+n):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+o+"&toggle_id="+n,g.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(e){t&&t.removeClass("show"),g(document).trigger("yith_save_toggle_element_done",[e,i])}})},g.fn.serializeToggleElement=function(){var e=g(this),i=new FormData,t=g(e).find(":input").serializeArray();return g.each(t,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},g.fn.formatToggleTitle=function(){var e=g(this),t=e.find(":input"),i=e.find("span.title").data("title_format"),a=e.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==i)var n=i.match(l);if(void 0!==a)var o=a.match(l);g.each(t,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=g(t).val(),null!=n&&void 0!==n&&-1!==n.indexOf($field_id)&&(i=i.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==i&&e.find("span.title").html(i),""!==a&&e.find(".subtitle").html(a),g(document).trigger("yith-toggle-element-item-title",[e])},g.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},g(document).on("click",".yith-toggle-title",function(e){var t=g(e.target),i=t.closest(".yith-toggle-row"),a=i.find(".yith-toggle-content");if(t.hasClass("yith-plugin-fw-onoff")||t.hasClass("yith-icon-drag"))return!1;i.is(".yith-toggle-row-opened")?a.slideUp(400):a.slideDown(400),i.toggleClass("yith-toggle-row-opened")}),g(document).on("click",".yith-add-box-button",function(e){e.preventDefault();var t=g(this),i=t.data("box_id"),a=t.data("closed_label"),l=t.data("opened_label"),n=t.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+n),""!==i&&(g("#"+i).html(template({index:"box_id"})).slideToggle(),""!==a&&(t.html()===a?t.html(l).removeClass("closed"):t.html(a).addClass("closed")),h(),g(document).trigger("yith-add-box-button-toggle",[t]))}),g(document).on("click",".yith-add-box-buttons .yith-save-button",function(e){e.preventDefault();var t=g(this).parents(".yith-add-box"),i=g(this).closest(".yith-toggle_wrapper").attr("id"),a=t.find(".spinner"),l=g(this).parents(".toggle-element"),n=t.find(":input"),o=l.find(".yith-toggle-row").length,r=g('<input type="hidden">');r.val(o),g(document).trigger("yith-toggle-change-counter",[r,t]),o=r.val();var d=wp.template("yith-toggle-element-item-"+i),s=g(d({index:o}));a.addClass("show"),g.each(n,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_val=g(t).val(),"radio"==g(t).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,g(t).is(":checked")&&g(s).find("#"+$field_id).prop("checked",!0),(g(t).hasClass("yith-post-search")||g(t).hasClass("yith-term-search"))&&g(s).find("#"+$field_id).html(g("#"+g(t).attr("id")).html()),g(s).find("#"+$field_id).val($field_val))}),g(s).formatToggleTitle();var c=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-add",[t,s,c]);setTimeout(function(){if("yes"===c.val()){g(l).find(".yith-toggle-elements").append(s),g(t).find(".yith-plugin-fw-datepicker").datepicker("destroy"),g(t).html(""),g(t).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){g(l).find(".highlight").removeClass("highlight")},2e3),h()}},1e3)}),g(document).on("click",".yith-toggle-row .yith-save-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element"),i=g(this).closest(".yith-toggle-row"),a=i.find(".spinner");i.formatToggleTitle();var l=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-update",[t,i,l]),"yes"===l.val()&&(a.addClass("show"),t.saveToggleElement(a))}),g(document).on("click",".yith-toggle-row .yith-delete-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element");g(this).closest(".yith-toggle-row").remove(),t.saveToggleElement()}),g(document).on("click",".yith-toggle-onoff",function(e){e.preventDefault(),g(this).closest(".toggle-element").saveToggleElement()}),g(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){g(this).closest(".yith-plugin-fw-radio").val(g(this).val()).trigger("change")}),g(document).on("click",".yith-password-eye",function(){var e=g(this),t=g(this).closest(".yith-password-wrapper").find("input");"password"===t.attr("type")?(t.attr("type","text"),e.addClass("yith-password-eye-closed")):(t.attr("type","password"),e.removeClass("yith-password-eye-closed"))}),g(".yith-plugin-fw-radio").each(function(){g(this).val(g(this).attr("value"))})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function(a){var r=function(){var b=a(".yith-plugin-fw-datepicker"),c=a(".yith-plugin-fw-colorpicker"),d=a(".yith-plugin-fw-upload-img-url"),f=a(".add_media"),h=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),g=a(".yith-plugin-fw-sidebar-layout"),l=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),m=a(".codemirror"),n=a(".yit-icons-manager-wrapper");a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();a(this).datepicker(b)});c.wpColorPicker({palettes:!1,
2
+ width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});c.each(function(){var b=a(this).data("variations-label"),e=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),p=a(this).closest(".yith-single-colorpicker"),q=e.find(".wp-picker-input-wrap"),c=p.find(".wp-picker-input-wrap");q.length&&e.find("a.wp-color-result").attr("title",b);p.length&&p.find("a.wp-color-result").attr("title",b);q.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),
3
+ q.find(".wp-picker-default").wrap(b));c.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),c.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(d.change(function(){var b=a(this).val(),e=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>e.length&&(e=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?
4
+ e.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):e.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var e=a(this).attr("id").replace(/-button$/,"");if(!k){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var k=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,
5
+ states:b});k.on("select",function(){var b=k.state().get("selection").first().toJSON();a("#"+e).val(b.url);a("#"+e+"-yith-attachment-id")&&a("#"+e+"-yith-attachment-id").val(b.id);d.trigger("change")})}k.open()}),a(document).on("click",".yith-plugin-fw-upload-button-reset",function(b){var e=a(this);b=e.attr("id");e=e.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+e).val(b);d.trigger("change")}));f.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&
6
+ (a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var e=a(this);b=e.closest(".image-gallery");var c=b.find(".image_gallery_ids"),k=c.val(),d=b.find("ul.slides-wrapper"),f=wp.media.frames.image_gallery=wp.media({title:e.data("choose"),button:{text:e.data("update")},states:[new wp.media.controller.Library({title:e.data("choose"),filterable:"all",multiple:!0})]});f.on("select",function(){f.state().get("selection").map(function(a){a=a.toJSON();a.id&&(k=k?k+","+a.id:a.id,d.append('<li class="image" data-attachment_id="'+
7
+ a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+e.data("delete")+'">x</a></li></ul></li>'))});c.val(k)});f.open()}),h.each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(e,c){var k="";b.find("li.image").css("cursor",
8
+ "default").each(function(){var b=a(this).attr("data-attachment_id");k=k+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(k)}})}),h.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),e=a(this).closest(".image-gallery ul.slides-wrapper");b=b.find(".image_gallery_ids");var c="";a(this).closest("li.image").remove();e.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");c=c+b+","});b.val(c)}));g.each(function(){a(this).find("img").on("click",
9
+ function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),e=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var c=a(this).data("type");a(this).parent().children(":radio").attr("checked",!1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof c)switch(c){case "left":e.show();b.hide();break;case "right":b.show();e.hide();break;case "double":e.show();b.show();break;default:e.hide(),b.hide()}})});
10
+ l.each(function(){var b=a(this).data("val"),e=a(this).data("min"),c=a(this).data("max"),d=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:e,max:c,range:"min",step:d,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,e){a(this).find("input").val(e.value);a(this).find(".ui-slider-handle").text(e.value);a(this).siblings(".feedback").find("strong").text(e.value+f)}})});m.each(function(b,e){var c=CodeMirror.fromTextArea(e,{lineNumbers:1,
11
+ mode:"javascript",showCursorWhenSelecting:!0});a(e).data("codemirrorInstance",c)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});n.each(function(){var b=a(this),e=b.find(".yit-icons-manager-icon-preview").first(),c=b.find(".yit-icons-manager-icon-text");
12
+ b.on("click",".yit-icons-manager-list li",function(d){d=a(d.target).closest("li");var f=d.data("font"),k=d.data("icon"),h=d.data("key"),g=d.data("name");e.attr("data-font",f);e.attr("data-icon",k);e.attr("data-key",h);e.attr("data-name",g);c.val(f+":"+g);b.find(".yit-icons-manager-list li").removeClass("active");d.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",
13
+ function(){var b=a(this),e=b.data("key"),c=b.closest(".yith-plugin-fw-select-images__wrapper"),d=c.find(".yith-plugin-fw-select-images__item");c=c.find("select").first();c.length&&(c.val(e),d.removeClass("yith-plugin-fw-select-images__item--selected"),b.addClass("yith-plugin-fw-select-images__item--selected"))});a(document.body).trigger("wc-enhanced-select-init");a(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",
14
+ stop:function(b,c){var e=jQuery(".ui-sortable-handle"),d,f=[];for(d=0;d<e.length;d++)f[d]=a(e[d]).data("item_key");0<f.length&&a(this).closest(".toggle-element").saveToggleElement(null,f)}});a(document.body).trigger("yith-framework-enhanced-select-init")};r();a(document).on("click",".yith-plugin-fw-onoff-container span",function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");
15
+ b.change()});a.fn.saveToggleElement=function(b,c){var d=a(this),f="yith_plugin_fw_save_toggle_element",h=d.serializeToggleElement(),g=d.find(".yith-toggle_wrapper"),l=g.attr("id"),m=a.urlParam("tab");h.append("security",g.data("nonce"));"undefined"!=typeof c&&0<c.length&&h.append("yith_toggle_elements_order_keys",c);d.closest(".metaboxes-tab.yith-plugin-ui").length?(f="yith_plugin_fw_save_toggle_element_metabox",post_id=a(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=a(this).closest("form#post").find("#yit_metaboxes_nonce").val(),
16
+ url=yith_framework_fw_fields.ajax_url+"?action="+f+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+l):url=yith_framework_fw_fields.admin_url+"?action="+f+"&tab="+m+"&toggle_id="+l;a.ajax({type:"POST",url:url,data:h,contentType:!1,processData:!1,success:function(c){b&&b.removeClass("show");a(document).trigger("yith_save_toggle_element_done",[c,d])}})};a.fn.serializeToggleElement=function(){var b=a(this),c=new FormData;b=a(b).find(":input").serializeArray();a.each(b,function(a,
17
+ b){el_name=b.name;c.append(b.name,b.value)});return c};a.fn.formatToggleTitle=function(){var b=a(this),c=b.find(":input"),d=b.find("span.title").data("title_format"),f=b.find(".subtitle").data("subtitle_format"),h=RegExp("[^%%]+(?=[%%])","g");if("undefined"!=typeof d)var g=d.match(h);if("undefined"!=typeof f)var l=f.match(h);a.each(c,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=
18
+ a(c).val(),null!=g&&"undefined"!=typeof g&&-1!==g.indexOf($field_id)&&(d=d.replace("%%"+$field_id+"%%",$field_val)),null!=l&&"undefined"!=typeof l&&-1!==l.indexOf($field_id)&&(f=f.replace("%%"+$field_id+"%%",$field_val)))});""!==d&&b.find("span.title").html(d);""!==f&&b.find(".subtitle").html(f);a(document).trigger("yith-toggle-element-item-title",[b])};a.urlParam=function(a){a=(new RegExp("[?&]"+a+"=([^&#]*)")).exec(window.location.search);return null!==a?a[1]||0:!1};a(document).on("click",".yith-toggle-title",
19
+ function(b){b=a(b.target);var c=b.closest(".yith-toggle-row"),d=c.find(".yith-toggle-content");if(b.hasClass("yith-plugin-fw-onoff")||b.hasClass("yith-icon-drag"))return!1;c.is(".yith-toggle-row-opened")?d.slideUp(400):d.slideDown(400);c.toggleClass("yith-toggle-row-opened")});a(document).on("click",".yith-add-box-button",function(b){b.preventDefault();b=a(this);var c=b.data("box_id"),d=b.data("closed_label"),f=b.data("opened_label"),h=b.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+
20
+ h);""!==c&&(a("#"+c).html(template({index:"box_id"})).slideToggle(),""!==d&&(b.html()===d?b.html(f).removeClass("closed"):b.html(d).addClass("closed")),r(),a(document).trigger("yith-add-box-button-toggle",[b]))});a(document).on("click",".yith-add-box-buttons .yith-save-button",function(b){b.preventDefault();var c=a(this).parents(".yith-add-box"),d=a(this).closest(".yith-toggle_wrapper").attr("id");b=c.find(".spinner");var f=a(this).parents(".toggle-element"),h=c.find(":input"),g=f.find(".yith-toggle-row").length,
21
+ l=a('<input type="hidden">');l.val(g);a(document).trigger("yith-toggle-change-counter",[l,c]);g=l.val();d=wp.template("yith-toggle-element-item-"+d);var m=a(d({index:g}));b.addClass("show");a.each(h,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_val=a(c).val(),"radio"==a(c).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+
22
+ g,a(c).is(":checked")&&a(m).find("#"+$field_id).prop("checked",!0),(a(c).hasClass("yith-post-search")||a(c).hasClass("yith-term-search"))&&a(m).find("#"+$field_id).html(a("#"+a(c).attr("id")).html()),a(m).find("#"+$field_id).val($field_val))});a(m).formatToggleTitle();var n=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-add",[c,m,n]);setTimeout(function(){"yes"===n.val()&&(a(f).find(".yith-toggle-elements").append(m),a(c).find(".yith-plugin-fw-datepicker").datepicker("destroy"),
23
+ a(c).html(""),a(c).prev(".yith-add-box-button").trigger("click"),f.saveToggleElement(),setTimeout(function(){a(f).find(".highlight").removeClass("highlight")},2E3),r())},1E3)});a(document).on("click",".yith-toggle-row .yith-save-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");var c=a(this).closest(".yith-toggle-row"),d=c.find(".spinner");c.formatToggleTitle();var f=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-update",[b,c,f]);
24
+ "yes"===f.val()&&(d.addClass("show"),b.saveToggleElement(d))});a(document).on("click",".yith-toggle-row .yith-delete-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");a(this).closest(".yith-toggle-row").remove();b.saveToggleElement()});a(document).on("click",".yith-toggle-onoff",function(b){b.preventDefault();a(this).closest(".toggle-element").saveToggleElement()});a(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){a(this).closest(".yith-plugin-fw-radio").val(a(this).val()).trigger("change")});
25
+ a(document).on("click",".yith-password-eye",function(){var b=a(this),c=a(this).closest(".yith-password-wrapper").find("input");"password"===c.attr("type")?(c.attr("type","text"),b.addClass("yith-password-eye-closed")):(c.attr("type","password"),b.removeClass("yith-password-eye-closed"))});a(".yith-plugin-fw-radio").each(function(){a(this).val(a(this).attr("value"))})});
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.3.9
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.3.9
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
@@ -123,4 +123,4 @@ if( ! function_exists( 'yit_get_upgrade_files' ) ){
123
 
124
  return $to_include;
125
  }
126
- }
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.3.13
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.3.11
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
123
 
124
  return $to_include;
125
  }
126
+ }
plugin-fw/lib/promo/yith-promo.php CHANGED
@@ -21,8 +21,8 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
21
  return false;
22
  }
23
 
24
- $base_url = apply_filters( 'yith_plugin_fw_promo_base_url', YIT_CORE_PLUGIN_PATH . '/lib/promo/' );
25
- $xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
26
  $transient = "yith_promo_message";
27
  $remote_data = get_site_transient( $transient );
28
  $regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
21
  return false;
22
  }
23
 
24
+ $base_url = apply_filters( 'yith_plugin_fw_promo_base_url', YIT_CORE_PLUGIN_URL . '/lib/promo/' );
25
+ $xml = apply_filters( 'yith_plugin_fw_promo_xml_url', YIT_CORE_PLUGIN_PATH . '/lib/promo/yith-promo.xml' );
26
  $transient = "yith_promo_message";
27
  $remote_data = get_site_transient( $transient );
28
  $regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
plugin-fw/lib/yit-assets.php CHANGED
@@ -50,8 +50,11 @@ if ( !class_exists( 'YIT_Assets' ) ) {
50
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
51
 
52
  //scripts
53
- wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider', 'jquery-ui-sortable' ), $this->version, true );
54
- wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'yith-plugin-fw-fields' ), $this->version, true );
 
 
 
55
  wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'yith-plugin-fw-fields' ), $this->version, true );
56
  wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
57
  wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
50
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
51
 
52
  //scripts
53
+ wp_register_script( 'yith-colorpicker', YIT_CORE_PLUGIN_URL . '/assets/js/yith-colorpicker.min.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
54
+
55
+ wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'yith-colorpicker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider', 'jquery-ui-sortable' ), $this->version, true );
56
+
57
+ wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'yith-plugin-fw-fields' ), $this->version, true );
58
  wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'yith-plugin-fw-fields' ), $this->version, true );
59
  wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
60
  wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
plugin-fw/lib/yit-cpt-unlimited.php CHANGED
@@ -1590,8 +1590,9 @@ class YIT_CPT_Unlimited {
1590
  * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1591
  */
1592
  public function admin_assets() {
 
1593
  wp_enqueue_media();
1594
- wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited.js', array('jquery'), '', true );
1595
  }
1596
 
1597
  /**
@@ -1619,6 +1620,7 @@ class YIT_CPT_Unlimited {
1619
  if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
1620
  return;
1621
  }
 
1622
  ?>
1623
  <script>
1624
  (function($) {
@@ -1629,7 +1631,8 @@ class YIT_CPT_Unlimited {
1629
  href: '#',
1630
  class: 'multi-uploader add-new-h2',
1631
  'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
1632
- 'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>'
 
1633
  }).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
1634
 
1635
  var spinner = $('<span />', {
@@ -1652,6 +1655,9 @@ class YIT_CPT_Unlimited {
1652
  * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1653
  */
1654
  public function post_multiuploader() {
 
 
 
1655
  if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
1656
  return;
1657
  }
1590
  * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1591
  */
1592
  public function admin_assets() {
1593
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1594
  wp_enqueue_media();
1595
+ wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited' . $suffix . 'js', array('jquery'), '', true );
1596
  }
1597
 
1598
  /**
1620
  if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
1621
  return;
1622
  }
1623
+
1624
  ?>
1625
  <script>
1626
  (function($) {
1631
  href: '#',
1632
  class: 'multi-uploader add-new-h2',
1633
  'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
1634
+ 'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>',
1635
+ 'data-nonce': '<?php echo wp_create_nonce( 'cpt-unlimited-multiuploader' ); ?>'
1636
  }).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
1637
 
1638
  var spinner = $('<span />', {
1655
  * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1656
  */
1657
  public function post_multiuploader() {
1658
+
1659
+ check_ajax_referer( 'cpt-unlimited-multiuploader' );
1660
+
1661
  if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
1662
  return;
1663
  }
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -608,6 +608,13 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
608
  * @author Emanuela Castorina
609
  */
610
  public function save_toggle_element_options() {
 
 
 
 
 
 
 
611
  $posted = $_POST;
612
  $tabs = $this->get_available_tabs();
613
  $yit_options = $this->get_main_array_options();
@@ -615,7 +622,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
615
  $option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
616
  $updated = false;
617
 
618
- if ( !empty( $yit_options[ $current_tab ] ) && !empty( $option_id ) ) {
619
 
620
  $tab_options = $yit_options[ $current_tab ];
621
  foreach ( $tab_options as $key => $item ) {
608
  * @author Emanuela Castorina
609
  */
610
  public function save_toggle_element_options() {
611
+
612
+ check_ajax_referer( 'save-toggle-element', 'security' );
613
+
614
+ if( ! current_user_can( $this->settings['capability'] ) ){
615
+ wp_die( -1 );
616
+ }
617
+
618
  $posted = $_POST;
619
  $tabs = $this->get_available_tabs();
620
  $yit_options = $this->get_main_array_options();
622
  $option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
623
  $updated = false;
624
 
625
+ if ( ! empty( $yit_options[ $current_tab ] ) && ! empty( $option_id ) ) {
626
 
627
  $tab_options = $yit_options[ $current_tab ];
628
  foreach ( $tab_options as $key => $item ) {
plugin-fw/lib/yith-system-status.php CHANGED
@@ -81,6 +81,14 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
81
  return;
82
  }
83
 
 
 
 
 
 
 
 
 
84
  $system_info = get_option( 'yith_system_info' );
85
  $error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
86
 
@@ -159,6 +167,7 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
159
  */
160
  public function check_system_status() {
161
 
 
162
  if ( '' == get_option( 'yith_system_info' ) || ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) ) {
163
 
164
  $this->add_requirements( __( 'YITH Plugins', 'yith-plugin-fw' ), array( 'min_wp_version' => '4.9', 'min_wc_version' => '3.4', 'min_php_version' => '5.6.20' ) );
@@ -200,7 +209,7 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
200
  break;
201
 
202
  default:
203
- if ( ! version_compare( $value, $required_value, '>=' ) ) {
204
  $check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
205
  $errors = true;
206
  }
@@ -297,9 +306,9 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
297
  */
298
  public function get_system_info() {
299
 
300
- $tls = '';
301
 
302
- if ( function_exists( 'curl_init' ) ) {
303
  //Get TLS version
304
  $ch = curl_init();
305
  curl_setopt( $ch, CURLOPT_URL, 'https://www.howsmyssl.com/a/check' );
@@ -322,15 +331,14 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
322
  $wp_memory_limit = max( $wp_memory_limit, $this->memory_size_to_num( @ini_get( 'memory_limit' ) ) );
323
  }
324
 
325
- $imagick_version = '0.0.0';
326
- if ( class_exists( 'Imagick' ) ) {
327
  preg_match( "/([0-9]+\.[0-9]+\.[0-9]+)/", Imagick::getVersion()['versionString'], $imatch );
328
  $imagick_version = $imatch[0];
329
  }
330
 
331
  return apply_filters( 'yith_system_additional_check', array(
332
  'min_wp_version' => get_bloginfo( 'version' ),
333
- 'min_wc_version' => function_exists( 'WC' ) ? WC()->version : __( 'Not installed', 'yith-plugin-fw' ),
334
  'wp_memory_limit' => $wp_memory_limit,
335
  'min_php_version' => $php_version,
336
  'min_tls_version' => $tls,
@@ -357,8 +365,9 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
357
  * @author Alberto Ruggiero
358
  */
359
  public function memory_size_to_num( $memory_size ) {
360
- $unit = strtoupper( substr( $memory_size, - 1 ) );
361
- $size = substr( $memory_size, 0, - 1 );
 
362
  $multiplier = array(
363
  'P' => 5,
364
  'T' => 4,
@@ -366,8 +375,11 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
366
  'M' => 2,
367
  'K' => 1,
368
  );
369
- for ( $i = 1; $i <= $multiplier[ $unit ]; $i ++ ) {
370
- $size *= 1024;
 
 
 
371
  }
372
 
373
  return $size;
81
  return;
82
  }
83
 
84
+ /**
85
+ * Add to prevent trigger admin_init called directly
86
+ * wp-admin/admin-post.php?page=yith_system_info
87
+ */
88
+ if ( ! is_user_logged_in() ) {
89
+ return;
90
+ }
91
+
92
  $system_info = get_option( 'yith_system_info' );
93
  $error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
94
 
167
  */
168
  public function check_system_status() {
169
 
170
+
171
  if ( '' == get_option( 'yith_system_info' ) || ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) ) {
172
 
173
  $this->add_requirements( __( 'YITH Plugins', 'yith-plugin-fw' ), array( 'min_wp_version' => '4.9', 'min_wc_version' => '3.4', 'min_php_version' => '5.6.20' ) );
209
  break;
210
 
211
  default:
212
+ if ( ! version_compare( $value, $required_value, '>=' ) && $value != 'n/a' ) {
213
  $check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
214
  $errors = true;
215
  }
306
  */
307
  public function get_system_info() {
308
 
309
+ $tls = $imagick_version = 'n/a';
310
 
311
+ if ( function_exists( 'curl_init' ) && apply_filters( 'yith_system_status_check_ssl', true ) ) {
312
  //Get TLS version
313
  $ch = curl_init();
314
  curl_setopt( $ch, CURLOPT_URL, 'https://www.howsmyssl.com/a/check' );
331
  $wp_memory_limit = max( $wp_memory_limit, $this->memory_size_to_num( @ini_get( 'memory_limit' ) ) );
332
  }
333
 
334
+ if ( class_exists( 'Imagick' ) && is_callable( array( 'Imagick', 'getVersion' ) ) ) {
 
335
  preg_match( "/([0-9]+\.[0-9]+\.[0-9]+)/", Imagick::getVersion()['versionString'], $imatch );
336
  $imagick_version = $imatch[0];
337
  }
338
 
339
  return apply_filters( 'yith_system_additional_check', array(
340
  'min_wp_version' => get_bloginfo( 'version' ),
341
+ 'min_wc_version' => function_exists( 'WC' ) ? WC()->version : 'n/a',
342
  'wp_memory_limit' => $wp_memory_limit,
343
  'min_php_version' => $php_version,
344
  'min_tls_version' => $tls,
365
  * @author Alberto Ruggiero
366
  */
367
  public function memory_size_to_num( $memory_size ) {
368
+ $unit = strtoupper( substr( $memory_size, - 1 ) );
369
+ $size = substr( $memory_size, 0, - 1 );
370
+
371
  $multiplier = array(
372
  'P' => 5,
373
  'T' => 4,
375
  'M' => 2,
376
  'K' => 1,
377
  );
378
+
379
+ if ( isset( $multiplier[ $unit ] ) ) {
380
+ for ( $i = 1; $i <= $multiplier[ $unit ]; $i ++ ) {
381
+ $size *= 1024;
382
+ }
383
  }
384
 
385
  return $size;
plugin-fw/templates/fields/colorpicker.php CHANGED
@@ -16,7 +16,7 @@ wp_enqueue_style( 'wp-color-picker' );
16
 
17
  extract( $field );
18
 
19
- $class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker';
20
  $default = isset( $default ) ? $default : '';
21
  if( isset($std) && !empty( $std) && empty($default) ){
22
  $default = $std;
@@ -26,7 +26,7 @@ if( isset($std) && !empty( $std) && empty($default) ){
26
  <input type="text" name="<?php echo $name ?>"
27
  id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
28
  <?php if ( isset( $default ) ) : ?> data-default-color="<?php echo $default ?>"<?php endif ?>
29
- class="<?php echo $class ?>"
30
  <?php echo $custom_attributes ?>
31
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
32
 
16
 
17
  extract( $field );
18
 
19
+ $class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker color-picker';
20
  $default = isset( $default ) ? $default : '';
21
  if( isset($std) && !empty( $std) && empty($default) ){
22
  $default = $std;
26
  <input type="text" name="<?php echo $name ?>"
27
  id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
28
  <?php if ( isset( $default ) ) : ?> data-default-color="<?php echo $default ?>"<?php endif ?>
29
+ class="<?php echo $class ?>" data-alpha="true"
30
  <?php echo $custom_attributes ?>
31
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
32
 
plugin-fw/templates/fields/toggle-element.php CHANGED
@@ -31,6 +31,7 @@ $values = maybe_unserialize( $values );
31
  $sortable = isset( $sortable ) ? $sortable : false;
32
  $class_wrapper = $sortable ? 'ui-sortable' : '';
33
  $onoff_id = isset( $onoff_field['id'] ) ? $onoff_field['id'] : '';
 
34
 
35
  if ( empty( $values ) && ! $show_add_button && $elements ) {
36
  $values = array();
@@ -41,7 +42,7 @@ if ( empty( $values ) && ! $show_add_button && $elements ) {
41
  }
42
 
43
  ?>
44
- <div class="yith-toggle_wrapper <?php echo $class_wrapper ?>" id="<?php echo $id ?>">
45
  <?php
46
 
47
  if ( $show_add_button ):
31
  $sortable = isset( $sortable ) ? $sortable : false;
32
  $class_wrapper = $sortable ? 'ui-sortable' : '';
33
  $onoff_id = isset( $onoff_field['id'] ) ? $onoff_field['id'] : '';
34
+ $ajax_nonce = wp_create_nonce( 'save-toggle-element' );
35
 
36
  if ( empty( $values ) && ! $show_add_button && $elements ) {
37
  $values = array();
42
  }
43
 
44
  ?>
45
+ <div class="yith-toggle_wrapper <?php echo $class_wrapper ?>" id="<?php echo $id ?>" data-nonce="<?php echo $ajax_nonce; ?>">
46
  <?php
47
 
48
  if ( $show_add_button ):
plugin-fw/templates/sysinfo/system-information-panel.php CHANGED
@@ -9,7 +9,7 @@
9
  */
10
 
11
  $system_info = get_option( 'yith_system_info' );
12
- $recommended_memory = '128M';
13
 
14
  ?>
15
  <div id="yith-sysinfo" class="wrap yith-system-info">
@@ -28,6 +28,8 @@ $recommended_memory = '128M';
28
 
29
  if ( $key == 'wp_memory_limit' && ! $has_errors ) {
30
  $has_warnings = $item['value'] < $recommended_memory;
 
 
31
  }
32
 
33
  ?>
@@ -43,7 +45,13 @@ $recommended_memory = '128M';
43
  } elseif ( $key == 'wp_memory_limit' ) {
44
  echo esc_html( size_format( $item['value'] ) );
45
  } else {
46
- echo $item['value'];
 
 
 
 
 
 
47
  } ?>
48
 
49
  </td>
@@ -57,10 +65,14 @@ $recommended_memory = '128M';
57
  } elseif ( $key == 'wp_memory_limit' ) {
58
  echo sprintf( __( '%s needs at least %s of available memory', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $requirement ) ) ) . '</span>' );
59
  echo '<br/>';
60
- echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $recommended_memory ) ) ) . '</span>' );
 
 
61
 
62
  } else {
63
  echo sprintf( __( '%s needs at least %s version', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . $requirement . '</span>' );
 
 
64
  } ?>
65
  </li>
66
  <?php endforeach; ?>
@@ -74,7 +86,9 @@ $recommended_memory = '128M';
74
  case 'min_php_version':
75
  case 'min_tls_version':
76
  case 'imagick_version':
77
- echo __( 'Contact your hosting company in order to update it.', 'yith-plugin-fw' );
 
 
78
  break;
79
  case 'wp_cron_enabled':
80
  echo sprintf( __( 'Remove %s from %s file', 'yith-plugin-fw' ), '<code>define( \'DISABLE_WP_CRON\', true );</code>', '<b>wp-config.php</b>' );
@@ -96,14 +110,28 @@ $recommended_memory = '128M';
96
  } ?>
97
  <?php endif; ?>
98
 
99
- <?php if ( $has_warnings ) : ?>
100
- <ul>
101
- <li>
102
- <?php echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="warning">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $recommended_memory ) ) ) . '</span>' ); ?>
103
- </li>
104
- </ul>
105
- <?php echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' ); ?>
106
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  </td>
108
  </tr>
109
  <?php endforeach; ?>
9
  */
10
 
11
  $system_info = get_option( 'yith_system_info' );
12
+ $recommended_memory = 134217728;
13
 
14
  ?>
15
  <div id="yith-sysinfo" class="wrap yith-system-info">
28
 
29
  if ( $key == 'wp_memory_limit' && ! $has_errors ) {
30
  $has_warnings = $item['value'] < $recommended_memory;
31
+ } elseif ( ( $key == 'min_tls_version' || $key == 'imagick_version' ) && ! $has_errors ) {
32
+ $has_warnings = $item['value'] == 'n/a';
33
  }
34
 
35
  ?>
45
  } elseif ( $key == 'wp_memory_limit' ) {
46
  echo esc_html( size_format( $item['value'] ) );
47
  } else {
48
+
49
+ if ( $item['value'] == 'n/a' ) {
50
+ echo __( 'N/A', 'yith-plugin-fw' );
51
+ } else {
52
+ echo $item['value'];
53
+ }
54
+
55
  } ?>
56
 
57
  </td>
65
  } elseif ( $key == 'wp_memory_limit' ) {
66
  echo sprintf( __( '%s needs at least %s of available memory', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $requirement ) ) ) . '</span>' );
67
  echo '<br/>';
68
+ echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( $recommended_memory ) ) . '</span>' );
69
+ echo '<br/>';
70
+ echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' );
71
 
72
  } else {
73
  echo sprintf( __( '%s needs at least %s version', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . $requirement . '</span>' );
74
+
75
+
76
  } ?>
77
  </li>
78
  <?php endforeach; ?>
86
  case 'min_php_version':
87
  case 'min_tls_version':
88
  case 'imagick_version':
89
+ if ( $item['value'] != 'n/a' ) {
90
+ echo __( 'Contact your hosting company in order to update it.', 'yith-plugin-fw' );
91
+ }
92
  break;
93
  case 'wp_cron_enabled':
94
  echo sprintf( __( 'Remove %s from %s file', 'yith-plugin-fw' ), '<code>define( \'DISABLE_WP_CRON\', true );</code>', '<b>wp-config.php</b>' );
110
  } ?>
111
  <?php endif; ?>
112
 
113
+ <?php if ( $has_warnings ) {
114
+
115
+ if ( $item['value'] != 'n/a' ) {
116
+
117
+ echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( $recommended_memory ) ) . '</span>' );
118
+ echo '<br/>';
119
+ echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' );
120
+
121
+ } else {
122
+
123
+ switch ( $key ) {
124
+ case 'min_tls_version':
125
+ echo __( 'We cannot determine which <b>TLS</b> version is installed because <b>cURL</b> module is disabled. Ask your hosting company to enable it.', 'yith-plugin-fw' );
126
+ break;
127
+ case 'imagick_version':
128
+ echo __( '<b>ImageMagick</b> module is not installed. Ask your hosting company to install it.', 'yith-plugin-fw' );
129
+ break;
130
+ }
131
+
132
+ }
133
+
134
+ } ?>
135
  </td>
136
  </tr>
137
  <?php endforeach; ?>
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -1085,7 +1085,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
1085
  $this->found = true;
1086
  }
1087
 
1088
- $arg = apply_filters('yith_wcan_list_type_query_arg', 'filter_' . sanitize_title($instance['attribute']), $display_type, $term);
1089
 
1090
  $current_filter = (isset($_GET[$arg])) ? explode(apply_filters('yith_wcan_list_filter_operator', ',', $display_type), apply_filters("yith_wcan_list_filter_query_{$arg}", $_GET[$arg] ) ) : array();
1091
 
@@ -1217,6 +1217,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
1217
  }
1218
 
1219
  // Remove this term is $current_filter has more than 1 term filtered
 
1220
  if (sizeof($current_filter) > 1) {
1221
  $current_filter_without_this = array_diff($current_filter, array($term_param));
1222
  $link = add_query_arg($arg, implode(apply_filters('yith_wcan_list_filter_operator', ',', $display_type), $current_filter_without_this), $link);
1085
  $this->found = true;
1086
  }
1087
 
1088
+ $arg = apply_filters('yith_wcan_list_type_query_arg', 'filter_' . sanitize_title($instance['attribute']), $display_type, $term, $instance['attribute']);
1089
 
1090
  $current_filter = (isset($_GET[$arg])) ? explode(apply_filters('yith_wcan_list_filter_operator', ',', $display_type), apply_filters("yith_wcan_list_filter_query_{$arg}", $_GET[$arg] ) ) : array();
1091
 
1217
  }
1218
 
1219
  // Remove this term is $current_filter has more than 1 term filtered
1220
+
1221
  if (sizeof($current_filter) > 1) {
1222
  $current_filter_without_this = array_diff($current_filter, array($term_param));
1223
  $link = add_query_arg($arg, implode(apply_filters('yith_wcan_list_filter_operator', ',', $display_type), $current_filter_without_this), $link);