Version Description
- Initial release
=
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Product Filter |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- README.txt +92 -0
- assets/css/admin.css +26 -0
- assets/css/frontend.css +84 -0
- assets/images/ajax-loader.gif +0 -0
- assets/js/yith-wcan-admin.js +38 -0
- assets/js/yith-wcan-frontend.js +89 -0
- assets/js/yith-wcan-frontend.min.js +15 -0
- class.yith-wcan-admin.php +106 -0
- class.yith-wcan-frontend.php +130 -0
- class.yith-wcan-helper.php +45 -0
- class.yith-wcan.php +79 -0
- functions.yith-wcan.php +101 -0
- init.php +57 -0
- languages/default.po +192 -0
- languages/yit-it_IT.mo +0 -0
- languages/yit-it_IT.po +191 -0
- languages/yit.pot +187 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- widgets/class.yith-wcan-navigation-widget.php +577 -0
- yit-common/assets/css/yith-panel.css +78 -0
- yit-common/assets/js/google_fonts.json +1 -0
- yit-common/assets/js/yith-panel.js +296 -0
- yit-common/google_fonts.php +68 -0
- yit-common/yit-functions.php +208 -0
- yit-common/yith-panel.php +504 -0
README.txt
ADDED
@@ -0,0 +1,92 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== YITH WooCommerce Ajax Navigation ===
|
2 |
+
|
3 |
+
Contributors: yithemes
|
4 |
+
Tags: woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation
|
5 |
+
Requires at least: 3.5.1
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 1.0.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page.
|
12 |
+
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page. The plugin also includes two new types of Product Attributes visualizations: Color and Label.
|
17 |
+
With Color display type you're able to assign a color (selected from a Color Picker) to each Product Attributes. With Label Color display you're able to assign a label (3 chars max) to your Product Attributes.
|
18 |
+
|
19 |
+
Working demos are available here:
|
20 |
+
**[LIVE DEMO 1](http://demo.yithemes.com/room09/shop/)** - **[LIVE DEMO 2](http://demo.yithemes.com/bazar/shop/)**
|
21 |
+
|
22 |
+
Full documentation is available [here](http://yithemes.com/docs-plugins/yith_ajax_navigation/).
|
23 |
+
|
24 |
+
|
25 |
+
= Installation =
|
26 |
+
|
27 |
+
Once you have installed the plugin, you just need to activate the plugin in order to enable it.
|
28 |
+
|
29 |
+
= Configuration =
|
30 |
+
|
31 |
+
The widget works with Product Attributes. This means you need to create the Attributes and to assign them to your products. Once you have customized your products with Product Attributes you're able to use the Widget.
|
32 |
+
|
33 |
+
= Developer =
|
34 |
+
|
35 |
+
Are you a developer? Want to customize the templates or the style of the plugin? Read on the [documentation](http://yithemes.com/docs-plugins/yith_ajax_navigation/) and discover how to do that.
|
36 |
+
|
37 |
+
= Support =
|
38 |
+
|
39 |
+
Hi there, we have good news here: all our plugins are released for free. Wow!
|
40 |
+
Already knew it, right?! Great, but maybe you do not know that: if you're looking for how to install the plugins or how to use them within your Wordpress installations, which is the right way to ask support?
|
41 |
+
That's the way:
|
42 |
+
|
43 |
+
* Register on http://yithemes.com
|
44 |
+
* Go to Support > Get Support
|
45 |
+
|
46 |
+
Here we provide support, not on wordpress.org were, usually we do not read topics. It's better to follow us or write on our forum!
|
47 |
+
|
48 |
+
== Installation ==
|
49 |
+
|
50 |
+
1. Unzip the downloaded zip file.
|
51 |
+
2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
|
52 |
+
3. Activate `YITH WooCommerce Ajax Navigation` from Plugins page
|
53 |
+
|
54 |
+
== Frequently Asked Questions ==
|
55 |
+
|
56 |
+
= The widget is not displayed in my sidebar. Why? =
|
57 |
+
In order to display the widget you need to assign it to the sidebar in the Shop page and you need to add Product Attributes to your product. Read the Getting Started section to learn how to add them.
|
58 |
+
|
59 |
+
== Screenshots ==
|
60 |
+
|
61 |
+
1. The widget in action with "Color" type selected
|
62 |
+
2. The widget in action with "Label" type selected
|
63 |
+
3. The final result
|
64 |
+
|
65 |
+
== Changelog ==
|
66 |
+
|
67 |
+
= 1.0.0 =
|
68 |
+
|
69 |
+
* Initial release
|
70 |
+
|
71 |
+
== Suggestions ==
|
72 |
+
|
73 |
+
If you have suggestions about how to improve YITH WooCommerce Ajax Navigation, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Ajax Navigation.
|
74 |
+
|
75 |
+
== Translators ==
|
76 |
+
|
77 |
+
= Available Languages =
|
78 |
+
* English (Default)
|
79 |
+
* Italiano
|
80 |
+
|
81 |
+
If you have created your own language pack, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
|
82 |
+
[use](http://yithemes.com/contact/ "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Ajax Navigation Languages.
|
83 |
+
|
84 |
+
== Documentation ==
|
85 |
+
|
86 |
+
Full documentation is available [here](http://yithemes.com/docs-plugins/yith_ajax_navigation/).
|
87 |
+
|
88 |
+
== Upgrade notice ==
|
89 |
+
|
90 |
+
= 1.0.0 =
|
91 |
+
|
92 |
+
Initial release
|
assets/css/admin.css
ADDED
@@ -0,0 +1,26 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/* widget area */
|
2 |
+
.yith_wcan_placeholder + .spinner {
|
3 |
+
background-position: center;
|
4 |
+
float: left;
|
5 |
+
margin: 10px 0;
|
6 |
+
width: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.yith_wcan_placeholder table {
|
10 |
+
width: 100%;
|
11 |
+
}
|
12 |
+
|
13 |
+
.yith_wcan_placeholder th {
|
14 |
+
text-align: left;
|
15 |
+
}
|
16 |
+
|
17 |
+
.yith_wcan_placeholder td {
|
18 |
+
vertical-align: top;
|
19 |
+
}
|
20 |
+
|
21 |
+
/*
|
22 |
+
.yith_wcan_placeholder .wp-color-result:after,
|
23 |
+
.yith_wcan_placeholder .wp-color-result.wp-picker-open:after{
|
24 |
+
content: "";
|
25 |
+
}
|
26 |
+
*/
|
assets/css/frontend.css
ADDED
@@ -0,0 +1,84 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
.yith-wcan-group:after {
|
2 |
+
content: "";
|
3 |
+
display: table;
|
4 |
+
clear: both;
|
5 |
+
}
|
6 |
+
|
7 |
+
.yith-wcan-loading {
|
8 |
+
background: url('../images/ajax-loader.gif') no-repeat center;
|
9 |
+
height: 100px;
|
10 |
+
}
|
11 |
+
|
12 |
+
.woocommerce .widget_layered_nav ul.yith-wcan li span,
|
13 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan li span {
|
14 |
+
cursor: not-allowed;
|
15 |
+
}
|
16 |
+
|
17 |
+
/* Colors Type */
|
18 |
+
.yith-wcan-color li {
|
19 |
+
float: left;
|
20 |
+
}
|
21 |
+
|
22 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a,
|
23 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li a,
|
24 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li span,
|
25 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li span {
|
26 |
+
border: 1px solid #ddd;
|
27 |
+
display: block;
|
28 |
+
height: 20px;
|
29 |
+
margin: 5px 5px 5px 0;
|
30 |
+
padding: 0;
|
31 |
+
width: 20px;
|
32 |
+
overflow: hidden;
|
33 |
+
text-indent: 100%;
|
34 |
+
white-space: nowrap;
|
35 |
+
}
|
36 |
+
|
37 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
|
38 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li a:hover,
|
39 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
40 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
41 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li span:hover,
|
42 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li span:hover,
|
43 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen span,
|
44 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen span {
|
45 |
+
border: 1px solid #444;
|
46 |
+
background-image: none;
|
47 |
+
|
48 |
+
-webkit-border-radius: 0;
|
49 |
+
-moz-border-radius: 0;
|
50 |
+
border-radius: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
/* Labels Type */
|
54 |
+
.yith-wcan-label li {
|
55 |
+
float: left;
|
56 |
+
}
|
57 |
+
|
58 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-label li a,
|
59 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-label li a,
|
60 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-label li span,
|
61 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-label li span {
|
62 |
+
background: #efefef;
|
63 |
+
border: 1px solid #ddd;
|
64 |
+
display: block;
|
65 |
+
margin: 5px 5px 5px 0;
|
66 |
+
padding: 2px;
|
67 |
+
overflow: hidden;
|
68 |
+
text-decoration: none;
|
69 |
+
}
|
70 |
+
|
71 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-label li a:hover,
|
72 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-label li a:hover,
|
73 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-label li.chosen a,
|
74 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-label li.chosen a {
|
75 |
+
border: 1px solid #444;
|
76 |
+
background-image: none;
|
77 |
+
background-color: #ad74a2;
|
78 |
+
color: #fff;
|
79 |
+
|
80 |
+
-webkit-border-radius: 0;
|
81 |
+
-moz-border-radius: 0;
|
82 |
+
border-radius: 0;
|
83 |
+
}
|
84 |
+
|
assets/images/ajax-loader.gif
ADDED
Binary file
|
assets/js/yith-wcan-admin.js
ADDED
@@ -0,0 +1,38 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/**
|
2 |
+
* Admin
|
3 |
+
*
|
4 |
+
* @author Your Inspiration Themes
|
5 |
+
* @package YITH WooCommerce Ajax Navigation
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
jQuery(function($){
|
9 |
+
|
10 |
+
$(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function(e){
|
11 |
+
var t = this,
|
12 |
+
container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
|
13 |
+
spinner = container.next('.spinner').show();
|
14 |
+
|
15 |
+
var data = {
|
16 |
+
action: 'yith_wcan_select_type',
|
17 |
+
id: $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
|
18 |
+
name: $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
|
19 |
+
attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
|
20 |
+
value: $('.yith_wcan_type', $(t).parents('.widget-content')).val()
|
21 |
+
};
|
22 |
+
|
23 |
+
|
24 |
+
$.post(ajaxurl, data, function(response) {
|
25 |
+
spinner.hide();
|
26 |
+
|
27 |
+
container.html( response.content );
|
28 |
+
$(document).trigger('yith_colorpicker');
|
29 |
+
}, 'json');
|
30 |
+
});
|
31 |
+
|
32 |
+
//color-picker
|
33 |
+
$(document).on('yith_colorpicker', function(){
|
34 |
+
$('.yith-colorpicker').each(function(){
|
35 |
+
$(this).wpColorPicker();
|
36 |
+
});
|
37 |
+
}).trigger('yith_colorpicker');
|
38 |
+
});
|
assets/js/yith-wcan-frontend.js
ADDED
@@ -0,0 +1,89 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/**
|
2 |
+
* Frontend
|
3 |
+
*
|
4 |
+
* @author Your Inspiration Themes
|
5 |
+
* @package YITH WooCommerce Ajax Navigation
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
jQuery(function($){
|
9 |
+
/**
|
10 |
+
Copyright (c) 2010, All Right Reserved, Wong Shek Hei @ shekhei@gmail.com
|
11 |
+
License: GNU Lesser General Public License (http://www.gnu.org/licenses/lgpl.html)
|
12 |
+
**/
|
13 |
+
var expr=/[.#\w].([\S]*)/g,classexpr=/(?!(\[))(\.)[^.#[]*/g,idexpr=/(#)[^.#[]*/,tagexpr=/^[\w]+/,varexpr=/(\w+?)=(['"])([^\2$]*?)\2/,simpleselector=/^[\w]+$/,parseSelector=function(d){for(var c={sel:[],val:[]},a=[],j=!1,h="",e=[],f=0,m=d.length;f<m;f++){var g=d.charAt(f);if(j)if("\\"===g&&f+1<d.length)e.push(d.charAt(++f));else if(h===g)h="",e.push(g);else if(("'"===g||'"'===g)&&""===h)h=g,e.push(g);else if("]"===g&&""===h)c.val.push(e.join("")),e=[],j=!1;else{if("]"!==g||""!==h)""===h&&","===g?(c.val.push(e.join("")),
|
14 |
+
e=[]):e.push(g)}else"\\"===g&&f+1<d.length?j&&e.push(d.charAt(++f)):"["===g&&""===h?j=!0:" "===g||"+"===g?(c.sel=c.sel.join(""),a.push(c),"+"===g&&a.push({sel:"+",val:""}),c={sel:[],val:[]}):" "!==g&&"]"!==g&&c.sel.push(g)}if(0!=c.sel.length||0!=c.val.length)c.sel=c.sel.join(""),a.push(c);for(f=0;f<a.length;f++){c=a[f].sel;if("+"===c)b.tag=c;else{var b=[];b.tag=tagexpr.exec(c);b.id=idexpr.exec(c);b.id&&$.isArray(b.id)&&(b.id=b.id[0].substr(1));b.tag||(b.tag="div");b.vars=[];for(d=0;d<a[f].val.length;d++)h=
|
15 |
+
a[f].val[d].indexOf("="),j=a[f].val[d].substr(0,h),h=a[f].val[d].substr(h+1),h=h.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===j?b.text=h:b.vars.push([j,h]);c=c.match(classexpr);j=[];if(c){for(d=0;d<c.length;d++)j.push(c[d].substr(1));b.className=j.join(" ")}}a[f]=b}return a},rmFromParent=function(d){var c=d.parentNode,a=d.nextSibling;c.removeChild(d);return a?function(){c.insertBefore(d,a)}:function(){c.appendChild(d)}},nonArrVer=function(d,c){var a=[],a=simpleselector.test(d)?[{tag:d}]:parseSelector(d),
|
16 |
+
j=[];"undefined"===typeof c&&(c=1);for(var h=[],e=[],f=[],m=document.createElement("div"),g=0,b=0;b<a.length;b++){if("+"==a[b].tag)e=f.slice(),--g;else{for(var l=0;l<c;l++)if("input"==a[b].tag){var k=[];k.push("<"+a[b].tag);a[b].id&&k.push("id='"+a[b].id+"'");a[b].className&&(k.push("class='"+a[b].className),b+1===a.length&&k.push(lastClass),k.push("'"));if(a[b].vars)for(var n=0;n<a[b].vars.length;n++)k.push(a[b].vars[n][0]+"='"+a[b].vars[n][1]+"'");a[b].text&&k.push("value='"+a[b].text+"'");k.push("/>");
|
17 |
+
f[l]=e[l];e[l]?(e[l].innerHTML+=k.join(" "),e[l]=e[l].lastChild):(m.innerHTML=k.join(" "),e[l]=m.removeChild(m.firstChild))}else{k=document.createElement(a[b].tag);if(a[b].vars)for(n=0;n<a[b].vars.length;n++)console.log(a[b].tag,a[b].vars[n]),k.setAttribute(a[b].vars[n][0],a[b].vars[n][1]);a[b].id&&(k.id=a[b].id);a[b].className&&(k.className=a[b].className);a[b].text&&k.appendChild(document.createTextNode(a[b].text));f[l]=e[l];e[l]=e[l]?e[l].appendChild(k):k}g++||Array.prototype.push.apply(h,e)}j=
|
18 |
+
$.merge(j,e)}return $(h)},arrVer=function(d,c,a){for(var j=d.match(/%[^%]*%/g)||[],h=[],e=0;e<c.length;e++){for(var f=d,m=0;m<j.length;m++)var g=j[m].substr(1,j[m].length-2),f=f.replace(j[m],c[e][g]);h=$.merge(h,nonArrVer(f,a))}return $(h)};
|
19 |
+
$.jseldom=function(d){if(2==arguments.length&&$.isPlainObject(arguments[1]))return arrVer.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!$.isArray(arguments[1]))return nonArrVer.apply(this,arguments);if(2==arguments.length)return arrVer.apply(this,arguments)};
|
20 |
+
|
21 |
+
|
22 |
+
//wrap the container
|
23 |
+
$(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
|
24 |
+
$('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
|
25 |
+
|
26 |
+
$(document).on('click', '.yith-wcan a', function(e){
|
27 |
+
e.preventDefault();
|
28 |
+
var href = this.href;
|
29 |
+
|
30 |
+
//loading
|
31 |
+
$(yith_wcan.container).html('').addClass('yith-wcan-loading');
|
32 |
+
$(yith_wcan.pagination).hide();
|
33 |
+
$(yith_wcan.result_count).hide();
|
34 |
+
|
35 |
+
$.ajax({
|
36 |
+
url: href,
|
37 |
+
success: function( response ){
|
38 |
+
$(yith_wcan.container).removeClass('yith-wcan-loading');
|
39 |
+
|
40 |
+
//container
|
41 |
+
if( $(response).find(yith_wcan.container).length > 0 ) {
|
42 |
+
$('.yit-wcan-container').html( $(response).find(yith_wcan.container) );
|
43 |
+
} else {
|
44 |
+
$('.yit-wcan-container').html( $(response).find('.woocommerce-info') );
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
//pagination
|
49 |
+
if( $(response).find(yith_wcan.pagination).length > 0 ) {
|
50 |
+
//se non esiste lo creo
|
51 |
+
if( $(yith_wcan.pagination).length == 0 ) {
|
52 |
+
$.jseldom( yith_wcan.pagination ).insertAfter( $(yith_wcan.container) );
|
53 |
+
}
|
54 |
+
|
55 |
+
$(yith_wcan.pagination)
|
56 |
+
.html( $(response).find(yith_wcan.pagination).html())
|
57 |
+
.show();
|
58 |
+
}
|
59 |
+
|
60 |
+
//result count
|
61 |
+
if( $(response).find(yith_wcan.result_count).length > 0 ) {
|
62 |
+
$(yith_wcan.result_count).html( $(response).find(yith_wcan.result_count).html()).show();
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
//load new widgets
|
67 |
+
$('.yith-woo-ajax-navigation').each(function(){
|
68 |
+
var id = $(this).attr('id');
|
69 |
+
$(this).html( $(response).find('#'+id).html() );
|
70 |
+
|
71 |
+
if( $(this).text() == '' ) {
|
72 |
+
$(this).hide();
|
73 |
+
} else {
|
74 |
+
$(this).show();
|
75 |
+
}
|
76 |
+
});
|
77 |
+
|
78 |
+
//update browser history (IE doesn't support it)
|
79 |
+
if ( !navigator.userAgent.match(/msie/i) ) {
|
80 |
+
window.history.pushState({"pageTitle":response.pageTitle},"", href);
|
81 |
+
}
|
82 |
+
|
83 |
+
//trigger ready event
|
84 |
+
$(document).trigger("ready");
|
85 |
+
$(document).trigger("yith-wcan-ajax-filtered");
|
86 |
+
}
|
87 |
+
});
|
88 |
+
});
|
89 |
+
});
|
assets/js/yith-wcan-frontend.min.js
ADDED
@@ -0,0 +1,15 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/**
|
2 |
+
* Frontend
|
3 |
+
*
|
4 |
+
* @author Your Inspiration Themes
|
5 |
+
* @package YITH WooCommerce Ajax Navigation
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
jQuery(function(c){var s=/(?!(\[))(\.)[^.#[]*/g,t=/(#)[^.#[]*/,u=/^[\w]+/,v=/^[\w]+$/,q=function(n,p){var a=[];if(v.test(n))a=[{tag:n}];else{for(var a=n,e={sel:[],val:[]},f=[],h=!1,g="",j=[],b=0,k=a.length;b<k;b++){var d=a.charAt(b);if(h)if("\\"===d&&b+1<a.length)j.push(a.charAt(++b));else if(g===d)g="",j.push(d);else if(("'"===d||'"'===d)&&""===g)g=d,j.push(d);else if("]"===d&&""===g)e.val.push(j.join("")),j=[],h=!1;else{if("]"!==d||""!==g)""===g&&","===d?(e.val.push(j.join("")),j=[]):j.push(d)}else"\\"===
|
9 |
+
d&&b+1<a.length?h&&j.push(a.charAt(++b)):"["===d&&""===g?h=!0:" "===d||"+"===d?(e.sel=e.sel.join(""),f.push(e),"+"===d&&f.push({sel:"+",val:""}),e={sel:[],val:[]}):" "!==d&&"]"!==d&&e.sel.push(d)}if(0!=e.sel.length||0!=e.val.length)e.sel=e.sel.join(""),f.push(e);for(b=0;b<f.length;b++){e=f[b].sel;if("+"===e)l.tag=e;else{var l=[];l.tag=u.exec(e);l.id=t.exec(e);l.id&&c.isArray(l.id)&&(l.id=l.id[0].substr(1));l.tag||(l.tag="div");l.vars=[];for(a=0;a<f[b].val.length;a++)g=f[b].val[a].indexOf("="),h=f[b].val[a].substr(0,
|
10 |
+
g),g=f[b].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===h?l.text=g:l.vars.push([h,g]);e=e.match(s);h=[];if(e){for(a=0;a<e.length;a++)h.push(e[a].substr(1));l.className=h.join(" ")}}f[b]=l}a=f}l=[];"undefined"===typeof p&&(p=1);e=[];f=[];h=[];g=document.createElement("div");for(b=j=0;b<a.length;b++){if("+"==a[b].tag)f=h.slice(),--j;else{for(k=0;k<p;k++)if("input"==a[b].tag){d=[];d.push("<"+a[b].tag);a[b].id&&d.push("id='"+a[b].id+"'");a[b].className&&(d.push("class='"+
|
11 |
+
a[b].className),b+1===a.length&&d.push(lastClass),d.push("'"));if(a[b].vars)for(var m=0;m<a[b].vars.length;m++)d.push(a[b].vars[m][0]+"='"+a[b].vars[m][1]+"'");a[b].text&&d.push("value='"+a[b].text+"'");d.push("/>");h[k]=f[k];f[k]?(f[k].innerHTML+=d.join(" "),f[k]=f[k].lastChild):(g.innerHTML=d.join(" "),f[k]=g.removeChild(g.firstChild))}else{d=document.createElement(a[b].tag);if(a[b].vars)for(m=0;m<a[b].vars.length;m++)console.log(a[b].tag,a[b].vars[m]),d.setAttribute(a[b].vars[m][0],a[b].vars[m][1]);
|
12 |
+
a[b].id&&(d.id=a[b].id);a[b].className&&(d.className=a[b].className);a[b].text&&d.appendChild(document.createTextNode(a[b].text));h[k]=f[k];f[k]=f[k]?f[k].appendChild(d):d}j++||Array.prototype.push.apply(e,f)}l=c.merge(l,f)}return c(e)},r=function(n,p,a){for(var e=n.match(/%[^%]*%/g)||[],f=[],h=0;h<p.length;h++){for(var g=n,j=0;j<e.length;j++)var b=e[j].substr(1,e[j].length-2),g=g.replace(e[j],p[h][b]);f=c.merge(f,q(g,a))}return c(f)};c.jseldom=function(n){if(2==arguments.length&&c.isPlainObject(arguments[1]))return r.apply(this,
|
13 |
+
[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!c.isArray(arguments[1]))return q.apply(this,arguments);if(2==arguments.length)return r.apply(this,arguments)};c(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');c(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');c(document).on("click",".yith-wcan a",function(n){n.preventDefault();var p=this.href;c(yith_wcan.container).html("").addClass("yith-wcan-loading");c(yith_wcan.pagination).hide();
|
14 |
+
c(yith_wcan.result_count).hide();c.ajax({url:p,success:function(a){c(yith_wcan.container).removeClass("yith-wcan-loading");0<c(a).find(yith_wcan.container).length?c(".yit-wcan-container").html(c(a).find(yith_wcan.container)):c(".yit-wcan-container").html(c(a).find(".woocommerce-info"));0<c(a).find(yith_wcan.pagination).length&&(0==c(yith_wcan.pagination).length&&c.jseldom(yith_wcan.pagination).insertAfter(c(yith_wcan.container)),c(yith_wcan.pagination).html(c(a).find(yith_wcan.pagination).html()).show());
|
15 |
+
0<c(a).find(yith_wcan.result_count).length&&c(yith_wcan.result_count).html(c(a).find(yith_wcan.result_count).html()).show();c(".yith-woo-ajax-navigation").each(function(){var e=c(this).attr("id");c(this).html(c(a).find("#"+e).html());""==c(this).text()?c(this).hide():c(this).show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:a.pageTitle},"",p);c(document).trigger("ready");c(document).trigger("yith-wcan-ajax-filtered")}})})});
|
class.yith-wcan-admin.php
ADDED
@@ -0,0 +1,106 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WCAN_Admin' ) ) {
|
13 |
+
/**
|
14 |
+
* Admin class.
|
15 |
+
* The class manage all the admin behaviors.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
*/
|
19 |
+
class YITH_WCAN_Admin {
|
20 |
+
/**
|
21 |
+
* Plugin version
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
* @since 1.0.0
|
25 |
+
*/
|
26 |
+
public $version;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @since 1.0.0
|
33 |
+
*/
|
34 |
+
public function __construct( $version ) {
|
35 |
+
$this->version = $version;
|
36 |
+
|
37 |
+
//Actions
|
38 |
+
add_action( 'init', array( $this, 'init' ) );
|
39 |
+
add_action('wp_ajax_yith_wcan_select_type', array( $this, 'ajax_print_terms') );
|
40 |
+
|
41 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
42 |
+
|
43 |
+
// YITH WCAN Loaded
|
44 |
+
do_action( 'yith_wcan_loaded' );
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Init method:
|
50 |
+
* - default options
|
51 |
+
*
|
52 |
+
* @access public
|
53 |
+
* @since 1.0.0
|
54 |
+
*/
|
55 |
+
public function init() {}
|
56 |
+
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Enqueue admin styles and scripts
|
60 |
+
*
|
61 |
+
* @access public
|
62 |
+
* @return void
|
63 |
+
* @since 1.0.0
|
64 |
+
*/
|
65 |
+
public function enqueue_styles_scripts() {
|
66 |
+
global $pagenow;
|
67 |
+
|
68 |
+
if( 'widgets.php' == $pagenow ) {
|
69 |
+
wp_enqueue_style( 'wp-color-picker' );
|
70 |
+
wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', false, $this->version );
|
71 |
+
|
72 |
+
wp_enqueue_script( 'wp-color-picker' );
|
73 |
+
wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array('jquery', 'wp-color-picker'), $this->version, true );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Print terms for the element selected
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return void
|
82 |
+
* @since 1.0.0
|
83 |
+
*/
|
84 |
+
public function ajax_print_terms() {
|
85 |
+
$type = $_POST['value'];
|
86 |
+
$attribute = $_POST['attribute'];
|
87 |
+
$return = array('message' => '', 'content' => $_POST);
|
88 |
+
|
89 |
+
$terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
|
90 |
+
|
91 |
+
|
92 |
+
$return['content'] = yith_wcan_attributes_table(
|
93 |
+
$type,
|
94 |
+
$attribute,
|
95 |
+
$_POST['id'],
|
96 |
+
$_POST['name'],
|
97 |
+
array(),
|
98 |
+
false
|
99 |
+
);
|
100 |
+
|
101 |
+
echo json_encode($return);
|
102 |
+
die();
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
}
|
class.yith-wcan-frontend.php
ADDED
@@ -0,0 +1,130 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WCAN_Frontend' ) ) {
|
13 |
+
/**
|
14 |
+
* Frontend class.
|
15 |
+
* The class manage all the frontend behaviors.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
*/
|
19 |
+
class YITH_WCAN_Frontend {
|
20 |
+
/**
|
21 |
+
* Plugin version
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
* @since 1.0.0
|
25 |
+
*/
|
26 |
+
public $version;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @since 1.0.0
|
33 |
+
*/
|
34 |
+
public function __construct( $version ) {
|
35 |
+
$this->version = $version;
|
36 |
+
|
37 |
+
//Actions
|
38 |
+
add_action( 'init', array( $this, 'init' ) );
|
39 |
+
add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
|
40 |
+
|
41 |
+
add_action( 'wp_head', array( $this, 'enqueue_styles_scripts' ) );
|
42 |
+
|
43 |
+
// YITH WCAN Loaded
|
44 |
+
do_action( 'yith_wcan_loaded' );
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Init method:
|
50 |
+
* - default options
|
51 |
+
*
|
52 |
+
* @access public
|
53 |
+
* @since 1.0.0
|
54 |
+
*/
|
55 |
+
public function init() {
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Enqueue frontend styles and scripts
|
62 |
+
*
|
63 |
+
* @access public
|
64 |
+
* @return void
|
65 |
+
* @since 1.0.0
|
66 |
+
*/
|
67 |
+
public function enqueue_styles_scripts() {
|
68 |
+
if( yith_wcan_can_be_displayed() ) {
|
69 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
70 |
+
|
71 |
+
wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
|
72 |
+
wp_enqueue_script( 'yith_wcan_frontend', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix .'.js', array('jquery'), $this->version, true );
|
73 |
+
|
74 |
+
$args = array(
|
75 |
+
'container' => '.products',
|
76 |
+
'pagination' => 'nav.woocommerce-pagination',
|
77 |
+
'result_count' => '.woocommerce-result-count'
|
78 |
+
);
|
79 |
+
wp_localize_script( 'yith_wcan_frontend', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Layered Nav Init
|
86 |
+
*
|
87 |
+
* @package WooCommerce/Widgets
|
88 |
+
* @access public
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public function woocommerce_layered_nav_init( ) {
|
92 |
+
|
93 |
+
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
|
94 |
+
|
95 |
+
global $_chosen_attributes, $woocommerce, $_attributes_array;
|
96 |
+
|
97 |
+
$_chosen_attributes = $_attributes_array = array();
|
98 |
+
|
99 |
+
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
100 |
+
if ( $attribute_taxonomies ) {
|
101 |
+
foreach ( $attribute_taxonomies as $tax ) {
|
102 |
+
|
103 |
+
$attribute = sanitize_title( $tax->attribute_name );
|
104 |
+
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
|
105 |
+
|
106 |
+
// create an array of product attribute taxonomies
|
107 |
+
$_attributes_array[] = $taxonomy;
|
108 |
+
|
109 |
+
$name = 'filter_' . $attribute;
|
110 |
+
$query_type_name = 'query_type_' . $attribute;
|
111 |
+
|
112 |
+
if ( ! empty( $_GET[ $name ] ) && taxonomy_exists( $taxonomy ) ) {
|
113 |
+
|
114 |
+
$_chosen_attributes[ $taxonomy ]['terms'] = explode( ',', $_GET[ $name ] );
|
115 |
+
|
116 |
+
if ( empty( $_GET[ $query_type_name ] ) || ! in_array( strtolower( $_GET[ $query_type_name ] ), array( 'and', 'or' ) ) )
|
117 |
+
$_chosen_attributes[ $taxonomy ]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
|
118 |
+
else
|
119 |
+
$_chosen_attributes[ $taxonomy ]['query_type'] = strtolower( $_GET[ $query_type_name ] );
|
120 |
+
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
add_filter('loop_shop_post_in', 'woocommerce_layered_nav_query');
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
130 |
+
}
|
class.yith-wcan-helper.php
ADDED
@@ -0,0 +1,45 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WCAN_Helper' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH WooCommerce Ajax Navigation Helper
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_WCAN_Helper {
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Get Woocommerce Attribute Taxonomies
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
* @access public
|
25 |
+
*/
|
26 |
+
public static function attribute_taxonomies() {
|
27 |
+
global $woocommerce;
|
28 |
+
|
29 |
+
if ( ! isset( $woocommerce ) ) return array();
|
30 |
+
|
31 |
+
$attributes = array();
|
32 |
+
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
33 |
+
|
34 |
+
if( empty( $attribute_taxonomies ) ) return array();
|
35 |
+
foreach( $attribute_taxonomies as $attribute ) {
|
36 |
+
if ( taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute->attribute_name ) ) ) {
|
37 |
+
$attributes[] = $attribute->attribute_name;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
return $attributes;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
class.yith-wcan.php
ADDED
@@ -0,0 +1,79 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WCAN' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH WooCommerce Ajax Navigation
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_WCAN {
|
19 |
+
/**
|
20 |
+
* Plugin version
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
public $version = '1.0.0';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Plugin object
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
public $obj = null;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor
|
37 |
+
*
|
38 |
+
* @return mixed|YITH_WCAN_Admin|YITH_WCAN_Frontend
|
39 |
+
* @since 1.0.0
|
40 |
+
*/
|
41 |
+
public function __construct() {
|
42 |
+
|
43 |
+
// actions
|
44 |
+
add_action( 'init', array( $this, 'init' ) );
|
45 |
+
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
46 |
+
|
47 |
+
|
48 |
+
if( is_admin() ) {
|
49 |
+
$this->obj = new YITH_WCAN_Admin( $this->version );
|
50 |
+
} else {
|
51 |
+
$this->obj = new YITH_WCAN_Frontend( $this->version );
|
52 |
+
}
|
53 |
+
|
54 |
+
return $this->obj;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Init method
|
60 |
+
*
|
61 |
+
* @access public
|
62 |
+
* @since 1.0.0
|
63 |
+
*/
|
64 |
+
public function init() {}
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Load and register widgets
|
69 |
+
*
|
70 |
+
* @access public
|
71 |
+
* @since 1.0.0
|
72 |
+
*/
|
73 |
+
public function registerWidgets() {
|
74 |
+
register_widget( 'YITH_WCAN_Navigation_Widget' );
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
}
|
functions.yith-wcan.php
ADDED
@@ -0,0 +1,101 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return a dropdown with Woocommerce attributes
|
15 |
+
*/
|
16 |
+
function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
|
17 |
+
$attributes = YITH_WCAN_Helper::attribute_taxonomies();
|
18 |
+
$options = "";
|
19 |
+
|
20 |
+
foreach( $attributes as $attribute ) {
|
21 |
+
$options .= "<option name='{$attribute}'". selected( $attribute, $selected, false ) .">{$attribute}</option>";
|
22 |
+
}
|
23 |
+
|
24 |
+
if( $echo ) {
|
25 |
+
echo $options;
|
26 |
+
} else {
|
27 |
+
return $options;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Print the widgets options already filled
|
34 |
+
*
|
35 |
+
* @param $type string list|colors|label
|
36 |
+
* @param $attribute woocommerce taxonomy
|
37 |
+
* @param $id id used in the <input />
|
38 |
+
* @param $name base name used in the <input />
|
39 |
+
* @param $values array of values (could be empty if this is an ajax call)
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = array(), $echo = true ) {
|
44 |
+
$return = '';
|
45 |
+
|
46 |
+
$terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
|
47 |
+
|
48 |
+
if( 'list' == $type ) {
|
49 |
+
$return = '<input type="hidden" name="'. $name .'[colors]" value="" /><input type="hidden" name="'. $name .'[labels]" value="" />';
|
50 |
+
} elseif( 'color' == $type ) {
|
51 |
+
if( !empty($terms) ) {
|
52 |
+
$return = sprintf('<table><tr><th>%s</th><th>%s</th></tr>', __('Term', 'yit'), __('Color', 'yit'));
|
53 |
+
|
54 |
+
foreach( $terms as $term ) {
|
55 |
+
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[colors][{$term->term_id}]' value='" . (isset( $values[$term->term_id] ) ? $values[$term->term_id] : '') . "' size='3' class='yith-colorpicker' /></td></tr>";
|
56 |
+
}
|
57 |
+
|
58 |
+
$return .= '</table>';
|
59 |
+
}
|
60 |
+
|
61 |
+
$return .= '<input type="hidden" name="'. $name .'[labels]" value="" />';
|
62 |
+
} elseif( 'label' == $type ) {
|
63 |
+
if( !empty($terms) ) {
|
64 |
+
$return = sprintf('<table><tr><th>%s</th><th>%s</th></tr>', __('Term', 'yit'), __('Labels', 'yit'));
|
65 |
+
|
66 |
+
foreach( $terms as $term ) {
|
67 |
+
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[labels][{$term->term_id}]' value='" . (isset( $values[$term->term_id] ) ? $values[$term->term_id] : '') . "' size='3' maxlength='3' /></td></tr>";
|
68 |
+
}
|
69 |
+
|
70 |
+
$return .= '</table>';
|
71 |
+
}
|
72 |
+
|
73 |
+
$return .= '<input type="hidden" name="'. $name .'[colors]" value="" />';
|
74 |
+
}
|
75 |
+
|
76 |
+
if( $echo ) {
|
77 |
+
echo $return;
|
78 |
+
}
|
79 |
+
|
80 |
+
return $return;
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Can the widget be displayed?
|
86 |
+
*
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
+
function yith_wcan_can_be_displayed() {
|
90 |
+
global $woocommerce, $_attributes_array;
|
91 |
+
|
92 |
+
|
93 |
+
/* if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $_attributes_array, array( 'product_cat', 'product_tag' ) ) ) )
|
94 |
+
return false;*/
|
95 |
+
|
96 |
+
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) ) {
|
97 |
+
return true;
|
98 |
+
} else {
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
}
|
init.php
ADDED
@@ -0,0 +1,57 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: YITH WooCommerce Ajax Navigation
|
4 |
+
* Plugin URI: http://yithemes.com/
|
5 |
+
* Description: YITH WooCommerce Ajax Navigation allows user to filter products in Shop page without reloading the page.
|
6 |
+
* Version: 1.0.0
|
7 |
+
* Author: Your Inspiration Themes
|
8 |
+
* Author URI: http://yithemes.com/
|
9 |
+
* Text Domain: yit
|
10 |
+
* Domain Path: /languages/
|
11 |
+
*
|
12 |
+
* @author Your Inspiration Themes
|
13 |
+
* @package YITH WooCommerce Ajax Navigation
|
14 |
+
* @version 1.0.0
|
15 |
+
*/
|
16 |
+
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
+
|
18 |
+
This program is free software; you can redistribute it and/or modify
|
19 |
+
it under the terms of the GNU General Public License, version 2, as
|
20 |
+
published by the Free Software Foundation.
|
21 |
+
|
22 |
+
This program is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU General Public License for more details.
|
26 |
+
|
27 |
+
You should have received a copy of the GNU General Public License
|
28 |
+
along with this program; if not, write to the Free Software
|
29 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
30 |
+
*/
|
31 |
+
if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Required functions
|
35 |
+
*/
|
36 |
+
if( !defined('YITH_FUNCTIONS') ) {
|
37 |
+
require_once( 'yit-common/yit-functions.php' );
|
38 |
+
}
|
39 |
+
if ( ! yit_is_woocommerce_active() ) return;
|
40 |
+
|
41 |
+
load_plugin_textdomain( 'yit', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
42 |
+
|
43 |
+
define( 'YITH_WCAN', true );
|
44 |
+
define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
45 |
+
define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
46 |
+
|
47 |
+
// Load required classes and functions
|
48 |
+
require_once('functions.yith-wcan.php');
|
49 |
+
require_once('class.yith-wcan-admin.php');
|
50 |
+
require_once('class.yith-wcan-frontend.php');
|
51 |
+
require_once('class.yith-wcan-helper.php');
|
52 |
+
require_once('widgets/class.yith-wcan-navigation-widget.php');
|
53 |
+
require_once('class.yith-wcan.php');
|
54 |
+
|
55 |
+
// Let's start the game!
|
56 |
+
global $yith_wcan;
|
57 |
+
$yith_wcan = new YITH_WCAN();
|
languages/default.po
ADDED
@@ -0,0 +1,192 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Ajax Navigation v1.0.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-06-17 12:59:26+0000\n"
|
7 |
+
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: CSL v1.x\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: UNITED STATES\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
18 |
+
"X-Poedit-Basepath: ../\n"
|
19 |
+
"X-Poedit-Bookmarks: \n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Textdomain-Support: yes"
|
22 |
+
|
23 |
+
#: functions.yith-wcan.php:52
|
24 |
+
#: functions.yith-wcan.php:64
|
25 |
+
#@ yit
|
26 |
+
msgid "Term"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: functions.yith-wcan.php:52
|
30 |
+
#: widgets/class.yith-wcan-navigation-widget.php:535
|
31 |
+
#@ yit
|
32 |
+
msgid "Color"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: functions.yith-wcan.php:64
|
36 |
+
#@ yit
|
37 |
+
msgid "Labels"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#. translators: plugin header field 'Name'
|
41 |
+
#: init.php:0
|
42 |
+
#: widgets/class.yith-wcan-navigation-widget.php:23
|
43 |
+
#@ yit
|
44 |
+
msgid "YITH WooCommerce Ajax Navigation"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#. translators: plugin header field 'PluginURI'
|
48 |
+
#. translators: plugin header field 'AuthorURI'
|
49 |
+
#: init.php:0
|
50 |
+
#@ yit
|
51 |
+
msgid "http://yithemes.com/"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#. translators: plugin header field 'Description'
|
55 |
+
#: init.php:0
|
56 |
+
#@ yit
|
57 |
+
msgid "YITH WooCommerce Ajax Navigation allows user to filter products in Shop page without reloading the page."
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#. translators: plugin header field 'Author'
|
61 |
+
#: init.php:0
|
62 |
+
#@ yit
|
63 |
+
msgid "Your Inspiration Themes"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#. translators: plugin header field 'Version'
|
67 |
+
#: init.php:0
|
68 |
+
#@ yit
|
69 |
+
msgid "1.0.0"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: widgets/class.yith-wcan-navigation-widget.php:21
|
73 |
+
#@ yit
|
74 |
+
msgid "Narrow down the products list without reloading the page"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: widgets/class.yith-wcan-navigation-widget.php:516
|
78 |
+
#@ yit
|
79 |
+
msgid "Title"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: widgets/class.yith-wcan-navigation-widget.php:521
|
83 |
+
#@ yit
|
84 |
+
msgid "Attribute:"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: widgets/class.yith-wcan-navigation-widget.php:526
|
88 |
+
#@ yit
|
89 |
+
msgid "Query Type:"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: widgets/class.yith-wcan-navigation-widget.php:528
|
93 |
+
#@ yit
|
94 |
+
msgid "AND"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: widgets/class.yith-wcan-navigation-widget.php:529
|
98 |
+
#@ yit
|
99 |
+
msgid "OR"
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: widgets/class.yith-wcan-navigation-widget.php:532
|
103 |
+
#@ yit
|
104 |
+
msgid "Type:"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: widgets/class.yith-wcan-navigation-widget.php:534
|
108 |
+
#@ yit
|
109 |
+
msgid "List"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: widgets/class.yith-wcan-navigation-widget.php:536
|
113 |
+
#@ yit
|
114 |
+
msgid "Label"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: yit-common/yith-panel.php:396
|
118 |
+
#@ yit
|
119 |
+
msgid "Select a date"
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: yit-common/yith-panel.php:397
|
123 |
+
#@ yit
|
124 |
+
msgid "Hours"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: yit-common/yith-panel.php:398
|
128 |
+
#: yit-common/yith-panel.php:399
|
129 |
+
#@ yit
|
130 |
+
msgid "Minutes"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: yit-common/yith-panel.php:407
|
134 |
+
#@ yit
|
135 |
+
msgid "Upload"
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: yit-common/yith-panel.php:434
|
139 |
+
#@ yit
|
140 |
+
msgid "px"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: yit-common/yith-panel.php:435
|
144 |
+
#@ yit
|
145 |
+
msgid "em"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: yit-common/yith-panel.php:436
|
149 |
+
#@ yit
|
150 |
+
msgid "pt"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: yit-common/yith-panel.php:437
|
154 |
+
#@ yit
|
155 |
+
msgid "rem"
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: yit-common/yith-panel.php:447
|
159 |
+
#@ yit
|
160 |
+
msgid "Select a font family"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: yit-common/yith-panel.php:455
|
164 |
+
#@ yit
|
165 |
+
msgid "Regular"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: yit-common/yith-panel.php:456
|
169 |
+
#@ yit
|
170 |
+
msgid "Bold"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: yit-common/yith-panel.php:457
|
174 |
+
#@ yit
|
175 |
+
msgid "Extra bold"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: yit-common/yith-panel.php:458
|
179 |
+
#@ yit
|
180 |
+
msgid "Italic"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: yit-common/yith-panel.php:459
|
184 |
+
#@ yit
|
185 |
+
msgid "Italic bold"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: yit-common/yith-panel.php:471
|
189 |
+
#@ yit
|
190 |
+
msgid "Click to preview"
|
191 |
+
msgstr ""
|
192 |
+
|
languages/yit-it_IT.mo
ADDED
Binary file
|
languages/yit-it_IT.po
ADDED
@@ -0,0 +1,191 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Ajax Navigation v1.0.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-06-17 15:07+0100\n"
|
7 |
+
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: Poedit 1.5.5\n"
|
14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
16 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"Language: it_IT\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
|
22 |
+
# @ yit
|
23 |
+
#: functions.yith-wcan.php:52 functions.yith-wcan.php:64
|
24 |
+
msgid "Term"
|
25 |
+
msgstr "Proprietà "
|
26 |
+
|
27 |
+
# @ yit
|
28 |
+
#: functions.yith-wcan.php:52
|
29 |
+
#: widgets/class.yith-wcan-navigation-widget.php:535
|
30 |
+
msgid "Color"
|
31 |
+
msgstr "Colore"
|
32 |
+
|
33 |
+
# @ yit
|
34 |
+
#: functions.yith-wcan.php:64
|
35 |
+
msgid "Labels"
|
36 |
+
msgstr "Label"
|
37 |
+
|
38 |
+
# @ yit
|
39 |
+
#. translators: plugin header field 'Name'
|
40 |
+
#: init.php:0 widgets/class.yith-wcan-navigation-widget.php:23
|
41 |
+
msgid "YITH WooCommerce Ajax Navigation"
|
42 |
+
msgstr "YITH WooCommerce Ajax Navigation"
|
43 |
+
|
44 |
+
# @ yit
|
45 |
+
#. translators: plugin header field 'PluginURI'
|
46 |
+
#. translators: plugin header field 'AuthorURI'
|
47 |
+
#: init.php:0
|
48 |
+
msgid "http://yithemes.com/"
|
49 |
+
msgstr "http://yithemes.com/"
|
50 |
+
|
51 |
+
# @ yit
|
52 |
+
#. translators: plugin header field 'Description'
|
53 |
+
#: init.php:0
|
54 |
+
msgid ""
|
55 |
+
"YITH WooCommerce Ajax Navigation allows user to filter products in Shop page "
|
56 |
+
"without reloading the page."
|
57 |
+
msgstr ""
|
58 |
+
"YITH WooCommerce Ajax Navigation consente all'utente di filtrare i prodotti "
|
59 |
+
"contenuti nella pagina Shop senza ricaricare la pagina."
|
60 |
+
|
61 |
+
# @ yit
|
62 |
+
#. translators: plugin header field 'Author'
|
63 |
+
#: init.php:0
|
64 |
+
msgid "Your Inspiration Themes"
|
65 |
+
msgstr "Your Inspiration Themes"
|
66 |
+
|
67 |
+
# @ yit
|
68 |
+
#. translators: plugin header field 'Version'
|
69 |
+
#: init.php:0
|
70 |
+
msgid "1.0.0"
|
71 |
+
msgstr "1.0.0"
|
72 |
+
|
73 |
+
# @ yit
|
74 |
+
#: widgets/class.yith-wcan-navigation-widget.php:21
|
75 |
+
msgid "Narrow down the products list without reloading the page"
|
76 |
+
msgstr "Filtra la lista dei prodotti senza ricaricare la pagina"
|
77 |
+
|
78 |
+
# @ yit
|
79 |
+
#: widgets/class.yith-wcan-navigation-widget.php:516
|
80 |
+
msgid "Title"
|
81 |
+
msgstr "Titolo"
|
82 |
+
|
83 |
+
# @ yit
|
84 |
+
#: widgets/class.yith-wcan-navigation-widget.php:521
|
85 |
+
msgid "Attribute:"
|
86 |
+
msgstr "Attributo:"
|
87 |
+
|
88 |
+
# @ yit
|
89 |
+
#: widgets/class.yith-wcan-navigation-widget.php:526
|
90 |
+
msgid "Query Type:"
|
91 |
+
msgstr "Tipo Query:"
|
92 |
+
|
93 |
+
# @ yit
|
94 |
+
#: widgets/class.yith-wcan-navigation-widget.php:528
|
95 |
+
msgid "AND"
|
96 |
+
msgstr "AND"
|
97 |
+
|
98 |
+
# @ yit
|
99 |
+
#: widgets/class.yith-wcan-navigation-widget.php:529
|
100 |
+
msgid "OR"
|
101 |
+
msgstr "OR"
|
102 |
+
|
103 |
+
# @ yit
|
104 |
+
#: widgets/class.yith-wcan-navigation-widget.php:532
|
105 |
+
msgid "Type:"
|
106 |
+
msgstr "Tipo:"
|
107 |
+
|
108 |
+
# @ yit
|
109 |
+
#: widgets/class.yith-wcan-navigation-widget.php:534
|
110 |
+
msgid "List"
|
111 |
+
msgstr "Lista"
|
112 |
+
|
113 |
+
# @ yit
|
114 |
+
#: widgets/class.yith-wcan-navigation-widget.php:536
|
115 |
+
msgid "Label"
|
116 |
+
msgstr "Label"
|
117 |
+
|
118 |
+
# @ yit
|
119 |
+
#: yit-common/yith-panel.php:396
|
120 |
+
msgid "Select a date"
|
121 |
+
msgstr "Seleziona una data"
|
122 |
+
|
123 |
+
# @ yit
|
124 |
+
#: yit-common/yith-panel.php:397
|
125 |
+
msgid "Hours"
|
126 |
+
msgstr "Ore"
|
127 |
+
|
128 |
+
# @ yit
|
129 |
+
#: yit-common/yith-panel.php:398 yit-common/yith-panel.php:399
|
130 |
+
msgid "Minutes"
|
131 |
+
msgstr "Minuti"
|
132 |
+
|
133 |
+
# @ yit
|
134 |
+
#: yit-common/yith-panel.php:407
|
135 |
+
msgid "Upload"
|
136 |
+
msgstr "Upload"
|
137 |
+
|
138 |
+
# @ yit
|
139 |
+
#: yit-common/yith-panel.php:434
|
140 |
+
msgid "px"
|
141 |
+
msgstr "px"
|
142 |
+
|
143 |
+
# @ yit
|
144 |
+
#: yit-common/yith-panel.php:435
|
145 |
+
msgid "em"
|
146 |
+
msgstr "em"
|
147 |
+
|
148 |
+
# @ yit
|
149 |
+
#: yit-common/yith-panel.php:436
|
150 |
+
msgid "pt"
|
151 |
+
msgstr "pt"
|
152 |
+
|
153 |
+
# @ yit
|
154 |
+
#: yit-common/yith-panel.php:437
|
155 |
+
msgid "rem"
|
156 |
+
msgstr "rem"
|
157 |
+
|
158 |
+
# @ yit
|
159 |
+
#: yit-common/yith-panel.php:447
|
160 |
+
msgid "Select a font family"
|
161 |
+
msgstr "Seleziona un font"
|
162 |
+
|
163 |
+
# @ yit
|
164 |
+
#: yit-common/yith-panel.php:455
|
165 |
+
msgid "Regular"
|
166 |
+
msgstr "Regular"
|
167 |
+
|
168 |
+
# @ yit
|
169 |
+
#: yit-common/yith-panel.php:456
|
170 |
+
msgid "Bold"
|
171 |
+
msgstr "Bold"
|
172 |
+
|
173 |
+
# @ yit
|
174 |
+
#: yit-common/yith-panel.php:457
|
175 |
+
msgid "Extra bold"
|
176 |
+
msgstr "Extra bold"
|
177 |
+
|
178 |
+
# @ yit
|
179 |
+
#: yit-common/yith-panel.php:458
|
180 |
+
msgid "Italic"
|
181 |
+
msgstr "Italic"
|
182 |
+
|
183 |
+
# @ yit
|
184 |
+
#: yit-common/yith-panel.php:459
|
185 |
+
msgid "Italic bold"
|
186 |
+
msgstr "Italic bold"
|
187 |
+
|
188 |
+
# @ yit
|
189 |
+
#: yit-common/yith-panel.php:471
|
190 |
+
msgid "Click to preview"
|
191 |
+
msgstr "Clicca per anteprima"
|
languages/yit.pot
ADDED
@@ -0,0 +1,187 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Ajax Navigation v1.0.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-06-17 15:02+0100\n"
|
7 |
+
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: Poedit 1.5.5\n"
|
14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
16 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Textdomain-Support: yes\n"
|
18 |
+
"Language: en_US\n"
|
19 |
+
|
20 |
+
# @ yit
|
21 |
+
#: functions.yith-wcan.php:52 functions.yith-wcan.php:64
|
22 |
+
msgid "Term"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
# @ yit
|
26 |
+
#: functions.yith-wcan.php:52
|
27 |
+
#: widgets/class.yith-wcan-navigation-widget.php:535
|
28 |
+
msgid "Color"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
# @ yit
|
32 |
+
#: functions.yith-wcan.php:64
|
33 |
+
msgid "Labels"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
# @ yit
|
37 |
+
#. translators: plugin header field 'Name'
|
38 |
+
#: init.php:0 widgets/class.yith-wcan-navigation-widget.php:23
|
39 |
+
msgid "YITH WooCommerce Ajax Navigation"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
# @ yit
|
43 |
+
#. translators: plugin header field 'PluginURI'
|
44 |
+
#. translators: plugin header field 'AuthorURI'
|
45 |
+
#: init.php:0
|
46 |
+
msgid "http://yithemes.com/"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
# @ yit
|
50 |
+
#. translators: plugin header field 'Description'
|
51 |
+
#: init.php:0
|
52 |
+
msgid ""
|
53 |
+
"YITH WooCommerce Ajax Navigation allows user to filter products in Shop page "
|
54 |
+
"without reloading the page."
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
# @ yit
|
58 |
+
#. translators: plugin header field 'Author'
|
59 |
+
#: init.php:0
|
60 |
+
msgid "Your Inspiration Themes"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
# @ yit
|
64 |
+
#. translators: plugin header field 'Version'
|
65 |
+
#: init.php:0
|
66 |
+
msgid "1.0.0"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
# @ yit
|
70 |
+
#: widgets/class.yith-wcan-navigation-widget.php:21
|
71 |
+
msgid "Narrow down the products list without reloading the page"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
# @ yit
|
75 |
+
#: widgets/class.yith-wcan-navigation-widget.php:516
|
76 |
+
msgid "Title"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
# @ yit
|
80 |
+
#: widgets/class.yith-wcan-navigation-widget.php:521
|
81 |
+
msgid "Attribute:"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
# @ yit
|
85 |
+
#: widgets/class.yith-wcan-navigation-widget.php:526
|
86 |
+
msgid "Query Type:"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
# @ yit
|
90 |
+
#: widgets/class.yith-wcan-navigation-widget.php:528
|
91 |
+
msgid "AND"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
# @ yit
|
95 |
+
#: widgets/class.yith-wcan-navigation-widget.php:529
|
96 |
+
msgid "OR"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
# @ yit
|
100 |
+
#: widgets/class.yith-wcan-navigation-widget.php:532
|
101 |
+
msgid "Type:"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
# @ yit
|
105 |
+
#: widgets/class.yith-wcan-navigation-widget.php:534
|
106 |
+
msgid "List"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
# @ yit
|
110 |
+
#: widgets/class.yith-wcan-navigation-widget.php:536
|
111 |
+
msgid "Label"
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
# @ yit
|
115 |
+
#: yit-common/yith-panel.php:396
|
116 |
+
msgid "Select a date"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
# @ yit
|
120 |
+
#: yit-common/yith-panel.php:397
|
121 |
+
msgid "Hours"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
# @ yit
|
125 |
+
#: yit-common/yith-panel.php:398 yit-common/yith-panel.php:399
|
126 |
+
msgid "Minutes"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
# @ yit
|
130 |
+
#: yit-common/yith-panel.php:407
|
131 |
+
msgid "Upload"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
# @ yit
|
135 |
+
#: yit-common/yith-panel.php:434
|
136 |
+
msgid "px"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
# @ yit
|
140 |
+
#: yit-common/yith-panel.php:435
|
141 |
+
msgid "em"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
# @ yit
|
145 |
+
#: yit-common/yith-panel.php:436
|
146 |
+
msgid "pt"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
# @ yit
|
150 |
+
#: yit-common/yith-panel.php:437
|
151 |
+
msgid "rem"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
# @ yit
|
155 |
+
#: yit-common/yith-panel.php:447
|
156 |
+
msgid "Select a font family"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
# @ yit
|
160 |
+
#: yit-common/yith-panel.php:455
|
161 |
+
msgid "Regular"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
# @ yit
|
165 |
+
#: yit-common/yith-panel.php:456
|
166 |
+
msgid "Bold"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
# @ yit
|
170 |
+
#: yit-common/yith-panel.php:457
|
171 |
+
msgid "Extra bold"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
# @ yit
|
175 |
+
#: yit-common/yith-panel.php:458
|
176 |
+
msgid "Italic"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
# @ yit
|
180 |
+
#: yit-common/yith-panel.php:459
|
181 |
+
msgid "Italic bold"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
# @ yit
|
185 |
+
#: yit-common/yith-panel.php:471
|
186 |
+
msgid "Click to preview"
|
187 |
+
msgstr ""
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
widgets/class.yith-wcan-navigation-widget.php
ADDED
@@ -0,0 +1,577 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WCAN' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH WooCommerce Ajax Navigation Widget
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_WCAN_Navigation_Widget extends WP_Widget {
|
19 |
+
|
20 |
+
function __construct() {
|
21 |
+
$widget_ops = array('classname' => 'yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Narrow down the products list without reloading the page', 'yit') );
|
22 |
+
$control_ops = array('width' => 400, 'height' => 350);
|
23 |
+
parent::__construct('yith-woo-ajax-navigation', __('YITH WooCommerce Ajax Navigation', 'yit'), $widget_ops, $control_ops);
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
function widget( $args, $instance ) {
|
28 |
+
global $_chosen_attributes, $woocommerce, $_attributes_array;
|
29 |
+
|
30 |
+
extract( $args );
|
31 |
+
|
32 |
+
if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $_attributes_array, array( 'product_cat', 'product_tag' ) ) ) )
|
33 |
+
return;
|
34 |
+
|
35 |
+
$current_term = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->term_id : '';
|
36 |
+
$current_tax = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->taxonomy : '';
|
37 |
+
|
38 |
+
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
39 |
+
$taxonomy = $woocommerce->attribute_taxonomy_name($instance['attribute']);
|
40 |
+
$query_type = isset( $instance['query_type'] ) ? $instance['query_type'] : 'and';
|
41 |
+
$display_type = isset( $instance['type'] ) ? $instance['type'] : 'list';
|
42 |
+
|
43 |
+
if ( ! taxonomy_exists( $taxonomy ) )
|
44 |
+
return;
|
45 |
+
|
46 |
+
$terms = get_terms( $taxonomy, array( 'hide_empty' => '1' ) );
|
47 |
+
|
48 |
+
if ( count( $terms ) > 0 ) {
|
49 |
+
|
50 |
+
ob_start();
|
51 |
+
|
52 |
+
$found = false;
|
53 |
+
|
54 |
+
echo $before_widget . $before_title . $title . $after_title;
|
55 |
+
|
56 |
+
// Force found when option is selected - do not force found on taxonomy attributes
|
57 |
+
if ( ! $_attributes_array || ! is_tax( $_attributes_array ) )
|
58 |
+
if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) )
|
59 |
+
$found = true;
|
60 |
+
|
61 |
+
if ( $display_type == 'list' ) {
|
62 |
+
// List display
|
63 |
+
echo "<ul class='yith-wcan-list yith-wcan'>";
|
64 |
+
|
65 |
+
foreach ( $terms as $term ) {
|
66 |
+
|
67 |
+
// Get count based on current view - uses transients
|
68 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
69 |
+
|
70 |
+
if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
71 |
+
|
72 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
73 |
+
|
74 |
+
set_transient( $transient_name, $_products_in_term );
|
75 |
+
}
|
76 |
+
|
77 |
+
$option_is_set = ( isset( $_chosen_attributes[ $taxonomy ] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) );
|
78 |
+
|
79 |
+
// If this is an AND query, only show options with count > 0
|
80 |
+
if ( $query_type == 'and' ) {
|
81 |
+
|
82 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
83 |
+
|
84 |
+
// skip the term for the current archive
|
85 |
+
if ( $current_term == $term->term_id )
|
86 |
+
continue;
|
87 |
+
|
88 |
+
if ( $count > 0 && $current_term !== $term->term_id )
|
89 |
+
$found = true;
|
90 |
+
|
91 |
+
if ( $count == 0 && ! $option_is_set )
|
92 |
+
continue;
|
93 |
+
|
94 |
+
// If this is an OR query, show all options so search can be expanded
|
95 |
+
} else {
|
96 |
+
|
97 |
+
// skip the term for the current archive
|
98 |
+
if ( $current_term == $term->term_id )
|
99 |
+
continue;
|
100 |
+
|
101 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
102 |
+
|
103 |
+
if ( $count > 0 )
|
104 |
+
$found = true;
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
$arg = 'filter_' . sanitize_title( $instance['attribute'] );
|
109 |
+
|
110 |
+
$current_filter = ( isset( $_GET[ $arg ] ) ) ? explode( ',', $_GET[ $arg ] ) : array();
|
111 |
+
|
112 |
+
if ( ! is_array( $current_filter ) )
|
113 |
+
$current_filter = array();
|
114 |
+
|
115 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
116 |
+
|
117 |
+
if ( ! in_array( $term->term_id, $current_filter ) )
|
118 |
+
$current_filter[] = $term->term_id;
|
119 |
+
|
120 |
+
// Base Link decided by current page
|
121 |
+
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
|
122 |
+
$link = home_url();
|
123 |
+
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id('shop') ) ) {
|
124 |
+
$link = get_post_type_archive_link( 'product' );
|
125 |
+
} else {
|
126 |
+
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
127 |
+
}
|
128 |
+
|
129 |
+
// All current filters
|
130 |
+
if ( $_chosen_attributes ) {
|
131 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
132 |
+
if ( $name !== $taxonomy ) {
|
133 |
+
|
134 |
+
// Exclude query arg for current term archive term
|
135 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
136 |
+
$key = array_search( $current_term, $data );
|
137 |
+
unset( $data['terms'][$key] );
|
138 |
+
}
|
139 |
+
|
140 |
+
// Remove pa_ and sanitize
|
141 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
142 |
+
|
143 |
+
if ( ! empty( $data['terms'] ) )
|
144 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
145 |
+
|
146 |
+
if ( $data['query_type'] == 'or' )
|
147 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
// Min/Max
|
153 |
+
if ( isset( $_GET['min_price'] ) )
|
154 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
155 |
+
|
156 |
+
if ( isset( $_GET['max_price'] ) )
|
157 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
158 |
+
|
159 |
+
// Current Filter = this widget
|
160 |
+
if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
|
161 |
+
|
162 |
+
$class = 'class="chosen"';
|
163 |
+
|
164 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
165 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
166 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
167 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
168 |
+
}
|
169 |
+
|
170 |
+
} else {
|
171 |
+
|
172 |
+
$class = '';
|
173 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
// Search Arg
|
178 |
+
if ( get_search_query() )
|
179 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
180 |
+
|
181 |
+
// Post Type Arg
|
182 |
+
if ( isset( $_GET['post_type'] ) )
|
183 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
184 |
+
|
185 |
+
// Query type Arg
|
186 |
+
if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
|
187 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
188 |
+
|
189 |
+
echo '<li ' . $class . '>';
|
190 |
+
|
191 |
+
echo ( $count > 0 || $option_is_set ) ? '<a href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
|
192 |
+
|
193 |
+
echo $term->name;
|
194 |
+
|
195 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
196 |
+
|
197 |
+
echo ' <small class="count">' . $count . '</small></li>';
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
echo "</ul>";
|
202 |
+
|
203 |
+
} elseif ( $display_type == 'color' ) {
|
204 |
+
// List display
|
205 |
+
echo "<ul class='yith-wcan-color yith-wcan yith-wcan-group'>";
|
206 |
+
|
207 |
+
foreach ( $terms as $term ) {
|
208 |
+
|
209 |
+
// Get count based on current view - uses transients
|
210 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
211 |
+
|
212 |
+
if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
213 |
+
|
214 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
215 |
+
|
216 |
+
set_transient( $transient_name, $_products_in_term );
|
217 |
+
}
|
218 |
+
|
219 |
+
$option_is_set = ( isset( $_chosen_attributes[ $taxonomy ] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) );
|
220 |
+
|
221 |
+
// If this is an AND query, only show options with count > 0
|
222 |
+
if ( $query_type == 'and' ) {
|
223 |
+
|
224 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
225 |
+
|
226 |
+
// skip the term for the current archive
|
227 |
+
if ( $current_term == $term->term_id )
|
228 |
+
continue;
|
229 |
+
|
230 |
+
if ( $count > 0 && $current_term !== $term->term_id )
|
231 |
+
$found = true;
|
232 |
+
|
233 |
+
if ( $count == 0 && ! $option_is_set )
|
234 |
+
continue;
|
235 |
+
|
236 |
+
// If this is an OR query, show all options so search can be expanded
|
237 |
+
} else {
|
238 |
+
|
239 |
+
// skip the term for the current archive
|
240 |
+
if ( $current_term == $term->term_id )
|
241 |
+
continue;
|
242 |
+
|
243 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
244 |
+
|
245 |
+
if ( $count > 0 )
|
246 |
+
$found = true;
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
$arg = 'filter_' . sanitize_title( $instance['attribute'] );
|
251 |
+
|
252 |
+
$current_filter = ( isset( $_GET[ $arg ] ) ) ? explode( ',', $_GET[ $arg ] ) : array();
|
253 |
+
|
254 |
+
if ( ! is_array( $current_filter ) )
|
255 |
+
$current_filter = array();
|
256 |
+
|
257 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
258 |
+
|
259 |
+
if ( ! in_array( $term->term_id, $current_filter ) )
|
260 |
+
$current_filter[] = $term->term_id;
|
261 |
+
|
262 |
+
// Base Link decided by current page
|
263 |
+
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
|
264 |
+
$link = home_url();
|
265 |
+
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id('shop') ) ) {
|
266 |
+
$link = get_post_type_archive_link( 'product' );
|
267 |
+
} else {
|
268 |
+
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
269 |
+
}
|
270 |
+
|
271 |
+
// All current filters
|
272 |
+
if ( $_chosen_attributes ) {
|
273 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
274 |
+
if ( $name !== $taxonomy ) {
|
275 |
+
|
276 |
+
// Exclude query arg for current term archive term
|
277 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
278 |
+
$key = array_search( $current_term, $data );
|
279 |
+
unset( $data['terms'][$key] );
|
280 |
+
}
|
281 |
+
|
282 |
+
// Remove pa_ and sanitize
|
283 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
284 |
+
|
285 |
+
if ( ! empty( $data['terms'] ) )
|
286 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
287 |
+
|
288 |
+
if ( $data['query_type'] == 'or' )
|
289 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
290 |
+
}
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
// Min/Max
|
295 |
+
if ( isset( $_GET['min_price'] ) )
|
296 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
297 |
+
|
298 |
+
if ( isset( $_GET['max_price'] ) )
|
299 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
300 |
+
|
301 |
+
// Current Filter = this widget
|
302 |
+
if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
|
303 |
+
|
304 |
+
$class = 'class="chosen"';
|
305 |
+
|
306 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
307 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
308 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
309 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
310 |
+
}
|
311 |
+
|
312 |
+
} else {
|
313 |
+
|
314 |
+
$class = '';
|
315 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
316 |
+
|
317 |
+
}
|
318 |
+
|
319 |
+
// Search Arg
|
320 |
+
if ( get_search_query() )
|
321 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
322 |
+
|
323 |
+
// Post Type Arg
|
324 |
+
if ( isset( $_GET['post_type'] ) )
|
325 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
326 |
+
|
327 |
+
// Query type Arg
|
328 |
+
if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
|
329 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
330 |
+
|
331 |
+
echo '<li ' . $class . '>';
|
332 |
+
|
333 |
+
echo ( $count > 0 || $option_is_set ) ? '<a style="background-color:' . $instance['colors'][$term->term_id] . ';" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span style="background-color:' . $instance['colors'][$term->term_id] . ';" >';
|
334 |
+
|
335 |
+
echo $term->name;
|
336 |
+
|
337 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
338 |
+
|
339 |
+
//echo ' <small class="count">' . $count . '</small></li>';
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
echo "</ul>";
|
344 |
+
|
345 |
+
} elseif ( $display_type == 'label' ) {
|
346 |
+
// List display
|
347 |
+
echo "<ul class='yith-wcan-label yith-wcan yith-wcan-group'>";
|
348 |
+
|
349 |
+
foreach ( $terms as $term ) {
|
350 |
+
|
351 |
+
// Get count based on current view - uses transients
|
352 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
353 |
+
|
354 |
+
if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
355 |
+
|
356 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
357 |
+
|
358 |
+
set_transient( $transient_name, $_products_in_term );
|
359 |
+
}
|
360 |
+
|
361 |
+
$option_is_set = ( isset( $_chosen_attributes[ $taxonomy ] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) );
|
362 |
+
|
363 |
+
// If this is an AND query, only show options with count > 0
|
364 |
+
if ( $query_type == 'and' ) {
|
365 |
+
|
366 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
367 |
+
|
368 |
+
// skip the term for the current archive
|
369 |
+
if ( $current_term == $term->term_id )
|
370 |
+
continue;
|
371 |
+
|
372 |
+
if ( $count > 0 && $current_term !== $term->term_id )
|
373 |
+
$found = true;
|
374 |
+
|
375 |
+
if ( $count == 0 && ! $option_is_set )
|
376 |
+
continue;
|
377 |
+
|
378 |
+
// If this is an OR query, show all options so search can be expanded
|
379 |
+
} else {
|
380 |
+
|
381 |
+
// skip the term for the current archive
|
382 |
+
if ( $current_term == $term->term_id )
|
383 |
+
continue;
|
384 |
+
|
385 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
386 |
+
|
387 |
+
if ( $count > 0 )
|
388 |
+
$found = true;
|
389 |
+
|
390 |
+
}
|
391 |
+
|
392 |
+
$arg = 'filter_' . sanitize_title( $instance['attribute'] );
|
393 |
+
|
394 |
+
$current_filter = ( isset( $_GET[ $arg ] ) ) ? explode( ',', $_GET[ $arg ] ) : array();
|
395 |
+
|
396 |
+
if ( ! is_array( $current_filter ) )
|
397 |
+
$current_filter = array();
|
398 |
+
|
399 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
400 |
+
|
401 |
+
if ( ! in_array( $term->term_id, $current_filter ) )
|
402 |
+
$current_filter[] = $term->term_id;
|
403 |
+
|
404 |
+
// Base Link decided by current page
|
405 |
+
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
|
406 |
+
$link = home_url();
|
407 |
+
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id('shop') ) ) {
|
408 |
+
$link = get_post_type_archive_link( 'product' );
|
409 |
+
} else {
|
410 |
+
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
411 |
+
}
|
412 |
+
|
413 |
+
// All current filters
|
414 |
+
if ( $_chosen_attributes ) {
|
415 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
416 |
+
if ( $name !== $taxonomy ) {
|
417 |
+
|
418 |
+
// Exclude query arg for current term archive term
|
419 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
420 |
+
$key = array_search( $current_term, $data );
|
421 |
+
unset( $data['terms'][$key] );
|
422 |
+
}
|
423 |
+
|
424 |
+
// Remove pa_ and sanitize
|
425 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
426 |
+
|
427 |
+
if ( ! empty( $data['terms'] ) )
|
428 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
429 |
+
|
430 |
+
if ( $data['query_type'] == 'or' )
|
431 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
432 |
+
}
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
// Min/Max
|
437 |
+
if ( isset( $_GET['min_price'] ) )
|
438 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
439 |
+
|
440 |
+
if ( isset( $_GET['max_price'] ) )
|
441 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
442 |
+
|
443 |
+
// Current Filter = this widget
|
444 |
+
if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
|
445 |
+
|
446 |
+
$class = 'class="chosen"';
|
447 |
+
|
448 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
449 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
450 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
451 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
452 |
+
}
|
453 |
+
|
454 |
+
} else {
|
455 |
+
|
456 |
+
$class = '';
|
457 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
458 |
+
|
459 |
+
}
|
460 |
+
|
461 |
+
// Search Arg
|
462 |
+
if ( get_search_query() )
|
463 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
464 |
+
|
465 |
+
// Post Type Arg
|
466 |
+
if ( isset( $_GET['post_type'] ) )
|
467 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
468 |
+
|
469 |
+
// Query type Arg
|
470 |
+
if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
|
471 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
472 |
+
|
473 |
+
echo '<li ' . $class . '>';
|
474 |
+
|
475 |
+
echo ( $count > 0 || $option_is_set ) ? '<a title="' . $term->name . '" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
|
476 |
+
|
477 |
+
echo $instance['labels'][$term->term_id];
|
478 |
+
|
479 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
480 |
+
|
481 |
+
//echo ' <small class="count">' . $count . '</small></li>';
|
482 |
+
|
483 |
+
}
|
484 |
+
echo "</ul>";
|
485 |
+
|
486 |
+
} // End display type conditional
|
487 |
+
|
488 |
+
echo $after_widget;
|
489 |
+
|
490 |
+
if ( ! $found ) {
|
491 |
+
ob_end_clean();
|
492 |
+
echo substr($before_widget, 0, strlen($before_widget) - 1) . ' style="display:none">' . $after_widget;
|
493 |
+
} else {
|
494 |
+
echo ob_get_clean();
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
function form( $instance ) {
|
501 |
+
global $woocommerce;
|
502 |
+
|
503 |
+
$defaults = array(
|
504 |
+
'title' => '',
|
505 |
+
'attribute' => '',
|
506 |
+
'query_type' => 'and',
|
507 |
+
'type' => 'list',
|
508 |
+
'colors' => '',
|
509 |
+
'labels' => ''
|
510 |
+
);
|
511 |
+
|
512 |
+
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
513 |
+
|
514 |
+
<p>
|
515 |
+
<label>
|
516 |
+
<strong><?php _e( 'Title', 'yit' ) ?>:</strong><br />
|
517 |
+
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
|
518 |
+
</label>
|
519 |
+
</p>
|
520 |
+
|
521 |
+
<p><label for="<?php echo $this->get_field_id('attribute'); ?>"><strong><?php _e('Attribute:', 'yit') ?></strong></label>
|
522 |
+
<select class="yith_wcan_attributes widefat" id="<?php echo esc_attr( $this->get_field_id('attribute') ); ?>" name="<?php echo esc_attr( $this->get_field_name('attribute') ); ?>">
|
523 |
+
<?php yith_wcan_dropdown_attributes( $instance['attribute'] ); ?>
|
524 |
+
</select></p>
|
525 |
+
|
526 |
+
<p><label for="<?php echo $this->get_field_id( 'query_type' ); ?>"><?php _e( 'Query Type:', 'yit' ) ?></label>
|
527 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'query_type' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'query_type' ) ); ?>">
|
528 |
+
<option value="and" <?php selected( $instance['query_type'], 'and' ); ?>><?php _e( 'AND', 'yit' ); ?></option>
|
529 |
+
<option value="or" <?php selected( $instance['query_type'], 'or' ); ?>><?php _e( 'OR', 'yit' ); ?></option>
|
530 |
+
</select></p>
|
531 |
+
|
532 |
+
<p><label for="<?php echo $this->get_field_id('type'); ?>"><strong><?php _e('Type:', 'yit') ?></strong></label>
|
533 |
+
<select class="yith_wcan_type widefat" id="<?php echo esc_attr( $this->get_field_id('type') ); ?>" name="<?php echo esc_attr( $this->get_field_name('type') ); ?>">
|
534 |
+
<option value="list" <?php selected( 'list', $instance['type'] ) ?>><?php _e( 'List', 'yit' ) ?></option>
|
535 |
+
<option value="color" <?php selected( 'color', $instance['type'] ) ?>><?php _e( 'Color', 'yit' ) ?></option>
|
536 |
+
<option value="label" <?php selected( 'label', $instance['type'] ) ?>><?php _e( 'Label', 'yit' ) ?></option>
|
537 |
+
</select></p>
|
538 |
+
|
539 |
+
<div class="yith_wcan_placeholder">
|
540 |
+
<?php yith_wcan_attributes_table(
|
541 |
+
$instance['type'],
|
542 |
+
$instance['attribute'],
|
543 |
+
'widget-' . $this->id . '-',
|
544 |
+
'widget-' . $this->id_base . '[' . $this->number . ']',
|
545 |
+
$instance['type'] == 'color' ? $instance['colors'] : ( $instance['type'] == 'label' ? $instance['labels'] : array() )
|
546 |
+
);
|
547 |
+
?>
|
548 |
+
</div>
|
549 |
+
<span class="spinner" style="display: none;"></span>
|
550 |
+
|
551 |
+
<input type="hidden" name="widget_id" value="widget-<?php echo $this->id ?>-" />
|
552 |
+
<input type="hidden" name="widget_name" value="widget-<?php echo $this->id_base ?>[<?php echo $this->number ?>]" />
|
553 |
+
|
554 |
+
<script>jQuery(document).trigger('yith_colorpicker');</script>
|
555 |
+
<?php
|
556 |
+
}
|
557 |
+
|
558 |
+
function update( $new_instance, $old_instance ) {
|
559 |
+
global $woocommerce;
|
560 |
+
|
561 |
+
$instance = $old_instance;
|
562 |
+
|
563 |
+
if ( empty( $new_instance['title'] ) )
|
564 |
+
$new_instance['title'] = $woocommerce->attribute_label( $new_instance['attribute'] );
|
565 |
+
|
566 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
567 |
+
$instance['attribute'] = stripslashes( $new_instance['attribute'] );
|
568 |
+
$instance['query_type'] = stripslashes( $new_instance['query_type'] );
|
569 |
+
$instance['type'] = stripslashes( $new_instance['type'] );
|
570 |
+
$instance['colors'] = $new_instance['colors'];
|
571 |
+
$instance['labels'] = $new_instance['labels'];
|
572 |
+
|
573 |
+
return $instance;
|
574 |
+
}
|
575 |
+
|
576 |
+
}
|
577 |
+
}
|
yit-common/assets/css/yith-panel.css
ADDED
@@ -0,0 +1,78 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/* typography */
|
2 |
+
.typography_container {
|
3 |
+
padding-bottom:0px;
|
4 |
+
}
|
5 |
+
.typography_container .option {
|
6 |
+
width: 100%;
|
7 |
+
}
|
8 |
+
.typography_container input {
|
9 |
+
float:left;
|
10 |
+
margin-right:14px;
|
11 |
+
}
|
12 |
+
|
13 |
+
.typography_container .select-wrapper {
|
14 |
+
float: left;
|
15 |
+
width: 150px;
|
16 |
+
margin-right: 10px;
|
17 |
+
margin-bottom: 0px !important;
|
18 |
+
}
|
19 |
+
.typography_container .select-wrapper.font-unit {
|
20 |
+
width: 61px;
|
21 |
+
}
|
22 |
+
.typography_container .ui-spinner-buttons {
|
23 |
+
top: 0px !important;
|
24 |
+
}
|
25 |
+
.typography_container .select-wrapper.font-style {
|
26 |
+
width: 93px;
|
27 |
+
}
|
28 |
+
.typography_container .select-wrapper select {
|
29 |
+
width:100%;
|
30 |
+
}
|
31 |
+
|
32 |
+
.typography_container .font-preview {
|
33 |
+
border: 1px dashed #ddd;
|
34 |
+
-webkit-border-radius: 10px;
|
35 |
+
-moz-border-radius: 10px;
|
36 |
+
border-radius: 10px;
|
37 |
+
margin: 10px 0;
|
38 |
+
padding: 20px;
|
39 |
+
position: relative;
|
40 |
+
}
|
41 |
+
.typography_container .font-preview .refresh_container {
|
42 |
+
background: rgba(255,255,255,0.82);
|
43 |
+
-webkit-border-radius: 10px;
|
44 |
+
-moz-border-radius: 10px;
|
45 |
+
border-radius: 10px;
|
46 |
+
position: absolute;
|
47 |
+
left: 0;
|
48 |
+
top: 0;
|
49 |
+
width: 100%;
|
50 |
+
height: 100%;
|
51 |
+
z-index: 0;
|
52 |
+
}
|
53 |
+
.typography_container button.refresh {
|
54 |
+
/*background: #F2F2F2 url(../images/white-grad.png) repeat-x scroll left top;*/
|
55 |
+
border: 1px solid #BBB;
|
56 |
+
-webkit-border-radius: 11px;
|
57 |
+
border-radius: 11px;
|
58 |
+
-moz-box-sizing: content-box;
|
59 |
+
-webkit-box-sizing: content-box;
|
60 |
+
box-sizing: content-box;
|
61 |
+
color: #464646;
|
62 |
+
cursor: pointer;
|
63 |
+
font-size: 12px!important;
|
64 |
+
line-height: 6px;
|
65 |
+
margin: -16px 0px 0px -105px;
|
66 |
+
padding: 3px 8px;
|
67 |
+
position: absolute;
|
68 |
+
text-shadow: rgba(255, 255, 255, 1) 0 1px 0;
|
69 |
+
text-decoration: none;
|
70 |
+
top: 50%;
|
71 |
+
left: 50%;
|
72 |
+
width: 108px;
|
73 |
+
height: 18px;
|
74 |
+
}
|
75 |
+
.typography_container button.refresh img {
|
76 |
+
margin-right: 5px;
|
77 |
+
vertical-align: middle;
|
78 |
+
}
|
yit-common/assets/js/google_fonts.json
ADDED
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
{"items":["ABeeZee","Abel","Abril Fatface","Aclonica","Acme","Actor","Adamina","Advent Pro","Aguafina Script","Akronim","Aladin","Aldrich","Alef","Alegreya","Alegreya SC","Alex Brush","Alfa Slab One","Alice","Alike","Alike Angular","Allan","Allerta","Allerta Stencil","Allura","Almendra","Almendra Display","Almendra SC","Amarante","Amaranth","Amatic SC","Amethysta","Anaheim","Andada","Andika","Angkor","Annie Use Your Telescope","Anonymous Pro","Antic","Antic Didone","Antic Slab","Anton","Arapey","Arbutus","Arbutus Slab","Architects Daughter","Archivo Black","Archivo Narrow","Arimo","Arizonia","Armata","Artifika","Arvo","Asap","Asset","Astloch","Asul","Atomic Age","Aubrey","Audiowide","Autour One","Average","Average Sans","Averia Gruesa Libre","Averia Libre","Averia Sans Libre","Averia Serif Libre","Bad Script","Balthazar","Bangers","Basic","Battambang","Baumans","Bayon","Belgrano","Belleza","BenchNine","Bentham","Berkshire Swash","Bevan","Bigelow Rules","Bigshot One","Bilbo","Bilbo Swash Caps","Bitter","Black Ops One","Bokor","Bonbon","Boogaloo","Bowlby One","Bowlby One SC","Brawler","Bree Serif","Bubblegum Sans","Bubbler One","Buda:300","Buenard","Butcherman","Butterfly Kids","Cabin","Cabin Condensed","Cabin Sketch","Caesar Dressing","Cagliostro","Calligraffitti","Cambo","Candal","Cantarell","Cantata One","Cantora One","Capriola","Cardo","Carme","Carrois Gothic","Carrois Gothic SC","Carter One","Caudex","Cedarville Cursive","Ceviche One","Changa One","Chango","Chau Philomene One","Chela One","Chelsea Market","Chenla","Cherry Cream Soda","Cherry Swash","Chewy","Chicle","Chivo","Cinzel","Cinzel Decorative","Clicker Script","Coda","Coda Caption:800","Codystar","Combo","Comfortaa","Coming Soon","Concert One","Condiment","Content","Contrail One","Convergence","Cookie","Copse","Corben","Courgette","Cousine","Coustard","Covered By Your Grace","Crafty Girls","Creepster","Crete Round","Crimson Text","Croissant One","Crushed","Cuprum","Cutive","Cutive Mono","Damion","Dancing Script","Dangrek","Dawning of a New Day","Days One","Delius","Delius Swash Caps","Delius Unicase","Della Respira","Denk One","Devonshire","Didact Gothic","Diplomata","Diplomata SC","Domine","Donegal One","Doppio One","Dorsa","Dosis","Dr Sugiyama","Droid Sans","Droid Sans Mono","Droid Serif","Duru Sans","Dynalight","EB Garamond","Eagle Lake","Eater","Economica","Electrolize","Elsie","Elsie Swash Caps","Emblema One","Emilys Candy","Engagement","Englebert","Enriqueta","Erica One","Esteban","Euphoria Script","Ewert","Exo","Expletus Sans","Fanwood Text","Fascinate","Fascinate Inline","Faster One","Fasthand","Federant","Federo","Felipa","Fenix","Finger Paint","Fjalla One","Fjord One","Flamenco","Flavors","Fondamento","Fontdiner Swanky","Forum","Francois One","Freckle Face","Fredericka the Great","Fredoka One","Freehand","Fresca","Frijole","Fruktur","Fugaz One","GFS Didot","GFS Neohellenic","Gabriela","Gafata","Galdeano","Galindo","Gentium Basic","Gentium Book Basic","Geo","Geostar","Geostar Fill","Germania One","Gilda Display","Give You Glory","Glass Antiqua","Glegoo","Gloria Hallelujah","Goblin One","Gochi Hand","Gorditas","Goudy Bookletter 1911","Graduate","Grand Hotel","Gravitas One","Great Vibes","Griffy","Gruppo","Gudea","Habibi","Hammersmith One","Hanalei","Hanalei Fill","Handlee","Hanuman","Happy Monkey","Headland One","Henny Penny","Herr Von Muellerhoff","Holtwood One SC","Homemade Apple","Homenaje","IM Fell DW Pica","IM Fell DW Pica SC","IM Fell Double Pica","IM Fell Double Pica SC","IM Fell English","IM Fell English SC","IM Fell French Canon","IM Fell French Canon SC","IM Fell Great Primer","IM Fell Great Primer SC","Iceberg","Iceland","Imprima","Inconsolata","Inder","Indie Flower","Inika","Irish Grover","Istok Web","Italiana","Italianno","Jacques Francois","Jacques Francois Shadow","Jim Nightshade","Jockey One","Jolly Lodger","Josefin Sans","Josefin Slab","Joti One","Judson","Julee","Julius Sans One","Junge","Jura","Just Another Hand","Just Me Again Down Here","Kameron","Karla","Kaushan Script","Kavoon","Keania One","Kelly Slab","Kenia","Khmer","Kite One","Knewave","Kotta One","Koulen","Kranky","Kreon","Kristi","Krona One","La Belle Aurore","Lancelot","Lato","League Script","Leckerli One","Ledger","Lekton","Lemon","Libre Baskerville","Life Savers","Lilita One","Limelight","Linden Hill","Lobster","Lobster Two","Londrina Outline","Londrina Shadow","Londrina Sketch","Londrina Solid","Lora","Love Ya Like A Sister","Loved by the King","Lovers Quarrel","Luckiest Guy","Lusitana","Lustria","Macondo","Macondo Swash Caps","Magra","Maiden Orange","Mako","Marcellus","Marcellus SC","Marck Script","Margarine","Marko One","Marmelad","Marvel","Mate","Mate SC","Maven Pro","McLaren","Meddon","MedievalSharp","Medula One","Megrim","Meie Script","Merienda","Merienda One","Merriweather","Merriweather Sans","Metal","Metal Mania","Metamorphous","Metrophobic","Michroma","Milonga","Miltonian","Miltonian Tattoo","Miniver","Miss Fajardose","Modern Antiqua","Molengo","Molle:italic","Monda","Monofett","Monoton","Monsieur La Doulaise","Montaga","Montez","Montserrat","Montserrat Alternates","Montserrat Subrayada","Moul","Moulpali","Mountains of Christmas","Mouse Memoirs","Mr Bedfort","Mr Dafoe","Mr De Haviland","Mrs Saint Delafield","Mrs Sheppards","Muli","Mystery Quest","Neucha","Neuton","New Rocker","News Cycle","Niconne","Nixie One","Nobile","Nokora","Norican","Nosifer","Nothing You Could Do","Noticia Text","Noto Sans","Noto Serif","Nova Cut","Nova Flat","Nova Mono","Nova Oval","Nova Round","Nova Script","Nova Slim","Nova Square","Numans","Nunito","Odor Mean Chey","Offside","Old Standard TT","Oldenburg","Oleo Script","Oleo Script Swash Caps","Open Sans","Open Sans Condensed:300","Open Sans Condensed:300italic","Open Sans Condensed:700","Oranienbaum","Orbitron","Oregano","Orienta","Original Surfer","Oswald","Over the Rainbow","Overlock","Overlock SC","Ovo","Oxygen","Oxygen Mono","PT Mono","PT Sans","PT Sans Caption","PT Sans Narrow","PT Serif","PT Serif Caption","Pacifico","Paprika","Parisienne","Passero One","Passion One","Patrick Hand","Patrick Hand SC","Patua One","Paytone One","Peralta","Permanent Marker","Petit Formal Script","Petrona","Philosopher","Piedra","Pinyon Script","Pirata One","Plaster","Play","Playball","Playfair Display","Playfair Display SC","Podkova","Poiret One","Poller One","Poly","Pompiere","Pontano Sans","Port Lligat Sans","Port Lligat Slab","Prata","Preahvihear","Press Start 2P","Princess Sofia","Prociono","Prosto One","Puritan","Purple Purse","Quando","Quantico","Quattrocento","Quattrocento Sans","Questrial","Quicksand","Quintessential","Qwigley","Racing Sans One","Radley","Raleway","Raleway Dots","Rambla","Rammetto One","Ranchers","Rancho","Rationale","Redressed","Reenie Beanie","Revalia","Ribeye","Ribeye Marrow","Righteous","Risque","Roboto","Roboto Condensed","Roboto Slab","Rochester","Rock Salt","Rokkitt","Romanesco","Ropa Sans","Rosario","Rosarivo","Rouge Script","Ruda","Rufina","Ruge Boogie","Ruluko","Rum Raisin","Ruslan Display","Russo One","Ruthie","Rye","Sacramento","Sail","Salsa","Sanchez","Sancreek","Sansita One","Sarina","Satisfy","Scada","Schoolbell","Seaweed Script","Sevillana","Seymour One","Shadows Into Light","Shadows Into Light Two","Shanti","Share","Share Tech","Share Tech Mono","Shojumaru","Short Stack","Siemreap","Sigmar One","Signika","Signika Negative","Simonetta","Sintony","Sirin Stencil","Six Caps","Skranji","Slackey","Smokum","Smythe","Sniglet:800","Snippet","Snowburst One","Sofadi One","Sofia","Sonsie One","Sorts Mill Goudy","Source Code Pro","Source Sans Pro","Special Elite","Spicy Rice","Spinnaker","Spirax","Squada One","Stalemate","Stalinist One","Stardos Stencil","Stint Ultra Condensed","Stint Ultra Expanded","Stoke","Strait","Sue Ellen Francisco","Sunshiney","Supermercado One","Suwannaphum","Swanky and Moo Moo","Syncopate","Tangerine","Taprom","Tauri","Telex","Tenor Sans","Text Me One","The Girl Next Door","Tienne","Tinos","Titan One","Titillium Web","Trade Winds","Trocchi","Trochut","Trykker","Tulpen One","Ubuntu","Ubuntu Condensed","Ubuntu Mono","Ultra","Uncial Antiqua","Underdog","Unica One","UnifrakturCook:700","UnifrakturMaguntia","Unkempt","Unlock","Unna","VT323","Vampiro One","Varela","Varela Round","Vast Shadow","Vibur","Vidaloka","Viga","Voces","Volkhov","Vollkorn","Voltaire","Waiting for the Sunrise","Wallpoet","Walter Turncoat","Warnes","Wellfleet","Wendy One","Wire One","Yanone Kaffeesatz","Yellowtail","Yeseva One","Yesteryear","Zeyada"]}
|
yit-common/assets/js/yith-panel.js
ADDED
@@ -0,0 +1,296 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
|
3 |
+
//image uploader
|
4 |
+
var _custom_media = true,
|
5 |
+
_orig_send_attachment = wp.media.editor.send.attachment;
|
6 |
+
|
7 |
+
$('.uploader .button').click(function(e) {
|
8 |
+
var send_attachment_bkp = wp.media.editor.send.attachment;
|
9 |
+
var button = $(this);
|
10 |
+
var id = button.attr('id').replace('_button', '');
|
11 |
+
_custom_media = true;
|
12 |
+
wp.media.editor.send.attachment = function(props, attachment){
|
13 |
+
if ( _custom_media ) {
|
14 |
+
$("#"+id).val(attachment.url);
|
15 |
+
} else {
|
16 |
+
return _orig_send_attachment.apply( this, [props, attachment] );
|
17 |
+
};
|
18 |
+
}
|
19 |
+
|
20 |
+
wp.media.editor.open(button);
|
21 |
+
return false;
|
22 |
+
});
|
23 |
+
|
24 |
+
$('.add_media').on('click', function(){
|
25 |
+
_custom_media = false;
|
26 |
+
});
|
27 |
+
|
28 |
+
//color-picker
|
29 |
+
$('.panel-colorpicker').wpColorPicker({
|
30 |
+
change: function(event, ui){
|
31 |
+
$('#'+event.target.id).parents('.typography_container').find('.font-preview > p').css('color', ui.color.toString());
|
32 |
+
}
|
33 |
+
});
|
34 |
+
|
35 |
+
//typography
|
36 |
+
$('.typography_container').yit_panel_typography();
|
37 |
+
|
38 |
+
//datepicker
|
39 |
+
$('.panel-datepicker').datepicker({
|
40 |
+
showOtherMonths: true,
|
41 |
+
selectOtherMonths: true,
|
42 |
+
numberOfMonths: 2,
|
43 |
+
minDate: 0
|
44 |
+
});
|
45 |
+
});
|
46 |
+
|
47 |
+
// typography
|
48 |
+
(function( window, $, undefined ) {
|
49 |
+
|
50 |
+
$.yit_panel_typography = function( options, element ) {
|
51 |
+
this.element = $( element );
|
52 |
+
this._init( options );
|
53 |
+
};
|
54 |
+
|
55 |
+
$.yit_panel_typography.defaults = {
|
56 |
+
elements : {
|
57 |
+
size: '.typography_size',
|
58 |
+
unit: '.typography_unit',
|
59 |
+
family: '.typography_family',
|
60 |
+
style: '.typography_style',
|
61 |
+
color: '.typography_color',
|
62 |
+
preview: '.font-preview p',
|
63 |
+
refresh: '.refresh'
|
64 |
+
}
|
65 |
+
};
|
66 |
+
|
67 |
+
$.yit_panel_typography.prototype = {
|
68 |
+
_init : function( options ) {
|
69 |
+
this.options = $.extend( true, {}, $.yit_panel_typography.defaults, options );
|
70 |
+
|
71 |
+
//init the options string
|
72 |
+
if( yit_family_string == '' ) {
|
73 |
+
//web fonts
|
74 |
+
var web_fonts = $.parseJSON(yit_web_fonts);
|
75 |
+
yit_family_string += '<optgroup label="Web Fonts">';
|
76 |
+
$.each(web_fonts.items, function(i,v){
|
77 |
+
yit_family_string += '<option>' + v + '</option>';
|
78 |
+
});
|
79 |
+
yit_family_string += '</optgroup>';
|
80 |
+
|
81 |
+
//google fonts
|
82 |
+
var google_fonts = $.parseJSON(yit_google_fonts);
|
83 |
+
yit_family_string += '<optgroup label="Google Fonts">';
|
84 |
+
$.each(google_fonts.items, function(i,v){
|
85 |
+
yit_family_string += '<option>' + v + '</option>';
|
86 |
+
});
|
87 |
+
yit_family_string += '</optgroup>';
|
88 |
+
}
|
89 |
+
|
90 |
+
this._loadElements();
|
91 |
+
this._initEvents();
|
92 |
+
},
|
93 |
+
|
94 |
+
_loadElements : function() {
|
95 |
+
var elements = this.options.elements;
|
96 |
+
var container = this.element;
|
97 |
+
|
98 |
+
for( var el in elements) {
|
99 |
+
elements[el] = container.find( elements[el] );
|
100 |
+
}
|
101 |
+
},
|
102 |
+
|
103 |
+
_initEvents : function() {
|
104 |
+
var elements = this.options.elements;
|
105 |
+
var self = this;
|
106 |
+
|
107 |
+
//refresh
|
108 |
+
var refresh = elements.refresh;
|
109 |
+
refresh.on('click', function(e){
|
110 |
+
e.preventDefault();
|
111 |
+
|
112 |
+
$(this).parent().fadeOut( 'slow' );
|
113 |
+
|
114 |
+
//Set current value, before trigger change event
|
115 |
+
|
116 |
+
//Color
|
117 |
+
elements.preview.css( 'color', elements.color.val() );
|
118 |
+
|
119 |
+
//Font size
|
120 |
+
var size = elements.size.val();
|
121 |
+
var unit = elements.unit.val();
|
122 |
+
|
123 |
+
elements.preview.css( 'font-size', size + unit );
|
124 |
+
elements.preview.css( 'line-height', ( unit == 'em' || unit == 'rem' ? Number( size ) + 0.4 : Number ( size ) + 4 ) + unit );
|
125 |
+
|
126 |
+
//Font style
|
127 |
+
var style = elements.style.val();
|
128 |
+
|
129 |
+
if( style == 'italic' ) {
|
130 |
+
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'italic' });
|
131 |
+
} else if( style == 'bold' ) {
|
132 |
+
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'normal' });
|
133 |
+
} else if( style == 'extra-bold' ) {
|
134 |
+
elements.preview.css({ 'font-weight' : '800', 'font-style' : 'normal' });
|
135 |
+
} else if( style == 'bold-italic' ) {
|
136 |
+
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'italic' });
|
137 |
+
} else {
|
138 |
+
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'normal' });
|
139 |
+
}
|
140 |
+
|
141 |
+
//Font Family
|
142 |
+
var group = elements.family.find( 'option:selected' ).parent().attr( 'label' );
|
143 |
+
|
144 |
+
if( group == 'Web fonts' ) {
|
145 |
+
//Web font
|
146 |
+
elements.preview.css( 'font-family', elements.family.val() );
|
147 |
+
} else {
|
148 |
+
//Google font
|
149 |
+
WebFontConfig = {
|
150 |
+
google: {
|
151 |
+
families: [ elements.family.find('option:selected' ).text() ] },
|
152 |
+
fontactive: function( fontFamily, fontDescription ) {
|
153 |
+
elements.preview.css( 'font-family', fontFamily );
|
154 |
+
}
|
155 |
+
};
|
156 |
+
|
157 |
+
(function() {
|
158 |
+
var wf = document.createElement('script');
|
159 |
+
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
|
160 |
+
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
|
161 |
+
wf.type = 'text/javascript';
|
162 |
+
wf.async = 'true';
|
163 |
+
|
164 |
+
var s = document.getElementsByTagName('script')[0];
|
165 |
+
s.parentNode.insertBefore(wf, s);
|
166 |
+
})();
|
167 |
+
}
|
168 |
+
});
|
169 |
+
|
170 |
+
//font size, font unit
|
171 |
+
$([elements.size, elements.unit]).each(function(){
|
172 |
+
$(this).on('change', function(){
|
173 |
+
if( elements.refresh.is( ':visible' ) ) { return; }
|
174 |
+
|
175 |
+
var size = elements.size.val();
|
176 |
+
var unit = elements.unit.val();
|
177 |
+
|
178 |
+
elements.preview.css({
|
179 |
+
'font-size' : size + unit,
|
180 |
+
'line-height' : ( unit == 'em' || unit == 'rem' ? Number( size ) + 0.4 : Number ( size ) + 4 ) + unit
|
181 |
+
}).trigger( 'resize' );
|
182 |
+
});
|
183 |
+
});
|
184 |
+
|
185 |
+
//font family
|
186 |
+
var family = elements.family;
|
187 |
+
family.on('mousedown', function(e){
|
188 |
+
var t = $(this);
|
189 |
+
if(t.data('instance') == false) {
|
190 |
+
var currentElement = {
|
191 |
+
'value' : t.val(),
|
192 |
+
'text' : t.find('option:selected').text()
|
193 |
+
};
|
194 |
+
|
195 |
+
t.html(yit_family_string)
|
196 |
+
.find('option')
|
197 |
+
.filter(function(){
|
198 |
+
return $(this).text() == currentElement.text;
|
199 |
+
}).attr('selected', true);
|
200 |
+
|
201 |
+
t.data('instance', 'true');
|
202 |
+
}
|
203 |
+
});
|
204 |
+
family.on('change', function(){
|
205 |
+
if( elements.refresh.is( ':visible' ) ) { return; }
|
206 |
+
|
207 |
+
var group = $( this ).find( 'option:selected' ).parent().attr( 'label' );
|
208 |
+
|
209 |
+
if( group == 'Web fonts' ) {
|
210 |
+
//Web font
|
211 |
+
elements.preview.css( 'font-family', $( this ).val() );
|
212 |
+
} else {
|
213 |
+
//Google font
|
214 |
+
WebFontConfig = {
|
215 |
+
google: {
|
216 |
+
families: [ $( this ).val() ]
|
217 |
+
},
|
218 |
+
fontactive: function( fontFamily, fontDescription ) {
|
219 |
+
elements.preview.css( 'font-family', fontFamily );
|
220 |
+
}
|
221 |
+
};
|
222 |
+
|
223 |
+
(function() {
|
224 |
+
var wf = document.createElement('script');
|
225 |
+
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
|
226 |
+
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
|
227 |
+
wf.type = 'text/javascript';
|
228 |
+
wf.async = 'true';
|
229 |
+
|
230 |
+
var s = document.getElementsByTagName('script')[0];
|
231 |
+
s.parentNode.insertBefore(wf, s);
|
232 |
+
})();
|
233 |
+
}
|
234 |
+
|
235 |
+
elements.preview.trigger( 'resize' );
|
236 |
+
});
|
237 |
+
|
238 |
+
elements.style.on('change', function(){
|
239 |
+
if( elements.refresh.is( ':visible' ) ) { return; }
|
240 |
+
|
241 |
+
var style = $( this ).val();
|
242 |
+
|
243 |
+
if( style == 'italic' ) {
|
244 |
+
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'italic' });
|
245 |
+
} else if( style == 'bold' ) {
|
246 |
+
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'normal' });
|
247 |
+
} else if( style == 'extra-bold' ) {
|
248 |
+
elements.preview.css({ 'font-weight' : '800', 'font-style' : 'normal' });
|
249 |
+
} else if( style == 'bold-italic' ) {
|
250 |
+
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'italic' });
|
251 |
+
} else {
|
252 |
+
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'normal' });
|
253 |
+
}
|
254 |
+
|
255 |
+
elements.preview.trigger( 'resize' );
|
256 |
+
});
|
257 |
+
|
258 |
+
//preview
|
259 |
+
elements.preview.resize(function(){
|
260 |
+
var box = $(this).parents('.yit-box');
|
261 |
+
$(this).parents('form').height( box.height() );
|
262 |
+
});
|
263 |
+
}
|
264 |
+
};
|
265 |
+
|
266 |
+
$.fn.yit_panel_typography = function( options ) {
|
267 |
+
if ( typeof options === 'string' ) {
|
268 |
+
var args = Array.prototype.slice.call( arguments, 1 );
|
269 |
+
|
270 |
+
this.each(function() {
|
271 |
+
var instance = $.data( this, 'yit_panel_typography' );
|
272 |
+
if ( !instance ) {
|
273 |
+
console.error( "cannot call methods on yit_checkout prior to initialization; " +
|
274 |
+
"attempted to call method '" + options + "'" );
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
|
278 |
+
console.error( "no such method '" + options + "' for yit_panel_typography instance" );
|
279 |
+
return;
|
280 |
+
}
|
281 |
+
instance[ options ].apply( instance, args );
|
282 |
+
});
|
283 |
+
}
|
284 |
+
else {
|
285 |
+
this.each(function() {
|
286 |
+
var instance = $.data( this, 'yit_panel_typography' );
|
287 |
+
if ( !instance ) {
|
288 |
+
$.data( this, 'yit_panel_typography', new $.yit_panel_typography( options, this ) );
|
289 |
+
}
|
290 |
+
});
|
291 |
+
}
|
292 |
+
return this;
|
293 |
+
};
|
294 |
+
|
295 |
+
|
296 |
+
})( window, jQuery );
|
yit-common/google_fonts.php
ADDED
@@ -0,0 +1,68 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Google font management
|
4 |
+
*/
|
5 |
+
|
6 |
+
$yith_google_fonts = new Google_Font();
|
7 |
+
|
8 |
+
class Google_Font {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array The google fonts to include in the page
|
12 |
+
*/
|
13 |
+
public $google_fonts = array();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Generate the url for the google fonts
|
17 |
+
*/
|
18 |
+
public function google_fonts_url() {
|
19 |
+
$base_url = 'http://fonts.googleapis.com/css?family=';
|
20 |
+
$fonts = array();
|
21 |
+
|
22 |
+
if ( empty( $this->google_fonts ) ) return;
|
23 |
+
|
24 |
+
foreach ( $this->google_fonts as $font => $variants ) {
|
25 |
+
$fonts[] = urlencode( $font . ':' . implode( ',', $variants ) );
|
26 |
+
}
|
27 |
+
|
28 |
+
return $base_url . implode( '|', $fonts );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Add a new google font in queue
|
33 |
+
*
|
34 |
+
* @param $font The name of google font
|
35 |
+
* @param array $variants The variatns for the google font to add
|
36 |
+
*/
|
37 |
+
public function add_google_font( $font, $variants = array() ) {
|
38 |
+
if ( ! is_array( $variants ) ) $variants = array( $variants );
|
39 |
+
|
40 |
+
foreach ( $variants as $variant ) {
|
41 |
+
if ( ! isset( $this->google_fonts[$font] ) ) $this->google_fonts[$font] = array( 300, 400 );
|
42 |
+
if ( ! in_array( $variant, $this->google_fonts[$font] ) ) $this->google_fonts[$font][] = $variant;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( ! function_exists( 'yith_add_google_font' ) ) {
|
48 |
+
/**
|
49 |
+
* Add a new google font in queue
|
50 |
+
*
|
51 |
+
* @param $font The name of google font
|
52 |
+
* @param array $variant The variatns for the google font to add
|
53 |
+
*/
|
54 |
+
function yith_add_google_font( $font, $variant = array() ) {
|
55 |
+
global $yith_google_fonts;
|
56 |
+
$yith_google_fonts->add_google_font( $font, $variant );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( ! function_exists( 'yith_google_fonts_url' ) ) {
|
61 |
+
/**
|
62 |
+
* @return string The url with the google fonts to load
|
63 |
+
*/
|
64 |
+
function yith_google_fonts_url() {
|
65 |
+
global $yith_google_fonts;
|
66 |
+
return $yith_google_fonts->google_fonts_url();
|
67 |
+
}
|
68 |
+
}
|
yit-common/yit-functions.php
ADDED
@@ -0,0 +1,208 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Your Inspiration Themes common functions
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @version 0.0.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if( !defined('YITH_FUNCTIONS')) {
|
10 |
+
define( 'YITH_FUNCTIONS', true);
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( ! function_exists( 'yit_is_woocommerce_active' ) ) {
|
14 |
+
/**
|
15 |
+
* WC Detection
|
16 |
+
*/
|
17 |
+
function yit_is_woocommerce_active() {
|
18 |
+
$active_plugins = (array) get_option( 'active_plugins', array() );
|
19 |
+
|
20 |
+
if ( is_multisite() ) {
|
21 |
+
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
22 |
+
}
|
23 |
+
|
24 |
+
$woo = yit_get_plugin_basename_from_slug( 'woocommerce' );
|
25 |
+
return in_array( $woo, $active_plugins ) || array_key_exists( $woo, $active_plugins );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
if( ! function_exists( 'yit_get_plugin_basename_from_slug' ) ) {
|
30 |
+
/**
|
31 |
+
* Helper function to extract the file path of the plugin file from the
|
32 |
+
* plugin slug, if the plugin is installed.
|
33 |
+
*
|
34 |
+
* @param string $slug Plugin slug (typically folder name) as provided by the developer
|
35 |
+
* @return string Either file path for plugin if installed, or just the plugin slug
|
36 |
+
*/
|
37 |
+
function yit_get_plugin_basename_from_slug( $slug ) {
|
38 |
+
include_once ABSPATH . '/wp-admin/includes/plugin.php';
|
39 |
+
|
40 |
+
$keys = array_keys( get_plugins() );
|
41 |
+
|
42 |
+
foreach ( $keys as $key ) {
|
43 |
+
if ( preg_match( '|^' . $slug .'|', $key ) )
|
44 |
+
return $key;
|
45 |
+
}
|
46 |
+
|
47 |
+
return $slug;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
if( ! function_exists( 'yith_debug') ) {
|
52 |
+
/**
|
53 |
+
* Debug helper function. This is a wrapper for var_dump() that adds
|
54 |
+
* the <pre /> tags, cleans up newlines and indents, and runs
|
55 |
+
* htmlentities() before output.
|
56 |
+
*
|
57 |
+
* @param mixed $var The variable to dump.
|
58 |
+
* @param mixed $var2 The second variable to dump
|
59 |
+
* @param ...
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
function yith_debug() {
|
63 |
+
$args = func_get_args();
|
64 |
+
if( !empty( $args ) ) {
|
65 |
+
foreach( $args as $k=>$arg ) {
|
66 |
+
// var_dump the variable into a buffer and keep the output
|
67 |
+
ob_start();
|
68 |
+
var_dump($arg);
|
69 |
+
$output = ob_get_clean();
|
70 |
+
|
71 |
+
// neaten the newlines and indents
|
72 |
+
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
|
73 |
+
|
74 |
+
if(!extension_loaded('xdebug')) {
|
75 |
+
$output = htmlspecialchars($output, ENT_QUOTES);
|
76 |
+
}
|
77 |
+
|
78 |
+
$output = '<pre class="yit-debug">'
|
79 |
+
. '<strong>$param_' . ($k+1) . ": </strong>"
|
80 |
+
. $output
|
81 |
+
. '</pre>';
|
82 |
+
echo $output;
|
83 |
+
}
|
84 |
+
} else {
|
85 |
+
trigger_error("yit_debug() expects at least 1 parameter, 0 given.", E_USER_WARNING);
|
86 |
+
}
|
87 |
+
|
88 |
+
return $args;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
if( ! function_exists('yit_get_options_from_prefix') ) {
|
94 |
+
/**
|
95 |
+
* Returns an array of all options that starts with a prefix
|
96 |
+
*
|
97 |
+
* @param string $prefix
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
function yit_get_options_from_prefix( $prefix ) {
|
101 |
+
if( !$prefix ) return array();
|
102 |
+
|
103 |
+
global $wpdb;
|
104 |
+
|
105 |
+
$sql = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '{$prefix}%'";
|
106 |
+
$options = $wpdb->get_col( $sql );
|
107 |
+
$return = array();
|
108 |
+
|
109 |
+
foreach( $options as $option ) {
|
110 |
+
$return[$option] = get_option( $option );
|
111 |
+
}
|
112 |
+
|
113 |
+
return yit_debug($return);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if( !function_exists('yit_wp_roles') ) {
|
118 |
+
/**
|
119 |
+
* Returns the roles of the site.
|
120 |
+
*
|
121 |
+
* @return array
|
122 |
+
* @since 1.0.0
|
123 |
+
*/
|
124 |
+
function yit_wp_roles() {
|
125 |
+
global $wp_roles;
|
126 |
+
|
127 |
+
if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles();
|
128 |
+
|
129 |
+
$roles = array();
|
130 |
+
foreach( $wp_roles->roles as $k=>$role ) {
|
131 |
+
$roles[$k] = $role['name'];
|
132 |
+
}
|
133 |
+
|
134 |
+
return $roles;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
if( !function_exists('yit_user_roles') ) {
|
139 |
+
/**
|
140 |
+
* Returns the roles of the user
|
141 |
+
*
|
142 |
+
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
|
143 |
+
* @return array()
|
144 |
+
* @since 1.0.0
|
145 |
+
*/
|
146 |
+
function yit_user_roles( $user_id = null ) {
|
147 |
+
if ( is_numeric( $user_id ) )
|
148 |
+
$user = get_userdata( $user_id );
|
149 |
+
else
|
150 |
+
$user = wp_get_current_user();
|
151 |
+
|
152 |
+
if ( empty( $user ) )
|
153 |
+
return false;
|
154 |
+
|
155 |
+
return (array) $user->roles;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
// ADMIN
|
161 |
+
if( !function_exists('yit_typo_option_to_css') ) {
|
162 |
+
/**
|
163 |
+
* Change the typography option saved in database to attributes for css
|
164 |
+
*
|
165 |
+
* @param array $option The option as saved in the database
|
166 |
+
* @return string
|
167 |
+
* @since 1.0.0
|
168 |
+
*/
|
169 |
+
function yit_typo_option_to_css( $option ) {
|
170 |
+
$attrs = $variant = array();
|
171 |
+
|
172 |
+
extract( $option );
|
173 |
+
$attrs[] = "color: $color;";
|
174 |
+
$attrs[] = "font-size: {$size}{$unit};";
|
175 |
+
$attrs[] = "font-family: '{$family}';";
|
176 |
+
switch ( $style ) {
|
177 |
+
case 'regular':
|
178 |
+
$attrs[] = 'font-weight: 400;';
|
179 |
+
$attrs[] = 'font-style: normal;';
|
180 |
+
$variant = 400;
|
181 |
+
break;
|
182 |
+
case 'bold':
|
183 |
+
$attrs[] = 'font-weight: 700;';
|
184 |
+
$attrs[] = 'font-style: normal;';
|
185 |
+
$variant = 700;
|
186 |
+
break;
|
187 |
+
case 'extra-bold':
|
188 |
+
$attrs[] = 'font-weight: 800;';
|
189 |
+
$attrs[] = 'font-style: normal;';
|
190 |
+
$variant = 800;
|
191 |
+
break;
|
192 |
+
case 'italic':
|
193 |
+
$attrs[] = 'font-weight: 400;';
|
194 |
+
$attrs[] = 'font-style: italic;';
|
195 |
+
$variant = 400;
|
196 |
+
break;
|
197 |
+
case 'bold-italic':
|
198 |
+
$attrs[] = 'font-weight: 700;';
|
199 |
+
$attrs[] = 'font-style: italic;';
|
200 |
+
$variant = 700;
|
201 |
+
break;
|
202 |
+
}
|
203 |
+
|
204 |
+
yith_add_google_font( $family, $variant );
|
205 |
+
|
206 |
+
return implode( "\n", $attrs ) . "\n";
|
207 |
+
}
|
208 |
+
}
|
yit-common/yith-panel.php
ADDED
@@ -0,0 +1,504 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Your Inspiration Themes Panel
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @version 0.1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if( !class_exists('YITH_Panel') ) {
|
10 |
+
/*
|
11 |
+
* The class manages the theme options for the Plugin
|
12 |
+
*/
|
13 |
+
class YITH_Panel {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class version
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
public $version = '0.1.0';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Parameters for add_submenu_page
|
24 |
+
*
|
25 |
+
* add_submenu_page(
|
26 |
+
* 'themes.php', // The file name of a standard WordPress admin page
|
27 |
+
* 'Theme Options', // The text to be displayed in the title tags of the page when the menu is selected
|
28 |
+
* 'Theme Options', // The text to be used for the menu
|
29 |
+
* 'administrator', // The capability (or role) required for this menu to be displayed to the user.
|
30 |
+
* 'theme-options', // The slug name to refer to this menu by (should be unique for this menu).
|
31 |
+
* 'theme_options_display_page' // The function to be called to output the content for this page.
|
32 |
+
* );
|
33 |
+
*
|
34 |
+
* @access protected
|
35 |
+
*/
|
36 |
+
protected $_submenu = array();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Initial Options definition:
|
40 |
+
* 'tab' => array(
|
41 |
+
* 'label',
|
42 |
+
* 'sections' => array(
|
43 |
+
* 'fields' => array(
|
44 |
+
* 'option1',
|
45 |
+
* 'option2',
|
46 |
+
* ...
|
47 |
+
* )
|
48 |
+
* )
|
49 |
+
* )
|
50 |
+
*
|
51 |
+
* @var array
|
52 |
+
* @access public
|
53 |
+
*/
|
54 |
+
public $options = array();
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Options group name
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
* @access public
|
61 |
+
*/
|
62 |
+
public $option_group = 'panel_group';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Option name
|
66 |
+
*
|
67 |
+
* @var string
|
68 |
+
* @access public
|
69 |
+
*/
|
70 |
+
public $option_name = 'panel_options';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Banner links
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
* @access public
|
77 |
+
*/
|
78 |
+
public $banner_url = 'http://yithemes.com/?ap_id=plugin';
|
79 |
+
public $banner_img = '';
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Constructor
|
83 |
+
*
|
84 |
+
* @param array $submenu Parameters for add_submenu_page
|
85 |
+
* @param array $options Array of plugin options
|
86 |
+
*
|
87 |
+
*/
|
88 |
+
public function __construct( $submenu, $options, $banner = array(), $option_group = false, $option_name = false ) {
|
89 |
+
$this->_submenu = apply_filters('yith_panel_submenu', $submenu);
|
90 |
+
$this->options = apply_filters('yith_panel_options', $options);
|
91 |
+
|
92 |
+
if( !empty($banner) ) {
|
93 |
+
$this->banner_url = $banner['url'];
|
94 |
+
$this->banner_img = $banner['img'];
|
95 |
+
}
|
96 |
+
|
97 |
+
if( $option_group ) {
|
98 |
+
$this->option_group = $option_group;
|
99 |
+
}
|
100 |
+
|
101 |
+
if( $option_name ) {
|
102 |
+
$this->option_name = $option_name;
|
103 |
+
}
|
104 |
+
|
105 |
+
//add new menu item
|
106 |
+
//register new settings option group
|
107 |
+
//include js and css files
|
108 |
+
//print browser
|
109 |
+
add_action( 'admin_menu', array( $this, 'add_submenu_page') );
|
110 |
+
add_action( 'admin_init', array( $this, 'panel_register_setting') );
|
111 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'panel_enqueue') );
|
112 |
+
|
113 |
+
// add the typography javascript vars
|
114 |
+
add_action( 'yith_panel_after_panel', array( $this, 'js_typo_vars' ) );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Create new submenu page
|
119 |
+
*
|
120 |
+
* @return void
|
121 |
+
* @access public
|
122 |
+
* @link http://codex.wordpress.org/Function_Reference/add_submenu_page
|
123 |
+
*/
|
124 |
+
public function add_submenu_page() {
|
125 |
+
$submenu = $this->_submenu;
|
126 |
+
add_submenu_page(
|
127 |
+
$submenu[0],
|
128 |
+
$submenu[1],
|
129 |
+
$submenu[2],
|
130 |
+
$submenu[3],
|
131 |
+
$submenu[4],
|
132 |
+
array( $this, isset($submenu[5]) ? $submenu[5] : 'display_panel_page' )
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Print the Panel page
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
* @access public
|
141 |
+
*/
|
142 |
+
public function display_panel_page() {
|
143 |
+
// Create a header in the default WordPress 'wrap' container
|
144 |
+
$page = $this->_get_tab();
|
145 |
+
?>
|
146 |
+
<div id="icon-themes" class="icon32"><br /></div>
|
147 |
+
<h2 class="nav-tab-wrapper">
|
148 |
+
<?php foreach( $this->options as $k=>$tab ): ?>
|
149 |
+
<a class="nav-tab<?php if( $page == $k ): ?> nav-tab-active<?php endif ?>" href="<?php echo add_query_arg('panel_page', $k) ?>"><?php echo $tab['label'] ?></a>
|
150 |
+
<?php endforeach ?>
|
151 |
+
<?php do_action('yith_panel_after_tabs'); ?>
|
152 |
+
</h2>
|
153 |
+
|
154 |
+
<div class="wrap">
|
155 |
+
<?php $this->printBanner() ?>
|
156 |
+
<?php do_action('yith_panel_before_panel'); ?>
|
157 |
+
<form action="options.php" method="post">
|
158 |
+
|
159 |
+
<?php do_settings_sections( $this->option_name ); ?>
|
160 |
+
<?php settings_fields( $this->option_group ) ?>
|
161 |
+
|
162 |
+
<p class="submit">
|
163 |
+
<input type="hidden" name="panel_page" value="<?php echo $page ?>" />
|
164 |
+
<input class="button-primary" type="submit" name="save_options" value="Save Options" />
|
165 |
+
</p>
|
166 |
+
</form>
|
167 |
+
<?php do_action('yith_panel_after_panel'); ?>
|
168 |
+
</div>
|
169 |
+
<?php
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Add the vars for the typography options
|
174 |
+
*/
|
175 |
+
public function js_typo_vars() {
|
176 |
+
global $yith_panel_if_typography;
|
177 |
+
if ( ! isset( $yith_panel_if_typography ) || ! $yith_panel_if_typography ) return;
|
178 |
+
|
179 |
+
$web_fonts = array(
|
180 |
+
"Arial",
|
181 |
+
"Arial Black",
|
182 |
+
"Comic Sans MS",
|
183 |
+
"Courier New",
|
184 |
+
"Georgia",
|
185 |
+
"Impact",
|
186 |
+
"Lucida Console",
|
187 |
+
"Lucida Sans Unicode",
|
188 |
+
"Thaoma",
|
189 |
+
"Trebuchet MS",
|
190 |
+
"Verdana"
|
191 |
+
);
|
192 |
+
|
193 |
+
// http://niubbys.altervista.org/google_fonts.php
|
194 |
+
$google_fonts = file_get_contents( dirname(__FILE__) . '/assets/js/google_fonts.json' );
|
195 |
+
?>
|
196 |
+
<script type="text/javascript">
|
197 |
+
var yit_google_fonts = '<?php echo $google_fonts ?>',
|
198 |
+
yit_web_fonts = '{"items":<?php echo json_encode( $web_fonts ) ?>}',
|
199 |
+
yit_family_string = '';
|
200 |
+
</script>
|
201 |
+
<?php
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Register a new settings option group
|
206 |
+
*
|
207 |
+
* @return void
|
208 |
+
* @access public
|
209 |
+
* @link http://codex.wordpress.org/Function_Reference/register_setting
|
210 |
+
* @link http://codex.wordpress.org/Function_Reference/add_settings_section
|
211 |
+
* @link http://codex.wordpress.org/Function_Reference/add_settings_field
|
212 |
+
*/
|
213 |
+
public function panel_register_setting() {
|
214 |
+
$page = $this->_get_tab();
|
215 |
+
$tab = isset( $this->options[$page] ) ? $this->options[$page] : array();
|
216 |
+
|
217 |
+
if( !empty($tab['sections']) ) {
|
218 |
+
//add sections and fields
|
219 |
+
foreach( $tab['sections'] as $section_name => $section) {
|
220 |
+
//add the section
|
221 |
+
add_settings_section(
|
222 |
+
$section_name,
|
223 |
+
$section['title'],
|
224 |
+
array( $this, 'panel_section_content'),
|
225 |
+
$this->option_name
|
226 |
+
);
|
227 |
+
|
228 |
+
//add the fields
|
229 |
+
foreach( $section['fields'] as $option_name => $option ) {
|
230 |
+
$option['id'] = $option_name;
|
231 |
+
$option['label_for'] = $option_name;
|
232 |
+
|
233 |
+
//register settings group
|
234 |
+
register_setting(
|
235 |
+
$this->option_group,
|
236 |
+
$option_name,
|
237 |
+
array( $this, 'panel_sanitize')
|
238 |
+
);
|
239 |
+
|
240 |
+
add_settings_field(
|
241 |
+
$option_name,
|
242 |
+
$option['title'],
|
243 |
+
array( $this, 'panel_field_content' ),
|
244 |
+
$this->option_name,
|
245 |
+
$section_name,
|
246 |
+
$option
|
247 |
+
);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Display sections content
|
255 |
+
*
|
256 |
+
* @return void
|
257 |
+
* @access public
|
258 |
+
*/
|
259 |
+
public function panel_section_content( $section ) {
|
260 |
+
$page = $this->_get_tab();
|
261 |
+
if( isset( $this->options[$page]['sections'][ $section['id'] ]['description'] )) {
|
262 |
+
echo "<p class='section-description'>" . $this->options[$page]['sections'][ $section['id'] ]['description'] . "</p>";
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Sanitize the option's value
|
268 |
+
*
|
269 |
+
* @param array $input
|
270 |
+
* @return array
|
271 |
+
* @access public
|
272 |
+
*/
|
273 |
+
public function panel_sanitize( $input ) {
|
274 |
+
return apply_filters('yith_panel_sanitize', $input);
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Get the active tab. If the page isn't provided, the function
|
279 |
+
* will return the first tab name
|
280 |
+
*
|
281 |
+
* @return string
|
282 |
+
* @access protected
|
283 |
+
*/
|
284 |
+
public function _get_tab() {
|
285 |
+
if( isset($_POST['panel_page']) && $_POST['panel_page'] != '' ) {
|
286 |
+
return $_POST['panel_page'];
|
287 |
+
} elseif( isset($_GET['panel_page']) && $_GET['panel_page'] != '' ) {
|
288 |
+
return $_GET['panel_page'];
|
289 |
+
} else {
|
290 |
+
$tabs = array_keys( $this->options );
|
291 |
+
return $tabs[0];
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Enqueue scripts and styles
|
297 |
+
*
|
298 |
+
* @return void
|
299 |
+
* @access public
|
300 |
+
*/
|
301 |
+
public function panel_enqueue( $hook ) {
|
302 |
+
global $pagenow;
|
303 |
+
|
304 |
+
if( $pagenow == $this->_submenu[0] && isset( $_GET['page'] ) && $_GET['page'] == $this->_submenu[4] ) {
|
305 |
+
wp_enqueue_style( 'wp-color-picker' );
|
306 |
+
wp_enqueue_style( 'jquery-ui', 'http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css' );
|
307 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
308 |
+
|
309 |
+
wp_enqueue_style( 'yith-panel-css', plugin_dir_url( __FILE__ ) . 'assets/css/yith-panel.css', array('wp-color-picker'), $this->version );
|
310 |
+
wp_enqueue_script( 'yith-panel-js', plugin_dir_url( __FILE__ ) . 'assets/js/yith-panel.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
311 |
+
|
312 |
+
wp_enqueue_media();
|
313 |
+
|
314 |
+
do_action( 'yith_panel_enqueue' );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Display field content
|
321 |
+
*
|
322 |
+
* @return void
|
323 |
+
* @access public
|
324 |
+
*/
|
325 |
+
public function panel_field_content( $field ) {
|
326 |
+
$value = get_option( $field['id'], isset($field['std']) ? $field['std'] : '' );
|
327 |
+
$id = $field['id'];
|
328 |
+
$name = $field['id'];
|
329 |
+
|
330 |
+
$echo = '';
|
331 |
+
|
332 |
+
switch( $field['type'] ) {
|
333 |
+
case 'text':
|
334 |
+
$echo = "<input type='text' id='{$id}' name='{$name}' value='{$value}' class='regular-text code' />";
|
335 |
+
|
336 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
337 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
338 |
+
}
|
339 |
+
break;
|
340 |
+
|
341 |
+
case 'textarea': $echo = "<textarea name='{$name}' id='{$id}' class='large-text code' rows='10' cols='50'>{$value}</textarea>";
|
342 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
343 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
344 |
+
}
|
345 |
+
break;
|
346 |
+
|
347 |
+
case 'checkbox': $echo = "<input type='checkbox' id='{$id}' name='{$name}' value='1' ". checked($value, true, false) ." />";
|
348 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
349 |
+
$echo .= " <label for='{$id}'><span class='description'>{$field['description']}</span></label>";
|
350 |
+
}
|
351 |
+
break;
|
352 |
+
|
353 |
+
case 'select': $echo = "<select name='{$name}' id='{$id}'>";
|
354 |
+
foreach( $field['options'] as $v=>$label ) {
|
355 |
+
$echo .= "<option value='{$v}'". selected($value, $v, false) .">{$label}</option>";
|
356 |
+
}
|
357 |
+
$echo .= "</select>";
|
358 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
359 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
360 |
+
}
|
361 |
+
break;
|
362 |
+
|
363 |
+
case 'number':
|
364 |
+
$mms = '';
|
365 |
+
if( isset( $field['min'] ) ) {
|
366 |
+
$mms .= " min='{$field['min']}'";
|
367 |
+
}
|
368 |
+
|
369 |
+
if( isset( $field['max'] ) ) {
|
370 |
+
$mms .= " max='{$field['max']}'";
|
371 |
+
}
|
372 |
+
|
373 |
+
if( isset( $field['step'] ) ) {
|
374 |
+
$mms .= " step='{$field['step']}'";
|
375 |
+
}
|
376 |
+
|
377 |
+
$echo = "<input type='number' id='{$id}' name='{$name}' value='{$value}' class='small-text' {$mms} />";
|
378 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
379 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
380 |
+
}
|
381 |
+
break;
|
382 |
+
|
383 |
+
case 'colorpicker':
|
384 |
+
$std = isset( $field['std'] ) ? $field['std'] : '';
|
385 |
+
|
386 |
+
$echo = "<input type='text' id='{$id}' name='{$name}' value='{$value}' class='medium-text code panel-colorpicker' data-default-color='{$std}' />";
|
387 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
388 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
389 |
+
}
|
390 |
+
break;
|
391 |
+
|
392 |
+
case 'datepicker':
|
393 |
+
$std = isset( $field['std'] ) ? $field['std'] : array( 'date' => '', 'hh' => 0, 'mm' => 0, 'ss' => 0 );
|
394 |
+
$value = ! empty( $value ) ? $value : array( 'date' => '', 'hh' => 0, 'mm' => 0, 'ss' => 0 );
|
395 |
+
|
396 |
+
$echo = "<input type='text' id='{$id}_date' name='{$name}[date]' value='{$value['date']}' class='medium-text code panel-datepicker' colorpicker='" . __( 'Select a date', 'yit' ) . "' /> - ";
|
397 |
+
$echo .= "<input type='text' id='{$id}_hh' name='{$name}[hh]' value='{$value['hh']}' class='small-text code' colorpicker='" . __( 'Hours', 'yit' ) . "' /> : ";
|
398 |
+
$echo .= "<input type='text' id='{$id}_mm' name='{$name}[mm]' value='{$value['mm']}' class='small-text code' colorpicker='" . __( 'Minutes', 'yit' ) . "' /> : ";
|
399 |
+
$echo .= "<input type='text' id='{$id}_ss' name='{$name}[ss]' value='{$value['ss']}' class='small-text code' colorpicker='" . __( 'Minutes', 'yit' ) . "' />";
|
400 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
401 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
402 |
+
}
|
403 |
+
break;
|
404 |
+
|
405 |
+
case 'upload':
|
406 |
+
$echo = '<div class="uploader">';
|
407 |
+
$echo .= " <input type='text' id='{$id}' name='{$name}' value='{$value}' class='regular-text code' /> <input type='button' name='' id='{$id}_button' class='button' value='". __('Upload', 'yit') ."'>";
|
408 |
+
$echo .= '</div>';
|
409 |
+
if( isset($field['description']) && $field['description'] != '' ) {
|
410 |
+
$echo .= "<p class='description'>{$field['description']}</p>";
|
411 |
+
}
|
412 |
+
break;
|
413 |
+
|
414 |
+
case 'checkboxes':
|
415 |
+
$echo = '<div class="checkboxes">';
|
416 |
+
foreach ( $field['options'] as $check_value => $check_label ) {
|
417 |
+
$echo .= "<label><input type='checkbox' id='{$id}_{$check_value}' name='{$name}[]' value='$check_value' ". checked( in_array( $check_value, $value ), true, false) ." /> {$check_label}</label><br />";
|
418 |
+
}
|
419 |
+
|
420 |
+
$echo .= " <p class='description'>{$field['description']}</p>";
|
421 |
+
break;
|
422 |
+
|
423 |
+
case 'typography': $value = wp_parse_args( $value, $field['std'] ); ?>
|
424 |
+
<div class="typography_container typography">
|
425 |
+
<div class="option">
|
426 |
+
<!-- Size -->
|
427 |
+
<div class="spinner_container">
|
428 |
+
<input class="typography_size number small-text" type="number" name="<?php echo $name ?>[size]" id="<?php echo $id ?>-size" value="<?php echo $value['size'] ?>" data-min="<?php if(isset( $field['min'] )) echo $field['min'] ?>" data-max="<?php if(isset( $field['max'] )) echo $field['max'] ?>" />
|
429 |
+
</div>
|
430 |
+
|
431 |
+
<!-- Unit -->
|
432 |
+
<div class="select-wrapper font-unit">
|
433 |
+
<select class="typography_unit" name="<?php echo $name ?>[unit]" id="<?php echo $id ?>-unit">
|
434 |
+
<option value="px" <?php selected( $value['unit'], 'px' ) ?>><?php _e( 'px', 'yit' ) ?></option>
|
435 |
+
<option value="em" <?php selected( $value['unit'], 'em' ) ?>><?php _e( 'em', 'yit' ) ?></option>
|
436 |
+
<option value="pt" <?php selected( $value['unit'], 'pt' ) ?>><?php _e( 'pt', 'yit' ) ?></option>
|
437 |
+
<option value="rem" <?php selected( $value['unit'], 'rem' ) ?>><?php _e( 'rem', 'yit' ) ?></option>
|
438 |
+
</select>
|
439 |
+
</div>
|
440 |
+
|
441 |
+
<!-- Family -->
|
442 |
+
<div class="select-wrapper font-family">
|
443 |
+
<select class="typography_family" name="<?php echo $name ?>[family]" id="<?php echo $id ?>-family" data-instance="false">
|
444 |
+
<?php if( $value['family'] ): ?>
|
445 |
+
<option value="<?php echo stripslashes( $value['family'] ) ?>"><?php echo $value['family'] ?></option>
|
446 |
+
<?php else: ?>
|
447 |
+
<option value=""><?php _e('Select a font family', 'yit') ?></option>
|
448 |
+
<?php endif ?>
|
449 |
+
</select>
|
450 |
+
</div>
|
451 |
+
|
452 |
+
<!-- Style -->
|
453 |
+
<div class="select-wrapper font-style">
|
454 |
+
<select class="typography_style" name="<?php echo $name ?>[style]" id="<?php echo $id ?>-style">
|
455 |
+
<option value="regular" <?php selected( $value['style'], 'regular' ) ?>><?php _e( 'Regular', 'yit' ) ?></option>
|
456 |
+
<option value="bold" <?php selected( $value['style'], 'bold' ) ?>><?php _e( 'Bold', 'yit' ) ?></option>
|
457 |
+
<option value="extra-bold" <?php selected( $value['style'], 'extra-bold' ) ?>><?php _e( 'Extra bold', 'yit' ) ?></option>
|
458 |
+
<option value="italic" <?php selected( $value['style'], 'italic' ) ?>><?php _e( 'Italic', 'yit' ) ?></option>
|
459 |
+
<option value="bold-italic" <?php selected( $value['style'], 'bold-italic' ) ?>><?php _e( 'Italic bold', 'yit' ) ?></option>
|
460 |
+
</select>
|
461 |
+
</div>
|
462 |
+
|
463 |
+
<!-- Color -->
|
464 |
+
<input type='text' id='<?php echo $id ?>-color' name='<?php echo $name ?>[color]' value='<?php echo $value['color'] ?>' class='medium-text code panel-colorpicker typography_color' data-default-color='<?php echo $field['std']['color'] ?>' />
|
465 |
+
|
466 |
+
</div>
|
467 |
+
<div class="clear"></div>
|
468 |
+
<div class="font-preview">
|
469 |
+
<p>The quick brown fox jumps over the lazy dog</p>
|
470 |
+
<!-- Refresh -->
|
471 |
+
<div class="refresh_container"><button class="refresh"><?php _e( 'Click to preview', 'yit' ) ?></button></div>
|
472 |
+
</div>
|
473 |
+
</div>
|
474 |
+
<?php
|
475 |
+
global $yith_panel_if_typography;
|
476 |
+
$yith_panel_if_typography = true;
|
477 |
+
break;
|
478 |
+
|
479 |
+
default:
|
480 |
+
do_action('yith_panel_field_' . $field['type']);
|
481 |
+
break;
|
482 |
+
}
|
483 |
+
|
484 |
+
echo $echo;
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Print the banner
|
489 |
+
*
|
490 |
+
* @access protected
|
491 |
+
* @return void
|
492 |
+
*/
|
493 |
+
public function printBanner() {
|
494 |
+
if( !$this->banner_url || !$this->banner_img ) return;
|
495 |
+
?>
|
496 |
+
<div class="yith_banner">
|
497 |
+
<a href="<?php echo $this->banner_url ?>" target="_blank">
|
498 |
+
<img src="<?php echo $this->banner_img ?>" alt="" />
|
499 |
+
</a>
|
500 |
+
</div>
|
501 |
+
<?php
|
502 |
+
}
|
503 |
+
}
|
504 |
+
}
|