YITH WooCommerce Ajax Product Filter - Version 2.5.0

Version Description

  • Added: yith_wcan_untrailingslashit hook for disable untrailingslashit function in filter link
  • Tweak: Performance improved with new plugin core 2.0
  • Tweak: Plugin don't apply filter in category page
  • Fixed: Issuet with YITH Infinite Scrolling plugin
  • Fixed: Filter widget don't show in product attribute page
  • Fixed: Issue with WPML and Visual Composer plugins in admin
Download this release

Release Info

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

Code changes from version 2.4.0 to 2.5.0

README.txt CHANGED
@@ -4,7 +4,7 @@ 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.3.1
7
- Stable tag: 2.4.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -159,6 +159,15 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
160
== Changelog ==
161
162
= 2.4.0 =
163
164
* Tweak: New wordpress translation text domain added
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.3.1
7
+ Stable tag: 2.5.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
159
160
== Changelog ==
161
162
+ = 2.5.0 =
163
+
164
+ * Added: yith_wcan_untrailingslashit hook for disable untrailingslashit function in filter link
165
+ * Tweak: Performance improved with new plugin core 2.0
166
+ * Tweak: Plugin don't apply filter in category page
167
+ * Fixed: Issuet with YITH Infinite Scrolling plugin
168
+ * Fixed: Filter widget don't show in product attribute page
169
+ * Fixed: Issue with WPML and Visual Composer plugins in admin
170
+
171
= 2.4.0 =
172
173
* Tweak: New wordpress translation text domain added
assets/css/admin.css CHANGED
@@ -198,4 +198,10 @@ textarea#yit_wcan_options_yith_wcan_custom_style {
198
min-height: 300px;
199
padding: 8px;
200
resize: none;
201
}
198
min-height: 300px;
199
padding: 8px;
200
resize: none;
201
+ }
202
+
203
+ div#yit_wcan_options_yith_wcan_seo_value-container .option,
204
+ div#yit_wcan_options_yith_wcan_seo_value-container .option .select_wrapper,
205
+ #yit_wcan_options_yith_wcan_seo_option-container .select_wrapper {
206
+ width: auto;
207
}
assets/css/frontend.css CHANGED
@@ -172,11 +172,22 @@
172
}
173
174
/* widget dropdown */
175
- .widget h3.with-dropdown {
176
position: relative;
177
cursor: pointer;
178
}
179
- .widget h3.with-dropdown .widget-dropdown {
180
border-width: 0;
181
width: 22px;
182
height: 22px;
@@ -186,7 +197,13 @@
186
top: 0;
187
right: 0;
188
}
189
- .widget h3.with-dropdown.open .widget-dropdown {
190
background-position: bottom 15px right;
191
}
192
172
}
173
174
/* widget dropdown */
175
+ .widget h1.with-dropdown,
176
+ .widget h2.with-dropdown,
177
+ .widget h3.with-dropdown,
178
+ .widget h4.with-dropdown,
179
+ .widget h5.with-dropdown,
180
+ .widget h6.with-dropdown {
181
position: relative;
182
cursor: pointer;
183
}
184
+
185
+ .widget h1.with-dropdown .widget-dropdown,
186
+ .widget h2.with-dropdown .widget-dropdown,
187
+ .widget h3.with-dropdown .widget-dropdown,
188
+ .widget h4.with-dropdown .widget-dropdown,
189
+ .widget h5.with-dropdown .widget-dropdown,
190
+ .widget h6.with-dropdown .widget-dropdown {
191
border-width: 0;
192
width: 22px;
193
height: 22px;
197
top: 0;
198
right: 0;
199
}
200
+
201
+ .widget h1.with-dropdown.open .widget-dropdown,
202
+ .widget h2.with-dropdown.open .widget-dropdown,
203
+ .widget h3.with-dropdown.open .widget-dropdown,
204
+ .widget h4.with-dropdown.open .widget-dropdown,
205
+ .widget h5.with-dropdown.open .widget-dropdown,
206
+ .widget h6.with-dropdown.open .widget-dropdown {
207
background-position: bottom 15px right;
208
}
209
assets/js/yith-wcan-frontend.js CHANGED
@@ -141,6 +141,7 @@ jQuery(function ($) {
141
142
//loading
143
$(yith_wcan.container).html('').addClass('yith-wcan-loading');
144
145
if (typeof yith_wcan_frontend != 'undefined') {
146
$(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
141
142
//loading
143
$(yith_wcan.container).html('').addClass('yith-wcan-loading');
144
+ $(document).trigger("yith-wcan-ajax-loading");
145
146
if (typeof yith_wcan_frontend != 'undefined') {
147
$(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
assets/js/yith-wcan-frontend.min.js CHANGED
@@ -5,9 +5,9 @@ k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].ta
5
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},v=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,u(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return v.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return u.apply(this,arguments);if(2==arguments.length)return v.apply(this,arguments)};b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
7
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=t(a,"min_price"),a=t(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
8
- "undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));0<b(c).find(yith_wcan.pagination).length?(0==b(yith_wcan.pagination).length&&
9
- b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());
10
- ""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var r=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
11
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
12
"1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
13
r);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||r()})});
5
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},v=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,u(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return v.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return u.apply(this,arguments);if(2==arguments.length)return v.apply(this,arguments)};b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
7
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=t(a,"min_price"),a=t(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
8
+ b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));0<b(c).find(yith_wcan.pagination).length?
9
+ (0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=b(this),d=a.attr("id");
10
+ a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var r=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
11
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
12
"1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
13
r);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||r()})});
includes/class.yith-wcan-admin.php CHANGED
@@ -267,7 +267,7 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
267
}
268
269
$message = __( 'Dear users,
270
- we would like to inform you that the YITH WooCommerce Ajax Navigation plugin will change its name in YITH WooCommerce Ajax Product Filter from the next update. Also, the plugin textdomain will change too from "yit" to "yith_wc_ajxnav".
271
This modification solves the issues about textdomain conflicts generated by some translation/multilanguage plugins you have identified in the past weeks.
272
If updating the plugin some language files are no more recognized by WordPress, you will just have to rename the language files in the correct format. After renaming the files, you can update/translate the .po file following the classic procedure for translations.', 'yith-woocommerce-ajax-navigation' );
273
267
}
268
269
$message = __( 'Dear users,
270
+ we would like to inform you that the YITH WooCommerce Ajax Navigation plugin will change its name in YITH WooCommerce Ajax Product Filter from the next update. Also, the plugin textdomain will change too from "yit" to "yith-woocommerce-ajax-navigation".
271
This modification solves the issues about textdomain conflicts generated by some translation/multilanguage plugins you have identified in the past weeks.
272
If updating the plugin some language files are no more recognized by WordPress, you will just have to rename the language files in the correct format. After renaming the files, you can update/translate the .po file following the classic procedure for translations.', 'yith-woocommerce-ajax-navigation' );
273
includes/class.yith-wcan.php CHANGED
@@ -63,7 +63,7 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
63
$this->version = YITH_WCAN_VERSION;
64
65
/* Load Plugin Framework */
66
- add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
67
68
/* Register Widget */
69
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
@@ -99,8 +99,12 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
99
* @return void
100
*/
101
public function plugin_fw_loader() {
102
- if ( ! defined( 'YIT' ) || ! defined( 'YIT_CORE_PLUGIN' ) ) {
103
- require_once( YITH_WCAN_DIR . 'plugin-fw/yit-plugin.php' );
104
}
105
}
106
63
$this->version = YITH_WCAN_VERSION;
64
65
/* Load Plugin Framework */
66
+ add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ) );
67
68
/* Register Widget */
69
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
99
* @return void
100
*/
101
public function plugin_fw_loader() {
102
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
103
+ global $plugin_fw_data;
104
+ if( ! empty( $plugin_fw_data ) ){
105
+ $plugin_fw_file = array_shift( $plugin_fw_data );
106
+ require_once( $plugin_fw_file );
107
+ }
108
}
109
}
110
includes/functions.yith-wcan.php CHANGED
@@ -118,7 +118,12 @@ function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = ar
118
function yith_wcan_can_be_displayed() {
119
global $woocommerce, $_attributes_array;
120
121
- if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) ) {
122
return true;
123
}
124
else {
@@ -436,16 +441,19 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
436
*/
437
function yit_get_woocommerce_layered_nav_link() {
438
439
- if ( defined( 'SHOP_IS_ON_FRONT' ) || is_shop() ) {
440
- return untrailingslashit( get_post_type_archive_link( 'product' ) );
441
}
442
443
elseif ( is_product_category() ) {
444
- return untrailingslashit( get_term_link( get_queried_object()->slug, 'product_cat' ) );
445
}
446
447
else {
448
- return untrailingslashit( get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) );
449
}
450
451
return false;
@@ -475,4 +483,21 @@ if ( ! function_exists( 'yit_wcan_localize_terms' ) ) {
475
return $term_id;
476
}
477
478
}
118
function yith_wcan_can_be_displayed() {
119
global $woocommerce, $_attributes_array;
120
121
+ if (
122
+ is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) ||
123
+ is_active_widget( false, false, 'yith-woo-ajax-navigation-sort-by', true ) ||
124
+ is_active_widget( false, false, 'yith-woo-ajax-navigation-stock-on-sale', true ) ||
125
+ is_active_widget( false, false, 'yith-woo-ajax-navigation-list-price-filter', true )
126
+ ) {
127
return true;
128
}
129
else {
441
*/
442
function yit_get_woocommerce_layered_nav_link() {
443
444
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
445
+ $return = get_post_type_archive_link( 'product' );
446
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
447
}
448
449
elseif ( is_product_category() ) {
450
+ $return = get_term_link( get_queried_object()->slug, 'product_cat' );
451
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
452
}
453
454
else {
455
+ $return = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
456
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
457
}
458
459
return false;
483
return $term_id;
484
}
485
486
+ }
487
+
488
+ if ( ! function_exists( 'yit_wcan_get_product_taxonomy' ) ) {
489
+ /**
490
+ * Get the product taxonomy array
491
+ * @return array product taxonomy array
492
+ *
493
+ * @since 2.2
494
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
495
+ */
496
+
497
+ function yit_wcan_get_product_taxonomy() {
498
+ global $_attributes_array;
499
+ $product_taxonomies = ! empty( $_attributes_array ) ? $_attributes_array : get_object_taxonomies( 'product' );
500
+ return array_merge( $product_taxonomies, apply_filters( 'yith_wcan_product_taxonomy_type', array() ) );
501
+ }
502
+
503
}
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: 2.4.0
7
* Author: yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yith_wc_ajxnav
@@ -65,10 +65,13 @@ if ( defined( 'YITH_WCAN_VERSION' ) ) {
65
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
66
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
67
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
68
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.4.0' );
69
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
70
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
71
72
73
/**
74
* Init default plugin settings
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: 2.5.0
7
* Author: yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yith_wc_ajxnav
65
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
66
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
67
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
68
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.5.0' );
69
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
70
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
71
72
+ /* Plugin Framework Version Check */
73
+ ! function_exists( 'yit_maybe_plugin_fw_loader' ) && require_once( YITH_WCAN_DIR . 'plugin-fw/init.php' );
74
+ yit_maybe_plugin_fw_loader( YITH_WCAN_DIR );
75
76
/**
77
* Init default plugin settings
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -165,6 +165,12 @@
165
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
167
$("#" + id).val( attachment.url );
168
$('.plugin-option .upload_img_url').trigger('change');
169
});
170
165
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
167
$("#" + id).val( attachment.url );
168
+ // Save the id of the selected element to an element which name is the same with
169
+ // a suffix "-yith-attachment-id"
170
+ if ($("#" + id + "-yith-attachment-id")) {
171
+ $("#" + id + "-yith-attachment-id").val(attachment.id);
172
+ }
173
+
174
$('.plugin-option .upload_img_url').trigger('change');
175
});
176
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1,10 +1 @@
1
- (function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
2
- "</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .on_off_container span").on("click",
3
- 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");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
4
- a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parents().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).trigger("change"),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
5
- var c,d=a(this).attr("id").replace(/-button#x2F;,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url);a(".plugin-option .upload_img_url").trigger("change")}));c.open()}));a(".plugin-option .add_media").on("click",
6
- function(){});a("[data-field]").each(function(){var b=a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");a(d).on("change",function(){var b=d,g=e.toString(),h=!0;if("string"==typeof b){":radio"==b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");
7
- b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\amp;").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",
8
- resizable:!1,draggable:!1,create:function(b,d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=
9
- a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";
10
- b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
1
+ !function(e){function t(t,i,n){var a=!0;if("string"==typeof i){":radio"==i.substr(0,6)&&(i+=":checked");for(var n=n.split(","),o=0;o<n.length;o++){if(e(i).val()==n[o]){a=!0;break}a=!1}}a?e(t+"-container").closest("tr").show():e(t+"-container").closest("tr").hide()}var i=function(){var t="";e(this).attr("multiple")?(e(this).children("option:selected").each(function(i,n){0!=i&&(t+=", "),t+=e(n).text()}),""==t&&e(this).children().children("option:selected").each(function(i,n){0!=i&&(t+=", "),t+=e(n).text()})):(t=e(this).children("option:selected").text(),""==t&&(t=e(this).children().children("option:selected").text())),e(this).parent().find("span").length<=0&&e(this).before("<span></span>"),e(this).parent().children("span").replaceWith("<span>"+t+"</span>")};if(e(".plugin-option .select_wrapper select").not(".chosen").each(i).change(i),e(".plugin-option .select_wrapper").click(function(t){t.stopPropagation(),e(this).find("select[multiple]").not(".chosen").toggle()}),e(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(e){e.stopPropagation()}),e(window).click(function(){e(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()}),e(".plugin-option .chosen .select_wrapper select").chosen(),e(".plugin-option .on_off_container span").on("click",function(){var t=e(this).prev("input"),i=t.prop("checked");i?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var t=e(this).data("val"),i=e(this).data("min"),n=e(this).data("max"),a=e(this).data("step"),o=e(this).data("labels");e(this).slider({value:t,min:i,max:n,range:"min",step:a,slide:function(t,i){e(this).find("input").val(i.value),e(this).siblings(".feedback").find("strong").text(i.value+o)}})}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media){{var n=!0;wp.media.editor.send.attachment}e(".plugin-option .upload_img_url").change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),n=e(this).parents().siblings(".upload_img_preview");n.html(i.test(t)?'<img src="'+t+'" style="max-width:600px; max-height:300px;" />':"")}).trigger("change"),e(document).on("click",".plugin-option .upload_button",function(t){t.preventDefault();var i,n=e(this),a=n.attr("id").replace(/-button#x2F;,"");if(i)return void i.open();var o=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:o}),i.on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+a).val(t.url),e("#"+a+"-yith-attachment-id")&&e("#"+a+"-yith-attachment-id").val(t.id),e(".plugin-option .upload_img_url").trigger("change")}),i.open()})}e(".plugin-option .add_media").on("click",function(){n=!1}),e("[data-field]").each(function(){var i=e(this),n="#"+i.data("field"),a="#"+i.data("dep"),o=i.data("value");e(a).on("change",function(){t(n,a,o.toString())}).change()}),e(".rm_connectedlist").each(function(){{var t=e(this).find("ul"),i=e(this).find(":hidden");t.sortable({connectWith:t,update:function(){var n={};t.each(function(){var t={};e(this).children().each(function(){t[e(this).data("option")]=e(this).text()}),n[e(this).data("list")]=t}),i.val(JSON.stringify(n).replace(/[\\"']/g,"\\amp;").replace(/\u0000/g,"\\0"))}}).disableSelection()}}),e(document).ready(function(){e(".yith-video-link").click(function(t){t.preventDefault();var i=e(this).data("video-id");e("."+i).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(){e(this).css("maxWidth","853px")},open:function(){e(".ui-widget-overlay").bind("click",function(){e(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}}),e(".ui-dialog :button").blur()})}),e(document).ready(function(){e(".codemirror").each(function(t,i){var n=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",n)})}),e(document).ready(function(){e(".google-analytic-generate").click(function(){var t=e("#"+e(this).data("textarea")).data("codemirrorInstance"),i=e("#"+e(this).data("input")).val(),n=e(this).data("basename"),a="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";a+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",a+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",a+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",a+="ga('create', '"+i+"', '"+n+"');\n",a+="ga('send', 'pageview');\n",t.replaceRange(a,t.getCursor("start"),t.getCursor("end"))})})}(jQuery);
plugin-fw/init.php ADDED
@@ -0,0 +1,59 @@
1
+ <?php
2
+ /**
3
+ * Framework Name: YIT Plugin Framework
4
+ * Version: 2.1
5
+ * Author: Yithemes
6
+ * Text Domain: yith-plugin-fw
7
+ * Domain Path: /languages/
8
+ *
9
+ * @author Your Inspiration Themes
10
+ * @package YITH WooCommerce Ajax Navigation
11
+ * @version 2.0
12
+ */
13
+ /**
14
+ * This file belongs to the YIT Plugin Framework.
15
+ *
16
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
17
+ * that is bundled with this package in the file LICENSE.txt.
18
+ * It is also available through the world-wide-web at this URL:
19
+ * http://www.gnu.org/licenses/gpl-3.0.txt
20
+ */
21
+
22
+
23
+ if ( ! defined( 'ABSPATH' ) ) {
24
+ exit;
25
+ } // Exit if accessed directly
26
+
27
+ if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) ) {
28
+ /**
29
+ * YITH WooCommerce Ajax Navigation
30
+ *
31
+ * @since 1.0.0
32
+ */
33
+ function yit_maybe_plugin_fw_loader( $plugin_fw_path ) {
34
+ global $plugin_fw_data;
35
+
36
+ $default_headers = array(
37
+ 'Name' => 'Framework Name',
38
+ 'Version' => 'Version',
39
+ 'Author' => 'Author',
40
+ 'TextDomain' => 'Text Domain',
41
+ 'DomainPath' => 'Domain Path',
42
+ );
43
+
44
+ $framework_data = get_file_data( $plugin_fw_path .'/plugin-fw/init.php', $default_headers );
45
+ $plugin_fw_main_file = $plugin_fw_path . 'plugin-fw/yit-plugin.php';
46
+
47
+ if( ! empty( $plugin_fw_data ) ){
48
+ foreach( $plugin_fw_data as $version => $path ){
49
+ if( version_compare( $version, $framework_data['Version'], '<' ) ){
50
+ $plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
51
+ }
52
+ }
53
+ }
54
+
55
+ else {
56
+ $plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
57
+ }
58
+ }
59
+ }
plugin-fw/lib/yit-metabox.php CHANGED
@@ -161,8 +161,6 @@ if (!class_exists('YIT_Metabox')) {
161
wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
-
165
-
166
}
167
168
/**
161
wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
}
165
166
/**
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -278,6 +278,20 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
278
}
279
}
280
281
woocommerce_update_options( $yit_options[ $current_tab ] );
282
283
do_action( 'yit_panel_wc_after_update' );
@@ -314,7 +328,6 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
314
wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
315
wp_enqueue_style ( 'wp-jquery-ui-dialog' );
316
317
-
318
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
319
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
320
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
@@ -365,7 +378,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
365
* @return array Filtered body classes
366
*/
367
public function admin_body_class( $admin_body_classes ){
368
- return substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
369
}
370
371
/**
278
}
279
}
280
281
+ foreach($_POST as $name => $value) {
282
+
283
+ // Check if current POST var which name ends with a specific needle
284
+ $attachment_id_needle = "-yith-attachment-id";
285
+ $is_hidden_input = (($temp = strlen($name) - strlen($attachment_id_needle)) >= 0 && strpos($name, $attachment_id_needle, $temp) !== FALSE);
286
+ if ($is_hidden_input){
287
+ // Is an input element of type "hidden" coupled with an input element for selecting an element from the media gallery
288
+ $yit_options[ $current_tab ][$name] = array(
289
+ "type" => "text",
290
+ "id" => $name
291
+ );
292
+ }
293
+ }
294
+
295
woocommerce_update_options( $yit_options[ $current_tab ] );
296
297
do_action( 'yit_panel_wc_after_update' );
328
wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
329
wp_enqueue_style ( 'wp-jquery-ui-dialog' );
330
331
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
332
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
333
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
378
* @return array Filtered body classes
379
*/
380
public function admin_body_class( $admin_body_classes ){
381
+ global $pagenow;
382
+ return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
383
}
384
385
/**
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -121,32 +121,27 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
121
*/
122
public function admin_enqueue_scripts() {
123
124
- global $wp_scripts;
125
126
//scripts
127
- wp_enqueue_media();
128
- wp_enqueue_script( 'jquery-ui' );
129
- wp_enqueue_script( 'jquery-ui-core' );
130
- wp_enqueue_script( 'jquery-ui-slider' );
131
- wp_enqueue_script( 'jquery-ui-dialog' );
132
- wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
133
- wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
134
- wp_enqueue_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
135
- wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
136
- wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
137
-
138
-
139
- wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
140
141
//styles
142
-
143
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
144
-
145
wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
146
wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
147
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
148
-
149
- wp_enqueue_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
150
}
151
152
/**
121
*/
122
public function admin_enqueue_scripts() {
123
124
+ global $wp_scripts, $pagenow;
125
126
//scripts
127
+ wp_enqueue_media();
128
+ wp_enqueue_script( 'jquery-ui' );
129
+ wp_enqueue_script( 'jquery-ui-core' );
130
+ wp_enqueue_script( 'jquery-ui-slider' );
131
+ wp_enqueue_script( 'jquery-ui-dialog' );
132
+ wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
133
+ wp_enqueue_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
134
+ wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
135
+ wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
136
137
//styles
138
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
139
+ wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
140
wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
141
wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
142
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
143
+ wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
144
+ wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
145
}
146
147
/**
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -190,15 +190,34 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
190
* @author Andrea Grillo <andrea.grillo@yithemes.com>
191
*/
192
protected function _upgrader_pre_download( $reply, $package, $upgrader ) {
193
194
/**
195
* It isn't YITH Premium plugins, please wordpress update it for me!
196
*/
197
- if( ! isset( $upgrader->skin->plugin ) ) {
198
return $reply;
199
}
200
201
- $plugin_info = YIT_Plugin_Licence()->get_product( $upgrader->skin->plugin );
202
203
/**
204
* False ? It isn't YITH Premium plugins, please wordpress update it for me!
190
* @author Andrea Grillo <andrea.grillo@yithemes.com>
191
*/
192
protected function _upgrader_pre_download( $reply, $package, $upgrader ) {
193
+ $plugin = false;
194
+ $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
195
+
196
+ if( ! $is_bulk ){
197
+ $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
198
+ }
199
+
200
+ else {
201
+ //Bulk action upgrade
202
+ $action_url = parse_url( $upgrader->skin->options['url'] );
203
+ parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ) );
204
+ $plugins = explode( ',', $plugins );
205
+ foreach( $plugins as $plugin_init ){
206
+ $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_init );
207
+ if( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ){
208
+ $plugin = $plugin_init;
209
+ }
210
+ }
211
+ }
212
213
/**
214
* It isn't YITH Premium plugins, please wordpress update it for me!
215
*/
216
+ if( ! $plugin ) {
217
return $reply;
218
}
219
220
+ $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
221
222
/**
223
* False ? It isn't YITH Premium plugins, please wordpress update it for me!
plugin-fw/licence/lib/yit-licence.php CHANGED
@@ -48,7 +48,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
48
* @var string The yithemes api uri
49
* @since 1.0
50
*/
51
- protected $_api_uri = 'http://www.yithemes.com';
52
53
/**
54
* @var string The yithemes api uri query args
48
* @var string The yithemes api uri
49
* @since 1.0
50
*/
51
+ protected $_api_uri = 'http://yithemes.com';
52
53
/**
54
* @var string The yithemes api uri query args
plugin-fw/licence/lib/yit-plugin-licence.php CHANGED
@@ -75,9 +75,7 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
75
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
76
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
77
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
78
- add_action( "wp_ajax_nopriv_activate-{$this->_product_type}", array( $this, 'activate' ) );
79
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
80
- add_action( "wp_ajax_nopriv_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
81
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
82
}
83
75
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
76
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
77
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
78
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
79
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
80
}
81
plugin-fw/licence/lib/yit-theme-licence.php CHANGED
@@ -71,9 +71,7 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
71
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
72
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
73
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
74
- add_action( "wp_ajax_nopriv_activate-{$this->_product_type}", array( $this, 'activate' ) );
75
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
76
- add_action( "wp_ajax_nopriv_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
77
}
78
79
/**
71
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
72
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
73
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
74
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
75
}
76
77
/**
plugin-fw/templates/panel/woocommerce/woocommerce-upload.php CHANGED
@@ -16,10 +16,10 @@
16
* @since 1.0.0
17
*/
18
19
- if ( ! defined( 'ABSPATH' ) ) {
20
exit;
21
} // Exit if accessed directly
22
-
23
24
?>
25
@@ -29,18 +29,25 @@ if ( ! defined( 'ABSPATH' ) ) {
29
</th>
30
<td class="forminp forminp-color plugin-option">
31
32
- <div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload" <?php if ( isset( $option['deps'] ) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $this->get_id_field( $option['deps']['ids'] ) ?>" data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
33
<div class="option">
34
- <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>" value="<?php echo $value == '1' ? '' : esc_attr( $value ) ?>" class="upload_img_url" />
35
- <input type="button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button" class="upload_button button" />
36
</div>
37
<div class="clear"></div>
38
<span class="description"><?php echo $desc ?></span>
39
<div class="upload_img_preview" style="margin-top:10px;">
40
<?php
41
$file = $value;
42
- if ( preg_match( '/(jpg|jpeg|png|gif|ico)#x2F;', $file ) ) {
43
- echo "<img src=\"" . YIT_CORE_PLUGIN_URL. "/assets/images/sleep.png\" data-src=\"$file\" />";
44
}
45
?>
46
</div>
16
* @since 1.0.0
17
*/
18
19
+ if (!defined('ABSPATH')) {
20
exit;
21
} // Exit if accessed directly
22
+ $hidden_val = get_option($id . "-yith-attachment-id", 0);
23
24
?>
25
29
</th>
30
<td class="forminp forminp-color plugin-option">
31
32
+ <div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload"
33
+ <?php if (isset($option['deps'])): ?>data-field="<?php echo $id ?>"
34
+ data-dep="<?php echo $this->get_id_field($option['deps']['ids']) ?>"
35
+ data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
36
<div class="option">
37
+ <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>"
38
+ value="<?php echo $value == '1' ? '' : esc_attr($value) ?>" class="upload_img_url"/>
39
+ <input type="hidden" name="<?php echo $id ?>-yith-attachment-id" id="<?php echo $id ?>-yith-attachment-id" value="<?php echo $hidden_val; ?>" />
40
+ <input type="button" value="<?php _e('Upload', 'yith-plugin-fw') ?>" id="<?php echo $id ?>-button"
41
+ class="upload_button button"/>
42
</div>
43
<div class="clear"></div>
44
<span class="description"><?php echo $desc ?></span>
45
+
46
<div class="upload_img_preview" style="margin-top:10px;">
47
<?php
48
$file = $value;
49
+ if (preg_match('/(jpg|jpeg|png|gif|ico)#x2F;', $file)) {
50
+ echo "<img src=\"" . YIT_CORE_PLUGIN_URL . "/assets/images/sleep.png\" data-src=\"$file\" />";
51
}
52
?>
53
</div>
plugin-fw/yit-plugin.php CHANGED
@@ -13,22 +13,10 @@ if ( ! defined( 'ABSPATH' ) ) {
13
} // Exit if accessed directly
14
15
16
- if( !defined('YIT_CORE_PLUGIN')) {
17
- define( 'YIT_CORE_PLUGIN', true);
18
- }
19
-
20
- if( !defined('YIT_CORE_PLUGIN_PATH')) {
21
- define( 'YIT_CORE_PLUGIN_PATH', dirname(__FILE__));
22
- }
23
-
24
- if( !defined('YIT_CORE_PLUGIN_URL')) {
25
- define( 'YIT_CORE_PLUGIN_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ));
26
- }
27
-
28
- if( ! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) ){
29
- define ( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
30
- }
31
-
32
33
include_once( 'yit-functions.php' );
34
include_once( 'yit-plugin-registration-hook.php' );
13
} // Exit if accessed directly
14
15
16
+ ! defined( 'YIT_CORE_PLUGIN' ) && define( 'YIT_CORE_PLUGIN', true);
17
+ ! defined( 'YIT_CORE_PLUGIN_PATH' ) && define( 'YIT_CORE_PLUGIN_PATH', dirname(__FILE__) );
18
+ ! defined( 'YIT_CORE_PLUGIN_URL' ) && define( 'YIT_CORE_PLUGIN_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) );
19
+ ! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) && define( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
20
21
include_once( 'yit-functions.php' );
22
include_once( 'yit-plugin-registration-hook.php' );
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -28,13 +28,12 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
28
29
30
function widget( $args, $instance ) {
31
- global $_chosen_attributes, $woocommerce, $_attributes_array;
32
33
extract( $args );
34
35
- $attributes_array = ! empty( $_attributes_array ) ? $_attributes_array : array();
36
-
37
- if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $attributes_array, apply_filters( 'yith_wcan_product_taxonomy_type', array( 'product_cat', 'product_tag' ) ) ) ) ) {
38
return;
39
}
40
@@ -156,7 +155,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
156
$current_filter[] = $term_param;
157
}
158
159
- if ( defined( 'SHOP_IS_ON_FRONT' ) || is_shop() ) {
160
$link = get_post_type_archive_link( 'product' );
161
}
162
@@ -168,7 +167,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
168
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
169
}
170
171
- $link = untrailingslashit( $link );
172
173
// All current filters
174
if ( $_chosen_attributes ) {
@@ -335,7 +334,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
335
$current_filter[] = $term->term_id;
336
}
337
338
- if ( defined( 'SHOP_IS_ON_FRONT' ) || is_shop() ) {
339
$link = get_post_type_archive_link( 'product' );
340
}
341
@@ -347,7 +346,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
347
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
348
}
349
350
- $link = untrailingslashit( $link );
351
352
// All current filters
353
if ( $_chosen_attributes ) {
@@ -505,7 +504,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
505
$current_filter[] = $term->term_id;
506
}
507
508
- if ( defined( 'SHOP_IS_ON_FRONT' ) || is_shop() ) {
509
$link = get_post_type_archive_link( 'product' );
510
}
511
@@ -517,7 +516,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
517
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
518
}
519
520
- $link = untrailingslashit( $link );
521
522
// All current filters
523
if ( $_chosen_attributes ) {
@@ -673,7 +672,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
673
$current_filter[] = $term->term_id;
674
}
675
676
- if ( defined( 'SHOP_IS_ON_FRONT' ) || is_shop() ) {
677
$link = get_post_type_archive_link( 'product' );
678
}
679
@@ -685,7 +684,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
685
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
686
}
687
688
- $link = untrailingslashit( $link );
689
690
// All current filters
691
if ( $_chosen_attributes ) {
28
29
30
function widget( $args, $instance ) {
31
+ global $_chosen_attributes, $woocommerce;
32
33
extract( $args );
34
+ $_attributes_array = yit_wcan_get_product_taxonomy();
35
36
+ if ( ! is_post_type_archive( 'product' ) && ! is_tax( $_attributes_array ) ) {
37
return;
38
}
39
155
$current_filter[] = $term_param;
156
}
157
158
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
159
$link = get_post_type_archive_link( 'product' );
160
}
161
167
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
168
}
169
170
+ $link = apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $link ) : $link;
171
172
// All current filters
173
if ( $_chosen_attributes ) {
334
$current_filter[] = $term->term_id;
335
}
336
337
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
338
$link = get_post_type_archive_link( 'product' );
339
}
340
346
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
347
}
348
349
+ $link = apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $link ) : $link;
350
351
// All current filters
352
if ( $_chosen_attributes ) {
504
$current_filter[] = $term->term_id;
505
}
506
507
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
508
$link = get_post_type_archive_link( 'product' );
509
}
510
516
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
517
}
518
519
+ $link = apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $link ) : $link;
520
521
// All current filters
522
if ( $_chosen_attributes ) {
672
$current_filter[] = $term->term_id;
673
}
674
675
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
676
$link = get_post_type_archive_link( 'product' );
677
}
678
684
$link = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
685
}
686
687
+ $link = apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $link ) : $link;
688
689
// All current filters
690
if ( $_chosen_attributes ) {
widgets/class.yith-wcan-reset-navigation-widget.php CHANGED
@@ -27,13 +27,13 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
27
28
29
function widget( $args, $instance ) {
30
- global $_chosen_attributes, $woocommerce, $_attributes_array;
31
32
extract( $args );
33
34
- $attributes_array = ! empty( $_attributes_array ) ? $_attributes_array : array();
35
36
- if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $attributes_array, apply_filters( 'yith_wcan_product_taxonomy_type', array( 'product_cat', 'product_tag' ) ) ) ) ) {
37
return;
38
}
39
27
28
29
function widget( $args, $instance ) {
30
+ global $_chosen_attributes, $woocommerce;
31
32
extract( $args );
33
34
+ $_attributes_array = yit_wcan_get_product_taxonomy();
35
36
+ if ( ! is_post_type_archive( 'product' ) && ! is_tax( $_attributes_array ) ) {
37
return;
38
}
39