Version Description
- Fixed: Click on row to filter in dropdown style
- Removed: var_dump() in product filter widget
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Product Filter |
Version | 2.7.0 |
Comparing to | |
See all releases |
Code changes from version 2.6.0 to 2.7.0
- README.txt +7 -2
- assets/css/admin.css +209 -205
- assets/css/frontend.css +279 -269
- assets/images/06.png +0 -0
- assets/images/07.png +0 -0
- assets/images/08-bg.png +0 -0
- assets/images/08-icon.png +0 -0
- assets/images/08.png +0 -0
- assets/js/yith-wcan-admin.js +117 -117
- assets/js/yith-wcan-frontend.js +321 -312
- assets/js/yith-wcan-frontend.min.js +11 -11
- includes/class.yith-wcan-admin.php +275 -275
- includes/class.yith-wcan-frontend.php +138 -138
- includes/class.yith-wcan-helper.php +65 -65
- includes/class.yith-wcan.php +173 -173
- includes/functions.yith-wcan.php +502 -502
- init.php +2 -2
- languages/yith-woocommerce-ajax-navigation-it_IT.mo +0 -0
- languages/yith-woocommerce-ajax-navigation-it_IT.po +2 -2
- languages/yith-woocommerce-ajax-navigation-tr_TR.mo +0 -0
- languages/yith-woocommerce-ajax-navigation-tr_TR.po +2 -2
- languages/yith-woocommerce-ajax-navigation.pot +1 -1
- plugin-fw/assets/css/metaboxes.css +21 -0
- plugin-fw/assets/css/yit-plugin-panel.css +4 -0
- plugin-fw/assets/js/yit-plugin-panel.js +10 -0
- plugin-fw/assets/js/yit-plugin-panel.min.js +10 -1
- plugin-fw/init.php +13 -15
- plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
- plugin-fw/languages/yith-plugin-fw-it_IT.po +223 -133
- plugin-fw/languages/yith-plugin-fw.pot +148 -108
- plugin-fw/lib/yit-plugin-panel-wc.php +8 -3
- plugin-fw/lib/yit-plugin-panel.php +23 -14
- plugin-fw/lib/yit-plugin-subpanel.php +12 -9
- plugin-fw/lib/yit-upgrade.php +9 -25
- plugin-fw/licence/assets/css/yit-licence.css +112 -23
- plugin-fw/licence/assets/js/yit-licence.js +82 -25
- plugin-fw/licence/lib/yit-licence.php +201 -54
- plugin-fw/licence/lib/yit-plugin-licence.php +17 -15
- plugin-fw/licence/lib/yit-theme-licence.php +61 -24
- plugin-fw/licence/templates/panel/activation/activation-panel.php +127 -54
- plugin-fw/templates/metaboxes/types/number.php +14 -1
- plugin-fw/templates/panel/types/upload.php +2 -1
- plugin-fw/yit-functions.php +261 -236
- settings/custom-style-options.php +39 -39
- settings/frontend-options.php +60 -60
- templates/admin/premium.php +17 -1
- widgets/class.yith-wcan-navigation-widget.php +947 -912
- widgets/class.yith-wcan-reset-navigation-widget.php +111 -111
README.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -159,6 +159,11 @@ If you want to see a demonstration version of the premium plugin, you can see it
|
|
159 |
|
160 |
== Changelog ==
|
161 |
|
|
|
|
|
|
|
|
|
|
|
162 |
= 2.6.0 =
|
163 |
|
164 |
* Added: yith_wcan_show_widget hook to manage the widgets display condition
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.4
|
7 |
+
Stable tag: 2.7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 2.7.0 =
|
163 |
+
|
164 |
+
* Fixed: Click on row to filter in dropdown style
|
165 |
+
* Removed: var_dump() in product filter widget
|
166 |
+
|
167 |
= 2.6.0 =
|
168 |
|
169 |
* Added: yith_wcan_show_widget hook to manage the widgets display condition
|
assets/css/admin.css
CHANGED
@@ -1,206 +1,210 @@
|
|
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: middle;
|
19 |
-
}
|
20 |
-
|
21 |
-
p.yit-wcan-display-label,
|
22 |
-
p.yit-wcan-display-color,
|
23 |
-
p#yit-wcan-style,
|
24 |
-
p#yit-wcan-show-count,
|
25 |
-
p.yit-wcan-display-tags,
|
26 |
-
div.yit-wcan-widget-tag-list {
|
27 |
-
display: none;
|
28 |
-
}
|
29 |
-
|
30 |
-
div.yit-wcan-widget-tag-list.tags{
|
31 |
-
display: block;
|
32 |
-
}
|
33 |
-
|
34 |
-
p#yit-wcan-style.yit-wcan-style-color,
|
35 |
-
p#yit-wcan-style.yit-wcan-style-multicolor,
|
36 |
-
p#yit-wcan-show-count.yit-wcan-show-count-list,
|
37 |
-
p#yit-wcan-show-count.yit-wcan-show-count-brands,
|
38 |
-
p#yit-wcan-show-count.yit-wcan-show-count-tags{
|
39 |
-
display: block;
|
40 |
-
}
|
41 |
-
|
42 |
-
label.yith-wcan-reset-table{
|
43 |
-
width: 50%;
|
44 |
-
display: inline-block;
|
45 |
-
vertical-align: top;
|
46 |
-
}
|
47 |
-
|
48 |
-
/* Options Panel Customizzation */
|
49 |
-
|
50 |
-
.plugin-option .form-table tr {
|
51 |
-
background-color: #ffffff;
|
52 |
-
border: none;
|
53 |
-
}
|
54 |
-
|
55 |
-
.plugin-option .form-table tr th {
|
56 |
-
padding: 20px 10px 20px 20px;
|
57 |
-
}
|
58 |
-
|
59 |
-
.yith_wcan_placeholder .wp-picker-holder {
|
60 |
-
position: absolute;
|
61 |
-
z-index: 999;
|
62 |
-
}
|
63 |
-
|
64 |
-
.yith-wcan-multicolor .wp-picker-container .wp-picker-clear {
|
65 |
-
display: none;
|
66 |
-
}
|
67 |
-
|
68 |
-
/* == Panel Customization === */
|
69 |
-
|
70 |
-
.yit-plugins_page_yith_wcan_panel .plugin-option{
|
71 |
-
margin-right: 15px;
|
72 |
-
}
|
73 |
-
|
74 |
-
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option {
|
75 |
-
width: 270px;
|
76 |
-
}
|
77 |
-
|
78 |
-
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options
|
79 |
-
width:
|
80 |
-
}
|
81 |
-
|
82 |
-
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .
|
83 |
-
|
84 |
-
}
|
85 |
-
|
86 |
-
.yit-plugins_page_yith_wcan_panel .plugin-option .
|
87 |
-
|
88 |
-
}
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
margin-bottom: 15px;
|
109 |
-
}
|
110 |
-
|
111 |
-
.
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
.plugin-option .form-table td .yith_wcan_select_tag
|
122 |
-
|
123 |
-
}
|
124 |
-
|
125 |
-
.plugin-option .form-table td .yith_wcan_select_tag thead
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
}
|
140 |
-
|
141 |
-
.
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
.
|
146 |
-
|
147 |
-
}
|
148 |
-
|
149 |
-
.yith-wcan-select-option .
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
border
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
input#
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
width:
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
206 |
}
|
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: middle;
|
19 |
+
}
|
20 |
+
|
21 |
+
p.yit-wcan-display-label,
|
22 |
+
p.yit-wcan-display-color,
|
23 |
+
p#yit-wcan-style,
|
24 |
+
p#yit-wcan-show-count,
|
25 |
+
p.yit-wcan-display-tags,
|
26 |
+
div.yit-wcan-widget-tag-list {
|
27 |
+
display: none;
|
28 |
+
}
|
29 |
+
|
30 |
+
div.yit-wcan-widget-tag-list.tags{
|
31 |
+
display: block;
|
32 |
+
}
|
33 |
+
|
34 |
+
p#yit-wcan-style.yit-wcan-style-color,
|
35 |
+
p#yit-wcan-style.yit-wcan-style-multicolor,
|
36 |
+
p#yit-wcan-show-count.yit-wcan-show-count-list,
|
37 |
+
p#yit-wcan-show-count.yit-wcan-show-count-brands,
|
38 |
+
p#yit-wcan-show-count.yit-wcan-show-count-tags{
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
|
42 |
+
label.yith-wcan-reset-table{
|
43 |
+
width: 50%;
|
44 |
+
display: inline-block;
|
45 |
+
vertical-align: top;
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Options Panel Customizzation */
|
49 |
+
|
50 |
+
.plugin-option .form-table tr {
|
51 |
+
background-color: #ffffff;
|
52 |
+
border: none;
|
53 |
+
}
|
54 |
+
|
55 |
+
.plugin-option .form-table tr th {
|
56 |
+
padding: 20px 10px 20px 20px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.yith_wcan_placeholder .wp-picker-holder {
|
60 |
+
position: absolute;
|
61 |
+
z-index: 999;
|
62 |
+
}
|
63 |
+
|
64 |
+
.yith-wcan-multicolor .wp-picker-container .wp-picker-clear {
|
65 |
+
display: none;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* == Panel Customization === */
|
69 |
+
|
70 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option{
|
71 |
+
margin-right: 15px;
|
72 |
+
}
|
73 |
+
|
74 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option {
|
75 |
+
width: 270px;
|
76 |
+
}
|
77 |
+
|
78 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option.yit-upload {
|
79 |
+
width: 350px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .option {
|
83 |
+
width: 100px;
|
84 |
+
}
|
85 |
+
|
86 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .description {
|
87 |
+
line-height: 38px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.yit-plugins_page_yith_wcan_panel .plugin-option .form-table tr th {
|
91 |
+
width: 240px;
|
92 |
+
}
|
93 |
+
|
94 |
+
div#yit_wcan_options_yith_wcan_dropdown_style-container .select_wrapper,
|
95 |
+
div#yit_wcan_options_yith_wcan_tag_query_option-container .select_wrapper {
|
96 |
+
width: 220px;
|
97 |
+
}
|
98 |
+
|
99 |
+
input.yith-wcan-price-filter-input.widefat {
|
100 |
+
width: 30%;
|
101 |
+
display: inline-block;
|
102 |
+
margin-bottom: 10px;
|
103 |
+
margin-right: 15px;
|
104 |
+
}
|
105 |
+
|
106 |
+
.yith-wcan-price-filter label {
|
107 |
+
display: block;
|
108 |
+
margin-bottom: 15px;
|
109 |
+
}
|
110 |
+
|
111 |
+
.yith-add-new-range-button {
|
112 |
+
margin-bottom: 15px;
|
113 |
+
}
|
114 |
+
|
115 |
+
.plugin-option .form-table td .yith_wcan_select_tag tbody td,
|
116 |
+
.plugin-option .form-table td .yith_wcan_select_tag thead td{
|
117 |
+
padding: 5px 5px 5px 0;
|
118 |
+
line-height: 0;
|
119 |
+
}
|
120 |
+
|
121 |
+
.plugin-option .form-table td .yith_wcan_select_tag tbody td.term_count{
|
122 |
+
text-align: center;
|
123 |
+
}
|
124 |
+
|
125 |
+
.plugin-option .form-table td .yith_wcan_select_tag thead {
|
126 |
+
margin-bottom: 15px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.plugin-option .form-table td .yith_wcan_select_tag thead td{
|
130 |
+
font-weight: bold;
|
131 |
+
text-transform: uppercase;
|
132 |
+
padding-bottom: 25px;
|
133 |
+
}
|
134 |
+
|
135 |
+
.yith_wcan_select_tag_wrapper {
|
136 |
+
max-height: 150px;
|
137 |
+
overflow-y: scroll;
|
138 |
+
overflow-x: hidden;
|
139 |
+
}
|
140 |
+
|
141 |
+
.yith_wcan_select_tag_wrapper .term_count{
|
142 |
+
text-align: center;
|
143 |
+
}
|
144 |
+
|
145 |
+
.yith_wcan_tags_query_type{
|
146 |
+
margin-bottom: 15px;
|
147 |
+
}
|
148 |
+
|
149 |
+
.yith-wcan-select-option .select-all {
|
150 |
+
margin-right: 15px;
|
151 |
+
}
|
152 |
+
.yith-wcan-select-option .select-all,
|
153 |
+
.yith-wcan-select-option .unselect-all {
|
154 |
+
text-decoration: none;
|
155 |
+
font-size: 12px;
|
156 |
+
font-weight: bold;
|
157 |
+
text-transform: uppercase;
|
158 |
+
margin-bottom: 5px;
|
159 |
+
display: inline-block;
|
160 |
+
}
|
161 |
+
|
162 |
+
.yith-wcan-select-option a.select-all:focus,
|
163 |
+
.yith-wcan-select-option a.unselect-all:focus{
|
164 |
+
-webkit-box-shadow: none;
|
165 |
+
box-shadow: none;
|
166 |
+
}
|
167 |
+
|
168 |
+
.yith-wcan-admin-note {
|
169 |
+
display: block;
|
170 |
+
font-style: italic;
|
171 |
+
}
|
172 |
+
|
173 |
+
.yith-wcan-admin-note-star {
|
174 |
+
font-size: 8px;
|
175 |
+
}
|
176 |
+
|
177 |
+
#yith-wcan-tag-list-messages {
|
178 |
+
display: none;
|
179 |
+
background-color: #FAFAFA ;
|
180 |
+
border: 1px solid #e5e5e5;
|
181 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
182 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
183 |
+
padding: 5px;
|
184 |
+
border-radius: 5px;
|
185 |
+
font-size: 12px;
|
186 |
+
}
|
187 |
+
|
188 |
+
input#yit_wcan_options_yith_wcan_ajax_shop_pagination,
|
189 |
+
input#yit_wcan_options_yith_wcan_ajax_shop_container,
|
190 |
+
input#yit_wcan_options_yith_wcan_ajax_shop_result_container,
|
191 |
+
input#yit_wcan_options_yith_wcan_ajax_widget_title_class,
|
192 |
+
input#yit_wcan_options_yith_wcan_ajax_widget_title_tag {
|
193 |
+
width: 230px;
|
194 |
+
}
|
195 |
+
|
196 |
+
div#yit_wcan_options_yith_wcan_custom_style-container .option {
|
197 |
+
width: 85%;
|
198 |
+
}
|
199 |
+
|
200 |
+
textarea#yit_wcan_options_yith_wcan_custom_style {
|
201 |
+
min-height: 300px;
|
202 |
+
padding: 8px;
|
203 |
+
resize: none;
|
204 |
+
}
|
205 |
+
|
206 |
+
div#yit_wcan_options_yith_wcan_seo_value-container .option,
|
207 |
+
div#yit_wcan_options_yith_wcan_seo_value-container .option .select_wrapper,
|
208 |
+
#yit_wcan_options_yith_wcan_seo_option-container .select_wrapper {
|
209 |
+
width: auto;
|
210 |
}
|
assets/css/frontend.css
CHANGED
@@ -1,269 +1,279 @@
|
|
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 |
-
box-sizing: content-box;
|
36 |
-
}
|
37 |
-
|
38 |
-
.woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
|
39 |
-
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li a:hover,
|
40 |
-
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
41 |
-
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
42 |
-
.woocommerce .widget_layered_nav ul.yith-wcan-color li span:hover,
|
43 |
-
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li span:hover,
|
44 |
-
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen span,
|
45 |
-
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen span {
|
46 |
-
border: 1px solid #444;
|
47 |
-
background-image: none;
|
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 |
-
|
85 |
-
/* DROPDOWN STYLE */
|
86 |
-
|
87 |
-
.yit-wcan-select-open {
|
88 |
-
background: transparent url(../images/select-arrow.png) top 15px right no-repeat;
|
89 |
-
border: 1px solid #cecece;
|
90 |
-
color: #838383;
|
91 |
-
display: block;
|
92 |
-
line-height: 16px;
|
93 |
-
margin-bottom: 15px;
|
94 |
-
margin-top: 15px;
|
95 |
-
overflow: hidden;
|
96 |
-
padding: 10px 30px 10px 10px;
|
97 |
-
}
|
98 |
-
|
99 |
-
.yit-wcan-select-open.active {
|
100 |
-
background: transparent url(../images/select-arrow.png) bottom 15px right no-repeat;
|
101 |
-
}
|
102 |
-
|
103 |
-
.yith-wcan-select-wrapper {
|
104 |
-
background: #ffffff;
|
105 |
-
margin: 0 4px 4px 0;
|
106 |
-
max-height: 240px;
|
107 |
-
padding-bottom: 30px;
|
108 |
-
position: absolute;
|
109 |
-
overflow-x: hidden;
|
110 |
-
overflow-y: auto;
|
111 |
-
max-width: 268px;
|
112 |
-
width: 100%;
|
113 |
-
z-index: -1;
|
114 |
-
border: 1px solid #cecece;
|
115 |
-
padding: 10px 0px;
|
116 |
-
margin-top: -16px;
|
117 |
-
}
|
118 |
-
|
119 |
-
.widget-area .yith-wcan-select-wrapper {
|
120 |
-
max-width: 260px;
|
121 |
-
}
|
122 |
-
|
123 |
-
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li {
|
124 |
-
padding: 5px 8px;
|
125 |
-
border-bottom: 1px solid transparent;
|
126 |
-
border-top: 1px solid transparent;
|
127 |
-
}
|
128 |
-
|
129 |
-
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li:hover,
|
130 |
-
.woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen {
|
131 |
-
-webkit-box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
|
132 |
-
-moz-box-shadow: 0px 3px 0px #f2f2f2 inset, 0px -3px 0px #f2f2f2 inset;
|
133 |
-
box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
|
134 |
-
border-bottom: 1px solid #cecece;
|
135 |
-
border-top: 1px solid #cecece;
|
136 |
-
}
|
137 |
-
|
138 |
-
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
|
139 |
-
width: 100%;
|
140 |
-
color: #838383;
|
141 |
-
box-sizing: border-box;
|
142 |
-
-moz-box-sizing: border-box; /* Firefox */
|
143 |
-
}
|
144 |
-
|
145 |
-
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
|
146 |
-
width: auto;
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
.
|
155 |
-
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
.
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
.
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
.widget
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
.widget
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
.widget
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
.widget
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
.yith-wcan-sort-by ul.orderby
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
box-sizing: content-box;
|
36 |
+
}
|
37 |
+
|
38 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
|
39 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li a:hover,
|
40 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
41 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen a,
|
42 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li span:hover,
|
43 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li span:hover,
|
44 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen span,
|
45 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen span {
|
46 |
+
border: 1px solid #444;
|
47 |
+
background-image: none;
|
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 |
+
|
85 |
+
/* DROPDOWN STYLE */
|
86 |
+
|
87 |
+
.yit-wcan-select-open {
|
88 |
+
background: transparent url(../images/select-arrow.png) top 15px right no-repeat;
|
89 |
+
border: 1px solid #cecece;
|
90 |
+
color: #838383;
|
91 |
+
display: block;
|
92 |
+
line-height: 16px;
|
93 |
+
margin-bottom: 15px;
|
94 |
+
margin-top: 15px;
|
95 |
+
overflow: hidden;
|
96 |
+
padding: 10px 30px 10px 10px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.yit-wcan-select-open.active {
|
100 |
+
background: transparent url(../images/select-arrow.png) bottom 15px right no-repeat;
|
101 |
+
}
|
102 |
+
|
103 |
+
.yith-wcan-select-wrapper {
|
104 |
+
background: #ffffff;
|
105 |
+
margin: 0 4px 4px 0;
|
106 |
+
max-height: 240px;
|
107 |
+
padding-bottom: 30px;
|
108 |
+
position: absolute;
|
109 |
+
overflow-x: hidden;
|
110 |
+
overflow-y: auto;
|
111 |
+
max-width: 268px;
|
112 |
+
width: 100%;
|
113 |
+
z-index: -1;
|
114 |
+
border: 1px solid #cecece;
|
115 |
+
padding: 10px 0px;
|
116 |
+
margin-top: -16px;
|
117 |
+
}
|
118 |
+
|
119 |
+
.widget-area .yith-wcan-select-wrapper {
|
120 |
+
max-width: 260px;
|
121 |
+
}
|
122 |
+
|
123 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li {
|
124 |
+
padding: 5px 8px;
|
125 |
+
border-bottom: 1px solid transparent;
|
126 |
+
border-top: 1px solid transparent;
|
127 |
+
}
|
128 |
+
|
129 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li:hover,
|
130 |
+
.woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen {
|
131 |
+
-webkit-box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
|
132 |
+
-moz-box-shadow: 0px 3px 0px #f2f2f2 inset, 0px -3px 0px #f2f2f2 inset;
|
133 |
+
box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
|
134 |
+
border-bottom: 1px solid #cecece;
|
135 |
+
border-top: 1px solid #cecece;
|
136 |
+
}
|
137 |
+
|
138 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
|
139 |
+
width: 100%;
|
140 |
+
color: #838383;
|
141 |
+
box-sizing: border-box;
|
142 |
+
-moz-box-sizing: border-box; /* Firefox */
|
143 |
+
}
|
144 |
+
|
145 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
|
146 |
+
width: auto;
|
147 |
+
display: block;
|
148 |
+
}
|
149 |
+
|
150 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.chosen a{
|
151 |
+
padding: 0;
|
152 |
+
}
|
153 |
+
|
154 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a:hover, .widget .yit-wcan-select-open:hover {
|
155 |
+
text-decoration: none;
|
156 |
+
color: #838383;
|
157 |
+
}
|
158 |
+
|
159 |
+
.woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a, .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a {
|
160 |
+
background: transparent url(../images/cross.png) bottom 6px left no-repeat;
|
161 |
+
border: none;
|
162 |
+
}
|
163 |
+
|
164 |
+
/* WooCommerce 2.1.X Fix */
|
165 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-select li.chosen a:before,
|
166 |
+
.woocommerce-page .widget_layered_nav ul.yith-wcan-select li.chosen a:before {
|
167 |
+
content: "";
|
168 |
+
}
|
169 |
+
|
170 |
+
/* Hierarchical Order */
|
171 |
+
.widget.widget_layered_nav li.yit-wcan-child-terms {
|
172 |
+
padding-left: 30px;
|
173 |
+
}
|
174 |
+
|
175 |
+
.yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.yit-wcan-child-terms {
|
176 |
+
padding-left: 30px;
|
177 |
+
}
|
178 |
+
|
179 |
+
/* widget dropdown */
|
180 |
+
.widget h1.with-dropdown,
|
181 |
+
.widget h2.with-dropdown,
|
182 |
+
.widget h3.with-dropdown,
|
183 |
+
.widget h4.with-dropdown,
|
184 |
+
.widget h5.with-dropdown,
|
185 |
+
.widget h6.with-dropdown {
|
186 |
+
position: relative;
|
187 |
+
cursor: pointer;
|
188 |
+
}
|
189 |
+
|
190 |
+
.widget h1.with-dropdown .widget-dropdown,
|
191 |
+
.widget h2.with-dropdown .widget-dropdown,
|
192 |
+
.widget h3.with-dropdown .widget-dropdown,
|
193 |
+
.widget h4.with-dropdown .widget-dropdown,
|
194 |
+
.widget h5.with-dropdown .widget-dropdown,
|
195 |
+
.widget h6.with-dropdown .widget-dropdown {
|
196 |
+
border-width: 0;
|
197 |
+
width: 22px;
|
198 |
+
height: 22px;
|
199 |
+
background: url(../images/select-arrow.png) top 0px right no-repeat;
|
200 |
+
background-size: 95% !important;
|
201 |
+
position: absolute;
|
202 |
+
top: 0;
|
203 |
+
right: 0;
|
204 |
+
}
|
205 |
+
|
206 |
+
.widget h1.with-dropdown.open .widget-dropdown,
|
207 |
+
.widget h2.with-dropdown.open .widget-dropdown,
|
208 |
+
.widget h3.with-dropdown.open .widget-dropdown,
|
209 |
+
.widget h4.with-dropdown.open .widget-dropdown,
|
210 |
+
.widget h5.with-dropdown.open .widget-dropdown,
|
211 |
+
.widget h6.with-dropdown.open .widget-dropdown {
|
212 |
+
background-position: bottom 15px right;
|
213 |
+
}
|
214 |
+
|
215 |
+
/* === Sort By === */
|
216 |
+
|
217 |
+
.yith-wcan-sort-by ul.orderby {
|
218 |
+
list-style: none;
|
219 |
+
padding: 0;
|
220 |
+
}
|
221 |
+
|
222 |
+
.yith-wcan-sort-by ul.orderby li.orderby-wrapper {
|
223 |
+
margin-bottom: 5px;
|
224 |
+
}
|
225 |
+
|
226 |
+
.yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
|
227 |
+
a.yith-wcan-onsale-button.active:before,
|
228 |
+
a.yith-wcan-instock-button.active:before,
|
229 |
+
a.yith-wcan-price-link.active:before {
|
230 |
+
font-family: WooCommerce;
|
231 |
+
speak: none;
|
232 |
+
font-variant: normal;
|
233 |
+
text-transform: none;
|
234 |
+
-webkit-font-smoothing: antialiased;
|
235 |
+
text-decoration: none;
|
236 |
+
font-weight: 400;
|
237 |
+
line-height: 1;
|
238 |
+
content:"";
|
239 |
+
color: #a00;
|
240 |
+
margin-right: .618em;
|
241 |
+
}
|
242 |
+
|
243 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor {
|
244 |
+
position: relative;
|
245 |
+
}
|
246 |
+
|
247 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor {
|
248 |
+
width: 0;
|
249 |
+
height: 0;
|
250 |
+
border-style: solid;
|
251 |
+
position: absolute;
|
252 |
+
top: 0;
|
253 |
+
left: 0;
|
254 |
+
margin: 0;
|
255 |
+
cursor: pointer;
|
256 |
+
}
|
257 |
+
|
258 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-1{
|
259 |
+
border-width: 20px 20px 0 0;
|
260 |
+
}
|
261 |
+
|
262 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-2{
|
263 |
+
border-width: 0 0 20px 20px;
|
264 |
+
}
|
265 |
+
|
266 |
+
.woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor.round {
|
267 |
+
border-radius: 50%;
|
268 |
+
}
|
269 |
+
|
270 |
+
.woocommerce .widget_price_filter .price_slider_amount button {
|
271 |
+
display: none;
|
272 |
+
}
|
273 |
+
|
274 |
+
.woocommerce .widget_price_filter .price_slider_amount #min_price.yith_wcan_no_slider,
|
275 |
+
.woocommerce .widget_price_filter .price_slider_amount #max_price.yith_wcan_no_slider {
|
276 |
+
margin-bottom: 10px;
|
277 |
+
}
|
278 |
+
|
279 |
+
|
assets/images/06.png
CHANGED
Binary file
|
assets/images/07.png
CHANGED
Binary file
|
assets/images/08-bg.png
ADDED
Binary file
|
assets/images/08-icon.png
ADDED
Binary file
|
assets/images/08.png
ADDED
Binary file
|
assets/js/yith-wcan-admin.js
CHANGED
@@ -1,118 +1,118 @@
|
|
1 |
-
/**
|
2 |
-
* Admin
|
3 |
-
*
|
4 |
-
* @author Your Inspiration Themes
|
5 |
-
* @package YITH WooCommerce Ajax Navigation
|
6 |
-
* @version 1.3.2
|
7 |
-
*/
|
8 |
-
jQuery(function ($) {
|
9 |
-
$.add_new_range = function () {
|
10 |
-
var range_filter = $('#widgets-right').find('.range-filter'),
|
11 |
-
input_field = range_filter.find('input:last-child'),
|
12 |
-
field_name = range_filter.data('field_name'),
|
13 |
-
position = parseInt(input_field.data('position')) + 1,
|
14 |
-
html = '<input type="text" placeholder="min" name="' + field_name + '[' + position + '][min]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>' +
|
15 |
-
'<input type="text" placeholder="max" name="' + field_name + '[' + position + '][max]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>';
|
16 |
-
|
17 |
-
range_filter.append(html);
|
18 |
-
};
|
19 |
-
|
20 |
-
$.select_dropdown = function( elem ) { console.log( elem );
|
21 |
-
var t = elem,
|
22 |
-
select = t.parents('p').next('p');
|
23 |
-
|
24 |
-
t.is(':checked') ? select.fadeIn('slow') : select.fadeOut('slow');
|
25 |
-
}
|
26 |
-
|
27 |
-
$(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function (e) {
|
28 |
-
var t = this,
|
29 |
-
container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
|
30 |
-
spinner = container.next('.spinner').show(),
|
31 |
-
display = $(this).parents('.widget-content').find('#yit-wcan-display'),
|
32 |
-
style = $(this).parents('.widget-content').find('#yit-wcan-style'),
|
33 |
-
show_count = $(this).parents('.widget-content').find('#yit-wcan-show-count'),
|
34 |
-
attributes = $(this).parents('.widget-content').find('.yith-wcan-attribute-list'),
|
35 |
-
tag_list = $(this).parents('.widget-content').find('.yit-wcan-widget-tag-list');
|
36 |
-
|
37 |
-
var data = {
|
38 |
-
action : 'yith_wcan_select_type',
|
39 |
-
id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
|
40 |
-
name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
|
41 |
-
attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
|
42 |
-
value : $('.yith_wcan_type', $(t).parents('.widget-content')).val()
|
43 |
-
};
|
44 |
-
|
45 |
-
/* Hierarchical hide/show */
|
46 |
-
if (data.value == 'list' || data.value == 'select' || data.value == 'brands' || data.value == 'tags' ) {
|
47 |
-
display.show();
|
48 |
-
style.hide();
|
49 |
-
} else if (data.value == 'label' || data.value == 'color' || data.value == 'multicolor' ) {
|
50 |
-
display.hide();
|
51 |
-
}
|
52 |
-
|
53 |
-
if( data.value == 'color' || data.value == 'multicolor' ){
|
54 |
-
style.show();
|
55 |
-
} else {
|
56 |
-
style.hide();
|
57 |
-
}
|
58 |
-
|
59 |
-
if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' ){
|
60 |
-
show_count.show();
|
61 |
-
} else {
|
62 |
-
show_count.hide();
|
63 |
-
}
|
64 |
-
|
65 |
-
if( data.value == 'tags' || data.value == 'brands' ){
|
66 |
-
attributes.hide();
|
67 |
-
} else {
|
68 |
-
attributes.show();
|
69 |
-
}
|
70 |
-
|
71 |
-
if( data.value == 'tags' ){
|
72 |
-
tag_list.show();
|
73 |
-
} else {
|
74 |
-
tag_list.hide();
|
75 |
-
}
|
76 |
-
|
77 |
-
$.post(ajaxurl, data, function (response) {
|
78 |
-
spinner.hide();
|
79 |
-
container.html(response.content);
|
80 |
-
$(document).trigger('yith_colorpicker');
|
81 |
-
}, 'json');
|
82 |
-
});
|
83 |
-
|
84 |
-
//color-picker
|
85 |
-
$(document).on('yith_colorpicker',function () {
|
86 |
-
$('.yith-colorpicker').each(function () {
|
87 |
-
$(this).wpColorPicker();
|
88 |
-
});
|
89 |
-
}).trigger('yith_colorpicker');
|
90 |
-
|
91 |
-
$(document).on('change', '.yith-wcan-enable-custom-style', function(){
|
92 |
-
var t = $(this),
|
93 |
-
enable_custom_style = t.parents('.widget-content').find('.yith-wcan-reset-custom-style'),
|
94 |
-
checked = t.find('.yith-wcan-enable-custom-style-check').is(':checked');
|
95 |
-
|
96 |
-
checked ? enable_custom_style.fadeIn('slow') : enable_custom_style.fadeOut('slow');
|
97 |
-
});
|
98 |
-
|
99 |
-
$(document).on('change', '.yith-wcan-dropdown-check', function(){
|
100 |
-
$.select_dropdown( $(this) );
|
101 |
-
});
|
102 |
-
|
103 |
-
//Filter By Tag tab
|
104 |
-
var select_all = $('.yith-wcan-select-option .select-all'),
|
105 |
-
unselect_all = $('.yith-wcan-select-option .unselect-all'),
|
106 |
-
checklist = $('.yith_wcan_select_tag'),
|
107 |
-
widget_select = $('#yith-wcan-tag-widget-select');
|
108 |
-
|
109 |
-
select_all.on('click', function(e){
|
110 |
-
e.preventDefault();
|
111 |
-
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
|
112 |
-
});
|
113 |
-
|
114 |
-
unselect_all.on('click', function(e){
|
115 |
-
e.preventDefault();
|
116 |
-
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
|
117 |
-
});
|
118 |
});
|
1 |
+
/**
|
2 |
+
* Admin
|
3 |
+
*
|
4 |
+
* @author Your Inspiration Themes
|
5 |
+
* @package YITH WooCommerce Ajax Navigation
|
6 |
+
* @version 1.3.2
|
7 |
+
*/
|
8 |
+
jQuery(function ($) {
|
9 |
+
$.add_new_range = function () {
|
10 |
+
var range_filter = $('#widgets-right').find('.range-filter'),
|
11 |
+
input_field = range_filter.find('input:last-child'),
|
12 |
+
field_name = range_filter.data('field_name'),
|
13 |
+
position = parseInt(input_field.data('position')) + 1,
|
14 |
+
html = '<input type="text" placeholder="min" name="' + field_name + '[' + position + '][min]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>' +
|
15 |
+
'<input type="text" placeholder="max" name="' + field_name + '[' + position + '][max]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>';
|
16 |
+
|
17 |
+
range_filter.append(html);
|
18 |
+
};
|
19 |
+
|
20 |
+
$.select_dropdown = function( elem ) { console.log( elem );
|
21 |
+
var t = elem,
|
22 |
+
select = t.parents('p').next('p');
|
23 |
+
|
24 |
+
t.is(':checked') ? select.fadeIn('slow') : select.fadeOut('slow');
|
25 |
+
}
|
26 |
+
|
27 |
+
$(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function (e) {
|
28 |
+
var t = this,
|
29 |
+
container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
|
30 |
+
spinner = container.next('.spinner').show(),
|
31 |
+
display = $(this).parents('.widget-content').find('#yit-wcan-display'),
|
32 |
+
style = $(this).parents('.widget-content').find('#yit-wcan-style'),
|
33 |
+
show_count = $(this).parents('.widget-content').find('#yit-wcan-show-count'),
|
34 |
+
attributes = $(this).parents('.widget-content').find('.yith-wcan-attribute-list'),
|
35 |
+
tag_list = $(this).parents('.widget-content').find('.yit-wcan-widget-tag-list');
|
36 |
+
|
37 |
+
var data = {
|
38 |
+
action : 'yith_wcan_select_type',
|
39 |
+
id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
|
40 |
+
name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
|
41 |
+
attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
|
42 |
+
value : $('.yith_wcan_type', $(t).parents('.widget-content')).val()
|
43 |
+
};
|
44 |
+
|
45 |
+
/* Hierarchical hide/show */
|
46 |
+
if (data.value == 'list' || data.value == 'select' || data.value == 'brands' || data.value == 'tags' ) {
|
47 |
+
display.show();
|
48 |
+
style.hide();
|
49 |
+
} else if (data.value == 'label' || data.value == 'color' || data.value == 'multicolor' ) {
|
50 |
+
display.hide();
|
51 |
+
}
|
52 |
+
|
53 |
+
if( data.value == 'color' || data.value == 'multicolor' ){
|
54 |
+
style.show();
|
55 |
+
} else {
|
56 |
+
style.hide();
|
57 |
+
}
|
58 |
+
|
59 |
+
if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' ){
|
60 |
+
show_count.show();
|
61 |
+
} else {
|
62 |
+
show_count.hide();
|
63 |
+
}
|
64 |
+
|
65 |
+
if( data.value == 'tags' || data.value == 'brands' || data.value == 'categories' ){
|
66 |
+
attributes.hide();
|
67 |
+
} else {
|
68 |
+
attributes.show();
|
69 |
+
}
|
70 |
+
|
71 |
+
if( data.value == 'tags' ){
|
72 |
+
tag_list.show();
|
73 |
+
} else {
|
74 |
+
tag_list.hide();
|
75 |
+
}
|
76 |
+
|
77 |
+
$.post(ajaxurl, data, function (response) {
|
78 |
+
spinner.hide();
|
79 |
+
container.html(response.content);
|
80 |
+
$(document).trigger('yith_colorpicker');
|
81 |
+
}, 'json');
|
82 |
+
});
|
83 |
+
|
84 |
+
//color-picker
|
85 |
+
$(document).on('yith_colorpicker',function () {
|
86 |
+
$('.yith-colorpicker').each(function () {
|
87 |
+
$(this).wpColorPicker();
|
88 |
+
});
|
89 |
+
}).trigger('yith_colorpicker');
|
90 |
+
|
91 |
+
$(document).on('change', '.yith-wcan-enable-custom-style', function(){
|
92 |
+
var t = $(this),
|
93 |
+
enable_custom_style = t.parents('.widget-content').find('.yith-wcan-reset-custom-style'),
|
94 |
+
checked = t.find('.yith-wcan-enable-custom-style-check').is(':checked');
|
95 |
+
|
96 |
+
checked ? enable_custom_style.fadeIn('slow') : enable_custom_style.fadeOut('slow');
|
97 |
+
});
|
98 |
+
|
99 |
+
$(document).on('change', '.yith-wcan-dropdown-check', function(){
|
100 |
+
$.select_dropdown( $(this) );
|
101 |
+
});
|
102 |
+
|
103 |
+
//Filter By Tag tab
|
104 |
+
var select_all = $('.yith-wcan-select-option .select-all'),
|
105 |
+
unselect_all = $('.yith-wcan-select-option .unselect-all'),
|
106 |
+
checklist = $('.yith_wcan_select_tag'),
|
107 |
+
widget_select = $('#yith-wcan-tag-widget-select');
|
108 |
+
|
109 |
+
select_all.on('click', function(e){
|
110 |
+
e.preventDefault();
|
111 |
+
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
|
112 |
+
});
|
113 |
+
|
114 |
+
unselect_all.on('click', function(e){
|
115 |
+
e.preventDefault();
|
116 |
+
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
|
117 |
+
});
|
118 |
});
|
assets/js/yith-wcan-frontend.js
CHANGED
@@ -1,312 +1,321 @@
|
|
1 |
-
/**
|
2 |
-
* Frontend
|
3 |
-
*
|
4 |
-
* @author Your Inspiration Themes
|
5 |
-
* @package YITH WooCommerce Ajax Navigation
|
6 |
-
* @version 1.3.2
|
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) {
|
14 |
-
for (var c = {sel: [], val: []}, a = [], j = !1, h = "", e = [], f = 0, m = d.length; f < m; f++) {
|
15 |
-
var g = d.charAt(f);
|
16 |
-
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 {
|
17 |
-
if ("]" !== g || "" !== h)"" === h && "," === g ? (c.val.push(e.join("")),
|
18 |
-
e = []) : e.push(g)
|
19 |
-
} 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)
|
20 |
-
}
|
21 |
-
if (0 != c.sel.length || 0 != c.val.length)c.sel = c.sel.join(""), a.push(c);
|
22 |
-
for (f = 0; f < a.length; f++) {
|
23 |
-
c = a[f].sel;
|
24 |
-
if ("+" === c)b.tag = c; else {
|
25 |
-
var b = [];
|
26 |
-
b.tag = tagexpr.exec(c);
|
27 |
-
b.id = idexpr.exec(c);
|
28 |
-
b.id && $.isArray(b.id) && (b.id = b.id[0].substr(1));
|
29 |
-
b.tag || (b.tag = "div");
|
30 |
-
b.vars = [];
|
31 |
-
for (d = 0; d < a[f].val.length; d++)h =
|
32 |
-
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]);
|
33 |
-
c = c.match(classexpr);
|
34 |
-
j = [];
|
35 |
-
if (c) {
|
36 |
-
for (d = 0; d < c.length; d++)j.push(c[d].substr(1));
|
37 |
-
b.className = j.join(" ")
|
38 |
-
}
|
39 |
-
}
|
40 |
-
a[f] = b
|
41 |
-
}
|
42 |
-
return a
|
43 |
-
}, rmFromParent = function (d) {
|
44 |
-
var c = d.parentNode, a = d.nextSibling;
|
45 |
-
c.removeChild(d);
|
46 |
-
return a ? function () {
|
47 |
-
c.insertBefore(d, a)
|
48 |
-
} : function () {
|
49 |
-
c.appendChild(d)
|
50 |
-
}
|
51 |
-
}, nonArrVer = function (d, c) {
|
52 |
-
var a = [], a = simpleselector.test(d) ? [
|
53 |
-
{tag: d}
|
54 |
-
] : parseSelector(d),
|
55 |
-
j = [];
|
56 |
-
"undefined" === typeof c && (c = 1);
|
57 |
-
for (var h = [], e = [], f = [], m = document.createElement("div"), g = 0, b = 0; b < a.length; b++) {
|
58 |
-
if ("+" == a[b].tag)e = f.slice(), --g; else {
|
59 |
-
for (var l = 0; l < c; l++)if ("input" == a[b].tag) {
|
60 |
-
var k = [];
|
61 |
-
k.push("<" + a[b].tag);
|
62 |
-
a[b].id && k.push("id='" + a[b].id + "'");
|
63 |
-
a[b].className && (k.push("class='" + a[b].className), b + 1 === a.length && k.push(lastClass), k.push("'"));
|
64 |
-
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] + "'");
|
65 |
-
a[b].text && k.push("value='" + a[b].text + "'");
|
66 |
-
k.push("/>");
|
67 |
-
f[l] = e[l];
|
68 |
-
e[l] ? (e[l].innerHTML += k.join(" "), e[l] = e[l].lastChild) : (m.innerHTML = k.join(" "), e[l] = m.removeChild(m.firstChild))
|
69 |
-
} else {
|
70 |
-
k = document.createElement(a[b].tag);
|
71 |
-
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]);
|
72 |
-
a[b].id && (k.id = a[b].id);
|
73 |
-
a[b].className && (k.className = a[b].className);
|
74 |
-
a[b].text && k.appendChild(document.createTextNode(a[b].text));
|
75 |
-
f[l] = e[l];
|
76 |
-
e[l] = e[l] ? e[l].appendChild(k) : k
|
77 |
-
}
|
78 |
-
g++ || Array.prototype.push.apply(h, e)
|
79 |
-
}
|
80 |
-
j =
|
81 |
-
$.merge(j, e)
|
82 |
-
}
|
83 |
-
return $(h)
|
84 |
-
}, arrVer = function (d, c, a) {
|
85 |
-
for (var j = d.match(/%[^%]*%/g) || [], h = [], e = 0; e < c.length; e++) {
|
86 |
-
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]);
|
87 |
-
h = $.merge(h, nonArrVer(f, a))
|
88 |
-
}
|
89 |
-
return $(h)
|
90 |
-
};
|
91 |
-
$.jseldom = function (d) {
|
92 |
-
if (2 == arguments.length && $.isPlainObject(arguments[1]))return arrVer.apply(this, [arguments[0], [arguments[1]]]);
|
93 |
-
if (1 == arguments.length || 2 == arguments.length && !$.isArray(arguments[1]))return nonArrVer.apply(this, arguments);
|
94 |
-
if (2 == arguments.length)return arrVer.apply(this, arguments)
|
95 |
-
};
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
t.
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
$('
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
$(
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Frontend
|
3 |
+
*
|
4 |
+
* @author Your Inspiration Themes
|
5 |
+
* @package YITH WooCommerce Ajax Navigation
|
6 |
+
* @version 1.3.2
|
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) {
|
14 |
+
for (var c = {sel: [], val: []}, a = [], j = !1, h = "", e = [], f = 0, m = d.length; f < m; f++) {
|
15 |
+
var g = d.charAt(f);
|
16 |
+
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 {
|
17 |
+
if ("]" !== g || "" !== h)"" === h && "," === g ? (c.val.push(e.join("")),
|
18 |
+
e = []) : e.push(g)
|
19 |
+
} 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)
|
20 |
+
}
|
21 |
+
if (0 != c.sel.length || 0 != c.val.length)c.sel = c.sel.join(""), a.push(c);
|
22 |
+
for (f = 0; f < a.length; f++) {
|
23 |
+
c = a[f].sel;
|
24 |
+
if ("+" === c)b.tag = c; else {
|
25 |
+
var b = [];
|
26 |
+
b.tag = tagexpr.exec(c);
|
27 |
+
b.id = idexpr.exec(c);
|
28 |
+
b.id && $.isArray(b.id) && (b.id = b.id[0].substr(1));
|
29 |
+
b.tag || (b.tag = "div");
|
30 |
+
b.vars = [];
|
31 |
+
for (d = 0; d < a[f].val.length; d++)h =
|
32 |
+
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]);
|
33 |
+
c = c.match(classexpr);
|
34 |
+
j = [];
|
35 |
+
if (c) {
|
36 |
+
for (d = 0; d < c.length; d++)j.push(c[d].substr(1));
|
37 |
+
b.className = j.join(" ")
|
38 |
+
}
|
39 |
+
}
|
40 |
+
a[f] = b
|
41 |
+
}
|
42 |
+
return a
|
43 |
+
}, rmFromParent = function (d) {
|
44 |
+
var c = d.parentNode, a = d.nextSibling;
|
45 |
+
c.removeChild(d);
|
46 |
+
return a ? function () {
|
47 |
+
c.insertBefore(d, a)
|
48 |
+
} : function () {
|
49 |
+
c.appendChild(d)
|
50 |
+
}
|
51 |
+
}, nonArrVer = function (d, c) {
|
52 |
+
var a = [], a = simpleselector.test(d) ? [
|
53 |
+
{tag: d}
|
54 |
+
] : parseSelector(d),
|
55 |
+
j = [];
|
56 |
+
"undefined" === typeof c && (c = 1);
|
57 |
+
for (var h = [], e = [], f = [], m = document.createElement("div"), g = 0, b = 0; b < a.length; b++) {
|
58 |
+
if ("+" == a[b].tag)e = f.slice(), --g; else {
|
59 |
+
for (var l = 0; l < c; l++)if ("input" == a[b].tag) {
|
60 |
+
var k = [];
|
61 |
+
k.push("<" + a[b].tag);
|
62 |
+
a[b].id && k.push("id='" + a[b].id + "'");
|
63 |
+
a[b].className && (k.push("class='" + a[b].className), b + 1 === a.length && k.push(lastClass), k.push("'"));
|
64 |
+
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] + "'");
|
65 |
+
a[b].text && k.push("value='" + a[b].text + "'");
|
66 |
+
k.push("/>");
|
67 |
+
f[l] = e[l];
|
68 |
+
e[l] ? (e[l].innerHTML += k.join(" "), e[l] = e[l].lastChild) : (m.innerHTML = k.join(" "), e[l] = m.removeChild(m.firstChild))
|
69 |
+
} else {
|
70 |
+
k = document.createElement(a[b].tag);
|
71 |
+
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]);
|
72 |
+
a[b].id && (k.id = a[b].id);
|
73 |
+
a[b].className && (k.className = a[b].className);
|
74 |
+
a[b].text && k.appendChild(document.createTextNode(a[b].text));
|
75 |
+
f[l] = e[l];
|
76 |
+
e[l] = e[l] ? e[l].appendChild(k) : k
|
77 |
+
}
|
78 |
+
g++ || Array.prototype.push.apply(h, e)
|
79 |
+
}
|
80 |
+
j =
|
81 |
+
$.merge(j, e)
|
82 |
+
}
|
83 |
+
return $(h)
|
84 |
+
}, arrVer = function (d, c, a) {
|
85 |
+
for (var j = d.match(/%[^%]*%/g) || [], h = [], e = 0; e < c.length; e++) {
|
86 |
+
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]);
|
87 |
+
h = $.merge(h, nonArrVer(f, a))
|
88 |
+
}
|
89 |
+
return $(h)
|
90 |
+
};
|
91 |
+
$.jseldom = function (d) {
|
92 |
+
if (2 == arguments.length && $.isPlainObject(arguments[1]))return arrVer.apply(this, [arguments[0], [arguments[1]]]);
|
93 |
+
if (1 == arguments.length || 2 == arguments.length && !$.isArray(arguments[1]))return nonArrVer.apply(this, arguments);
|
94 |
+
if (2 == arguments.length)return arrVer.apply(this, arguments)
|
95 |
+
};
|
96 |
+
|
97 |
+
var ajax_call = false;
|
98 |
+
|
99 |
+
$.fn.yith_wcan_ajax_filters = function (e, obj) {
|
100 |
+
e.preventDefault();
|
101 |
+
var href = obj.href,
|
102 |
+
t = $(obj);
|
103 |
+
|
104 |
+
if (typeof href == 'undefined' && t.parents().hasClass('price_slider_wrapper')) {
|
105 |
+
var form = t.parents('form'),
|
106 |
+
l = window.location,
|
107 |
+
shop_uri = l.origin + l.pathname,
|
108 |
+
is_filtered = shop_uri != l.href,
|
109 |
+
search = l.search,
|
110 |
+
min_price = $('.price_slider_amount #min_price').val(),
|
111 |
+
max_price = $('.price_slider_amount #max_price').val(),
|
112 |
+
regex_min = new RegExp('^min_price', 'i'),
|
113 |
+
regex_max = new RegExp('^max_price', 'i');
|
114 |
+
|
115 |
+
href = l.href;
|
116 |
+
|
117 |
+
if (is_filtered == true) {
|
118 |
+
href = RemoveParameterFromUrl(href, 'min_price');
|
119 |
+
href = RemoveParameterFromUrl(href, 'max_price');
|
120 |
+
}
|
121 |
+
|
122 |
+
var concat = shop_uri == href ? '?' : '&';
|
123 |
+
|
124 |
+
href = href + concat + $.param(
|
125 |
+
{
|
126 |
+
min_price: min_price,
|
127 |
+
max_price: max_price
|
128 |
+
}
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
if (t.data('type') == 'select') {
|
133 |
+
|
134 |
+
t.parents('div.yith-woo-ajax-navigation').find('a.yit-wcan-select-open').removeClass('active');
|
135 |
+
|
136 |
+
t.parent().find('div.yith-wcan-select-wrapper').animate({
|
137 |
+
|
138 |
+
visibility: "hidden",
|
139 |
+
opacity : 0
|
140 |
+
|
141 |
+
}, 300);
|
142 |
+
}
|
143 |
+
|
144 |
+
//loading
|
145 |
+
$(yith_wcan.container).html('').addClass('yith-wcan-loading');
|
146 |
+
$(document).trigger("yith-wcan-ajax-loading");
|
147 |
+
|
148 |
+
if (typeof yith_wcan_frontend != 'undefined') {
|
149 |
+
$(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
|
150 |
+
}
|
151 |
+
|
152 |
+
$(yith_wcan.pagination).hide();
|
153 |
+
$(yith_wcan.result_count).hide();
|
154 |
+
|
155 |
+
if( ajax_call != false ){
|
156 |
+
ajax_call.abort();
|
157 |
+
ajax_call = false;
|
158 |
+
console.log( 'here' );
|
159 |
+
}
|
160 |
+
|
161 |
+
ajax_call = $.ajax({
|
162 |
+
url : href,
|
163 |
+
success: function (response) {
|
164 |
+
ajax_call = false;
|
165 |
+
$(yith_wcan.container).removeClass('yith-wcan-loading');
|
166 |
+
|
167 |
+
//container
|
168 |
+
if ($(response).find(yith_wcan.container).length > 0) {
|
169 |
+
$('.yit-wcan-container').html($(response).find(yith_wcan.container));
|
170 |
+
} else {
|
171 |
+
$('.yit-wcan-container').html($(response).find('.woocommerce-info'));
|
172 |
+
}
|
173 |
+
|
174 |
+
//pagination
|
175 |
+
if ($(response).find(yith_wcan.pagination).length > 0) {
|
176 |
+
//se non esiste lo creo
|
177 |
+
if ($(yith_wcan.pagination).length == 0) {
|
178 |
+
$.jseldom(yith_wcan.pagination).insertAfter($(yith_wcan.container));
|
179 |
+
}
|
180 |
+
|
181 |
+
$(yith_wcan.pagination)
|
182 |
+
.html($(response).find(yith_wcan.pagination).html())
|
183 |
+
.show();
|
184 |
+
}
|
185 |
+
|
186 |
+
else {
|
187 |
+
$(yith_wcan.pagination).empty();
|
188 |
+
}
|
189 |
+
|
190 |
+
//result count
|
191 |
+
if ($(response).find(yith_wcan.result_count).length > 0) {
|
192 |
+
$(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
var widget_reload = function (t) {
|
197 |
+
var id = t.attr('id');
|
198 |
+
t.html($(response).find('#' + id).html());
|
199 |
+
|
200 |
+
if (t.text() == '') {
|
201 |
+
t.hide();
|
202 |
+
} else {
|
203 |
+
t.show();
|
204 |
+
}
|
205 |
+
};
|
206 |
+
|
207 |
+
//load new widgets
|
208 |
+
$('.yith-woo-ajax-navigation').add('.yith-wcan-sort-by').add('.yith-wcan-stock-on-sale').add('.yith-wcan-list-price-filter').each(function () {
|
209 |
+
var t = $(this);
|
210 |
+
widget_reload(t)
|
211 |
+
});
|
212 |
+
|
213 |
+
//update browser history (IE doesn't support it)
|
214 |
+
if (!navigator.userAgent.match(/msie/i)) {
|
215 |
+
window.history.pushState({"pageTitle": response.pageTitle}, "", href);
|
216 |
+
}
|
217 |
+
|
218 |
+
//trigger ready event
|
219 |
+
$(document).trigger("ready");
|
220 |
+
$(document).trigger("yith-wcan-ajax-filtered");
|
221 |
+
}
|
222 |
+
});
|
223 |
+
};
|
224 |
+
|
225 |
+
//wrap the container
|
226 |
+
$(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
|
227 |
+
$('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
|
228 |
+
|
229 |
+
$(document).on('click', '.yith-wcan a', function (e) {
|
230 |
+
$(this).yith_wcan_ajax_filters(e, this);
|
231 |
+
});
|
232 |
+
|
233 |
+
|
234 |
+
/*AJAX NAVIGATION DROPDOWN STYLE*/
|
235 |
+
|
236 |
+
function yit_open_select_dropdown(element) {
|
237 |
+
|
238 |
+
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "1").animate({
|
239 |
+
|
240 |
+
visibility: "visible",
|
241 |
+
opacity : 1
|
242 |
+
|
243 |
+
|
244 |
+
}, 300);
|
245 |
+
|
246 |
+
$(element).parent().find('a.yit-wcan-select-open').addClass('active');
|
247 |
+
}
|
248 |
+
|
249 |
+
function yit_close_select_dropdown(element) {
|
250 |
+
|
251 |
+
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "-1").animate({
|
252 |
+
|
253 |
+
visibility: "hidden",
|
254 |
+
opacity : 0
|
255 |
+
|
256 |
+
}, 300);
|
257 |
+
|
258 |
+
$(element).parent().find('a.yit-wcan-select-open').removeClass('active');
|
259 |
+
}
|
260 |
+
|
261 |
+
var yit_hidden_filters_wrapper = function () {
|
262 |
+
|
263 |
+
$('div.yith-wcan-select-wrapper').animate({
|
264 |
+
|
265 |
+
visibility: "hidden",
|
266 |
+
opacity : 0
|
267 |
+
|
268 |
+
}, 0);
|
269 |
+
|
270 |
+
$('a.yit-wcan-select-open').removeClass('active');
|
271 |
+
}
|
272 |
+
|
273 |
+
var yit_active_filter = function () {
|
274 |
+
|
275 |
+
var filter_number = $('div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen').length;
|
276 |
+
|
277 |
+
yit_hidden_filters_wrapper();
|
278 |
+
|
279 |
+
$('div.yith-wcan-select-wrapper').each(function () {
|
280 |
+
|
281 |
+
var filter_name = "";
|
282 |
+
var chosen = $(this).find('ul.yith-wcan-select li.chosen').each(function () {
|
283 |
+
filter_name += $(this).text() + ', ';
|
284 |
+
});
|
285 |
+
|
286 |
+
filter_name = filter_name.substring(0, filter_name.length - 2);
|
287 |
+
|
288 |
+
if (filter_name != "") {
|
289 |
+
$(this).parent().find('a.yit-wcan-select-open').text(filter_name);
|
290 |
+
}
|
291 |
+
})
|
292 |
+
}
|
293 |
+
|
294 |
+
$(document).on('click', 'a.yit-wcan-select-open.active', function (e) {
|
295 |
+
e.preventDefault();
|
296 |
+
yit_close_select_dropdown(this);
|
297 |
+
});
|
298 |
+
|
299 |
+
$(document).on('click', 'a.yit-wcan-select-open:not(.active)', function (e) {
|
300 |
+
e.preventDefault();
|
301 |
+
yit_open_select_dropdown(this);
|
302 |
+
});
|
303 |
+
|
304 |
+
$(document).on('ready yith-wcan-ajax-filtered', yit_active_filter);
|
305 |
+
|
306 |
+
$(document).on('ready', yit_hidden_filters_wrapper);
|
307 |
+
|
308 |
+
$('body').on('click', function (e) {
|
309 |
+
|
310 |
+
if (!$(e.target).hasClass('yit-wcan-select-open')) {
|
311 |
+
yit_hidden_filters_wrapper();
|
312 |
+
}
|
313 |
+
|
314 |
+
});
|
315 |
+
|
316 |
+
function RemoveParameterFromUrl(url, parameter) {
|
317 |
+
return url
|
318 |
+
.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1')
|
319 |
+
.replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
|
320 |
+
}
|
321 |
+
});
|
assets/js/yith-wcan-frontend.min.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
jQuery(function(b){function
|
2 |
-
e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<a.length?k&&l.push(a.charAt(++c)):"["===e&&""===g?k=!0:" "===e||"+"===e?(d.sel=d.sel.join(""),f.push(d),"+"===e&&f.push({sel:"+",val:""}),d={sel:[],val:[]}):" "!==e&&"]"!==e&&d.sel.push(e)}if(0!=d.sel.length||0!=d.val.length)d.sel=d.sel.join(""),f.push(d);for(c=0;c<f.length;c++){d=f[c].sel;if("+"===d)n.tag=d;else{var n=[];n.tag=
|
3 |
-
b.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(a=0;a<f[c].val.length;a++)g=f[c].val[a].indexOf("="),k=f[c].val[a].substr(0,g),g=f[c].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(
|
4 |
k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].tag);a[c].id&&e.push("id='"+a[c].id+"'");a[c].className&&(e.push("class='"+a[c].className),c+1===a.length&&e.push(lastClass),e.push("'"));if(a[c].vars)for(var q=0;q<a[c].vars.length;q++)e.push(a[c].vars[q][0]+"='"+a[c].vars[q][1]+"'");a[c].text&&e.push("value='"+a[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.firstChild))}else{e=document.createElement(a[c].tag);
|
5 |
-
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},
|
6 |
-
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,
|
7 |
-
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=
|
8 |
-
b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));
|
9 |
-
(0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=
|
10 |
-
a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var
|
11 |
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
|
12 |
-
"1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");
|
13 |
-
|
1 |
+
jQuery(function(b){function u(b,p){return b.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var x=/(?!(\[))(\.)[^.#[]*/g,y=/(#)[^.#[]*/,z=/^[\w]+/,A=/^[\w]+$/,v=function(h,p){var a=[];if(A.test(h))a=[{tag:h}];else{for(var a=h,d={sel:[],val:[]},f=[],k=!1,g="",l=[],c=0,m=a.length;c<m;c++){var e=a.charAt(c);if(k)if("\\"===e&&c+1<a.length)l.push(a.charAt(++c));else if(g===e)g="",l.push(e);else if(("'"===e||'"'===e)&&""===g)g=e,l.push(e);else if("]"===
|
2 |
+
e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<a.length?k&&l.push(a.charAt(++c)):"["===e&&""===g?k=!0:" "===e||"+"===e?(d.sel=d.sel.join(""),f.push(d),"+"===e&&f.push({sel:"+",val:""}),d={sel:[],val:[]}):" "!==e&&"]"!==e&&d.sel.push(e)}if(0!=d.sel.length||0!=d.val.length)d.sel=d.sel.join(""),f.push(d);for(c=0;c<f.length;c++){d=f[c].sel;if("+"===d)n.tag=d;else{var n=[];n.tag=z.exec(d);n.id=y.exec(d);n.id&&
|
3 |
+
b.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(a=0;a<f[c].val.length;a++)g=f[c].val[a].indexOf("="),k=f[c].val[a].substr(0,g),g=f[c].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(x);k=[];if(d){for(a=0;a<d.length;a++)k.push(d[a].substr(1));n.className=k.join(" ")}}f[c]=n}a=f}n=[];"undefined"===typeof p&&(p=1);d=[];f=[];k=[];g=document.createElement("div");for(c=l=0;c<a.length;c++){if("+"==a[c].tag)f=
|
4 |
k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].tag);a[c].id&&e.push("id='"+a[c].id+"'");a[c].className&&(e.push("class='"+a[c].className),c+1===a.length&&e.push(lastClass),e.push("'"));if(a[c].vars)for(var q=0;q<a[c].vars.length;q++)e.push(a[c].vars[q][0]+"='"+a[c].vars[q][1]+"'");a[c].text&&e.push("value='"+a[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.firstChild))}else{e=document.createElement(a[c].tag);
|
5 |
+
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},w=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
|
6 |
+
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,v(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1;b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
|
7 |
+
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=u(a,"min_price"),a=u(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
|
8 |
+
b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1,console.log("here"));r=b.ajax({url:a,success:function(c){r=!1;b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));
|
9 |
+
0<b(c).find(yith_wcan.pagination).length?(0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=
|
10 |
+
b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var t=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
|
11 |
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
|
12 |
+
"1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
|
13 |
+
t);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||t()})});
|
includes/class.yith-wcan-admin.php
CHANGED
@@ -1,275 +1,275 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
15 |
-
/**
|
16 |
-
* Admin class.
|
17 |
-
* The class manage all the admin behaviors.
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
*/
|
21 |
-
class YITH_WCAN_Admin {
|
22 |
-
/**
|
23 |
-
* Plugin version
|
24 |
-
*
|
25 |
-
* @var string
|
26 |
-
* @since 1.0.0
|
27 |
-
*/
|
28 |
-
public $version;
|
29 |
-
|
30 |
-
/* @var YIT_Plugin_Panel_WooCommerce */
|
31 |
-
protected $_panel;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @var string Main Panel Option
|
35 |
-
*/
|
36 |
-
protected $_main_panel_option;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var string The panel page
|
40 |
-
*/
|
41 |
-
protected $_panel_page = 'yith_wcan_panel';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var string Official plugin documentation
|
45 |
-
*/
|
46 |
-
protected $_official_documentation = 'https://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var string Official plugin landing page
|
50 |
-
*/
|
51 |
-
protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-product-filter';
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var string Official plugin landing page
|
55 |
-
*/
|
56 |
-
protected $_premium_live = 'http://plugins.yithemes.com/yith-woocommerce-ajax-product-filter/shop/';
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Constructor
|
60 |
-
*
|
61 |
-
* @access public
|
62 |
-
* @since 1.0.0
|
63 |
-
*/
|
64 |
-
public function __construct( $version ) {
|
65 |
-
$this->version = $version;
|
66 |
-
|
67 |
-
//Actions
|
68 |
-
add_action( 'init', array( $this, 'init' ) );
|
69 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
70 |
-
|
71 |
-
/* Plugin Option Panel */
|
72 |
-
add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
|
73 |
-
add_action( 'yit_panel_wcan_description', array( $this, 'frontend_description_option' ), 10, 3 );
|
74 |
-
add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
|
75 |
-
add_action( 'yith_wcan_custom_style_tab', array( $this, 'custom_style_tab' ) );
|
76 |
-
|
77 |
-
/* Plugin Informations */
|
78 |
-
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
|
79 |
-
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
|
80 |
-
|
81 |
-
// YITH WCAN Loaded
|
82 |
-
do_action( 'yith_wcan_loaded' );
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Init method:
|
88 |
-
* - default options
|
89 |
-
*
|
90 |
-
* @access public
|
91 |
-
* @since 1.0.0
|
92 |
-
*/
|
93 |
-
public function init() {
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Enqueue admin styles and scripts
|
99 |
-
*
|
100 |
-
* @access public
|
101 |
-
* @return void
|
102 |
-
* @since 1.0.0
|
103 |
-
*/
|
104 |
-
public function enqueue_styles_scripts() {
|
105 |
-
global $pagenow;
|
106 |
-
|
107 |
-
if ( 'widgets.php' == $pagenow || 'admin.php' == $pagenow ) {
|
108 |
-
wp_enqueue_style( 'wp-color-picker' );
|
109 |
-
wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', array( 'yit-plugin-style' ), $this->version );
|
110 |
-
|
111 |
-
wp_enqueue_script( 'wp-color-picker' );
|
112 |
-
wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
113 |
-
}
|
114 |
-
|
115 |
-
if( 'admin.php' == $pagenow && isset( $_GET['page'] ) && 'yith_wcan_panel' == $_GET['page'] && isset( $_GET['tab'] ) && 'custom-style' == $_GET['tab'] ){
|
116 |
-
wp_enqueue_style( 'codemirror-style', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.css', array( 'yit-plugin-style' ) );
|
117 |
-
wp_enqueue_script( 'codemirror-script', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.js', array( 'jquery' ), false, true );
|
118 |
-
wp_enqueue_script( 'codemirror-script-css', YITH_WCAN_URL . 'assets/3rd-party/codemirror/mode/css/css.js', array( 'codemirror-script' ), false, true );
|
119 |
-
wp_enqueue_script( 'yith-wcan-codemirror-init', YITH_WCAN_URL . 'assets/js/yith-wcan-editor.js', array( 'jquery' ), $this->version, true );
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Add a panel under YITH Plugins tab
|
125 |
-
*
|
126 |
-
* @return void
|
127 |
-
* @since 1.0
|
128 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
129 |
-
* @use /Yit_Plugin_Panel class
|
130 |
-
* @see plugin-fw/lib/yit-plugin-panel.php
|
131 |
-
*/
|
132 |
-
public function register_panel() {
|
133 |
-
|
134 |
-
if ( ! empty( $this->_panel ) ) {
|
135 |
-
return;
|
136 |
-
}
|
137 |
-
|
138 |
-
$admin_tabs = array(
|
139 |
-
'frontend' => __( 'Front end', 'yith-woocommerce-ajax-navigation' ),
|
140 |
-
'custom-style' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
|
141 |
-
'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-navigation' )
|
142 |
-
);
|
143 |
-
|
144 |
-
$args = array(
|
145 |
-
'create_menu_page' => true,
|
146 |
-
'parent_slug' => '',
|
147 |
-
'page_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
|
148 |
-
'menu_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
|
149 |
-
'capability' => 'manage_options',
|
150 |
-
'parent' => 'wcan',
|
151 |
-
'parent_page' => 'yit_plugin_panel',
|
152 |
-
'page' => $this->_panel_page,
|
153 |
-
'admin-tabs' => apply_filters( 'yith_wcan_settings_tabs', $admin_tabs ),
|
154 |
-
'options-path' => YITH_WCAN_DIR . '/settings',
|
155 |
-
'plugin-url' => YITH_WCAN_URL
|
156 |
-
);
|
157 |
-
|
158 |
-
/* === Fixed: not updated theme === */
|
159 |
-
if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
160 |
-
require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
|
161 |
-
}
|
162 |
-
|
163 |
-
$this->_panel = new YIT_Plugin_Panel( $args );
|
164 |
-
$this->_main_panel_option = "yit_{$args['parent']}_options";
|
165 |
-
|
166 |
-
$this->save_default_options();
|
167 |
-
|
168 |
-
do_action( 'yith_wcan_after_option_panel', $args );
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Add default option to panel
|
173 |
-
*
|
174 |
-
* @return void
|
175 |
-
* @since 1.0
|
176 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
177 |
-
* @use /Yit_Plugin_Panel class
|
178 |
-
* @see plugin-fw/lib/yit-plugin-panel.php
|
179 |
-
*/
|
180 |
-
public function save_default_options(){
|
181 |
-
$options = get_option( $this->_main_panel_option );
|
182 |
-
if( $options === false ){
|
183 |
-
add_option( $this->_main_panel_option, $this->_panel->get_default_options());
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Premium Tab
|
190 |
-
*/
|
191 |
-
public function premium_tab() {
|
192 |
-
require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Action Links
|
197 |
-
*
|
198 |
-
* add the action links to plugin admin page
|
199 |
-
*
|
200 |
-
* @param $links | links plugin array
|
201 |
-
*
|
202 |
-
* @return mixed Array
|
203 |
-
* @since 1.0
|
204 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
205 |
-
* @return mixed
|
206 |
-
* @use plugin_action_links_{$plugin_file_name}
|
207 |
-
*/
|
208 |
-
public function action_links( $links ) {
|
209 |
-
$premium_live_text = defined( 'YITH_WCAN_FREE_INIT' ) ? __( 'Premium live demo', 'yith-woocommerce-ajax-navigation' ) : __( 'Live demo', 'yith-woocommerce-ajax-navigation' );
|
210 |
-
$links[] = '<a href="' . $this->_premium_live . '" target="_blank">' . $premium_live_text . '</a>';
|
211 |
-
|
212 |
-
if ( defined( 'YITH_WCAN_FREE_INIT' ) ) {
|
213 |
-
$links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-ajax-navigation' ) . '</a>';
|
214 |
-
}
|
215 |
-
|
216 |
-
return $links;
|
217 |
-
}
|
218 |
-
|
219 |
-
/**
|
220 |
-
* plugin_row_meta
|
221 |
-
*
|
222 |
-
* add the action links to plugin admin page
|
223 |
-
*
|
224 |
-
* @param $plugin_meta
|
225 |
-
* @param $plugin_file
|
226 |
-
* @param $plugin_data
|
227 |
-
* @param $status
|
228 |
-
*
|
229 |
-
* @return Array
|
230 |
-
* @since 1.0
|
231 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
232 |
-
* @use plugin_row_meta
|
233 |
-
*/
|
234 |
-
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
235 |
-
|
236 |
-
if ( ( defined( 'YITH_WCAN_INIT' ) && YITH_WCAN_INIT == $plugin_file ) || ( defined( 'YITH_WCAN_FREE_INIT' ) && YITH_WCAN_FREE_INIT == $plugin_file ) ) {
|
237 |
-
$plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-ajax-navigation' ) . '</a>';
|
238 |
-
}
|
239 |
-
return $plugin_meta;
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Get the premium landing uri
|
244 |
-
*
|
245 |
-
* @since 1.0.0
|
246 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
247 |
-
* @return string The premium landing link
|
248 |
-
*/
|
249 |
-
public function get_premium_landing_uri() {
|
250 |
-
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Add the frontend tab description
|
255 |
-
*
|
256 |
-
* @param $option
|
257 |
-
* @param $db_value
|
258 |
-
* @param $custom_attributes
|
259 |
-
*
|
260 |
-
* @return string The description text
|
261 |
-
* @since 2.0.0
|
262 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
263 |
-
*/
|
264 |
-
public function frontend_description_option( $option, $db_value, $custom_attributes ){
|
265 |
-
echo "<p>{$option['desc']}</p>";
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Custom Style tab
|
270 |
-
*/
|
271 |
-
public function custom_style_tab(){
|
272 |
-
require_once( YITH_WCAN_DIR . 'templates/admin/editor.php' );
|
273 |
-
}
|
274 |
-
}
|
275 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
15 |
+
/**
|
16 |
+
* Admin class.
|
17 |
+
* The class manage all the admin behaviors.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class YITH_WCAN_Admin {
|
22 |
+
/**
|
23 |
+
* Plugin version
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
* @since 1.0.0
|
27 |
+
*/
|
28 |
+
public $version;
|
29 |
+
|
30 |
+
/* @var YIT_Plugin_Panel_WooCommerce */
|
31 |
+
protected $_panel;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string Main Panel Option
|
35 |
+
*/
|
36 |
+
protected $_main_panel_option;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var string The panel page
|
40 |
+
*/
|
41 |
+
protected $_panel_page = 'yith_wcan_panel';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string Official plugin documentation
|
45 |
+
*/
|
46 |
+
protected $_official_documentation = 'https://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var string Official plugin landing page
|
50 |
+
*/
|
51 |
+
protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-product-filter';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var string Official plugin landing page
|
55 |
+
*/
|
56 |
+
protected $_premium_live = 'http://plugins.yithemes.com/yith-woocommerce-ajax-product-filter/shop/';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Constructor
|
60 |
+
*
|
61 |
+
* @access public
|
62 |
+
* @since 1.0.0
|
63 |
+
*/
|
64 |
+
public function __construct( $version ) {
|
65 |
+
$this->version = $version;
|
66 |
+
|
67 |
+
//Actions
|
68 |
+
add_action( 'init', array( $this, 'init' ) );
|
69 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
70 |
+
|
71 |
+
/* Plugin Option Panel */
|
72 |
+
add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
|
73 |
+
add_action( 'yit_panel_wcan_description', array( $this, 'frontend_description_option' ), 10, 3 );
|
74 |
+
add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
|
75 |
+
add_action( 'yith_wcan_custom_style_tab', array( $this, 'custom_style_tab' ) );
|
76 |
+
|
77 |
+
/* Plugin Informations */
|
78 |
+
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
|
79 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
|
80 |
+
|
81 |
+
// YITH WCAN Loaded
|
82 |
+
do_action( 'yith_wcan_loaded' );
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Init method:
|
88 |
+
* - default options
|
89 |
+
*
|
90 |
+
* @access public
|
91 |
+
* @since 1.0.0
|
92 |
+
*/
|
93 |
+
public function init() {
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Enqueue admin styles and scripts
|
99 |
+
*
|
100 |
+
* @access public
|
101 |
+
* @return void
|
102 |
+
* @since 1.0.0
|
103 |
+
*/
|
104 |
+
public function enqueue_styles_scripts() {
|
105 |
+
global $pagenow;
|
106 |
+
|
107 |
+
if ( 'widgets.php' == $pagenow || 'admin.php' == $pagenow ) {
|
108 |
+
wp_enqueue_style( 'wp-color-picker' );
|
109 |
+
wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', array( 'yit-plugin-style' ), $this->version );
|
110 |
+
|
111 |
+
wp_enqueue_script( 'wp-color-picker' );
|
112 |
+
wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
113 |
+
}
|
114 |
+
|
115 |
+
if( 'admin.php' == $pagenow && isset( $_GET['page'] ) && 'yith_wcan_panel' == $_GET['page'] && isset( $_GET['tab'] ) && 'custom-style' == $_GET['tab'] ){
|
116 |
+
wp_enqueue_style( 'codemirror-style', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.css', array( 'yit-plugin-style' ) );
|
117 |
+
wp_enqueue_script( 'codemirror-script', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.js', array( 'jquery' ), false, true );
|
118 |
+
wp_enqueue_script( 'codemirror-script-css', YITH_WCAN_URL . 'assets/3rd-party/codemirror/mode/css/css.js', array( 'codemirror-script' ), false, true );
|
119 |
+
wp_enqueue_script( 'yith-wcan-codemirror-init', YITH_WCAN_URL . 'assets/js/yith-wcan-editor.js', array( 'jquery' ), $this->version, true );
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Add a panel under YITH Plugins tab
|
125 |
+
*
|
126 |
+
* @return void
|
127 |
+
* @since 1.0
|
128 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
129 |
+
* @use /Yit_Plugin_Panel class
|
130 |
+
* @see plugin-fw/lib/yit-plugin-panel.php
|
131 |
+
*/
|
132 |
+
public function register_panel() {
|
133 |
+
|
134 |
+
if ( ! empty( $this->_panel ) ) {
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
$admin_tabs = array(
|
139 |
+
'frontend' => __( 'Front end', 'yith-woocommerce-ajax-navigation' ),
|
140 |
+
'custom-style' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
|
141 |
+
'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-navigation' )
|
142 |
+
);
|
143 |
+
|
144 |
+
$args = array(
|
145 |
+
'create_menu_page' => true,
|
146 |
+
'parent_slug' => '',
|
147 |
+
'page_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
|
148 |
+
'menu_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
|
149 |
+
'capability' => 'manage_options',
|
150 |
+
'parent' => 'wcan',
|
151 |
+
'parent_page' => 'yit_plugin_panel',
|
152 |
+
'page' => $this->_panel_page,
|
153 |
+
'admin-tabs' => apply_filters( 'yith_wcan_settings_tabs', $admin_tabs ),
|
154 |
+
'options-path' => YITH_WCAN_DIR . '/settings',
|
155 |
+
'plugin-url' => YITH_WCAN_URL
|
156 |
+
);
|
157 |
+
|
158 |
+
/* === Fixed: not updated theme === */
|
159 |
+
if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
160 |
+
require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
|
161 |
+
}
|
162 |
+
|
163 |
+
$this->_panel = new YIT_Plugin_Panel( $args );
|
164 |
+
$this->_main_panel_option = "yit_{$args['parent']}_options";
|
165 |
+
|
166 |
+
$this->save_default_options();
|
167 |
+
|
168 |
+
do_action( 'yith_wcan_after_option_panel', $args );
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Add default option to panel
|
173 |
+
*
|
174 |
+
* @return void
|
175 |
+
* @since 1.0
|
176 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
177 |
+
* @use /Yit_Plugin_Panel class
|
178 |
+
* @see plugin-fw/lib/yit-plugin-panel.php
|
179 |
+
*/
|
180 |
+
public function save_default_options(){
|
181 |
+
$options = get_option( $this->_main_panel_option );
|
182 |
+
if( $options === false ){
|
183 |
+
add_option( $this->_main_panel_option, $this->_panel->get_default_options());
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Premium Tab
|
190 |
+
*/
|
191 |
+
public function premium_tab() {
|
192 |
+
require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Action Links
|
197 |
+
*
|
198 |
+
* add the action links to plugin admin page
|
199 |
+
*
|
200 |
+
* @param $links | links plugin array
|
201 |
+
*
|
202 |
+
* @return mixed Array
|
203 |
+
* @since 1.0
|
204 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
205 |
+
* @return mixed
|
206 |
+
* @use plugin_action_links_{$plugin_file_name}
|
207 |
+
*/
|
208 |
+
public function action_links( $links ) {
|
209 |
+
$premium_live_text = defined( 'YITH_WCAN_FREE_INIT' ) ? __( 'Premium live demo', 'yith-woocommerce-ajax-navigation' ) : __( 'Live demo', 'yith-woocommerce-ajax-navigation' );
|
210 |
+
$links[] = '<a href="' . $this->_premium_live . '" target="_blank">' . $premium_live_text . '</a>';
|
211 |
+
|
212 |
+
if ( defined( 'YITH_WCAN_FREE_INIT' ) ) {
|
213 |
+
$links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-ajax-navigation' ) . '</a>';
|
214 |
+
}
|
215 |
+
|
216 |
+
return $links;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* plugin_row_meta
|
221 |
+
*
|
222 |
+
* add the action links to plugin admin page
|
223 |
+
*
|
224 |
+
* @param $plugin_meta
|
225 |
+
* @param $plugin_file
|
226 |
+
* @param $plugin_data
|
227 |
+
* @param $status
|
228 |
+
*
|
229 |
+
* @return Array
|
230 |
+
* @since 1.0
|
231 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
232 |
+
* @use plugin_row_meta
|
233 |
+
*/
|
234 |
+
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
235 |
+
|
236 |
+
if ( ( defined( 'YITH_WCAN_INIT' ) && YITH_WCAN_INIT == $plugin_file ) || ( defined( 'YITH_WCAN_FREE_INIT' ) && YITH_WCAN_FREE_INIT == $plugin_file ) ) {
|
237 |
+
$plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-ajax-navigation' ) . '</a>';
|
238 |
+
}
|
239 |
+
return $plugin_meta;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Get the premium landing uri
|
244 |
+
*
|
245 |
+
* @since 1.0.0
|
246 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
247 |
+
* @return string The premium landing link
|
248 |
+
*/
|
249 |
+
public function get_premium_landing_uri() {
|
250 |
+
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Add the frontend tab description
|
255 |
+
*
|
256 |
+
* @param $option
|
257 |
+
* @param $db_value
|
258 |
+
* @param $custom_attributes
|
259 |
+
*
|
260 |
+
* @return string The description text
|
261 |
+
* @since 2.0.0
|
262 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
263 |
+
*/
|
264 |
+
public function frontend_description_option( $option, $db_value, $custom_attributes ){
|
265 |
+
echo "<p>{$option['desc']}</p>";
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Custom Style tab
|
270 |
+
*/
|
271 |
+
public function custom_style_tab(){
|
272 |
+
require_once( YITH_WCAN_DIR . 'templates/admin/editor.php' );
|
273 |
+
}
|
274 |
+
}
|
275 |
+
}
|
includes/class.yith-wcan-frontend.php
CHANGED
@@ -1,138 +1,138 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Frontend class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
|
15 |
-
/**
|
16 |
-
* Frontend class.
|
17 |
-
* The class manage all the frontend behaviors.
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
*/
|
21 |
-
class YITH_WCAN_Frontend {
|
22 |
-
/**
|
23 |
-
* Plugin version
|
24 |
-
*
|
25 |
-
* @var string
|
26 |
-
* @since 1.0.0
|
27 |
-
*/
|
28 |
-
public $version;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Constructor
|
32 |
-
*
|
33 |
-
* @access public
|
34 |
-
* @since 1.0.0
|
35 |
-
*/
|
36 |
-
public function __construct( $version ) {
|
37 |
-
$this->version = $version;
|
38 |
-
|
39 |
-
//Actions
|
40 |
-
add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
|
41 |
-
|
42 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
43 |
-
|
44 |
-
// YITH WCAN Loaded
|
45 |
-
do_action( 'yith_wcan_loaded' );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Enqueue frontend styles and scripts
|
50 |
-
*
|
51 |
-
* @access public
|
52 |
-
* @return void
|
53 |
-
* @since 1.0.0
|
54 |
-
*/
|
55 |
-
public function enqueue_styles_scripts() {
|
56 |
-
if ( yith_wcan_can_be_displayed() ) {
|
57 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
58 |
-
|
59 |
-
wp_enqueue_style( 'yith-wcan-frontend', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
|
60 |
-
wp_enqueue_script( 'yith-wcan-script', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix . '.js', array( 'jquery' ), $this->version, true );
|
61 |
-
|
62 |
-
$custom_style = yith_wcan_get_option( 'yith_wcan_custom_style', '' );
|
63 |
-
|
64 |
-
! empty( $custom_style ) && wp_add_inline_style( 'yith-wcan-frontend', sanitize_text_field( $custom_style ) );
|
65 |
-
|
66 |
-
$args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
|
67 |
-
'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
|
68 |
-
'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
|
69 |
-
'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
|
70 |
-
)
|
71 |
-
);
|
72 |
-
|
73 |
-
wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Layered Nav Init
|
80 |
-
*
|
81 |
-
* @package WooCommerce/Widgets
|
82 |
-
* @access public
|
83 |
-
* @return void
|
84 |
-
*/
|
85 |
-
public function woocommerce_layered_nav_init() {
|
86 |
-
|
87 |
-
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
|
88 |
-
|
89 |
-
global $_chosen_attributes, $woocommerce;
|
90 |
-
|
91 |
-
$_chosen_attributes = array();
|
92 |
-
|
93 |
-
/* FIX TO WOOCOMMERCE 2.1 */
|
94 |
-
$attibute_taxonomies = function_exists( 'wc_get_attribute_taxonomies' ) ? $attribute_taxonomies = wc_get_attribute_taxonomies() : $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
95 |
-
|
96 |
-
if ( $attribute_taxonomies ) {
|
97 |
-
foreach ( $attribute_taxonomies as $tax ) {
|
98 |
-
|
99 |
-
$attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
|
100 |
-
|
101 |
-
/* FIX TO WOOCOMMERCE 2.1 */
|
102 |
-
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
103 |
-
$taxonomy = wc_attribute_taxonomy_name( $attribute );
|
104 |
-
}
|
105 |
-
else {
|
106 |
-
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
|
107 |
-
}
|
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 |
-
if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
|
126 |
-
add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
|
127 |
-
}
|
128 |
-
else {
|
129 |
-
add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
|
137 |
-
}
|
138 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
|
15 |
+
/**
|
16 |
+
* Frontend class.
|
17 |
+
* The class manage all the frontend behaviors.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class YITH_WCAN_Frontend {
|
22 |
+
/**
|
23 |
+
* Plugin version
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
* @since 1.0.0
|
27 |
+
*/
|
28 |
+
public $version;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constructor
|
32 |
+
*
|
33 |
+
* @access public
|
34 |
+
* @since 1.0.0
|
35 |
+
*/
|
36 |
+
public function __construct( $version ) {
|
37 |
+
$this->version = $version;
|
38 |
+
|
39 |
+
//Actions
|
40 |
+
add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
|
41 |
+
|
42 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
43 |
+
|
44 |
+
// YITH WCAN Loaded
|
45 |
+
do_action( 'yith_wcan_loaded' );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Enqueue frontend styles and scripts
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @return void
|
53 |
+
* @since 1.0.0
|
54 |
+
*/
|
55 |
+
public function enqueue_styles_scripts() {
|
56 |
+
if ( yith_wcan_can_be_displayed() ) {
|
57 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
58 |
+
|
59 |
+
wp_enqueue_style( 'yith-wcan-frontend', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
|
60 |
+
wp_enqueue_script( 'yith-wcan-script', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix . '.js', array( 'jquery' ), $this->version, true );
|
61 |
+
|
62 |
+
$custom_style = yith_wcan_get_option( 'yith_wcan_custom_style', '' );
|
63 |
+
|
64 |
+
! empty( $custom_style ) && wp_add_inline_style( 'yith-wcan-frontend', sanitize_text_field( $custom_style ) );
|
65 |
+
|
66 |
+
$args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
|
67 |
+
'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
|
68 |
+
'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
|
69 |
+
'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Layered Nav Init
|
80 |
+
*
|
81 |
+
* @package WooCommerce/Widgets
|
82 |
+
* @access public
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function woocommerce_layered_nav_init() {
|
86 |
+
|
87 |
+
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
|
88 |
+
|
89 |
+
global $_chosen_attributes, $woocommerce;
|
90 |
+
|
91 |
+
$_chosen_attributes = array();
|
92 |
+
|
93 |
+
/* FIX TO WOOCOMMERCE 2.1 */
|
94 |
+
$attibute_taxonomies = function_exists( 'wc_get_attribute_taxonomies' ) ? $attribute_taxonomies = wc_get_attribute_taxonomies() : $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
95 |
+
|
96 |
+
if ( $attribute_taxonomies ) {
|
97 |
+
foreach ( $attribute_taxonomies as $tax ) {
|
98 |
+
|
99 |
+
$attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
|
100 |
+
|
101 |
+
/* FIX TO WOOCOMMERCE 2.1 */
|
102 |
+
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
103 |
+
$taxonomy = wc_attribute_taxonomy_name( $attribute );
|
104 |
+
}
|
105 |
+
else {
|
106 |
+
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
|
107 |
+
}
|
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 |
+
if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
|
126 |
+
add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
|
127 |
+
}
|
128 |
+
else {
|
129 |
+
add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
includes/class.yith-wcan-helper.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN_Helper' ) ) {
|
15 |
-
/**
|
16 |
-
* YITH WooCommerce Ajax Navigation Helper
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
*/
|
20 |
-
class YITH_WCAN_Helper {
|
21 |
-
|
22 |
-
/*
|
23 |
-
* Get Woocommerce Attribute Taxonomies
|
24 |
-
*
|
25 |
-
* @since 1.0.0
|
26 |
-
* @access public
|
27 |
-
*/
|
28 |
-
public static function attribute_taxonomies() {
|
29 |
-
global $woocommerce;
|
30 |
-
|
31 |
-
if ( ! isset( $woocommerce ) ) {
|
32 |
-
return array();
|
33 |
-
}
|
34 |
-
|
35 |
-
$attributes = array();
|
36 |
-
if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
|
37 |
-
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
38 |
-
}
|
39 |
-
else {
|
40 |
-
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
41 |
-
}
|
42 |
-
|
43 |
-
if ( empty( $attribute_taxonomies ) ) {
|
44 |
-
return array();
|
45 |
-
}
|
46 |
-
foreach ( $attribute_taxonomies as $attribute ) {
|
47 |
-
|
48 |
-
/* FIX TO WOOCOMMERCE 2.1 */
|
49 |
-
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
50 |
-
$taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
|
51 |
-
}
|
52 |
-
else {
|
53 |
-
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
if ( taxonomy_exists( $taxonomy ) ) {
|
58 |
-
$attributes[] = $attribute->attribute_name;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
return $attributes;
|
63 |
-
}
|
64 |
-
|
65 |
-
}
|
66 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN_Helper' ) ) {
|
15 |
+
/**
|
16 |
+
* YITH WooCommerce Ajax Navigation Helper
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
class YITH_WCAN_Helper {
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Get Woocommerce Attribute Taxonomies
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
* @access public
|
27 |
+
*/
|
28 |
+
public static function attribute_taxonomies() {
|
29 |
+
global $woocommerce;
|
30 |
+
|
31 |
+
if ( ! isset( $woocommerce ) ) {
|
32 |
+
return array();
|
33 |
+
}
|
34 |
+
|
35 |
+
$attributes = array();
|
36 |
+
if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
|
37 |
+
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
38 |
+
}
|
39 |
+
else {
|
40 |
+
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( empty( $attribute_taxonomies ) ) {
|
44 |
+
return array();
|
45 |
+
}
|
46 |
+
foreach ( $attribute_taxonomies as $attribute ) {
|
47 |
+
|
48 |
+
/* FIX TO WOOCOMMERCE 2.1 */
|
49 |
+
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
50 |
+
$taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
|
51 |
+
}
|
52 |
+
else {
|
53 |
+
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
if ( taxonomy_exists( $taxonomy ) ) {
|
58 |
+
$attributes[] = $attribute->attribute_name;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
return $attributes;
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
}
|
includes/class.yith-wcan.php
CHANGED
@@ -1,174 +1,174 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN' ) ) {
|
15 |
-
/**
|
16 |
-
* YITH WooCommerce Ajax Navigation
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
*/
|
20 |
-
class YITH_WCAN {
|
21 |
-
/**
|
22 |
-
* Plugin version
|
23 |
-
*
|
24 |
-
* @var string
|
25 |
-
* @since 1.0.0
|
26 |
-
*/
|
27 |
-
public $version;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Frontend object
|
31 |
-
*
|
32 |
-
* @var string
|
33 |
-
* @since 1.0.0
|
34 |
-
*/
|
35 |
-
public $frontend = null;
|
36 |
-
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Admin object
|
40 |
-
*
|
41 |
-
* @var string
|
42 |
-
* @since 1.0.0
|
43 |
-
*/
|
44 |
-
public $admin = null;
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Main instance
|
49 |
-
*
|
50 |
-
* @var string
|
51 |
-
* @since 1.4.0
|
52 |
-
*/
|
53 |
-
protected static $_instance = null;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Constructor
|
57 |
-
*
|
58 |
-
* @return mixed|YITH_WCAN_Admin|YITH_WCAN_Frontend
|
59 |
-
* @since 1.0.0
|
60 |
-
*/
|
61 |
-
public function __construct() {
|
62 |
-
|
63 |
-
$this->version = YITH_WCAN_VERSION;
|
64 |
-
|
65 |
-
/* Load Plugin Framework */
|
66 |
-
add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ) );
|
67 |
-
|
68 |
-
/* Register Widget */
|
69 |
-
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
70 |
-
|
71 |
-
$this->required();
|
72 |
-
|
73 |
-
$this->init();
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Load and register widgets
|
78 |
-
*
|
79 |
-
* @access public
|
80 |
-
* @since 1.0.0
|
81 |
-
*/
|
82 |
-
public function registerWidgets() {
|
83 |
-
$widgets = apply_filters( 'yith_wcan_widgets', array(
|
84 |
-
'YITH_WCAN_Navigation_Widget',
|
85 |
-
'YITH_WCAN_Reset_Navigation_Widget',
|
86 |
-
)
|
87 |
-
);
|
88 |
-
|
89 |
-
foreach( $widgets as $widget ){
|
90 |
-
register_widget( $widget );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Load plugin framework
|
96 |
-
*
|
97 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
98 |
-
* @since 1.0
|
99 |
-
* @return void
|
100 |
-
*/
|
101 |
-
public function plugin_fw_loader() {
|
102 |
-
if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
|
103 |
-
global $plugin_fw_data;
|
104 |
-
if( ! empty( $plugin_fw_data ) ){
|
105 |
-
$plugin_fw_file = array_shift( $plugin_fw_data );
|
106 |
-
require_once( $plugin_fw_file );
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Main plugin Instance
|
113 |
-
*
|
114 |
-
* @return YITH_Vendors Main instance
|
115 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
116 |
-
*/
|
117 |
-
public static function instance() {
|
118 |
-
|
119 |
-
if( class_exists( 'YITH_WCAN_Premium' ) ){
|
120 |
-
//Premium Class
|
121 |
-
if( is_null( YITH_WCAN_Premium::$_instance ) ){
|
122 |
-
YITH_WCAN_Premium::$_instance = new YITH_WCAN_Premium();
|
123 |
-
}
|
124 |
-
|
125 |
-
return YITH_WCAN_Premium::$_instance;
|
126 |
-
}
|
127 |
-
|
128 |
-
// Base Class
|
129 |
-
else {
|
130 |
-
//Premium Class
|
131 |
-
if( is_null( YITH_WCAN::$_instance ) ){
|
132 |
-
YITH_WCAN::$_instance = new YITH_WCAN();
|
133 |
-
}
|
134 |
-
|
135 |
-
return YITH_WCAN::$_instance;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Load required files
|
143 |
-
*
|
144 |
-
* @since 1.4
|
145 |
-
* @return void
|
146 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
147 |
-
*/
|
148 |
-
public function required(){
|
149 |
-
$required = apply_filters( 'yith_wcan_required_files', array(
|
150 |
-
'includes/functions.yith-wcan.php',
|
151 |
-
'includes/class.yith-wcan-admin.php',
|
152 |
-
'includes/class.yith-wcan-frontend.php',
|
153 |
-
'includes/class.yith-wcan-helper.php',
|
154 |
-
'widgets/class.yith-wcan-navigation-widget.php',
|
155 |
-
'widgets/class.yith-wcan-reset-navigation-widget.php',
|
156 |
-
)
|
157 |
-
);
|
158 |
-
|
159 |
-
foreach( $required as $file ){
|
160 |
-
file_exists( YITH_WCAN_DIR . $file ) && require_once( YITH_WCAN_DIR . $file );
|
161 |
-
}
|
162 |
-
}
|
163 |
-
|
164 |
-
public function init() {
|
165 |
-
if ( is_admin() ) {
|
166 |
-
$this->admin = new YITH_WCAN_Admin( $this->version );
|
167 |
-
}
|
168 |
-
else {
|
169 |
-
$this->frontend = new YITH_WCAN_Frontend( $this->version );
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
}
|
174 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN' ) ) {
|
15 |
+
/**
|
16 |
+
* YITH WooCommerce Ajax Navigation
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
class YITH_WCAN {
|
21 |
+
/**
|
22 |
+
* Plugin version
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
* @since 1.0.0
|
26 |
+
*/
|
27 |
+
public $version;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Frontend object
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
* @since 1.0.0
|
34 |
+
*/
|
35 |
+
public $frontend = null;
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Admin object
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public $admin = null;
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Main instance
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
* @since 1.4.0
|
52 |
+
*/
|
53 |
+
protected static $_instance = null;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Constructor
|
57 |
+
*
|
58 |
+
* @return mixed|YITH_WCAN_Admin|YITH_WCAN_Frontend
|
59 |
+
* @since 1.0.0
|
60 |
+
*/
|
61 |
+
public function __construct() {
|
62 |
+
|
63 |
+
$this->version = YITH_WCAN_VERSION;
|
64 |
+
|
65 |
+
/* Load Plugin Framework */
|
66 |
+
add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ) );
|
67 |
+
|
68 |
+
/* Register Widget */
|
69 |
+
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
70 |
+
|
71 |
+
$this->required();
|
72 |
+
|
73 |
+
$this->init();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Load and register widgets
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @since 1.0.0
|
81 |
+
*/
|
82 |
+
public function registerWidgets() {
|
83 |
+
$widgets = apply_filters( 'yith_wcan_widgets', array(
|
84 |
+
'YITH_WCAN_Navigation_Widget',
|
85 |
+
'YITH_WCAN_Reset_Navigation_Widget',
|
86 |
+
)
|
87 |
+
);
|
88 |
+
|
89 |
+
foreach( $widgets as $widget ){
|
90 |
+
register_widget( $widget );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Load plugin framework
|
96 |
+
*
|
97 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
98 |
+
* @since 1.0
|
99 |
+
* @return void
|
100 |
+
*/
|
101 |
+
public function plugin_fw_loader() {
|
102 |
+
if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
|
103 |
+
global $plugin_fw_data;
|
104 |
+
if( ! empty( $plugin_fw_data ) ){
|
105 |
+
$plugin_fw_file = array_shift( $plugin_fw_data );
|
106 |
+
require_once( $plugin_fw_file );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Main plugin Instance
|
113 |
+
*
|
114 |
+
* @return YITH_Vendors Main instance
|
115 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
116 |
+
*/
|
117 |
+
public static function instance() {
|
118 |
+
|
119 |
+
if( class_exists( 'YITH_WCAN_Premium' ) ){
|
120 |
+
//Premium Class
|
121 |
+
if( is_null( YITH_WCAN_Premium::$_instance ) ){
|
122 |
+
YITH_WCAN_Premium::$_instance = new YITH_WCAN_Premium();
|
123 |
+
}
|
124 |
+
|
125 |
+
return YITH_WCAN_Premium::$_instance;
|
126 |
+
}
|
127 |
+
|
128 |
+
// Base Class
|
129 |
+
else {
|
130 |
+
//Premium Class
|
131 |
+
if( is_null( YITH_WCAN::$_instance ) ){
|
132 |
+
YITH_WCAN::$_instance = new YITH_WCAN();
|
133 |
+
}
|
134 |
+
|
135 |
+
return YITH_WCAN::$_instance;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Load required files
|
143 |
+
*
|
144 |
+
* @since 1.4
|
145 |
+
* @return void
|
146 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
147 |
+
*/
|
148 |
+
public function required(){
|
149 |
+
$required = apply_filters( 'yith_wcan_required_files', array(
|
150 |
+
'includes/functions.yith-wcan.php',
|
151 |
+
'includes/class.yith-wcan-admin.php',
|
152 |
+
'includes/class.yith-wcan-frontend.php',
|
153 |
+
'includes/class.yith-wcan-helper.php',
|
154 |
+
'widgets/class.yith-wcan-navigation-widget.php',
|
155 |
+
'widgets/class.yith-wcan-reset-navigation-widget.php',
|
156 |
+
)
|
157 |
+
);
|
158 |
+
|
159 |
+
foreach( $required as $file ){
|
160 |
+
file_exists( YITH_WCAN_DIR . $file ) && require_once( YITH_WCAN_DIR . $file );
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
public function init() {
|
165 |
+
if ( is_admin() ) {
|
166 |
+
$this->admin = new YITH_WCAN_Admin( $this->version );
|
167 |
+
}
|
168 |
+
else {
|
169 |
+
$this->frontend = new YITH_WCAN_Frontend( $this->version );
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
174 |
}
|
includes/functions.yith-wcan.php
CHANGED
@@ -1,503 +1,503 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Return a dropdown with Woocommerce attributes
|
17 |
-
*/
|
18 |
-
function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
|
19 |
-
$attributes = YITH_WCAN_Helper::attribute_taxonomies();
|
20 |
-
$options = "";
|
21 |
-
|
22 |
-
foreach ( $attributes as $attribute ) {
|
23 |
-
$options .= "<option name='{$attribute}'" . selected( $attribute, $selected, false ) . ">{$attribute}</option>";
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( $echo ) {
|
27 |
-
echo $options;
|
28 |
-
}
|
29 |
-
else {
|
30 |
-
return $options;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Print the widgets options already filled
|
37 |
-
*
|
38 |
-
* @param $type string list|colors|label
|
39 |
-
* @param $attribute woocommerce taxonomy
|
40 |
-
* @param $id id used in the <input />
|
41 |
-
* @param $name base name used in the <input />
|
42 |
-
* @param $values array of values (could be empty if this is an ajax call)
|
43 |
-
*
|
44 |
-
* @return string
|
45 |
-
*/
|
46 |
-
function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = array(), $echo = true ) {
|
47 |
-
$return = '';
|
48 |
-
|
49 |
-
$terms = get_terms( 'pa_' . $attribute, array( 'hide_empty' => '0' ) );
|
50 |
-
|
51 |
-
if ( 'list' == $type ) {
|
52 |
-
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
|
53 |
-
}
|
54 |
-
|
55 |
-
elseif ( 'color' == $type ) {
|
56 |
-
if ( ! empty( $terms ) ) {
|
57 |
-
$return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), __( 'Color', 'yith-woocommerce-ajax-navigation' ) );
|
58 |
-
|
59 |
-
foreach ( $terms as $term ) {
|
60 |
-
$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>";
|
61 |
-
}
|
62 |
-
|
63 |
-
$return .= '</table>';
|
64 |
-
}
|
65 |
-
|
66 |
-
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
|
67 |
-
}
|
68 |
-
|
69 |
-
elseif ( 'multicolor' == $type ) {
|
70 |
-
if ( ! empty( $terms ) ) {
|
71 |
-
$return = sprintf( '<table class="yith-wcan-multicolor"><tr><th>%s</th><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), _x( 'Color 1', 'For multicolor: I.E. white and red T-Shirt', 'yith-woocommerce-ajax-navigation' ), _x( 'Color 2', 'For multicolor: I.E. white and red T-Shirt', 'yith-woocommerce-ajax-navigation' ) );
|
72 |
-
|
73 |
-
foreach ( $terms as $term ) {
|
74 |
-
|
75 |
-
$return .= "<tr>";
|
76 |
-
|
77 |
-
$return .= "<td><label for='{$id}{$term->term_id}'>{$term->name}</label></td>";
|
78 |
-
|
79 |
-
$return .= "<td><input type='text' id='{$id}{$term->term_id}_1' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][0] ) ? $values[$term->term_id][0] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
|
80 |
-
$return .= "<td><input type='text' id='{$id}{$term->term_id}_2' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][1] ) ? $values[$term->term_id][1] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
|
81 |
-
|
82 |
-
$return .= '</tr>';
|
83 |
-
}
|
84 |
-
|
85 |
-
$return .= '</table>';
|
86 |
-
}
|
87 |
-
|
88 |
-
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
|
89 |
-
}
|
90 |
-
|
91 |
-
elseif ( 'label' == $type ) {
|
92 |
-
if ( ! empty( $terms ) ) {
|
93 |
-
$return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), __( 'Labels', 'yith-woocommerce-ajax-navigation' ) );
|
94 |
-
|
95 |
-
foreach ( $terms as $term ) {
|
96 |
-
$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' /></td></tr>";
|
97 |
-
}
|
98 |
-
|
99 |
-
$return .= '</table>';
|
100 |
-
}
|
101 |
-
|
102 |
-
$return .= '<input type="hidden" name="' . $name . '[colors]" value="" />';
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( $echo ) {
|
106 |
-
echo $return;
|
107 |
-
}
|
108 |
-
|
109 |
-
return $return;
|
110 |
-
}
|
111 |
-
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Can the widget be displayed?
|
115 |
-
*
|
116 |
-
* @return bool
|
117 |
-
*/
|
118 |
-
function yith_wcan_can_be_displayed() {
|
119 |
-
global $woocommerce, $_attributes_array;
|
120 |
-
|
121 |
-
if (
|
122 |
-
is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) ||
|
123 |
-
is_active_widget( false, false, 'yith-woo-ajax-navigation-sort-by', true ) ||
|
124 |
-
is_active_widget( false, false, 'yith-woo-ajax-navigation-stock-on-sale', true ) ||
|
125 |
-
is_active_widget( false, false, 'yith-woo-ajax-navigation-list-price-filter', true )
|
126 |
-
) {
|
127 |
-
return true;
|
128 |
-
}
|
129 |
-
else {
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
|
135 |
-
if ( ! function_exists( 'yit_curPageURL' ) ) {
|
136 |
-
/**
|
137 |
-
* Retrieve the current complete url
|
138 |
-
*
|
139 |
-
* @since 1.0
|
140 |
-
*/
|
141 |
-
function yit_curPageURL() {
|
142 |
-
$pageURL = 'http';
|
143 |
-
if ( isset( $_SERVER["HTTPS"] ) AND $_SERVER["HTTPS"] == "on" ) {
|
144 |
-
$pageURL .= "s";
|
145 |
-
}
|
146 |
-
|
147 |
-
$pageURL .= "://";
|
148 |
-
|
149 |
-
if ( isset( $_SERVER["SERVER_PORT"] ) AND $_SERVER["SERVER_PORT"] != "80" ) {
|
150 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
151 |
-
}
|
152 |
-
else {
|
153 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
154 |
-
}
|
155 |
-
|
156 |
-
return $pageURL;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
if ( ! function_exists( 'yit_reorder_terms_by_parent' ) ) {
|
161 |
-
/**
|
162 |
-
* Sort the array of terms associating the child to the parent terms
|
163 |
-
*
|
164 |
-
* @param $terms mixed|array
|
165 |
-
*
|
166 |
-
* @return mixed!array
|
167 |
-
* @since 1.3.1
|
168 |
-
*/
|
169 |
-
function yit_reorder_terms_by_parent( $terms ) {
|
170 |
-
|
171 |
-
/* Extract Child Terms */
|
172 |
-
$child_terms = array();
|
173 |
-
$terms_count = 0;
|
174 |
-
$parent_terms = array();
|
175 |
-
|
176 |
-
foreach ( $terms as $array_key => $term ) {
|
177 |
-
|
178 |
-
if ( $term->parent != 0 ) {
|
179 |
-
|
180 |
-
if ( isset( $child_terms[$term->parent] ) && $child_terms[$term->parent] != null ) {
|
181 |
-
$child_terms[$term->parent] = array_merge( $child_terms[$term->parent], array( $term ) );
|
182 |
-
}
|
183 |
-
else {
|
184 |
-
$child_terms[$term->parent] = array( $term );
|
185 |
-
}
|
186 |
-
|
187 |
-
}
|
188 |
-
else {
|
189 |
-
$parent_terms[$terms_count] = $term;
|
190 |
-
}
|
191 |
-
$terms_count ++;
|
192 |
-
}
|
193 |
-
|
194 |
-
/* Reorder Therms */
|
195 |
-
$terms_count = 0;
|
196 |
-
$terms = array();
|
197 |
-
|
198 |
-
foreach ( $parent_terms as $term ) {
|
199 |
-
|
200 |
-
$terms[$terms_count] = $term;
|
201 |
-
|
202 |
-
/* The term as child */
|
203 |
-
if ( array_key_exists( $term->term_id, $child_terms ) ) {
|
204 |
-
|
205 |
-
foreach ( $child_terms[$term->term_id] as $child_term ) {
|
206 |
-
$terms_count ++;
|
207 |
-
$terms[$terms_count] = $child_term;
|
208 |
-
}
|
209 |
-
}
|
210 |
-
$terms_count ++;
|
211 |
-
}
|
212 |
-
|
213 |
-
return $terms;
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
if ( ! function_exists( 'yit_get_terms' ) ) {
|
218 |
-
/**
|
219 |
-
* Get the array of objects terms
|
220 |
-
*
|
221 |
-
* @param $type A type of term to display
|
222 |
-
*
|
223 |
-
* @return $terms mixed|array
|
224 |
-
*
|
225 |
-
* @since 1.3.1
|
226 |
-
*/
|
227 |
-
function yit_get_terms( $case, $taxonomy, $instance = false ) {
|
228 |
-
|
229 |
-
$exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
|
230 |
-
$include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
|
231 |
-
|
232 |
-
switch ( $case ) {
|
233 |
-
|
234 |
-
case 'all':
|
235 |
-
$terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'exclude' => $exclude ) );
|
236 |
-
break;
|
237 |
-
|
238 |
-
case 'hierarchical':
|
239 |
-
$terms = yit_reorder_terms_by_parent( get_terms( $taxonomy, array( 'hide_empty' => true, 'exclude' => $exclude ) ) );
|
240 |
-
break;
|
241 |
-
|
242 |
-
case 'parent' :
|
243 |
-
$terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'parent' => false, 'exclude' => $exclude ) );
|
244 |
-
break;
|
245 |
-
|
246 |
-
default:
|
247 |
-
$args = array( 'hide_empty' => true, 'exclude' => $exclude, 'include' => $include );
|
248 |
-
if ( 'parent' == $instance['display'] ) {
|
249 |
-
$args['parent'] = false;
|
250 |
-
}
|
251 |
-
|
252 |
-
$terms = get_terms( $taxonomy, $args );
|
253 |
-
|
254 |
-
if ( 'hierarchical' == $instance['display'] ) {
|
255 |
-
$terms = yit_reorder_terms_by_parent( $terms );
|
256 |
-
}
|
257 |
-
break;
|
258 |
-
}
|
259 |
-
|
260 |
-
return $terms;
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
-
if ( ! function_exists( 'yit_term_is_child' ) ) {
|
265 |
-
/**
|
266 |
-
* Return true if the term is a child, false otherwise
|
267 |
-
*
|
268 |
-
* @param $term The term object
|
269 |
-
*
|
270 |
-
* @return bool
|
271 |
-
*
|
272 |
-
* @since 1.3.1
|
273 |
-
*/
|
274 |
-
function yit_term_is_child( $term ) {
|
275 |
-
|
276 |
-
return ( isset( $term->parent ) && $term->parent != 0 ) ? true : false;
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
if ( ! function_exists( 'yit_term_is_parent' ) ) {
|
281 |
-
/**
|
282 |
-
* Return true if the term is a parent, false otherwise
|
283 |
-
*
|
284 |
-
* @param $term The term object
|
285 |
-
*
|
286 |
-
* @return bool
|
287 |
-
*
|
288 |
-
* @since 1.3.1
|
289 |
-
*/
|
290 |
-
function yit_term_is_parent( $term ) {
|
291 |
-
|
292 |
-
return ( isset( $term->parent ) && $term->parent == 0 ) ? true : false;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
if ( ! function_exists( 'yit_term_has_child' ) ) {
|
297 |
-
/**
|
298 |
-
* Return true if the term has a child, false otherwise
|
299 |
-
*
|
300 |
-
* @param $term The term object
|
301 |
-
* @param $taxonomy the taxonomy to search
|
302 |
-
*
|
303 |
-
* @return bool
|
304 |
-
*
|
305 |
-
* @since 1.3.1
|
306 |
-
*/
|
307 |
-
function yit_term_has_child( $term, $taxonomy ) {
|
308 |
-
global $woocommerce;
|
309 |
-
|
310 |
-
$count = 0;
|
311 |
-
$child_terms = get_terms( $taxonomy, array( 'child_of' => $term->term_id ) );
|
312 |
-
foreach ( $child_terms as $term ) {
|
313 |
-
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
314 |
-
$count += sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
315 |
-
}
|
316 |
-
|
317 |
-
return empty( $count ) ? false : true;
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
if ( ! function_exists( 'yith_wcan_get_option' ) ) {
|
322 |
-
/**
|
323 |
-
* Retreive the plugin option
|
324 |
-
*
|
325 |
-
* @param mixed|bool $option_name The option name. If false return alla options array
|
326 |
-
*
|
327 |
-
*
|
328 |
-
* @return mixed|array|string The option(s)
|
329 |
-
*
|
330 |
-
* @since 1.3.1
|
331 |
-
*/
|
332 |
-
function yith_wcan_get_option( $option_name = false, $default = false ) {
|
333 |
-
$options = get_option( 'yit_wcan_options' );
|
334 |
-
|
335 |
-
if ( ! $option_name ) {
|
336 |
-
return $options;
|
337 |
-
}
|
338 |
-
|
339 |
-
return isset( $options[$option_name] ) ? $options[$option_name] : $default;
|
340 |
-
}
|
341 |
-
}
|
342 |
-
|
343 |
-
if ( ! function_exists( 'yit_get_filter_args' ) ) {
|
344 |
-
/**
|
345 |
-
* Retreive the filter query args option
|
346 |
-
*
|
347 |
-
* @return array The option(s)
|
348 |
-
*
|
349 |
-
* @since 1.4
|
350 |
-
*/
|
351 |
-
function yit_get_filter_args( $check_price_filter = true ) {
|
352 |
-
$filter_value = array();
|
353 |
-
$regexs = array( '/^filter_[a-zA-Z0-9]/', '/^query_type_[a-zA-Z0-9]/', '/product_tag/' );
|
354 |
-
|
355 |
-
/* Support to YITH WooCommerce Brands */
|
356 |
-
if ( defined( 'YITH_WCBR_PREMIUM_INIT' ) && YITH_WCBR_PREMIUM_INIT ) {
|
357 |
-
$brands_taxonomy = YITH_WCBR::$brands_taxonomy;
|
358 |
-
$regexs[] = "/{$brands_taxonomy}/";
|
359 |
-
}
|
360 |
-
|
361 |
-
if ( ! empty( $_GET ) ) {
|
362 |
-
foreach ( $regexs as $regex ) {
|
363 |
-
foreach ( $_GET as $query_var => $value ) {
|
364 |
-
if ( preg_match( $regex, $query_var ) ) {
|
365 |
-
$filter_value[$query_var] = $value;
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
if ( $check_price_filter ) {
|
372 |
-
// WooCommerce Price Filter
|
373 |
-
if ( isset( $_GET['min_price'] ) ) {
|
374 |
-
$link = $filter_value['min_price'] = $_GET['min_price'];
|
375 |
-
}
|
376 |
-
|
377 |
-
if ( isset( $_GET['max_price'] ) ) {
|
378 |
-
$link = $filter_value['max_price'] = $_GET['max_price'];
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
// WooCommerce In Stock/On Sale filters
|
383 |
-
if ( isset( $_GET['instock_filter'] ) ) {
|
384 |
-
$link = $filter_value['instock_filter'] = $_GET['instock_filter'];
|
385 |
-
}
|
386 |
-
|
387 |
-
if ( isset( $_GET['onsale_filter'] ) ) {
|
388 |
-
$link = $filter_value['onsale_filter'] = $_GET['onsale_filter'];
|
389 |
-
}
|
390 |
-
|
391 |
-
if ( isset( $_GET['orderby'] ) ) {
|
392 |
-
$link = $filter_value['orderby'] = $_GET['orderby'];
|
393 |
-
}
|
394 |
-
|
395 |
-
if ( isset( $_GET['product_tag'] ) ) {
|
396 |
-
$link = $filter_value['product_tag'] = urlencode( $_GET['product_tag'] );
|
397 |
-
}
|
398 |
-
|
399 |
-
return $filter_value;
|
400 |
-
}
|
401 |
-
}
|
402 |
-
|
403 |
-
if ( ! function_exists( 'yit_check_active_price_filter' ) ) {
|
404 |
-
/**
|
405 |
-
* Check if there is an active price filter
|
406 |
-
*
|
407 |
-
* @return bool True if the the filter is active, false otherwise
|
408 |
-
*
|
409 |
-
* @since 1.4
|
410 |
-
*/
|
411 |
-
function yit_check_active_price_filter( $min_price, $max_price ) {
|
412 |
-
return isset( $_GET['min_price'] ) && $_GET['min_price'] == $min_price && isset( $_GET['max_price'] ) && $_GET['max_price'] == $max_price;
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
if ( ! function_exists( 'yit_remove_price_filter_query_args' ) ) {
|
417 |
-
/**
|
418 |
-
* Remove min_price and max_price query args from filters array value
|
419 |
-
*
|
420 |
-
* @return array The array params
|
421 |
-
*
|
422 |
-
* @since 1.4
|
423 |
-
*/
|
424 |
-
function yit_remove_price_filter_query_args( $filter_value ) {
|
425 |
-
foreach ( array( 'min_price', 'max_price' ) as $remove ) {
|
426 |
-
unset( $filter_value[$remove] );
|
427 |
-
}
|
428 |
-
|
429 |
-
return $filter_value;
|
430 |
-
}
|
431 |
-
}
|
432 |
-
|
433 |
-
if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
|
434 |
-
/**
|
435 |
-
* Get current layered link
|
436 |
-
*
|
437 |
-
* @return string The new link
|
438 |
-
*
|
439 |
-
* @since 1.4
|
440 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
441 |
-
*/
|
442 |
-
function yit_get_woocommerce_layered_nav_link() {
|
443 |
-
|
444 |
-
if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category()
|
445 |
-
$return = get_post_type_archive_link( 'product' );
|
446 |
-
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
447 |
-
}
|
448 |
-
|
449 |
-
elseif ( is_product_category() ) {
|
450 |
-
$return = get_term_link( get_queried_object()->slug, 'product_cat' );
|
451 |
-
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
452 |
-
}
|
453 |
-
|
454 |
-
else {
|
455 |
-
$return = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
|
456 |
-
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
457 |
-
}
|
458 |
-
|
459 |
-
return false;
|
460 |
-
}
|
461 |
-
}
|
462 |
-
|
463 |
-
if ( ! function_exists( 'yit_wcan_localize_terms' ) ) {
|
464 |
-
/**
|
465 |
-
* Get current layered link
|
466 |
-
*
|
467 |
-
* @param $term_id The term id
|
468 |
-
* @param $taxonomy The taxonomy name
|
469 |
-
*
|
470 |
-
* @return string The new term_id
|
471 |
-
*
|
472 |
-
* @since 1.4
|
473 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
474 |
-
*/
|
475 |
-
|
476 |
-
function yit_wcan_localize_terms( $term_id, $taxonomy ) {
|
477 |
-
/* === WPML Support === */
|
478 |
-
global $sitepress;
|
479 |
-
if ( ! empty( $sitepress ) && function_exists( 'wpml_object_id_filter' ) ) {
|
480 |
-
$term_id = wpml_object_id_filter( $term_id, $taxonomy, true, $sitepress->get_default_language() );
|
481 |
-
}
|
482 |
-
|
483 |
-
return $term_id;
|
484 |
-
}
|
485 |
-
|
486 |
-
}
|
487 |
-
|
488 |
-
if ( ! function_exists( 'yit_wcan_get_product_taxonomy' ) ) {
|
489 |
-
/**
|
490 |
-
* Get the product taxonomy array
|
491 |
-
* @return array product taxonomy array
|
492 |
-
*
|
493 |
-
* @since 2.2
|
494 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
495 |
-
*/
|
496 |
-
|
497 |
-
function yit_wcan_get_product_taxonomy() {
|
498 |
-
global $_attributes_array;
|
499 |
-
$product_taxonomies = ! empty( $_attributes_array ) ? $_attributes_array : get_object_taxonomies( 'product' );
|
500 |
-
return array_merge( $product_taxonomies, apply_filters( 'yith_wcan_product_taxonomy_type', array() ) );
|
501 |
-
}
|
502 |
-
|
503 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Return a dropdown with Woocommerce attributes
|
17 |
+
*/
|
18 |
+
function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
|
19 |
+
$attributes = YITH_WCAN_Helper::attribute_taxonomies();
|
20 |
+
$options = "";
|
21 |
+
|
22 |
+
foreach ( $attributes as $attribute ) {
|
23 |
+
$options .= "<option name='{$attribute}'" . selected( $attribute, $selected, false ) . ">{$attribute}</option>";
|
24 |
+
}
|
25 |
+
|
26 |
+
if ( $echo ) {
|
27 |
+
echo $options;
|
28 |
+
}
|
29 |
+
else {
|
30 |
+
return $options;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Print the widgets options already filled
|
37 |
+
*
|
38 |
+
* @param $type string list|colors|label
|
39 |
+
* @param $attribute woocommerce taxonomy
|
40 |
+
* @param $id id used in the <input />
|
41 |
+
* @param $name base name used in the <input />
|
42 |
+
* @param $values array of values (could be empty if this is an ajax call)
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = array(), $echo = true ) {
|
47 |
+
$return = '';
|
48 |
+
|
49 |
+
$terms = get_terms( 'pa_' . $attribute, array( 'hide_empty' => '0' ) );
|
50 |
+
|
51 |
+
if ( 'list' == $type ) {
|
52 |
+
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
|
53 |
+
}
|
54 |
+
|
55 |
+
elseif ( 'color' == $type ) {
|
56 |
+
if ( ! empty( $terms ) ) {
|
57 |
+
$return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), __( 'Color', 'yith-woocommerce-ajax-navigation' ) );
|
58 |
+
|
59 |
+
foreach ( $terms as $term ) {
|
60 |
+
$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>";
|
61 |
+
}
|
62 |
+
|
63 |
+
$return .= '</table>';
|
64 |
+
}
|
65 |
+
|
66 |
+
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
|
67 |
+
}
|
68 |
+
|
69 |
+
elseif ( 'multicolor' == $type ) {
|
70 |
+
if ( ! empty( $terms ) ) {
|
71 |
+
$return = sprintf( '<table class="yith-wcan-multicolor"><tr><th>%s</th><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), _x( 'Color 1', 'For multicolor: I.E. white and red T-Shirt', 'yith-woocommerce-ajax-navigation' ), _x( 'Color 2', 'For multicolor: I.E. white and red T-Shirt', 'yith-woocommerce-ajax-navigation' ) );
|
72 |
+
|
73 |
+
foreach ( $terms as $term ) {
|
74 |
+
|
75 |
+
$return .= "<tr>";
|
76 |
+
|
77 |
+
$return .= "<td><label for='{$id}{$term->term_id}'>{$term->name}</label></td>";
|
78 |
+
|
79 |
+
$return .= "<td><input type='text' id='{$id}{$term->term_id}_1' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][0] ) ? $values[$term->term_id][0] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
|
80 |
+
$return .= "<td><input type='text' id='{$id}{$term->term_id}_2' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][1] ) ? $values[$term->term_id][1] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
|
81 |
+
|
82 |
+
$return .= '</tr>';
|
83 |
+
}
|
84 |
+
|
85 |
+
$return .= '</table>';
|
86 |
+
}
|
87 |
+
|
88 |
+
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
|
89 |
+
}
|
90 |
+
|
91 |
+
elseif ( 'label' == $type ) {
|
92 |
+
if ( ! empty( $terms ) ) {
|
93 |
+
$return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith-woocommerce-ajax-navigation' ), __( 'Labels', 'yith-woocommerce-ajax-navigation' ) );
|
94 |
+
|
95 |
+
foreach ( $terms as $term ) {
|
96 |
+
$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' /></td></tr>";
|
97 |
+
}
|
98 |
+
|
99 |
+
$return .= '</table>';
|
100 |
+
}
|
101 |
+
|
102 |
+
$return .= '<input type="hidden" name="' . $name . '[colors]" value="" />';
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( $echo ) {
|
106 |
+
echo $return;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $return;
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Can the widget be displayed?
|
115 |
+
*
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
function yith_wcan_can_be_displayed() {
|
119 |
+
global $woocommerce, $_attributes_array;
|
120 |
+
|
121 |
+
if (
|
122 |
+
is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) ||
|
123 |
+
is_active_widget( false, false, 'yith-woo-ajax-navigation-sort-by', true ) ||
|
124 |
+
is_active_widget( false, false, 'yith-woo-ajax-navigation-stock-on-sale', true ) ||
|
125 |
+
is_active_widget( false, false, 'yith-woo-ajax-navigation-list-price-filter', true )
|
126 |
+
) {
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
else {
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
if ( ! function_exists( 'yit_curPageURL' ) ) {
|
136 |
+
/**
|
137 |
+
* Retrieve the current complete url
|
138 |
+
*
|
139 |
+
* @since 1.0
|
140 |
+
*/
|
141 |
+
function yit_curPageURL() {
|
142 |
+
$pageURL = 'http';
|
143 |
+
if ( isset( $_SERVER["HTTPS"] ) AND $_SERVER["HTTPS"] == "on" ) {
|
144 |
+
$pageURL .= "s";
|
145 |
+
}
|
146 |
+
|
147 |
+
$pageURL .= "://";
|
148 |
+
|
149 |
+
if ( isset( $_SERVER["SERVER_PORT"] ) AND $_SERVER["SERVER_PORT"] != "80" ) {
|
150 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
151 |
+
}
|
152 |
+
else {
|
153 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
154 |
+
}
|
155 |
+
|
156 |
+
return $pageURL;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( ! function_exists( 'yit_reorder_terms_by_parent' ) ) {
|
161 |
+
/**
|
162 |
+
* Sort the array of terms associating the child to the parent terms
|
163 |
+
*
|
164 |
+
* @param $terms mixed|array
|
165 |
+
*
|
166 |
+
* @return mixed!array
|
167 |
+
* @since 1.3.1
|
168 |
+
*/
|
169 |
+
function yit_reorder_terms_by_parent( $terms ) {
|
170 |
+
|
171 |
+
/* Extract Child Terms */
|
172 |
+
$child_terms = array();
|
173 |
+
$terms_count = 0;
|
174 |
+
$parent_terms = array();
|
175 |
+
|
176 |
+
foreach ( $terms as $array_key => $term ) {
|
177 |
+
|
178 |
+
if ( $term->parent != 0 ) {
|
179 |
+
|
180 |
+
if ( isset( $child_terms[$term->parent] ) && $child_terms[$term->parent] != null ) {
|
181 |
+
$child_terms[$term->parent] = array_merge( $child_terms[$term->parent], array( $term ) );
|
182 |
+
}
|
183 |
+
else {
|
184 |
+
$child_terms[$term->parent] = array( $term );
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
else {
|
189 |
+
$parent_terms[$terms_count] = $term;
|
190 |
+
}
|
191 |
+
$terms_count ++;
|
192 |
+
}
|
193 |
+
|
194 |
+
/* Reorder Therms */
|
195 |
+
$terms_count = 0;
|
196 |
+
$terms = array();
|
197 |
+
|
198 |
+
foreach ( $parent_terms as $term ) {
|
199 |
+
|
200 |
+
$terms[$terms_count] = $term;
|
201 |
+
|
202 |
+
/* The term as child */
|
203 |
+
if ( array_key_exists( $term->term_id, $child_terms ) ) {
|
204 |
+
|
205 |
+
foreach ( $child_terms[$term->term_id] as $child_term ) {
|
206 |
+
$terms_count ++;
|
207 |
+
$terms[$terms_count] = $child_term;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
$terms_count ++;
|
211 |
+
}
|
212 |
+
|
213 |
+
return $terms;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( ! function_exists( 'yit_get_terms' ) ) {
|
218 |
+
/**
|
219 |
+
* Get the array of objects terms
|
220 |
+
*
|
221 |
+
* @param $type A type of term to display
|
222 |
+
*
|
223 |
+
* @return $terms mixed|array
|
224 |
+
*
|
225 |
+
* @since 1.3.1
|
226 |
+
*/
|
227 |
+
function yit_get_terms( $case, $taxonomy, $instance = false ) {
|
228 |
+
|
229 |
+
$exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
|
230 |
+
$include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
|
231 |
+
|
232 |
+
switch ( $case ) {
|
233 |
+
|
234 |
+
case 'all':
|
235 |
+
$terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'exclude' => $exclude ) );
|
236 |
+
break;
|
237 |
+
|
238 |
+
case 'hierarchical':
|
239 |
+
$terms = yit_reorder_terms_by_parent( get_terms( $taxonomy, array( 'hide_empty' => true, 'exclude' => $exclude ) ) );
|
240 |
+
break;
|
241 |
+
|
242 |
+
case 'parent' :
|
243 |
+
$terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'parent' => false, 'exclude' => $exclude ) );
|
244 |
+
break;
|
245 |
+
|
246 |
+
default:
|
247 |
+
$args = array( 'hide_empty' => true, 'exclude' => $exclude, 'include' => $include );
|
248 |
+
if ( 'parent' == $instance['display'] ) {
|
249 |
+
$args['parent'] = false;
|
250 |
+
}
|
251 |
+
|
252 |
+
$terms = get_terms( $taxonomy, $args );
|
253 |
+
|
254 |
+
if ( 'hierarchical' == $instance['display'] ) {
|
255 |
+
$terms = yit_reorder_terms_by_parent( $terms );
|
256 |
+
}
|
257 |
+
break;
|
258 |
+
}
|
259 |
+
|
260 |
+
return $terms;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
if ( ! function_exists( 'yit_term_is_child' ) ) {
|
265 |
+
/**
|
266 |
+
* Return true if the term is a child, false otherwise
|
267 |
+
*
|
268 |
+
* @param $term The term object
|
269 |
+
*
|
270 |
+
* @return bool
|
271 |
+
*
|
272 |
+
* @since 1.3.1
|
273 |
+
*/
|
274 |
+
function yit_term_is_child( $term ) {
|
275 |
+
|
276 |
+
return ( isset( $term->parent ) && $term->parent != 0 ) ? true : false;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
if ( ! function_exists( 'yit_term_is_parent' ) ) {
|
281 |
+
/**
|
282 |
+
* Return true if the term is a parent, false otherwise
|
283 |
+
*
|
284 |
+
* @param $term The term object
|
285 |
+
*
|
286 |
+
* @return bool
|
287 |
+
*
|
288 |
+
* @since 1.3.1
|
289 |
+
*/
|
290 |
+
function yit_term_is_parent( $term ) {
|
291 |
+
|
292 |
+
return ( isset( $term->parent ) && $term->parent == 0 ) ? true : false;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
if ( ! function_exists( 'yit_term_has_child' ) ) {
|
297 |
+
/**
|
298 |
+
* Return true if the term has a child, false otherwise
|
299 |
+
*
|
300 |
+
* @param $term The term object
|
301 |
+
* @param $taxonomy the taxonomy to search
|
302 |
+
*
|
303 |
+
* @return bool
|
304 |
+
*
|
305 |
+
* @since 1.3.1
|
306 |
+
*/
|
307 |
+
function yit_term_has_child( $term, $taxonomy ) {
|
308 |
+
global $woocommerce;
|
309 |
+
|
310 |
+
$count = 0;
|
311 |
+
$child_terms = get_terms( $taxonomy, array( 'child_of' => $term->term_id ) );
|
312 |
+
foreach ( $child_terms as $term ) {
|
313 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
314 |
+
$count += sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
315 |
+
}
|
316 |
+
|
317 |
+
return empty( $count ) ? false : true;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
if ( ! function_exists( 'yith_wcan_get_option' ) ) {
|
322 |
+
/**
|
323 |
+
* Retreive the plugin option
|
324 |
+
*
|
325 |
+
* @param mixed|bool $option_name The option name. If false return alla options array
|
326 |
+
*
|
327 |
+
*
|
328 |
+
* @return mixed|array|string The option(s)
|
329 |
+
*
|
330 |
+
* @since 1.3.1
|
331 |
+
*/
|
332 |
+
function yith_wcan_get_option( $option_name = false, $default = false ) {
|
333 |
+
$options = get_option( 'yit_wcan_options' );
|
334 |
+
|
335 |
+
if ( ! $option_name ) {
|
336 |
+
return $options;
|
337 |
+
}
|
338 |
+
|
339 |
+
return isset( $options[$option_name] ) ? $options[$option_name] : $default;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
if ( ! function_exists( 'yit_get_filter_args' ) ) {
|
344 |
+
/**
|
345 |
+
* Retreive the filter query args option
|
346 |
+
*
|
347 |
+
* @return array The option(s)
|
348 |
+
*
|
349 |
+
* @since 1.4
|
350 |
+
*/
|
351 |
+
function yit_get_filter_args( $check_price_filter = true ) {
|
352 |
+
$filter_value = array();
|
353 |
+
$regexs = array( '/^filter_[a-zA-Z0-9]/', '/^query_type_[a-zA-Z0-9]/', '/product_tag/' );
|
354 |
+
|
355 |
+
/* Support to YITH WooCommerce Brands */
|
356 |
+
if ( defined( 'YITH_WCBR_PREMIUM_INIT' ) && YITH_WCBR_PREMIUM_INIT ) {
|
357 |
+
$brands_taxonomy = YITH_WCBR::$brands_taxonomy;
|
358 |
+
$regexs[] = "/{$brands_taxonomy}/";
|
359 |
+
}
|
360 |
+
|
361 |
+
if ( ! empty( $_GET ) ) {
|
362 |
+
foreach ( $regexs as $regex ) {
|
363 |
+
foreach ( $_GET as $query_var => $value ) {
|
364 |
+
if ( preg_match( $regex, $query_var ) ) {
|
365 |
+
$filter_value[$query_var] = $value;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
if ( $check_price_filter ) {
|
372 |
+
// WooCommerce Price Filter
|
373 |
+
if ( isset( $_GET['min_price'] ) ) {
|
374 |
+
$link = $filter_value['min_price'] = $_GET['min_price'];
|
375 |
+
}
|
376 |
+
|
377 |
+
if ( isset( $_GET['max_price'] ) ) {
|
378 |
+
$link = $filter_value['max_price'] = $_GET['max_price'];
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
// WooCommerce In Stock/On Sale filters
|
383 |
+
if ( isset( $_GET['instock_filter'] ) ) {
|
384 |
+
$link = $filter_value['instock_filter'] = $_GET['instock_filter'];
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( isset( $_GET['onsale_filter'] ) ) {
|
388 |
+
$link = $filter_value['onsale_filter'] = $_GET['onsale_filter'];
|
389 |
+
}
|
390 |
+
|
391 |
+
if ( isset( $_GET['orderby'] ) ) {
|
392 |
+
$link = $filter_value['orderby'] = $_GET['orderby'];
|
393 |
+
}
|
394 |
+
|
395 |
+
if ( isset( $_GET['product_tag'] ) ) {
|
396 |
+
$link = $filter_value['product_tag'] = urlencode( $_GET['product_tag'] );
|
397 |
+
}
|
398 |
+
|
399 |
+
return $filter_value;
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
if ( ! function_exists( 'yit_check_active_price_filter' ) ) {
|
404 |
+
/**
|
405 |
+
* Check if there is an active price filter
|
406 |
+
*
|
407 |
+
* @return bool True if the the filter is active, false otherwise
|
408 |
+
*
|
409 |
+
* @since 1.4
|
410 |
+
*/
|
411 |
+
function yit_check_active_price_filter( $min_price, $max_price ) {
|
412 |
+
return isset( $_GET['min_price'] ) && $_GET['min_price'] == $min_price && isset( $_GET['max_price'] ) && $_GET['max_price'] == $max_price;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
if ( ! function_exists( 'yit_remove_price_filter_query_args' ) ) {
|
417 |
+
/**
|
418 |
+
* Remove min_price and max_price query args from filters array value
|
419 |
+
*
|
420 |
+
* @return array The array params
|
421 |
+
*
|
422 |
+
* @since 1.4
|
423 |
+
*/
|
424 |
+
function yit_remove_price_filter_query_args( $filter_value ) {
|
425 |
+
foreach ( array( 'min_price', 'max_price' ) as $remove ) {
|
426 |
+
unset( $filter_value[$remove] );
|
427 |
+
}
|
428 |
+
|
429 |
+
return $filter_value;
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
|
434 |
+
/**
|
435 |
+
* Get current layered link
|
436 |
+
*
|
437 |
+
* @return string The new link
|
438 |
+
*
|
439 |
+
* @since 1.4
|
440 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
441 |
+
*/
|
442 |
+
function yit_get_woocommerce_layered_nav_link() {
|
443 |
+
|
444 |
+
if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() ) || is_product_taxonomy() ) {
|
445 |
+
$return = get_post_type_archive_link( 'product' );
|
446 |
+
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
447 |
+
}
|
448 |
+
|
449 |
+
elseif ( is_product_category() ) {
|
450 |
+
$return = get_term_link( get_queried_object()->slug, 'product_cat' );
|
451 |
+
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
452 |
+
}
|
453 |
+
|
454 |
+
else {
|
455 |
+
$return = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
|
456 |
+
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
|
457 |
+
}
|
458 |
+
|
459 |
+
return false;
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
if ( ! function_exists( 'yit_wcan_localize_terms' ) ) {
|
464 |
+
/**
|
465 |
+
* Get current layered link
|
466 |
+
*
|
467 |
+
* @param $term_id The term id
|
468 |
+
* @param $taxonomy The taxonomy name
|
469 |
+
*
|
470 |
+
* @return string The new term_id
|
471 |
+
*
|
472 |
+
* @since 1.4
|
473 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
474 |
+
*/
|
475 |
+
|
476 |
+
function yit_wcan_localize_terms( $term_id, $taxonomy ) {
|
477 |
+
/* === WPML Support === */
|
478 |
+
global $sitepress;
|
479 |
+
if ( ! empty( $sitepress ) && function_exists( 'wpml_object_id_filter' ) ) {
|
480 |
+
$term_id = wpml_object_id_filter( $term_id, $taxonomy, true, $sitepress->get_default_language() );
|
481 |
+
}
|
482 |
+
|
483 |
+
return $term_id;
|
484 |
+
}
|
485 |
+
|
486 |
+
}
|
487 |
+
|
488 |
+
if ( ! function_exists( 'yit_wcan_get_product_taxonomy' ) ) {
|
489 |
+
/**
|
490 |
+
* Get the product taxonomy array
|
491 |
+
* @return array product taxonomy array
|
492 |
+
*
|
493 |
+
* @since 2.2
|
494 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
495 |
+
*/
|
496 |
+
|
497 |
+
function yit_wcan_get_product_taxonomy() {
|
498 |
+
global $_attributes_array;
|
499 |
+
$product_taxonomies = ! empty( $_attributes_array ) ? $_attributes_array : get_object_taxonomies( 'product' );
|
500 |
+
return array_merge( $product_taxonomies, apply_filters( 'yith_wcan_product_taxonomy_type', array() ) );
|
501 |
+
}
|
502 |
+
|
503 |
}
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
|
6 |
-
* Version: 2.
|
7 |
* Author: yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith_wc_ajxnav
|
@@ -65,7 +65,7 @@ if ( defined( 'YITH_WCAN_VERSION' ) ) {
|
|
65 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
66 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
67 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
68 |
-
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.
|
69 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
70 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
71 |
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
|
6 |
+
* Version: 2.7.0
|
7 |
* Author: yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith_wc_ajxnav
|
65 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
66 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
67 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
68 |
+
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.7.0' );
|
69 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
70 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
71 |
|
languages/yith-woocommerce-ajax-navigation-it_IT.mo
CHANGED
Binary file
|
languages/yith-woocommerce-ajax-navigation-it_IT.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2015-11-
|
6 |
-
"PO-Revision-Date: 2015-11-
|
7 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: it_IT\n"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2015-11-10 12:29+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-11-10 12:29+0100\n"
|
7 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: it_IT\n"
|
languages/yith-woocommerce-ajax-navigation-tr_TR.mo
CHANGED
Binary file
|
languages/yith-woocommerce-ajax-navigation-tr_TR.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2015-11-
|
6 |
-
"PO-Revision-Date: 2015-11-
|
7 |
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
|
8 |
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
|
9 |
"Language: tr\n"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2015-11-10 12:29+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-11-10 12:29+0100\n"
|
7 |
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
|
8 |
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
|
9 |
"Language: tr\n"
|
languages/yith-woocommerce-ajax-navigation.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2015-11-
|
7 |
"PO-Revision-Date: 2015-06-19 13:59+0100\n"
|
8 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
9 |
"Language-Team: \n"
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2015-11-10 12:29+0100\n"
|
7 |
"PO-Revision-Date: 2015-06-19 13:59+0100\n"
|
8 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
9 |
"Language-Team: \n"
|
plugin-fw/assets/css/metaboxes.css
CHANGED
@@ -237,6 +237,27 @@
|
|
237 |
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
|
238 |
width: 100%!important;
|
239 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
/* typography */
|
242 |
.the-metabox.typography .select_wrapper.font-family { width:200px; }
|
237 |
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
|
238 |
width: 100%!important;
|
239 |
}
|
240 |
+
.select_wrapper span {
|
241 |
+
height: 26px;
|
242 |
+
line-height: 26px;
|
243 |
+
padding-left: 6px;
|
244 |
+
position: absolute;
|
245 |
+
z-index: 2;
|
246 |
+
overflow: hidden;
|
247 |
+
}
|
248 |
+
|
249 |
+
.the-metabox .select_wrapper select {
|
250 |
+
cursor: pointer;
|
251 |
+
height: 28px;
|
252 |
+
margin: 0;
|
253 |
+
opacity: 0;
|
254 |
+
padding: 0;
|
255 |
+
position: relative;
|
256 |
+
width: inherit;
|
257 |
+
z-index: 4;
|
258 |
+
background-color: #FAFAFA;
|
259 |
+
}
|
260 |
+
|
261 |
|
262 |
/* typography */
|
263 |
.the-metabox.typography .select_wrapper.font-family { width:200px; }
|
plugin-fw/assets/css/yit-plugin-panel.css
CHANGED
@@ -631,6 +631,10 @@
|
|
631 |
width: 6em;
|
632 |
}
|
633 |
|
|
|
|
|
|
|
|
|
634 |
/* === YIT FRAMEWORK === */
|
635 |
.plugin-card .plugin-icon img {
|
636 |
max-width: 100%;
|
631 |
width: 6em;
|
632 |
}
|
633 |
|
634 |
+
#wpwrap h2.nav-tab-wrapper {
|
635 |
+
border-bottom: 1px solid #ccc;
|
636 |
+
}
|
637 |
+
|
638 |
/* === YIT FRAMEWORK === */
|
639 |
.plugin-card .plugin-icon img {
|
640 |
max-width: 100%;
|
plugin-fw/assets/js/yit-plugin-panel.js
CHANGED
@@ -177,6 +177,16 @@
|
|
177 |
//Open the uploader dialog
|
178 |
custom_uploader.open();
|
179 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
|
182 |
$('.plugin-option .add_media').on('click', function () {
|
177 |
//Open the uploader dialog
|
178 |
custom_uploader.open();
|
179 |
});
|
180 |
+
|
181 |
+
$( document).on( 'click', '.plugin-option .upload_button_reset', function(e){
|
182 |
+
var t = $(this),
|
183 |
+
id = t.attr('id'),
|
184 |
+
input_id = t.attr('id').replace(/-button_reset$/, ''),
|
185 |
+
default_value = $('#' + id).data('default');
|
186 |
+
|
187 |
+
$("#" + input_id).val( default_value );
|
188 |
+
$('.plugin-option .upload_img_url').trigger('change');
|
189 |
+
} );
|
190 |
}
|
191 |
|
192 |
$('.plugin-option .add_media').on('click', function () {
|
plugin-fw/assets/js/yit-plugin-panel.min.js
CHANGED
@@ -1 +1,10 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
|
2 |
+
"</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .on_off_container span").on("click",
|
3 |
+
function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
|
4 |
+
a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parents().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).trigger("change"),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
|
5 |
+
var c,d=a(this).attr("id").replace(/-button$/,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url);a("#"+d+"-yith-attachment-id")&&a("#"+d+"-yith-attachment-id").val(b.id);a(".plugin-option .upload_img_url").trigger("change")}));
|
6 |
+
c.open()}),a(document).on("click",".plugin-option .upload_button_reset",function(b){var c=a(this);b=c.attr("id");c=c.attr("id").replace(/-button_reset$/,"");b=a("#"+b).data("default");a("#"+c).val(b);a(".plugin-option .upload_img_url").trigger("change")}));a(".plugin-option .add_media").on("click",function(){});a("[data-field]").each(function(){var b=a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");a(d).on("change",function(){var b=d,g=e.toString(),h=!0;if("string"==typeof b){":radio"==
|
7 |
+
b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,
|
8 |
+
"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(b,d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});
|
9 |
+
a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
|
10 |
+
e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 2.
|
5 |
* Author: Yithemes
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
@@ -20,20 +20,20 @@
|
|
20 |
*/
|
21 |
|
22 |
|
23 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
24 |
exit;
|
25 |
} // Exit if accessed directly
|
26 |
|
27 |
-
if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) ) {
|
28 |
/**
|
29 |
* YITH WooCommerce Ajax Navigation
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
-
function yit_maybe_plugin_fw_loader( $plugin_path ) {
|
34 |
global $plugin_fw_data;
|
35 |
|
36 |
-
$default_headers = array(
|
37 |
'Name' => 'Framework Name',
|
38 |
'Version' => 'Version',
|
39 |
'Author' => 'Author',
|
@@ -41,19 +41,17 @@ if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) ) {
|
|
41 |
'DomainPath' => 'Domain Path',
|
42 |
);
|
43 |
|
44 |
-
$framework_data
|
45 |
-
$plugin_fw_main_file
|
46 |
|
47 |
-
if( ! empty( $plugin_fw_data ) ){
|
48 |
-
foreach( $plugin_fw_data as $version => $path ){
|
49 |
-
if( version_compare( $version, $framework_data['Version'], '<' ) ){
|
50 |
-
$plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
|
51 |
}
|
52 |
}
|
53 |
-
}
|
54 |
-
|
55 |
-
else {
|
56 |
-
$plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
|
57 |
}
|
58 |
}
|
59 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 2.9.5
|
5 |
* Author: Yithemes
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
20 |
*/
|
21 |
|
22 |
|
23 |
+
if ( ! defined ( 'ABSPATH' ) ) {
|
24 |
exit;
|
25 |
} // Exit if accessed directly
|
26 |
|
27 |
+
if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
|
28 |
/**
|
29 |
* YITH WooCommerce Ajax Navigation
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
+
function yit_maybe_plugin_fw_loader ( $plugin_path ) {
|
34 |
global $plugin_fw_data;
|
35 |
|
36 |
+
$default_headers = array (
|
37 |
'Name' => 'Framework Name',
|
38 |
'Version' => 'Version',
|
39 |
'Author' => 'Author',
|
41 |
'DomainPath' => 'Domain Path',
|
42 |
);
|
43 |
|
44 |
+
$framework_data = get_file_data ( trailingslashit ( $plugin_path ) . 'plugin-fw/init.php', $default_headers );
|
45 |
+
$plugin_fw_main_file = trailingslashit ( $plugin_path ) . 'plugin-fw/yit-plugin.php';
|
46 |
|
47 |
+
if ( ! empty( $plugin_fw_data ) ) {
|
48 |
+
foreach ( $plugin_fw_data as $version => $path ) {
|
49 |
+
if ( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ) {
|
50 |
+
$plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
|
51 |
}
|
52 |
}
|
53 |
+
} else {
|
54 |
+
$plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
|
|
|
|
|
55 |
}
|
56 |
}
|
57 |
}
|
plugin-fw/languages/yith-plugin-fw-it_IT.mo
CHANGED
Binary file
|
plugin-fw/languages/yith-plugin-fw-it_IT.po
CHANGED
@@ -4,15 +4,15 @@ msgid ""
|
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
|
6 |
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
-
"PO-Revision-Date: 2015-
|
9 |
"Last-Translator: \n"
|
10 |
-
"Language-Team:
|
11 |
-
"Language:
|
12 |
"MIME-Version: 1.0\n"
|
13 |
-
"Content-Type: text/plain; charset=
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
-
"X-Generator: Poedit 1.8\n"
|
16 |
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
|
17 |
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
|
18 |
"esc_html_x:1,2c\n"
|
@@ -136,8 +136,9 @@ msgid "Type"
|
|
136 |
msgstr "Tipologia"
|
137 |
|
138 |
#: lib/yit-cpt-unlimited.php:1052
|
139 |
-
|
140 |
-
|
|
|
141 |
|
142 |
#: lib/yit-cpt-unlimited.php:1058
|
143 |
msgid "Rewrite"
|
@@ -220,10 +221,10 @@ msgid "Add %s from images"
|
|
220 |
msgstr "Aggiungi %s dalla immagini"
|
221 |
|
222 |
#: lib/yit-cpt-unlimited.php:1633
|
223 |
-
msgid "
|
224 |
-
msgstr "
|
225 |
|
226 |
-
#: lib/yit-plugin-panel-wc.php:
|
227 |
msgid "The changes you have made will be lost if you leave this page."
|
228 |
msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
|
229 |
|
@@ -231,71 +232,71 @@ msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
|
|
231 |
msgid "Plugin Settings"
|
232 |
msgstr "Impostazioni plugin"
|
233 |
|
234 |
-
#: lib/yit-plugin-panel.php:
|
235 |
msgid "YIT Plugins"
|
236 |
msgstr "YIT Plugins"
|
237 |
|
238 |
-
#: lib/yit-plugin-panel.php:
|
239 |
#: templates/panel/woocommerce/woocommerce-form.php:5
|
240 |
msgid "Save Changes"
|
241 |
msgstr "Salva modifiche"
|
242 |
|
243 |
-
#: lib/yit-plugin-panel.php:
|
244 |
msgid "If you continue with this action, you will reset all options in this page."
|
245 |
msgstr ""
|
246 |
"Se prosegui con questa azione, tutte le opzioni di questa pagina saranno "
|
247 |
"reimpostate."
|
248 |
|
249 |
-
#: lib/yit-plugin-panel.php:
|
250 |
-
msgid "Reset to
|
251 |
-
msgstr "
|
252 |
|
253 |
-
#: lib/yit-plugin-panel.php:
|
254 |
-
#: templates/panel/woocommerce/woocommerce-form.php:
|
255 |
msgid "Are you sure?"
|
256 |
msgstr "Sei sicuro?"
|
257 |
|
258 |
-
#: lib/yit-plugin-panel.php:
|
259 |
msgid "The element you have entered already exists. Please, enter another name."
|
260 |
msgstr "L'elemento inserito esiste già. Per favore, inserisci un altro nome."
|
261 |
|
262 |
-
#: lib/yit-plugin-panel.php:
|
263 |
msgid "Settings saved"
|
264 |
msgstr "Impostazioni salvate"
|
265 |
|
266 |
-
#: lib/yit-plugin-panel.php:
|
267 |
msgid "Settings reset"
|
268 |
msgstr "Impostazioni azzerate"
|
269 |
|
270 |
-
#: lib/yit-plugin-panel.php:
|
271 |
msgid "Element deleted correctly."
|
272 |
msgstr "Elemento rimosso correttamente."
|
273 |
|
274 |
-
#: lib/yit-plugin-panel.php:
|
275 |
msgid "Element updated correctly."
|
276 |
msgstr "Elemento aggiornato correttamente."
|
277 |
|
278 |
-
#: lib/yit-plugin-panel.php:
|
279 |
msgid "Database imported correctly."
|
280 |
msgstr "Database importato correttamente."
|
281 |
|
282 |
-
#: lib/yit-plugin-panel.php:
|
283 |
msgid "An error has occurred during import. Please try again."
|
284 |
msgstr "Si è verificato un errore durante l'importazione. Prova di nuovo."
|
285 |
|
286 |
-
#: lib/yit-plugin-panel.php:
|
287 |
msgid "The added file is not valid."
|
288 |
msgstr "Il file aggiunto non è valido."
|
289 |
|
290 |
-
#: lib/yit-plugin-panel.php:
|
291 |
msgid "Sorry, import is disabled."
|
292 |
msgstr "Ci dispiace, l'importazione è disabilitata."
|
293 |
|
294 |
-
#: lib/yit-plugin-panel.php:
|
295 |
msgid "Sorting successful."
|
296 |
msgstr "Ordinamento effettuato con successo."
|
297 |
|
298 |
-
#: lib/yit-plugin-subpanel.php:
|
299 |
msgid ""
|
300 |
"If you continue with this action, you will reset all the options in this page."
|
301 |
msgstr ""
|
@@ -367,19 +368,19 @@ msgstr ""
|
|
367 |
msgid "Update now."
|
368 |
msgstr "Aggiorna adesso."
|
369 |
|
370 |
-
#: lib/yit-upgrade.php:
|
371 |
msgid "Yithemes Repository"
|
372 |
msgstr "Repository YIThemes"
|
373 |
|
374 |
-
#: lib/yit-upgrade.php:
|
375 |
msgid "Invalid URL Provided."
|
376 |
msgstr "L'URL inserito non è valido."
|
377 |
|
378 |
-
#: lib/yit-upgrade.php:
|
379 |
msgid "Could not create Temporary file."
|
380 |
msgstr "Non è stato possibile creare il file temporaneo."
|
381 |
|
382 |
-
#: lib/yit-upgrade.php:
|
383 |
#, php-format
|
384 |
msgid ""
|
385 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
@@ -388,7 +389,7 @@ msgstr ""
|
|
388 |
"È disponibile una nuova versione di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
|
389 |
"changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a>."
|
390 |
|
391 |
-
#: lib/yit-upgrade.php:
|
392 |
#, php-format
|
393 |
msgid ""
|
394 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
@@ -401,21 +402,16 @@ msgstr ""
|
|
401 |
"<em>Per poter usufruire degli aggiornamenti automatici è necessario attivare il "
|
402 |
"plugin su un solo sito.</em>"
|
403 |
|
404 |
-
#: lib/yit-upgrade.php:
|
405 |
#, php-format
|
406 |
msgid ""
|
407 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
408 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>Automatic "
|
409 |
-
"update is unavailable for this plugin, please <a href=\"%5$s\" title=\"
|
410 |
"activation\">activate</a> your copy of %6s.</em>"
|
411 |
msgstr ""
|
412 |
-
"È disponibile una nuova versioni di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
|
413 |
-
"changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a>. "
|
414 |
-
"<em>Gli aggiornamenti automatici non sono disponibili per questo plugi, per "
|
415 |
-
"favore, <a href=\"%5$s\" title=\"Licence activation\">attiva</a> la tua copia di "
|
416 |
-
"%6s.</em>"
|
417 |
|
418 |
-
#: lib/yit-upgrade.php:
|
419 |
#, php-format
|
420 |
msgid ""
|
421 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
@@ -426,83 +422,111 @@ msgstr ""
|
|
426 |
"changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a> "
|
427 |
"oppure <a href=\"%5$s\">aggiorna adesso</a>."
|
428 |
|
429 |
-
#: lib/yit-upgrade.php:
|
430 |
msgid "You can't update the plugins for this site."
|
431 |
msgstr "Non è possibile aggiornare i plugin per questo sito."
|
432 |
|
433 |
-
#: lib/yit-upgrade.php:
|
434 |
msgid "You do not have sufficient permissions to update the plugins for this site."
|
435 |
msgstr ""
|
436 |
"Non sei in possesso delle autorizzazioni necessarie per aggiornare i plugin in "
|
437 |
"questo sito."
|
438 |
|
439 |
-
#: lib/yit-upgrade.php:
|
440 |
msgid "Update Plugin"
|
441 |
msgstr "Aggiorna plugin"
|
442 |
|
443 |
-
#: licence/lib/yit-licence.php:
|
444 |
#, php-format
|
445 |
msgctxt "%s = field name"
|
446 |
msgid "%s field cannot be empty"
|
447 |
msgstr "Il campo %s non può essere vuoto"
|
448 |
|
449 |
-
#: licence/lib/yit-licence.php:
|
450 |
#, php-format
|
451 |
msgid "%s and %s fields cannot be empty"
|
452 |
msgstr "I campi %s e %s non possono essere vuoti"
|
453 |
|
454 |
-
#: licence/lib/yit-licence.php:
|
455 |
msgid "Unable to contact the remote server, please try again later. Thanks!"
|
456 |
msgstr "Impossibile contattare il server remoto, prova più tardi. Grazie!"
|
457 |
|
458 |
-
#: licence/lib/yit-licence.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
msgid "Invalid Request"
|
460 |
msgstr "Richiesta non valida"
|
461 |
|
462 |
-
#: licence/lib/yit-licence.php:
|
463 |
-
msgid "Invalid
|
464 |
-
msgstr "
|
465 |
|
466 |
-
#: licence/lib/yit-licence.php:
|
467 |
msgid "Software has been deactivated"
|
468 |
msgstr "Il software è stato disattivato"
|
469 |
|
470 |
-
#: licence/lib/yit-licence.php:
|
471 |
msgid "Maximum number of activations exceeded"
|
472 |
msgstr "Hai raggiunto il numero massimo di attivazioni"
|
473 |
|
474 |
-
#: licence/lib/yit-licence.php:
|
475 |
msgid "Invalid instance ID"
|
476 |
msgstr "Istanza ID non valida"
|
477 |
|
478 |
-
#: licence/lib/yit-licence.php:
|
479 |
msgid "Invalid security key"
|
480 |
msgstr "Chiave di sicurezza non valida"
|
481 |
|
482 |
-
#: licence/lib/yit-licence.php:
|
483 |
-
msgid "
|
484 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
|
486 |
-
#: licence/lib/yit-licence.php:
|
487 |
-
msgid "
|
488 |
-
msgstr "
|
489 |
|
490 |
-
#: licence/lib/yit-plugin-licence.php:
|
491 |
-
#: licence/lib/yit-theme-licence.php:
|
492 |
-
#: licence/lib/yit-theme-licence.php:
|
493 |
-
msgid "
|
494 |
-
msgstr "
|
495 |
|
496 |
-
#: licence/lib/yit-theme-licence.php:
|
497 |
#, php-format
|
498 |
msgid "%s"
|
499 |
msgstr "%s"
|
500 |
|
501 |
-
#: licence/
|
502 |
-
msgid "Yithemes Licence Activation"
|
503 |
-
msgstr "Attivazione licenza YIThemes"
|
504 |
-
|
505 |
-
#: licence/templates/panel/activation/activation-panel.php:23
|
506 |
msgid ""
|
507 |
"I cannot find the license key for activating the theme I have bought some time "
|
508 |
"ago. Where can I find it?"
|
@@ -510,30 +534,25 @@ msgstr ""
|
|
510 |
"Non riesco a trovare la chiave di licenza per l'attivazione del tema che ho "
|
511 |
"acquistato diverso tempo fa. Dove posso trovarla?"
|
512 |
|
513 |
-
#: licence/
|
514 |
msgid ""
|
515 |
"If you have purchased one of our products before 27 January 2015, you can benefit "
|
516 |
"from support and updates (the services offered with the license)\n"
|
517 |
-
"
|
518 |
-
"a new license key, because, before this date, your license used to be
|
519 |
-
"automatically by our system.\n"
|
520 |
-
"
|
521 |
-
"and updates you have to buy a new license and activate it through the
|
522 |
-
"you will be\n"
|
523 |
-
"
|
524 |
-
"section \"My licenses\"."
|
525 |
-
msgstr ""
|
526 |
-
|
527 |
-
|
528 |
-
"
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
"degli aggiornamenti dovrai riacquistare il prodotto e\n"
|
533 |
-
"attivarlo con la chiave di licenza che ti sarà fornita e che puoi trovare sul tuo "
|
534 |
-
"account YIThemes, alla voce \"Le mie licenze\"."
|
535 |
-
|
536 |
-
#: licence/templates/panel/activation/activation-panel.php:37
|
537 |
msgid ""
|
538 |
"Have you updated your licenses? Have you asked for an extension? Update "
|
539 |
"information concerning your products."
|
@@ -541,71 +560,75 @@ msgstr ""
|
|
541 |
"Hai aggiornato la tua licenza? Hai richiesto un'estensione? Aggiorna le "
|
542 |
"informazioni dei tuoi prodotti."
|
543 |
|
544 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
545 |
-
msgid "Update
|
546 |
-
msgstr "
|
547 |
|
548 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
549 |
-
msgid "
|
550 |
-
|
|
|
|
|
551 |
|
552 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
553 |
msgid "Activate"
|
554 |
msgstr "Attiva"
|
555 |
|
556 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
557 |
msgid "Activated"
|
558 |
msgstr "Attivato"
|
559 |
|
560 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
561 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
562 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
563 |
msgid "Product Name"
|
564 |
msgstr "Nome prodotto"
|
565 |
|
566 |
-
#: licence/templates/panel/activation/activation-panel.php:92
|
567 |
-
#: licence/templates/panel/activation/activation-panel.php:124
|
568 |
-
#: licence/templates/panel/activation/activation-panel.php:148
|
569 |
-
#: templates/metaboxes/types/contactform.php:148
|
570 |
-
#: templates/metaboxes/types/contactform.php:340
|
571 |
-
msgid "Email"
|
572 |
-
msgstr "Email"
|
573 |
-
|
574 |
#: licence/templates/panel/activation/activation-panel.php:93
|
575 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
576 |
-
#: licence/templates/panel/activation/activation-panel.php:149
|
577 |
-
msgid "Licence Key"
|
578 |
-
msgstr "Chiave di licenza"
|
579 |
-
|
580 |
-
#: licence/templates/panel/activation/activation-panel.php:94
|
581 |
-
#: licence/templates/panel/activation/activation-panel.php:150
|
582 |
msgid "Expires"
|
583 |
msgstr "Scadenza"
|
584 |
|
585 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
586 |
msgid "Remaining"
|
587 |
msgstr "Tempo rimanente"
|
588 |
|
589 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
590 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
591 |
-
|
592 |
-
|
593 |
-
msgid "Renew"
|
594 |
-
msgstr "Rinnova"
|
595 |
|
596 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
|
|
|
|
|
|
|
|
597 |
#, php-format
|
598 |
msgid "%1s out of %2s"
|
599 |
msgstr "%1s di %2s"
|
600 |
|
601 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
msgid "Banned"
|
603 |
msgstr "Bloccato"
|
604 |
|
605 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
606 |
msgid "Expired"
|
607 |
msgstr "Non più valido"
|
608 |
|
|
|
|
|
|
|
|
|
609 |
#: templates/metaboxes/types/ajax-products.php:23
|
610 |
msgid "Search for a product"
|
611 |
msgstr "Cerca un prodotto"
|
@@ -802,7 +825,7 @@ msgstr "Icona"
|
|
802 |
#: templates/metaboxes/types/icon-list.php:69
|
803 |
#: templates/metaboxes/types/select-icon.php:33
|
804 |
#: templates/metaboxes/types/upload.php:21 templates/panel/types/upload.php:31
|
805 |
-
#: templates/panel/woocommerce/woocommerce-upload.php:
|
806 |
msgid "Upload"
|
807 |
msgstr "Carica"
|
808 |
|
@@ -970,10 +993,77 @@ msgstr "Corsivo"
|
|
970 |
msgid "Italic bold"
|
971 |
msgstr "Grassetto corsivo"
|
972 |
|
973 |
-
#: templates/panel/woocommerce/woocommerce-form.php:
|
974 |
msgid "Reset Defaults"
|
975 |
msgstr "Ripristina impostazioni iniziali"
|
976 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
977 |
#~ msgid "%field_1% and %field_2% fields cannot be empty"
|
978 |
#~ msgstr "I campi %field_1% e %field_2% non possono essere vuoti"
|
979 |
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
|
6 |
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
|
7 |
+
"POT-Creation-Date: 2015-11-16 12:23+0100\n"
|
8 |
+
"PO-Revision-Date: 2015-11-16 12:24+0100\n"
|
9 |
"Last-Translator: \n"
|
10 |
+
"Language-Team: YIThemes <plugins@yithemes.com>\n"
|
11 |
+
"Language: it_IT\n"
|
12 |
"MIME-Version: 1.0\n"
|
13 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
+
"X-Generator: Poedit 1.8.1\n"
|
16 |
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
|
17 |
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
|
18 |
"esc_html_x:1,2c\n"
|
136 |
msgstr "Tipologia"
|
137 |
|
138 |
#: lib/yit-cpt-unlimited.php:1052
|
139 |
+
#, php-format
|
140 |
+
msgid "Layout for this %s"
|
141 |
+
msgstr ""
|
142 |
|
143 |
#: lib/yit-cpt-unlimited.php:1058
|
144 |
msgid "Rewrite"
|
221 |
msgstr "Aggiungi %s dalla immagini"
|
222 |
|
223 |
#: lib/yit-cpt-unlimited.php:1633
|
224 |
+
msgid "Upload multiple files"
|
225 |
+
msgstr ""
|
226 |
|
227 |
+
#: lib/yit-plugin-panel-wc.php:336
|
228 |
msgid "The changes you have made will be lost if you leave this page."
|
229 |
msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
|
230 |
|
232 |
msgid "Plugin Settings"
|
233 |
msgstr "Impostazioni plugin"
|
234 |
|
235 |
+
#: lib/yit-plugin-panel.php:96 lib/yit-plugin-subpanel.php:101
|
236 |
msgid "YIT Plugins"
|
237 |
msgstr "YIT Plugins"
|
238 |
|
239 |
+
#: lib/yit-plugin-panel.php:288 lib/yit-plugin-subpanel.php:143
|
240 |
#: templates/panel/woocommerce/woocommerce-form.php:5
|
241 |
msgid "Save Changes"
|
242 |
msgstr "Salva modifiche"
|
243 |
|
244 |
+
#: lib/yit-plugin-panel.php:291 templates/panel/woocommerce/woocommerce-form.php:8
|
245 |
msgid "If you continue with this action, you will reset all options in this page."
|
246 |
msgstr ""
|
247 |
"Se prosegui con questa azione, tutte le opzioni di questa pagina saranno "
|
248 |
"reimpostate."
|
249 |
|
250 |
+
#: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
|
251 |
+
msgid "Reset to default"
|
252 |
+
msgstr ""
|
253 |
|
254 |
+
#: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
|
255 |
+
#: templates/panel/woocommerce/woocommerce-form.php:11
|
256 |
msgid "Are you sure?"
|
257 |
msgstr "Sei sicuro?"
|
258 |
|
259 |
+
#: lib/yit-plugin-panel.php:427
|
260 |
msgid "The element you have entered already exists. Please, enter another name."
|
261 |
msgstr "L'elemento inserito esiste già. Per favore, inserisci un altro nome."
|
262 |
|
263 |
+
#: lib/yit-plugin-panel.php:428
|
264 |
msgid "Settings saved"
|
265 |
msgstr "Impostazioni salvate"
|
266 |
|
267 |
+
#: lib/yit-plugin-panel.php:429
|
268 |
msgid "Settings reset"
|
269 |
msgstr "Impostazioni azzerate"
|
270 |
|
271 |
+
#: lib/yit-plugin-panel.php:430
|
272 |
msgid "Element deleted correctly."
|
273 |
msgstr "Elemento rimosso correttamente."
|
274 |
|
275 |
+
#: lib/yit-plugin-panel.php:431 lib/yit-plugin-panel.php:432
|
276 |
msgid "Element updated correctly."
|
277 |
msgstr "Elemento aggiornato correttamente."
|
278 |
|
279 |
+
#: lib/yit-plugin-panel.php:433
|
280 |
msgid "Database imported correctly."
|
281 |
msgstr "Database importato correttamente."
|
282 |
|
283 |
+
#: lib/yit-plugin-panel.php:434
|
284 |
msgid "An error has occurred during import. Please try again."
|
285 |
msgstr "Si è verificato un errore durante l'importazione. Prova di nuovo."
|
286 |
|
287 |
+
#: lib/yit-plugin-panel.php:435
|
288 |
msgid "The added file is not valid."
|
289 |
msgstr "Il file aggiunto non è valido."
|
290 |
|
291 |
+
#: lib/yit-plugin-panel.php:436
|
292 |
msgid "Sorry, import is disabled."
|
293 |
msgstr "Ci dispiace, l'importazione è disabilitata."
|
294 |
|
295 |
+
#: lib/yit-plugin-panel.php:437
|
296 |
msgid "Sorting successful."
|
297 |
msgstr "Ordinamento effettuato con successo."
|
298 |
|
299 |
+
#: lib/yit-plugin-subpanel.php:146
|
300 |
msgid ""
|
301 |
"If you continue with this action, you will reset all the options in this page."
|
302 |
msgstr ""
|
368 |
msgid "Update now."
|
369 |
msgstr "Aggiorna adesso."
|
370 |
|
371 |
+
#: lib/yit-upgrade.php:250
|
372 |
msgid "Yithemes Repository"
|
373 |
msgstr "Repository YIThemes"
|
374 |
|
375 |
+
#: lib/yit-upgrade.php:284
|
376 |
msgid "Invalid URL Provided."
|
377 |
msgstr "L'URL inserito non è valido."
|
378 |
|
379 |
+
#: lib/yit-upgrade.php:297
|
380 |
msgid "Could not create Temporary file."
|
381 |
msgstr "Non è stato possibile creare il file temporaneo."
|
382 |
|
383 |
+
#: lib/yit-upgrade.php:439
|
384 |
#, php-format
|
385 |
msgid ""
|
386 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
389 |
"È disponibile una nuova versione di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
|
390 |
"changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a>."
|
391 |
|
392 |
+
#: lib/yit-upgrade.php:441
|
393 |
#, php-format
|
394 |
msgid ""
|
395 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
402 |
"<em>Per poter usufruire degli aggiornamenti automatici è necessario attivare il "
|
403 |
"plugin su un solo sito.</em>"
|
404 |
|
405 |
+
#: lib/yit-upgrade.php:443
|
406 |
#, php-format
|
407 |
msgid ""
|
408 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
409 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>Automatic "
|
410 |
+
"update is unavailable for this plugin, please <a href=\"%5$s\" title=\"License "
|
411 |
"activation\">activate</a> your copy of %6s.</em>"
|
412 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
+
#: lib/yit-upgrade.php:445
|
415 |
#, php-format
|
416 |
msgid ""
|
417 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
422 |
"changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a> "
|
423 |
"oppure <a href=\"%5$s\">aggiorna adesso</a>."
|
424 |
|
425 |
+
#: lib/yit-upgrade.php:518
|
426 |
msgid "You can't update the plugins for this site."
|
427 |
msgstr "Non è possibile aggiornare i plugin per questo sito."
|
428 |
|
429 |
+
#: lib/yit-upgrade.php:522
|
430 |
msgid "You do not have sufficient permissions to update the plugins for this site."
|
431 |
msgstr ""
|
432 |
"Non sei in possesso delle autorizzazioni necessarie per aggiornare i plugin in "
|
433 |
"questo sito."
|
434 |
|
435 |
+
#: lib/yit-upgrade.php:529
|
436 |
msgid "Update Plugin"
|
437 |
msgstr "Aggiorna plugin"
|
438 |
|
439 |
+
#: licence/lib/yit-licence.php:170
|
440 |
#, php-format
|
441 |
msgctxt "%s = field name"
|
442 |
msgid "%s field cannot be empty"
|
443 |
msgstr "Il campo %s non può essere vuoto"
|
444 |
|
445 |
+
#: licence/lib/yit-licence.php:171
|
446 |
#, php-format
|
447 |
msgid "%s and %s fields cannot be empty"
|
448 |
msgstr "I campi %s e %s non possono essere vuoti"
|
449 |
|
450 |
+
#: licence/lib/yit-licence.php:172
|
451 |
msgid "Unable to contact the remote server, please try again later. Thanks!"
|
452 |
msgstr "Impossibile contattare il server remoto, prova più tardi. Grazie!"
|
453 |
|
454 |
+
#: licence/lib/yit-licence.php:173
|
455 |
+
#: licence/templates/panel/activation/activation-panel.php:89
|
456 |
+
#: licence/templates/panel/activation/activation-panel.php:164
|
457 |
+
#: licence/templates/panel/activation/activation-panel.php:195
|
458 |
+
#: templates/metaboxes/types/contactform.php:148
|
459 |
+
#: templates/metaboxes/types/contactform.php:340
|
460 |
+
msgid "Email"
|
461 |
+
msgstr "Email"
|
462 |
+
|
463 |
+
#: licence/lib/yit-licence.php:174
|
464 |
+
#: licence/templates/panel/activation/activation-panel.php:90
|
465 |
+
#: licence/templates/panel/activation/activation-panel.php:165
|
466 |
+
#: licence/templates/panel/activation/activation-panel.php:196
|
467 |
+
msgid "License Key"
|
468 |
+
msgstr ""
|
469 |
+
|
470 |
+
#: licence/lib/yit-licence.php:175
|
471 |
+
msgid "Are you sure you want to deactivate the license for current site?"
|
472 |
+
msgstr ""
|
473 |
+
|
474 |
+
#: licence/lib/yit-licence.php:638
|
475 |
msgid "Invalid Request"
|
476 |
msgstr "Richiesta non valida"
|
477 |
|
478 |
+
#: licence/lib/yit-licence.php:639
|
479 |
+
msgid "Invalid license key"
|
480 |
+
msgstr ""
|
481 |
|
482 |
+
#: licence/lib/yit-licence.php:640
|
483 |
msgid "Software has been deactivated"
|
484 |
msgstr "Il software è stato disattivato"
|
485 |
|
486 |
+
#: licence/lib/yit-licence.php:641
|
487 |
msgid "Maximum number of activations exceeded"
|
488 |
msgstr "Hai raggiunto il numero massimo di attivazioni"
|
489 |
|
490 |
+
#: licence/lib/yit-licence.php:642
|
491 |
msgid "Invalid instance ID"
|
492 |
msgstr "Istanza ID non valida"
|
493 |
|
494 |
+
#: licence/lib/yit-licence.php:643
|
495 |
msgid "Invalid security key"
|
496 |
msgstr "Chiave di sicurezza non valida"
|
497 |
|
498 |
+
#: licence/lib/yit-licence.php:644
|
499 |
+
msgid "License key has expired"
|
500 |
+
msgstr ""
|
501 |
+
|
502 |
+
#: licence/lib/yit-licence.php:645
|
503 |
+
msgid "License key has been banned"
|
504 |
+
msgstr ""
|
505 |
+
|
506 |
+
#: licence/lib/yit-licence.php:646
|
507 |
+
msgid "Great"
|
508 |
+
msgstr ""
|
509 |
+
|
510 |
+
#: licence/lib/yit-licence.php:646
|
511 |
+
msgid "License successfully activated"
|
512 |
+
msgstr ""
|
513 |
|
514 |
+
#: licence/lib/yit-licence.php:647
|
515 |
+
msgid "License key deactivated for website"
|
516 |
+
msgstr ""
|
517 |
|
518 |
+
#: licence/lib/yit-plugin-licence.php:68 licence/lib/yit-plugin-licence.php:69
|
519 |
+
#: licence/lib/yit-theme-licence.php:70 licence/lib/yit-theme-licence.php:71
|
520 |
+
#: licence/lib/yit-theme-licence.php:110 licence/lib/yit-theme-licence.php:111
|
521 |
+
msgid "License Activation"
|
522 |
+
msgstr ""
|
523 |
|
524 |
+
#: licence/lib/yit-theme-licence.php:118 licence/lib/yit-theme-licence.php:119
|
525 |
#, php-format
|
526 |
msgid "%s"
|
527 |
msgstr "%s"
|
528 |
|
529 |
+
#: licence/lib/yit-theme-licence.php:160
|
|
|
|
|
|
|
|
|
530 |
msgid ""
|
531 |
"I cannot find the license key for activating the theme I have bought some time "
|
532 |
"ago. Where can I find it?"
|
534 |
"Non riesco a trovare la chiave di licenza per l'attivazione del tema che ho "
|
535 |
"acquistato diverso tempo fa. Dove posso trovarla?"
|
536 |
|
537 |
+
#: licence/lib/yit-theme-licence.php:163
|
538 |
msgid ""
|
539 |
"If you have purchased one of our products before 27 January 2015, you can benefit "
|
540 |
"from support and updates (the services offered with the license)\n"
|
541 |
+
" until 27 January 2016 and you do not have to purchase it again "
|
542 |
+
"to get a new license key, because, before this date, your license used to be "
|
543 |
+
"activated automatically by our system.\n"
|
544 |
+
" After 27 January 2016, instead, if you want to benefit from "
|
545 |
+
"support and updates you have to buy a new license and activate it through the "
|
546 |
+
"license key you will be\n"
|
547 |
+
" provided with and that you can find in your YIThemes account, "
|
548 |
+
"in section \"My licenses\"."
|
549 |
+
msgstr ""
|
550 |
+
|
551 |
+
#: licence/templates/panel/activation/activation-panel.php:22
|
552 |
+
msgid "Yithemes License Activation"
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
+
#: licence/templates/panel/activation/activation-panel.php:28
|
|
|
|
|
|
|
|
|
|
|
556 |
msgid ""
|
557 |
"Have you updated your licenses? Have you asked for an extension? Update "
|
558 |
"information concerning your products."
|
560 |
"Hai aggiornato la tua licenza? Hai richiesto un'estensione? Aggiorna le "
|
561 |
"informazioni dei tuoi prodotti."
|
562 |
|
563 |
+
#: licence/templates/panel/activation/activation-panel.php:30
|
564 |
+
msgid "Update license information"
|
565 |
+
msgstr ""
|
566 |
|
567 |
+
#: licence/templates/panel/activation/activation-panel.php:43
|
568 |
+
msgid "Product to activate"
|
569 |
+
msgid_plural "Products to activate"
|
570 |
+
msgstr[0] ""
|
571 |
+
msgstr[1] ""
|
572 |
|
573 |
+
#: licence/templates/panel/activation/activation-panel.php:62
|
574 |
msgid "Activate"
|
575 |
msgstr "Attiva"
|
576 |
|
577 |
+
#: licence/templates/panel/activation/activation-panel.php:81
|
578 |
msgid "Activated"
|
579 |
msgstr "Attivato"
|
580 |
|
581 |
+
#: licence/templates/panel/activation/activation-panel.php:87
|
582 |
+
#: licence/templates/panel/activation/activation-panel.php:162
|
583 |
+
#: licence/templates/panel/activation/activation-panel.php:192
|
584 |
msgid "Product Name"
|
585 |
msgstr "Nome prodotto"
|
586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
#: licence/templates/panel/activation/activation-panel.php:93
|
588 |
+
#: licence/templates/panel/activation/activation-panel.php:199
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
msgid "Expires"
|
590 |
msgstr "Scadenza"
|
591 |
|
592 |
+
#: licence/templates/panel/activation/activation-panel.php:96
|
593 |
msgid "Remaining"
|
594 |
msgstr "Tempo rimanente"
|
595 |
|
596 |
+
#: licence/templates/panel/activation/activation-panel.php:97
|
597 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
598 |
+
msgid "Membership"
|
599 |
+
msgstr ""
|
|
|
|
|
600 |
|
601 |
+
#: licence/templates/panel/activation/activation-panel.php:100
|
602 |
+
msgid "License Actions"
|
603 |
+
msgstr ""
|
604 |
+
|
605 |
+
#: licence/templates/panel/activation/activation-panel.php:125
|
606 |
#, php-format
|
607 |
msgid "%1s out of %2s"
|
608 |
msgstr "%1s di %2s"
|
609 |
|
610 |
+
#: licence/templates/panel/activation/activation-panel.php:140
|
611 |
+
msgid "Deactivate"
|
612 |
+
msgstr ""
|
613 |
+
|
614 |
+
#: licence/templates/panel/activation/activation-panel.php:145
|
615 |
+
#: licence/templates/panel/activation/activation-panel.php:202
|
616 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
617 |
+
msgid "Renew"
|
618 |
+
msgstr "Rinnova"
|
619 |
+
|
620 |
+
#: licence/templates/panel/activation/activation-panel.php:158
|
621 |
msgid "Banned"
|
622 |
msgstr "Bloccato"
|
623 |
|
624 |
+
#: licence/templates/panel/activation/activation-panel.php:188
|
625 |
msgid "Expired"
|
626 |
msgstr "Non più valido"
|
627 |
|
628 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
629 |
+
msgid "License"
|
630 |
+
msgstr ""
|
631 |
+
|
632 |
#: templates/metaboxes/types/ajax-products.php:23
|
633 |
msgid "Search for a product"
|
634 |
msgstr "Cerca un prodotto"
|
825 |
#: templates/metaboxes/types/icon-list.php:69
|
826 |
#: templates/metaboxes/types/select-icon.php:33
|
827 |
#: templates/metaboxes/types/upload.php:21 templates/panel/types/upload.php:31
|
828 |
+
#: templates/panel/woocommerce/woocommerce-upload.php:40
|
829 |
msgid "Upload"
|
830 |
msgstr "Carica"
|
831 |
|
993 |
msgid "Italic bold"
|
994 |
msgstr "Grassetto corsivo"
|
995 |
|
996 |
+
#: templates/panel/woocommerce/woocommerce-form.php:11
|
997 |
msgid "Reset Defaults"
|
998 |
msgstr "Ripristina impostazioni iniziali"
|
999 |
|
1000 |
+
#~ msgid "Layout for this "
|
1001 |
+
#~ msgstr "Layout per questo"
|
1002 |
+
|
1003 |
+
#~ msgid "Add with multiupload"
|
1004 |
+
#~ msgstr "Aggiungi con caricamento multiplo"
|
1005 |
+
|
1006 |
+
#~ msgid "Reset to Default"
|
1007 |
+
#~ msgstr "Ripristina impostazioni iniziali"
|
1008 |
+
|
1009 |
+
#~ msgid ""
|
1010 |
+
#~ "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
1011 |
+
#~ "changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>Automatic "
|
1012 |
+
#~ "update is unavailable for this plugin, please <a href=\"%5$s\" title=\"Licence "
|
1013 |
+
#~ "activation\">activate</a> your copy of %6s.</em>"
|
1014 |
+
#~ msgstr ""
|
1015 |
+
#~ "È disponibile una nuova versioni di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
|
1016 |
+
#~ "changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</"
|
1017 |
+
#~ "a>. <em>Gli aggiornamenti automatici non sono disponibili per questo plugi, per "
|
1018 |
+
#~ "favore, <a href=\"%5$s\" title=\"Licence activation\">attiva</a> la tua copia "
|
1019 |
+
#~ "di %6s.</em>"
|
1020 |
+
|
1021 |
+
#~ msgid "Invalid licence key"
|
1022 |
+
#~ msgstr "Chiave di licenza non valida"
|
1023 |
+
|
1024 |
+
#~ msgid "Licence key has expired"
|
1025 |
+
#~ msgstr "Questa chiave di licenza è scaduta"
|
1026 |
+
|
1027 |
+
#~ msgid "Licence key has been banned"
|
1028 |
+
#~ msgstr "Questa chiave di licenza è stata bloccata"
|
1029 |
+
|
1030 |
+
#~ msgid "Licence Activation"
|
1031 |
+
#~ msgstr "Attivazione licenza"
|
1032 |
+
|
1033 |
+
#~ msgid "Yithemes Licence Activation"
|
1034 |
+
#~ msgstr "Attivazione licenza YIThemes"
|
1035 |
+
|
1036 |
+
#~ msgid ""
|
1037 |
+
#~ "If you have purchased one of our products before 27 January 2015, you can "
|
1038 |
+
#~ "benefit from support and updates (the services offered with the license)\n"
|
1039 |
+
#~ " until 27 January 2016 and you do not have to purchase it again to "
|
1040 |
+
#~ "get a new license key, because, before this date, your license used to be "
|
1041 |
+
#~ "activated automatically by our system.\n"
|
1042 |
+
#~ " After 27 January 2016, instead, if you want to benefit from support "
|
1043 |
+
#~ "and updates you have to buy a new license and activate it through the license "
|
1044 |
+
#~ "key you will be\n"
|
1045 |
+
#~ " provided with and that you can find in your YIThemes account, in "
|
1046 |
+
#~ "section \"My licenses\"."
|
1047 |
+
#~ msgstr ""
|
1048 |
+
#~ "Se hai acquistato un nostro prodotto prima del 27 gennaio 2015 potrai accedere "
|
1049 |
+
#~ "al supporto e scaricare gli aggiornamenti fino al 27 gennaio 2016 e non avrai "
|
1050 |
+
#~ "bisogno di una chiave di licenza,\n"
|
1051 |
+
#~ "in quanto la tua licenza prima di questa data veniva attivata in modo "
|
1052 |
+
#~ "automatico dal nostro sistema.\n"
|
1053 |
+
#~ "Dopo il 27 gennaio 2016, invece, per poter usufruire del servizio di supporto e "
|
1054 |
+
#~ "degli aggiornamenti dovrai riacquistare il prodotto e\n"
|
1055 |
+
#~ "attivarlo con la chiave di licenza che ti sarà fornita e che puoi trovare sul "
|
1056 |
+
#~ "tuo account YIThemes, alla voce \"Le mie licenze\"."
|
1057 |
+
|
1058 |
+
#~ msgid "Update licence information"
|
1059 |
+
#~ msgstr "Aggiorna le informazioni di licenza"
|
1060 |
+
|
1061 |
+
#~ msgid "Products to be activated"
|
1062 |
+
#~ msgstr "Prodotti da attivare"
|
1063 |
+
|
1064 |
+
#~ msgid "Licence Key"
|
1065 |
+
#~ msgstr "Chiave di licenza"
|
1066 |
+
|
1067 |
#~ msgid "%field_1% and %field_2% fields cannot be empty"
|
1068 |
#~ msgstr "I campi %field_1% e %field_2% non possono essere vuoti"
|
1069 |
|
plugin-fw/languages/yith-plugin-fw.pot
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
# Copyright (C) 2015 YIThemes
|
2 |
# This file is distributed under the same license as the YITH Plugin Starter package.
|
|
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
|
6 |
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"PO-Revision-Date: 2015-05-05 10:38+0100\n"
|
9 |
"Last-Translator: \n"
|
10 |
"Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
|
@@ -12,7 +13,7 @@ msgstr ""
|
|
12 |
"MIME-Version: 1.0\n"
|
13 |
"Content-Type: text/plain; charset=utf-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
-
"X-Generator: Poedit 1.
|
16 |
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
|
17 |
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
|
18 |
"esc_html_x:1,2c\n"
|
@@ -136,7 +137,8 @@ msgid "Type"
|
|
136 |
msgstr ""
|
137 |
|
138 |
#: lib/yit-cpt-unlimited.php:1052
|
139 |
-
|
|
|
140 |
msgstr ""
|
141 |
|
142 |
#: lib/yit-cpt-unlimited.php:1058
|
@@ -215,10 +217,10 @@ msgid "Add %s from images"
|
|
215 |
msgstr ""
|
216 |
|
217 |
#: lib/yit-cpt-unlimited.php:1633
|
218 |
-
msgid "
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: lib/yit-plugin-panel-wc.php:
|
222 |
msgid "The changes you have made will be lost if you leave this page."
|
223 |
msgstr ""
|
224 |
|
@@ -226,69 +228,69 @@ msgstr ""
|
|
226 |
msgid "Plugin Settings"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: lib/yit-plugin-panel.php:
|
230 |
msgid "YIT Plugins"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: lib/yit-plugin-panel.php:
|
234 |
#: templates/panel/woocommerce/woocommerce-form.php:5
|
235 |
msgid "Save Changes"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: lib/yit-plugin-panel.php:
|
239 |
msgid "If you continue with this action, you will reset all options in this page."
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: lib/yit-plugin-panel.php:
|
243 |
-
msgid "Reset to
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: lib/yit-plugin-panel.php:
|
247 |
-
#: templates/panel/woocommerce/woocommerce-form.php:
|
248 |
msgid "Are you sure?"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: lib/yit-plugin-panel.php:
|
252 |
msgid "The element you have entered already exists. Please, enter another name."
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: lib/yit-plugin-panel.php:
|
256 |
msgid "Settings saved"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: lib/yit-plugin-panel.php:
|
260 |
msgid "Settings reset"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: lib/yit-plugin-panel.php:
|
264 |
msgid "Element deleted correctly."
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: lib/yit-plugin-panel.php:
|
268 |
msgid "Element updated correctly."
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: lib/yit-plugin-panel.php:
|
272 |
msgid "Database imported correctly."
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: lib/yit-plugin-panel.php:
|
276 |
msgid "An error has occurred during import. Please try again."
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: lib/yit-plugin-panel.php:
|
280 |
msgid "The added file is not valid."
|
281 |
msgstr ""
|
282 |
|
283 |
-
#: lib/yit-plugin-panel.php:
|
284 |
msgid "Sorry, import is disabled."
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: lib/yit-plugin-panel.php:
|
288 |
msgid "Sorting successful."
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: lib/yit-plugin-subpanel.php:
|
292 |
msgid ""
|
293 |
"If you continue with this action, you will reset all the options in this page."
|
294 |
msgstr ""
|
@@ -347,26 +349,26 @@ msgstr ""
|
|
347 |
msgid "Update now."
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: lib/yit-upgrade.php:
|
351 |
msgid "Yithemes Repository"
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: lib/yit-upgrade.php:
|
355 |
msgid "Invalid URL Provided."
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: lib/yit-upgrade.php:
|
359 |
msgid "Could not create Temporary file."
|
360 |
msgstr ""
|
361 |
|
362 |
-
#: lib/yit-upgrade.php:
|
363 |
#, php-format
|
364 |
msgid ""
|
365 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
366 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>."
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: lib/yit-upgrade.php:
|
370 |
#, php-format
|
371 |
msgid ""
|
372 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
@@ -375,16 +377,16 @@ msgid ""
|
|
375 |
"updates.</em>"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: lib/yit-upgrade.php:
|
379 |
#, php-format
|
380 |
msgid ""
|
381 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
382 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>Automatic "
|
383 |
-
"update is unavailable for this plugin, please <a href=\"%5$s\" title=\"
|
384 |
"activation\">activate</a> your copy of %6s.</em>"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: lib/yit-upgrade.php:
|
388 |
#, php-format
|
389 |
msgid ""
|
390 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
@@ -392,169 +394,207 @@ msgid ""
|
|
392 |
"\">update now</a>."
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: lib/yit-upgrade.php:
|
396 |
msgid "You can't update the plugins for this site."
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: lib/yit-upgrade.php:
|
400 |
msgid "You do not have sufficient permissions to update the plugins for this site."
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: lib/yit-upgrade.php:
|
404 |
msgid "Update Plugin"
|
405 |
msgstr ""
|
406 |
|
407 |
-
#: licence/lib/yit-licence.php:
|
408 |
#, php-format
|
409 |
-
|
|
|
410 |
msgstr ""
|
411 |
|
412 |
-
#: licence/lib/yit-licence.php:
|
413 |
-
|
|
|
414 |
msgstr ""
|
415 |
|
416 |
-
#: licence/lib/yit-licence.php:
|
417 |
msgid "Unable to contact the remote server, please try again later. Thanks!"
|
418 |
msgstr ""
|
419 |
|
420 |
-
#: licence/lib/yit-licence.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
msgid "Invalid Request"
|
422 |
msgstr ""
|
423 |
|
424 |
-
#: licence/lib/yit-licence.php:
|
425 |
-
msgid "Invalid
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: licence/lib/yit-licence.php:
|
429 |
msgid "Software has been deactivated"
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: licence/lib/yit-licence.php:
|
433 |
msgid "Maximum number of activations exceeded"
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: licence/lib/yit-licence.php:
|
437 |
msgid "Invalid instance ID"
|
438 |
msgstr ""
|
439 |
|
440 |
-
#: licence/lib/yit-licence.php:
|
441 |
msgid "Invalid security key"
|
442 |
msgstr ""
|
443 |
|
444 |
-
#: licence/lib/yit-licence.php:
|
445 |
-
msgid "
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: licence/lib/yit-licence.php:
|
449 |
-
msgid "
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: licence/lib/yit-
|
453 |
-
|
454 |
-
#: licence/lib/yit-theme-licence.php:107 licence/lib/yit-theme-licence.php:108
|
455 |
-
msgid "Licence Activation"
|
456 |
msgstr ""
|
457 |
|
458 |
-
#: licence/lib/yit-
|
459 |
-
|
460 |
-
msgid "%s"
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: licence/
|
464 |
-
msgid "
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: licence/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
msgid ""
|
469 |
"I cannot find the license key for activating the theme I have bought some time "
|
470 |
"ago. Where can I find it?"
|
471 |
msgstr ""
|
472 |
|
473 |
-
#: licence/
|
474 |
msgid ""
|
475 |
"If you have purchased one of our products before 27 January 2015, you can benefit "
|
476 |
"from support and updates (the services offered with the license)\n"
|
477 |
-
"
|
478 |
-
"a new license key, because, before this date, your license used to be
|
479 |
-
"automatically by our system.\n"
|
480 |
-
"
|
481 |
-
"and updates you have to buy a new license and activate it through the
|
482 |
-
"you will be\n"
|
483 |
-
"
|
484 |
-
"section \"My licenses\"."
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
|
|
|
|
|
|
|
|
488 |
msgid ""
|
489 |
"Have you updated your licenses? Have you asked for an extension? Update "
|
490 |
"information concerning your products."
|
491 |
msgstr ""
|
492 |
|
493 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
494 |
-
msgid "Update
|
495 |
msgstr ""
|
496 |
|
497 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
498 |
-
msgid "
|
499 |
-
|
|
|
|
|
500 |
|
501 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
502 |
msgid "Activate"
|
503 |
msgstr ""
|
504 |
|
505 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
506 |
msgid "Activated"
|
507 |
msgstr ""
|
508 |
|
509 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
510 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
511 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
512 |
msgid "Product Name"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: licence/templates/panel/activation/activation-panel.php:92
|
516 |
-
#: licence/templates/panel/activation/activation-panel.php:124
|
517 |
-
#: licence/templates/panel/activation/activation-panel.php:148
|
518 |
-
#: templates/metaboxes/types/contactform.php:148
|
519 |
-
#: templates/metaboxes/types/contactform.php:340
|
520 |
-
msgid "Email"
|
521 |
-
msgstr ""
|
522 |
-
|
523 |
#: licence/templates/panel/activation/activation-panel.php:93
|
524 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
525 |
-
#: licence/templates/panel/activation/activation-panel.php:149
|
526 |
-
msgid "Licence Key"
|
527 |
-
msgstr ""
|
528 |
-
|
529 |
-
#: licence/templates/panel/activation/activation-panel.php:94
|
530 |
-
#: licence/templates/panel/activation/activation-panel.php:150
|
531 |
msgid "Expires"
|
532 |
msgstr ""
|
533 |
|
534 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
535 |
msgid "Remaining"
|
536 |
msgstr ""
|
537 |
|
538 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
539 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
540 |
-
|
541 |
-
|
542 |
-
|
|
|
|
|
543 |
msgstr ""
|
544 |
|
545 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
546 |
#, php-format
|
547 |
msgid "%1s out of %2s"
|
548 |
msgstr ""
|
549 |
|
550 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
msgid "Banned"
|
552 |
msgstr ""
|
553 |
|
554 |
-
#: licence/templates/panel/activation/activation-panel.php:
|
555 |
msgid "Expired"
|
556 |
msgstr ""
|
557 |
|
|
|
|
|
|
|
|
|
558 |
#: templates/metaboxes/types/ajax-products.php:23
|
559 |
msgid "Search for a product"
|
560 |
msgstr ""
|
@@ -630,7 +670,7 @@ msgstr ""
|
|
630 |
|
631 |
#: templates/metaboxes/types/contactform.php:77
|
632 |
#: templates/metaboxes/types/contactform.php:269
|
633 |
-
msgid "Title
|
634 |
msgstr ""
|
635 |
|
636 |
#: templates/metaboxes/types/contactform.php:81
|
@@ -652,7 +692,7 @@ msgstr ""
|
|
652 |
|
653 |
#: templates/metaboxes/types/contactform.php:95
|
654 |
#: templates/metaboxes/types/contactform.php:287
|
655 |
-
msgid "Type
|
656 |
msgstr ""
|
657 |
|
658 |
#: templates/metaboxes/types/contactform.php:103
|
@@ -747,7 +787,7 @@ msgstr ""
|
|
747 |
#: templates/metaboxes/types/icon-list.php:69
|
748 |
#: templates/metaboxes/types/select-icon.php:33
|
749 |
#: templates/metaboxes/types/upload.php:21 templates/panel/types/upload.php:31
|
750 |
-
#: templates/panel/woocommerce/woocommerce-upload.php:
|
751 |
msgid "Upload"
|
752 |
msgstr ""
|
753 |
|
@@ -915,6 +955,6 @@ msgstr ""
|
|
915 |
msgid "Italic bold"
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: templates/panel/woocommerce/woocommerce-form.php:
|
919 |
msgid "Reset Defaults"
|
920 |
msgstr ""
|
1 |
# Copyright (C) 2015 YIThemes
|
2 |
# This file is distributed under the same license as the YITH Plugin Starter package.
|
3 |
+
#, fuzzy
|
4 |
msgid ""
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
|
7 |
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
+
"POT-Creation-Date: 2015-11-16 12:23+0100\n"
|
9 |
"PO-Revision-Date: 2015-05-05 10:38+0100\n"
|
10 |
"Last-Translator: \n"
|
11 |
"Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
|
13 |
"MIME-Version: 1.0\n"
|
14 |
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Generator: Poedit 1.8.1\n"
|
17 |
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
|
18 |
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
|
19 |
"esc_html_x:1,2c\n"
|
137 |
msgstr ""
|
138 |
|
139 |
#: lib/yit-cpt-unlimited.php:1052
|
140 |
+
#, php-format
|
141 |
+
msgid "Layout for this %s"
|
142 |
msgstr ""
|
143 |
|
144 |
#: lib/yit-cpt-unlimited.php:1058
|
217 |
msgstr ""
|
218 |
|
219 |
#: lib/yit-cpt-unlimited.php:1633
|
220 |
+
msgid "Upload multiple files"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: lib/yit-plugin-panel-wc.php:336
|
224 |
msgid "The changes you have made will be lost if you leave this page."
|
225 |
msgstr ""
|
226 |
|
228 |
msgid "Plugin Settings"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: lib/yit-plugin-panel.php:96 lib/yit-plugin-subpanel.php:101
|
232 |
msgid "YIT Plugins"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: lib/yit-plugin-panel.php:288 lib/yit-plugin-subpanel.php:143
|
236 |
#: templates/panel/woocommerce/woocommerce-form.php:5
|
237 |
msgid "Save Changes"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: lib/yit-plugin-panel.php:291 templates/panel/woocommerce/woocommerce-form.php:8
|
241 |
msgid "If you continue with this action, you will reset all options in this page."
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
|
245 |
+
msgid "Reset to default"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
|
249 |
+
#: templates/panel/woocommerce/woocommerce-form.php:11
|
250 |
msgid "Are you sure?"
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: lib/yit-plugin-panel.php:427
|
254 |
msgid "The element you have entered already exists. Please, enter another name."
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: lib/yit-plugin-panel.php:428
|
258 |
msgid "Settings saved"
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: lib/yit-plugin-panel.php:429
|
262 |
msgid "Settings reset"
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: lib/yit-plugin-panel.php:430
|
266 |
msgid "Element deleted correctly."
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: lib/yit-plugin-panel.php:431 lib/yit-plugin-panel.php:432
|
270 |
msgid "Element updated correctly."
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: lib/yit-plugin-panel.php:433
|
274 |
msgid "Database imported correctly."
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: lib/yit-plugin-panel.php:434
|
278 |
msgid "An error has occurred during import. Please try again."
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: lib/yit-plugin-panel.php:435
|
282 |
msgid "The added file is not valid."
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: lib/yit-plugin-panel.php:436
|
286 |
msgid "Sorry, import is disabled."
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: lib/yit-plugin-panel.php:437
|
290 |
msgid "Sorting successful."
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: lib/yit-plugin-subpanel.php:146
|
294 |
msgid ""
|
295 |
"If you continue with this action, you will reset all the options in this page."
|
296 |
msgstr ""
|
349 |
msgid "Update now."
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: lib/yit-upgrade.php:250
|
353 |
msgid "Yithemes Repository"
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: lib/yit-upgrade.php:284
|
357 |
msgid "Invalid URL Provided."
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: lib/yit-upgrade.php:297
|
361 |
msgid "Could not create Temporary file."
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: lib/yit-upgrade.php:439
|
365 |
#, php-format
|
366 |
msgid ""
|
367 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
368 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>."
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: lib/yit-upgrade.php:441
|
372 |
#, php-format
|
373 |
msgid ""
|
374 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
377 |
"updates.</em>"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: lib/yit-upgrade.php:443
|
381 |
#, php-format
|
382 |
msgid ""
|
383 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
384 |
"changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>Automatic "
|
385 |
+
"update is unavailable for this plugin, please <a href=\"%5$s\" title=\"License "
|
386 |
"activation\">activate</a> your copy of %6s.</em>"
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: lib/yit-upgrade.php:445
|
390 |
#, php-format
|
391 |
msgid ""
|
392 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
|
394 |
"\">update now</a>."
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: lib/yit-upgrade.php:518
|
398 |
msgid "You can't update the plugins for this site."
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: lib/yit-upgrade.php:522
|
402 |
msgid "You do not have sufficient permissions to update the plugins for this site."
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: lib/yit-upgrade.php:529
|
406 |
msgid "Update Plugin"
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: licence/lib/yit-licence.php:170
|
410 |
#, php-format
|
411 |
+
msgctxt "%s = field name"
|
412 |
+
msgid "%s field cannot be empty"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: licence/lib/yit-licence.php:171
|
416 |
+
#, php-format
|
417 |
+
msgid "%s and %s fields cannot be empty"
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: licence/lib/yit-licence.php:172
|
421 |
msgid "Unable to contact the remote server, please try again later. Thanks!"
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: licence/lib/yit-licence.php:173
|
425 |
+
#: licence/templates/panel/activation/activation-panel.php:89
|
426 |
+
#: licence/templates/panel/activation/activation-panel.php:164
|
427 |
+
#: licence/templates/panel/activation/activation-panel.php:195
|
428 |
+
#: templates/metaboxes/types/contactform.php:148
|
429 |
+
#: templates/metaboxes/types/contactform.php:340
|
430 |
+
msgid "Email"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
+
#: licence/lib/yit-licence.php:174
|
434 |
+
#: licence/templates/panel/activation/activation-panel.php:90
|
435 |
+
#: licence/templates/panel/activation/activation-panel.php:165
|
436 |
+
#: licence/templates/panel/activation/activation-panel.php:196
|
437 |
+
msgid "License Key"
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
#: licence/lib/yit-licence.php:175
|
441 |
+
msgid "Are you sure you want to deactivate the license for current site?"
|
442 |
+
msgstr ""
|
443 |
+
|
444 |
+
#: licence/lib/yit-licence.php:638
|
445 |
msgid "Invalid Request"
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: licence/lib/yit-licence.php:639
|
449 |
+
msgid "Invalid license key"
|
450 |
msgstr ""
|
451 |
|
452 |
+
#: licence/lib/yit-licence.php:640
|
453 |
msgid "Software has been deactivated"
|
454 |
msgstr ""
|
455 |
|
456 |
+
#: licence/lib/yit-licence.php:641
|
457 |
msgid "Maximum number of activations exceeded"
|
458 |
msgstr ""
|
459 |
|
460 |
+
#: licence/lib/yit-licence.php:642
|
461 |
msgid "Invalid instance ID"
|
462 |
msgstr ""
|
463 |
|
464 |
+
#: licence/lib/yit-licence.php:643
|
465 |
msgid "Invalid security key"
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: licence/lib/yit-licence.php:644
|
469 |
+
msgid "License key has expired"
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: licence/lib/yit-licence.php:645
|
473 |
+
msgid "License key has been banned"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: licence/lib/yit-licence.php:646
|
477 |
+
msgid "Great"
|
|
|
|
|
478 |
msgstr ""
|
479 |
|
480 |
+
#: licence/lib/yit-licence.php:646
|
481 |
+
msgid "License successfully activated"
|
|
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: licence/lib/yit-licence.php:647
|
485 |
+
msgid "License key deactivated for website"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: licence/lib/yit-plugin-licence.php:68 licence/lib/yit-plugin-licence.php:69
|
489 |
+
#: licence/lib/yit-theme-licence.php:70 licence/lib/yit-theme-licence.php:71
|
490 |
+
#: licence/lib/yit-theme-licence.php:110 licence/lib/yit-theme-licence.php:111
|
491 |
+
msgid "License Activation"
|
492 |
+
msgstr ""
|
493 |
+
|
494 |
+
#: licence/lib/yit-theme-licence.php:118 licence/lib/yit-theme-licence.php:119
|
495 |
+
#, php-format
|
496 |
+
msgid "%s"
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: licence/lib/yit-theme-licence.php:160
|
500 |
msgid ""
|
501 |
"I cannot find the license key for activating the theme I have bought some time "
|
502 |
"ago. Where can I find it?"
|
503 |
msgstr ""
|
504 |
|
505 |
+
#: licence/lib/yit-theme-licence.php:163
|
506 |
msgid ""
|
507 |
"If you have purchased one of our products before 27 January 2015, you can benefit "
|
508 |
"from support and updates (the services offered with the license)\n"
|
509 |
+
" until 27 January 2016 and you do not have to purchase it again "
|
510 |
+
"to get a new license key, because, before this date, your license used to be "
|
511 |
+
"activated automatically by our system.\n"
|
512 |
+
" After 27 January 2016, instead, if you want to benefit from "
|
513 |
+
"support and updates you have to buy a new license and activate it through the "
|
514 |
+
"license key you will be\n"
|
515 |
+
" provided with and that you can find in your YIThemes account, "
|
516 |
+
"in section \"My licenses\"."
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: licence/templates/panel/activation/activation-panel.php:22
|
520 |
+
msgid "Yithemes License Activation"
|
521 |
+
msgstr ""
|
522 |
+
|
523 |
+
#: licence/templates/panel/activation/activation-panel.php:28
|
524 |
msgid ""
|
525 |
"Have you updated your licenses? Have you asked for an extension? Update "
|
526 |
"information concerning your products."
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: licence/templates/panel/activation/activation-panel.php:30
|
530 |
+
msgid "Update license information"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: licence/templates/panel/activation/activation-panel.php:43
|
534 |
+
msgid "Product to activate"
|
535 |
+
msgid_plural "Products to activate"
|
536 |
+
msgstr[0] ""
|
537 |
+
msgstr[1] ""
|
538 |
|
539 |
+
#: licence/templates/panel/activation/activation-panel.php:62
|
540 |
msgid "Activate"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: licence/templates/panel/activation/activation-panel.php:81
|
544 |
msgid "Activated"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: licence/templates/panel/activation/activation-panel.php:87
|
548 |
+
#: licence/templates/panel/activation/activation-panel.php:162
|
549 |
+
#: licence/templates/panel/activation/activation-panel.php:192
|
550 |
msgid "Product Name"
|
551 |
msgstr ""
|
552 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
#: licence/templates/panel/activation/activation-panel.php:93
|
554 |
+
#: licence/templates/panel/activation/activation-panel.php:199
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
msgid "Expires"
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: licence/templates/panel/activation/activation-panel.php:96
|
559 |
msgid "Remaining"
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: licence/templates/panel/activation/activation-panel.php:97
|
563 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
564 |
+
msgid "Membership"
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: licence/templates/panel/activation/activation-panel.php:100
|
568 |
+
msgid "License Actions"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: licence/templates/panel/activation/activation-panel.php:125
|
572 |
#, php-format
|
573 |
msgid "%1s out of %2s"
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: licence/templates/panel/activation/activation-panel.php:140
|
577 |
+
msgid "Deactivate"
|
578 |
+
msgstr ""
|
579 |
+
|
580 |
+
#: licence/templates/panel/activation/activation-panel.php:145
|
581 |
+
#: licence/templates/panel/activation/activation-panel.php:202
|
582 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
583 |
+
msgid "Renew"
|
584 |
+
msgstr ""
|
585 |
+
|
586 |
+
#: licence/templates/panel/activation/activation-panel.php:158
|
587 |
msgid "Banned"
|
588 |
msgstr ""
|
589 |
|
590 |
+
#: licence/templates/panel/activation/activation-panel.php:188
|
591 |
msgid "Expired"
|
592 |
msgstr ""
|
593 |
|
594 |
+
#: licence/templates/panel/activation/activation-panel.php:223
|
595 |
+
msgid "License"
|
596 |
+
msgstr ""
|
597 |
+
|
598 |
#: templates/metaboxes/types/ajax-products.php:23
|
599 |
msgid "Search for a product"
|
600 |
msgstr ""
|
670 |
|
671 |
#: templates/metaboxes/types/contactform.php:77
|
672 |
#: templates/metaboxes/types/contactform.php:269
|
673 |
+
msgid "Field Title"
|
674 |
msgstr ""
|
675 |
|
676 |
#: templates/metaboxes/types/contactform.php:81
|
692 |
|
693 |
#: templates/metaboxes/types/contactform.php:95
|
694 |
#: templates/metaboxes/types/contactform.php:287
|
695 |
+
msgid "Field Type"
|
696 |
msgstr ""
|
697 |
|
698 |
#: templates/metaboxes/types/contactform.php:103
|
787 |
#: templates/metaboxes/types/icon-list.php:69
|
788 |
#: templates/metaboxes/types/select-icon.php:33
|
789 |
#: templates/metaboxes/types/upload.php:21 templates/panel/types/upload.php:31
|
790 |
+
#: templates/panel/woocommerce/woocommerce-upload.php:40
|
791 |
msgid "Upload"
|
792 |
msgstr ""
|
793 |
|
955 |
msgid "Italic bold"
|
956 |
msgstr ""
|
957 |
|
958 |
+
#: templates/panel/woocommerce/woocommerce-form.php:11
|
959 |
msgid "Reset Defaults"
|
960 |
msgstr ""
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -319,22 +319,27 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
319 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
320 |
*/
|
321 |
public function admin_enqueue_scripts() {
|
322 |
-
global $woocommerce;
|
323 |
|
324 |
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
|
325 |
|
326 |
wp_enqueue_media();
|
327 |
wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
|
328 |
-
|
329 |
wp_enqueue_style ( 'wp-jquery-ui-dialog' );
|
330 |
|
331 |
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
|
332 |
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
|
333 |
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
|
334 |
-
|
335 |
wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
|
336 |
'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
|
337 |
) );
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
339 |
|
340 |
/**
|
319 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
320 |
*/
|
321 |
public function admin_enqueue_scripts() {
|
322 |
+
global $woocommerce, $pagenow;
|
323 |
|
324 |
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
|
325 |
|
326 |
wp_enqueue_media();
|
327 |
wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
|
328 |
+
wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
|
329 |
wp_enqueue_style ( 'wp-jquery-ui-dialog' );
|
330 |
|
331 |
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
|
332 |
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
|
333 |
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
|
334 |
+
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.min.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
|
335 |
wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
|
336 |
'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
|
337 |
) );
|
338 |
+
|
339 |
+
if( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yit-plugins_page' ) !== false ){
|
340 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
341 |
+
wp_enqueue_script( 'yit-plugin-panel' );
|
342 |
+
}
|
343 |
}
|
344 |
|
345 |
/**
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -92,8 +92,12 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
92 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
93 |
*/
|
94 |
public function add_menu_page() {
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
/**
|
@@ -121,27 +125,32 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
121 |
*/
|
122 |
public function admin_enqueue_scripts() {
|
123 |
|
124 |
-
|
125 |
|
126 |
//scripts
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
|
137 |
//styles
|
138 |
-
|
139 |
wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
|
140 |
wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
|
141 |
-
|
142 |
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
|
143 |
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
|
144 |
wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
/**
|
92 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
93 |
*/
|
94 |
public function add_menu_page() {
|
95 |
+
global $admin_page_hooks;
|
96 |
+
|
97 |
+
if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
|
98 |
+
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
|
99 |
+
add_menu_page( 'yit_plugin_panel', __( 'YIT Plugins', 'yith-plugin-fw' ), 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
|
100 |
+
}
|
101 |
}
|
102 |
|
103 |
/**
|
125 |
*/
|
126 |
public function admin_enqueue_scripts() {
|
127 |
|
128 |
+
global $wp_scripts, $pagenow;
|
129 |
|
130 |
//scripts
|
131 |
+
wp_enqueue_media();
|
132 |
+
wp_enqueue_script( 'jquery-ui' );
|
133 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
134 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
135 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
136 |
+
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
|
137 |
+
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
|
138 |
+
wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
|
139 |
+
wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
|
140 |
|
141 |
//styles
|
142 |
+
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
|
143 |
wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
|
144 |
wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
|
145 |
+
wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
|
146 |
wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
|
147 |
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
|
148 |
wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
|
149 |
+
|
150 |
+
if( 'admin.php' == $pagenow && strpos('yit-plugins_page',get_current_screen()->id ) !== false ){
|
151 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
152 |
+
wp_enqueue_script( 'yit-plugin-panel' );
|
153 |
+
}
|
154 |
}
|
155 |
|
156 |
/**
|
plugin-fw/lib/yit-plugin-subpanel.php
CHANGED
@@ -88,22 +88,25 @@ if ( ! class_exists( 'YIT_Plugin_SubPanel' ) ) {
|
|
88 |
* @since 1.0
|
89 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
90 |
*/
|
91 |
-
|
|
|
|
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
|
|
|
|
96 |
|
97 |
-
|
98 |
-
$logo = $admin_logo;
|
99 |
-
}
|
100 |
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
|
101 |
add_menu_page( 'yit_plugin_panel', __( 'YIT Plugins', 'yith-plugin-fw' ), 'nosuchcapability', 'yit_plugin_panel', NULL, $logo, $position );
|
|
|
102 |
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
|
108 |
/**
|
109 |
* Show a tabbed panel to setting page
|
88 |
* @since 1.0
|
89 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
90 |
*/
|
91 |
+
public function add_setting_page() {
|
92 |
+
global $admin_page_hooks;
|
93 |
+
$logo = YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png';
|
94 |
|
95 |
+
$admin_logo = function_exists( 'yit_get_option' ) ? yit_get_option( 'admin-logo-menu' ) : '';
|
96 |
|
97 |
+
if ( isset( $admin_logo ) && !empty( $admin_logo ) && $admin_logo != '' && $admin_logo ) {
|
98 |
+
$logo = $admin_logo;
|
99 |
+
}
|
100 |
|
101 |
+
if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ) {
|
|
|
|
|
102 |
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
|
103 |
add_menu_page( 'yit_plugin_panel', __( 'YIT Plugins', 'yith-plugin-fw' ), 'nosuchcapability', 'yit_plugin_panel', NULL, $logo, $position );
|
104 |
+
}
|
105 |
|
106 |
+
add_submenu_page( 'yit_plugin_panel', $this->settings['label'], $this->settings['label'], 'manage_options', $this->settings['page'], array( $this, 'yit_panel' ) );
|
107 |
+
remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
|
108 |
|
109 |
+
}
|
110 |
|
111 |
/**
|
112 |
* Show a tabbed panel to setting page
|
plugin-fw/lib/yit-upgrade.php
CHANGED
@@ -60,8 +60,10 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
60 |
add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
|
@@ -129,7 +131,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
129 |
);
|
130 |
|
131 |
foreach( $this->_plugins as $init => $info ){
|
132 |
-
YIT_Plugin_Licence()->check( $init );
|
133 |
|
134 |
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
|
135 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
@@ -157,24 +159,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
157 |
yit_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
|
158 |
}
|
159 |
|
160 |
-
/**
|
161 |
-
* Call the protected method _upgrader_pre_download to retrive the zip package file
|
162 |
-
*
|
163 |
-
* @param bool $reply Whether to bail without returning the package. Default false.
|
164 |
-
* @param string $package The package file name.
|
165 |
-
* @param \WP_Upgrader $upgrader WP_Upgrader instance.
|
166 |
-
*
|
167 |
-
* @return string | The download file
|
168 |
-
*
|
169 |
-
* @since 1.0
|
170 |
-
* @see wp-admin/includes/class-wp-upgrader.php
|
171 |
-
* @access public
|
172 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
173 |
-
*/
|
174 |
-
public function upgrader_pre_download( $reply, $package, $upgrader ){
|
175 |
-
return $this->_upgrader_pre_download( $reply, $package, $upgrader );
|
176 |
-
}
|
177 |
-
|
178 |
/**
|
179 |
* Retrive the zip package file
|
180 |
*
|
@@ -186,10 +170,10 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
186 |
*
|
187 |
* @since 1.0
|
188 |
* @see wp-admin/includes/class-wp-upgrader.php
|
189 |
-
* @access
|
190 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
191 |
*/
|
192 |
-
|
193 |
$plugin = false;
|
194 |
$is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
|
195 |
|
@@ -247,7 +231,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
247 |
return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
|
248 |
}
|
249 |
|
250 |
-
$upgrader->skin->feedback( 'downloading_package', __( '
|
251 |
|
252 |
$download_file = $this->_download_url( $package, $args );
|
253 |
|
@@ -440,7 +424,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
440 |
}elseif( is_plugin_active_for_network( $init ) ){
|
441 |
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
|
442 |
}elseif ( empty( $r->package ) ) {
|
443 |
-
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="
|
444 |
} else {
|
445 |
printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url($details_url), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $init, 'upgrade-plugin_' . $init ) );
|
446 |
}
|
60 |
add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
|
61 |
}
|
62 |
|
63 |
+
$is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
|
64 |
+
if ( $is_debug_enabled ) {
|
65 |
+
$this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
|
66 |
+
add_filter( 'block_local_requests', '__return_false' );
|
67 |
}
|
68 |
}
|
69 |
|
131 |
);
|
132 |
|
133 |
foreach( $this->_plugins as $init => $info ){
|
134 |
+
YIT_Plugin_Licence()->check( $init, false );
|
135 |
|
136 |
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
|
137 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
159 |
yit_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
/**
|
163 |
* Retrive the zip package file
|
164 |
*
|
170 |
*
|
171 |
* @since 1.0
|
172 |
* @see wp-admin/includes/class-wp-upgrader.php
|
173 |
+
* @access public
|
174 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
175 |
*/
|
176 |
+
public function upgrader_pre_download( $reply, $package, $upgrader ) {
|
177 |
$plugin = false;
|
178 |
$is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
|
179 |
|
231 |
return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
|
232 |
}
|
233 |
|
234 |
+
$upgrader->skin->feedback( 'downloading_package', __( 'YIThemes Repository', 'yith-plugin-fw' ) );
|
235 |
|
236 |
$download_file = $this->_download_url( $package, $args );
|
237 |
|
424 |
}elseif( is_plugin_active_for_network( $init ) ){
|
425 |
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
|
426 |
}elseif ( empty( $r->package ) ) {
|
427 |
+
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
|
428 |
} else {
|
429 |
printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url($details_url), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $init, 'upgrade-plugin_' . $init ) );
|
430 |
}
|
plugin-fw/licence/assets/css/yit-licence.css
CHANGED
@@ -23,6 +23,7 @@
|
|
23 |
|
24 |
.yit-container.product-licence-activation .to-active-wrapper {
|
25 |
margin-bottom: 60px;
|
|
|
26 |
}
|
27 |
|
28 |
.yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
|
@@ -121,17 +122,13 @@
|
|
121 |
vertical-align: top;
|
122 |
}
|
123 |
|
124 |
-
.yit-container.product-licence-activation .spinner
|
125 |
-
|
126 |
-
vertical-align: middle;
|
127 |
float: none;
|
128 |
}
|
129 |
|
130 |
-
.yit-container.product-licence-activation
|
131 |
-
|
132 |
-
float: none;
|
133 |
-
top: -3px;
|
134 |
-
position: relative;
|
135 |
}
|
136 |
|
137 |
.yit-container.product-licence-activation .licence-check-section{
|
@@ -176,18 +173,24 @@
|
|
176 |
padding: 12px 19px;
|
177 |
}
|
178 |
|
|
|
179 |
.yit-container.product-licence-activation .button-licence.licence-renew {
|
180 |
text-decoration: none;
|
181 |
padding: 7px 12px;
|
182 |
font-size: 9px;
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
185 |
.yit-container.product-licence-activation .button-licence.licence-renew:focus {
|
186 |
box-shadow: none;
|
187 |
}
|
188 |
|
189 |
.yit-container.product-licence-activation table:not(.to-active-table) {
|
190 |
-
width:
|
191 |
border: 1px solid #dcdcdc;
|
192 |
border-spacing: 0;
|
193 |
border-radius: 5px;
|
@@ -197,12 +200,18 @@
|
|
197 |
|
198 |
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
199 |
border-bottom: 1px solid #dcdcdc;
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
|
202 |
.yit-container.product-licence-activation table:not(.to-active-table) td,
|
203 |
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
204 |
border-right: 1px solid #dcdcdc;
|
205 |
}
|
|
|
206 |
.yit-container.product-licence-activation table td:last-child,
|
207 |
.yit-container.product-licence-activation table th:last-child {
|
208 |
border-right: 0;
|
@@ -216,8 +225,12 @@
|
|
216 |
background-color: #ffffff;
|
217 |
}
|
218 |
|
|
|
|
|
|
|
|
|
219 |
.yit-container.product-licence-activation table thead tr th {
|
220 |
-
font-size:
|
221 |
color: #313131;
|
222 |
text-transform: uppercase;
|
223 |
font-weight: bold;
|
@@ -228,6 +241,14 @@
|
|
228 |
line-height: 60px;
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
.yit-container.product-licence-activation table tbody tr td{
|
232 |
text-align: center;
|
233 |
line-height: 20px;
|
@@ -260,15 +281,17 @@
|
|
260 |
width: 33%;
|
261 |
}
|
262 |
|
263 |
-
|
264 |
-
.yit-container.product-licence-activation .to-active-table td.product-name {
|
265 |
color: #808a97;
|
266 |
font-size: 12px;
|
267 |
text-transform: uppercase;
|
268 |
font-weight: bold;
|
269 |
line-height: 20px;
|
|
|
|
|
|
|
|
|
270 |
width: 20%;
|
271 |
-
padding-left: 20px;
|
272 |
}
|
273 |
|
274 |
.yit-container.product-licence-activation .to-active-table td.activate-button {
|
@@ -302,15 +325,12 @@
|
|
302 |
box-shadow: 0 0 1px rgba(30,140,190,.8);
|
303 |
}
|
304 |
|
305 |
-
.yit-container.product-licence-activation input[type=text]
|
|
|
306 |
text-transform: uppercase;
|
307 |
text-align: center;
|
308 |
}
|
309 |
|
310 |
-
.yit-container.product-licence-activation input[type=email] {
|
311 |
-
text-align: left;
|
312 |
-
}
|
313 |
-
|
314 |
.yit-container.product-licence-activation input[type=submit]:focus{
|
315 |
outline: 0;
|
316 |
}
|
@@ -328,19 +348,88 @@
|
|
328 |
color: #808a97;
|
329 |
}
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
/* === Responsive === */
|
332 |
|
333 |
-
@media (max-width: 767px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
-
|
|
|
|
|
336 |
|
337 |
-
|
|
|
|
|
338 |
|
339 |
-
|
|
|
|
|
|
|
340 |
|
341 |
@media (min-width: 1200px) {
|
342 |
.yit-container.product-licence-activation{
|
343 |
-
width:
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
}
|
346 |
|
23 |
|
24 |
.yit-container.product-licence-activation .to-active-wrapper {
|
25 |
margin-bottom: 60px;
|
26 |
+
max-width: 900px;
|
27 |
}
|
28 |
|
29 |
.yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
|
122 |
vertical-align: top;
|
123 |
}
|
124 |
|
125 |
+
.yit-container.product-licence-activation .spinner{
|
126 |
+
vertical-align: -5px;
|
|
|
127 |
float: none;
|
128 |
}
|
129 |
|
130 |
+
.yit-container.product-licence-activation .spinner.show{
|
131 |
+
visibility: visible;
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
.yit-container.product-licence-activation .licence-check-section{
|
173 |
padding: 12px 19px;
|
174 |
}
|
175 |
|
176 |
+
.yit-container.product-licence-activation .button-licence.licence-deactive,
|
177 |
.yit-container.product-licence-activation .button-licence.licence-renew {
|
178 |
text-decoration: none;
|
179 |
padding: 7px 12px;
|
180 |
font-size: 9px;
|
181 |
}
|
182 |
|
183 |
+
.yit-container.product-licence-activation table:not(.expired-table) .button-licence.licence-renew {
|
184 |
+
margin-left: 10px;
|
185 |
+
}
|
186 |
+
|
187 |
+
.yit-container.product-licence-activation .button-licence.licence-deactive:focus,
|
188 |
.yit-container.product-licence-activation .button-licence.licence-renew:focus {
|
189 |
box-shadow: none;
|
190 |
}
|
191 |
|
192 |
.yit-container.product-licence-activation table:not(.to-active-table) {
|
193 |
+
width: auto;
|
194 |
border: 1px solid #dcdcdc;
|
195 |
border-spacing: 0;
|
196 |
border-radius: 5px;
|
200 |
|
201 |
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
202 |
border-bottom: 1px solid #dcdcdc;
|
203 |
+
padding: 0 10px;
|
204 |
+
}
|
205 |
+
|
206 |
+
.yit-container.product-licence-activation table tbody tr td.product-licence-key {
|
207 |
+
text-transform: lowercase;
|
208 |
}
|
209 |
|
210 |
.yit-container.product-licence-activation table:not(.to-active-table) td,
|
211 |
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
212 |
border-right: 1px solid #dcdcdc;
|
213 |
}
|
214 |
+
|
215 |
.yit-container.product-licence-activation table td:last-child,
|
216 |
.yit-container.product-licence-activation table th:last-child {
|
217 |
border-right: 0;
|
225 |
background-color: #ffffff;
|
226 |
}
|
227 |
|
228 |
+
.yit-container.product-licence-activation table tbody tr:nth-child(2n) {
|
229 |
+
background-color: #f4f4f4;
|
230 |
+
}
|
231 |
+
|
232 |
.yit-container.product-licence-activation table thead tr th {
|
233 |
+
font-size: 11px;
|
234 |
color: #313131;
|
235 |
text-transform: uppercase;
|
236 |
font-weight: bold;
|
241 |
line-height: 60px;
|
242 |
}
|
243 |
|
244 |
+
.yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-no-alt {
|
245 |
+
color: #b20015;
|
246 |
+
}
|
247 |
+
|
248 |
+
.yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-yes {
|
249 |
+
color: #1ca800;
|
250 |
+
}
|
251 |
+
|
252 |
.yit-container.product-licence-activation table tbody tr td{
|
253 |
text-align: center;
|
254 |
line-height: 20px;
|
281 |
width: 33%;
|
282 |
}
|
283 |
|
284 |
+
.yit-container.product-licence-activation td.product-name {
|
|
|
285 |
color: #808a97;
|
286 |
font-size: 12px;
|
287 |
text-transform: uppercase;
|
288 |
font-weight: bold;
|
289 |
line-height: 20px;
|
290 |
+
padding: 10px 20px;
|
291 |
+
}
|
292 |
+
|
293 |
+
.yit-container.product-licence-activation .to-active-table td.product-name {
|
294 |
width: 20%;
|
|
|
295 |
}
|
296 |
|
297 |
.yit-container.product-licence-activation .to-active-table td.activate-button {
|
325 |
box-shadow: 0 0 1px rgba(30,140,190,.8);
|
326 |
}
|
327 |
|
328 |
+
.yit-container.product-licence-activation input[type=text],
|
329 |
+
.yit-container.product-licence-activation input[type=email]{
|
330 |
text-transform: uppercase;
|
331 |
text-align: center;
|
332 |
}
|
333 |
|
|
|
|
|
|
|
|
|
334 |
.yit-container.product-licence-activation input[type=submit]:focus{
|
335 |
outline: 0;
|
336 |
}
|
348 |
color: #808a97;
|
349 |
}
|
350 |
|
351 |
+
#yith-licence-notice {
|
352 |
+
margin-left: 0;
|
353 |
+
visibility: hidden;
|
354 |
+
min-height: 38px;
|
355 |
+
}
|
356 |
+
|
357 |
+
#yith-licence-notice.visible {
|
358 |
+
visibility: visible;
|
359 |
+
}
|
360 |
+
|
361 |
/* === Responsive === */
|
362 |
|
363 |
+
@media (max-width: 767px) {
|
364 |
+
.yit-container.product-licence-activation .activation-faq {
|
365 |
+
margin-right: 5px;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
@media (max-width: 480px) {
|
370 |
+
.yit-container.product-licence-activation .activation-faq {
|
371 |
+
margin-right: 5px;
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
@media (min-width: 768px) and (max-width: 992px) {
|
376 |
+
.yit-container.product-licence-activation .button-licence.licence-deactive,
|
377 |
+
.yit-container.product-licence-activation .button-licence.licence-renew {
|
378 |
+
margin-bottom: 10px;
|
379 |
+
display: block;
|
380 |
+
margin-left: 0;
|
381 |
+
padding: 5px 7px;
|
382 |
+
}
|
383 |
+
|
384 |
+
.yit-container.product-licence-activation .button-licence.licence-deactive {
|
385 |
+
margin-bottom: 10px;
|
386 |
+
}
|
387 |
+
|
388 |
+
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
389 |
+
line-height: 20px;
|
390 |
+
}
|
391 |
+
|
392 |
+
.yit-container.product-licence-activation table tbody tr td {
|
393 |
+
padding: 5px;
|
394 |
+
}
|
395 |
+
|
396 |
+
.yit-container.product-licence-activation .activation-faq {
|
397 |
+
margin-right: 20px;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
@media (min-width: 980px) and (max-width: 1199px) {
|
402 |
+
.yit-container.product-licence-activation .button-licence.licence-deactive,
|
403 |
+
.yit-container.product-licence-activation .button-licence.licence-renew {
|
404 |
+
display: block;
|
405 |
+
margin-left: 0;
|
406 |
+
padding: 5px 7px;
|
407 |
+
}
|
408 |
+
|
409 |
+
.yit-container.product-licence-activation .button-licence.licence-renew {
|
410 |
+
margin-top: 10px;
|
411 |
+
}
|
412 |
|
413 |
+
.yit-container.product-licence-activation table:not(.to-active-table) th {
|
414 |
+
line-height: 20px;
|
415 |
+
}
|
416 |
|
417 |
+
.yit-container.product-licence-activation table tbody tr td {
|
418 |
+
padding: 5px;
|
419 |
+
}
|
420 |
|
421 |
+
.yit-container.product-licence-activation .activation-faq {
|
422 |
+
width: 75%;
|
423 |
+
}
|
424 |
+
}
|
425 |
|
426 |
@media (min-width: 1200px) {
|
427 |
.yit-container.product-licence-activation{
|
428 |
+
width: auto;
|
429 |
+
}
|
430 |
+
|
431 |
+
.yit-container.product-licence-activation .activation-faq {
|
432 |
+
width: 50%;
|
433 |
}
|
434 |
}
|
435 |
|
plugin-fw/licence/assets/js/yit-licence.js
CHANGED
@@ -16,20 +16,21 @@
|
|
16 |
button.on('click', function (e, button) {
|
17 |
e.preventDefault();
|
18 |
|
19 |
-
var t
|
20 |
-
form_id
|
21 |
-
form
|
22 |
-
data
|
23 |
-
message
|
24 |
-
message_wrapper
|
25 |
-
email
|
26 |
-
licence_key
|
27 |
-
email_val
|
28 |
-
licence_key_val
|
29 |
-
error
|
30 |
-
error_fields
|
31 |
-
product_row
|
32 |
-
|
|
|
33 |
|
34 |
/* Init Input Fields */
|
35 |
message.empty();
|
@@ -38,17 +39,17 @@
|
|
38 |
licence_key.removeClass('require');
|
39 |
product_row.removeClass('error');
|
40 |
spinner.addClass('show');
|
41 |
-
t.prop("disabled", true).addClass('clicked');
|
42 |
|
43 |
if ('' == email_val) {
|
44 |
error = true;
|
45 |
-
error_fields[ error_fields.length ] =
|
46 |
email.addClass('require');
|
47 |
}
|
48 |
|
49 |
if ('' == licence_key_val) {
|
50 |
error = true;
|
51 |
-
error_fields[ error_fields.length ] =
|
52 |
licence_key.addClass('require');
|
53 |
}
|
54 |
|
@@ -60,7 +61,7 @@
|
|
60 |
success: function (response) {
|
61 |
|
62 |
spinner.removeClass('show');
|
63 |
-
t.prop("disabled", false).removeClass('clicked');
|
64 |
|
65 |
if (true == response.activated) {
|
66 |
$('.product-licence-activation').empty().replaceWith(response.template);
|
@@ -93,10 +94,10 @@
|
|
93 |
}
|
94 |
|
95 |
spinner.removeClass('show');
|
96 |
-
t.prop("disabled", false).removeClass('clicked');
|
97 |
}
|
98 |
});
|
99 |
-
}
|
100 |
|
101 |
var licence_update = function (button) {
|
102 |
button.on('click', function (e) {
|
@@ -119,21 +120,77 @@
|
|
119 |
}
|
120 |
});
|
121 |
});
|
122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
var licence_api = function () {
|
125 |
-
var button
|
126 |
-
check
|
|
|
127 |
|
128 |
licence_activation(button);
|
129 |
licence_update(check);
|
130 |
-
|
|
|
131 |
|
132 |
licence_api();
|
133 |
|
134 |
$('body').on('click', '.yit-changelog-button', function (e) {
|
135 |
$('#TB_window').remove();
|
136 |
-
|
137 |
});
|
138 |
|
139 |
})(jQuery);
|
16 |
button.on('click', function (e, button) {
|
17 |
e.preventDefault();
|
18 |
|
19 |
+
var t = $(this),
|
20 |
+
form_id = t.data('formid'),
|
21 |
+
form = $('#' + form_id),
|
22 |
+
data = form.serialize(),
|
23 |
+
message = $(form).find('.message'),
|
24 |
+
message_wrapper = $(form).find('.message-wrapper'),
|
25 |
+
email = form.find('.user-email'),
|
26 |
+
licence_key = form.find('.licence-key'),
|
27 |
+
email_val = form.find('.user-email').val(),
|
28 |
+
licence_key_val = form.find('.licence-key').val(),
|
29 |
+
error = false,
|
30 |
+
error_fields = new Array(),
|
31 |
+
product_row = form.find('.product-row'),
|
32 |
+
licence_activation = $('.licence-activation'),
|
33 |
+
spinner = $('#products-to-active').find('.spinner');
|
34 |
|
35 |
/* Init Input Fields */
|
36 |
message.empty();
|
39 |
licence_key.removeClass('require');
|
40 |
product_row.removeClass('error');
|
41 |
spinner.addClass('show');
|
42 |
+
t.add(licence_activation).prop("disabled", true).addClass('clicked');
|
43 |
|
44 |
if ('' == email_val) {
|
45 |
error = true;
|
46 |
+
error_fields[ error_fields.length ] = licence_message.email;
|
47 |
email.addClass('require');
|
48 |
}
|
49 |
|
50 |
if ('' == licence_key_val) {
|
51 |
error = true;
|
52 |
+
error_fields[ error_fields.length ] = licence_message.license_key;
|
53 |
licence_key.addClass('require');
|
54 |
}
|
55 |
|
61 |
success: function (response) {
|
62 |
|
63 |
spinner.removeClass('show');
|
64 |
+
t.add(licence_activation).prop("disabled", false).removeClass('clicked');
|
65 |
|
66 |
if (true == response.activated) {
|
67 |
$('.product-licence-activation').empty().replaceWith(response.template);
|
94 |
}
|
95 |
|
96 |
spinner.removeClass('show');
|
97 |
+
t.add(licence_activation).prop("disabled", false).removeClass('clicked');
|
98 |
}
|
99 |
});
|
100 |
+
};
|
101 |
|
102 |
var licence_update = function (button) {
|
103 |
button.on('click', function (e) {
|
120 |
}
|
121 |
});
|
122 |
});
|
123 |
+
};
|
124 |
+
|
125 |
+
var licence_deactivate = function (button) {
|
126 |
+
button.on('click', function (e) {
|
127 |
+
e.preventDefault();
|
128 |
+
|
129 |
+
var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
|
130 |
+
|
131 |
+
if( check == true ){
|
132 |
+
var t = $(this),
|
133 |
+
licence_key = t.data('licence-key'),
|
134 |
+
licence_email = t.data('licence-email'),
|
135 |
+
product_init = t.data('product-init'),
|
136 |
+
action = t.data('action'),
|
137 |
+
renew = $('.licence-renew'),
|
138 |
+
deactive = $('.licence-deactive'),
|
139 |
+
message = $('#yith-licence-notice'),
|
140 |
+
activated_table = $('.activated-table');
|
141 |
+
|
142 |
+
t.add(renew).add(deactive).prop("disabled", true).addClass('clicked');
|
143 |
+
$('#activated-products').find('.spinner').addClass('show');
|
144 |
+
|
145 |
+
jQuery.ajax({
|
146 |
+
type : 'POST',
|
147 |
+
url : ajaxurl,
|
148 |
+
data : {
|
149 |
+
action: action,
|
150 |
+
licence_key: licence_key,
|
151 |
+
email: licence_email,
|
152 |
+
product_init: product_init
|
153 |
+
},
|
154 |
+
success: function (response) {
|
155 |
+
message.css( 'maxWidth', activated_table.width() );
|
156 |
+
if (false == response.activated && typeof response.error == 'undefined') {
|
157 |
+
$('.product-licence-activation').empty().replaceWith(response.template);
|
158 |
+
licence_api();
|
159 |
+
}
|
160 |
+
|
161 |
+
if (false == response.activated && typeof response.error != 'undefined') {
|
162 |
+
message.find('p.yith-licence-notice-message').html(response.error);
|
163 |
+
message.removeClass('notice-success').addClass('notice-error visible');
|
164 |
+
t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
|
165 |
+
$('#activated-products').find('.spinner').removeClass('show');
|
166 |
+
}
|
167 |
+
|
168 |
+
else if (false == response) {
|
169 |
+
message.find('p.yith-licence-notice-message').html(licence_message.server);
|
170 |
+
message.removeClass('notice-success').addClass('notice-error visible');
|
171 |
+
t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
|
172 |
+
$('#activated-products').find('.spinner').removeClass('show');
|
173 |
+
}
|
174 |
+
}
|
175 |
+
});
|
176 |
+
}
|
177 |
+
});
|
178 |
+
};
|
179 |
|
180 |
var licence_api = function () {
|
181 |
+
var button = $('.licence-activation'),
|
182 |
+
check = $('.licence-check'),
|
183 |
+
deactivated = $('.licence-deactive');
|
184 |
|
185 |
licence_activation(button);
|
186 |
licence_update(check);
|
187 |
+
licence_deactivate(deactivated);
|
188 |
+
};
|
189 |
|
190 |
licence_api();
|
191 |
|
192 |
$('body').on('click', '.yit-changelog-button', function (e) {
|
193 |
$('#TB_window').remove();
|
|
|
194 |
});
|
195 |
|
196 |
})(jQuery);
|
plugin-fw/licence/lib/yit-licence.php
CHANGED
@@ -56,17 +56,48 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
56 |
*/
|
57 |
protected $_api_uri_query_args = '?wc-api=software-api&request=%request%';
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* Constructor
|
61 |
*
|
62 |
* @since 1.0
|
63 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
64 |
*/
|
65 |
-
public function __construct(){
|
66 |
-
|
67 |
-
if
|
68 |
-
$this->_api_uri = 'http://dev.yithemes.com';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -114,7 +145,6 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
114 |
return $home_url;
|
115 |
}
|
116 |
|
117 |
-
|
118 |
/**
|
119 |
* Check if the request is ajax
|
120 |
*
|
@@ -146,21 +176,20 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
146 |
|
147 |
wp_enqueue_script( 'yit-licence', $script_path . '/licence/assets/js/' . $filename, array( 'jquery' ), '1.0.0', true );
|
148 |
wp_enqueue_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
|
149 |
-
}
|
150 |
|
151 |
-
|
152 |
-
* Localize Scripts
|
153 |
-
*
|
154 |
-
* @return void
|
155 |
-
*
|
156 |
-
* @since 1.0
|
157 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
158 |
-
*/
|
159 |
-
public function localize_script() {
|
160 |
wp_localize_script( 'yit-licence', 'licence_message', array(
|
161 |
-
'error'
|
162 |
-
'errors'
|
163 |
-
'server'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
)
|
165 |
);
|
166 |
}
|
@@ -177,7 +206,6 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
177 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
178 |
*/
|
179 |
public function activate() {
|
180 |
-
|
181 |
$product_init = $_REQUEST['product_init'];
|
182 |
$product = $this->get_product( $product_init );
|
183 |
|
@@ -190,7 +218,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
190 |
);
|
191 |
|
192 |
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'activation' ) ) );
|
193 |
-
$response = wp_remote_get( $api_uri );
|
194 |
|
195 |
if ( is_wp_error( $response ) ) {
|
196 |
$body = false;
|
@@ -203,13 +231,14 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
203 |
if ( $body && is_array( $body ) && isset( $body['activated'] ) && $body['activated'] ) {
|
204 |
|
205 |
$option[$product['product_id']] = array(
|
206 |
-
'email'
|
207 |
-
'licence_key'
|
208 |
-
'licence_expires'
|
209 |
-
'message'
|
210 |
-
'activated'
|
211 |
-
'activation_limit'
|
212 |
-
'activation_remaining'
|
|
|
213 |
);
|
214 |
|
215 |
/* === Check for other plugins activation === */
|
@@ -222,7 +251,74 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
222 |
YIT_Upgrade()->force_regenerate_update_transient();
|
223 |
|
224 |
/* === Licence Activation Template === */
|
225 |
-
$body['template'] = $this->show_activation_panel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
wp_send_json( $body );
|
@@ -240,7 +336,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
240 |
* @since 1.0
|
241 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
242 |
*/
|
243 |
-
public function check( $product_init ) {
|
244 |
|
245 |
$status = false;
|
246 |
$body = false;
|
@@ -261,7 +357,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
261 |
);
|
262 |
|
263 |
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'check' ) ) );
|
264 |
-
$response = wp_remote_get( $api_uri );
|
265 |
|
266 |
if ( ! is_wp_error( $response ) ) {
|
267 |
$body = json_decode( $response['body'] );
|
@@ -279,6 +375,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
279 |
$licence[ $product_id ]['licence_expires'] = $body['licence_expires'];
|
280 |
$licence[ $product_id ]['activation_remaining'] = $body['activation_remaining'];
|
281 |
$licence[ $product_id ]['activation_limit'] = $body['activation_limit'];
|
|
|
282 |
$status = (bool) $body['activated'];
|
283 |
}
|
284 |
elseif ( isset( $body['code'] ) ) {
|
@@ -297,7 +394,8 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
297 |
* 106 -> Licence key has expired
|
298 |
* 107 -> Licence key has be banned
|
299 |
*
|
300 |
-
* Only code 101, 106 and 107 have effect on DB
|
|
|
301 |
*
|
302 |
*/
|
303 |
|
@@ -308,15 +406,17 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
308 |
|
309 |
case '106':
|
310 |
$licence[ $product_id ]['activated'] = false;
|
311 |
-
$licence[ $product_id ]['message'] = $body['
|
312 |
$licence[ $product_id ]['status_code'] = $body['code'];
|
313 |
$licence[ $product_id ]['licence_expires'] = $body['licence_expires'];
|
|
|
314 |
break;
|
315 |
|
316 |
case '107':
|
317 |
-
$licence[ $product_id ]['activated']
|
318 |
-
$licence[ $product_id ]['message']
|
319 |
-
$licence[ $product_id ]['status_code']
|
|
|
320 |
break;
|
321 |
}
|
322 |
}
|
@@ -325,11 +425,28 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
325 |
update_option( $this->_licence_option, $licence );
|
326 |
|
327 |
/* === Update Plugin Licence Information === */
|
328 |
-
|
|
|
|
|
329 |
}
|
330 |
return $status;
|
331 |
}
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
/**
|
334 |
* Update Plugins Information
|
335 |
*
|
@@ -342,17 +459,18 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
342 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
343 |
*/
|
344 |
public function update_licence_information() {
|
345 |
-
|
346 |
-
|
347 |
-
}
|
348 |
|
349 |
/* === Regenerate Update Plugins Transient === */
|
350 |
YIT_Upgrade()->force_regenerate_update_transient();
|
351 |
|
352 |
do_action( 'yit_licence_after_check' );
|
353 |
|
354 |
-
|
355 |
-
|
|
|
|
|
356 |
}
|
357 |
|
358 |
/**
|
@@ -363,7 +481,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
363 |
* @since 1.0
|
364 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
365 |
*/
|
366 |
-
public function show_activation_panel() {
|
367 |
|
368 |
$path = defined( 'YIT_CORE_PLUGIN_PATH' ) ? YIT_CORE_PLUGIN_PATH : get_template_directory() . '/core/plugin-fw/';
|
369 |
|
@@ -542,20 +660,49 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
542 |
* @since 1.0
|
543 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
544 |
*/
|
545 |
-
public function
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
'
|
550 |
-
'
|
551 |
-
'
|
552 |
-
'
|
553 |
-
'
|
554 |
-
'
|
555 |
-
'
|
|
|
|
|
|
|
|
|
556 |
);
|
557 |
|
558 |
-
return isset( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
}
|
560 |
|
561 |
}
|
56 |
*/
|
57 |
protected $_api_uri_query_args = '?wc-api=software-api&request=%request%';
|
58 |
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @var string check for show extra info
|
62 |
+
* @since 1.0
|
63 |
+
*/
|
64 |
+
public $show_extra_info = false;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @var string check for show extra info
|
68 |
+
* @since 1.0
|
69 |
+
*/
|
70 |
+
public $show_renew_button = true;
|
71 |
+
|
72 |
/**
|
73 |
* Constructor
|
74 |
*
|
75 |
* @since 1.0
|
76 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
77 |
*/
|
78 |
+
public function __construct() {
|
79 |
+
$is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
|
80 |
+
if ( $is_debug_enabled ) {
|
81 |
+
$this->_api_uri = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
|
82 |
+
add_filter( 'block_local_requests', '__return_false' );
|
83 |
+
}
|
84 |
+
|
85 |
+
/* Style adn Script */
|
86 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
87 |
+
if( $is_debug_enabled ) {
|
88 |
+
//show extra info and renew button in debug mode
|
89 |
+
$this->show_extra_info = $this->show_renew_button = true;
|
90 |
+
}
|
91 |
+
|
92 |
+
else {
|
93 |
+
$this->show_extra_info = defined( 'YIT_SHOW_EXTRA_LICENCE_INFO' ) && YIT_SHOW_EXTRA_LICENCE_INFO;
|
94 |
+
$this->show_renew_button = ! ( defined( 'YIT_HIDE_LICENCE_RENEW_BUTTON' ) && YIT_HIDE_LICENCE_RENEW_BUTTON );
|
95 |
}
|
96 |
+
|
97 |
+
/* Update Licence Information */
|
98 |
+
add_action( 'core_upgrade_preamble', array( $this, 'check_all' ) );
|
99 |
+
add_action( 'wp_maybe_auto_update', array( $this, 'check_all' ) );
|
100 |
+
|
101 |
}
|
102 |
|
103 |
/**
|
145 |
return $home_url;
|
146 |
}
|
147 |
|
|
|
148 |
/**
|
149 |
* Check if the request is ajax
|
150 |
*
|
176 |
|
177 |
wp_enqueue_script( 'yit-licence', $script_path . '/licence/assets/js/' . $filename, array( 'jquery' ), '1.0.0', true );
|
178 |
wp_enqueue_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
|
|
|
179 |
|
180 |
+
/* Localize Scripts */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
wp_localize_script( 'yit-licence', 'licence_message', array(
|
182 |
+
'error' => sprintf( _x( '%s field cannot be empty', '%s = field name', 'yith-plugin-fw' ), '%field%' ), // sprintf must be used to avoid errors with '%field%' string in translation in .po file
|
183 |
+
'errors' => sprintf( __( '%s and %s fields cannot be empty', 'yith-plugin-fw' ), '%field_1%', '%field_2%' ),
|
184 |
+
'server' => __( 'Unable to contact the remote server, please try again later. Thanks!', 'yith-plugin-fw' ),
|
185 |
+
'email' => __( 'Email', 'yith-plugin-fw' ),
|
186 |
+
'license_key' => __( 'License Key', 'yith-plugin-fw' ),
|
187 |
+
'are_you_sure' => __( 'Are you sure you want to deactivate the license for current site?', 'yith-plugin-fw' )
|
188 |
+
)
|
189 |
+
);
|
190 |
+
|
191 |
+
wp_localize_script( 'yit-licence', 'script_info', array(
|
192 |
+
'is_debug' => defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG
|
193 |
)
|
194 |
);
|
195 |
}
|
206 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
207 |
*/
|
208 |
public function activate() {
|
|
|
209 |
$product_init = $_REQUEST['product_init'];
|
210 |
$product = $this->get_product( $product_init );
|
211 |
|
218 |
);
|
219 |
|
220 |
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'activation' ) ) );
|
221 |
+
$response = wp_remote_get( $api_uri, array( 'timeout' => 30 ) );
|
222 |
|
223 |
if ( is_wp_error( $response ) ) {
|
224 |
$body = false;
|
231 |
if ( $body && is_array( $body ) && isset( $body['activated'] ) && $body['activated'] ) {
|
232 |
|
233 |
$option[$product['product_id']] = array(
|
234 |
+
'email' => urldecode( $args['email'] ),
|
235 |
+
'licence_key' => $args['licence_key'],
|
236 |
+
'licence_expires' => $body['licence_expires'],
|
237 |
+
'message' => $body['message'],
|
238 |
+
'activated' => true,
|
239 |
+
'activation_limit' => $body['activation_limit'],
|
240 |
+
'activation_remaining' => $body['activation_remaining'],
|
241 |
+
'is_membership' => isset( $body['is_membership'] ) ? $body['is_membership'] : false,
|
242 |
);
|
243 |
|
244 |
/* === Check for other plugins activation === */
|
251 |
YIT_Upgrade()->force_regenerate_update_transient();
|
252 |
|
253 |
/* === Licence Activation Template === */
|
254 |
+
$body['template'] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
|
255 |
+
}
|
256 |
+
|
257 |
+
wp_send_json( $body );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Deactivate Plugins
|
262 |
+
*
|
263 |
+
* Send a request to API server to activate plugins
|
264 |
+
*
|
265 |
+
* @return void
|
266 |
+
* @use wp_send_json
|
267 |
+
*
|
268 |
+
* @since 1.0
|
269 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
270 |
+
*/
|
271 |
+
public function deactivate() {
|
272 |
+
$product_init = $_REQUEST['product_init'];
|
273 |
+
$product = $this->get_product( $product_init );
|
274 |
+
|
275 |
+
$args = array(
|
276 |
+
'email' => urlencode( sanitize_email( $_REQUEST['email'] ) ),
|
277 |
+
'licence_key' => sanitize_text_field( $_REQUEST['licence_key'] ),
|
278 |
+
'product_id' => sanitize_text_field( $product['product_id'] ),
|
279 |
+
'secret_key' => sanitize_text_field( $product['secret_key'] ),
|
280 |
+
'instance' => $this->get_home_url()
|
281 |
+
);
|
282 |
+
|
283 |
+
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'deactivation' ) ) );
|
284 |
+
$response = wp_remote_get( $api_uri, array( 'timeout' => 30 ) );
|
285 |
+
|
286 |
+
if ( is_wp_error( $response ) ) {
|
287 |
+
$body = false;
|
288 |
+
}
|
289 |
+
else {
|
290 |
+
$body = json_decode( $response['body'] );
|
291 |
+
$body = is_object( $body ) ? get_object_vars( $body ) : false;
|
292 |
+
}
|
293 |
+
|
294 |
+
if ( $body && is_array( $body ) && isset( $body['activated'] ) && ! $body['activated'] && ! isset( $body['error'] ) ) {
|
295 |
+
|
296 |
+
$option[$product['product_id']] = array(
|
297 |
+
'activated' => false,
|
298 |
+
'email' => urldecode( $args['email'] ),
|
299 |
+
'licence_key' => $args['licence_key'],
|
300 |
+
'licence_expires' => $body['licence_expires'],
|
301 |
+
'message' => $body['message'],
|
302 |
+
'activation_limit' => $body['activation_limit'],
|
303 |
+
'activation_remaining' => $body['activation_remaining'],
|
304 |
+
'is_membership' => isset( $body['is_membership'] ) ? $body['is_membership'] : false,
|
305 |
+
);
|
306 |
+
|
307 |
+
/* === Check for other plugins activation === */
|
308 |
+
$options = $this->get_licence();
|
309 |
+
$options[$product['product_id']] = $option[$product['product_id']];
|
310 |
+
|
311 |
+
update_option( $this->_licence_option, $options );
|
312 |
+
|
313 |
+
/* === Update Plugin Licence Information === */
|
314 |
+
YIT_Upgrade()->force_regenerate_update_transient();
|
315 |
+
|
316 |
+
/* === Licence Activation Template === */
|
317 |
+
$body['template'] = $this->show_activation_panel( $this->get_response_code_message( 'deactivated', array( 'instance' => $body['instance'] ) ) );
|
318 |
+
}
|
319 |
+
|
320 |
+
else {
|
321 |
+
$body['error'] = $this->get_response_code_message( $body['code'] );
|
322 |
}
|
323 |
|
324 |
wp_send_json( $body );
|
336 |
* @since 1.0
|
337 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
338 |
*/
|
339 |
+
public function check( $product_init, $regenerate_transient = true ) {
|
340 |
|
341 |
$status = false;
|
342 |
$body = false;
|
357 |
);
|
358 |
|
359 |
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'check' ) ) );
|
360 |
+
$response = wp_remote_get( $api_uri, array( 'timeout' => 30 ) );
|
361 |
|
362 |
if ( ! is_wp_error( $response ) ) {
|
363 |
$body = json_decode( $response['body'] );
|
375 |
$licence[ $product_id ]['licence_expires'] = $body['licence_expires'];
|
376 |
$licence[ $product_id ]['activation_remaining'] = $body['activation_remaining'];
|
377 |
$licence[ $product_id ]['activation_limit'] = $body['activation_limit'];
|
378 |
+
$licence[ $product_id ]['is_membership'] = isset( $body['is_membership'] ) ? $body['is_membership'] : false;
|
379 |
$status = (bool) $body['activated'];
|
380 |
}
|
381 |
elseif ( isset( $body['code'] ) ) {
|
394 |
* 106 -> Licence key has expired
|
395 |
* 107 -> Licence key has be banned
|
396 |
*
|
397 |
+
* Only code 101, 106 and 107 have effect on DB during activation
|
398 |
+
* All error code have effect on DB during deactivation
|
399 |
*
|
400 |
*/
|
401 |
|
406 |
|
407 |
case '106':
|
408 |
$licence[ $product_id ]['activated'] = false;
|
409 |
+
$licence[ $product_id ]['message'] = $body['error'];
|
410 |
$licence[ $product_id ]['status_code'] = $body['code'];
|
411 |
$licence[ $product_id ]['licence_expires'] = $body['licence_expires'];
|
412 |
+
//$licence[ $product_id ]['is_membership'] = isset( $body['is_membership'] ) ? $body['is_membership'] : false;
|
413 |
break;
|
414 |
|
415 |
case '107':
|
416 |
+
$licence[ $product_id ]['activated'] = false;
|
417 |
+
$licence[ $product_id ]['message'] = $body['error'];
|
418 |
+
$licence[ $product_id ]['status_code'] = $body['code'];
|
419 |
+
//$licence[ $product_id ]['is_membership'] = isset( $body['is_membership'] ) ? $body['is_membership'] : false;
|
420 |
break;
|
421 |
}
|
422 |
}
|
425 |
update_option( $this->_licence_option, $licence );
|
426 |
|
427 |
/* === Update Plugin Licence Information === */
|
428 |
+
if( $regenerate_transient ) {
|
429 |
+
YIT_Upgrade()->force_regenerate_update_transient();
|
430 |
+
}
|
431 |
}
|
432 |
return $status;
|
433 |
}
|
434 |
|
435 |
+
/**
|
436 |
+
* Check for licence update
|
437 |
+
*
|
438 |
+
* @return void
|
439 |
+
* @since 2.5
|
440 |
+
*
|
441 |
+
* @use YIT_Theme_Licence->check()
|
442 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
443 |
+
*/
|
444 |
+
public function check_all(){
|
445 |
+
foreach ( $this->_products as $init => $info ) {
|
446 |
+
$this->check( $init );
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
/**
|
451 |
* Update Plugins Information
|
452 |
*
|
459 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
460 |
*/
|
461 |
public function update_licence_information() {
|
462 |
+
/* Check licence information for alla products */
|
463 |
+
$this->check_all();
|
|
|
464 |
|
465 |
/* === Regenerate Update Plugins Transient === */
|
466 |
YIT_Upgrade()->force_regenerate_update_transient();
|
467 |
|
468 |
do_action( 'yit_licence_after_check' );
|
469 |
|
470 |
+
if( $this->is_ajax() ) {
|
471 |
+
$response['template'] = $this->show_activation_panel();
|
472 |
+
wp_send_json( $response );
|
473 |
+
}
|
474 |
}
|
475 |
|
476 |
/**
|
481 |
* @since 1.0
|
482 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
483 |
*/
|
484 |
+
public function show_activation_panel( $notice = '' ) {
|
485 |
|
486 |
$path = defined( 'YIT_CORE_PLUGIN_PATH' ) ? YIT_CORE_PLUGIN_PATH : get_template_directory() . '/core/plugin-fw/';
|
487 |
|
660 |
* @since 1.0
|
661 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
662 |
*/
|
663 |
+
public function get_response_code_message( $code, $args = array() ) {
|
664 |
+
extract( $args );
|
665 |
+
|
666 |
+
$messages = array(
|
667 |
+
'100' => __( 'Invalid Request', 'yith-plugin-fw' ),
|
668 |
+
'101' => __( 'Invalid license key', 'yith-plugin-fw' ),
|
669 |
+
'102' => __( 'Software has been deactivated', 'yith-plugin-fw' ),
|
670 |
+
'103' => __( 'Maximum number of activations exceeded', 'yith-plugin-fw' ),
|
671 |
+
'104' => __( 'Invalid instance ID', 'yith-plugin-fw' ),
|
672 |
+
'105' => __( 'Invalid security key', 'yith-plugin-fw' ),
|
673 |
+
'106' => __( 'License key has expired', 'yith-plugin-fw' ),
|
674 |
+
'107' => __( 'License key has been banned', 'yith-plugin-fw' ),
|
675 |
+
'108' => __( 'Current product is not included with your membership key', 'woocommerce-software-add-on' ),
|
676 |
+
'200' => sprintf( '<strong>%s</strong>! %s',__( 'Great', 'yith-plugin-fw' ), __( 'License successfully activated', 'yith-plugin-fw' ) ),
|
677 |
+
'deactivated' => sprintf( '%s <strong>%s</strong>', __( 'License key deactivated for website', 'woocommerce-software-add-on' ), isset( $instance ) ? $instance : '' )
|
678 |
);
|
679 |
|
680 |
+
return isset( $messages[$code] ) ? $messages[$code] : false;
|
681 |
+
}
|
682 |
+
|
683 |
+
/**
|
684 |
+
* Get the product name to display
|
685 |
+
*
|
686 |
+
* @param $product_name
|
687 |
+
*
|
688 |
+
* @return string the product name
|
689 |
+
*
|
690 |
+
* @since 2.2
|
691 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
692 |
+
*/
|
693 |
+
public function display_product_name( $product_name ){
|
694 |
+
return str_replace( array( 'YITH', 'WooCommerce', 'Premium', 'Theme' ), '', $product_name );
|
695 |
+
}
|
696 |
+
|
697 |
+
public function get_number_of_membership_products(){
|
698 |
+
$activated_products = $this->get_activated_products();
|
699 |
+
$num_members_products_activate = 0;
|
700 |
+
foreach( $activated_products as $activated_product ){
|
701 |
+
if( isset( $activated_product['licence']['is_membership'] ) && $activated_product['licence']['is_membership'] ){
|
702 |
+
$num_members_products_activate++;
|
703 |
+
}
|
704 |
+
}
|
705 |
+
return $num_members_products_activate;
|
706 |
}
|
707 |
|
708 |
}
|
plugin-fw/licence/lib/yit-plugin-licence.php
CHANGED
@@ -8,11 +8,11 @@
|
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
-
if ( !
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
-
if ( !
|
16 |
/**
|
17 |
* YIT Plugin Licence Panel
|
18 |
*
|
@@ -23,7 +23,6 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
26 |
-
|
27 |
class YIT_Plugin_Licence extends YIT_Licence {
|
28 |
|
29 |
/**
|
@@ -59,27 +58,26 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
59 |
public function __construct() {
|
60 |
parent::__construct();
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
$this->_settings = array(
|
67 |
'parent_page' => 'yit_plugin_panel',
|
68 |
-
'page_title' => __( '
|
69 |
-
'menu_title' => __( '
|
70 |
'capability' => 'manage_options',
|
71 |
'page' => 'yith_plugins_activation',
|
72 |
);
|
73 |
|
74 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
75 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
76 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
|
77 |
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
|
|
78 |
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
79 |
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
|
80 |
}
|
81 |
|
82 |
-
|
83 |
public function licence_after_check() {
|
84 |
/* === Regenerate Update Plugins Transient === */
|
85 |
YIT_Upgrade()->force_regenerate_update_transient();
|
@@ -133,16 +131,20 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
133 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
134 |
*/
|
135 |
public function register( $plugin_init, $secret_key, $product_id ) {
|
136 |
-
if ( !
|
137 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
138 |
}
|
139 |
|
140 |
$plugins = get_plugins();
|
141 |
$plugins[$plugin_init]['secret_key'] = $secret_key;
|
142 |
$plugins[$plugin_init]['product_id'] = $product_id;
|
143 |
-
$this->_products[$plugin_init]
|
144 |
}
|
145 |
-
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
/**
|
@@ -152,7 +154,7 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
152 |
* @since 1.0
|
153 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
154 |
*/
|
155 |
-
if( !
|
156 |
function YIT_Plugin_Licence() {
|
157 |
return YIT_Plugin_Licence::instance();
|
158 |
}
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
+
if ( !defined( 'ABSPATH' ) ) {
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
+
if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
|
16 |
/**
|
17 |
* YIT Plugin Licence Panel
|
18 |
*
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
|
|
26 |
class YIT_Plugin_Licence extends YIT_Licence {
|
27 |
|
28 |
/**
|
58 |
public function __construct() {
|
59 |
parent::__construct();
|
60 |
|
61 |
+
if ( !is_admin() ) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
|
65 |
$this->_settings = array(
|
66 |
'parent_page' => 'yit_plugin_panel',
|
67 |
+
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
68 |
+
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
69 |
'capability' => 'manage_options',
|
70 |
'page' => 'yith_plugins_activation',
|
71 |
);
|
72 |
|
73 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
|
|
|
|
74 |
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
75 |
+
add_action( "wp_ajax_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
76 |
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
77 |
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
|
78 |
}
|
79 |
|
80 |
+
|
81 |
public function licence_after_check() {
|
82 |
/* === Regenerate Update Plugins Transient === */
|
83 |
YIT_Upgrade()->force_regenerate_update_transient();
|
131 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
132 |
*/
|
133 |
public function register( $plugin_init, $secret_key, $product_id ) {
|
134 |
+
if ( !function_exists( 'get_plugins' ) ) {
|
135 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
136 |
}
|
137 |
|
138 |
$plugins = get_plugins();
|
139 |
$plugins[$plugin_init]['secret_key'] = $secret_key;
|
140 |
$plugins[$plugin_init]['product_id'] = $product_id;
|
141 |
+
$this->_products[$plugin_init] = $plugins[$plugin_init];
|
142 |
}
|
143 |
+
|
144 |
+
public function get_product_type() {
|
145 |
+
return $this->_product_type;
|
146 |
+
}
|
147 |
+
}
|
148 |
}
|
149 |
|
150 |
/**
|
154 |
* @since 1.0
|
155 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
156 |
*/
|
157 |
+
if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
|
158 |
function YIT_Plugin_Licence() {
|
159 |
return YIT_Plugin_Licence::instance();
|
160 |
}
|
plugin-fw/licence/lib/yit-theme-licence.php
CHANGED
@@ -8,11 +8,11 @@
|
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
-
if ( !
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
-
if ( !
|
16 |
/**
|
17 |
* YIT Plugin Licence Panel
|
18 |
*
|
@@ -23,7 +23,6 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
26 |
-
|
27 |
class YIT_Theme_Licence extends YIT_Licence {
|
28 |
|
29 |
/**
|
@@ -50,6 +49,12 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
50 |
*/
|
51 |
protected $_product_type = 'theme';
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* Constructor
|
55 |
*
|
@@ -61,16 +66,15 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
61 |
|
62 |
$this->_settings = array(
|
63 |
'parent_page' => 'yit_product_panel',
|
64 |
-
'page_title' => __( '
|
65 |
-
'menu_title' => __( '
|
66 |
'capability' => 'manage_options',
|
67 |
'page' => 'yith_plugins_activation',
|
68 |
);
|
69 |
|
70 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
71 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
72 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
|
73 |
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
|
|
74 |
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
75 |
}
|
76 |
|
@@ -101,15 +105,15 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
101 |
public function add_submenu_page() {
|
102 |
|
103 |
$admin_tree = array(
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['page_title'] ),
|
114 |
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['menu_title'] ),
|
115 |
$admin_tree['capability'],
|
@@ -122,8 +126,8 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
122 |
* Premium product registration
|
123 |
*
|
124 |
* @param $product_init | string | The product init file
|
125 |
-
* @param $secret_key
|
126 |
-
* @param $product_id
|
127 |
*
|
128 |
* @return void
|
129 |
*
|
@@ -131,11 +135,44 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
131 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
132 |
*/
|
133 |
public function register( $product_init, $secret_key, $product_id ) {
|
134 |
-
$theme
|
135 |
-
$products[$product_init]['Name']
|
136 |
-
$products[$product_init]['secret_key']
|
137 |
-
$products[$product_init]['product_id']
|
138 |
-
$this->_products[$product_init]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
}
|
141 |
}
|
@@ -147,7 +184,7 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
147 |
* @since 1.0
|
148 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
149 |
*/
|
150 |
-
if( !
|
151 |
function YIT_Theme_Licence() {
|
152 |
return YIT_Theme_Licence::instance();
|
153 |
}
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
+
if ( !defined( 'ABSPATH' ) ) {
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
+
if ( !class_exists( 'YIT_Theme_Licence' ) ) {
|
16 |
/**
|
17 |
* YIT Plugin Licence Panel
|
18 |
*
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
|
|
26 |
class YIT_Theme_Licence extends YIT_Licence {
|
27 |
|
28 |
/**
|
49 |
*/
|
50 |
protected $_product_type = 'theme';
|
51 |
|
52 |
+
/**
|
53 |
+
* @var string Old theme licence works until 28 January 2016
|
54 |
+
* @since 1.0
|
55 |
+
*/
|
56 |
+
protected $_old_licence_expires = 1453939200; //28 January 2016
|
57 |
+
|
58 |
/**
|
59 |
* Constructor
|
60 |
*
|
66 |
|
67 |
$this->_settings = array(
|
68 |
'parent_page' => 'yit_product_panel',
|
69 |
+
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
70 |
+
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
71 |
'capability' => 'manage_options',
|
72 |
'page' => 'yith_plugins_activation',
|
73 |
);
|
74 |
|
75 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
|
|
|
|
76 |
add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
77 |
+
add_action( "wp_ajax_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
78 |
add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
79 |
}
|
80 |
|
105 |
public function add_submenu_page() {
|
106 |
|
107 |
$admin_tree = array(
|
108 |
+
'parent_slug' => apply_filters( 'yit_licence_parent_slug', 'yit_panel' ),
|
109 |
+
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
110 |
+
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
111 |
+
'capability' => 'manage_options',
|
112 |
+
'menu_slug' => 'yit_panel_license',
|
113 |
+
'function' => 'show_activation_panel'
|
114 |
+
);
|
115 |
+
|
116 |
+
add_submenu_page( $admin_tree['parent_slug'],
|
117 |
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['page_title'] ),
|
118 |
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['menu_title'] ),
|
119 |
$admin_tree['capability'],
|
126 |
* Premium product registration
|
127 |
*
|
128 |
* @param $product_init | string | The product init file
|
129 |
+
* @param $secret_key | string | The product secret key
|
130 |
+
* @param $product_id | string | The product slug (product_id)
|
131 |
*
|
132 |
* @return void
|
133 |
*
|
135 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
136 |
*/
|
137 |
public function register( $product_init, $secret_key, $product_id ) {
|
138 |
+
$theme = wp_get_theme();
|
139 |
+
$products[$product_init]['Name'] = $theme->Name;
|
140 |
+
$products[$product_init]['secret_key'] = $secret_key;
|
141 |
+
$products[$product_init]['product_id'] = $product_id;
|
142 |
+
$this->_products[$product_init] = $products[$product_init];
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Check for old licence
|
147 |
+
*
|
148 |
+
* @return bool True for old licence period, false otherwise
|
149 |
+
* @since 2.2
|
150 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
151 |
+
*/
|
152 |
+
public function show_old_licence_message() {
|
153 |
+
return time() < $this->_old_licence_expires;
|
154 |
+
}
|
155 |
+
|
156 |
+
public function get_old_licence_message() {
|
157 |
+
ob_start(); ?>
|
158 |
+
<div class="activation-faq">
|
159 |
+
<h3><?php _e( 'I cannot find the license key for activating the theme I have bought some time ago. Where can I find it?', 'yith-plugin-fw' ) ?></h3>
|
160 |
+
|
161 |
+
<p>
|
162 |
+
<?php
|
163 |
+
_e( 'If you have purchased one of our products before 27 January 2015, you can benefit from support and updates (the services offered with the license)
|
164 |
+
until 27 January 2016 and you do not have to purchase it again to get a new license key, because, before this date, your license used to be activated automatically by our system.
|
165 |
+
After 27 January 2016, instead, if you want to benefit from support and updates you have to buy a new license and activate it through the license key you will be
|
166 |
+
provided with and that you can find in your YIThemes account, in section "My licenses".', 'yith-plugin-fw' )
|
167 |
+
?>
|
168 |
+
</p>
|
169 |
+
</div>
|
170 |
+
<?php
|
171 |
+
echo ob_get_clean();
|
172 |
+
}
|
173 |
+
|
174 |
+
public function get_product_type() {
|
175 |
+
return $this->_product_type;
|
176 |
}
|
177 |
}
|
178 |
}
|
184 |
* @since 1.0
|
185 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
186 |
*/
|
187 |
+
if ( !function_exists( 'YIT_Theme_Licence' ) ) {
|
188 |
function YIT_Theme_Licence() {
|
189 |
return YIT_Theme_Licence::instance();
|
190 |
}
|
plugin-fw/licence/templates/panel/activation/activation-panel.php
CHANGED
@@ -8,45 +8,40 @@
|
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
-
$to_active_products
|
12 |
-
$activated_products
|
13 |
-
$no_active_products
|
14 |
-
$expired_products
|
15 |
-
$banned_products
|
|
|
|
|
|
|
|
|
16 |
?>
|
17 |
|
18 |
<div class="yit-container product-licence-activation">
|
19 |
-
<h2><?php _e( 'Yithemes
|
20 |
-
|
21 |
-
<?php
|
22 |
-
<div class="activation-faq">
|
23 |
-
<h3><?php _e( 'I cannot find the license key for activating the theme I have bought some time ago. Where can I find it?', 'yith-plugin-fw' ) ?></h3>
|
24 |
-
<p>
|
25 |
-
<?php
|
26 |
-
_e( 'If you have purchased one of our products before 27 January 2015, you can benefit from support and updates (the services offered with the license)
|
27 |
-
until 27 January 2016 and you do not have to purchase it again to get a new license key, because, before this date, your license used to be activated automatically by our system.
|
28 |
-
After 27 January 2016, instead, if you want to benefit from support and updates you have to buy a new license and activate it through the license key you will be
|
29 |
-
provided with and that you can find in your YIThemes account, in section "My licenses".', 'yith-plugin-fw' )
|
30 |
-
?>
|
31 |
-
</p>
|
32 |
-
</div>
|
33 |
-
<?php endif; ?>
|
34 |
|
35 |
<div class="licence-check-section">
|
36 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
37 |
<span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
|
38 |
-
<input type="hidden" name="action" value="update_licence_information-<?php echo $this->
|
39 |
-
<input type="submit" name="submit" value="<?php _e( 'Update
|
40 |
<div class="spinner"></div>
|
41 |
</form>
|
42 |
</div>
|
43 |
|
44 |
-
|
|
|
|
|
45 |
|
|
|
46 |
|
47 |
<?php if( ! empty( $to_active_products ) ) : ?>
|
48 |
-
<h3 class="to-active">
|
49 |
-
<?php
|
50 |
<span class="spinner"></span>
|
51 |
</h3>
|
52 |
<div class="to-active-wrapper">
|
@@ -56,23 +51,22 @@ $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_produc
|
|
56 |
<tbody>
|
57 |
<tr class="product-row">
|
58 |
<td class="product-name">
|
59 |
-
<?php echo $info['Name'] ?>
|
60 |
</td>
|
61 |
<td>
|
62 |
<input type="email" name="email" placeholder="Your email on Yithemes.com" value="" class="user-email" />
|
63 |
</td>
|
64 |
<td>
|
65 |
-
<input type="text" name="licence_key" placeholder="
|
66 |
</td>
|
67 |
<td class="activate-button">
|
68 |
<input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' )?>" class="button-licence licence-activation" data-formid="<?php echo $info['product_id'] ?>"/>
|
69 |
</td>
|
70 |
</tr>
|
71 |
-
<input type="hidden" name="action" value="activate-<?php echo $this->
|
72 |
<input type="hidden" name="product_init" value="<?php echo $init ?>" />
|
73 |
</tbody>
|
74 |
</table>
|
75 |
-
<div class="spinner"></div>
|
76 |
<div class="message-wrapper">
|
77 |
<span class="message arrow-left"></span>
|
78 |
</div>
|
@@ -84,29 +78,78 @@ $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_produc
|
|
84 |
<!-- Activated Products -->
|
85 |
|
86 |
<?php if( ! empty( $activated_products ) ) : ?>
|
87 |
-
<h3
|
88 |
-
|
|
|
|
|
|
|
89 |
<thead>
|
90 |
<tr>
|
91 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
94 |
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
</tr>
|
98 |
</thead>
|
99 |
<tbody>
|
100 |
<?php foreach( $activated_products as $init => $info ) : ?>
|
101 |
<tr>
|
102 |
-
<td class="product-name"
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
</td>
|
109 |
-
<td><a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info['licence']['licence_key'] ) ?>" target="_blank"><?php _e( 'Renew', 'yith-plugin-fw' ) ?></a></td>
|
110 |
</tr>
|
111 |
<?php endforeach; ?>
|
112 |
</tbody>
|
@@ -121,16 +164,22 @@ $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_produc
|
|
121 |
<thead>
|
122 |
<tr>
|
123 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
124 |
-
|
125 |
-
|
|
|
|
|
126 |
</tr>
|
127 |
</thead>
|
128 |
<tbody>
|
129 |
<?php foreach( $banned_products as $init => $info ) : ?>
|
130 |
<tr>
|
131 |
-
<td class="product-name"
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
134 |
</tr>
|
135 |
<?php endforeach; ?>
|
136 |
</tbody>
|
@@ -145,20 +194,44 @@ $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_produc
|
|
145 |
<thead>
|
146 |
<tr>
|
147 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
150 |
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
151 |
-
|
|
|
|
|
|
|
152 |
</tr>
|
153 |
</thead>
|
154 |
<tbody>
|
155 |
<?php foreach( $expired_products as $init => $info ) : ?>
|
156 |
<tr>
|
157 |
-
<td class="product-name"
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
<td class="product-licence-expires"><?php echo date("F j, Y", $info['licence']['licence_expires'] ); ?></td>
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</tr>
|
163 |
<?php endforeach; ?>
|
164 |
</tbody>
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
+
$to_active_products = $this->get_to_active_products();
|
12 |
+
$activated_products = $this->get_activated_products();
|
13 |
+
$no_active_products = $this->get_no_active_licence_key();
|
14 |
+
$expired_products = isset( $no_active_products[ '106' ] ) ? $no_active_products[ '106' ] : array();
|
15 |
+
$banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_products[ '107' ] : array();
|
16 |
+
$notice = isset( $notice ) ? $notice : '';
|
17 |
+
$notice_class = ! empty( $notice ) ? 'notice notice-success visible' : 'notice notice-success';
|
18 |
+
$to_activate_check = $this instanceof YIT_Theme_Licence ? 1 : 2;
|
19 |
+
$num_members_products_activate = $this->get_number_of_membership_products();
|
20 |
?>
|
21 |
|
22 |
<div class="yit-container product-licence-activation">
|
23 |
+
<h2><?php _e( 'Yithemes License Activation', 'yith-plugin-fw' ) ?></h2>
|
24 |
+
|
25 |
+
<?php $this instanceof YIT_Theme_Licence && $this->show_old_licence_message() && $this->get_old_licence_message(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
<div class="licence-check-section">
|
28 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
29 |
<span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
|
30 |
+
<input type="hidden" name="action" value="update_licence_information-<?php echo $this->get_product_type(); ?>" />
|
31 |
+
<input type="submit" name="submit" value="<?php _e( 'Update license information', 'yith-plugin-fw' ) ?>" class="button-licence licence-check" />
|
32 |
<div class="spinner"></div>
|
33 |
</form>
|
34 |
</div>
|
35 |
|
36 |
+
<div id="yith-licence-notice" class="<?php echo $notice_class ?>">
|
37 |
+
<p class="yith-licence-notice-message"><?php echo $notice ?></p>
|
38 |
+
</div>
|
39 |
|
40 |
+
<!-- To Active Products -->
|
41 |
|
42 |
<?php if( ! empty( $to_active_products ) ) : ?>
|
43 |
+
<h3 id="products-to-active" class="to-active">
|
44 |
+
<?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
|
45 |
<span class="spinner"></span>
|
46 |
</h3>
|
47 |
<div class="to-active-wrapper">
|
51 |
<tbody>
|
52 |
<tr class="product-row">
|
53 |
<td class="product-name">
|
54 |
+
<?php echo $this->display_product_name( $info['Name'] ) ?>
|
55 |
</td>
|
56 |
<td>
|
57 |
<input type="email" name="email" placeholder="Your email on Yithemes.com" value="" class="user-email" />
|
58 |
</td>
|
59 |
<td>
|
60 |
+
<input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key" />
|
61 |
</td>
|
62 |
<td class="activate-button">
|
63 |
<input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' )?>" class="button-licence licence-activation" data-formid="<?php echo $info['product_id'] ?>"/>
|
64 |
</td>
|
65 |
</tr>
|
66 |
+
<input type="hidden" name="action" value="activate-<?php echo $this->get_product_type(); ?>" />
|
67 |
<input type="hidden" name="product_init" value="<?php echo $init ?>" />
|
68 |
</tbody>
|
69 |
</table>
|
|
|
70 |
<div class="message-wrapper">
|
71 |
<span class="message arrow-left"></span>
|
72 |
</div>
|
78 |
<!-- Activated Products -->
|
79 |
|
80 |
<?php if( ! empty( $activated_products ) ) : ?>
|
81 |
+
<h3 id="activated-products">
|
82 |
+
<?php _e( 'Activated', 'yith-plugin-fw' ) ?>
|
83 |
+
<span class="spinner"></span>
|
84 |
+
</h3>
|
85 |
+
<table class="activated-table">
|
86 |
<thead>
|
87 |
<tr>
|
88 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
89 |
+
<?php if( $this->show_extra_info ) : ?>
|
90 |
+
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
91 |
+
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
92 |
+
<?php endif; ?>
|
93 |
+
|
94 |
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
95 |
+
|
96 |
+
<?php if( $this->show_extra_info ) : ?>
|
97 |
+
<th><?php _e( 'Remaining', 'yith-plugin-fw' ) ?></th>
|
98 |
+
<?php if( $num_members_products_activate ) : ?>
|
99 |
+
<th><?php _e( 'Membership', 'yith-plugin-fw' ) ?></th>
|
100 |
+
<?php endif; ?>
|
101 |
+
<?php endif; ?>
|
102 |
+
|
103 |
+
<th><?php _e( 'License Actions', 'yith-plugin-fw' ) ?></th>
|
104 |
</tr>
|
105 |
</thead>
|
106 |
<tbody>
|
107 |
<?php foreach( $activated_products as $init => $info ) : ?>
|
108 |
<tr>
|
109 |
+
<td class="product-name">
|
110 |
+
<?php echo $this->display_product_name( $info['Name'] ) ?>
|
111 |
+
</td>
|
112 |
+
|
113 |
+
<?php if( $this->show_extra_info ) : ?>
|
114 |
+
<td class="product-licence-email">
|
115 |
+
<?php echo $info['licence']['email'] ?>
|
116 |
+
</td>
|
117 |
+
<td class="product-licence-key">
|
118 |
+
<?php echo $info['licence']['licence_key'] ?>
|
119 |
+
</td>
|
120 |
+
<?php endif; ?>
|
121 |
+
|
122 |
+
<td class="product-licence-expires">
|
123 |
+
<?php echo date("F j, Y", $info['licence']['licence_expires'] ); ?>
|
124 |
+
</td>
|
125 |
+
|
126 |
+
<?php if( $this->show_extra_info ) : ?>
|
127 |
+
<td class="product-licence-remaining">
|
128 |
+
<?php printf( __( '%1s out of %2s', 'yith-plugin-fw' ), $info['licence']['activation_remaining'], $info['licence']['activation_limit'] ); ?>
|
129 |
+
</td>
|
130 |
+
<?php if( $num_members_products_activate ) : ?>
|
131 |
+
<td class="product-licence-membership">
|
132 |
+
<span class="dashicons dashicons-<?php echo $info['licence']['is_membership'] ? 'yes' : 'no-alt' ?>"></span>
|
133 |
+
</td>
|
134 |
+
<?php endif; ?>
|
135 |
+
<?php endif; ?>
|
136 |
+
|
137 |
+
<td>
|
138 |
+
<a class="button-licence licence-deactive"
|
139 |
+
href="#"
|
140 |
+
data-licence-email="<?php echo $info['licence']['email'] ?>"
|
141 |
+
data-licence-key="<?php echo $info['licence']['licence_key'] ?>"
|
142 |
+
data-product-init="<?php echo $init ?>"
|
143 |
+
data-action="deactivate-<?php echo $this->get_product_type(); ?>">
|
144 |
+
<?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
|
145 |
+
</a>
|
146 |
+
|
147 |
+
<?php if( ! $info['licence']['is_membership'] && $this->show_renew_button ) : ?>
|
148 |
+
<a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info['licence']['licence_key'] ) ?>" target="_blank">
|
149 |
+
<?php _e( 'Renew', 'yith-plugin-fw' ) ?>
|
150 |
+
</a>
|
151 |
+
<?php endif; ?>
|
152 |
</td>
|
|
|
153 |
</tr>
|
154 |
<?php endforeach; ?>
|
155 |
</tbody>
|
164 |
<thead>
|
165 |
<tr>
|
166 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
167 |
+
<?php if( $this->show_extra_info ) : ?>
|
168 |
+
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
169 |
+
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
170 |
+
<?php endif; ?>
|
171 |
</tr>
|
172 |
</thead>
|
173 |
<tbody>
|
174 |
<?php foreach( $banned_products as $init => $info ) : ?>
|
175 |
<tr>
|
176 |
+
<td class="product-name">
|
177 |
+
<?php echo $this->display_product_name( $info['Name'] ) ?>
|
178 |
+
</td>
|
179 |
+
<?php if( $this->show_extra_info ) : ?>
|
180 |
+
<td class="product-licence-email"><?php echo $info['licence']['email'] ?></td>
|
181 |
+
<td class="product-licence-key"><?php echo $info['licence']['licence_key'] ?></td>
|
182 |
+
<?php endif; ?>
|
183 |
</tr>
|
184 |
<?php endforeach; ?>
|
185 |
</tbody>
|
194 |
<thead>
|
195 |
<tr>
|
196 |
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
197 |
+
|
198 |
+
<?php if( $this->show_extra_info ) : ?>
|
199 |
+
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
200 |
+
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
201 |
+
<?php endif; ?>
|
202 |
+
|
203 |
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
204 |
+
|
205 |
+
<?php if( $this->show_renew_button ) : ?>
|
206 |
+
<th><?php _e( 'Renew', 'yith-plugin-fw' ) ?></th>
|
207 |
+
<?php endif; ?>
|
208 |
</tr>
|
209 |
</thead>
|
210 |
<tbody>
|
211 |
<?php foreach( $expired_products as $init => $info ) : ?>
|
212 |
<tr>
|
213 |
+
<td class="product-name">
|
214 |
+
<?php echo $this->display_product_name( $info['Name'] ) ?>
|
215 |
+
</td>
|
216 |
+
|
217 |
+
<?php if( $this->show_extra_info ) : ?>
|
218 |
+
<td class="product-licence-email"><?php echo $info['licence']['email'] ?></td>
|
219 |
+
<td class="product-licence-key"><?php echo $info['licence']['licence_key'] ?></td>
|
220 |
+
<?php endif; ?>
|
221 |
+
|
222 |
<td class="product-licence-expires"><?php echo date("F j, Y", $info['licence']['licence_expires'] ); ?></td>
|
223 |
+
|
224 |
+
<?php if( $this->show_renew_button ) : ?>
|
225 |
+
<td>
|
226 |
+
<a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info['licence']['licence_key'] ) ?>" target="_blank">
|
227 |
+
<?php if( $info['licence']['is_membership'] ) : ?>
|
228 |
+
<?php _e( 'Order again', 'yith-plugin-fw' ) ?>
|
229 |
+
<?php else : ?>
|
230 |
+
<?php __( 'Renew license', 'yith-plugin-fw' ) ?>
|
231 |
+
<?php endif; ?>
|
232 |
+
</a>
|
233 |
+
</td>
|
234 |
+
<?php endif; ?>
|
235 |
</tr>
|
236 |
<?php endforeach; ?>
|
237 |
</tbody>
|
plugin-fw/templates/metaboxes/types/number.php
CHANGED
@@ -14,12 +14,25 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
|
15 |
extract( $args );
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
?>
|
18 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?>>
|
19 |
<div class="rm_number">
|
20 |
<label for="<?php echo $id ?>"><?php echo $label ?></label>
|
21 |
<span class="field">
|
22 |
-
<input class="number" type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" <?php echo $
|
23 |
<?php yit_string( '<span class="description">', $desc, '</span>' ); ?>
|
24 |
</span>
|
25 |
</div>
|
14 |
|
15 |
extract( $args );
|
16 |
|
17 |
+
$min_max_attr = $step_attr = '';
|
18 |
+
|
19 |
+
if( isset( $min ) ){
|
20 |
+
$min_max_attr .= " min='{$min}'";
|
21 |
+
}
|
22 |
+
|
23 |
+
if( isset( $max ) ){
|
24 |
+
$min_max_attr .= " max='{$max}'";
|
25 |
+
}
|
26 |
+
|
27 |
+
if( isset( $step ) ){
|
28 |
+
$step_attr .= "step='{$step}'";
|
29 |
+
}
|
30 |
?>
|
31 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?>>
|
32 |
<div class="rm_number">
|
33 |
<label for="<?php echo $id ?>"><?php echo $label ?></label>
|
34 |
<span class="field">
|
35 |
+
<input class="number" type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" <?php echo $step_attr ?> <?php echo $min_max_attr ?> value="<?php echo esc_attr( $value ) ?>" <?php if( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?>" />
|
36 |
<?php yit_string( '<span class="description">', $desc, '</span>' ); ?>
|
37 |
</span>
|
38 |
</div>
|
plugin-fw/templates/panel/types/upload.php
CHANGED
@@ -26,9 +26,10 @@ $name = $this->get_name_field( $option['id'] );
|
|
26 |
?>
|
27 |
<div id="<?php echo $id ?>-container" >
|
28 |
<div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload" <?php if ( isset( $option['deps'] ) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $this->get_id_field( $option['deps']['ids'] ) ?>" data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
|
29 |
-
<div class="option">
|
30 |
<input type="text" name="<?php echo $name ?>" id="<?php echo $id ?>" value="<?php echo $db_value == '1' ? '' : esc_attr( $db_value ) ?>" class="upload_img_url" />
|
31 |
<input type="button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button" class="upload_button button" />
|
|
|
32 |
</div>
|
33 |
<div class="clear"></div>
|
34 |
<span class="description"><?php echo $option['desc'] ?></span>
|
26 |
?>
|
27 |
<div id="<?php echo $id ?>-container" >
|
28 |
<div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload" <?php if ( isset( $option['deps'] ) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $this->get_id_field( $option['deps']['ids'] ) ?>" data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
|
29 |
+
<div class="option yit-upload">
|
30 |
<input type="text" name="<?php echo $name ?>" id="<?php echo $id ?>" value="<?php echo $db_value == '1' ? '' : esc_attr( $db_value ) ?>" class="upload_img_url" />
|
31 |
<input type="button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button" class="upload_button button" />
|
32 |
+
<input type="button" value="<?php _e( 'Reset', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button_reset" class="upload_button_reset button" data-default="<?php echo $option['std'] ?>"/>
|
33 |
</div>
|
34 |
<div class="clear"></div>
|
35 |
<span class="description"><?php echo $option['desc'] ?></span>
|
plugin-fw/yit-functions.php
CHANGED
@@ -8,11 +8,11 @@
|
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
-
if ( ! function_exists( 'yit_plugin_locate_template' ) ) {
|
16 |
/**
|
17 |
* Locate the templates and return the path of the file found
|
18 |
*
|
@@ -23,12 +23,12 @@ if ( ! function_exists( 'yit_plugin_locate_template' ) ) {
|
|
23 |
* @return string
|
24 |
* @since 2.0.0
|
25 |
*/
|
26 |
-
function yit_plugin_locate_template( $plugin_basename, $path, $var = NULL ) {
|
27 |
|
28 |
$template_path = '/theme/templates/' . $path;
|
29 |
|
30 |
-
$located = locate_template( array(
|
31 |
-
$template_path
|
32 |
) );
|
33 |
|
34 |
if ( ! $located ) {
|
@@ -40,7 +40,7 @@ if ( ! function_exists( 'yit_plugin_locate_template' ) ) {
|
|
40 |
|
41 |
}
|
42 |
|
43 |
-
if ( ! function_exists( 'yit_plugin_get_template' ) ) {
|
44 |
/**
|
45 |
* Retrieve a template file.
|
46 |
*
|
@@ -52,30 +52,30 @@ if ( ! function_exists( 'yit_plugin_get_template' ) ) {
|
|
52 |
* @return string
|
53 |
* @since 2.0.0
|
54 |
*/
|
55 |
-
function yit_plugin_get_template( $plugin_basename, $path, $var = null, $return = false ) {
|
56 |
|
57 |
-
$located = yit_plugin_locate_template( $plugin_basename, $path, $var );
|
58 |
|
59 |
-
if ( $var && is_array( $var ) ) {
|
60 |
-
extract( $var );
|
61 |
}
|
62 |
|
63 |
if ( $return ) {
|
64 |
-
ob_start();
|
65 |
}
|
66 |
|
67 |
// include file located
|
68 |
-
if( file_exists( $located ) ){
|
69 |
-
include( $located );
|
70 |
}
|
71 |
|
72 |
if ( $return ) {
|
73 |
-
return ob_get_clean();
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
|
78 |
-
if ( ! function_exists( 'yit_plugin_content' ) ) {
|
79 |
/**
|
80 |
* Return post content with read more link (if needed)
|
81 |
*
|
@@ -88,85 +88,79 @@ if ( ! function_exists( 'yit_plugin_content' ) ) {
|
|
88 |
* @return string
|
89 |
* @since 2.0.0
|
90 |
*/
|
91 |
-
function yit_plugin_content( $what = 'content', $limit = 25, $more_text = '', $split = '[...]', $in_paragraph = 'true' ) {
|
92 |
if ( $what == 'content' ) {
|
93 |
-
$content = get_the_content( $more_text );
|
94 |
-
}
|
95 |
-
else {
|
96 |
if ( $what == 'excerpt' ) {
|
97 |
-
$content = get_the_excerpt();
|
98 |
-
}
|
99 |
-
else {
|
100 |
$content = $what;
|
101 |
}
|
102 |
}
|
103 |
|
104 |
if ( $limit == 0 ) {
|
105 |
if ( $what == 'excerpt' ) {
|
106 |
-
$content = apply_filters( 'the_excerpt', $content );
|
107 |
-
}
|
108 |
-
|
109 |
-
$content =
|
110 |
-
$content =
|
111 |
-
$content = str_replace( ']]>', ']]>', $content );
|
112 |
}
|
113 |
|
114 |
return $content;
|
115 |
}
|
116 |
|
117 |
// remove the tag more from the content
|
118 |
-
if ( preg_match( "/<(a)[^>]*class\s*=\s*(['\"])more-link\\2[^>]*>(.*?)<\/\\1>/", $content, $matches ) ) {
|
119 |
|
120 |
-
if ( strpos( $matches[0], '[button' ) ) {
|
121 |
-
$more_link = str_replace( 'href="#"', 'href="' . get_permalink() . '"', do_shortcode( $matches[3] ) );
|
122 |
-
}
|
123 |
-
|
124 |
-
$more_link = $matches[0];
|
125 |
}
|
126 |
|
127 |
-
$content = str_replace( $more_link, '', $content );
|
128 |
$split = '';
|
129 |
}
|
130 |
|
131 |
if ( empty( $content ) ) {
|
132 |
return;
|
133 |
}
|
134 |
-
$content = explode( ' ', $content );
|
135 |
|
136 |
if ( ! empty( $more_text ) && ! isset( $more_link ) ) {
|
137 |
//array_pop( $content );
|
138 |
-
$more_link = strpos( $more_text, '<a class="btn"' ) ? $more_text : '<a class="read-more' . apply_filters( 'yit_simple_read_more_classes', ' ' ) . '" href="' . get_permalink() . '">' . $more_text . '</a>';
|
139 |
$split = '';
|
140 |
-
}
|
141 |
-
elseif ( ! isset( $more_link ) ) {
|
142 |
$more_link = '';
|
143 |
}
|
144 |
|
145 |
// split
|
146 |
-
if ( count( $content ) >= $limit ) {
|
147 |
$split_content = '';
|
148 |
for ( $i = 0; $i < $limit; $i ++ ) {
|
149 |
-
$split_content .= $content[$i] . ' ';
|
150 |
}
|
151 |
|
152 |
$content = $split_content . $split;
|
153 |
-
}
|
154 |
-
|
155 |
-
$content = implode( " ", $content );
|
156 |
}
|
157 |
|
158 |
// TAGS UNCLOSED
|
159 |
-
$tags = array();
|
160 |
// get all tags opened
|
161 |
-
preg_match_all( "/(<([\w]+)[^>]*>)/", $content, $tags_opened, PREG_SET_ORDER );
|
162 |
foreach ( $tags_opened as $tag ) {
|
163 |
-
$tags[] = $tag[2];
|
164 |
}
|
165 |
|
166 |
// get all tags closed and remove it from the tags opened.. the rest will be closed at the end of the content
|
167 |
-
preg_match_all( "/(<\/([\w]+)[^>]*>)/", $content, $tags_closed, PREG_SET_ORDER );
|
168 |
foreach ( $tags_closed as $tag ) {
|
169 |
-
unset( $tags[array_search( $tag[2], $tags )] );
|
170 |
}
|
171 |
|
172 |
// close the tags
|
@@ -178,16 +172,16 @@ if ( ! function_exists( 'yit_plugin_content' ) ) {
|
|
178 |
|
179 |
//$content = preg_replace( '/\[.+\]/', '', $content );
|
180 |
if ( $in_paragraph == true ): $content .= $more_link; endif;
|
181 |
-
$content = preg_replace( '/<img[^>]+./', '', $content ); //remove images
|
182 |
-
$content = apply_filters( 'the_content', $content );
|
183 |
-
$content = str_replace( ']]>', ']]>', $content ); // echo str_replace( array( '<', '>' ), array( '<', '>' ), $content );
|
184 |
if ( $in_paragraph == false ): $content .= $more_link; endif;
|
185 |
|
186 |
return $content;
|
187 |
}
|
188 |
}
|
189 |
|
190 |
-
if ( ! function_exists( 'yit_plugin_string' ) ) {
|
191 |
/**
|
192 |
* Simple echo a string, with a before and after string, only if the main string is not empty.
|
193 |
*
|
@@ -199,10 +193,10 @@ if ( ! function_exists( 'yit_plugin_string' ) ) {
|
|
199 |
* @return string The complete string, if the main string is not empty or null
|
200 |
* @since 2.0.0
|
201 |
*/
|
202 |
-
function yit_plugin_string( $before = '', $string = '', $after = '', $echo = true ) {
|
203 |
$html = '';
|
204 |
|
205 |
-
if ( $string != '' AND ! is_null( $string ) ) {
|
206 |
$html = $before . $string . $after;
|
207 |
}
|
208 |
|
@@ -214,7 +208,7 @@ if ( ! function_exists( 'yit_plugin_string' ) ) {
|
|
214 |
}
|
215 |
}
|
216 |
|
217 |
-
if ( ! function_exists( 'yit_plugin_decode_title' ) ) {
|
218 |
/**
|
219 |
* Change some special characters to put easily html into a string
|
220 |
*
|
@@ -228,14 +222,14 @@ if ( ! function_exists( 'yit_plugin_decode_title' ) ) {
|
|
228 |
*
|
229 |
* @since 1.0
|
230 |
*/
|
231 |
-
function yit_plugin_decode_title( $title ) {
|
232 |
-
$replaces = apply_filters( 'yit_title_special_characters', array() );
|
233 |
|
234 |
-
return preg_replace( array_keys( $replaces ), array_values( $replaces ), $title );
|
235 |
}
|
236 |
}
|
237 |
|
238 |
-
if ( ! function_exists( 'yit_plugin_get_attachment_id' ) ) {
|
239 |
|
240 |
/**
|
241 |
* Return the ID of an attachment.
|
@@ -247,49 +241,49 @@ if ( ! function_exists( 'yit_plugin_get_attachment_id' ) ) {
|
|
247 |
* @since 2.0.0
|
248 |
*/
|
249 |
|
250 |
-
function yit_plugin_get_attachment_id( $url ) {
|
251 |
|
252 |
-
$upload_dir = wp_upload_dir();
|
253 |
-
$dir = trailingslashit( $upload_dir['baseurl'] );
|
254 |
|
255 |
-
if ( false === strpos( $url, $dir ) ) {
|
256 |
return false;
|
257 |
}
|
258 |
|
259 |
-
$file = basename( $url );
|
260 |
|
261 |
-
$query = array(
|
262 |
'post_type' => 'attachment',
|
263 |
'fields' => 'ids',
|
264 |
-
'meta_query' => array(
|
265 |
-
array(
|
266 |
'value' => $file,
|
267 |
'compare' => 'LIKE',
|
268 |
-
)
|
269 |
-
)
|
270 |
);
|
271 |
|
272 |
-
$query['meta_query'][0]['key'] = '_wp_attached_file';
|
273 |
-
$ids
|
274 |
|
275 |
foreach ( $ids as $id ) {
|
276 |
-
$attachment_image = wp_get_attachment_image_src( $id, 'full' );
|
277 |
-
if ( $url == array_shift( $attachment_image ) || $url == str_replace( 'https://', 'http://', array_shift( $attachment_image ) ) ) {
|
278 |
return $id;
|
279 |
}
|
280 |
}
|
281 |
-
$query['meta_query'][0]['key'] = '_wp_attachment_metadata';
|
282 |
-
$ids
|
283 |
|
284 |
foreach ( $ids as $id ) {
|
285 |
|
286 |
-
$meta = wp_get_attachment_metadata( $id );
|
287 |
-
if ( ! isset( $meta['sizes'] ) ) {
|
288 |
continue;
|
289 |
}
|
290 |
|
291 |
-
foreach ( (array)
|
292 |
-
if ( $values['file'] == $file && $url == str_replace( 'https://', 'http://', array_shift( wp_get_attachment_image_src( $id, $size ) ) ) ) {
|
293 |
|
294 |
return $id;
|
295 |
}
|
@@ -300,7 +294,7 @@ if ( ! function_exists( 'yit_plugin_get_attachment_id' ) ) {
|
|
300 |
}
|
301 |
}
|
302 |
|
303 |
-
if ( ! function_exists( 'yit_enqueue_script' ) ) {
|
304 |
/**
|
305 |
* Enqueues script.
|
306 |
*
|
@@ -310,19 +304,18 @@ if ( ! function_exists( 'yit_enqueue_script' ) ) {
|
|
310 |
* @author Simone D'Amico <simone.damico@yithemes.com>
|
311 |
* @see yit_register_script() For parameter information.
|
312 |
*/
|
313 |
-
function yit_enqueue_script( $handle, $src, $deps = array(), $ver = false, $in_footer = true ) {
|
314 |
|
315 |
-
if ( function_exists( 'YIT_Asset' ) && ! is_admin() ) {
|
316 |
$enqueue = true;
|
317 |
-
YIT_Asset()->set( 'script', $handle, compact( 'src', 'deps', 'ver', 'in_footer', 'enqueue' ) );
|
318 |
-
}
|
319 |
-
|
320 |
-
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
|
321 |
}
|
322 |
}
|
323 |
}
|
324 |
|
325 |
-
if ( ! function_exists( 'yit_enqueue_style' ) ) {
|
326 |
/**
|
327 |
* Enqueues style.
|
328 |
*
|
@@ -332,54 +325,53 @@ if ( ! function_exists( 'yit_enqueue_style' ) ) {
|
|
332 |
* @author Simone D'Amico <simone.damico@yithemes.com>
|
333 |
* @see yit_register_style() For parameter information.
|
334 |
*/
|
335 |
-
function yit_enqueue_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
|
336 |
|
337 |
-
if ( function_exists( 'YIT_Asset' ) ) {
|
338 |
$enqueue = true;
|
339 |
-
$who = YIT_Asset()->get_stylesheet_handle( get_stylesheet_uri(), 'style' );
|
340 |
$where = 'before';
|
341 |
|
342 |
-
if( false == $who ){
|
343 |
$who = '';
|
344 |
}
|
345 |
|
346 |
-
YIT_Asset()->set( 'style', $handle, compact( 'src', 'deps', 'ver', 'media', 'enqueue' ), $where, $who );
|
347 |
-
}
|
348 |
-
|
349 |
-
wp_enqueue_style( $handle, $src, $deps, $ver, $media );
|
350 |
}
|
351 |
}
|
352 |
}
|
353 |
|
354 |
-
if ( ! function_exists( 'yit_get_post_meta' ) ) {
|
355 |
/**
|
356 |
* Retrieve the value of a metabox.
|
357 |
*
|
358 |
* This function retrieve the value of a metabox attached to a post. It return either a single value or an array.
|
359 |
*
|
360 |
-
* @param int $id
|
361 |
-
* @param string $meta
|
362 |
*
|
363 |
* @return mixed Single value or array
|
364 |
* @since 2.0.0
|
365 |
*/
|
366 |
-
function yit_get_post_meta( $id, $meta ) {
|
367 |
-
if ( ! strpos( $meta, '[' ) ) {
|
368 |
-
return get_post_meta( $id, $meta, true );
|
369 |
}
|
370 |
|
371 |
-
$sub_meta = explode( '[', $meta );
|
372 |
|
373 |
-
$meta = get_post_meta( $id, $meta, true );
|
374 |
-
for ( $i = 0; $i < count( $sub_meta ); $i ++ ) {
|
375 |
-
$meta = $meta[rtrim( $sub_meta[$i], ']' )];
|
376 |
}
|
377 |
|
378 |
return $meta;
|
379 |
}
|
380 |
}
|
381 |
|
382 |
-
if ( ! function_exists( 'yit_string' ) ) {
|
383 |
/**
|
384 |
* Simple echo a string, with a before and after string, only if the main string is not empty.
|
385 |
*
|
@@ -391,10 +383,10 @@ if ( ! function_exists( 'yit_string' ) ) {
|
|
391 |
* @return string The complete string, if the main string is not empty or null
|
392 |
* @since 2.0.0
|
393 |
*/
|
394 |
-
function yit_string( $before = '', $string = '', $after = '', $echo = true ) {
|
395 |
$html = '';
|
396 |
|
397 |
-
if ( $string != '' AND ! is_null( $string ) ) {
|
398 |
$html = $before . $string . $after;
|
399 |
}
|
400 |
|
@@ -407,7 +399,7 @@ if ( ! function_exists( 'yit_string' ) ) {
|
|
407 |
}
|
408 |
|
409 |
|
410 |
-
if ( ! function_exists( 'yit_pagination' ) ) {
|
411 |
/**
|
412 |
* Print pagination
|
413 |
*
|
@@ -417,12 +409,12 @@ if ( ! function_exists( 'yit_pagination' ) ) {
|
|
417 |
* @return string
|
418 |
* @since 2.0.0
|
419 |
*/
|
420 |
-
function yit_pagination( $pages = '', $range = 10 ) {
|
421 |
$showitems = ( $range * 2 ) + 1;
|
422 |
|
423 |
-
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : false;
|
424 |
if ( $paged === false ) {
|
425 |
-
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : false;
|
426 |
}
|
427 |
if ( $paged === false ) {
|
428 |
$paged = 1;
|
@@ -446,60 +438,60 @@ if ( ! function_exists( 'yit_pagination' ) ) {
|
|
446 |
if ( 1 != $pages ) {
|
447 |
$html .= "<div class='general-pagination clearfix'>";
|
448 |
if ( $paged > 2 ) {
|
449 |
-
$html .= sprintf( '<a class="%s" href="%s">«</a>', 'yit_pagination_first', get_pagenum_link( 1 ) );
|
450 |
}
|
451 |
if ( $paged > 1 ) {
|
452 |
-
$html .= sprintf( '<a class="%s" href="%s">‹</a>', 'yit_pagination_previous', get_pagenum_link( $paged - 1 ) );
|
453 |
}
|
454 |
|
455 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
456 |
if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
|
457 |
$class = ( $paged == $i ) ? " class='selected'" : '';
|
458 |
-
$html .= "<a href='" . get_pagenum_link( $i ) . "'$class >$i</a>";
|
459 |
}
|
460 |
}
|
461 |
|
462 |
if ( $paged < $pages ) {
|
463 |
-
$html .= sprintf( '<a class="%s" href="%s">›</a>', 'yit_pagination_next', get_pagenum_link( $paged + 1 ) );
|
464 |
}
|
465 |
if ( $paged < $pages - 1 ) {
|
466 |
-
$html .= sprintf( '<a class="%s" href="%s">»</a>', 'yit_pagination_last', get_pagenum_link( $pages ) );
|
467 |
}
|
468 |
|
469 |
$html .= "</div>\n";
|
470 |
}
|
471 |
|
472 |
-
echo apply_filters( 'yit_pagination_html', $html );
|
473 |
}
|
474 |
}
|
475 |
|
476 |
-
if ( ! function_exists( 'yit_registered_sidebars' ) ) {
|
477 |
/**
|
478 |
* Retrieve all registered sidebars
|
479 |
*
|
480 |
* @return array
|
481 |
* @since 2.0.0
|
482 |
*/
|
483 |
-
function yit_registered_sidebars() {
|
484 |
global $wp_registered_sidebars;
|
485 |
|
486 |
-
$return = array();
|
487 |
|
488 |
if ( empty( $wp_registered_sidebars ) ) {
|
489 |
-
$return = array( '' => '' );
|
490 |
}
|
491 |
|
492 |
-
foreach ( ( array )
|
493 |
-
$return[$the_['name']] = $the_['name'];
|
494 |
}
|
495 |
|
496 |
-
ksort( $return );
|
497 |
|
498 |
return $return;
|
499 |
}
|
500 |
}
|
501 |
|
502 |
-
if ( ! function_exists( 'yit_layout_option' ) ) {
|
503 |
/**
|
504 |
* Retrieve a layout option
|
505 |
*
|
@@ -511,20 +503,18 @@ if ( ! function_exists( 'yit_layout_option' ) ) {
|
|
511 |
* @return array
|
512 |
* @since 2.0.0
|
513 |
*/
|
514 |
-
function yit_layout_option( $key, $id = false, $type = "post", $model = "post_type" ) {
|
515 |
|
516 |
$option = '';
|
517 |
|
518 |
-
if ( defined( 'YIT' ) ) {
|
519 |
-
$option = YIT_Layout_Panel()->get_option( $key, $id, $type, $model );
|
520 |
-
}
|
521 |
-
|
522 |
-
if ( ! $id && ( is_single() || is_page() ) ) {
|
523 |
global $post;
|
524 |
$id = $post->ID;
|
525 |
-
}
|
526 |
-
|
527 |
-
$option = get_post_meta( $id, $key );
|
528 |
}
|
529 |
}
|
530 |
|
@@ -532,32 +522,31 @@ if ( ! function_exists( 'yit_layout_option' ) ) {
|
|
532 |
}
|
533 |
}
|
534 |
|
535 |
-
if ( ! function_exists( 'yit_curPageURL' ) ) {
|
536 |
/**
|
537 |
* Retrieve the current complete url
|
538 |
*
|
539 |
* @since 1.0
|
540 |
*/
|
541 |
-
function yit_curPageURL() {
|
542 |
$pageURL = 'http';
|
543 |
-
if ( isset( $_SERVER["HTTPS"] ) AND $_SERVER["HTTPS"] == "on" ) {
|
544 |
$pageURL .= "s";
|
545 |
}
|
546 |
|
547 |
$pageURL .= "://";
|
548 |
|
549 |
-
if ( isset( $_SERVER["SERVER_PORT"] ) AND $_SERVER["SERVER_PORT"] != "80" ) {
|
550 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
551 |
-
}
|
552 |
-
|
553 |
-
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
554 |
}
|
555 |
|
556 |
return $pageURL;
|
557 |
}
|
558 |
}
|
559 |
|
560 |
-
if ( ! function_exists( 'yit_get_excluded_categories' ) ) {
|
561 |
/**
|
562 |
*
|
563 |
* Retrieve the escluded categories, set on Theme Options
|
@@ -569,7 +558,7 @@ if ( ! function_exists( 'yit_get_excluded_categories' ) ) {
|
|
569 |
* @since 2.0.0
|
570 |
*/
|
571 |
|
572 |
-
function yit_get_excluded_categories( $k = 1 ) {
|
573 |
|
574 |
global $post;
|
575 |
|
@@ -577,20 +566,20 @@ if ( ! function_exists( 'yit_get_excluded_categories' ) ) {
|
|
577 |
return;
|
578 |
}
|
579 |
|
580 |
-
$cf_cats = get_post_meta( $post->ID, 'blog-cats', true);
|
581 |
|
582 |
-
if ( ! empty( $cf_cats ) ){
|
583 |
return $cf_cats;
|
584 |
}
|
585 |
|
586 |
-
$cats = function_exists( 'yit_get_option' ) ? yit_get_option( 'blog-excluded-cats' ) : '';
|
587 |
|
588 |
|
589 |
-
if ( ! is_array( $cats ) || empty( $cats ) || ! isset( $cats[$k] ) ) {
|
590 |
return;
|
591 |
}
|
592 |
|
593 |
-
$cats = array_map( 'trim', $cats[$k] );
|
594 |
|
595 |
$i = 0;
|
596 |
$query = '';
|
@@ -600,15 +589,15 @@ if ( ! function_exists( 'yit_get_excluded_categories' ) ) {
|
|
600 |
$i ++;
|
601 |
}
|
602 |
|
603 |
-
ltrim( ',', $query );
|
604 |
|
605 |
return $query;
|
606 |
}
|
607 |
}
|
608 |
|
609 |
|
610 |
-
if ( ! function_exists( 'yit_add_extra_theme_headers' ) ) {
|
611 |
-
add_filter( 'extra_theme_headers', 'yit_add_extra_theme_headers' );
|
612 |
|
613 |
/**
|
614 |
* Check the framework core version
|
@@ -619,13 +608,14 @@ if ( ! function_exists( 'yit_add_extra_theme_headers' ) ) {
|
|
619 |
* @since 2.0.0
|
620 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
621 |
*/
|
622 |
-
function yit_add_extra_theme_headers( $headers ) {
|
623 |
$headers[] = 'Core Framework Version';
|
|
|
624 |
return $headers;
|
625 |
}
|
626 |
}
|
627 |
|
628 |
-
if ( ! function_exists( 'yit_check_plugin_support' ) ) {
|
629 |
/**
|
630 |
* Check the framework core version
|
631 |
*
|
@@ -633,75 +623,76 @@ if ( ! function_exists( 'yit_check_plugin_support' ) ) {
|
|
633 |
* @since 2.0.0
|
634 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
635 |
*/
|
636 |
-
function yit_check_plugin_support() {
|
637 |
|
638 |
-
$headers['core'] = wp_get_theme()->get( 'Core Framework Version' );
|
639 |
-
$headers['author'] = wp_get_theme()->get( 'Author' );
|
640 |
|
641 |
-
if( ! $headers['core'] && defined( 'YIT_CORE_VERSION' ) ) {
|
642 |
-
$headers['core'] = YIT_CORE_VERSION;
|
643 |
}
|
644 |
|
645 |
-
if ( ( ! empty( $headers['core'] ) && version_compare( $headers['core'], '2.0.0', '<=' ) ) || $headers['author'] != 'Your Inspiration Themes' ) {
|
646 |
return true;
|
647 |
-
}
|
648 |
-
else {
|
649 |
return false;
|
650 |
}
|
651 |
}
|
652 |
}
|
653 |
|
654 |
-
if( !function_exists( 'yit_ie_version' ) ) {
|
655 |
/**
|
656 |
* Retrieve IE version.
|
657 |
*
|
658 |
* @return int|float
|
659 |
-
* @since
|
660 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
661 |
*/
|
662 |
-
function yit_ie_version() {
|
663 |
-
preg_match('/MSIE ([0-9]\.[0-9])/'
|
664 |
-
if ( ! isset( $reg[1] ) )
|
665 |
-
|
666 |
-
else
|
667 |
-
|
|
|
668 |
}
|
669 |
}
|
670 |
|
671 |
-
if( ! function_exists( 'yit_avoid_duplicate' ) ) {
|
672 |
/**
|
673 |
* Check if something exists. If yes, add a -N to the value where N is a number.
|
674 |
*
|
675 |
-
* @param mixed
|
676 |
-
* @param array
|
677 |
* @param string $check
|
|
|
678 |
* @return mixed
|
679 |
-
* @since
|
680 |
* @author Antonino Scarf� <antonino.scarfi@yithemes.com>
|
681 |
*/
|
682 |
-
function yit_avoid_duplicate( $value, $array, $check = 'value' ) {
|
683 |
-
$match = array();
|
684 |
|
685 |
-
if( !is_array( $array ) ) {
|
686 |
return $value;
|
687 |
}
|
688 |
|
689 |
-
if ( ( $check == 'value' && ! in_array( $value, $array ) ) || ( $check == 'key' && ! isset( $array[$value] ) ) ) {
|
690 |
return $value;
|
691 |
} else {
|
692 |
-
if ( ! preg_match( '/([a-z]+)-([0-9]+)/', $value, $match ) ) {
|
693 |
$i = 2;
|
694 |
} else {
|
695 |
-
$i
|
696 |
-
$value = $match[1];
|
697 |
}
|
698 |
|
699 |
-
return yit_avoid_duplicate( $value . '-' . $i, $array, $check );
|
700 |
}
|
701 |
}
|
702 |
}
|
703 |
|
704 |
-
if( !function_exists( 'yit_title_special_characters' ) ) {
|
705 |
/**
|
706 |
* The chars used in yit_decode_title() and yit_encode_title()
|
707 |
*
|
@@ -709,22 +700,23 @@ if( !function_exists( 'yit_title_special_characters' ) ) {
|
|
709 |
* string: This is [my title] with | a new line
|
710 |
* return: This is <span class="highlight">my title</span> with <br /> a new line
|
711 |
*
|
712 |
-
* @param string
|
|
|
713 |
* @return string The html
|
714 |
*
|
715 |
* @since 1.0
|
716 |
*/
|
717 |
-
function yit_title_special_characters( $chars )
|
718 |
-
|
719 |
-
return array_merge( $chars, array(
|
720 |
'/[=\[](.*?)[=\]]/' => '<span class="title-highlight">$1</span>',
|
721 |
-
'/\|/'
|
722 |
) );
|
723 |
}
|
724 |
-
|
|
|
725 |
}
|
726 |
|
727 |
-
if( !function_exists( 'yit_decode_title' ) ) {
|
728 |
/**
|
729 |
* Change some special characters to put easily html into a string
|
730 |
*
|
@@ -732,20 +724,20 @@ if( !function_exists( 'yit_decode_title' ) ) {
|
|
732 |
* string: This is [my title] with | a new line
|
733 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
734 |
*
|
735 |
-
* @param string
|
|
|
736 |
* @return string The html
|
737 |
*
|
738 |
* @since 1.0
|
739 |
*/
|
740 |
-
function yit_decode_title( $title )
|
741 |
-
|
742 |
-
$replaces = apply_filters( 'yit_title_special_characters', array() );
|
743 |
|
744 |
-
return preg_replace( array_keys( $replaces ), array_values( $replaces ), $title );
|
745 |
}
|
746 |
}
|
747 |
|
748 |
-
if( !function_exists( 'yit_encode_title' ) ) {
|
749 |
/**
|
750 |
* Change some special characters to put easily html into a string
|
751 |
*
|
@@ -753,20 +745,20 @@ if( !function_exists( 'yit_encode_title' ) ) {
|
|
753 |
* string: This is [my title] with | a new line
|
754 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
755 |
*
|
756 |
-
* @param string
|
|
|
757 |
* @return string The html
|
758 |
*
|
759 |
* @since 1.0
|
760 |
*/
|
761 |
-
function yit_encode_title( $title )
|
762 |
-
|
763 |
-
$replaces = apply_filters( 'yit_title_special_characters', array() );
|
764 |
|
765 |
-
return preg_replace( array_values( $replaces ), array_keys( $replaces ), $title );
|
766 |
}
|
767 |
}
|
768 |
|
769 |
-
if( !function_exists( 'yit_remove_chars_title' ) ) {
|
770 |
/**
|
771 |
* Change some special characters to put easily html into a string
|
772 |
*
|
@@ -774,30 +766,30 @@ if( !function_exists( 'yit_remove_chars_title' ) ) {
|
|
774 |
* string: This is [my title] with | a new line
|
775 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
776 |
*
|
777 |
-
* @param string
|
|
|
778 |
* @return string The html
|
779 |
*
|
780 |
* @since 1.0
|
781 |
*/
|
782 |
-
function yit_remove_chars_title( $title )
|
783 |
-
|
784 |
-
$replaces = apply_filters( 'yit_title_special_characters', array() );
|
785 |
|
786 |
-
return preg_replace( array_keys( $replaces ), '$1', $title );
|
787 |
}
|
788 |
}
|
789 |
|
790 |
-
if( ! function_exists( 'is_shop_installed' ) ) {
|
791 |
/**
|
792 |
* Detect if there is a shop plugin installed
|
793 |
*
|
794 |
* @return bool
|
795 |
-
* @since
|
796 |
* @author Francesco Grasso <francesco.grasso@yithemes.com
|
797 |
*/
|
798 |
-
function is_shop_installed() {
|
799 |
global $woocommerce;
|
800 |
-
if( isset( $woocommerce ) || defined( 'JIGOSHOP_VERSION' ) ) {
|
801 |
return true;
|
802 |
} else {
|
803 |
return false;
|
@@ -805,7 +797,7 @@ if( ! function_exists( 'is_shop_installed' ) ) {
|
|
805 |
}
|
806 |
}
|
807 |
|
808 |
-
if ( ! function_exists( 'yit_load_js_file' ) ) {
|
809 |
/**
|
810 |
* Load .min.js file if WP_Debug is not defined
|
811 |
*
|
@@ -815,52 +807,52 @@ if ( ! function_exists( 'yit_load_js_file' ) ) {
|
|
815 |
* @since 2.0.0
|
816 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
817 |
*/
|
818 |
-
function yit_load_js_file( $filename ) {
|
819 |
|
820 |
-
if ( ! ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) ) {
|
821 |
-
$filename = str_replace( '.js', '.min.js', $filename );
|
822 |
}
|
823 |
|
824 |
return $filename;
|
825 |
}
|
826 |
}
|
827 |
|
828 |
-
if ( ! function_exists( 'yit_wpml_register_string' ) ) {
|
829 |
/**
|
830 |
* Register a string in wpml trnslation
|
831 |
*
|
832 |
* @param $contenxt context name
|
833 |
-
* @param $name
|
834 |
-
* @param $value
|
835 |
*
|
836 |
* @since 2.0.0
|
837 |
* @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
|
838 |
*/
|
839 |
-
function yit_wpml_register_string( $contenxt
|
840 |
// wpml string translation
|
841 |
-
do_action( 'wpml_register_single_string', $contenxt, $name, $value );
|
842 |
}
|
843 |
}
|
844 |
|
845 |
-
if ( ! function_exists( 'yit_wpml_string_translate' ) ) {
|
846 |
/**
|
847 |
* Get a string translation
|
848 |
*
|
849 |
-
* @param $contenxt
|
850 |
-
* @param $name
|
851 |
* @param $default_value value to translate
|
852 |
*
|
853 |
* @return string the string translated
|
854 |
* @since 2.0.0
|
855 |
* @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
|
856 |
*/
|
857 |
-
function yit_wpml_string_translate( $contenxt, $name, $default_value ) {
|
858 |
-
return apply_filters( 'wpml_translate_single_string', $default_value, $contenxt, $name );
|
859 |
}
|
860 |
|
861 |
}
|
862 |
|
863 |
-
if ( ! function_exists( 'yit_wpml_object_id' ) ) {
|
864 |
/**
|
865 |
* Get id of post translation in current language
|
866 |
*
|
@@ -873,16 +865,49 @@ if ( ! function_exists( 'yit_wpml_object_id' ) ) {
|
|
873 |
* @since 2.0.0
|
874 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
875 |
*/
|
876 |
-
function yit_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
|
877 |
-
if( function_exists( '
|
878 |
-
return
|
879 |
-
}
|
880 |
-
|
881 |
-
|
882 |
-
}
|
883 |
-
else{
|
884 |
return $element_id;
|
885 |
}
|
886 |
}
|
887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
888 |
}
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
|
11 |
+
if ( ! defined ( 'ABSPATH' ) ) {
|
12 |
exit;
|
13 |
} // Exit if accessed directly
|
14 |
|
15 |
+
if ( ! function_exists ( 'yit_plugin_locate_template' ) ) {
|
16 |
/**
|
17 |
* Locate the templates and return the path of the file found
|
18 |
*
|
23 |
* @return string
|
24 |
* @since 2.0.0
|
25 |
*/
|
26 |
+
function yit_plugin_locate_template ( $plugin_basename, $path, $var = NULL ) {
|
27 |
|
28 |
$template_path = '/theme/templates/' . $path;
|
29 |
|
30 |
+
$located = locate_template ( array (
|
31 |
+
$template_path,
|
32 |
) );
|
33 |
|
34 |
if ( ! $located ) {
|
40 |
|
41 |
}
|
42 |
|
43 |
+
if ( ! function_exists ( 'yit_plugin_get_template' ) ) {
|
44 |
/**
|
45 |
* Retrieve a template file.
|
46 |
*
|
52 |
* @return string
|
53 |
* @since 2.0.0
|
54 |
*/
|
55 |
+
function yit_plugin_get_template ( $plugin_basename, $path, $var = null, $return = false ) {
|
56 |
|
57 |
+
$located = yit_plugin_locate_template ( $plugin_basename, $path, $var );
|
58 |
|
59 |
+
if ( $var && is_array ( $var ) ) {
|
60 |
+
extract ( $var );
|
61 |
}
|
62 |
|
63 |
if ( $return ) {
|
64 |
+
ob_start ();
|
65 |
}
|
66 |
|
67 |
// include file located
|
68 |
+
if ( file_exists ( $located ) ) {
|
69 |
+
include ( $located );
|
70 |
}
|
71 |
|
72 |
if ( $return ) {
|
73 |
+
return ob_get_clean ();
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
|
78 |
+
if ( ! function_exists ( 'yit_plugin_content' ) ) {
|
79 |
/**
|
80 |
* Return post content with read more link (if needed)
|
81 |
*
|
88 |
* @return string
|
89 |
* @since 2.0.0
|
90 |
*/
|
91 |
+
function yit_plugin_content ( $what = 'content', $limit = 25, $more_text = '', $split = '[...]', $in_paragraph = 'true' ) {
|
92 |
if ( $what == 'content' ) {
|
93 |
+
$content = get_the_content ( $more_text );
|
94 |
+
} else {
|
|
|
95 |
if ( $what == 'excerpt' ) {
|
96 |
+
$content = get_the_excerpt ();
|
97 |
+
} else {
|
|
|
98 |
$content = $what;
|
99 |
}
|
100 |
}
|
101 |
|
102 |
if ( $limit == 0 ) {
|
103 |
if ( $what == 'excerpt' ) {
|
104 |
+
$content = apply_filters ( 'the_excerpt', $content );
|
105 |
+
} else {
|
106 |
+
$content = preg_replace ( '/<img[^>]+./', '', $content ); //remove images
|
107 |
+
$content = apply_filters ( 'the_content', $content );
|
108 |
+
$content = str_replace ( ']]>', ']]>', $content );
|
|
|
109 |
}
|
110 |
|
111 |
return $content;
|
112 |
}
|
113 |
|
114 |
// remove the tag more from the content
|
115 |
+
if ( preg_match ( "/<(a)[^>]*class\s*=\s*(['\"])more-link\\2[^>]*>(.*?)<\/\\1>/", $content, $matches ) ) {
|
116 |
|
117 |
+
if ( strpos ( $matches[ 0 ], '[button' ) ) {
|
118 |
+
$more_link = str_replace ( 'href="#"', 'href="' . get_permalink () . '"', do_shortcode ( $matches[ 3 ] ) );
|
119 |
+
} else {
|
120 |
+
$more_link = $matches[ 0 ];
|
|
|
121 |
}
|
122 |
|
123 |
+
$content = str_replace ( $more_link, '', $content );
|
124 |
$split = '';
|
125 |
}
|
126 |
|
127 |
if ( empty( $content ) ) {
|
128 |
return;
|
129 |
}
|
130 |
+
$content = explode ( ' ', $content );
|
131 |
|
132 |
if ( ! empty( $more_text ) && ! isset( $more_link ) ) {
|
133 |
//array_pop( $content );
|
134 |
+
$more_link = strpos ( $more_text, '<a class="btn"' ) ? $more_text : '<a class="read-more' . apply_filters ( 'yit_simple_read_more_classes', ' ' ) . '" href="' . get_permalink () . '">' . $more_text . '</a>';
|
135 |
$split = '';
|
136 |
+
} elseif ( ! isset( $more_link ) ) {
|
|
|
137 |
$more_link = '';
|
138 |
}
|
139 |
|
140 |
// split
|
141 |
+
if ( count ( $content ) >= $limit ) {
|
142 |
$split_content = '';
|
143 |
for ( $i = 0; $i < $limit; $i ++ ) {
|
144 |
+
$split_content .= $content[ $i ] . ' ';
|
145 |
}
|
146 |
|
147 |
$content = $split_content . $split;
|
148 |
+
} else {
|
149 |
+
$content = implode ( " ", $content );
|
|
|
150 |
}
|
151 |
|
152 |
// TAGS UNCLOSED
|
153 |
+
$tags = array ();
|
154 |
// get all tags opened
|
155 |
+
preg_match_all ( "/(<([\w]+)[^>]*>)/", $content, $tags_opened, PREG_SET_ORDER );
|
156 |
foreach ( $tags_opened as $tag ) {
|
157 |
+
$tags[] = $tag[ 2 ];
|
158 |
}
|
159 |
|
160 |
// get all tags closed and remove it from the tags opened.. the rest will be closed at the end of the content
|
161 |
+
preg_match_all ( "/(<\/([\w]+)[^>]*>)/", $content, $tags_closed, PREG_SET_ORDER );
|
162 |
foreach ( $tags_closed as $tag ) {
|
163 |
+
unset( $tags[ array_search ( $tag[ 2 ], $tags ) ] );
|
164 |
}
|
165 |
|
166 |
// close the tags
|
172 |
|
173 |
//$content = preg_replace( '/\[.+\]/', '', $content );
|
174 |
if ( $in_paragraph == true ): $content .= $more_link; endif;
|
175 |
+
$content = preg_replace ( '/<img[^>]+./', '', $content ); //remove images
|
176 |
+
$content = apply_filters ( 'the_content', $content );
|
177 |
+
$content = str_replace ( ']]>', ']]>', $content ); // echo str_replace( array( '<', '>' ), array( '<', '>' ), $content );
|
178 |
if ( $in_paragraph == false ): $content .= $more_link; endif;
|
179 |
|
180 |
return $content;
|
181 |
}
|
182 |
}
|
183 |
|
184 |
+
if ( ! function_exists ( 'yit_plugin_string' ) ) {
|
185 |
/**
|
186 |
* Simple echo a string, with a before and after string, only if the main string is not empty.
|
187 |
*
|
193 |
* @return string The complete string, if the main string is not empty or null
|
194 |
* @since 2.0.0
|
195 |
*/
|
196 |
+
function yit_plugin_string ( $before = '', $string = '', $after = '', $echo = true ) {
|
197 |
$html = '';
|
198 |
|
199 |
+
if ( $string != '' AND ! is_null ( $string ) ) {
|
200 |
$html = $before . $string . $after;
|
201 |
}
|
202 |
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
if ( ! function_exists ( 'yit_plugin_decode_title' ) ) {
|
212 |
/**
|
213 |
* Change some special characters to put easily html into a string
|
214 |
*
|
222 |
*
|
223 |
* @since 1.0
|
224 |
*/
|
225 |
+
function yit_plugin_decode_title ( $title ) {
|
226 |
+
$replaces = apply_filters ( 'yit_title_special_characters', array () );
|
227 |
|
228 |
+
return preg_replace ( array_keys ( $replaces ), array_values ( $replaces ), $title );
|
229 |
}
|
230 |
}
|
231 |
|
232 |
+
if ( ! function_exists ( 'yit_plugin_get_attachment_id' ) ) {
|
233 |
|
234 |
/**
|
235 |
* Return the ID of an attachment.
|
241 |
* @since 2.0.0
|
242 |
*/
|
243 |
|
244 |
+
function yit_plugin_get_attachment_id ( $url ) {
|
245 |
|
246 |
+
$upload_dir = wp_upload_dir ();
|
247 |
+
$dir = trailingslashit ( $upload_dir[ 'baseurl' ] );
|
248 |
|
249 |
+
if ( false === strpos ( $url, $dir ) ) {
|
250 |
return false;
|
251 |
}
|
252 |
|
253 |
+
$file = basename ( $url );
|
254 |
|
255 |
+
$query = array (
|
256 |
'post_type' => 'attachment',
|
257 |
'fields' => 'ids',
|
258 |
+
'meta_query' => array (
|
259 |
+
array (
|
260 |
'value' => $file,
|
261 |
'compare' => 'LIKE',
|
262 |
+
),
|
263 |
+
),
|
264 |
);
|
265 |
|
266 |
+
$query[ 'meta_query' ][ 0 ][ 'key' ] = '_wp_attached_file';
|
267 |
+
$ids = get_posts ( $query );
|
268 |
|
269 |
foreach ( $ids as $id ) {
|
270 |
+
$attachment_image = wp_get_attachment_image_src ( $id, 'full' );
|
271 |
+
if ( $url == array_shift ( $attachment_image ) || $url == str_replace ( 'https://', 'http://', array_shift ( $attachment_image ) ) ) {
|
272 |
return $id;
|
273 |
}
|
274 |
}
|
275 |
+
$query[ 'meta_query' ][ 0 ][ 'key' ] = '_wp_attachment_metadata';
|
276 |
+
$ids = get_posts ( $query );
|
277 |
|
278 |
foreach ( $ids as $id ) {
|
279 |
|
280 |
+
$meta = wp_get_attachment_metadata ( $id );
|
281 |
+
if ( ! isset( $meta[ 'sizes' ] ) ) {
|
282 |
continue;
|
283 |
}
|
284 |
|
285 |
+
foreach ( (array)$meta[ 'sizes' ] as $size => $values ) {
|
286 |
+
if ( $values[ 'file' ] == $file && $url == str_replace ( 'https://', 'http://', array_shift ( wp_get_attachment_image_src ( $id, $size ) ) ) ) {
|
287 |
|
288 |
return $id;
|
289 |
}
|
294 |
}
|
295 |
}
|
296 |
|
297 |
+
if ( ! function_exists ( 'yit_enqueue_script' ) ) {
|
298 |
/**
|
299 |
* Enqueues script.
|
300 |
*
|
304 |
* @author Simone D'Amico <simone.damico@yithemes.com>
|
305 |
* @see yit_register_script() For parameter information.
|
306 |
*/
|
307 |
+
function yit_enqueue_script ( $handle, $src, $deps = array (), $ver = false, $in_footer = true ) {
|
308 |
|
309 |
+
if ( function_exists ( 'YIT_Asset' ) && ! is_admin () ) {
|
310 |
$enqueue = true;
|
311 |
+
YIT_Asset ()->set ( 'script', $handle, compact ( 'src', 'deps', 'ver', 'in_footer', 'enqueue' ) );
|
312 |
+
} else {
|
313 |
+
wp_enqueue_script ( $handle, $src, $deps, $ver, $in_footer );
|
|
|
314 |
}
|
315 |
}
|
316 |
}
|
317 |
|
318 |
+
if ( ! function_exists ( 'yit_enqueue_style' ) ) {
|
319 |
/**
|
320 |
* Enqueues style.
|
321 |
*
|
325 |
* @author Simone D'Amico <simone.damico@yithemes.com>
|
326 |
* @see yit_register_style() For parameter information.
|
327 |
*/
|
328 |
+
function yit_enqueue_style ( $handle, $src, $deps = array (), $ver = false, $media = 'all' ) {
|
329 |
|
330 |
+
if ( function_exists ( 'YIT_Asset' ) ) {
|
331 |
$enqueue = true;
|
332 |
+
$who = YIT_Asset ()->get_stylesheet_handle ( get_stylesheet_uri (), 'style' );
|
333 |
$where = 'before';
|
334 |
|
335 |
+
if ( false == $who ) {
|
336 |
$who = '';
|
337 |
}
|
338 |
|
339 |
+
YIT_Asset ()->set ( 'style', $handle, compact ( 'src', 'deps', 'ver', 'media', 'enqueue' ), $where, $who );
|
340 |
+
} else {
|
341 |
+
wp_enqueue_style ( $handle, $src, $deps, $ver, $media );
|
|
|
342 |
}
|
343 |
}
|
344 |
}
|
345 |
|
346 |
+
if ( ! function_exists ( 'yit_get_post_meta' ) ) {
|
347 |
/**
|
348 |
* Retrieve the value of a metabox.
|
349 |
*
|
350 |
* This function retrieve the value of a metabox attached to a post. It return either a single value or an array.
|
351 |
*
|
352 |
+
* @param int $id Post ID.
|
353 |
+
* @param string $meta The meta key to retrieve.
|
354 |
*
|
355 |
* @return mixed Single value or array
|
356 |
* @since 2.0.0
|
357 |
*/
|
358 |
+
function yit_get_post_meta ( $id, $meta ) {
|
359 |
+
if ( ! strpos ( $meta, '[' ) ) {
|
360 |
+
return get_post_meta ( $id, $meta, true );
|
361 |
}
|
362 |
|
363 |
+
$sub_meta = explode ( '[', $meta );
|
364 |
|
365 |
+
$meta = get_post_meta ( $id, $meta, true );
|
366 |
+
for ( $i = 0; $i < count ( $sub_meta ); $i ++ ) {
|
367 |
+
$meta = $meta[ rtrim ( $sub_meta[ $i ], ']' ) ];
|
368 |
}
|
369 |
|
370 |
return $meta;
|
371 |
}
|
372 |
}
|
373 |
|
374 |
+
if ( ! function_exists ( 'yit_string' ) ) {
|
375 |
/**
|
376 |
* Simple echo a string, with a before and after string, only if the main string is not empty.
|
377 |
*
|
383 |
* @return string The complete string, if the main string is not empty or null
|
384 |
* @since 2.0.0
|
385 |
*/
|
386 |
+
function yit_string ( $before = '', $string = '', $after = '', $echo = true ) {
|
387 |
$html = '';
|
388 |
|
389 |
+
if ( $string != '' AND ! is_null ( $string ) ) {
|
390 |
$html = $before . $string . $after;
|
391 |
}
|
392 |
|
399 |
}
|
400 |
|
401 |
|
402 |
+
if ( ! function_exists ( 'yit_pagination' ) ) {
|
403 |
/**
|
404 |
* Print pagination
|
405 |
*
|
409 |
* @return string
|
410 |
* @since 2.0.0
|
411 |
*/
|
412 |
+
function yit_pagination ( $pages = '', $range = 10 ) {
|
413 |
$showitems = ( $range * 2 ) + 1;
|
414 |
|
415 |
+
$paged = ( get_query_var ( 'paged' ) ) ? get_query_var ( 'paged' ) : false;
|
416 |
if ( $paged === false ) {
|
417 |
+
$paged = ( get_query_var ( 'page' ) ) ? get_query_var ( 'page' ) : false;
|
418 |
}
|
419 |
if ( $paged === false ) {
|
420 |
$paged = 1;
|
438 |
if ( 1 != $pages ) {
|
439 |
$html .= "<div class='general-pagination clearfix'>";
|
440 |
if ( $paged > 2 ) {
|
441 |
+
$html .= sprintf ( '<a class="%s" href="%s">«</a>', 'yit_pagination_first', get_pagenum_link ( 1 ) );
|
442 |
}
|
443 |
if ( $paged > 1 ) {
|
444 |
+
$html .= sprintf ( '<a class="%s" href="%s">‹</a>', 'yit_pagination_previous', get_pagenum_link ( $paged - 1 ) );
|
445 |
}
|
446 |
|
447 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
448 |
if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
|
449 |
$class = ( $paged == $i ) ? " class='selected'" : '';
|
450 |
+
$html .= "<a href='" . get_pagenum_link ( $i ) . "'$class >$i</a>";
|
451 |
}
|
452 |
}
|
453 |
|
454 |
if ( $paged < $pages ) {
|
455 |
+
$html .= sprintf ( '<a class="%s" href="%s">›</a>', 'yit_pagination_next', get_pagenum_link ( $paged + 1 ) );
|
456 |
}
|
457 |
if ( $paged < $pages - 1 ) {
|
458 |
+
$html .= sprintf ( '<a class="%s" href="%s">»</a>', 'yit_pagination_last', get_pagenum_link ( $pages ) );
|
459 |
}
|
460 |
|
461 |
$html .= "</div>\n";
|
462 |
}
|
463 |
|
464 |
+
echo apply_filters ( 'yit_pagination_html', $html );
|
465 |
}
|
466 |
}
|
467 |
|
468 |
+
if ( ! function_exists ( 'yit_registered_sidebars' ) ) {
|
469 |
/**
|
470 |
* Retrieve all registered sidebars
|
471 |
*
|
472 |
* @return array
|
473 |
* @since 2.0.0
|
474 |
*/
|
475 |
+
function yit_registered_sidebars () {
|
476 |
global $wp_registered_sidebars;
|
477 |
|
478 |
+
$return = array ();
|
479 |
|
480 |
if ( empty( $wp_registered_sidebars ) ) {
|
481 |
+
$return = array ( '' => '' );
|
482 |
}
|
483 |
|
484 |
+
foreach ( ( array )$wp_registered_sidebars as $the_ ) {
|
485 |
+
$return[ $the_[ 'name' ] ] = $the_[ 'name' ];
|
486 |
}
|
487 |
|
488 |
+
ksort ( $return );
|
489 |
|
490 |
return $return;
|
491 |
}
|
492 |
}
|
493 |
|
494 |
+
if ( ! function_exists ( 'yit_layout_option' ) ) {
|
495 |
/**
|
496 |
* Retrieve a layout option
|
497 |
*
|
503 |
* @return array
|
504 |
* @since 2.0.0
|
505 |
*/
|
506 |
+
function yit_layout_option ( $key, $id = false, $type = "post", $model = "post_type" ) {
|
507 |
|
508 |
$option = '';
|
509 |
|
510 |
+
if ( defined ( 'YIT' ) ) {
|
511 |
+
$option = YIT_Layout_Panel ()->get_option ( $key, $id, $type, $model );
|
512 |
+
} else {
|
513 |
+
if ( ! $id && ( is_single () || is_page () ) ) {
|
|
|
514 |
global $post;
|
515 |
$id = $post->ID;
|
516 |
+
} elseif ( $id != 'all' ) {
|
517 |
+
$option = get_post_meta ( $id, $key );
|
|
|
518 |
}
|
519 |
}
|
520 |
|
522 |
}
|
523 |
}
|
524 |
|
525 |
+
if ( ! function_exists ( 'yit_curPageURL' ) ) {
|
526 |
/**
|
527 |
* Retrieve the current complete url
|
528 |
*
|
529 |
* @since 1.0
|
530 |
*/
|
531 |
+
function yit_curPageURL () {
|
532 |
$pageURL = 'http';
|
533 |
+
if ( isset( $_SERVER[ "HTTPS" ] ) AND $_SERVER[ "HTTPS" ] == "on" ) {
|
534 |
$pageURL .= "s";
|
535 |
}
|
536 |
|
537 |
$pageURL .= "://";
|
538 |
|
539 |
+
if ( isset( $_SERVER[ "SERVER_PORT" ] ) AND $_SERVER[ "SERVER_PORT" ] != "80" ) {
|
540 |
+
$pageURL .= $_SERVER[ "SERVER_NAME" ] . ":" . $_SERVER[ "SERVER_PORT" ] . $_SERVER[ "REQUEST_URI" ];
|
541 |
+
} else {
|
542 |
+
$pageURL .= $_SERVER[ "SERVER_NAME" ] . $_SERVER[ "REQUEST_URI" ];
|
|
|
543 |
}
|
544 |
|
545 |
return $pageURL;
|
546 |
}
|
547 |
}
|
548 |
|
549 |
+
if ( ! function_exists ( 'yit_get_excluded_categories' ) ) {
|
550 |
/**
|
551 |
*
|
552 |
* Retrieve the escluded categories, set on Theme Options
|
558 |
* @since 2.0.0
|
559 |
*/
|
560 |
|
561 |
+
function yit_get_excluded_categories ( $k = 1 ) {
|
562 |
|
563 |
global $post;
|
564 |
|
566 |
return;
|
567 |
}
|
568 |
|
569 |
+
$cf_cats = get_post_meta ( $post->ID, 'blog-cats', true );
|
570 |
|
571 |
+
if ( ! empty( $cf_cats ) ) {
|
572 |
return $cf_cats;
|
573 |
}
|
574 |
|
575 |
+
$cats = function_exists ( 'yit_get_option' ) ? yit_get_option ( 'blog-excluded-cats' ) : '';
|
576 |
|
577 |
|
578 |
+
if ( ! is_array ( $cats ) || empty( $cats ) || ! isset( $cats[ $k ] ) ) {
|
579 |
return;
|
580 |
}
|
581 |
|
582 |
+
$cats = array_map ( 'trim', $cats[ $k ] );
|
583 |
|
584 |
$i = 0;
|
585 |
$query = '';
|
589 |
$i ++;
|
590 |
}
|
591 |
|
592 |
+
ltrim ( ',', $query );
|
593 |
|
594 |
return $query;
|
595 |
}
|
596 |
}
|
597 |
|
598 |
|
599 |
+
if ( ! function_exists ( 'yit_add_extra_theme_headers' ) ) {
|
600 |
+
add_filter ( 'extra_theme_headers', 'yit_add_extra_theme_headers' );
|
601 |
|
602 |
/**
|
603 |
* Check the framework core version
|
608 |
* @since 2.0.0
|
609 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
610 |
*/
|
611 |
+
function yit_add_extra_theme_headers ( $headers ) {
|
612 |
$headers[] = 'Core Framework Version';
|
613 |
+
|
614 |
return $headers;
|
615 |
}
|
616 |
}
|
617 |
|
618 |
+
if ( ! function_exists ( 'yit_check_plugin_support' ) ) {
|
619 |
/**
|
620 |
* Check the framework core version
|
621 |
*
|
623 |
* @since 2.0.0
|
624 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
625 |
*/
|
626 |
+
function yit_check_plugin_support () {
|
627 |
|
628 |
+
$headers[ 'core' ] = wp_get_theme ()->get ( 'Core Framework Version' );
|
629 |
+
$headers[ 'author' ] = wp_get_theme ()->get ( 'Author' );
|
630 |
|
631 |
+
if ( ! $headers[ 'core' ] && defined ( 'YIT_CORE_VERSION' ) ) {
|
632 |
+
$headers[ 'core' ] = YIT_CORE_VERSION;
|
633 |
}
|
634 |
|
635 |
+
if ( ( ! empty( $headers[ 'core' ] ) && version_compare ( $headers[ 'core' ], '2.0.0', '<=' ) ) || $headers[ 'author' ] != 'Your Inspiration Themes' ) {
|
636 |
return true;
|
637 |
+
} else {
|
|
|
638 |
return false;
|
639 |
}
|
640 |
}
|
641 |
}
|
642 |
|
643 |
+
if ( ! function_exists ( 'yit_ie_version' ) ) {
|
644 |
/**
|
645 |
* Retrieve IE version.
|
646 |
*
|
647 |
* @return int|float
|
648 |
+
* @since 1.0.0
|
649 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
650 |
*/
|
651 |
+
function yit_ie_version () {
|
652 |
+
preg_match ( '/MSIE ([0-9]\.[0-9])/', $_SERVER[ 'HTTP_USER_AGENT' ], $reg );
|
653 |
+
if ( ! isset( $reg[ 1 ] ) ) {
|
654 |
+
return - 1;
|
655 |
+
} else {
|
656 |
+
return floatval ( $reg[ 1 ] );
|
657 |
+
}
|
658 |
}
|
659 |
}
|
660 |
|
661 |
+
if ( ! function_exists ( 'yit_avoid_duplicate' ) ) {
|
662 |
/**
|
663 |
* Check if something exists. If yes, add a -N to the value where N is a number.
|
664 |
*
|
665 |
+
* @param mixed $value
|
666 |
+
* @param array $array
|
667 |
* @param string $check
|
668 |
+
*
|
669 |
* @return mixed
|
670 |
+
* @since 2.0.0
|
671 |
* @author Antonino Scarf� <antonino.scarfi@yithemes.com>
|
672 |
*/
|
673 |
+
function yit_avoid_duplicate ( $value, $array, $check = 'value' ) {
|
674 |
+
$match = array ();
|
675 |
|
676 |
+
if ( ! is_array ( $array ) ) {
|
677 |
return $value;
|
678 |
}
|
679 |
|
680 |
+
if ( ( $check == 'value' && ! in_array ( $value, $array ) ) || ( $check == 'key' && ! isset( $array[ $value ] ) ) ) {
|
681 |
return $value;
|
682 |
} else {
|
683 |
+
if ( ! preg_match ( '/([a-z]+)-([0-9]+)/', $value, $match ) ) {
|
684 |
$i = 2;
|
685 |
} else {
|
686 |
+
$i = intval ( $match[ 2 ] ) + 1;
|
687 |
+
$value = $match[ 1 ];
|
688 |
}
|
689 |
|
690 |
+
return yit_avoid_duplicate ( $value . '-' . $i, $array, $check );
|
691 |
}
|
692 |
}
|
693 |
}
|
694 |
|
695 |
+
if ( ! function_exists ( 'yit_title_special_characters' ) ) {
|
696 |
/**
|
697 |
* The chars used in yit_decode_title() and yit_encode_title()
|
698 |
*
|
700 |
* string: This is [my title] with | a new line
|
701 |
* return: This is <span class="highlight">my title</span> with <br /> a new line
|
702 |
*
|
703 |
+
* @param string $title The string to convert
|
704 |
+
*
|
705 |
* @return string The html
|
706 |
*
|
707 |
* @since 1.0
|
708 |
*/
|
709 |
+
function yit_title_special_characters ( $chars ) {
|
710 |
+
return array_merge ( $chars, array (
|
|
|
711 |
'/[=\[](.*?)[=\]]/' => '<span class="title-highlight">$1</span>',
|
712 |
+
'/\|/' => '<br />',
|
713 |
) );
|
714 |
}
|
715 |
+
|
716 |
+
add_filter ( 'yit_title_special_characters', 'yit_title_special_characters' );
|
717 |
}
|
718 |
|
719 |
+
if ( ! function_exists ( 'yit_decode_title' ) ) {
|
720 |
/**
|
721 |
* Change some special characters to put easily html into a string
|
722 |
*
|
724 |
* string: This is [my title] with | a new line
|
725 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
726 |
*
|
727 |
+
* @param string $title The string to convert
|
728 |
+
*
|
729 |
* @return string The html
|
730 |
*
|
731 |
* @since 1.0
|
732 |
*/
|
733 |
+
function yit_decode_title ( $title ) {
|
734 |
+
$replaces = apply_filters ( 'yit_title_special_characters', array () );
|
|
|
735 |
|
736 |
+
return preg_replace ( array_keys ( $replaces ), array_values ( $replaces ), $title );
|
737 |
}
|
738 |
}
|
739 |
|
740 |
+
if ( ! function_exists ( 'yit_encode_title' ) ) {
|
741 |
/**
|
742 |
* Change some special characters to put easily html into a string
|
743 |
*
|
745 |
* string: This is [my title] with | a new line
|
746 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
747 |
*
|
748 |
+
* @param string $title The string to convert
|
749 |
+
*
|
750 |
* @return string The html
|
751 |
*
|
752 |
* @since 1.0
|
753 |
*/
|
754 |
+
function yit_encode_title ( $title ) {
|
755 |
+
$replaces = apply_filters ( 'yit_title_special_characters', array () );
|
|
|
756 |
|
757 |
+
return preg_replace ( array_values ( $replaces ), array_keys ( $replaces ), $title );
|
758 |
}
|
759 |
}
|
760 |
|
761 |
+
if ( ! function_exists ( 'yit_remove_chars_title' ) ) {
|
762 |
/**
|
763 |
* Change some special characters to put easily html into a string
|
764 |
*
|
766 |
* string: This is [my title] with | a new line
|
767 |
* return: This is <span class="title-highlight">my title</span> with <br /> a new line
|
768 |
*
|
769 |
+
* @param string $title The string to convert
|
770 |
+
*
|
771 |
* @return string The html
|
772 |
*
|
773 |
* @since 1.0
|
774 |
*/
|
775 |
+
function yit_remove_chars_title ( $title ) {
|
776 |
+
$replaces = apply_filters ( 'yit_title_special_characters', array () );
|
|
|
777 |
|
778 |
+
return preg_replace ( array_keys ( $replaces ), '$1', $title );
|
779 |
}
|
780 |
}
|
781 |
|
782 |
+
if ( ! function_exists ( 'is_shop_installed' ) ) {
|
783 |
/**
|
784 |
* Detect if there is a shop plugin installed
|
785 |
*
|
786 |
* @return bool
|
787 |
+
* @since 2.0.0
|
788 |
* @author Francesco Grasso <francesco.grasso@yithemes.com
|
789 |
*/
|
790 |
+
function is_shop_installed () {
|
791 |
global $woocommerce;
|
792 |
+
if ( isset( $woocommerce ) || defined ( 'JIGOSHOP_VERSION' ) ) {
|
793 |
return true;
|
794 |
} else {
|
795 |
return false;
|
797 |
}
|
798 |
}
|
799 |
|
800 |
+
if ( ! function_exists ( 'yit_load_js_file' ) ) {
|
801 |
/**
|
802 |
* Load .min.js file if WP_Debug is not defined
|
803 |
*
|
807 |
* @since 2.0.0
|
808 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
809 |
*/
|
810 |
+
function yit_load_js_file ( $filename ) {
|
811 |
|
812 |
+
if ( ! ( ( defined ( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) ) {
|
813 |
+
$filename = str_replace ( '.js', '.min.js', $filename );
|
814 |
}
|
815 |
|
816 |
return $filename;
|
817 |
}
|
818 |
}
|
819 |
|
820 |
+
if ( ! function_exists ( 'yit_wpml_register_string' ) ) {
|
821 |
/**
|
822 |
* Register a string in wpml trnslation
|
823 |
*
|
824 |
* @param $contenxt context name
|
825 |
+
* @param $name string name
|
826 |
+
* @param $value value to translate
|
827 |
*
|
828 |
* @since 2.0.0
|
829 |
* @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
|
830 |
*/
|
831 |
+
function yit_wpml_register_string ( $contenxt, $name, $value ) {
|
832 |
// wpml string translation
|
833 |
+
do_action ( 'wpml_register_single_string', $contenxt, $name, $value );
|
834 |
}
|
835 |
}
|
836 |
|
837 |
+
if ( ! function_exists ( 'yit_wpml_string_translate' ) ) {
|
838 |
/**
|
839 |
* Get a string translation
|
840 |
*
|
841 |
+
* @param $contenxt context name
|
842 |
+
* @param $name string name
|
843 |
* @param $default_value value to translate
|
844 |
*
|
845 |
* @return string the string translated
|
846 |
* @since 2.0.0
|
847 |
* @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
|
848 |
*/
|
849 |
+
function yit_wpml_string_translate ( $contenxt, $name, $default_value ) {
|
850 |
+
return apply_filters ( 'wpml_translate_single_string', $default_value, $contenxt, $name );
|
851 |
}
|
852 |
|
853 |
}
|
854 |
|
855 |
+
if ( ! function_exists ( 'yit_wpml_object_id' ) ) {
|
856 |
/**
|
857 |
* Get id of post translation in current language
|
858 |
*
|
865 |
* @since 2.0.0
|
866 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
867 |
*/
|
868 |
+
function yit_wpml_object_id ( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
|
869 |
+
if ( function_exists ( 'wpml_object_id_filter' ) ) {
|
870 |
+
return wpml_object_id_filter( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
|
871 |
+
} elseif ( function_exists ( 'icl_object_id' ) ) {
|
872 |
+
return icl_object_id ( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
|
873 |
+
} else {
|
|
|
|
|
874 |
return $element_id;
|
875 |
}
|
876 |
}
|
877 |
|
878 |
+
}
|
879 |
+
|
880 |
+
|
881 |
+
if ( ! function_exists ( 'yith_get_formatted_price' ) ) {
|
882 |
+
/**
|
883 |
+
* Format the price with a currency symbol.
|
884 |
+
*
|
885 |
+
* @param float $price
|
886 |
+
* @param array $args (default: array())
|
887 |
+
*
|
888 |
+
* @return string
|
889 |
+
*/
|
890 |
+
function yith_get_formatted_price ( $price, $args = array () ) {
|
891 |
+
extract ( apply_filters ( 'wc_price_args', wp_parse_args ( $args, array (
|
892 |
+
'ex_tax_label' => false,
|
893 |
+
'currency' => '',
|
894 |
+
'decimal_separator' => wc_get_price_decimal_separator (),
|
895 |
+
'thousand_separator' => wc_get_price_thousand_separator (),
|
896 |
+
'decimals' => wc_get_price_decimals (),
|
897 |
+
'price_format' => get_woocommerce_price_format (),
|
898 |
+
) ) ) );
|
899 |
+
|
900 |
+
$negative = $price < 0;
|
901 |
+
$price = apply_filters ( 'raw_woocommerce_price', floatval ( $negative ? $price * - 1 : $price ) );
|
902 |
+
$price = apply_filters ( 'formatted_woocommerce_price', number_format ( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );
|
903 |
+
|
904 |
+
if ( apply_filters ( 'woocommerce_price_trim_zeros', false ) && $decimals > 0 ) {
|
905 |
+
$price = wc_trim_zeros ( $price );
|
906 |
+
}
|
907 |
+
|
908 |
+
$formatted_price = ( $negative ? '-' : '' ) . sprintf ( $price_format, get_woocommerce_currency_symbol ( $currency ), $price );
|
909 |
+
$return = $formatted_price;
|
910 |
+
|
911 |
+
return apply_filters ( 'wc_price', $return, $price, $args );
|
912 |
+
}
|
913 |
}
|
settings/custom-style-options.php
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$custom_style = array(
|
4 |
-
|
5 |
-
'custom-style' => array(
|
6 |
-
|
7 |
-
'header' => array(
|
8 |
-
|
9 |
-
array( 'type' => 'open' ),
|
10 |
-
|
11 |
-
array(
|
12 |
-
'name' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
|
13 |
-
'type' => 'title'
|
14 |
-
),
|
15 |
-
|
16 |
-
array( 'type' => 'close' )
|
17 |
-
),
|
18 |
-
|
19 |
-
'settings' => array(
|
20 |
-
|
21 |
-
array( 'type' => 'open' ),
|
22 |
-
|
23 |
-
array(
|
24 |
-
'name' => __( 'Put here your custom CSS rules:', 'yith-woocommerce-ajax-navigation' ),
|
25 |
-
'desc' => '',
|
26 |
-
'id' => 'yith_wcan_custom_style',
|
27 |
-
'type' => 'textarea',
|
28 |
-
'std' => '',
|
29 |
-
'custom_attributes' => array(
|
30 |
-
'rows' => 15,
|
31 |
-
'cols' => 75
|
32 |
-
)
|
33 |
-
),
|
34 |
-
|
35 |
-
array( 'type' => 'close' ),
|
36 |
-
),
|
37 |
-
)
|
38 |
-
);
|
39 |
-
|
40 |
return apply_filters( 'yith_wcan_panel_custom_style_options', $custom_style );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$custom_style = array(
|
4 |
+
|
5 |
+
'custom-style' => array(
|
6 |
+
|
7 |
+
'header' => array(
|
8 |
+
|
9 |
+
array( 'type' => 'open' ),
|
10 |
+
|
11 |
+
array(
|
12 |
+
'name' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
|
13 |
+
'type' => 'title'
|
14 |
+
),
|
15 |
+
|
16 |
+
array( 'type' => 'close' )
|
17 |
+
),
|
18 |
+
|
19 |
+
'settings' => array(
|
20 |
+
|
21 |
+
array( 'type' => 'open' ),
|
22 |
+
|
23 |
+
array(
|
24 |
+
'name' => __( 'Put here your custom CSS rules:', 'yith-woocommerce-ajax-navigation' ),
|
25 |
+
'desc' => '',
|
26 |
+
'id' => 'yith_wcan_custom_style',
|
27 |
+
'type' => 'textarea',
|
28 |
+
'std' => '',
|
29 |
+
'custom_attributes' => array(
|
30 |
+
'rows' => 15,
|
31 |
+
'cols' => 75
|
32 |
+
)
|
33 |
+
),
|
34 |
+
|
35 |
+
array( 'type' => 'close' ),
|
36 |
+
),
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
return apply_filters( 'yith_wcan_panel_custom_style_options', $custom_style );
|
settings/frontend-options.php
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$frontend = array(
|
4 |
-
|
5 |
-
'frontend' => array(
|
6 |
-
|
7 |
-
'header' => array(
|
8 |
-
|
9 |
-
array( 'type' => 'open' ),
|
10 |
-
|
11 |
-
array(
|
12 |
-
'name' => __( 'General Settings', 'yith-woocommerce-ajax-navigation' ),
|
13 |
-
'type' => 'title'
|
14 |
-
),
|
15 |
-
|
16 |
-
array( 'type' => 'close' )
|
17 |
-
),
|
18 |
-
|
19 |
-
'settings' => array(
|
20 |
-
|
21 |
-
array( 'type' => 'open' ),
|
22 |
-
|
23 |
-
array(
|
24 |
-
'id' => 'yith_wcan_frontend_description',
|
25 |
-
'name' => _x( 'How To:', 'Admin panel: option description', 'yith-woocommerce-ajax-navigation' ),
|
26 |
-
'type' => 'wcan_description',
|
27 |
-
'desc' => _x( "If your theme use the WooCommerce standard templates, you don't need to change the following values.
|
28 |
-
Otherwise, add the classes used in the template of your theme.
|
29 |
-
If you don't know them, please contact the developer of your theme to receive the correct classes.", 'Admin: Panel section description', 'yith-woocommerce-ajax-navigation' ),
|
30 |
-
),
|
31 |
-
|
32 |
-
array(
|
33 |
-
'name' => __( 'Product Container', 'yith-woocommerce-ajax-navigation' ),
|
34 |
-
'desc' => __( 'Put here the CSS class or id for the product container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>.products</strong>)',
|
35 |
-
'id' => 'yith_wcan_ajax_shop_container',
|
36 |
-
'type' => 'text',
|
37 |
-
'std' => '.products'
|
38 |
-
),
|
39 |
-
|
40 |
-
array(
|
41 |
-
'name' => __( 'Shop Pagination Container', 'yith-woocommerce-ajax-navigation' ),
|
42 |
-
'desc' => __( 'Put here the CSS class or id for the shop pagination container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>nav.woocommerce-pagination</strong>)',
|
43 |
-
'id' => 'yith_wcan_ajax_shop_pagination',
|
44 |
-
'type' => 'text',
|
45 |
-
'std' => 'nav.woocommerce-pagination'
|
46 |
-
),
|
47 |
-
|
48 |
-
array(
|
49 |
-
'name' => __( 'Result Count Container', 'yith-woocommerce-ajax-navigation' ),
|
50 |
-
'desc' => __( 'Put here the CSS class or id for the result count container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>.woocommerce-result-count</strong>)',
|
51 |
-
'id' => 'yith_wcan_ajax_shop_result_container',
|
52 |
-
'type' => 'text',
|
53 |
-
'std' => '.woocommerce-result-count'
|
54 |
-
),
|
55 |
-
|
56 |
-
array( 'type' => 'close' ),
|
57 |
-
),
|
58 |
-
)
|
59 |
-
);
|
60 |
-
|
61 |
return apply_filters( 'yith_wcan_panel_frontend_options', $frontend );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$frontend = array(
|
4 |
+
|
5 |
+
'frontend' => array(
|
6 |
+
|
7 |
+
'header' => array(
|
8 |
+
|
9 |
+
array( 'type' => 'open' ),
|
10 |
+
|
11 |
+
array(
|
12 |
+
'name' => __( 'General Settings', 'yith-woocommerce-ajax-navigation' ),
|
13 |
+
'type' => 'title'
|
14 |
+
),
|
15 |
+
|
16 |
+
array( 'type' => 'close' )
|
17 |
+
),
|
18 |
+
|
19 |
+
'settings' => array(
|
20 |
+
|
21 |
+
array( 'type' => 'open' ),
|
22 |
+
|
23 |
+
array(
|
24 |
+
'id' => 'yith_wcan_frontend_description',
|
25 |
+
'name' => _x( 'How To:', 'Admin panel: option description', 'yith-woocommerce-ajax-navigation' ),
|
26 |
+
'type' => 'wcan_description',
|
27 |
+
'desc' => _x( "If your theme use the WooCommerce standard templates, you don't need to change the following values.
|
28 |
+
Otherwise, add the classes used in the template of your theme.
|
29 |
+
If you don't know them, please contact the developer of your theme to receive the correct classes.", 'Admin: Panel section description', 'yith-woocommerce-ajax-navigation' ),
|
30 |
+
),
|
31 |
+
|
32 |
+
array(
|
33 |
+
'name' => __( 'Product Container', 'yith-woocommerce-ajax-navigation' ),
|
34 |
+
'desc' => __( 'Put here the CSS class or id for the product container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>.products</strong>)',
|
35 |
+
'id' => 'yith_wcan_ajax_shop_container',
|
36 |
+
'type' => 'text',
|
37 |
+
'std' => '.products'
|
38 |
+
),
|
39 |
+
|
40 |
+
array(
|
41 |
+
'name' => __( 'Shop Pagination Container', 'yith-woocommerce-ajax-navigation' ),
|
42 |
+
'desc' => __( 'Put here the CSS class or id for the shop pagination container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>nav.woocommerce-pagination</strong>)',
|
43 |
+
'id' => 'yith_wcan_ajax_shop_pagination',
|
44 |
+
'type' => 'text',
|
45 |
+
'std' => 'nav.woocommerce-pagination'
|
46 |
+
),
|
47 |
+
|
48 |
+
array(
|
49 |
+
'name' => __( 'Result Count Container', 'yith-woocommerce-ajax-navigation' ),
|
50 |
+
'desc' => __( 'Put here the CSS class or id for the result count container', 'yith-woocommerce-ajax-navigation' ) . ' (Default: <strong>.woocommerce-result-count</strong>)',
|
51 |
+
'id' => 'yith_wcan_ajax_shop_result_container',
|
52 |
+
'type' => 'text',
|
53 |
+
'std' => '.woocommerce-result-count'
|
54 |
+
),
|
55 |
+
|
56 |
+
array( 'type' => 'close' ),
|
57 |
+
),
|
58 |
+
)
|
59 |
+
);
|
60 |
+
|
61 |
return apply_filters( 'yith_wcan_panel_frontend_options', $frontend );
|
templates/admin/premium.php
CHANGED
@@ -298,7 +298,7 @@
|
|
298 |
<h2><?php _e('WooCommerce Price Filter','yith-woocommerce-ajax-navigation');?></h2>
|
299 |
</div>
|
300 |
<p>
|
301 |
-
<?php echo _e('
|
302 |
</p>
|
303 |
</div>
|
304 |
<div class="col-1">
|
@@ -322,6 +322,22 @@
|
|
322 |
</div>
|
323 |
</div>
|
324 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
<div class="section section-cta section-odd">
|
326 |
<div class="landing-container">
|
327 |
<div class="premium-cta">
|
298 |
<h2><?php _e('WooCommerce Price Filter','yith-woocommerce-ajax-navigation');?></h2>
|
299 |
</div>
|
300 |
<p>
|
301 |
+
<?php echo _e('Take advantage of the premium version of the plugin to edit the default behavior of WooCommerce Price Filter. Change the %1$slayout of the filter%2$s and activate the %1$sAjax mode%2$s to apply the filter immediately, without reloading the page.', 'yith-woocommerce-ajax-navigation');?>
|
302 |
</p>
|
303 |
</div>
|
304 |
<div class="col-1">
|
322 |
</div>
|
323 |
</div>
|
324 |
</div>
|
325 |
+
<div class="section section-odd clear" style="background: url(<?php echo YITH_WCAN_URL ?>assets/images/08-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
|
326 |
+
<div class="landing-container">
|
327 |
+
<div class="col-2">
|
328 |
+
<div class="section-title">
|
329 |
+
<img src="<?php echo YITH_WCAN_URL ?>assets/images/08-icon.png" alt="icon 08" />
|
330 |
+
<h2><?php _e(' Filter by category','yith-woocommerce-ajax-navigation');?></h2>
|
331 |
+
</div>
|
332 |
+
<p>
|
333 |
+
<?php echo _e('Configure the widget to let your users filter product by a %1$sselected category%2$s. Your users will be even happier to browse your shop.', 'yith-woocommerce-ajax-navigation');?>
|
334 |
+
</p>
|
335 |
+
</div>
|
336 |
+
<div class="col-1">
|
337 |
+
<img src="<?php echo YITH_WCAN_URL ?>assets/images/08.png" alt="woocommerce price filter" />
|
338 |
+
</div>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
<div class="section section-cta section-odd">
|
342 |
<div class="landing-container">
|
343 |
<div class="premium-cta">
|
widgets/class.yith-wcan-navigation-widget.php
CHANGED
@@ -1,913 +1,948 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
|
15 |
-
/**
|
16 |
-
* YITH WooCommerce Ajax Navigation Widget
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
*/
|
20 |
-
class YITH_WCAN_Navigation_Widget extends WP_Widget {
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
$
|
52 |
-
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
if (
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
//
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
if ( $
|
143 |
-
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
$current_filter =
|
157 |
-
|
158 |
-
if ( !
|
159 |
-
$current_filter
|
160 |
-
}
|
161 |
-
|
162 |
-
$
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
//
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
$link
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
if ( $
|
247 |
-
|
248 |
-
}
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
//
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
if ( $current_term
|
303 |
-
|
304 |
-
}
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
$
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
if ( $
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
//
|
369 |
-
if ( isset( $
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
}
|
380 |
-
|
381 |
-
|
382 |
-
$
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
}
|
537 |
-
|
538 |
-
|
539 |
-
$link
|
540 |
-
}
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
}
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
}
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
}
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
}
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
<
|
810 |
-
<
|
811 |
-
<
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
<?php
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
$instance['
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
<
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
|
15 |
+
/**
|
16 |
+
* YITH WooCommerce Ajax Navigation Widget
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
class YITH_WCAN_Navigation_Widget extends WP_Widget {
|
21 |
+
|
22 |
+
public $brand_taxonomy = '';
|
23 |
+
|
24 |
+
function __construct() {
|
25 |
+
$widget_ops = array( 'classname' => 'yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Filter the product list without reloading the page', 'yith-woocommerce-ajax-navigation' ) );
|
26 |
+
$control_ops = array( 'width' => 400, 'height' => 350 );
|
27 |
+
add_action('wp_ajax_yith_wcan_select_type', array( $this, 'ajax_print_terms') );
|
28 |
+
parent::__construct( 'yith-woo-ajax-navigation', _x( 'YITH WooCommerce Ajax Product Filter', 'Admin: Widget Title', 'yith-woocommerce-ajax-navigation' ), $widget_ops, $control_ops );
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
function widget( $args, $instance ) {
|
33 |
+
global $_chosen_attributes, $woocommerce;
|
34 |
+
|
35 |
+
extract( $args );
|
36 |
+
$_attributes_array = yit_wcan_get_product_taxonomy();
|
37 |
+
|
38 |
+
if( apply_filters( 'yith_wcan_is_search', is_search() ) ){
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( apply_filters( 'yith_wcan_show_widget', ! is_post_type_archive( 'product' ) && ! is_tax( $_attributes_array ) ) ) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
if( defined( 'YITH_WCBR_PREMIUM_INIT' ) && YITH_WCBR_PREMIUM_INIT ) {
|
47 |
+
$this->brand_taxonomy = YITH_WCBR::$brands_taxonomy;
|
48 |
+
}
|
49 |
+
|
50 |
+
$current_term = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->term_id : '';
|
51 |
+
$current_tax = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->taxonomy : '';
|
52 |
+
$title = apply_filters( 'yith_widget_title_ajax_navigation', ( isset( $instance['title'] ) ? $instance['title'] : '' ), $instance, $this->id_base );
|
53 |
+
$query_type = isset( $instance['query_type'] ) ? $instance['query_type'] : 'and';
|
54 |
+
$display_type = isset( $instance['type'] ) ? $instance['type'] : 'list';
|
55 |
+
$is_child_class = 'yit-wcan-child-terms';
|
56 |
+
$is_chosen_class = 'chosen';
|
57 |
+
$terms_type_list = ( isset( $instance['display'] ) && ( $display_type == 'list' || $display_type == 'select' ) ) ? $instance['display'] : 'all';
|
58 |
+
|
59 |
+
$instance['attribute'] = empty( $instance['attribute'] ) ? '' : $instance['attribute'];
|
60 |
+
|
61 |
+
/* FIX TO WOOCOMMERCE 2.1 */
|
62 |
+
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
63 |
+
$taxonomy = wc_attribute_taxonomy_name( $instance['attribute'] );
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
$taxonomy = $woocommerce->attribute_taxonomy_name( $instance['attribute'] );
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( ! taxonomy_exists( $taxonomy ) ) {
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
$taxonomy = apply_filters( 'yith_wcan_get_terms_params', $taxonomy, $instance, 'taxonomy_name' );
|
74 |
+
$terms_type_list = apply_filters( 'yith_wcan_get_terms_params', $terms_type_list, $instance, 'terms_type' );
|
75 |
+
|
76 |
+
$terms = yit_get_terms( $terms_type_list, $taxonomy, $instance );
|
77 |
+
|
78 |
+
if ( count( $terms ) > 0 ) {
|
79 |
+
|
80 |
+
ob_start();
|
81 |
+
|
82 |
+
$found = false;
|
83 |
+
|
84 |
+
echo $before_widget;
|
85 |
+
|
86 |
+
$title = html_entity_decode( apply_filters( 'widget_title', $title ) );
|
87 |
+
|
88 |
+
if ( ! empty( $title ) ) {
|
89 |
+
echo $before_title . $title . $after_title;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Force found when option is selected - do not force found on taxonomy attributes
|
93 |
+
if ( ! $_attributes_array || ! is_tax( $_attributes_array ) ) {
|
94 |
+
if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
|
95 |
+
$found = true;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( in_array( $display_type, apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
|
100 |
+
// List display
|
101 |
+
echo "<ul class='yith-wcan-list yith-wcan'>";
|
102 |
+
|
103 |
+
foreach ( $terms as $term ) {
|
104 |
+
|
105 |
+
// Get count based on current view - uses transients
|
106 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
107 |
+
|
108 |
+
//if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
109 |
+
|
110 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
111 |
+
|
112 |
+
set_transient( $transient_name, $_products_in_term );
|
113 |
+
//}
|
114 |
+
|
115 |
+
$option_is_set = ( isset( $_chosen_attributes[$taxonomy] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) );
|
116 |
+
|
117 |
+
$term_param = apply_filters( 'yith_wcan_term_param_uri', $term->term_id, $display_type, $term );
|
118 |
+
|
119 |
+
// If this is an AND query, only show options with count > 0
|
120 |
+
if ( $query_type == 'and' ) {
|
121 |
+
|
122 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
123 |
+
|
124 |
+
// skip the term for the current archive
|
125 |
+
if ( $current_term == $term_param ) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $count > 0 && $current_term !== $term_param ) {
|
130 |
+
$found = true;
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( ( ( $terms_type_list == 'hierarchical' || ( $terms_type_list == 'tags' && $instance['display'] == 'hierarchical' ) ) || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
|
137 |
+
// If this is an OR query, show all options so search can be expanded
|
138 |
+
}
|
139 |
+
else {
|
140 |
+
|
141 |
+
// skip the term for the current archive
|
142 |
+
if ( $current_term == $term_param ) {
|
143 |
+
continue;
|
144 |
+
}
|
145 |
+
|
146 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
147 |
+
|
148 |
+
if ( $count > 0 ) {
|
149 |
+
$found = true;
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
$arg = apply_filters( 'yith_wcan_list_type_query_arg', 'filter_' . sanitize_title( $instance['attribute'] ), $display_type, $term );
|
155 |
+
|
156 |
+
$current_filter = ( isset( $_GET[$arg] ) ) ? explode(apply_filters( 'yith_wcan_list_filter_operator', ',', $display_type ), apply_filters( "yith_wcan_list_filter_query_{$arg}", $_GET[$arg] ) ) : array();
|
157 |
+
|
158 |
+
if ( ! is_array( $current_filter ) ) {
|
159 |
+
$current_filter = array();
|
160 |
+
}
|
161 |
+
|
162 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
163 |
+
|
164 |
+
if ( ! in_array( $term_param, $current_filter ) ) {
|
165 |
+
$current_filter[] = $term_param;
|
166 |
+
}
|
167 |
+
|
168 |
+
$link = yit_get_woocommerce_layered_nav_link();
|
169 |
+
|
170 |
+
// All current filters
|
171 |
+
if ( $_chosen_attributes ) {
|
172 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
173 |
+
if ( $name !== $taxonomy ) {
|
174 |
+
|
175 |
+
// Exclude query arg for current term archive term
|
176 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
177 |
+
$key = array_search( $current_term, $data );
|
178 |
+
unset( $data['terms'][$key] );
|
179 |
+
}
|
180 |
+
|
181 |
+
// Remove pa_ and sanitize
|
182 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
183 |
+
|
184 |
+
if ( ! empty( $data['terms'] ) ) {
|
185 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( $data['query_type'] == 'or' ) {
|
189 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
// Min/Max
|
196 |
+
if ( isset( $_GET['min_price'] ) ) {
|
197 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
198 |
+
}
|
199 |
+
|
200 |
+
if ( isset( $_GET['max_price'] ) ) {
|
201 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
202 |
+
}
|
203 |
+
|
204 |
+
if ( isset( $_GET['product_tag'] ) && $display_type != 'tags' ) {
|
205 |
+
$link = add_query_arg( 'product_tag', urlencode( $_GET['product_tag'] ), $link );
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
|
209 |
+
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
|
210 |
+
if( $brands->term_id != $term->term_id ){
|
211 |
+
$link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
$check_for_current_widget = isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] );
|
216 |
+
|
217 |
+
// Current Filter = this widget
|
218 |
+
if ( apply_filters( 'yith_wcan_list_type_current_widget_check', $check_for_current_widget, $current_filter, $display_type, $term_param ) ) {
|
219 |
+
$class = ( ( $terms_type_list == 'hierarchical' || ( $terms_type_list == 'tags' && $instance['display'] == 'hierarchical' ) ) && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
|
220 |
+
|
221 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
222 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
223 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term_param ) );
|
224 |
+
$link = add_query_arg( $arg, implode( apply_filters( 'yith_wcan_list_filter_operator', ',', $display_type ), $current_filter_without_this ), $link );
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
else {
|
229 |
+
$class = ( ( $terms_type_list == 'hierarchical' || ( $terms_type_list == 'tags' && $instance['display'] == 'hierarchical' ) ) && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
|
230 |
+
$link = add_query_arg( $arg, implode( apply_filters( 'yith_wcan_list_filter_operator', ',', $display_type ), $current_filter ), $link );
|
231 |
+
}
|
232 |
+
|
233 |
+
// Search Arg
|
234 |
+
if ( get_search_query() ) {
|
235 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
236 |
+
}
|
237 |
+
|
238 |
+
// Post Type Arg
|
239 |
+
if ( isset( $_GET['post_type'] ) ) {
|
240 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
241 |
+
}
|
242 |
+
|
243 |
+
$is_attribute = apply_filters( 'yith_wcan_is_attribute_check', true );
|
244 |
+
|
245 |
+
// Query type Arg
|
246 |
+
if ( $is_attribute && $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'] ) ) ) {
|
247 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
248 |
+
}
|
249 |
+
|
250 |
+
|
251 |
+
echo '<li ' . $class . '>';
|
252 |
+
|
253 |
+
echo ( $count > 0 || $option_is_set ) ? '<a href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
|
254 |
+
|
255 |
+
echo $term->name;
|
256 |
+
|
257 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
258 |
+
|
259 |
+
if ( $count != 0 && apply_filters( "{$args['widget_id']}-show_product_count", true, $instance ) ) {
|
260 |
+
echo ' <small class="count">' . $count . '</small><div class="clear"></div></li>';
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
echo "</ul>";
|
265 |
+
}
|
266 |
+
elseif ( $display_type == 'select' ) {
|
267 |
+
$dropdown_label = __( 'Filters:', 'yith-woocommerce-ajax-navigation' );
|
268 |
+
?>
|
269 |
+
|
270 |
+
<a class="yit-wcan-select-open" href="#"><?php echo apply_filters( 'yith_wcan_dropdown_default_label', $dropdown_label ) ?></a>
|
271 |
+
|
272 |
+
<?php
|
273 |
+
// Select display
|
274 |
+
echo "<div class='yith-wcan-select-wrapper'>";
|
275 |
+
|
276 |
+
echo "<ul class='yith-wcan-select yith-wcan'>";
|
277 |
+
|
278 |
+
foreach ( $terms as $term ) {
|
279 |
+
|
280 |
+
// Get count based on current view - uses transients
|
281 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
282 |
+
|
283 |
+
//if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
284 |
+
|
285 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
286 |
+
|
287 |
+
set_transient( $transient_name, $_products_in_term );
|
288 |
+
//}
|
289 |
+
|
290 |
+
$option_is_set = ( isset( $_chosen_attributes[$taxonomy] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) );
|
291 |
+
|
292 |
+
// If this is an AND query, only show options with count > 0
|
293 |
+
if ( $query_type == 'and' ) {
|
294 |
+
|
295 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
296 |
+
|
297 |
+
// skip the term for the current archive
|
298 |
+
if ( $current_term == $term->term_id ) {
|
299 |
+
continue;
|
300 |
+
}
|
301 |
+
|
302 |
+
if ( $count > 0 && $current_term !== $term->term_id ) {
|
303 |
+
$found = true;
|
304 |
+
}
|
305 |
+
|
306 |
+
if ( ( $terms_type_list != 'hierarchical' || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
|
307 |
+
continue;
|
308 |
+
}
|
309 |
+
|
310 |
+
// If this is an OR query, show all options so search can be expanded
|
311 |
+
}
|
312 |
+
else {
|
313 |
+
|
314 |
+
// skip the term for the current archive
|
315 |
+
if ( $current_term == $term->term_id ) {
|
316 |
+
continue;
|
317 |
+
}
|
318 |
+
|
319 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
320 |
+
|
321 |
+
if ( $count > 0 ) {
|
322 |
+
$found = true;
|
323 |
+
}
|
324 |
+
|
325 |
+
}
|
326 |
+
|
327 |
+
$arg = 'filter_' . urldecode( sanitize_title( $instance['attribute'] ) );
|
328 |
+
|
329 |
+
$current_filter = ( isset( $_GET[$arg] ) ) ? explode( ',', $_GET[$arg] ) : array();
|
330 |
+
|
331 |
+
if ( ! is_array( $current_filter ) ) {
|
332 |
+
$current_filter = array();
|
333 |
+
}
|
334 |
+
|
335 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
336 |
+
|
337 |
+
if ( ! in_array( $term->term_id, $current_filter ) ) {
|
338 |
+
$current_filter[] = $term->term_id;
|
339 |
+
}
|
340 |
+
|
341 |
+
$link = yit_get_woocommerce_layered_nav_link();
|
342 |
+
|
343 |
+
// All current filters
|
344 |
+
if ( $_chosen_attributes ) {
|
345 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
346 |
+
if ( $name !== $taxonomy ) {
|
347 |
+
|
348 |
+
// Exclude query arg for current term archive term
|
349 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
350 |
+
$key = array_search( $current_term, $data );
|
351 |
+
unset( $data['terms'][$key] );
|
352 |
+
}
|
353 |
+
|
354 |
+
// Remove pa_ and sanitize
|
355 |
+
$filter_name = urldecode( sanitize_title( str_replace( 'pa_', '', $name ) ) );
|
356 |
+
|
357 |
+
if ( ! empty( $data['terms'] ) ) {
|
358 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
359 |
+
}
|
360 |
+
|
361 |
+
if ( $data['query_type'] == 'or' ) {
|
362 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
// Min/Max
|
369 |
+
if ( isset( $_GET['min_price'] ) ) {
|
370 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
371 |
+
}
|
372 |
+
|
373 |
+
if ( isset( $_GET['max_price'] ) ) {
|
374 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
375 |
+
}
|
376 |
+
|
377 |
+
if ( isset( $_GET['product_tag'] ) ) {
|
378 |
+
$link = add_query_arg( 'product_tag', urlencode( $_GET['product_tag'] ), $link );
|
379 |
+
}
|
380 |
+
|
381 |
+
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
|
382 |
+
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
|
383 |
+
if( $brands->term_id != $term->term_id ){
|
384 |
+
$link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
|
385 |
+
}
|
386 |
+
}
|
387 |
+
|
388 |
+
// Current Filter = this widget
|
389 |
+
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
|
390 |
+
|
391 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
|
392 |
+
|
393 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
394 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
395 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
396 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
397 |
+
}
|
398 |
+
|
399 |
+
}
|
400 |
+
else {
|
401 |
+
|
402 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
|
403 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
// Search Arg
|
408 |
+
if ( get_search_query() ) {
|
409 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
410 |
+
}
|
411 |
+
|
412 |
+
// Post Type Arg
|
413 |
+
if ( isset( $_GET['post_type'] ) ) {
|
414 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
415 |
+
}
|
416 |
+
|
417 |
+
// Query type Arg
|
418 |
+
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'] ) ) ) {
|
419 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
420 |
+
}
|
421 |
+
|
422 |
+
echo '<li ' . $class . '>';
|
423 |
+
|
424 |
+
echo ( $count > 0 || $option_is_set ) ? '<a data-type="select" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
|
425 |
+
|
426 |
+
echo $term->name;
|
427 |
+
|
428 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
429 |
+
|
430 |
+
echo '</li>';
|
431 |
+
|
432 |
+
}
|
433 |
+
|
434 |
+
echo "</ul>";
|
435 |
+
|
436 |
+
echo "</div>";
|
437 |
+
|
438 |
+
}
|
439 |
+
elseif ( $display_type == 'color' ) {
|
440 |
+
// List display
|
441 |
+
echo "<ul class='yith-wcan-color yith-wcan yith-wcan-group'>";
|
442 |
+
|
443 |
+
foreach ( $terms as $term ) {
|
444 |
+
|
445 |
+
// Get count based on current view - uses transients
|
446 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
447 |
+
|
448 |
+
//if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
449 |
+
|
450 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
451 |
+
|
452 |
+
set_transient( $transient_name, $_products_in_term );
|
453 |
+
//}
|
454 |
+
|
455 |
+
$option_is_set = ( isset( $_chosen_attributes[$taxonomy] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) );
|
456 |
+
|
457 |
+
// If this is an AND query, only show options with count > 0
|
458 |
+
if ( $query_type == 'and' ) {
|
459 |
+
|
460 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
461 |
+
|
462 |
+
// skip the term for the current archive
|
463 |
+
if ( $current_term == $term->term_id ) {
|
464 |
+
continue;
|
465 |
+
}
|
466 |
+
|
467 |
+
if ( $count > 0 && $current_term !== $term->term_id ) {
|
468 |
+
$found = true;
|
469 |
+
}
|
470 |
+
|
471 |
+
if ( $count == 0 && ! $option_is_set ) {
|
472 |
+
continue;
|
473 |
+
}
|
474 |
+
|
475 |
+
// If this is an OR query, show all options so search can be expanded
|
476 |
+
}
|
477 |
+
else {
|
478 |
+
|
479 |
+
// skip the term for the current archive
|
480 |
+
if ( $current_term == $term->term_id ) {
|
481 |
+
continue;
|
482 |
+
}
|
483 |
+
|
484 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
485 |
+
|
486 |
+
if ( $count > 0 ) {
|
487 |
+
$found = true;
|
488 |
+
}
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
$arg = 'filter_' . sanitize_title( $instance['attribute'] );
|
493 |
+
|
494 |
+
$current_filter = ( isset( $_GET[$arg] ) ) ? explode( ',', $_GET[$arg] ) : array();
|
495 |
+
|
496 |
+
if ( ! is_array( $current_filter ) ) {
|
497 |
+
$current_filter = array();
|
498 |
+
}
|
499 |
+
|
500 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
501 |
+
|
502 |
+
if ( ! in_array( $term->term_id, $current_filter ) ) {
|
503 |
+
$current_filter[] = $term->term_id;
|
504 |
+
}
|
505 |
+
|
506 |
+
$link = yit_get_woocommerce_layered_nav_link();
|
507 |
+
|
508 |
+
// All current filters
|
509 |
+
if ( $_chosen_attributes ) {
|
510 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
511 |
+
if ( $name !== $taxonomy ) {
|
512 |
+
|
513 |
+
// Exclude query arg for current term archive term
|
514 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
515 |
+
$key = array_search( $current_term, $data );
|
516 |
+
unset( $data['terms'][$key] );
|
517 |
+
}
|
518 |
+
|
519 |
+
// Remove pa_ and sanitize
|
520 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
521 |
+
|
522 |
+
if ( ! empty( $data['terms'] ) ) {
|
523 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
524 |
+
}
|
525 |
+
|
526 |
+
if ( $data['query_type'] == 'or' ) {
|
527 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
528 |
+
}
|
529 |
+
}
|
530 |
+
}
|
531 |
+
}
|
532 |
+
|
533 |
+
// Min/Max
|
534 |
+
if ( isset( $_GET['min_price'] ) ) {
|
535 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
536 |
+
}
|
537 |
+
|
538 |
+
if ( isset( $_GET['max_price'] ) ) {
|
539 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
540 |
+
}
|
541 |
+
|
542 |
+
if ( isset( $_GET['product_tag'] ) ) {
|
543 |
+
$link = add_query_arg( 'product_tag', urlencode( $_GET['product_tag'] ), $link );
|
544 |
+
}
|
545 |
+
|
546 |
+
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
|
547 |
+
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
|
548 |
+
if( $brands->term_id != $term->term_id ){
|
549 |
+
$link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
// Current Filter = this widget
|
554 |
+
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
|
555 |
+
|
556 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
|
557 |
+
|
558 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
559 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
560 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
561 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
562 |
+
}
|
563 |
+
}
|
564 |
+
else {
|
565 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
|
566 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
567 |
+
}
|
568 |
+
|
569 |
+
// Search Arg
|
570 |
+
if ( get_search_query() ) {
|
571 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
572 |
+
}
|
573 |
+
|
574 |
+
// Post Type Arg
|
575 |
+
if ( isset( $_GET['post_type'] ) ) {
|
576 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
577 |
+
}
|
578 |
+
|
579 |
+
// Query type Arg
|
580 |
+
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'] ) ) ) {
|
581 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
582 |
+
}
|
583 |
+
|
584 |
+
$term_id = yit_wcan_localize_terms( $term->term_id, $taxonomy );
|
585 |
+
|
586 |
+
if ( ! empty( $instance['colors'][$term_id] ) ) {
|
587 |
+
$li_style = apply_filters( "{$args['widget_id']}-li_style", 'background-color:' . $instance['colors'][$term_id] . ';', $instance );
|
588 |
+
|
589 |
+
echo '<li ' . $class . '>';
|
590 |
+
|
591 |
+
echo ( $count > 0 || $option_is_set ) ? '<a style="' . $li_style . '" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '" title="' . $term->name . '" >' : '<span style="background-color:' . $instance['colors'][$term_id] . ';" >';
|
592 |
+
|
593 |
+
echo $term->name;
|
594 |
+
|
595 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
+
echo "</ul>";
|
600 |
+
|
601 |
+
}
|
602 |
+
elseif ( $display_type == 'label' ) {
|
603 |
+
// List display
|
604 |
+
echo "<ul class='yith-wcan-label yith-wcan yith-wcan-group'>";
|
605 |
+
|
606 |
+
foreach ( $terms as $term ) {
|
607 |
+
|
608 |
+
// Get count based on current view - uses transients
|
609 |
+
$transient_name = 'wc_ln_count_' . md5( sanitize_key( $taxonomy ) . sanitize_key( $term->term_id ) );
|
610 |
+
|
611 |
+
//if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
612 |
+
|
613 |
+
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
614 |
+
|
615 |
+
set_transient( $transient_name, $_products_in_term );
|
616 |
+
//}
|
617 |
+
|
618 |
+
$option_is_set = ( isset( $_chosen_attributes[$taxonomy] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) );
|
619 |
+
|
620 |
+
// If this is an AND query, only show options with count > 0
|
621 |
+
if ( $query_type == 'and' ) {
|
622 |
+
|
623 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
|
624 |
+
|
625 |
+
// skip the term for the current archive
|
626 |
+
if ( $current_term == $term->term_id ) {
|
627 |
+
continue;
|
628 |
+
}
|
629 |
+
|
630 |
+
if ( $count > 0 && $current_term !== $term->term_id ) {
|
631 |
+
$found = true;
|
632 |
+
}
|
633 |
+
|
634 |
+
if ( $count == 0 && ! $option_is_set ) {
|
635 |
+
continue;
|
636 |
+
}
|
637 |
+
|
638 |
+
// If this is an OR query, show all options so search can be expanded
|
639 |
+
}
|
640 |
+
else {
|
641 |
+
|
642 |
+
// skip the term for the current archive
|
643 |
+
if ( $current_term == $term->term_id ) {
|
644 |
+
continue;
|
645 |
+
}
|
646 |
+
|
647 |
+
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
|
648 |
+
|
649 |
+
if ( $count > 0 ) {
|
650 |
+
$found = true;
|
651 |
+
}
|
652 |
+
|
653 |
+
}
|
654 |
+
|
655 |
+
$arg = 'filter_' . sanitize_title( $instance['attribute'] );
|
656 |
+
|
657 |
+
$current_filter = ( isset( $_GET[$arg] ) ) ? explode( ',', $_GET[$arg] ) : array();
|
658 |
+
|
659 |
+
if ( ! is_array( $current_filter ) ) {
|
660 |
+
$current_filter = array();
|
661 |
+
}
|
662 |
+
|
663 |
+
$current_filter = array_map( 'esc_attr', $current_filter );
|
664 |
+
|
665 |
+
if ( ! in_array( $term->term_id, $current_filter ) ) {
|
666 |
+
$current_filter[] = $term->term_id;
|
667 |
+
}
|
668 |
+
|
669 |
+
$link = yit_get_woocommerce_layered_nav_link();
|
670 |
+
|
671 |
+
// All current filters
|
672 |
+
if ( $_chosen_attributes ) {
|
673 |
+
foreach ( $_chosen_attributes as $name => $data ) {
|
674 |
+
if ( $name !== $taxonomy ) {
|
675 |
+
|
676 |
+
// Exclude query arg for current term archive term
|
677 |
+
while ( in_array( $current_term, $data['terms'] ) ) {
|
678 |
+
$key = array_search( $current_term, $data );
|
679 |
+
unset( $data['terms'][$key] );
|
680 |
+
}
|
681 |
+
|
682 |
+
// Remove pa_ and sanitize
|
683 |
+
$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
|
684 |
+
|
685 |
+
if ( ! empty( $data['terms'] ) ) {
|
686 |
+
$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
|
687 |
+
}
|
688 |
+
|
689 |
+
if ( $data['query_type'] == 'or' ) {
|
690 |
+
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
|
691 |
+
}
|
692 |
+
}
|
693 |
+
}
|
694 |
+
}
|
695 |
+
|
696 |
+
// Min/Max
|
697 |
+
if ( isset( $_GET['min_price'] ) ) {
|
698 |
+
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
699 |
+
}
|
700 |
+
|
701 |
+
if ( isset( $_GET['max_price'] ) ) {
|
702 |
+
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
703 |
+
}
|
704 |
+
|
705 |
+
if ( isset( $_GET['product_tag'] ) ) {
|
706 |
+
$link = add_query_arg( 'product_tag', urlencode( $_GET['product_tag'] ), $link );
|
707 |
+
}
|
708 |
+
|
709 |
+
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
|
710 |
+
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
|
711 |
+
if( $brands->term_id != $term->term_id ){
|
712 |
+
$link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
// Current Filter = this widget
|
717 |
+
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
|
718 |
+
|
719 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
|
720 |
+
|
721 |
+
// Remove this term is $current_filter has more than 1 term filtered
|
722 |
+
if ( sizeof( $current_filter ) > 1 ) {
|
723 |
+
$current_filter_without_this = array_diff( $current_filter, array( $term->term_id ) );
|
724 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter_without_this ), $link );
|
725 |
+
}
|
726 |
+
|
727 |
+
}
|
728 |
+
else {
|
729 |
+
|
730 |
+
$class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
|
731 |
+
$link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
|
732 |
+
|
733 |
+
}
|
734 |
+
|
735 |
+
// Search Arg
|
736 |
+
if ( get_search_query() ) {
|
737 |
+
$link = add_query_arg( 's', get_search_query(), $link );
|
738 |
+
}
|
739 |
+
|
740 |
+
// Post Type Arg
|
741 |
+
if ( isset( $_GET['post_type'] ) ) {
|
742 |
+
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
743 |
+
}
|
744 |
+
|
745 |
+
// Query type Arg
|
746 |
+
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'] ) ) ) {
|
747 |
+
$link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
|
748 |
+
}
|
749 |
+
|
750 |
+
$term_id = yit_wcan_localize_terms( $term->term_id, $taxonomy );
|
751 |
+
|
752 |
+
if ( ! empty( $instance['labels'][$term_id] ) ) {
|
753 |
+
|
754 |
+
echo '<li ' . $class . '>';
|
755 |
+
|
756 |
+
echo ( $count > 0 || $option_is_set ) ? '<a title="' . $term->name . '" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
|
757 |
+
|
758 |
+
echo $instance['labels'][$term_id];
|
759 |
+
|
760 |
+
echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
|
761 |
+
}
|
762 |
+
}
|
763 |
+
echo "</ul>";
|
764 |
+
|
765 |
+
}
|
766 |
+
else {
|
767 |
+
do_action( "yith_wcan_widget_display_{$display_type}", $args, $instance, $display_type, $terms, $taxonomy );
|
768 |
+
}
|
769 |
+
// End display type conditional
|
770 |
+
|
771 |
+
echo $after_widget;
|
772 |
+
|
773 |
+
if ( ! apply_filters( 'yith_wcan_found_taxonomy', $found ) ) {
|
774 |
+
ob_end_clean();
|
775 |
+
echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
|
776 |
+
}
|
777 |
+
else {
|
778 |
+
echo ob_get_clean();
|
779 |
+
}
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
function form( $instance ) {
|
784 |
+
global $woocommerce;
|
785 |
+
|
786 |
+
$defaults = array(
|
787 |
+
'title' => '',
|
788 |
+
'attribute' => '',
|
789 |
+
'query_type' => 'and',
|
790 |
+
'type' => 'list',
|
791 |
+
'colors' => '',
|
792 |
+
'multicolor' => array(),
|
793 |
+
'labels' => '',
|
794 |
+
'display' => 'all'
|
795 |
+
);
|
796 |
+
|
797 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
798 |
+
|
799 |
+
$widget_types = apply_filters( 'yith_wcan_widget_types', array(
|
800 |
+
'list' => __( 'List', 'yith-woocommerce-ajax-navigation' ),
|
801 |
+
'color' => __( 'Color', 'yith-woocommerce-ajax-navigation' ),
|
802 |
+
'label' => __( 'Label', 'yith-woocommerce-ajax-navigation' ),
|
803 |
+
'select' => __( 'Dropdown', 'yith-woocommerce-ajax-navigation' )
|
804 |
+
)
|
805 |
+
);
|
806 |
+
?>
|
807 |
+
|
808 |
+
<p>
|
809 |
+
<label>
|
810 |
+
<strong><?php _e( 'Title', 'yith-woocommerce-ajax-navigation' ) ?>:</strong><br />
|
811 |
+
<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']; ?>" />
|
812 |
+
</label>
|
813 |
+
</p>
|
814 |
+
|
815 |
+
<p>
|
816 |
+
<label for="<?php echo $this->get_field_id( 'type' ); ?>"><strong><?php _e( 'Type:', 'yith-woocommerce-ajax-navigation' ) ?></strong></label>
|
817 |
+
<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' ) ); ?>">
|
818 |
+
<?php foreach ( $widget_types as $type => $label ) : ?>
|
819 |
+
<option value="<?php echo $type ?>" <?php selected( $type, $instance['type'] ) ?>><?php echo $label ?></option>
|
820 |
+
<?php endforeach; ?>
|
821 |
+
</select>
|
822 |
+
</p>
|
823 |
+
|
824 |
+
<?php do_action( 'yith_wcan_after_widget_type' ); ?>
|
825 |
+
|
826 |
+
<p>
|
827 |
+
<label for="<?php echo $this->get_field_id( 'query_type' ); ?>"><?php _e( 'Query Type:', 'yith-woocommerce-ajax-navigation' ) ?></label>
|
828 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'query_type' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'query_type' ) ); ?>">
|
829 |
+
<option value="and" <?php selected( $instance['query_type'], 'and' ); ?>><?php _e( 'AND', 'yith-woocommerce-ajax-navigation' ); ?></option>
|
830 |
+
<option value="or" <?php selected( $instance['query_type'], 'or' ); ?>><?php _e( 'OR', 'yith-woocommerce-ajax-navigation' ); ?></option>
|
831 |
+
</select>
|
832 |
+
</p>
|
833 |
+
|
834 |
+
<p class="yith-wcan-attribute-list" style="display: <?php echo $instance['type'] == 'tags' || $instance['type'] == 'brands' || $instance['type'] == 'categories' ? 'none' : 'block' ?>;">
|
835 |
+
|
836 |
+
<label for="<?php echo $this->get_field_id( 'attribute' ); ?>"><strong><?php _e( 'Attribute:', 'yith-woocommerce-ajax-navigation' ) ?></strong></label>
|
837 |
+
<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' ) ); ?>">
|
838 |
+
<?php yith_wcan_dropdown_attributes( $instance['attribute'] ); ?>
|
839 |
+
</select>
|
840 |
+
</p>
|
841 |
+
|
842 |
+
<p id="yit-wcan-display" class="yit-wcan-display-<?php echo $instance['type'] ?>">
|
843 |
+
<label for="<?php echo $this->get_field_id( 'display' ); ?>"><strong><?php _e( 'Display (default All):', 'yith-woocommerce-ajax-navigation' ) ?></strong></label>
|
844 |
+
<select class="yith_wcan_type widefat" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>">
|
845 |
+
<option value="all" <?php selected( 'all', $instance['display'] ) ?>> <?php _e( 'All (no hierarchical)', 'yith-woocommerce-ajax-navigation' ) ?></option>
|
846 |
+
<option value="hierarchical" <?php selected( 'hierarchical', $instance['display'] ) ?>> <?php _e( 'All (hierarchical)', 'yith-woocommerce-ajax-navigation' ) ?> </option>
|
847 |
+
<option value="parent" <?php selected( 'parent', $instance['display'] ) ?>> <?php _e( 'Only Parent', 'yith-woocommerce-ajax-navigation' ) ?> </option>
|
848 |
+
</select>
|
849 |
+
</p>
|
850 |
+
|
851 |
+
<div class="yith_wcan_placeholder">
|
852 |
+
<?php
|
853 |
+
$values = array();
|
854 |
+
|
855 |
+
if ( $instance['type'] == 'color' ) {
|
856 |
+
$values = $instance['colors'];
|
857 |
+
}
|
858 |
+
|
859 |
+
if ( $instance['type'] == 'multicolor' ) {
|
860 |
+
$values = $instance['multicolor'];
|
861 |
+
}
|
862 |
+
|
863 |
+
elseif ( $instance['type'] == 'label' ) {
|
864 |
+
$values = $instance['labels'];
|
865 |
+
}
|
866 |
+
|
867 |
+
yith_wcan_attributes_table(
|
868 |
+
$instance['type'],
|
869 |
+
$instance['attribute'],
|
870 |
+
'widget-' . $this->id . '-',
|
871 |
+
'widget-' . $this->id_base . '[' . $this->number . ']',
|
872 |
+
$values,
|
873 |
+
$instance['display']
|
874 |
+
);
|
875 |
+
?>
|
876 |
+
</div>
|
877 |
+
<span class="spinner" style="display: none;"></span>
|
878 |
+
|
879 |
+
<input type="hidden" name="widget_id" value="widget-<?php echo $this->id ?>-" />
|
880 |
+
<input type="hidden" name="widget_name" value="widget-<?php echo $this->id_base ?>[<?php echo $this->number ?>]" />
|
881 |
+
|
882 |
+
<script>jQuery(document).trigger('yith_colorpicker');</script>
|
883 |
+
<?php
|
884 |
+
}
|
885 |
+
|
886 |
+
function update( $new_instance, $old_instance ) {
|
887 |
+
global $woocommerce;
|
888 |
+
|
889 |
+
$instance = $old_instance;
|
890 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
891 |
+
$instance['attribute'] = stripslashes( $new_instance['attribute'] );
|
892 |
+
$instance['query_type'] = stripslashes( $new_instance['query_type'] );
|
893 |
+
$instance['type'] = stripslashes( $new_instance['type'] );
|
894 |
+
$instance['colors'] = ! empty( $new_instance['colors'] ) ? $new_instance['colors'] : array();
|
895 |
+
$instance['multicolor'] = ! empty( $new_instance['multicolor'] ) ? $new_instance['multicolor'] : array();
|
896 |
+
$instance['labels'] = ! empty( $new_instance['labels'] ) ? $new_instance['labels'] : array();
|
897 |
+
$instance['display'] = $new_instance['display'];
|
898 |
+
|
899 |
+
return $instance;
|
900 |
+
}
|
901 |
+
|
902 |
+
/**
|
903 |
+
* Print terms for the element selected
|
904 |
+
*
|
905 |
+
* @access public
|
906 |
+
* @return void
|
907 |
+
* @since 1.0.0
|
908 |
+
*/
|
909 |
+
public function ajax_print_terms() {
|
910 |
+
$type = $_POST['value'];
|
911 |
+
$attribute = $_POST['attribute'];
|
912 |
+
$return = array( 'message' => '', 'content' => $_POST );
|
913 |
+
|
914 |
+
$terms = get_terms( 'pa_' . $attribute, array( 'hide_empty' => '0' ) );
|
915 |
+
|
916 |
+
$settings = $this->get_settings();
|
917 |
+
$widget_settings = $settings[ $this->number ];
|
918 |
+
$value = '';
|
919 |
+
|
920 |
+
if( 'label' == $type ){
|
921 |
+
$value = $widget_settings['labels'];
|
922 |
+
}
|
923 |
+
|
924 |
+
elseif( 'color' == $type ){
|
925 |
+
$value = $widget_settings['colors'];
|
926 |
+
}
|
927 |
+
|
928 |
+
elseif( 'multicolor' == $type ) {
|
929 |
+
$value = $widget_settings['multicolor'];
|
930 |
+
}
|
931 |
+
|
932 |
+
if ( $type ) {
|
933 |
+
$return['content'] = yith_wcan_attributes_table(
|
934 |
+
$type,
|
935 |
+
$attribute,
|
936 |
+
$_POST['id'],
|
937 |
+
$_POST['name'],
|
938 |
+
$value,
|
939 |
+
false
|
940 |
+
);
|
941 |
+
}
|
942 |
+
|
943 |
+
|
944 |
+
echo json_encode( $return );
|
945 |
+
die();
|
946 |
+
}
|
947 |
+
}
|
948 |
}
|
widgets/class.yith-wcan-reset-navigation-widget.php
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author Your Inspiration Themes
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
|
15 |
-
/**
|
16 |
-
* YITH WooCommerce Ajax Navigation Widget
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
*/
|
20 |
-
class YITH_WCAN_Reset_Navigation_Widget extends WP_Widget {
|
21 |
-
|
22 |
-
function __construct() {
|
23 |
-
$widget_ops = array( 'classname' => 'yith-woo-ajax-reset-navigation yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Reset all filters set by YITH WooCommerce Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ) );
|
24 |
-
$control_ops = array( 'width' => 400, 'height' => 350 );
|
25 |
-
parent::__construct( 'yith-woo-ajax-reset-navigation', __( 'YITH WooCommerce Ajax Reset Filter', 'yith-woocommerce-ajax-navigation' ), $widget_ops, $control_ops );
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
function widget( $args, $instance ) {
|
30 |
-
global $_chosen_attributes, $woocommerce;
|
31 |
-
|
32 |
-
extract( $args );
|
33 |
-
|
34 |
-
$_attributes_array = yit_wcan_get_product_taxonomy();
|
35 |
-
|
36 |
-
if ( apply_filters( 'yith_wcan_show_widget', ! is_post_type_archive( 'product' ) && ! is_tax( $_attributes_array ) ) ) {
|
37 |
-
return;
|
38 |
-
}
|
39 |
-
|
40 |
-
// Price
|
41 |
-
$min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0;
|
42 |
-
$max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0;
|
43 |
-
|
44 |
-
ob_start();
|
45 |
-
|
46 |
-
if ( count( $_chosen_attributes ) > 0 || $min_price > 0 || $max_price > 0 || apply_filters( 'yith_woocommerce_reset_filters_attributes', false ) ) {
|
47 |
-
$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) : '';
|
48 |
-
$label = isset( $instance['label'] ) ? apply_filters( 'yith-wcan-reset-navigation-label', $instance['label'], $instance, $this->id_base ) : '';
|
49 |
-
|
50 |
-
//clean the url
|
51 |
-
$link = yit_curPageURL();
|
52 |
-
foreach ( (array) $_chosen_attributes as $taxonomy => $data ) {
|
53 |
-
$taxonomy_filter = str_replace( 'pa_', '', $taxonomy );
|
54 |
-
$link = remove_query_arg( 'filter_' . $taxonomy_filter, $link );
|
55 |
-
}
|
56 |
-
|
57 |
-
$link = remove_query_arg( array( 'min_price', 'max_price', 'product_tag' ), $link );
|
58 |
-
|
59 |
-
$link = apply_filters( 'yith_woocommerce_reset_filter_link', $link );
|
60 |
-
|
61 |
-
echo $before_widget;
|
62 |
-
if ( $title ) {
|
63 |
-
echo $before_title . $title . $after_title;
|
64 |
-
}
|
65 |
-
$button_class = apply_filters( 'yith-wcan-reset-navigation-button-class', "yith-wcan-reset-navigation button" );
|
66 |
-
echo "<div class='yith-wcan'><a class='{$button_class}' href='{$link}'>" . __( $label, 'yith-woocommerce-ajax-navigation' ) . "</a></div>";
|
67 |
-
echo $after_widget;
|
68 |
-
echo ob_get_clean();
|
69 |
-
}
|
70 |
-
else {
|
71 |
-
ob_end_clean();
|
72 |
-
echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
|
77 |
-
function form( $instance ) {
|
78 |
-
global $woocommerce;
|
79 |
-
|
80 |
-
$defaults = array(
|
81 |
-
'title' => '',
|
82 |
-
'label' => __( 'Reset All Filters', 'yith-woocommerce-ajax-navigation' )
|
83 |
-
);
|
84 |
-
|
85 |
-
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
86 |
-
|
87 |
-
<p>
|
88 |
-
<label>
|
89 |
-
<strong><?php _e( 'Title', 'yith-woocommerce-ajax-navigation' ) ?>:</strong><br />
|
90 |
-
<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']; ?>" />
|
91 |
-
</label>
|
92 |
-
</p>
|
93 |
-
<p>
|
94 |
-
<label>
|
95 |
-
<strong><?php _e( 'Button Label', 'yith-woocommerce-ajax-navigation' ) ?>:</strong><br />
|
96 |
-
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'label' ); ?>" name="<?php echo $this->get_field_name( 'label' ); ?>" value="<?php echo $instance['label']; ?>" />
|
97 |
-
</label>
|
98 |
-
</p>
|
99 |
-
|
100 |
-
<?php
|
101 |
-
}
|
102 |
-
|
103 |
-
function update( $new_instance, $old_instance ) {
|
104 |
-
$instance = $old_instance;
|
105 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
106 |
-
$instance['label'] = strip_tags( $new_instance['label'] );
|
107 |
-
|
108 |
-
return $instance;
|
109 |
-
}
|
110 |
-
|
111 |
-
}
|
112 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WCAN' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
|
15 |
+
/**
|
16 |
+
* YITH WooCommerce Ajax Navigation Widget
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
class YITH_WCAN_Reset_Navigation_Widget extends WP_Widget {
|
21 |
+
|
22 |
+
function __construct() {
|
23 |
+
$widget_ops = array( 'classname' => 'yith-woo-ajax-reset-navigation yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Reset all filters set by YITH WooCommerce Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ) );
|
24 |
+
$control_ops = array( 'width' => 400, 'height' => 350 );
|
25 |
+
parent::__construct( 'yith-woo-ajax-reset-navigation', __( 'YITH WooCommerce Ajax Reset Filter', 'yith-woocommerce-ajax-navigation' ), $widget_ops, $control_ops );
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
function widget( $args, $instance ) {
|
30 |
+
global $_chosen_attributes, $woocommerce;
|
31 |
+
|
32 |
+
extract( $args );
|
33 |
+
|
34 |
+
$_attributes_array = yit_wcan_get_product_taxonomy();
|
35 |
+
|
36 |
+
if ( apply_filters( 'yith_wcan_show_widget', ! is_post_type_archive( 'product' ) && ! is_tax( $_attributes_array ) ) ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
// Price
|
41 |
+
$min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0;
|
42 |
+
$max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0;
|
43 |
+
|
44 |
+
ob_start();
|
45 |
+
|
46 |
+
if ( count( $_chosen_attributes ) > 0 || $min_price > 0 || $max_price > 0 || apply_filters( 'yith_woocommerce_reset_filters_attributes', false ) ) {
|
47 |
+
$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) : '';
|
48 |
+
$label = isset( $instance['label'] ) ? apply_filters( 'yith-wcan-reset-navigation-label', $instance['label'], $instance, $this->id_base ) : '';
|
49 |
+
|
50 |
+
//clean the url
|
51 |
+
$link = yit_curPageURL();
|
52 |
+
foreach ( (array) $_chosen_attributes as $taxonomy => $data ) {
|
53 |
+
$taxonomy_filter = str_replace( 'pa_', '', $taxonomy );
|
54 |
+
$link = remove_query_arg( 'filter_' . $taxonomy_filter, $link );
|
55 |
+
}
|
56 |
+
|
57 |
+
$link = remove_query_arg( array( 'min_price', 'max_price', 'product_tag' ), $link );
|
58 |
+
|
59 |
+
$link = apply_filters( 'yith_woocommerce_reset_filter_link', $link );
|
60 |
+
|
61 |
+
echo $before_widget;
|
62 |
+
if ( $title ) {
|
63 |
+
echo $before_title . $title . $after_title;
|
64 |
+
}
|
65 |
+
$button_class = apply_filters( 'yith-wcan-reset-navigation-button-class', "yith-wcan-reset-navigation button" );
|
66 |
+
echo "<div class='yith-wcan'><a class='{$button_class}' href='{$link}'>" . __( $label, 'yith-woocommerce-ajax-navigation' ) . "</a></div>";
|
67 |
+
echo $after_widget;
|
68 |
+
echo ob_get_clean();
|
69 |
+
}
|
70 |
+
else {
|
71 |
+
ob_end_clean();
|
72 |
+
echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
function form( $instance ) {
|
78 |
+
global $woocommerce;
|
79 |
+
|
80 |
+
$defaults = array(
|
81 |
+
'title' => '',
|
82 |
+
'label' => __( 'Reset All Filters', 'yith-woocommerce-ajax-navigation' )
|
83 |
+
);
|
84 |
+
|
85 |
+
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
86 |
+
|
87 |
+
<p>
|
88 |
+
<label>
|
89 |
+
<strong><?php _e( 'Title', 'yith-woocommerce-ajax-navigation' ) ?>:</strong><br />
|
90 |
+
<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']; ?>" />
|
91 |
+
</label>
|
92 |
+
</p>
|
93 |
+
<p>
|
94 |
+
<label>
|
95 |
+
<strong><?php _e( 'Button Label', 'yith-woocommerce-ajax-navigation' ) ?>:</strong><br />
|
96 |
+
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'label' ); ?>" name="<?php echo $this->get_field_name( 'label' ); ?>" value="<?php echo $instance['label']; ?>" />
|
97 |
+
</label>
|
98 |
+
</p>
|
99 |
+
|
100 |
+
<?php
|
101 |
+
}
|
102 |
+
|
103 |
+
function update( $new_instance, $old_instance ) {
|
104 |
+
$instance = $old_instance;
|
105 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
106 |
+
$instance['label'] = strip_tags( $new_instance['label'] );
|
107 |
+
|
108 |
+
return $instance;
|
109 |
+
}
|
110 |
+
|
111 |
+
}
|
112 |
}
|