YITH WooCommerce Ajax Product Filter - Version 3.5.1

Version Description

  • Released on 14th March, 2018 =

  • Tweak: Removed old YITH_WCAN_Helper class

  • Updated: Plugin core framework

  • Fix: Unable to reset filters in product categories page

  • Fix: PHP Notice: Undefined index: display

  • Fix: $count not defined in loop

Download this release

Release Info

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

Code changes from version 3.5.0 to 3.5.1

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: 4.9.2
7
- Stable tag: 3.5.0
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.5.0 - Released: 01 Feb, 2018 =
163
 
164
  * New: 100% German translation (Thanks to Thomas)
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: 4.9.4
7
+ Stable tag: 3.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.5.1 - Released on 14th March, 2018 =
163
+
164
+ * Tweak: Removed old YITH_WCAN_Helper class
165
+ * Updated: Plugin core framework
166
+ * Fix: Unable to reset filters in product categories page
167
+ * Fix: PHP Notice: Undefined index: display
168
+ * Fix: $count not defined in loop
169
+
170
  = 3.5.0 - Released: 01 Feb, 2018 =
171
 
172
  * New: 100% German translation (Thanks to Thomas)
assets/css/frontend.css CHANGED
@@ -19,7 +19,8 @@
19
  }
20
 
21
  /* Colors Type */
22
- ul.yith-wcan-color.yith-wcan.yith-wcan-group {
 
23
  list-style: none;
24
  margin-left: 0;
25
  }
@@ -164,7 +165,8 @@ ul.yith-wcan-color.yith-wcan.yith-wcan-group {
164
  color: #838383;
165
  }
166
 
167
- .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a, .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a {
 
168
  background: transparent url(../images/cross.png) bottom 6px left no-repeat;
169
  border: none;
170
  }
@@ -214,7 +216,8 @@ ul.yith-wcan-color.yith-wcan.yith-wcan-group {
214
  .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
215
  a.yith-wcan-onsale-button.active:before,
216
  a.yith-wcan-instock-button.active:before,
217
- a.yith-wcan-price-link.active:before {
 
218
  font-family: WooCommerce;
219
  speak: none;
220
  font-variant: normal;
19
  }
20
 
21
  /* Colors Type */
22
+ ul.yith-wcan-color.yith-wcan.yith-wcan-group,
23
+ ul.yith-wcan-list {
24
  list-style: none;
25
  margin-left: 0;
26
  }
165
  color: #838383;
166
  }
167
 
168
+ .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a,
169
+ .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a {
170
  background: transparent url(../images/cross.png) bottom 6px left no-repeat;
171
  border: none;
172
  }
216
  .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
217
  a.yith-wcan-onsale-button.active:before,
218
  a.yith-wcan-instock-button.active:before,
219
+ a.yith-wcan-price-link.active:before,
220
+ ul.yith-wcan-list li.chosen a:before{
221
  font-family: WooCommerce;
222
  speak: none;
223
  font-variant: normal;
includes/class.yith-wcan-frontend.php CHANGED
@@ -73,6 +73,8 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
73
 
74
  add_filter( 'woocommerce_layered_nav_link', 'yit_plus_character_hack', 99 );
75
 
 
 
76
  // YITH WCAN Loaded
77
  do_action( 'yith_wcan_loaded' );
78
  }
73
 
74
  add_filter( 'woocommerce_layered_nav_link', 'yit_plus_character_hack', 99 );
75
 
76
+ add_filter( 'woocommerce_is_filtered', 'yit_is_filtered_uri', 20 );
77
+
78
  // YITH WCAN Loaded
79
  do_action( 'yith_wcan_loaded' );
80
  }
includes/class.yith-wcan-helper.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCAN' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCAN_Helper' ) ) {
15
- /**
16
- * YITH WooCommerce Ajax Navigation Helper
17
- *
18
- * @since 1.0.0
19
- */
20
- class YITH_WCAN_Helper {
21
-
22
- /*
23
- * Get Woocommerce Attribute Taxonomies
24
- *
25
- * @since 1.0.0
26
- * @access public
27
- */
28
- public static function attribute_taxonomies() {
29
- $_woocommerce = WC();
30
-
31
- if ( ! isset( $_woocommerce ) ) {
32
- return array();
33
- }
34
-
35
- $attributes = array();
36
- if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
37
- $attribute_taxonomies = wc_get_attribute_taxonomies();
38
- }
39
- else {
40
- $attribute_taxonomies = WC()->get_attribute_taxonomies();
41
- }
42
-
43
- if ( empty( $attribute_taxonomies ) ) {
44
- return array();
45
- }
46
- foreach ( $attribute_taxonomies as $attribute ) {
47
-
48
- /* FIX TO WOOCOMMERCE 2.1 */
49
- if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
50
- $taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
51
- }
52
- else {
53
- $taxonomy = WC()->attribute_taxonomy_name( $attribute->attribute_name );
54
- }
55
-
56
-
57
- if ( taxonomy_exists( $taxonomy ) ) {
58
- $attributes[] = $attribute->attribute_name;
59
- }
60
- }
61
-
62
- return $attributes;
63
- }
64
-
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class.yith-wcan.php CHANGED
@@ -190,7 +190,6 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
190
  'includes/functions.yith-wcan.php',
191
  'includes/class.yith-wcan-admin.php',
192
  'includes/class.yith-wcan-frontend.php',
193
- 'includes/class.yith-wcan-helper.php',
194
  'widgets/class.yith-wcan-navigation-widget.php',
195
  'widgets/class.yith-wcan-reset-navigation-widget.php',
196
  )
190
  'includes/functions.yith-wcan.php',
191
  'includes/class.yith-wcan-admin.php',
192
  'includes/class.yith-wcan-frontend.php',
 
193
  'widgets/class.yith-wcan-navigation-widget.php',
194
  'widgets/class.yith-wcan-reset-navigation-widget.php',
195
  )
includes/functions.yith-wcan.php CHANGED
@@ -16,12 +16,43 @@ if ( ! defined( 'YITH_WCAN' ) ) {
16
  * Return a dropdown with Woocommerce attributes
17
  */
18
  function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
19
- $attributes = YITH_WCAN_Helper::attribute_taxonomies();
20
- $options = "";
 
21
 
22
- foreach ( $attributes as $attribute ) {
23
- $options .= "<option name='{$attribute}'" . selected( $attribute, $selected, false ) . ">{$attribute}</option>";
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  if ( $echo ) {
27
  echo $options;
@@ -777,4 +808,5 @@ if( ! function_exists( 'yith_wcan_brands_enabled' ) ){
777
  function yith_wcan_brands_enabled() {
778
  return apply_filters( 'yith_wcan_brands_enabled', defined( 'YITH_WCBR' ) && YITH_WCBR );
779
  }
780
- }
 
16
  * Return a dropdown with Woocommerce attributes
17
  */
18
  function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
19
+ $_woocommerce = function_exists( 'wc' ) ? wc() : null;
20
+ $options = "";
21
+ $attributes = array();
22
 
23
+ if ( ! empty( $_woocommerce ) ) {
24
+
25
+ if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
26
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
27
+ }
28
+ else {
29
+ $attribute_taxonomies = $_woocommerce->get_attribute_taxonomies();
30
+ }
31
+
32
+ if ( empty( $attribute_taxonomies ) ) {
33
+ return array();
34
+ }
35
+
36
+ foreach ( $attribute_taxonomies as $attribute ) {
37
+
38
+ /* FIX TO WOOCOMMERCE 2.1 */
39
+ if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
40
+ $taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
41
+ }
42
+ else {
43
+ $taxonomy = $_woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
44
+ }
45
+
46
+
47
+ if ( taxonomy_exists( $taxonomy ) ) {
48
+ $attributes[] = $attribute->attribute_name;
49
+ }
50
+ }
51
+
52
+ foreach ( $attributes as $attribute ) {
53
+ $options .= "<option name='{$attribute}'" . selected( $attribute, $selected, false ) . ">{$attribute}</option>";
54
+ }
55
+ }
56
 
57
  if ( $echo ) {
58
  echo $options;
808
  function yith_wcan_brands_enabled() {
809
  return apply_filters( 'yith_wcan_brands_enabled', defined( 'YITH_WCBR' ) && YITH_WCBR );
810
  }
811
+ }
812
+
init.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
- * Version: 3.5.0
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
10
  * Domain Path: /languages/
11
  *
12
  * WC requires at least: 2.2.0
13
- * WC tested up to: 3.3.0
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.5.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
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
+ * Version: 3.5.1
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
10
  * Domain Path: /languages/
11
  *
12
  * WC requires at least: 2.2.0
13
+ * WC tested up to: 3.3.3
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.5.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
 
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
@@ -46,8 +46,8 @@
46
  }
47
 
48
  #plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
49
- padding : 0px 10px 10px;
50
- border-bottom : 1px solid #eee;
51
  }
52
 
53
  /* === Plugins Upgrader === */
46
  }
47
 
48
  #plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
49
+ padding : 0 0 0 10px;
50
+ margin : 0;
51
  }
52
 
53
  /* === Plugins Upgrader === */
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -55,7 +55,7 @@
55
  }
56
 
57
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
58
- .yith-plugin-fw input[type=text].colorpick{
59
  width : 6em;
60
  max-width : none;
61
  height : auto;
@@ -66,7 +66,7 @@
66
  .yith-plugin-fw .select2-container .select2-search--inline .select2-search__field,
67
  .woocommerce .yith-plugin-fw input.select2-search__field,
68
  .woocommerce .yith-plugin-fw table.form-table input.select2-search__field {
69
- padding : 3px;
70
  }
71
 
72
  .yith-plugin-fw textarea {
@@ -230,6 +230,15 @@ ul.yit-icons-manager-list li.active {
230
  max-height : 200px;
231
  }
232
 
 
 
 
 
 
 
 
 
 
233
  /* ------- Sidebar Layout ------- */
234
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
235
  display : none;
55
  }
56
 
57
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
58
+ .yith-plugin-fw input[type=text].colorpick {
59
  width : 6em;
60
  max-width : none;
61
  height : auto;
66
  .yith-plugin-fw .select2-container .select2-search--inline .select2-search__field,
67
  .woocommerce .yith-plugin-fw input.select2-search__field,
68
  .woocommerce .yith-plugin-fw table.form-table input.select2-search__field {
69
+ padding : 3px;
70
  }
71
 
72
  .yith-plugin-fw textarea {
230
  max-height : 200px;
231
  }
232
 
233
+ /* ------- Radio ------- */
234
+ .yith-plugin-fw-radio input[type=radio] {
235
+ margin : 0 3px 0 0;
236
+ }
237
+
238
+ .yith-plugin-fw-radio__row {
239
+ margin-bottom : 8px;
240
+ }
241
+
242
  /* ------- Sidebar Layout ------- */
243
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
244
  display : none;
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.0.12
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.0.12
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.0.13
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.0.13
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -604,8 +604,11 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
604
  return $this->_main_array_options;
605
  }
606
 
 
 
607
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $v ) {
608
- $path = $this->settings[ 'options-path' ] . '/' . $item . '-options.php';
 
609
  if ( file_exists( $path ) ) {
610
  $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
611
  }
604
  return $this->_main_array_options;
605
  }
606
 
607
+ $options_path = $this->settings[ 'options-path' ];
608
+
609
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $v ) {
610
+ $path = $options_path . '/' . $item . '-options.php';
611
+ $path = apply_filters( 'yith_plugin_panel_item_options_path', $path, $options_path, $item, $this );
612
  if ( file_exists( $path ) ) {
613
  $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
614
  }
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -103,6 +103,7 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
103
  $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
104
  $remote_xml = wp_remote_get( $xml );
105
 
 
106
  if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
107
  $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
108
  if ( $plugin_remote_info ) {
@@ -111,9 +112,18 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
111
  YIT_Plugin_Licence()->check( $plugin_slug, false );
112
  set_transient( $transient, $info, DAY_IN_SECONDS );
113
  } else {
 
114
  error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
115
  __FILE__, __FUNCTION__, $plugin_slug ) );
116
  }
 
 
 
 
 
 
 
 
117
  }
118
  }
119
 
103
  $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
104
  $remote_xml = wp_remote_get( $xml );
105
 
106
+ $error = false;
107
  if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
108
  $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
109
  if ( $plugin_remote_info ) {
112
  YIT_Plugin_Licence()->check( $plugin_slug, false );
113
  set_transient( $transient, $info, DAY_IN_SECONDS );
114
  } else {
115
+ $error = true;
116
  error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
117
  __FILE__, __FUNCTION__, $plugin_slug ) );
118
  }
119
+ } else {
120
+ $error = true;
121
+ }
122
+
123
+ if ( $error ) {
124
+ // If error, set empty value in the transient to prevent multiple requests
125
+ $info = array( 'Latest' => '', 'changelog' => '' );
126
+ set_transient( $transient, $info, HOUR_IN_SECONDS );
127
  }
128
  }
129
 
plugin-fw/templates/fields/radio.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var array $field
11
+ */
12
+
13
+ /** @since 3.0.13 */
14
+
15
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
16
+
17
+ extract( $field );
18
+
19
+ $class = isset( $class ) ? $class : '';
20
+ $class = 'yith-plugin-fw-radio ' . $class;
21
+ ?>
22
+ <div class="<?php echo $class ?>" id="<?php echo $id ?>"
23
+ <?php echo $custom_attributes ?>
24
+ <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?> value="<?php echo $value ?>">
25
+ <?php foreach ( $options as $key => $label ) :
26
+ $radio_id = sanitize_key( $id . '-' . $key );
27
+ ?>
28
+ <div class="yith-plugin-fw-radio__row">
29
+ <input type="radio" id="<?php echo $radio_id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $key ) ?>" <?php checked( $key, $value ); ?> />
30
+ <label for="<?php echo $radio_id ?>"><?php echo $label ?></label>
31
+ </div>
32
+ <?php endforeach; ?>
33
+ </div>
plugin-fw/templates/metaboxes/types/icon-list.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ /**
12
+ * Awesome Icon Admin View
13
+ *
14
+ * @package Yithemes
15
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
16
+ * @since 1.0.0
17
+ */
18
+
19
+ extract( $args );
20
+
21
+
22
+ if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23
+
24
+ $current_options = wp_parse_args( $args[ 'value' ], $args[ 'std' ] );
25
+ $current_icon = YIT_Icon()->get_icon_data( $current_options[ 'icon' ] );
26
+ $std_icon = YIT_Icon()->get_icon_data( $std[ 'icon' ] );
27
+
28
+ $options[ 'icon' ] = YIT_Plugin_Common::get_icon_list();
29
+
30
+ ?>
31
+
32
+
33
+ <div id="<?php echo $id ?>-container" class="select_icon rm_option rm_input rm_text" <?php echo yith_field_deps_data( $args ); ?>>
34
+ <div id="<?php echo $id ?>-container" <?php echo yith_field_deps_data( $args ); ?>>
35
+
36
+ <label for="<?php echo $id ?>"><?php echo $label ?></label>
37
+
38
+ <div class="option">
39
+ <div class="select_wrapper icon_list_type clearfix">
40
+ <select name="<?php echo $name ?>[select]" id="<?php echo $id ?>[select]" <?php if ( isset( $std[ 'select' ] ) ) : ?>data-std="<?php echo $std[ 'select' ]; ?>"<?php endif; ?>>
41
+ <?php foreach ( $options[ 'select' ] as $val => $option ) : ?>
42
+ <option value="<?php echo $val ?>" <?php selected( $current_options[ 'select' ], $val ); ?> ><?php echo $option ?></option>
43
+ <?php endforeach; ?>
44
+ </select>
45
+ </div>
46
+
47
+
48
+ <div class="icon-manager-wrapper">
49
+ <div class="icon-manager-text">
50
+ <div class="icon-preview" <?php echo $current_icon ?>></div>
51
+ <input type="text" id="<?php echo $id ?>[icon]" class="icon-text" name="<?php echo $name ?>[icon]" value="<?php echo $current_options[ 'icon' ]; ?>"/>
52
+ </div>
53
+
54
+
55
+ <div class="icon-manager">
56
+ <ul class="icon-list-wrapper">
57
+ <?php foreach ( $options[ 'icon' ] as $font => $icons ):
58
+ foreach ( $icons as $key => $icon ): ?>
59
+ <li data-font="<?php echo $font ?>" data-icon="<?php echo ( strpos( $key, '\\' ) === 0 ) ? '&#x' . substr( $key, 1 ) : $key ?>" data-key="<?php echo $key ?>" data-name="<?php echo $icon ?>"></li>
60
+ <?php
61
+ endforeach;
62
+ endforeach; ?>
63
+ </ul>
64
+ </div>
65
+ </div>
66
+
67
+
68
+ <div class="input_wrapper custom_icon_wrapper upload" style="clear:both;">
69
+ <input type="text" name="<?php echo $name ?>[custom]" id="<?php echo $id ?>[custom]" value="<?php echo $current_options[ 'custom' ] ?>" class="yith-plugin-fw-upload-img-url upload_custom_icon"/>
70
+ <input type="button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>" id="<?php echo $id; ?>-custom-button" class="yith-plugin-fw-upload-button button"/>
71
+
72
+ <div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
73
+ <?php
74
+ $file = $current_options[ 'custom' ];
75
+ if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
76
+ echo __( 'Image preview', 'yith-plugin-fw' ) . ': ' . "<img src=\"" . YIT_CORE_ASSETS_URL . "/images/sleep.png\" data-src=\"$file\" />";
77
+ }
78
+ ?>
79
+ </div>
80
+ </div>
81
+
82
+ </div>
83
+
84
+ <div class="clear"></div>
85
+
86
+
87
+ <div class="description">
88
+ <?php echo $desc ?>
89
+ <?php if ( $std[ 'select' ] == 'custom' ) : ?>
90
+ <?php printf( __( '(Default: %s <img src="%s"/>)', 'yith-plugin-fw' ), $options[ 'select' ][ 'custom' ], $std[ 'custom' ] ) ?>
91
+ <?php else: ?>
92
+ <?php printf( __( '(Default: <i %s></i> )', 'yith-plugin-fw' ), $std_icon ) ?>
93
+ <?php endif; ?>
94
+ </div>
95
+
96
+ <div class="clear"></div>
97
+
98
+ </div>
99
+ </div>
100
+
101
+ <script>
102
+
103
+ jQuery( document ).ready( function ( $ ) {
104
+
105
+ $( '.select_wrapper.icon_list_type' ).on( 'change', function () {
106
+
107
+ var t = $( this );
108
+ var parents = $( '#' + t.parents( 'div.select_icon' ).attr( 'id' ) );
109
+ var option = $( 'option:selected', this ).val();
110
+ var to_show = option == 'none' ? '' : option == 'icon' ? '.icon-manager-wrapper' : '.custom_icon_wrapper';
111
+
112
+ parents.find( '.option > div:not(.icon_list_type)' ).removeClass( 'show' ).addClass( 'hidden' );
113
+ parents.find( to_show ).removeClass( 'hidden' ).addClass( 'show' );
114
+ } );
115
+
116
+ $( '.select_wrapper.icon_list_type' ).trigger( 'change' );
117
+
118
+ var $icon_list = $( '.select_icon' ).find( 'ul.icon-list-wrapper' ),
119
+ $preview = $( '.icon-preview' ),
120
+ $element_list = $icon_list.find( 'li' ),
121
+ $icon_text = $( '.icon-text' );
122
+
123
+ $element_list.on( "click", function () {
124
+ var $t = $( this );
125
+ $element_list.removeClass( 'active' );
126
+ $t.addClass( 'active' );
127
+ $preview.attr( 'data-font', $t.data( 'font' ) );
128
+ $preview.attr( 'data-icon', $t.data( 'icon' ) );
129
+ $preview.attr( 'data-name', $t.data( 'name' ) );
130
+ $preview.attr( 'data-key', $t.data( 'key' ) );
131
+
132
+ $icon_text.val( $t.data( 'font' ) + ':' + $t.data( 'name' ) );
133
+
134
+ } );
135
+ } );
136
+
137
+ </script>
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -134,7 +134,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
134
  }
135
 
136
  foreach( $ancestors as $ancestor ){
137
- $tree[ $ancestor->term_id ] = 'parent' == $instance['display'] ? array() : yit_reorder_hierachical_categories( $ancestor->term_id, $taxonomy );
138
  }
139
  }
140
 
@@ -153,7 +153,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
153
  $dropdown_label = apply_filters( 'yith_wcan_dropdown_label', __( 'Filters:', 'yith-woocommerce-ajax-navigation' ), $this, $instance );
154
  ?>
155
 
156
- <a class="yit-wcan-select-open" href="#"><?php echo apply_filters( 'yith_wcan_dropdown_default_label', $dropdown_label ) ?></a>
157
 
158
  <?php
159
  // Select display
134
  }
135
 
136
  foreach( $ancestors as $ancestor ){
137
+ $tree[ $ancestor->term_id ] = 'parent' == $terms_type_list ? array() : yit_reorder_hierachical_categories( $ancestor->term_id, $taxonomy );
138
  }
139
  }
140
 
153
  $dropdown_label = apply_filters( 'yith_wcan_dropdown_label', __( 'Filters:', 'yith-woocommerce-ajax-navigation' ), $this, $instance );
154
  ?>
155
 
156
+ <a class="yit-wcan-select-open" href="#"><?php echo apply_filters( 'yith_wcan_dropdown_default_label', $dropdown_label, $this ) ?></a>
157
 
158
  <?php
159
  // Select display
widgets/class.yith-wcan-reset-navigation-widget.php CHANGED
@@ -66,7 +66,7 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
66
 
67
  else{
68
  //Start filter from Product category Page
69
- $term = get_term_by( YITH_WCAN()->filter_term_field, $_GET['source_id'], $_GET['source_tax'] );
70
 
71
  if( $term instanceof WP_Term ){
72
  $link = get_term_link( $term, $term->taxonomy );
66
 
67
  else{
68
  //Start filter from Product category Page
69
+ $term = get_term_by( 'term_id', $_GET['source_id'], $_GET['source_tax'] );
70
 
71
  if( $term instanceof WP_Term ){
72
  $link = get_term_link( $term, $term->taxonomy );