YITH WooCommerce Ajax Product Filter - Version 3.0.9

Version Description

  • Released: 31 Aug, 2016 =

  • Added: Support to Ultimate Member plugin

  • Fixed: Error on activation "the plugin required WooCommerce in order to works"

  • Fixed: Get term issue with old WordPress version

Download this release

Release Info

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

Code changes from version 3.0.8 to 3.0.9

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.5.3
7
- Stable tag: 3.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,6 +159,12 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
162
  = 3.0.8 - Released: Aug 11, 2016 =
163
 
164
  * Added: Support to WordPress 4.6RC2
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.6
7
+ Stable tag: 3.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.0.9 - Released: 31 Aug, 2016 =
163
+
164
+ * Added: Support to Ultimate Member plugin
165
+ * Fixed: Error on activation "the plugin required WooCommerce in order to works"
166
+ * Fixed: Get term issue with old WordPress version
167
+
168
  = 3.0.8 - Released: Aug 11, 2016 =
169
 
170
  * Added: Support to WordPress 4.6RC2
includes/class.yith-wcan-frontend.php CHANGED
@@ -58,9 +58,6 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
58
  $is_ajax_navigation_active = is_active_widget( false, false, 'yith-woo-ajax-navigation', true );
59
 
60
  //Actions
61
- //TODO: Remove woocommerce_layered_nav_init method
62
- //add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 90 );
63
-
64
  if( $is_ajax_navigation_active ) {
65
  add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
66
  }
@@ -108,7 +105,6 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
108
  * @return array
109
  */
110
  public function the_posts( $posts, $query = false ) {
111
-
112
  if( YITH_WCAN()->is_wc_older_2_6 ){
113
  add_action( 'wp', array( $this, 'layered_navigation_array_for_wc_older_26' ) );
114
  }
@@ -147,7 +143,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
147
  $current_wp_query,
148
  array(
149
  'post_type' => 'product',
150
- 'numberposts' => -1,
151
  'post_status' => 'publish',
152
  'meta_query' => is_object( $current_wp_query ) ? $current_wp_query->meta_query : array(),
153
  'fields' => 'ids',
@@ -155,7 +151,8 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
155
  'update_post_meta_cache' => false,
156
  'update_post_term_cache' => false,
157
  'pagename' => '',
158
- 'wc_query' => 'get_products_in_view'
 
159
  )
160
  );
161
 
@@ -185,7 +182,6 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
185
  $this->layered_nav_product_ids = $this->unfiltered_product_ids;
186
  }
187
  }
188
-
189
  return $posts;
190
  }
191
 
@@ -230,66 +226,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
230
  wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
231
  }
232
  }
233
-
234
-
235
- /**
236
- * Layered Nav Init
237
- *
238
- * @package WooCommerce/Widgets
239
- * @access public
240
- * @return void
241
- */
242
- public function woocommerce_layered_nav_init() {
243
- $is_ajax_navigation_active = is_active_widget( false, false, 'yith-woo-ajax-navigation', true );
244
-
245
- if ( ! YITH_WCAN()->is_wc_older_2_6 && $is_ajax_navigation_active && ! is_admin() ) {
246
-
247
- $_chosen_attributes = YITH_WCAN()->get_layered_nav_chosen_attributes();
248
-
249
- /* FIX TO WOOCOMMERCE 2.1 */
250
- $attibute_taxonomies = function_exists( 'wc_get_attribute_taxonomies' ) ? $attribute_taxonomies = wc_get_attribute_taxonomies() : $attribute_taxonomies = WC()->get_attribute_taxonomies();
251
-
252
- if ( $attribute_taxonomies ) {
253
- foreach ( $attribute_taxonomies as $tax ) {
254
-
255
- $attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
256
-
257
- /* FIX TO WOOCOMMERCE 2.1 */
258
- if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
259
- $taxonomy = wc_attribute_taxonomy_name( $attribute );
260
- }
261
- else {
262
- $taxonomy = WC()->attribute_taxonomy_name( $attribute );
263
- }
264
-
265
- $name = 'filter_' . $attribute;
266
- $query_type_name = 'query_type_' . $attribute;
267
-
268
- if ( ! empty( $_GET[$name] ) && taxonomy_exists( $taxonomy ) ) {
269
-
270
- $_chosen_attributes[ $taxonomy ]['terms'] = explode( ',', $_GET[ $name ] );
271
-
272
- if ( empty( $_GET[ $query_type_name ] ) || ! in_array( strtolower( $_GET[ $query_type_name ] ), array( 'and', 'or' ) ) )
273
- $_chosen_attributes[ $taxonomy ]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
274
- else
275
- $_chosen_attributes[ $taxonomy ]['query_type'] = strtolower( $_GET[ $query_type_name ] );
276
-
277
- }
278
- }
279
- }
280
-
281
- if ( YITH_WCAN()->is_wc_older_2_1 ) {
282
- add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
283
- //add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
284
- }
285
-
286
- elseif ( YITH_WCAN()->is_wc_older_2_6 ) {
287
- add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
288
- //add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
289
- }
290
- //Nothing to do for WooCommerce 2.6
291
- }
292
- }
293
  /**
294
  * Layered Nav post filter.
295
  *
@@ -303,7 +240,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
303
  if( is_product_taxonomy() ){
304
  $is_product_taxonomy = array(
305
  'taxonomy' => get_queried_object()->taxonomy,
306
- 'terms' => get_queried_object()->slug,
307
  'field' => YITH_WCAN()->filter_term_field
308
  );
309
  }
@@ -334,6 +271,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
334
  'meta_value' => 'visible',
335
  'fields' => 'ids',
336
  'no_found_rows' => true,
 
337
  'tax_query' => array(
338
  array(
339
  'taxonomy' => $attribute,
@@ -399,15 +337,16 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
399
 
400
  else {
401
 
402
- $args = array(
403
- 'post_type' => 'product',
404
- 'numberposts' => -1,
405
- 'post_status' => 'publish',
406
- 'meta_key' => '_visibility',
407
- 'meta_value' => 'visible',
408
- 'fields' => 'ids',
409
- 'no_found_rows' => true,
410
- 'tax_query' => array()
 
411
  );
412
 
413
 
58
  $is_ajax_navigation_active = is_active_widget( false, false, 'yith-woo-ajax-navigation', true );
59
 
60
  //Actions
 
 
 
61
  if( $is_ajax_navigation_active ) {
62
  add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
63
  }
105
  * @return array
106
  */
107
  public function the_posts( $posts, $query = false ) {
 
108
  if( YITH_WCAN()->is_wc_older_2_6 ){
109
  add_action( 'wp', array( $this, 'layered_navigation_array_for_wc_older_26' ) );
110
  }
143
  $current_wp_query,
144
  array(
145
  'post_type' => 'product',
146
+ 'numberposts' => - 1,
147
  'post_status' => 'publish',
148
  'meta_query' => is_object( $current_wp_query ) ? $current_wp_query->meta_query : array(),
149
  'fields' => 'ids',
151
  'update_post_meta_cache' => false,
152
  'update_post_term_cache' => false,
153
  'pagename' => '',
154
+ 'wc_query' => 'get_products_in_view',
155
+ 'suppress_filters' => true
156
  )
157
  );
158
 
182
  $this->layered_nav_product_ids = $this->unfiltered_product_ids;
183
  }
184
  }
 
185
  return $posts;
186
  }
187
 
226
  wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
227
  }
228
  }
229
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  /**
231
  * Layered Nav post filter.
232
  *
240
  if( is_product_taxonomy() ){
241
  $is_product_taxonomy = array(
242
  'taxonomy' => get_queried_object()->taxonomy,
243
+ 'terms' => get_queried_object()->slug,
244
  'field' => YITH_WCAN()->filter_term_field
245
  );
246
  }
271
  'meta_value' => 'visible',
272
  'fields' => 'ids',
273
  'no_found_rows' => true,
274
+ 'suppress_filters' => true,
275
  'tax_query' => array(
276
  array(
277
  'taxonomy' => $attribute,
337
 
338
  else {
339
 
340
+ $args = array(
341
+ 'post_type' => 'product',
342
+ 'numberposts' => - 1,
343
+ 'post_status' => 'publish',
344
+ 'meta_key' => '_visibility',
345
+ 'meta_value' => 'visible',
346
+ 'fields' => 'ids',
347
+ 'no_found_rows' => true,
348
+ 'suppress_filters' => true,
349
+ 'tax_query' => array()
350
  );
351
 
352
 
includes/class.yith-wcan.php CHANGED
@@ -99,6 +99,11 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
99
  $this->required();
100
 
101
  $this->init();
 
 
 
 
 
102
  }
103
 
104
  /**
@@ -218,5 +223,24 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
218
  return $chosen_attributes;
219
  }
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
  }
99
  $this->required();
100
 
101
  $this->init();
102
+
103
+ // Support to Ultimate Member plugin
104
+ if( class_exists( 'UM_API' ) ){
105
+ add_action( 'init', array( $this, 'ultimate_member_support' ), 0 );
106
+ }
107
  }
108
 
109
  /**
223
  return $chosen_attributes;
224
  }
225
 
226
+ /**
227
+ * Support to ultimate members functions
228
+ *
229
+ * The method set_predefined_fields call a WP_Query that generate
230
+ * an issue with shop filtered query. Move this step to init with priority 2
231
+ * instead of 1
232
+ *
233
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
234
+ * @since 3.0.9
235
+ * @return void
236
+ */
237
+ public function ultimate_member_support(){
238
+ global $ultimatemember;
239
+ if( $ultimatemember ){
240
+ remove_action('init', array($ultimatemember->builtin, 'set_predefined_fields'), 1);
241
+ add_action('init', array($ultimatemember->builtin, 'set_predefined_fields'), 2);
242
+ }
243
+ }
244
+
245
  }
246
  }
includes/functions.yith-wcan.php CHANGED
@@ -252,11 +252,11 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
252
  switch ( $case ) {
253
 
254
  case 'all':
255
- $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
256
  break;
257
 
258
  case 'hierarchical':
259
- $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
260
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
261
  $terms = yit_reorder_terms_by_parent( $terms, $taxonomy );
262
  $reordered = true;
@@ -264,7 +264,7 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
264
  break;
265
 
266
  case 'parent' :
267
- $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'parent' => false, 'exclude' => $exclude ) );
268
  break;
269
 
270
  default:
@@ -273,7 +273,7 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
273
  $args['parent'] = false;
274
  }
275
 
276
- $terms = get_terms( $args );
277
 
278
  if ( 'hierarchical' == $instance['display'] ) {
279
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
@@ -336,7 +336,7 @@ if ( ! function_exists( 'yit_term_has_child' ) ) {
336
  */
337
  function yit_term_has_child( $term, $taxonomy ) {
338
  $count = 0;
339
- $child_terms = get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $term->term_id ) );
340
 
341
  if( ! is_wp_error( $child_terms ) ){
342
  foreach ( $child_terms as $child_term ) {
@@ -488,16 +488,17 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
488
  }
489
 
490
  else {
491
- $taxonomy = get_query_var( 'taxonomy' );
 
 
492
  $brands_taxonomy = yit_get_brands_taxonomy();
493
 
494
  if( ! empty( $brands_taxonomy ) && $brands_taxonomy == $taxonomy ){
495
- $return = add_query_arg( array( $taxonomy => get_query_var( 'term' ) ), get_post_type_archive_link( 'product' ) );
496
  }
497
 
498
  else {
499
- $term = get_query_var( 'term' );
500
- $return = get_term_link( yith_wcan_is_product_attribute() && is_numeric( $term ) ? intval( $term ) : $term, $taxonomy );
501
  }
502
 
503
  return apply_filters( 'yith_wcan_untrailingslashit', true ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
@@ -599,7 +600,7 @@ if( ! function_exists( 'yit_reorder_hierachical_categories' ) ) {
599
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
600
  */
601
  function yit_reorder_hierachical_categories( $parent_term_id, $taxonomy = 'product_cat' ) {
602
- $childs = get_terms(
603
  array(
604
  'taxonomy' => $taxonomy,
605
  'parent' => $parent_term_id,
@@ -700,4 +701,25 @@ if( !function_exists( 'yith_wcan_is_product_attribute' ) ) {
700
  function yith_wcan_is_product_attribute( $attribute = '' ) {
701
  return preg_match( '/pa_' . $attribute . '.*/', get_query_var( 'taxonomy' ) );
702
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
  }
252
  switch ( $case ) {
253
 
254
  case 'all':
255
+ $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
256
  break;
257
 
258
  case 'hierarchical':
259
+ $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
260
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
261
  $terms = yit_reorder_terms_by_parent( $terms, $taxonomy );
262
  $reordered = true;
264
  break;
265
 
266
  case 'parent' :
267
+ $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'parent' => false, 'exclude' => $exclude ) );
268
  break;
269
 
270
  default:
273
  $args['parent'] = false;
274
  }
275
 
276
+ $terms = yith_wcan_wp_get_terms( $args );
277
 
278
  if ( 'hierarchical' == $instance['display'] ) {
279
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
336
  */
337
  function yit_term_has_child( $term, $taxonomy ) {
338
  $count = 0;
339
+ $child_terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $term->term_id ) );
340
 
341
  if( ! is_wp_error( $child_terms ) ){
342
  foreach ( $child_terms as $child_term ) {
488
  }
489
 
490
  else {
491
+ $queried_object = get_queried_object();
492
+ $taxonomy = $queried_object instanceof WP_Term ? $queried_object->taxonomy : get_query_var( 'taxonomy' );
493
+ $term = $queried_object instanceof WP_Term ? $queried_object : get_query_var( 'term' );
494
  $brands_taxonomy = yit_get_brands_taxonomy();
495
 
496
  if( ! empty( $brands_taxonomy ) && $brands_taxonomy == $taxonomy ){
497
+ $return = add_query_arg( array( $taxonomy => $term ), get_post_type_archive_link( 'product' ) );
498
  }
499
 
500
  else {
501
+ $return = get_term_link( yith_wcan_is_product_attribute() && is_numeric( $term ) ? intval( $term ) : $term, $taxonomy );
 
502
  }
503
 
504
  return apply_filters( 'yith_wcan_untrailingslashit', true ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
600
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
601
  */
602
  function yit_reorder_hierachical_categories( $parent_term_id, $taxonomy = 'product_cat' ) {
603
+ $childs = yith_wcan_wp_get_terms(
604
  array(
605
  'taxonomy' => $taxonomy,
606
  'parent' => $parent_term_id,
701
  function yith_wcan_is_product_attribute( $attribute = '' ) {
702
  return preg_match( '/pa_' . $attribute . '.*/', get_query_var( 'taxonomy' ) );
703
  }
704
+ }
705
+
706
+ if( ! function_exists( 'yith_wcan_wp_get_terms' ) ) {
707
+ /**
708
+ * get_terms function support for old WordPress Version
709
+ *
710
+ * @param string $args
711
+ *
712
+ * @return bool
713
+ */
714
+ function yith_wcan_wp_get_terms( $args ) {
715
+ global $wp_version;
716
+
717
+ if( version_compare( $wp_version, '4.6', '<' ) ){
718
+ return get_terms( $args['taxonomy'], $args );
719
+ }
720
+
721
+ else {
722
+ return get_terms( $args );
723
+ }
724
+ }
725
  }
init.php CHANGED
@@ -3,7 +3,7 @@
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.0.8
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
@@ -64,7 +64,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.0.8' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
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.0.9
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.0.9' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
plugin-fw/init.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 2.9.36
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 2.9.37
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -93,7 +93,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
93
 
94
  /* === HOOKS === */
95
  if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
96
- add_action( 'admin_init', array( $this, 'remove_wp_plugin_update_row' ), 15 );
97
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
98
  } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
99
  $transient = 'yith_register_' . md5( $plugin_slug );
@@ -433,18 +433,27 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
433
  $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
434
 
435
  if ( is_network_admin() || ! is_multisite() || true ) {
436
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
 
 
 
 
 
 
 
437
 
438
  if ( ! current_user_can( 'update_plugins' ) ) {
439
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
440
  } elseif ( is_plugin_active_for_network( $init ) ) {
441
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
442
  } elseif ( empty( $r->package ) ) {
443
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
444
  } else {
445
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
446
  }
447
 
 
 
448
  /**
449
  * Fires at the end of the update message container in each
450
  * row of the themes list table.
@@ -475,7 +484,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
475
  */
476
  public function remove_wp_plugin_update_row() {
477
  foreach ( $this->_plugins as $init => $plugin ) {
478
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10, 2 );
479
  add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
480
  add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
481
  }
93
 
94
  /* === HOOKS === */
95
  if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
96
+ add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
97
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
98
  } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
99
  $transient = 'yith_register_' . md5( $plugin_slug );
433
  $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
434
 
435
  if ( is_network_admin() || ! is_multisite() || true ) {
436
+ global $wp_version;
437
+ $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
438
+
439
+ echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
440
+
441
+ echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
442
+
443
+ echo( $is_wp_4_6 ? '<p>' : '' );
444
 
445
  if ( ! current_user_can( 'update_plugins' ) ) {
446
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
447
  } elseif ( is_plugin_active_for_network( $init ) ) {
448
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
449
  } elseif ( empty( $r->package ) ) {
450
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
451
  } else {
452
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
453
  }
454
 
455
+ echo( $is_wp_4_6 ? '</p>' : '' );
456
+
457
  /**
458
  * Fires at the end of the update message container in each
459
  * row of the themes list table.
484
  */
485
  public function remove_wp_plugin_update_row() {
486
  foreach ( $this->_plugins as $init => $plugin ) {
487
+ remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
488
  add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
489
  add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
490
  }
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -110,7 +110,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
110
  }
111
 
112
  if ( in_array( $display_type, apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
113
- $ancestors = get_terms(
114
  array(
115
  'taxonomy' => $taxonomy,
116
  'parent' => 0,
@@ -824,7 +824,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
824
  $attribute = $_POST['attribute'];
825
  $return = array( 'message' => '', 'content' => $_POST );
826
 
827
- $terms = get_terms( array( 'taxonomy' => 'pa_' . $attribute, 'hide_empty' => '0' ) );
828
 
829
  $settings = $this->get_settings();
830
  $widget_settings = $settings[ $this->number ];
110
  }
111
 
112
  if ( in_array( $display_type, apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
113
+ $ancestors = yith_wcan_wp_get_terms(
114
  array(
115
  'taxonomy' => $taxonomy,
116
  'parent' => 0,
824
  $attribute = $_POST['attribute'];
825
  $return = array( 'message' => '', 'content' => $_POST );
826
 
827
+ $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => 'pa_' . $attribute, 'hide_empty' => '0' ) );
828
 
829
  $settings = $this->get_settings();
830
  $widget_settings = $settings[ $this->number ];