YITH WooCommerce Compare - Version 2.4.6

Version Description

Released on 04 March 2021

  • New: support for WordPress 5.7
  • New: support for WooCommerce 5.1
  • Update: YITH plugin framework
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Compare
Version 2.4.6
Comparing to
See all releases

Code changes from version 2.4.5 to 2.4.6

Files changed (66) hide show
  1. README.txt +15 -8
  2. assets/css/admin.css +28 -28
  3. assets/css/style.css +224 -226
  4. assets/css/widget.css +64 -64
  5. assets/js/woocompare-admin.js +18 -18
  6. includes/class.yith-woocompare-admin.php +413 -480
  7. includes/class.yith-woocompare-frontend.php +902 -822
  8. includes/class.yith-woocompare-helper.php +89 -105
  9. includes/class.yith-woocompare.php +144 -145
  10. init.php +13 -12
  11. plugin-fw/assets/css/elementor.css +36 -0
  12. plugin-fw/assets/css/metaboxes.css +1 -0
  13. plugin-fw/assets/css/yith-fields.css +15 -209
  14. plugin-fw/assets/css/yith-icon-font.css +167 -0
  15. plugin-fw/assets/fonts/yith-icon.eot +0 -0
  16. plugin-fw/assets/fonts/yith-icon.svg +1 -0
  17. plugin-fw/assets/fonts/yith-icon.ttf +0 -0
  18. plugin-fw/assets/fonts/yith-icon.woff +0 -0
  19. plugin-fw/assets/images/yith-icon.svg +14 -1
  20. plugin-fw/assets/js/yith-fields.js +12 -7
  21. plugin-fw/assets/js/yith-fields.min.js +1 -1
  22. plugin-fw/assets/js/yith-gutenberg.js +0 -212
  23. plugin-fw/assets/js/yith-gutenberg.min.js +0 -1
  24. plugin-fw/dist/gutenberg/index.asset.php +1 -0
  25. plugin-fw/dist/gutenberg/index.js +1 -0
  26. plugin-fw/dist/gutenberg/style-index.css +2 -0
  27. plugin-fw/includes/builders/elementor/class-yith-elementor-widget.php +464 -0
  28. plugin-fw/includes/builders/elementor/class-yith-elementor.php +123 -0
  29. plugin-fw/includes/{class-yith-gutenberg.php → builders/gutenberg/class-yith-gutenberg.php} +39 -22
  30. plugin-fw/includes/builders/gutenberg/src/.jshintrc +24 -0
  31. plugin-fw/includes/builders/gutenberg/src/common/actions-to-jquery-events.js +26 -0
  32. plugin-fw/includes/builders/gutenberg/src/common/ajaxFetch.js +42 -0
  33. plugin-fw/includes/builders/gutenberg/src/common/checkForDeps.js +21 -0
  34. plugin-fw/includes/builders/gutenberg/src/common/generateShortcode.js +42 -0
  35. plugin-fw/includes/builders/gutenberg/src/common/icons.js +12 -0
  36. plugin-fw/includes/builders/gutenberg/src/common/index.js +4 -0
  37. plugin-fw/includes/builders/gutenberg/src/components/color-palette-control/index.js +96 -0
  38. plugin-fw/includes/builders/gutenberg/src/components/color-palette-control/style.scss +9 -0
  39. plugin-fw/includes/builders/gutenberg/src/components/color-picker-control/index.js +53 -0
  40. plugin-fw/includes/builders/gutenberg/src/components/shortcode/index.js +149 -0
  41. plugin-fw/includes/builders/gutenberg/src/components/shortcode/style.scss +56 -0
  42. plugin-fw/includes/builders/gutenberg/src/edit.js +233 -0
  43. plugin-fw/includes/builders/gutenberg/src/index.js +53 -0
  44. plugin-fw/includes/class-yit-assets.php +13 -1
  45. plugin-fw/includes/class-yit-plugin-panel-woocommerce.php +53 -48
  46. plugin-fw/includes/class-yit-plugin-panel.php +1 -1
  47. plugin-fw/includes/class-yit-pointers.php +2 -2
  48. plugin-fw/includes/class-yith-system-status.php +2 -2
  49. plugin-fw/init.php +2 -2
  50. plugin-fw/languages/yith-plugin-fw-el.mo +0 -0
  51. plugin-fw/languages/yith-plugin-fw-el.po +47 -38
  52. plugin-fw/languages/yith-plugin-fw-es_ES.mo +0 -0
  53. plugin-fw/languages/yith-plugin-fw-es_ES.po +56 -39
  54. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  55. plugin-fw/languages/yith-plugin-fw-it_IT.po +56 -38
  56. plugin-fw/languages/yith-plugin-fw-nl_NL.mo +0 -0
  57. plugin-fw/languages/yith-plugin-fw-nl_NL.po +47 -38
  58. plugin-fw/languages/yith-plugin-fw.pot +31 -26
  59. plugin-fw/lib/yith-gutenberg.php +1 -1
  60. plugin-fw/templates/fields/dimensions.php +14 -3
  61. plugin-fw/yit-functions.php +34 -0
  62. plugin-fw/yit-plugin.php +4 -1
  63. plugin-options/general-options.php +134 -136
  64. plugin-options/premium-options.php +19 -23
  65. templates/admin/premium.php +368 -357
  66. templates/compare.php +322 -288
README.txt CHANGED
@@ -3,13 +3,13 @@
3
  Contributors: yithemes
4
  Tags: yith, woocommerce compare, compare products, product compare, product comparison
5
  Requires at least: 4.0
6
- Tested up to: 5.6
7
- Stable tag: 2.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  YITH WooCommerce Compare allows you to compare more products of your shop in one complete table.
12
- WooCommerce Compatible up to 4.9.x
13
 
14
  == Description ==
15
 
@@ -19,7 +19,7 @@ set with the woocommerce attributes in the product configuration.
19
  You can also add a simple widget with the list of products the users have added, where you can manage them.
20
  Also you can simply customize the compare table with your style, by editing the specific template.
21
 
22
- Full documentation is available [here](https://yithemes.com/docs-plugins/yith-woocommerce-compare).
23
 
24
  This plugin is 100% compatible with [WPML](http://wpml.org/?aid=24889&affiliate_key=Qn1wDeBNTcZV)
25
 
@@ -45,10 +45,10 @@ You can also add the widget with the product list of compare table, in Appearanc
45
  Yes, you can copy the template from the plugin folder and paste it inside the folder "woocommerce" of your theme folder.
46
 
47
  = Can I select what fields show inside the compare table? =
48
- Yes, you can choose what fields to show in the compare table. You can do it in YIT Plugins -> Compare.
49
 
50
  = Can I order the fields in the compare table? =
51
- Yes, you can sort the fields in the compare table. You can do it in YIT Plugins -> Compare.
52
 
53
  = What are the main changes in plugin translation? =
54
  Recently YITH WooCommerce Compare has been selected to be included in the "translate.wordpress.org" translate programme.
@@ -66,6 +66,12 @@ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
69
  = 2.4.5 = Released on 04 February 2021
70
 
71
  * New: support for WooCommerce 5.0
@@ -434,7 +440,8 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
434
 
435
  == Upgrade notice ==
436
 
437
- = 2.4.5 = Released on 04 February 2021
438
 
439
- * New: support for WooCommerce 5.0
 
440
  * Update: YITH plugin framework
3
  Contributors: yithemes
4
  Tags: yith, woocommerce compare, compare products, product compare, product comparison
5
  Requires at least: 4.0
6
+ Tested up to: 5.7
7
+ Stable tag: 2.4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  YITH WooCommerce Compare allows you to compare more products of your shop in one complete table.
12
+ WooCommerce Compatible up to 5.1
13
 
14
  == Description ==
15
 
19
  You can also add a simple widget with the list of products the users have added, where you can manage them.
20
  Also you can simply customize the compare table with your style, by editing the specific template.
21
 
22
+ Full documentation is available [here](https://docs.yithemes.com/yith-woocommerce-compare/).
23
 
24
  This plugin is 100% compatible with [WPML](http://wpml.org/?aid=24889&affiliate_key=Qn1wDeBNTcZV)
25
 
45
  Yes, you can copy the template from the plugin folder and paste it inside the folder "woocommerce" of your theme folder.
46
 
47
  = Can I select what fields show inside the compare table? =
48
+ Yes, you can choose what fields to show in the compare table. You can do it in YITH -> Compare.
49
 
50
  = Can I order the fields in the compare table? =
51
+ Yes, you can sort the fields in the compare table. You can do it in YITH -> Compare.
52
 
53
  = What are the main changes in plugin translation? =
54
  Recently YITH WooCommerce Compare has been selected to be included in the "translate.wordpress.org" translate programme.
66
 
67
  == Changelog ==
68
 
69
+ = 2.4.6 = Released on 04 March 2021
70
+
71
+ * New: support for WordPress 5.7
72
+ * New: support for WooCommerce 5.1
73
+ * Update: YITH plugin framework
74
+
75
  = 2.4.5 = Released on 04 February 2021
76
 
77
  * New: support for WooCommerce 5.0
440
 
441
  == Upgrade notice ==
442
 
443
+ = 2.4.6 = Released on 04 March 2021
444
 
445
+ * New: support for WordPress 5.7
446
+ * New: support for WooCommerce 5.1
447
  * Update: YITH plugin framework
assets/css/admin.css CHANGED
@@ -1,28 +1,28 @@
1
- .yith_woocommerce_slider {
2
- width: 300px;
3
- float: left
4
- }
5
- .yith_woocommerce_slider_value {
6
- margin-top: -5px;
7
- margin-left: 10px;
8
- width: 50px;
9
- float: left;
10
- text-align: center;
11
- font-weight: bold;
12
- }
13
-
14
- .attributes li {
15
- margin-bottom: 0;
16
- }
17
-
18
- .attributes .ui-sortable-placeholder {
19
- background: #f9f9f9;
20
- border: 1px dashed #d4d4d4;
21
- -webkit-border-radius: 3px;
22
- -moz-border-radius: 3px;
23
- border-radius: 3px;
24
- visibility: visible !important;
25
- box-sizing: border-box;
26
- -moz-box-sizing: border-box;
27
- margin-bottom: -2px;
28
- }
1
+ .yith_woocommerce_slider {
2
+ width: 300px;
3
+ float: left
4
+ }
5
+ .yith_woocommerce_slider_value {
6
+ margin-top: -5px;
7
+ margin-left: 10px;
8
+ width: 50px;
9
+ float: left;
10
+ text-align: center;
11
+ font-weight: bold;
12
+ }
13
+
14
+ .attributes li {
15
+ margin-bottom: 0;
16
+ }
17
+
18
+ .attributes .ui-sortable-placeholder {
19
+ background: #f9f9f9;
20
+ border: 1px dashed #d4d4d4;
21
+ -webkit-border-radius: 3px;
22
+ -moz-border-radius: 3px;
23
+ border-radius: 3px;
24
+ visibility: visible !important;
25
+ box-sizing: border-box;
26
+ -moz-box-sizing: border-box;
27
+ margin-bottom: -2px;
28
+ }
assets/css/style.css CHANGED
@@ -1,227 +1,225 @@
1
- /**
2
- * The style of the woocommerce compare products
3
- */
4
-
5
- /* ###############
6
- FIXED COLUMNS
7
- ##############*/
8
-
9
- table.DTFC_Cloned thead, table.DTFC_Cloned tfoot{
10
- background-color:white;
11
- }
12
- div.DTFC_Blocker{
13
- background-color:white;
14
- }
15
- div.DTFC_LeftWrapper table.dataTable,
16
- div.DTFC_RightWrapper table.dataTable{
17
- margin-bottom:0;
18
- z-index:2;
19
- }
20
- div.DTFC_LeftWrapper table.dataTable.no-footer,
21
- div.DTFC_RightWrapper table.dataTable.no-footer{
22
- border-bottom:none;
23
- }
24
-
25
- /*############################
26
- * COMPARE
27
- #############################*/
28
-
29
- body {
30
- font-family: 'Open Sans', san-serif;
31
- font-size: 13px;
32
- line-height: 1.51em;
33
- color: #747373;
34
- background: none !important;
35
- margin: 0;
36
- }
37
-
38
- body h1 {
39
- background: #4F4F4F;
40
- color: #fff;
41
- font-weight: 800;
42
- padding: 10px;
43
- border-bottom: 2px solid #fff;
44
- display: block;
45
- text-transform: uppercase;
46
- font-size: 1.076em;
47
- margin: 0;
48
- text-align: center;
49
- }
50
-
51
- body #yith-woocompare {
52
- padding: 10px;
53
- }
54
-
55
- table.dataTable.compare-list tr {
56
- display: table-row;
57
- }
58
-
59
- table.dataTable.compare-list thead th,
60
- table.dataTable.compare-list thead td,
61
- table.dataTable.compare-list tfoot td,
62
- table.dataTable.compare-list tfoot th {
63
- border: 0;
64
- vertical-align: middle;
65
- }
66
- .DTFC_LeftFootWrapper table.compare-list,
67
- .DTFC_LeftHeadWrapper table.compare-list {
68
- border: 0;
69
- }
70
-
71
- table.compare-list td {
72
- width: 220px;
73
- max-width: 220px;
74
- min-width: 220px;
75
- text-align: center;
76
- vertical-align: middle;
77
- }
78
-
79
- table.compare-list {
80
- width: 100%;
81
- border-bottom: 0;
82
- border-top: 0;
83
- margin: 0;
84
- table-layout: auto;
85
- }
86
-
87
- table.compare-list tbody th {
88
- width: 150px;
89
- max-width: 150px;
90
- min-width: 150px;
91
- overflow: hidden;
92
- text-align: left;
93
- color: #333333;
94
- background-color: #f2f2f2;
95
- text-transform: uppercase;
96
- font-weight: 700;
97
- font-size: 14px;
98
- }
99
-
100
- .rtl table.compare-list tbody th {
101
- text-align: right;
102
- }
103
-
104
- table.dataTable.compare-list tbody th,
105
- table.dataTable.compare-list tbody td {
106
- border-right: 1px solid #e7e7e7;
107
- border-top: 1px solid #e7e7e7;
108
- border-bottom: none;
109
- border-left: none;
110
- padding: 10px;
111
- vertical-align: middle;
112
- }
113
- table.dataTable.compare-list tbody tr:last-child th,
114
- table.dataTable.compare-list tbody tr:last-child td {
115
- border-bottom: 1px solid #e7e7e7;
116
- }
117
-
118
- table.compare-list tbody td.last-column {
119
- width: auto;
120
- border-right: 0;
121
- }
122
-
123
- #yith-woocompare-table_wrapper {
124
- margin: 10px 0;
125
- }
126
-
127
- table.dataTable.compare-list tbody .product_info td {
128
- vertical-align: top;
129
- }
130
-
131
- table.compare-list thead th a.close, h1 a.close {
132
- float: right;
133
- margin-right: 10px;
134
- font-weight: 600;
135
- font-size: 0.9em;
136
- color: #fff;
137
- text-decoration: none;
138
- }
139
-
140
- table.compare-list .remove td a {
141
- color: #747373;
142
- text-decoration: none;
143
- }
144
-
145
- table.compare-list .remove td a:hover {
146
- color: #333333;
147
- }
148
-
149
- table.compare-list .remove td a .remove {
150
- border-radius: 100% 100% 100% 100%;
151
- color: red;
152
- display: inline-block;
153
- font-size: 1em;
154
- font-weight: 600;
155
- height: 1em;
156
- line-height: 0.81em;
157
- text-align: center;
158
- text-decoration: none;
159
- width: 1em;
160
- }
161
-
162
- .yith-woocompare-widget ul.products-list a.remove {
163
- float: left;
164
- }
165
-
166
- table.compare-list .remove td a:hover .remove {
167
- background-color: red;
168
- color: #ffffff;
169
- }
170
-
171
- table.compare-list .add-to-cart td a:not(.unstyled_button) {
172
- display: inline-block;
173
- margin: 10px 0;
174
- background-color: #4F4F4F;
175
- border: 0 none;
176
- color: #FFFFFF;
177
- font-weight: normal;
178
- line-height: normal;
179
- padding: 5px 20px;
180
- text-decoration: none;
181
- text-transform: uppercase;
182
- cursor: pointer;
183
- }
184
-
185
- table.compare-list .add-to-cart td a:not(.unstyled_button):hover {
186
- background: #868686;
187
- color: #fff;
188
- }
189
-
190
- table.compare-list .stock td span {
191
- color: #009900;
192
- }
193
-
194
- table.compare-list .stock td span.out-of-stock {
195
- color: #990000;
196
- }
197
-
198
- table.compare-list .price td {
199
- text-decoration: underline;
200
- }
201
-
202
- table.compare-list td.odd {
203
- background: #F7F7F7;
204
- }
205
-
206
- table.compare-list td.even {
207
- background: #fff;
208
- }
209
-
210
- table.compare-list td img {
211
- background: none repeat scroll 0 0 #FFFFFF;
212
- border: 1px solid #DADADA;
213
- height: auto;
214
- max-width: 100%;
215
- padding: 3px;
216
- margin-bottom: 20px;
217
- max-width: none;
218
- }
219
-
220
- @media( max-width: 767px ) {
221
- table.compare-list tbody th {
222
- width: 100px;
223
- max-width: 100px;
224
- min-width: 100px;
225
- font-size: 12px;
226
- }
227
  }
1
+ /**
2
+ * The style of the woocommerce compare products
3
+ */
4
+
5
+ /* ###############
6
+ FIXED COLUMNS
7
+ ##############*/
8
+
9
+ table.DTFC_Cloned thead, table.DTFC_Cloned tfoot{
10
+ background-color:white;
11
+ }
12
+ div.DTFC_Blocker{
13
+ background-color:white;
14
+ }
15
+ div.DTFC_LeftWrapper table.dataTable,
16
+ div.DTFC_RightWrapper table.dataTable{
17
+ margin-bottom:0;
18
+ z-index:2;
19
+ }
20
+ div.DTFC_LeftWrapper table.dataTable.no-footer,
21
+ div.DTFC_RightWrapper table.dataTable.no-footer{
22
+ border-bottom:none;
23
+ }
24
+
25
+ /*############################
26
+ * COMPARE
27
+ #############################*/
28
+
29
+ body {
30
+ font-family: 'Open Sans', san-serif;
31
+ font-size: 13px;
32
+ line-height: 1.51em;
33
+ color: #747373;
34
+ background: none !important;
35
+ margin: 0;
36
+ }
37
+
38
+ body h1 {
39
+ background: #4F4F4F;
40
+ color: #fff;
41
+ font-weight: 800;
42
+ padding: 10px;
43
+ border-bottom: 2px solid #fff;
44
+ display: block;
45
+ text-transform: uppercase;
46
+ font-size: 1.076em;
47
+ margin: 0;
48
+ text-align: center;
49
+ }
50
+
51
+ body #yith-woocompare {
52
+ padding: 10px;
53
+ }
54
+
55
+ table.dataTable.compare-list tr {
56
+ display: table-row;
57
+ }
58
+
59
+ table.dataTable.compare-list thead th,
60
+ table.dataTable.compare-list thead td,
61
+ table.dataTable.compare-list tfoot td,
62
+ table.dataTable.compare-list tfoot th {
63
+ border: 0;
64
+ vertical-align: middle;
65
+ }
66
+ .DTFC_LeftFootWrapper table.compare-list,
67
+ .DTFC_LeftHeadWrapper table.compare-list {
68
+ border: 0;
69
+ }
70
+
71
+ table.compare-list td {
72
+ width: 220px;
73
+ max-width: 220px;
74
+ min-width: 220px;
75
+ text-align: center;
76
+ vertical-align: middle;
77
+ }
78
+
79
+ table.compare-list {
80
+ width: 100%;
81
+ border-bottom: 0;
82
+ border-top: 0;
83
+ margin: 0;
84
+ table-layout: auto;
85
+ }
86
+
87
+ table.compare-list tbody th {
88
+ width: 150px;
89
+ max-width: 150px;
90
+ min-width: 150px;
91
+ overflow: hidden;
92
+ text-align: left;
93
+ color: #333333;
94
+ background-color: #f2f2f2;
95
+ text-transform: uppercase;
96
+ font-weight: 700;
97
+ font-size: 14px;
98
+ }
99
+
100
+ .rtl table.compare-list tbody th {
101
+ text-align: right;
102
+ }
103
+
104
+ table.dataTable.compare-list tbody th,
105
+ table.dataTable.compare-list tbody td {
106
+ border-right: 1px solid #e7e7e7;
107
+ border-top: 1px solid #e7e7e7;
108
+ border-bottom: none;
109
+ border-left: none;
110
+ padding: 10px;
111
+ vertical-align: middle;
112
+ }
113
+ table.dataTable.compare-list tbody tr:last-child th,
114
+ table.dataTable.compare-list tbody tr:last-child td {
115
+ border-bottom: 1px solid #e7e7e7;
116
+ }
117
+
118
+ table.compare-list tbody td.last-column {
119
+ width: auto;
120
+ border-right: 0;
121
+ }
122
+
123
+ #yith-woocompare-table_wrapper {
124
+ margin: 10px 0;
125
+ }
126
+
127
+ table.dataTable.compare-list tbody .product_info td {
128
+ vertical-align: top;
129
+ }
130
+
131
+ table.compare-list thead th a.close, h1 a.close {
132
+ float: right;
133
+ margin-right: 10px;
134
+ font-weight: 600;
135
+ font-size: 0.9em;
136
+ color: #fff;
137
+ text-decoration: none;
138
+ }
139
+
140
+ table.compare-list .remove td a {
141
+ color: #747373;
142
+ text-decoration: none;
143
+ }
144
+
145
+ table.compare-list .remove td a:hover {
146
+ color: #333333;
147
+ }
148
+
149
+ table.compare-list .remove td a .remove {
150
+ border-radius: 100% 100% 100% 100%;
151
+ color: red;
152
+ display: inline-block;
153
+ font-size: 1em;
154
+ font-weight: 600;
155
+ height: 1em;
156
+ line-height: 0.81em;
157
+ text-align: center;
158
+ text-decoration: none;
159
+ width: 1em;
160
+ }
161
+
162
+ .yith-woocompare-widget ul.products-list a.remove {
163
+ float: left;
164
+ }
165
+
166
+ table.compare-list .remove td a:hover .remove {
167
+ background-color: red;
168
+ color: #ffffff;
169
+ }
170
+
171
+ table.compare-list .add-to-cart td a:not(.unstyled_button) {
172
+ display: inline-block;
173
+ margin: 10px 0;
174
+ background-color: #4F4F4F;
175
+ border: 0 none;
176
+ color: #FFFFFF;
177
+ font-weight: normal;
178
+ line-height: normal;
179
+ padding: 5px 20px;
180
+ text-decoration: none;
181
+ text-transform: uppercase;
182
+ cursor: pointer;
183
+ }
184
+
185
+ table.compare-list .add-to-cart td a:not(.unstyled_button):hover {
186
+ background: #868686;
187
+ color: #fff;
188
+ }
189
+
190
+ table.compare-list .stock td span {
191
+ color: #009900;
192
+ }
193
+
194
+ table.compare-list .stock td span.out-of-stock {
195
+ color: #990000;
196
+ }
197
+
198
+ table.compare-list .price td {
199
+ text-decoration: underline;
200
+ }
201
+
202
+ table.compare-list td.odd {
203
+ background: #F7F7F7;
204
+ }
205
+
206
+ table.compare-list td.even {
207
+ background: #fff;
208
+ }
209
+
210
+ table.compare-list td img {
211
+ background: none repeat scroll 0 0 #FFFFFF;
212
+ border: 1px solid #DADADA;
213
+ height: auto;
214
+ padding: 3px;
215
+ margin-bottom: 20px;
216
+ }
217
+
218
+ @media( max-width: 767px ) {
219
+ table.compare-list tbody th {
220
+ width: 100px;
221
+ max-width: 100px;
222
+ min-width: 100px;
223
+ font-size: 12px;
224
+ }
 
 
225
  }
assets/css/widget.css CHANGED
@@ -1,65 +1,65 @@
1
- .yith-woocompare-widget ul.products-list {
2
- list-style: none;
3
- margin: 0 0 15px;
4
- }
5
-
6
- .yith-woocompare-widget ul.products-list li:not( .list_empty ) {
7
- position: relative;
8
- padding: 5px 0 5px 30px;
9
- border-bottom: 1px solid #dfdfdf;
10
- }
11
-
12
- .yith-woocompare-widget ul.products-list li .remove {
13
- position: absolute;
14
- left: 3px;
15
- color: #ff0000;
16
- font-weight: 400;
17
- font-size: 1.2em;
18
- line-height: 1.2;
19
- height: 1.2em;
20
- width: 1.2em;
21
- border-radius: 50%;
22
- text-align: center;
23
- cursor: pointer;
24
- outline: none;
25
- }
26
-
27
- .yith-woocompare-widget ul.products-list li .remove:hover {
28
- background-color: #ff0000;
29
- color: #ffffff;
30
- }
31
-
32
- .yith-woocompare-widget ul.products-list li .title {
33
- cursor: pointer;
34
- text-transform: uppercase;
35
- font-size: 12px;
36
- font-weight: 400;
37
- display: block;
38
- outline: none;
39
- }
40
-
41
- .yith-woocompare-widget a.compare {
42
- float: right;
43
- float: right;
44
- line-height: 1;
45
- cursor: pointer;
46
- padding: 8px 10px;
47
- font-size: 13px;
48
- text-transform: uppercase;
49
- font-weight: 700;
50
- border-radius: 3px;
51
- border: 0;
52
- white-space: nowrap;
53
- display: inline-block;
54
- color: #ffffff;
55
- background-color: #b2b2b2;
56
- }
57
-
58
- .yith-woocompare-widget a.compare:hover {
59
- background-color: #303030;
60
- }
61
-
62
- .yith-woocompare-widget a.clear-all {
63
- outline: none;
64
- font-size: 12px;
65
  }
1
+ .yith-woocompare-widget ul.products-list {
2
+ list-style: none;
3
+ margin: 0 0 15px;
4
+ }
5
+
6
+ .yith-woocompare-widget ul.products-list li:not( .list_empty ) {
7
+ position: relative;
8
+ padding: 5px 0 5px 30px;
9
+ border-bottom: 1px solid #dfdfdf;
10
+ }
11
+
12
+ .yith-woocompare-widget ul.products-list li .remove {
13
+ position: absolute;
14
+ left: 3px;
15
+ color: #ff0000;
16
+ font-weight: 400;
17
+ font-size: 1.2em;
18
+ line-height: 1.2;
19
+ height: 1.2em;
20
+ width: 1.2em;
21
+ border-radius: 50%;
22
+ text-align: center;
23
+ cursor: pointer;
24
+ outline: none;
25
+ }
26
+
27
+ .yith-woocompare-widget ul.products-list li .remove:hover {
28
+ background-color: #ff0000;
29
+ color: #ffffff;
30
+ }
31
+
32
+ .yith-woocompare-widget ul.products-list li .title {
33
+ cursor: pointer;
34
+ text-transform: uppercase;
35
+ font-size: 12px;
36
+ font-weight: 400;
37
+ display: block;
38
+ outline: none;
39
+ }
40
+
41
+ .yith-woocompare-widget a.compare {
42
+ float: right;
43
+ float: right;
44
+ line-height: 1;
45
+ cursor: pointer;
46
+ padding: 8px 10px;
47
+ font-size: 13px;
48
+ text-transform: uppercase;
49
+ font-weight: 700;
50
+ border-radius: 3px;
51
+ border: 0;
52
+ white-space: nowrap;
53
+ display: inline-block;
54
+ color: #ffffff;
55
+ background-color: #b2b2b2;
56
+ }
57
+
58
+ .yith-woocompare-widget a.compare:hover {
59
+ background-color: #303030;
60
+ }
61
+
62
+ .yith-woocompare-widget a.clear-all {
63
+ outline: none;
64
+ font-size: 12px;
65
  }
assets/js/woocompare-admin.js CHANGED
@@ -1,19 +1,19 @@
1
- jQuery(document).ready(function($) {
2
-
3
- $( ".attributes .fields" ).sortable({
4
- cursor: "move",
5
- scrollSensitivity: 10,
6
- tolerance: "pointer",
7
- axis: "y",
8
- stop: function(event, ui) {
9
- var list = ui.item.parents('.fields'),
10
- fields = new Array();
11
- $('input[type="checkbox"]', list).each(function(i){
12
- fields[i] = $(this).val();
13
- });
14
-
15
- list.next().val( fields.join(',') );
16
- }
17
- });
18
-
19
  });
1
+ jQuery(document).ready(function($) {
2
+
3
+ $( ".attributes .fields" ).sortable({
4
+ cursor: "move",
5
+ scrollSensitivity: 10,
6
+ tolerance: "pointer",
7
+ axis: "y",
8
+ stop: function(event, ui) {
9
+ var list = ui.item.parents('.fields'),
10
+ fields = new Array();
11
+ $('input[type="checkbox"]', list).each(function(i){
12
+ fields[i] = $(this).val();
13
+ });
14
+
15
+ list.next().val( fields.join(',') );
16
+ }
17
+ });
18
+
19
  });
includes/class.yith-woocompare-admin.php CHANGED
@@ -1,480 +1,413 @@
1
- <?php
2
- /**
3
- * Admin class
4
- *
5
- * @author YITH
6
- * @package YITH WooCommerce Compare
7
- * @version 2.0.0
8
- */
9
-
10
- if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the admin behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_Woocompare_Admin {
22
-
23
-
24
- /**
25
- * Plugin options
26
- *
27
- * @var array
28
- * @access public
29
- * @since 1.0.0
30
- */
31
- public $options = array();
32
-
33
- /**
34
- * Plugin version
35
- *
36
- * @var string
37
- * @since 1.0.0
38
- */
39
- public $version = YITH_WOOCOMPARE_VERSION;
40
-
41
- /**
42
- * @var $_panel Panel Object
43
- */
44
- protected $_panel;
45
-
46
- /**
47
- * @var $_premium string Premium tab template file name
48
- */
49
- protected $_premium = 'premium.php';
50
-
51
- /**
52
- * @var string Premium version landing link
53
- */
54
- protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-compare';
55
-
56
- /**
57
- * @var string Compare panel page
58
- */
59
- protected $_panel_page = 'yith_woocompare_panel';
60
-
61
- /**
62
- * Various links
63
- *
64
- * @var string
65
- * @access public
66
- * @since 1.0.0
67
- */
68
- public $doc_url = 'http://yithemes.com/docs-plugins/yith-woocommerce-compare/';
69
-
70
- /**
71
- * Constructor
72
- *
73
- * @access public
74
- * @since 1.0.0
75
- */
76
- public function __construct() {
77
-
78
- add_action( 'admin_menu', array( $this, 'register_panel' ), 5) ;
79
-
80
- //Add action links
81
- add_filter( 'plugin_action_links_' . plugin_basename( YITH_WOOCOMPARE_DIR . '/' . basename( YITH_WOOCOMPARE_FILE ) ), array( $this, 'action_links' ) );
82
- add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
83
-
84
- add_action( 'yith_woocompare_premium', array( $this, 'premium_tab' ) );
85
-
86
- add_action( 'admin_init', array( $this, 'register_pointer' ) );
87
- add_action( 'admin_init', array( $this, 'default_options'), 99 );
88
-
89
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 20 );
90
-
91
- add_action( 'woocommerce_admin_field_woocompare_image_width', array( $this, 'admin_fields_woocompare_image_width' ) );
92
- add_action( 'woocommerce_admin_field_woocompare_attributes', array( $this, 'admin_fields_attributes' ), 10, 1 );
93
- if( version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.4', '<' ) ) {
94
- add_action( 'woocommerce_update_option_woocompare_attributes', array( $this, 'admin_update_custom_option_pre_24' ), 10, 1 );
95
- }
96
- else {
97
- add_filter( 'woocommerce_admin_settings_sanitize_option_yith_woocompare_fields_attrs', array( $this, 'admin_update_custom_option' ), 10, 3 );
98
- }
99
-
100
- // YITH WCWL Loaded
101
- do_action( 'yith_woocompare_loaded' );
102
- }
103
-
104
- /**
105
- * Action Links
106
- *
107
- * add the action links to plugin admin page
108
- *
109
- * @param $links | links plugin array
110
- *
111
- * @return mixed Array
112
- * @since 1.0
113
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
114
- * @return mixed
115
- * @use plugin_action_links_{$plugin_file_name}
116
- */
117
- public function action_links( $links ) {
118
-
119
- $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
120
- if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) {
121
- $links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '" target="_blank">' . __( 'License', 'yith-woocommerce-compare' ) . '</a>';
122
- }
123
-
124
- return $links;
125
- }
126
-
127
- /**
128
- * Add a panel under YITH Plugins tab
129
- *
130
- * @return void
131
- * @since 1.0
132
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
133
- * @use /Yit_Plugin_Panel class
134
- * @see plugin-fw/lib/yit-plugin-panel.php
135
- */
136
- public function register_panel() {
137
-
138
- if ( ! empty( $this->_panel ) ) {
139
- return;
140
- }
141
-
142
- $admin_tabs = array(
143
- 'general' => __( 'Settings', 'yith-woocommerce-compare' ),
144
- );
145
-
146
- if ( ! ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) ) {
147
- $admin_tabs['premium'] = __( 'Premium Version', 'yith-woocommerce-compare' );
148
- }
149
-
150
- $args = array(
151
- 'create_menu_page' => true,
152
- 'parent_slug' => '',
153
- 'page_title' => _x( 'WooCommerce Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
154
- 'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
155
- 'capability' => 'manage_options',
156
- 'parent' => '',
157
- 'parent_page' => 'yith_plugin_panel',
158
- 'page' => $this->_panel_page,
159
- 'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
160
- 'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options',
161
- 'class' => yith_set_wrapper_class(),
162
- 'plugin_slug' => YITH_WOOCOMPARE_SLUG
163
- );
164
-
165
-
166
- /* === Fixed: not updated theme === */
167
- if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
168
- require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php' );
169
- }
170
-
171
- $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
172
- $this->options = $this->_panel->get_main_array_options();
173
- }
174
-
175
- /**
176
- * Set default custom options
177
- *
178
- */
179
- public function default_options() {
180
- $this->_default_options();
181
- }
182
-
183
- /**
184
- * Premium Tab Template
185
- *
186
- * Load the premium tab template on admin page
187
- *
188
- * @return void
189
- * @since 1.0
190
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
191
- * @return void
192
- */
193
- public function premium_tab() {
194
- $premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->_premium;
195
- if ( file_exists( $premium_tab_template ) ) {
196
- include_once( $premium_tab_template );
197
- }
198
-
199
- }
200
-
201
- /**
202
- * plugin_row_meta
203
- *
204
- * add the action links to plugin admin page
205
- *
206
- * @param $plugin_meta
207
- * @param $plugin_file
208
- * @param $plugin_data
209
- * @param $status
210
- *
211
- * @return Array
212
- * @since 1.0
213
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
214
- * @use plugin_row_meta
215
- */
216
- public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
217
-
218
- if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT == $plugin_file ) {
219
- $new_row_meta_args['slug'] = YITH_WOOCOMPARE_SLUG;
220
-
221
- if( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ){
222
- $new_row_meta_args['is_premium'] = true;
223
- }
224
- }
225
-
226
- return $new_row_meta_args;
227
- }
228
-
229
- /**
230
- * Register Pointer
231
- */
232
- public function register_pointer(){
233
-
234
- if( ! class_exists( 'YIT_Pointers' ) ){
235
- include_once( 'plugin-fw/lib/yit-pointers.php' );
236
- }
237
-
238
- $args[] = array(
239
- 'screen_id' => 'plugins',
240
- 'pointer_id' => 'yith_woocompare_panel',
241
- 'target' => '#toplevel_page_yit_plugin_panel',
242
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
243
- __( 'YITH WooCommerce Compare Activated', 'yith-woocommerce-compare' ),
244
- apply_filters( 'yith_woocompare_activated_pointer_content', sprintf( __( 'In the YIT Plugin tab you can find the YITH WooCommerce Compare options. With this menu, you can access to all the settings of our plugins that you have activated. YITH WooCommerce Compare is available in an outstanding PREMIUM version with many new options, <a href="%s">discover it now</a>.', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
245
- ),
246
- 'position' => array( 'edge' => 'left', 'align' => 'center' ),
247
- 'init' => YITH_WOOCOMPARE_INIT
248
- );
249
-
250
- $args[] = array(
251
- 'screen_id' => 'update',
252
- 'pointer_id' => 'yith_woocompare_panel',
253
- 'target' => '#toplevel_page_yit_plugin_panel',
254
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
255
- __( 'YITH WooCommerce Compare Updated', 'yith-woocommerce-compare' ),
256
- apply_filters( 'yith_woocompare_updated_pointer_content', sprintf( __( 'From now on, you can find all the options of YITH WooCommerce Compare under YIT Plugin -> Compare instead of WooCommerce -> Settings -> Compare, as in the previous version. When one of our plugins is updated, a new voice will be added to this menu. YITH WooCommerce Compare has been updated with new available options, <a href="%s">discover the PREMIUM version.</a>', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
257
- ),
258
- 'position' => array( 'edge' => 'left', 'align' => 'center' ),
259
- 'init' => YITH_WOOCOMPARE_INIT
260
- );
261
-
262
- YIT_Pointers()->register( $args );
263
- }
264
-
265
- /**
266
- * Get the premium landing uri
267
- *
268
- * @since 1.0.0
269
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
270
- * @return string The premium landing link
271
- */
272
- public function get_premium_landing_uri() {
273
- return $this->_premium_landing;
274
- }
275
-
276
- /**
277
- * Default options
278
- *
279
- * Sets up the default options used on the settings page
280
- *
281
- * @access protected
282
- * @return void
283
- * @since 1.0.0
284
- */
285
- protected function _default_options() {
286
-
287
- foreach ( $this->options as $section ) {
288
-
289
- foreach ( $section as $value ) {
290
-
291
- if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
292
-
293
- if ( $value['type'] == 'image_width' ) {
294
- add_option( $value['id'], $value['std'] );
295
- } elseif ( $value['type'] == 'woocompare_attributes' ) {
296
-
297
- $value_id = str_replace( '_attrs', '', $value['id'] );
298
-
299
- $in_db = get_option( $value_id );
300
- $in_db_original = get_option( $value['id'] );
301
-
302
- // if options is already in db and not reset defaults continue
303
- if ( $in_db && $in_db_original != 'all' ) {
304
- continue;
305
- }
306
-
307
- if ( $value['default'] == 'all' ) {
308
- $fields = YITH_Woocompare_Helper::standard_fields();
309
- $all = array();
310
-
311
- foreach ( array_keys( $fields ) as $field ) {
312
- $all[ $field ] = true;
313
- }
314
-
315
- update_option( $value_id, $all );
316
- } else {
317
- update_option( $value_id, $value['std'] );
318
- }
319
- }
320
- }
321
- }
322
- }
323
- }
324
-
325
- /**
326
- * Create new Woocommerce admin field: checkboxes
327
- *
328
- * @access public
329
- * @param array $value
330
- * @return void
331
- * @since 1.0.0
332
- */
333
- public function admin_fields_attributes( $value ) {
334
- $fields = YITH_Woocompare_Helper::standard_fields();
335
- $all = array();
336
- $checked = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
337
-
338
- foreach ( array_keys( $fields ) as $field ) {
339
- $all[ $field ] = true;
340
- }
341
- // then add fields that are not still saved
342
- foreach ( $checked as $k => $v ) {
343
- unset( $all[ $k ] );
344
- }
345
- $checkboxes = array_merge( $checked, $all );
346
-
347
-
348
- ?>
349
- <tr valign="top">
350
- <th scope="row" class="titledesc">
351
- <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
352
- </th>
353
-
354
- <td class="forminp attributes">
355
- <p class="description"><?php echo wp_kses_post( $value['desc'] ); ?></p>
356
- <ul class="fields">
357
- <?php foreach ( $checkboxes as $slug => $checked ) :
358
- if( ! isset( $fields[ $slug ] ) )
359
- continue;
360
- ?>
361
- <li>
362
- <label>
363
- <input type="checkbox" name="<?php echo esc_attr( $value['id'] ); ?>[]" id="<?php echo esc_attr( $value['id'] ); ?>_<?php echo esc_attr( $slug ); ?>" value="<?php echo esc_html( $slug ); ?>"<?php checked( $checked ) ?> /> <?php echo esc_html( $fields[ $slug ]); ?>
364
- </label>
365
- </li>
366
- <?php
367
- endforeach;
368
- ?>
369
- </ul>
370
- <input type="hidden" name="<?php echo esc_attr( $value['id'] ); ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
371
- </td>
372
- </tr>
373
- <?php
374
- }
375
-
376
- /**
377
- * Create new Woocommerce admin field: yit_wc_image_width
378
- *
379
- * @access public
380
- * @param array $value
381
- * @return void
382
- * @since 1.0.0
383
- */
384
- public function admin_fields_woocompare_image_width( $value ) {
385
-
386
- $width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
387
- $height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
388
- $crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
389
- $crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
390
- $crop = checked( 1, $crop, false );
391
-
392
- ?>
393
- <tr valign="top">
394
- <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
395
- <td class="forminp image_width_settings">
396
-
397
- <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo esc_attr( $width ); ?>" /> &times;
398
- <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo esc_attr( $height ); ?>" />px
399
-
400
- <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo esc_html( $crop ); ?> /> <?php esc_html_e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
401
- </label>
402
- <p class="description"><?php echo esc_html( $value['desc'] ); ?></p>
403
-
404
- </td>
405
- </tr><?php
406
-
407
- }
408
-
409
- /**
410
- * Save the admin field: slider
411
- *
412
- * @access public
413
- * @param mixed $value
414
- * @param mixed $option
415
- * @param mixed $raw_value
416
- * @return mixed
417
- * @since 1.0.0
418
- */
419
- public function admin_update_custom_option( $value, $option, $raw_value ) {
420
-
421
- $val = array();
422
- $checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( $_POST[ $option['id'] ] ) : array();
423
- $fields = array_map( 'trim', explode( ',', $_POST[ $option['id'] . '_positions' ] ) );
424
-
425
- foreach ( $fields as $field ) {
426
- $val[ $field ] = in_array( $field, $checked_fields );
427
- }
428
-
429
- update_option( str_replace( '_attrs', '', $option['id'] ), $val );
430
-
431
- return $value;
432
- }
433
-
434
- /**
435
- * Save the admin field: slider
436
- *
437
- * @access public
438
- * @param mixed $value
439
- * @return void
440
- * @since 1.0.0
441
- */
442
- public function admin_update_custom_option_pre_24( $value ) {
443
-
444
- $val = array();
445
- $checked_fields = isset( $_POST[ $value['id'] ] ) ? $_POST[ $value['id'] ] : array();
446
- $fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
447
-
448
- foreach ( $fields as $field ) {
449
- $val[ $field ] = in_array( $field, $checked_fields );
450
- }
451
-
452
- update_option( str_replace( '_attrs', '', $value['id'] ), $val );
453
- }
454
-
455
- /**
456
- * Enqueue admin styles and scripts
457
- *
458
- * @access public
459
- * @return void
460
- * @since 1.0.0
461
- */
462
- public function enqueue_styles_scripts() {
463
-
464
- $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
465
-
466
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'yith_woocompare_panel' ) {
467
- wp_enqueue_script( 'jquery-ui' );
468
- wp_enqueue_script( 'jquery-ui-core' );
469
- wp_enqueue_script( 'jquery-ui-mouse' );
470
- wp_enqueue_script( 'jquery-ui-slider' );
471
- wp_enqueue_script( 'jquery-ui-sortable' );
472
-
473
- wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css' );
474
- wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin'.$min.'.js', array( 'jquery', 'jquery-ui-sortable' ) );
475
- }
476
-
477
- do_action( 'yith_woocompare_enqueue_styles_scripts' );
478
- }
479
- }
480
- }
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Compare
7
+ * @version 2.0.0
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
13
+ /**
14
+ * Admin class.
15
+ * The class manage all the admin behaviors.
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ class YITH_Woocompare_Admin {
20
+
21
+ /**
22
+ * Plugin options
23
+ *
24
+ * @since 1.0.0
25
+ * @var array
26
+ * @access public
27
+ */
28
+ public $options = array();
29
+
30
+ /**
31
+ * Plugin version
32
+ *
33
+ * @since 1.0.0
34
+ * @var string
35
+ */
36
+ public $version = YITH_WOOCOMPARE_VERSION;
37
+
38
+ /**
39
+ * Panel Object
40
+ *
41
+ * @var YIT_Plugin_Panel_WooCommerce
42
+ */
43
+ protected $panel;
44
+
45
+ /**
46
+ * Premium tab template file name
47
+ *
48
+ * @var string
49
+ */
50
+ protected $premium = 'premium.php';
51
+
52
+ /**
53
+ * Premium version landing link
54
+ *
55
+ * @var string
56
+ */
57
+ protected $premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-compare';
58
+
59
+ /**
60
+ * Compare panel page
61
+ *
62
+ * @var string
63
+ */
64
+ protected $panel_page = 'yith_woocompare_panel';
65
+
66
+ /**
67
+ * Various links
68
+ *
69
+ * @since 1.0.0
70
+ * @var string
71
+ * @access public
72
+ */
73
+ public $doc_url = 'http://yithemes.com/docs-plugins/yith-woocommerce-compare/';
74
+
75
+ /**
76
+ * Constructor
77
+ *
78
+ * @access public
79
+ * @since 1.0.0
80
+ */
81
+ public function __construct() {
82
+
83
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
84
+
85
+ // Add action links.
86
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_WOOCOMPARE_DIR . '/' . basename( YITH_WOOCOMPARE_FILE ) ), array( $this, 'action_links' ) );
87
+ add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
88
+
89
+ add_action( 'yith_woocompare_premium', array( $this, 'premium_tab' ) );
90
+
91
+ add_action( 'admin_init', array( $this, 'default_options' ), 99 );
92
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 20 );
93
+
94
+ add_action( 'woocommerce_admin_field_woocompare_image_width', array( $this, 'admin_fields_woocompare_image_width' ) );
95
+ add_action( 'woocommerce_admin_field_woocompare_attributes', array( $this, 'admin_fields_attributes' ), 10, 1 );
96
+ add_filter( 'woocommerce_admin_settings_sanitize_option_yith_woocompare_fields_attrs', array( $this, 'admin_update_custom_option' ), 10, 3 );
97
+
98
+ // YITH WCWL Loaded.
99
+ do_action( 'yith_woocompare_loaded' );
100
+ }
101
+
102
+ /**
103
+ * Action Links: add the action links to plugin admin page
104
+ *
105
+ * @since 1.0
106
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
107
+ * @param array $links Links plugin array.
108
+ * @return mixed
109
+ * @use plugin_action_links_{$plugin_file_name}
110
+ */
111
+ public function action_links( $links ) {
112
+
113
+ $links[] = '<a href="' . admin_url( "admin.php?page={$this->panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
114
+ if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) {
115
+ $links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '" target="_blank">' . __( 'License', 'yith-woocommerce-compare' ) . '</a>';
116
+ }
117
+
118
+ return $links;
119
+ }
120
+
121
+ /**
122
+ * Add a panel under YITH Plugins tab
123
+ *
124
+ * @since 1.0
125
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
126
+ * @use /Yit_Plugin_Panel class
127
+ * @return void
128
+ * @see plugin-fw/lib/yit-plugin-panel.php
129
+ */
130
+ public function register_panel() {
131
+
132
+ if ( ! empty( $this->panel ) ) {
133
+ return;
134
+ }
135
+
136
+ $admin_tabs = array(
137
+ 'general' => __( 'Settings', 'yith-woocommerce-compare' ),
138
+ );
139
+
140
+ if ( ! ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) ) {
141
+ $admin_tabs['premium'] = __( 'Premium Version', 'yith-woocommerce-compare' );
142
+ }
143
+
144
+ $args = array(
145
+ 'create_menu_page' => true,
146
+ 'parent_slug' => '',
147
+ 'page_title' => _x( 'WooCommerce Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
148
+ 'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
149
+ 'capability' => 'manage_options',
150
+ 'parent' => '',
151
+ 'parent_page' => 'yith_plugin_panel',
152
+ 'page' => $this->panel_page,
153
+ 'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
154
+ 'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options',
155
+ 'class' => yith_set_wrapper_class(),
156
+ 'plugin_slug' => YITH_WOOCOMPARE_SLUG,
157
+ );
158
+
159
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
160
+ require_once YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php';
161
+ }
162
+
163
+ $this->panel = new YIT_Plugin_Panel_WooCommerce( $args );
164
+ $this->options = $this->panel->get_main_array_options();
165
+ }
166
+
167
+ /**
168
+ * Set default custom options
169
+ *
170
+ * @since 1.0.0
171
+ * @author Francesco Licandro
172
+ */
173
+ public function default_options() {
174
+ foreach ( $this->options as $section ) {
175
+
176
+ foreach ( $section as $value ) {
177
+
178
+ if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
179
+
180
+ if ( 'image_width' === $value['type'] ) {
181
+ add_option( $value['id'], $value['std'] );
182
+ } elseif ( 'woocompare_attributes' === $value['type'] ) {
183
+
184
+ $value_id = str_replace( '_attrs', '', $value['id'] );
185
+
186
+ $in_db = get_option( $value_id );
187
+ $in_db_original = get_option( $value['id'] );
188
+
189
+ // If options is already in db and not reset defaults continue.
190
+ if ( $in_db && 'all' !== $in_db_original ) {
191
+ continue;
192
+ }
193
+
194
+ if ( 'all' === $value['default'] ) {
195
+ $fields = YITH_Woocompare_Helper::standard_fields();
196
+ $all = array();
197
+
198
+ foreach ( array_keys( $fields ) as $field ) {
199
+ $all[ $field ] = true;
200
+ }
201
+
202
+ update_option( $value_id, $all );
203
+ } else {
204
+ update_option( $value_id, $value['std'] );
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Premium Tab Template
214
+ * Load the premium tab template on admin page
215
+ *
216
+ * @since 1.0
217
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
218
+ * @return void
219
+ */
220
+ public function premium_tab() {
221
+ $premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->premium;
222
+ if ( file_exists( $premium_tab_template ) ) {
223
+ include_once $premium_tab_template;
224
+ }
225
+
226
+ }
227
+
228
+ /**
229
+ * Add the action links to plugin admin page
230
+ *
231
+ * @since 1.0
232
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
233
+ * @param array $new_row_meta_args An array of plugin row meta.
234
+ * @param string[] $plugin_meta An array of the plugin's metadata, including the version, author, author URI, and plugin URI.
235
+ * @param string $plugin_file Path to the plugin file relative to the plugins directory.
236
+ * @param array $plugin_data An array of plugin data.
237
+ * @param string $status Status of the plugin. Defaults are 'All', 'Active',
238
+ * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
239
+ * 'Drop-ins', 'Search', 'Paused'.
240
+ * @return array
241
+ */
242
+ public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
243
+
244
+ if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT === $plugin_file ) {
245
+ $new_row_meta_args['slug'] = YITH_WOOCOMPARE_SLUG;
246
+
247
+ if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ) {
248
+ $new_row_meta_args['is_premium'] = true;
249
+ }
250
+ }
251
+
252
+ return $new_row_meta_args;
253
+ }
254
+
255
+ /**
256
+ * Register Pointer
257
+ *
258
+ * @since 1.0.0
259
+ * @author Francesco Licandro
260
+ * @deprecated
261
+ */
262
+ public function register_pointer() {
263
+ return false;
264
+ }
265
+
266
+ /**
267
+ * Get the premium landing uri
268
+ *
269
+ * @since 1.0.0
270
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
271
+ * @return string The premium landing link
272
+ */
273
+ public function get_premium_landing_uri() {
274
+ return $this->premium_landing;
275
+ }
276
+
277
+ /**
278
+ * Create new Woocommerce admin field: checkboxes
279
+ *
280
+ * @access public
281
+ * @since 1.0.0
282
+ * @param array $value The field value.
283
+ * @return void
284
+ */
285
+ public function admin_fields_attributes( $value ) {
286
+ $fields = YITH_Woocompare_Helper::standard_fields();
287
+ $all = array();
288
+ $checked = get_option( str_replace( '_attrs', '', $value['id'] ), 'all' === $value['default'] ? $all : array() );
289
+
290
+ foreach ( array_keys( $fields ) as $field ) {
291
+ $all[ $field ] = true;
292
+ }
293
+ // tThen add fields that are not still saved.
294
+ foreach ( $checked as $k => $v ) {
295
+ unset( $all[ $k ] );
296
+ }
297
+ $checkboxes = array_merge( $checked, $all );
298
+
299
+ ?>
300
+ <tr valign="top">
301
+ <th scope="row" class="titledesc">
302
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
303
+ </th>
304
+
305
+ <td class="forminp attributes">
306
+ <p class="description"><?php echo wp_kses_post( $value['desc'] ); ?></p>
307
+ <ul class="fields">
308
+ <?php
309
+ foreach ( $checkboxes as $slug => $checked ) :
310
+ if ( ! isset( $fields[ $slug ] ) ) {
311
+ continue;
312
+ }
313
+ ?>
314
+ <li>
315
+ <label>
316
+ <input type="checkbox" name="<?php echo esc_attr( $value['id'] ); ?>[]" id="<?php echo esc_attr( $value['id'] ); ?>_<?php echo esc_attr( $slug ); ?>" value="<?php echo esc_html( $slug ); ?>"<?php checked( $checked ); ?> /> <?php echo esc_html( $fields[ $slug ] ); ?>
317
+ </label>
318
+ </li>
319
+ <?php
320
+ endforeach;
321
+ ?>
322
+ </ul>
323
+ <input type="hidden" name="<?php echo esc_attr( $value['id'] ); ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"/>
324
+ </td>
325
+ </tr>
326
+ <?php
327
+ }
328
+
329
+ /**
330
+ * Create new Woocommerce admin field: yit_wc_image_width
331
+ *
332
+ * @access public
333
+ * @since 1.0.0
334
+ * @param array $value Field value.
335
+ * @return void
336
+ */
337
+ public function admin_fields_woocompare_image_width( $value ) {
338
+
339
+ $width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
340
+ $height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
341
+ $crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
342
+ $crop = ( 'on' === $crop || '1' === $crop ) ? 1 : 0;
343
+ $crop = checked( 1, $crop, false );
344
+
345
+ ?>
346
+ <tr valign="top">
347
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?></th>
348
+ <td class="forminp image_width_settings">
349
+
350
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo esc_attr( $width ); ?>"/> &times;
351
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo esc_attr( $height ); ?>"/>px
352
+
353
+ <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo esc_html( $crop ); ?> /> <?php esc_html_e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
354
+ </label>
355
+ <p class="description"><?php echo esc_html( $value['desc'] ); ?></p>
356
+
357
+ </td>
358
+ </tr>
359
+ <?php
360
+
361
+ }
362
+
363
+ /**
364
+ * Save the admin field: slider
365
+ *
366
+ * @access public
367
+ * @since 1.0.0
368
+ * @param mixed $value The option value.
369
+ * @param mixed $option The options array.
370
+ * @param mixed $raw_value The option raw value.
371
+ * @return mixed
372
+ */
373
+ public function admin_update_custom_option( $value, $option, $raw_value ) {
374
+
375
+ $val = array();
376
+ $checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( wp_unslash( $_POST[ $option['id'] ] ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
377
+ $fields = isset( $_POST[ $option['id'] . '_positions' ] ) ? array_map( 'wc_clean', explode( ',', wp_unslash( $_POST[ $option['id'] . '_positions' ] ) ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
378
+
379
+ foreach ( $fields as $field ) {
380
+ $val[ $field ] = in_array( $field, $checked_fields, true );
381
+ }
382
+
383
+ update_option( str_replace( '_attrs', '', $option['id'] ), $val );
384
+
385
+ return $value;
386
+ }
387
+
388
+ /**
389
+ * Enqueue admin styles and scripts
390
+ *
391
+ * @access public
392
+ * @since 1.0.0
393
+ * @return void
394
+ */
395
+ public function enqueue_styles_scripts() {
396
+
397
+ $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
398
+
399
+ if ( isset( $_GET['page'] ) && sanitize_text_field( wp_unslash( $_GET['page'] ) ) === $this->panel_page ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
400
+ wp_enqueue_script( 'jquery-ui' );
401
+ wp_enqueue_script( 'jquery-ui-core' );
402
+ wp_enqueue_script( 'jquery-ui-mouse' );
403
+ wp_enqueue_script( 'jquery-ui-slider' );
404
+ wp_enqueue_script( 'jquery-ui-sortable' );
405
+
406
+ wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css', array(), YITH_WOOCOMPARE_VERSION );
407
+ wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin' . $min . '.js', array( 'jquery', 'jquery-ui-sortable' ), YITH_WOOCOMPARE_VERSION, true );
408
+ }
409
+
410
+ do_action( 'yith_woocompare_enqueue_styles_scripts' );
411
+ }
412
+ }
413
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class.yith-woocompare-frontend.php CHANGED
@@ -1,822 +1,902 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author YITH
6
- * @package YITH Woocommerce Compare
7
- * @version 1.1.4
8
- */
9
-
10
- if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
11
-
12
- if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
13
- /**
14
- * YITH Custom Login Frontend
15
- *
16
- * @since 1.0.0
17
- */
18
- class YITH_Woocompare_Frontend {
19
- /**
20
- * Plugin version
21
- *
22
- * @var string
23
- * @since 1.0.0
24
- */
25
- public $version = YITH_WOOCOMPARE_VERSION;
26
-
27
- /**
28
- * The list of products inside the comparison table
29
- *
30
- * @var array
31
- * @since 1.0.0
32
- */
33
- public $products_list = array();
34
-
35
- /**
36
- * Plugin version
37
- *
38
- * @var string
39
- * @since 1.0.0
40
- */
41
- public $template_file = 'compare.php';
42
-
43
- /**
44
- * Stylesheet file
45
- *
46
- * @var string
47
- * @since 2.1.0
48
- */
49
- public $stylesheet_file = 'compare.css';
50
-
51
- /**
52
- * The name of cookie name
53
- *
54
- * @var string
55
- * @since 1.0.0
56
- */
57
- public $cookie_name = 'yith_woocompare_list';
58
-
59
- /**
60
- * The action used to view the table comparison
61
- *
62
- * @var string
63
- * @since 1.0.0
64
- */
65
- public $action_view = 'yith-woocompare-view-table';
66
-
67
- /**
68
- * The action used to add the product to compare list
69
- *
70
- * @var string
71
- * @since 1.0.0
72
- */
73
- public $action_add = 'yith-woocompare-add-product';
74
-
75
- /**
76
- * The action used to add the product to compare list
77
- *
78
- * @var string
79
- * @since 1.0.0
80
- */
81
- public $action_remove = 'yith-woocompare-remove-product';
82
-
83
- /**
84
- * The action used to reload the compare list widget
85
- *
86
- * @var string
87
- * @since 1.0.0
88
- */
89
- public $action_reload = 'yith-woocompare-reload-product';
90
-
91
- /**
92
- * The standard fields
93
- *
94
- * @var array
95
- * @since 1.0.0
96
- */
97
- public $default_fields = array();
98
-
99
- /**
100
- * Constructor
101
- *
102
- * @return YITH_Woocompare_Frontend
103
- * @since 1.0.0
104
- */
105
- public function __construct() {
106
-
107
-
108
- add_action( 'init', array( $this, 'init_variables' ), 1 );
109
- add_action( 'init', array( $this, 'populate_products_list' ), 10 );
110
-
111
- // Add link or button in the products list or
112
- if ( get_option( 'yith_woocompare_compare_button_in_product_page', 'yes' ) == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
113
- if ( get_option( 'yith_woocompare_compare_button_in_products_list', 'no' ) == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
114
- add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
115
- add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
116
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
117
- add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
118
-
119
- // add the shortcode
120
- add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
121
-
122
- // AJAX
123
- if( version_compare( WC()->version, '2.4', '>=' ) ){
124
- add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
125
- add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
126
- add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
127
- }
128
- else {
129
- add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
130
- add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
131
- add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
132
- }
133
- // no priv
134
- add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
135
- add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
136
- add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
137
-
138
- return $this;
139
- }
140
-
141
- /**
142
- * Init class variables
143
- *
144
- * @since 2.3.4
145
- * @author Francesco Licandro
146
- */
147
- public function init_variables(){
148
- global $sitepress;
149
-
150
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
151
-
152
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
153
- $sitepress->switch_lang( $lang, true );
154
- }
155
-
156
- // set coookiename
157
- if ( is_multisite() ) $this->cookie_name .= '_' . get_current_blog_id();
158
-
159
- // populate default fields for the comparison table
160
- $this->default_fields = YITH_Woocompare_Helper::standard_fields();
161
- }
162
-
163
- /**
164
- * Populate the compare product list
165
- */
166
- public function populate_products_list(){
167
-
168
- global $sitepress;
169
-
170
- /**
171
- * WPML Support
172
- */
173
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
174
-
175
- // get cookie val
176
- $the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
177
-
178
- // switch lang for WPML
179
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
180
- $sitepress->switch_lang( $lang, true );
181
- }
182
-
183
- foreach( $the_list as $product_id ) {
184
- if( function_exists( 'wpml_object_id_filter' ) ) {
185
- $product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
186
- // get all product of current lang
187
- if ( $product_id_translated !== $product_id ) {
188
- continue;
189
- }
190
- }
191
-
192
- // check for deleted|private products
193
- $product = wc_get_product( $product_id );
194
- if( ! $product || yit_get_prop( $product, 'post_status' ) !== 'publish' ) {
195
- continue;
196
- }
197
-
198
- $this->products_list[] = $product_id;
199
- }
200
-
201
- do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
202
- }
203
-
204
- /**
205
- * Enqueue the scripts and styles in the page
206
- */
207
- public function enqueue_scripts() {
208
-
209
- // scripts
210
- $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
211
- wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min .'.js', array('jquery'), $this->version, true );
212
-
213
- // enqueue and add localize
214
- wp_enqueue_script( 'yith-woocompare-main' );
215
-
216
- // localize script args
217
- $args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
218
- 'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
219
- 'actionadd' => $this->action_add,
220
- 'actionremove' => $this->action_remove,
221
- 'actionview' => $this->action_view,
222
- 'actionreload' => $this->action_reload,
223
- 'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
224
- 'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
225
- 'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
226
- 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
227
- 'button_text' => get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) ),
228
- 'cookie_name' => $this->cookie_name,
229
- 'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' )
230
- ));
231
-
232
- wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
233
-
234
- // colorbox
235
- wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
236
- wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
237
-
238
- // widget
239
- if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
240
- wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css' );
241
- }
242
- }
243
-
244
- /**
245
- * The fields to show in the table
246
- *
247
- * @param array $products
248
- * @return mixed|void
249
- * @since 1.0.0
250
- */
251
- public function fields( $products = array() ) {
252
-
253
- $fields = get_option( 'yith_woocompare_fields', array() );
254
-
255
- foreach ( $fields as $field => $show ) {
256
- if ( $show ) {
257
- if ( isset( $this->default_fields[$field] ) ) {
258
- $fields[$field] = $this->default_fields[$field];
259
- }
260
- else {
261
- if ( taxonomy_exists( $field ) ) {
262
- $fields[$field] = wc_attribute_label( $field );
263
- }
264
- }
265
- }
266
- else {
267
- unset( $fields[$field] );
268
- }
269
- }
270
-
271
- return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
272
- }
273
-
274
- /**
275
- * Render the maintenance page
276
- *
277
- */
278
- public function compare_table_html() {
279
-
280
- if ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_view ) ) return;
281
-
282
- // check if is add to cart
283
- if( isset( $_REQUEST['add-to-cart'] ) ) {
284
- $product_id = intval( $_REQUEST['add-to-cart'] );
285
-
286
- wp_redirect( get_permalink( $product_id ) );
287
- exit;
288
- }
289
-
290
- global $woocommerce, $sitepress;
291
-
292
- /**
293
- * WPML Suppot: Localize Ajax Call
294
- */
295
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
296
-
297
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
298
- $sitepress->switch_lang( $lang, true );
299
- }
300
-
301
- $args = $this->_vars();
302
- $args['fixed'] = false;
303
- $args['iframe'] = 'yes';
304
-
305
- //extract args
306
- extract( $args );
307
-
308
- // remove all styles from compare template
309
- add_action('wp_print_styles', array( $this, 'remove_all_styles' ), 100);
310
-
311
- // remove admin bar
312
- remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
313
- remove_action( 'wp_head', '_admin_bar_bump_cb' );
314
-
315
- // remove filters before render compare popup
316
- add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
317
-
318
- $plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
319
-
320
- if ( defined('WC_TEMPLATE_PATH') ) {
321
-
322
- $template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
323
- $child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
324
- }
325
- else {
326
- $template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
327
- $child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
328
- }
329
-
330
- foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
331
- if ( file_exists( ${$var} ) ) {
332
- include ${$var};
333
- exit();
334
- }
335
- }
336
- }
337
-
338
- /**
339
- * Return the array with all products and all attributes values
340
- *
341
- * @param mixed $products
342
- * @return array The complete list of products with all attributes value
343
- */
344
- public function get_products_list( $products = array() ) {
345
- $list = array();
346
-
347
- empty( $products ) && $products = $this->products_list;
348
- $products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
349
-
350
- $fields = $this->fields( $products );
351
-
352
- foreach ( $products as $product_id ) {
353
-
354
- /**
355
- * @type object $product /WC_Product
356
- */
357
- $product = $this->wc_get_product( $product_id );
358
-
359
- if ( ! $product )
360
- continue;
361
-
362
- $product->fields = array();
363
-
364
- // custom attributes
365
- foreach ( $fields as $field => $name ) {
366
-
367
- switch( $field ) {
368
- case 'title':
369
- $product->fields[$field] = $product->get_title();
370
- break;
371
- case 'price':
372
- $product->fields[$field] = $product->get_price_html();
373
- break;
374
- case 'image':
375
- $product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
376
- break;
377
- case 'description':
378
- $description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
379
- $product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
380
- break;
381
- case 'stock':
382
- $availability = $product->get_availability();
383
- if ( empty( $availability['availability'] ) ) {
384
- $availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
385
- }
386
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
387
- break;
388
- case 'sku':
389
- $sku = $product->get_sku();
390
- ! $sku && $sku = '-';
391
- $product->fields[$field] = $sku;
392
- break;
393
- case 'weight':
394
- if( $weight = $product->get_weight() ){
395
- $weight = wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) );
396
- }
397
- else {
398
- $weight = '-';
399
- }
400
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
401
- break;
402
- case 'dimensions':
403
- $dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
404
- ! $dimensions && $dimensions = '-';
405
-
406
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
407
- break;
408
- default:
409
- if ( taxonomy_exists( $field ) ) {
410
- $product->fields[$field] = array();
411
- $terms = get_the_terms( $product_id, $field );
412
- if ( ! empty( $terms ) ) {
413
- foreach ( $terms as $term ) {
414
- $term = sanitize_term( $term, $field );
415
- $product->fields[$field][] = $term->name;
416
- }
417
- }
418
- $product->fields[$field] = implode( ', ', $product->fields[$field] );
419
- }
420
- else {
421
- do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
422
- }
423
- break;
424
- }
425
- }
426
-
427
- $list[ $product_id ] = $product;
428
- }
429
-
430
- return $list;
431
- }
432
-
433
- /**
434
- * The URL of product comparison table
435
- *
436
- * @param bool | int $product_id
437
- * @return string The url to add the product in the comparison table
438
- */
439
- public function view_table_url( $product_id = false ) {
440
- $url_args = array(
441
- 'action' => $this->action_view,
442
- 'iframe' => 'yes'
443
- );
444
-
445
- $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
446
- if( $lang ) {
447
- $url_args['lang'] = $lang;
448
- }
449
- // fix by WPML
450
- return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, remove_query_arg( 'wc-ajax' ) ) ), $product_id );
451
- }
452
-
453
- /**
454
- * The URL to add the product into the comparison table
455
- *
456
- * @param int $product_id ID of the product to add
457
- * @return string The url to add the product in the comparison table
458
- */
459
- public function add_product_url( $product_id ) {
460
- $url_args = array(
461
- 'action' => $this->action_add,
462
- 'id' => $product_id
463
- );
464
-
465
- $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
466
- if( $lang ) {
467
- $url_args['lang'] = $lang;
468
- }
469
-
470
- return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
471
- }
472
-
473
- /**
474
- * The URL to remove the product into the comparison table
475
- *
476
- * @param string $product_id The ID of the product to remove
477
- * @return string The url to remove the product in the comparison table
478
- */
479
- public function remove_product_url( $product_id ) {
480
- $url_args = array(
481
- 'action' => $this->action_remove,
482
- 'id' => $product_id
483
- );
484
- return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
485
- }
486
-
487
- /**
488
- * Add the link to compare
489
- */
490
- public function add_compare_link( $product_id = false, $args = array() ) {
491
- extract( $args );
492
-
493
- if ( ! $product_id ) {
494
- global $product;
495
- $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
496
- }
497
-
498
- // return if product doesn't exist
499
- if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) )
500
- return;
501
-
502
- $is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button', 'button' ) : $button_or_link;
503
-
504
- if ( ! isset( $button_text ) || $button_text == 'default' ) {
505
- $button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
506
- do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
507
- $button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
508
- }
509
-
510
- printf( '<a href="%s" class="%s" data-product_id="%d" rel="nofollow">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( $is_button == 'button' ? ' button' : '' ), $product_id, $button_text ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
511
- }
512
-
513
- /**
514
- * Return the url of stylesheet position
515
- */
516
- public function stylesheet_url() {
517
- global $woocommerce;
518
-
519
- $filename = $this->stylesheet_file;
520
-
521
- $plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
522
-
523
- if ( defined('WC_TEMPLATE_PATH') ) {
524
- $template_path = array( 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
525
- $child_path = array( 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
526
- }
527
- else {
528
- $template_path = array( 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename );
529
- $child_path = array( 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename );
530
- }
531
-
532
- foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
533
- if ( file_exists( ${$var}['path'] ) ) {
534
- return ${$var}['url'];
535
- }
536
- }
537
- }
538
-
539
-
540
- /**
541
- * Generate template vars
542
- *
543
- * @return array
544
- * @since 1.0.0
545
- * @access protected
546
- */
547
- protected function _vars() {
548
- $vars = array(
549
- 'products' => $this->get_products_list(),
550
- 'fields' => $this->fields(),
551
- 'repeat_price' => get_option( 'yith_woocompare_price_end', 'yes' ),
552
- 'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end', 'no' ),
553
- );
554
-
555
- return $vars;
556
- }
557
-
558
- /**
559
- * The action called by the query string
560
- */
561
- public function add_product_to_compare_action() {
562
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ) {
563
- return;
564
- }
565
-
566
- $product_id = intval( $_REQUEST['id'] );
567
- $product = $this->wc_get_product( $product_id );
568
-
569
- // don't add the product if doesn't exist
570
- if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
571
- $this->add_product_to_compare( $product_id );
572
- }
573
-
574
- wp_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
575
- exit();
576
- }
577
-
578
- /**
579
- * The action called by AJAX
580
- */
581
- public function add_product_to_compare_ajax() {
582
-
583
- if( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ){
584
- die();
585
- }
586
-
587
- $product_id = intval( $_REQUEST['id'] );
588
- $product = $this->wc_get_product( $product_id );
589
-
590
- // don't add the product if doesn't exist
591
- if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
592
- $this->add_product_to_compare( $product_id );
593
- }
594
-
595
- do_action( 'yith_woocompare_add_product_action_ajax' );
596
-
597
- $json = apply_filters( 'yith_woocompare_add_product_action_json', array(
598
- 'table_url' => $this->view_table_url( $product_id ),
599
- 'widget_table' => $this->list_products_html(),
600
- ) );
601
-
602
- echo json_encode( $json );
603
- die();
604
- }
605
-
606
- /**
607
- * Add a product in the products comparison table
608
- *
609
- * @param int $product_id product ID to add in the comparison table
610
- */
611
- public function add_product_to_compare( $product_id ) {
612
-
613
- $this->products_list[] = $product_id;
614
- setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
615
-
616
- do_action( 'yith_woocompare_after_add_product', $product_id );
617
- }
618
-
619
- /**
620
- * The action called by the query string
621
- */
622
- public function remove_product_from_compare_action() {
623
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ) {
624
- return;
625
- }
626
-
627
- $this->remove_product_from_compare( $_REQUEST['id'] );
628
-
629
- // redirect
630
- $redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
631
-
632
- if ( isset( $_REQUEST['redirect'] ) && $_REQUEST['redirect'] == 'view' )
633
- $redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
634
-
635
- wp_redirect( $redirect );
636
- exit();
637
- }
638
-
639
- /**
640
- * The action called by AJAX
641
- */
642
- public function remove_product_from_compare_ajax() {
643
-
644
- if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ){
645
- die();
646
- }
647
-
648
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
649
-
650
- $this->remove_product_from_compare( $_REQUEST['id'] );
651
-
652
- do_action( 'yith_woocompare_remove_product_action_ajax' );
653
-
654
- header('Content-Type: text/html; charset=utf-8');
655
-
656
- if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
657
- echo wp_kses_post( $this->list_products_html( $lang ) );
658
- } else {
659
- $this->compare_table_html();
660
- }
661
-
662
- die();
663
- }
664
-
665
- /**
666
- * Return the list of widget table, used in AJAX
667
- */
668
- public function reload_widget_list_ajax() {
669
-
670
- if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
671
- die();
672
- }
673
-
674
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
675
-
676
- echo wp_kses_post( $this->list_products_html( $lang ) );
677
- die();
678
- }
679
-
680
- /**
681
- * The list of products as HTML list
682
- */
683
- public function list_products_html( $lang = false ) {
684
- ob_start();
685
-
686
- /**
687
- * WPML Suppot: Localize Ajax Call
688
- */
689
- global $sitepress;
690
-
691
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
692
- $sitepress->switch_lang( $lang, true );
693
- }
694
-
695
- if ( empty( $this->products_list ) ) {
696
- echo '<li class="list_empty">' . esc_html__( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
697
- return ob_get_clean();
698
- }
699
-
700
- foreach ( $this->products_list as $product_id ) {
701
- /**
702
- * @type object $product /WC_Product
703
- */
704
- $product = $this->wc_get_product( $product_id );
705
- if ( ! $product )
706
- continue;
707
- ?>
708
- <li>
709
- <a href="<?php echo esc_attr( $this->remove_product_url( $product_id ) ); ?>" data-product_id="<?php echo esc_attr( $product_id ); ?>" class="remove" title="<?php esc_html_e( 'Remove', 'yith-woocommerce-compare' ) ?>">x</a>
710
- <a class="title" href="<?php echo esc_attr( get_permalink( $product_id ) ); ?>"><?php echo esc_html( $product->get_title() ) ?></a>
711
- </li>
712
- <?php
713
- }
714
-
715
- $return = ob_get_clean();
716
-
717
- return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
718
- }
719
-
720
- /**
721
- * Remove a product from the comparison table
722
- *
723
- * @param $product_id The product ID to remove from the comparison table
724
- */
725
- public function remove_product_from_compare( $product_id ) {
726
-
727
- if( $product_id == 'all' ) {
728
- $this->products_list = array();
729
- }
730
- else {
731
- foreach ( $this->products_list as $k => $id ) {
732
- if ( intval( $product_id ) == $id ) {
733
- unset( $this->products_list[ $k ] );
734
- }
735
- }
736
- }
737
-
738
- setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
739
-
740
- do_action( 'yith_woocompare_after_remove_product', $product_id );
741
- }
742
-
743
- /**
744
- * Remove all styles from the compare template
745
- */
746
- public function remove_all_styles() {
747
- global $wp_styles;
748
-
749
- $wp_styles->queue = array_filter( $wp_styles->queue, function( $v ){
750
- return strpos( $v, 'yith-proteo' ) !== false;
751
- });
752
- }
753
-
754
- /**
755
- * Show the html for the shortcode
756
- */
757
- public function compare_button_sc( $atts, $content = null ) {
758
- $atts = shortcode_atts(array(
759
- 'product' => false,
760
- 'type' => 'default',
761
- 'container' => 'yes'
762
- ), $atts);
763
-
764
- $product_id = 0;
765
-
766
- /**
767
- * Retrieve the product ID in these steps:
768
- * - If "product" attribute is not set, get the product ID of current product loop
769
- * - If "product" contains ID, post slug or post title
770
- */
771
- if ( ! $atts['product'] ) {
772
- global $product;
773
- $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
774
- } else {
775
- global $wpdb;
776
- $product = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d OR post_name = %s OR post_title = %s LIMIT 1", $atts['product'], $atts['product'], $atts['product'] ) );
777
- if ( ! empty( $product ) ) {
778
- $product_id = $product->ID;
779
- }
780
- }
781
-
782
- // make sure to get always the product id of current language
783
- if( function_exists( 'wpml_object_id_filter' ) ) {
784
- $product_id = wpml_object_id_filter( $product_id, 'product', false );
785
- }
786
-
787
- // if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
788
- if ( empty( $product_id ) )
789
- return '';
790
-
791
- ob_start();
792
- if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
793
- $this->add_compare_link( $product_id, array(
794
- 'button_or_link' => ( $atts['type'] == 'default' ? false : $atts['type'] ),
795
- 'button_text' => empty( $content ) ? 'default' : $content
796
- ) );
797
- if ( $atts['container'] == 'yes' ) echo '</div>';
798
- return ob_get_clean();
799
- }
800
-
801
- public function wc_get_product( $product_id ){
802
- $wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
803
- return $wc_get_product( $product_id );
804
- }
805
-
806
-
807
- /**
808
- * Do action before loads compare popup
809
- *
810
- * @since 2.1.1
811
- * @author Francesco Licandro
812
- */
813
- public function actions_before_load_popup(){
814
- // removes WooCommerce Product Filter scripts
815
- wp_dequeue_script( 'prdctfltr-main-js' );
816
- wp_dequeue_script( 'prdctfltr-history' );
817
- wp_dequeue_script( 'prdctfltr-ionrange-js' );
818
- wp_dequeue_script( 'prdctfltr-isotope-js' );
819
- wp_dequeue_script( 'prdctfltr-scrollbar-js' );
820
- }
821
- }
822
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Frontend class
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ if ( ! class_exists( 'YITH_Woocompare_Frontend' ) ) {
13
+ /**
14
+ * YITH Custom Login Frontend
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YITH_Woocompare_Frontend {
19
+ /**
20
+ * Plugin version
21
+ *
22
+ * @since 1.0.0
23
+ * @var string
24
+ */
25
+ public $version = YITH_WOOCOMPARE_VERSION;
26
+
27
+ /**
28
+ * The list of products inside the comparison table
29
+ *
30
+ * @since 1.0.0
31
+ * @var array
32
+ */
33
+ public $products_list = array();
34
+
35
+ /**
36
+ * Plugin version
37
+ *
38
+ * @since 1.0.0
39
+ * @var string
40
+ */
41
+ public $template_file = 'compare.php';
42
+
43
+ /**
44
+ * Stylesheet file
45
+ *
46
+ * @since 2.1.0
47
+ * @var string
48
+ */
49
+ public $stylesheet_file = 'compare.css';
50
+
51
+ /**
52
+ * The name of cookie name
53
+ *
54
+ * @since 1.0.0
55
+ * @var string
56
+ */
57
+ public $cookie_name = 'yith_woocompare_list';
58
+
59
+ /**
60
+ * The action used to view the table comparison
61
+ *
62
+ * @since 1.0.0
63
+ * @var string
64
+ */
65
+ public $action_view = 'yith-woocompare-view-table';
66
+
67
+ /**
68
+ * The action used to add the product to compare list
69
+ *
70
+ * @since 1.0.0
71
+ * @var string
72
+ */
73
+ public $action_add = 'yith-woocompare-add-product';
74
+
75
+ /**
76
+ * The action used to add the product to compare list
77
+ *
78
+ * @since 1.0.0
79
+ * @var string
80
+ */
81
+ public $action_remove = 'yith-woocompare-remove-product';
82
+
83
+ /**
84
+ * The action used to reload the compare list widget
85
+ *
86
+ * @since 1.0.0
87
+ * @var string
88
+ */
89
+ public $action_reload = 'yith-woocompare-reload-product';
90
+
91
+ /**
92
+ * The standard fields
93
+ *
94
+ * @since 1.0.0
95
+ * @var array
96
+ */
97
+ public $default_fields = array();
98
+
99
+ /**
100
+ * Constructor
101
+ *
102
+ * @since 1.0.0
103
+ * @return YITH_Woocompare_Frontend
104
+ */
105
+ public function __construct() {
106
+
107
+ add_action( 'init', array( $this, 'init_variables' ), 1 );
108
+ add_action( 'init', array( $this, 'populate_products_list' ), 10 );
109
+
110
+ // Add link or button in the products list.
111
+ if ( 'yes' === get_option( 'yith_woocompare_compare_button_in_product_page', 'yes' ) ) {
112
+ add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
113
+ }
114
+ if ( 'yes' === get_option( 'yith_woocompare_compare_button_in_products_list', 'no' ) ) {
115
+ add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
116
+ }
117
+ add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
118
+ add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
119
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
120
+ add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
121
+
122
+ // Add the shortcode.
123
+ add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
124
+
125
+ // AJAX.
126
+ add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
127
+ add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
128
+ add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
129
+ // AJAX no priv.
130
+ add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
131
+ add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
132
+ add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
133
+
134
+ return $this;
135
+ }
136
+
137
+ /**
138
+ * Init class variables
139
+ *
140
+ * @since 2.3.4
141
+ * @author Francesco Licandro
142
+ */
143
+ public function init_variables() {
144
+ global $sitepress;
145
+
146
+ $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
147
+
148
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
149
+ $sitepress->switch_lang( $lang, true );
150
+ }
151
+
152
+ // Set coookiename.
153
+ if ( is_multisite() ) {
154
+ $this->cookie_name .= '_' . get_current_blog_id();
155
+ }
156
+
157
+ // Populate default fields for the comparison table.
158
+ $this->default_fields = YITH_Woocompare_Helper::standard_fields();
159
+ }
160
+
161
+ /**
162
+ * Populate the compare product list
163
+ */
164
+ public function populate_products_list() {
165
+
166
+ global $sitepress;
167
+
168
+ // WPML Support.
169
+ $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
170
+
171
+ // Get cookie val.
172
+ $the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( sanitize_text_field( wp_unslash( $_COOKIE[ $this->cookie_name ] ) ) ) : array();
173
+
174
+ // Switch lang for WPML.
175
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
176
+ $sitepress->switch_lang( $lang, true );
177
+ }
178
+
179
+ foreach ( $the_list as $product_id ) {
180
+ if ( function_exists( 'wpml_object_id_filter' ) ) {
181
+ $product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
182
+ // Get all product of current lang.
183
+ if ( $product_id_translated !== $product_id ) {
184
+ continue;
185
+ }
186
+ }
187
+
188
+ // Check for deleted|private products.
189
+ $product = wc_get_product( $product_id );
190
+ if ( ! $product || 'publish' !== $product->get_status() ) {
191
+ continue;
192
+ }
193
+
194
+ $this->products_list[] = $product_id;
195
+ }
196
+
197
+ do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
198
+ }
199
+
200
+ /**
201
+ * Enqueue the scripts and styles in the page
202
+ *
203
+ * @since 1.1.4
204
+ * @author Francesco Licandro
205
+ */
206
+ public function enqueue_scripts() {
207
+
208
+ $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
209
+ wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min . '.js', array( 'jquery' ), YITH_WOOCOMPARE_VERSION, true );
210
+ // Enqueue and add localize.
211
+ wp_enqueue_script( 'yith-woocompare-main' );
212
+
213
+ // Localize script args.
214
+ $args = apply_filters(
215
+ 'yith_woocompare_main_script_localize_array',
216
+ array(
217
+ 'ajaxurl' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
218
+ 'actionadd' => $this->action_add,
219
+ 'actionremove' => $this->action_remove,
220
+ 'actionview' => $this->action_view,
221
+ 'actionreload' => $this->action_reload,
222
+ 'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
223
+ 'table_title' => apply_filters( 'yith_woocompare_compare_table_title', __( 'Product Comparison', 'yith-woocommerce-compare' ) ),
224
+ 'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
225
+ 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
226
+ 'button_text' => get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) ),
227
+ 'cookie_name' => $this->cookie_name,
228
+ 'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' ),
229
+ )
230
+ );
231
+
232
+ wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
233
+
234
+ // Colorbox.
235
+ wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css', array(), '1.4.21' );
236
+ wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array( 'jquery' ), '1.4.21', true );
237
+
238
+ // Widget.
239
+ if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
240
+ wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css', array(), YITH_WOOCOMPARE_VERSION );
241
+ }
242
+ }
243
+
244
+ /**
245
+ * The fields to show in the table
246
+ *
247
+ * @since 1.0.0
248
+ * @param array $products An array of products.
249
+ * @return mixed|void
250
+ */
251
+ public function fields( $products = array() ) {
252
+
253
+ $fields = get_option( 'yith_woocompare_fields', array() );
254
+
255
+ foreach ( $fields as $field => $show ) {
256
+ if ( $show ) {
257
+ if ( isset( $this->default_fields[ $field ] ) ) {
258
+ $fields[ $field ] = $this->default_fields[ $field ];
259
+ } else {
260
+ if ( taxonomy_exists( $field ) ) {
261
+ $fields[ $field ] = wc_attribute_label( $field );
262
+ }
263
+ }
264
+ } else {
265
+ unset( $fields[ $field ] );
266
+ }
267
+ }
268
+
269
+ return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
270
+ }
271
+
272
+ /**
273
+ * Render the compare table
274
+ *
275
+ * @since 1.0.0
276
+ * @author Francesco Licandro
277
+ * @return void
278
+ */
279
+ public function compare_table_html() {
280
+ global $woocommerce, $sitepress;
281
+
282
+ if ( ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_view ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
283
+ return;
284
+ }
285
+
286
+ // Check if is add to cart.
287
+ if ( isset( $_REQUEST['add-to-cart'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
288
+ $product_id = absint( $_REQUEST['add-to-cart'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
289
+ wp_safe_redirect( get_permalink( $product_id ) );
290
+ exit;
291
+ }
292
+
293
+ // WPML Support: Localize Ajax Call.
294
+ $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
295
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
296
+ $sitepress->switch_lang( $lang, true );
297
+ }
298
+
299
+ $args = $this->vars();
300
+ $args['fixed'] = false;
301
+ $args['iframe'] = 'yes';
302
+
303
+ // Extract args.
304
+ extract( $args ); // phpcs:ignore
305
+
306
+ // Remove all styles from compare template.
307
+ add_action( 'wp_print_styles', array( $this, 'remove_all_styles' ), 100 );
308
+
309
+ // Remove admin bar.
310
+ remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
311
+ remove_action( 'wp_head', '_admin_bar_bump_cb' );
312
+
313
+ // Remove filters before render compare popup.
314
+ add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
315
+
316
+ $plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
317
+
318
+ if ( defined( 'WC_TEMPLATE_PATH' ) ) {
319
+ $template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
320
+ $child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
321
+ } else {
322
+ $template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
323
+ $child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
324
+ }
325
+
326
+ foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
327
+ if ( file_exists( ${$var} ) ) {
328
+ include ${$var};
329
+ exit();
330
+ }
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Return the array with all products and all attributes values
336
+ *
337
+ * @since 1.4.0
338
+ * @author Francesco Licandro
339
+ * @param mixed $products A list of products in compare table.
340
+ * @return array The complete list of products with all attributes value
341
+ */
342
+ public function get_products_list( $products = array() ) {
343
+ $list = array();
344
+
345
+ if ( empty( $products ) ) {
346
+ $products = $this->products_list;
347
+ }
348
+
349
+ $products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
350
+ $fields = $this->fields( $products );
351
+
352
+ foreach ( $products as $product_id ) {
353
+
354
+ $product = $this->wc_get_product( $product_id );
355
+ if ( ! $product ) {
356
+ continue;
357
+ }
358
+
359
+ $product->fields = array();
360
+
361
+ // Custom attributes.
362
+ foreach ( $fields as $field => $name ) {
363
+
364
+ switch ( $field ) {
365
+ case 'title':
366
+ $product->fields[ $field ] = $product->get_title();
367
+ break;
368
+ case 'price':
369
+ $product->fields[ $field ] = $product->get_price_html();
370
+ break;
371
+ case 'image':
372
+ $product->fields[ $field ] = absint( $product->get_image_id() );
373
+ break;
374
+ case 'description':
375
+ $description = apply_filters( 'woocommerce_short_description', $product->get_short_description() );
376
+ $product->fields[ $field ] = apply_filters( 'yith_woocompare_products_description', $description );
377
+ break;
378
+ case 'stock':
379
+ $availability = $product->get_availability();
380
+ if ( empty( $availability['availability'] ) ) {
381
+ $availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
382
+ }
383
+ $product->fields[ $field ] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
384
+ break;
385
+ case 'sku':
386
+ $sku = $product->get_sku();
387
+ if ( ! $sku ) {
388
+ $sku = '-';
389
+ }
390
+ $product->fields[ $field ] = $sku;
391
+ break;
392
+ case 'weight':
393
+ $weight = $product->get_weight();
394
+ $weight = $weight ? ( wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) ) ) : '-';
395
+
396
+ $product->fields[ $field ] = sprintf( '<span>%s</span>', esc_html( $weight ) );
397
+ break;
398
+ case 'dimensions':
399
+ $dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions( false ) ) : $product->get_dimensions();
400
+ if ( ! $dimensions ) {
401
+ $dimensions = '-';
402
+ }
403
+
404
+ $product->fields[ $field ] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
405
+ break;
406
+ default:
407
+ if ( taxonomy_exists( $field ) ) {
408
+ $product->fields[ $field ] = array();
409
+ $terms = get_the_terms( $product_id, $field );
410
+ if ( ! empty( $terms ) ) {
411
+ foreach ( $terms as $term ) {
412
+ $term = sanitize_term( $term, $field );
413
+ $product->fields[ $field ][] = $term->name;
414
+ }
415
+ }
416
+ $product->fields[ $field ] = implode( ', ', $product->fields[ $field ] );
417
+ } else {
418
+ do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
419
+ }
420
+ break;
421
+ }
422
+ }
423
+
424
+ $list[ $product_id ] = $product;
425
+ }
426
+
427
+ return $list;
428
+ }
429
+
430
+ /**
431
+ * The URL of product comparison table
432
+ *
433
+ * @since 1.4.0
434
+ * @author Francesco Licandro
435
+ * @param bool | integer $product_id The product ID.
436
+ * @return string The url to add the product in the comparison table.
437
+ */
438
+ public function view_table_url( $product_id = false ) {
439
+ $url_args = array(
440
+ 'action' => $this->action_view,
441
+ 'iframe' => 'yes',
442
+ );
443
+
444
+ $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
445
+ if ( $lang ) {
446
+ $url_args['lang'] = $lang;
447
+ }
448
+
449
+ return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, remove_query_arg( 'wc-ajax' ) ) ), $product_id );
450
+ }
451
+
452
+ /**
453
+ * The URL to add the product into the comparison table
454
+ *
455
+ * @since 1.4.0
456
+ * @author Francesco Licandro
457
+ * @param int $product_id ID of the product to add.
458
+ * @return string The url to add the product in the comparison table.
459
+ */
460
+ public function add_product_url( $product_id ) {
461
+ $url_args = array(
462
+ 'action' => $this->action_add,
463
+ 'id' => $product_id,
464
+ );
465
+
466
+ $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
467
+ if ( $lang ) {
468
+ $url_args['lang'] = $lang;
469
+ }
470
+
471
+ return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
472
+ }
473
+
474
+ /**
475
+ * The URL to remove the product into the comparison table
476
+ *
477
+ * @since 1.4.0
478
+ * @author Francesco Licandro
479
+ * @param string $product_id The ID of the product to remove.
480
+ * @return string The url to remove the product in the comparison table
481
+ */
482
+ public function remove_product_url( $product_id ) {
483
+ $url_args = array(
484
+ 'action' => $this->action_remove,
485
+ 'id' => $product_id,
486
+ );
487
+
488
+ return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
489
+ }
490
+
491
+ /**
492
+ * Add the link to compare
493
+ *
494
+ * @since 1.0.0
495
+ * @author Francesco Licandro
496
+ * @param mixed $product_id The product ID.
497
+ * @param array $args An array of link arguments.
498
+ */
499
+ public function add_compare_link( $product_id = false, $args = array() ) {
500
+ extract( $args ); // phpcs:ignore
501
+
502
+ if ( ! $product_id ) {
503
+ global $product;
504
+ $product_id = ! is_null( $product ) ? $product->get_id() : 0;
505
+ }
506
+
507
+ // Return if product doesn't exist.
508
+ if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) ) {
509
+ return;
510
+ }
511
+
512
+ $is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button', 'button' ) : $button_or_link;
513
+
514
+ if ( ! isset( $button_text ) || 'default' === $button_text ) {
515
+ $button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
516
+ do_action( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
517
+ $button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
518
+ }
519
+
520
+ printf( '<a href="%s" class="%s" data-product_id="%d" rel="nofollow">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( 'button' === $is_button ? ' button' : '' ), $product_id, $button_text ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
521
+ }
522
+
523
+ /**
524
+ * Return the url of stylesheet position
525
+ *
526
+ * @since 1.0.0
527
+ * @author Francesco Licandro
528
+ * @return string
529
+ */
530
+ public function stylesheet_url() {
531
+ global $woocommerce;
532
+
533
+ $filename = $this->stylesheet_file;
534
+
535
+ $plugin_path = array(
536
+ 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css',
537
+ 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css',
538
+ );
539
+
540
+ if ( defined( 'WC_TEMPLATE_PATH' ) ) {
541
+ $template_path = array(
542
+ 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename,
543
+ 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename,
544
+ );
545
+ $child_path = array(
546
+ 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename,
547
+ 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename,
548
+ );
549
+ } else {
550
+ $template_path = array(
551
+ 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename,
552
+ 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename,
553
+ );
554
+ $child_path = array(
555
+ 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename,
556
+ 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename,
557
+ );
558
+ }
559
+
560
+ foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
561
+ if ( file_exists( ${$var}['path'] ) ) {
562
+ return ${$var}['url'];
563
+ }
564
+ }
565
+ }
566
+
567
+
568
+ /**
569
+ * Generate template vars
570
+ *
571
+ * @since 1.0.0
572
+ * @access protected
573
+ * @return array
574
+ */
575
+ protected function vars() {
576
+ $vars = array(
577
+ 'products' => $this->get_products_list(),
578
+ 'fields' => $this->fields(),
579
+ 'repeat_price' => get_option( 'yith_woocompare_price_end', 'yes' ),
580
+ 'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end', 'no' ),
581
+ );
582
+
583
+ return $vars;
584
+ }
585
+
586
+ /**
587
+ * The action called by the query string
588
+ *
589
+ * @since 1.0.0
590
+ * @author Francesco Licandro
591
+ */
592
+ public function add_product_to_compare_action() {
593
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_add ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
594
+ return;
595
+ }
596
+
597
+ $product_id = absint( $_REQUEST['id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
598
+ $product = wc_get_product( $product_id );
599
+ // Don't add the product if doesn't exist.
600
+ if ( $product && ! in_array( $product_id, $this->products_list ) ) {
601
+ $this->add_product_to_compare( $product_id );
602
+ }
603
+
604
+ wp_safe_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
605
+ exit();
606
+ }
607
+
608
+ /**
609
+ * The action called by AJAX
610
+ *
611
+ * @since 1.0.0
612
+ * @author Francesco Licandro
613
+ */
614
+ public function add_product_to_compare_ajax() {
615
+
616
+ if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_add ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
617
+ die();
618
+ }
619
+
620
+ $product_id = absint( $_REQUEST['id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
621
+ $product = wc_get_product( $product_id );
622
+ // Don't add the product if doesn't exist.
623
+ if ( $product && ! in_array( $product_id, $this->products_list ) ) {
624
+ $this->add_product_to_compare( $product_id );
625
+ }
626
+
627
+ do_action( 'yith_woocompare_add_product_action_ajax' );
628
+
629
+ $json = apply_filters(
630
+ 'yith_woocompare_add_product_action_json',
631
+ array(
632
+ 'table_url' => $this->view_table_url( $product_id ),
633
+ 'widget_table' => $this->list_products_html(),
634
+ )
635
+ );
636
+
637
+ echo wp_json_encode( $json );
638
+ die();
639
+ }
640
+
641
+ /**
642
+ * Add a product in the products comparison table
643
+ *
644
+ * @since 1.0.0
645
+ * @author Francesco Licandro
646
+ * @param int $product_id Product ID to add in the comparison table.
647
+ */
648
+ public function add_product_to_compare( $product_id ) {
649
+
650
+ $this->products_list[] = $product_id;
651
+ setcookie( $this->cookie_name, wp_json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
652
+
653
+ do_action( 'yith_woocompare_after_add_product', $product_id );
654
+ }
655
+
656
+ /**
657
+ * The action called by the query string
658
+ *
659
+ * @since 1.0.0
660
+ * @author Francesco Licandro
661
+ */
662
+ public function remove_product_from_compare_action() {
663
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_remove ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
664
+ return;
665
+ }
666
+
667
+ $this->remove_product_from_compare( absint( $_REQUEST['id'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
668
+ // Redirect.
669
+ $redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
670
+
671
+ if ( isset( $_REQUEST['redirect'] ) && 'view' === sanitize_text_field( wp_unslash( $_REQUEST['redirect'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
672
+ $redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
673
+ }
674
+
675
+ wp_safe_redirect( $redirect );
676
+ exit();
677
+ }
678
+
679
+ /**
680
+ * The action called by AJAX
681
+ *
682
+ * @since 1.0.0
683
+ * @author Francesco Licandro
684
+ */
685
+ public function remove_product_from_compare_ajax() {
686
+
687
+ if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_remove ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
688
+ die();
689
+ }
690
+
691
+ $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
692
+
693
+ $this->remove_product_from_compare( absint( $_REQUEST['id'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
694
+
695
+ do_action( 'yith_woocompare_remove_product_action_ajax' );
696
+
697
+ header( 'Content-Type: text/html; charset=utf-8' );
698
+
699
+ if ( isset( $_REQUEST['responseType'] ) && 'product_list' === sanitize_text_field( wp_unslash( $_REQUEST['responseType'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
700
+ echo wp_kses_post( $this->list_products_html( $lang ) );
701
+ } else {
702
+ $this->compare_table_html();
703
+ }
704
+
705
+ die();
706
+ }
707
+
708
+ /**
709
+ * Return the list of widget table, used in AJAX
710
+ *
711
+ * @since 1.0.0
712
+ * @author Francesco Licandro
713
+ */
714
+ public function reload_widget_list_ajax() {
715
+
716
+ if ( ! isset( $_REQUEST['action'] ) || sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) !== $this->action_reload ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
717
+ die();
718
+ }
719
+
720
+ $lang = isset( $_REQUEST['lang'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['lang'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
721
+
722
+ echo wp_kses_post( $this->list_products_html( $lang ) );
723
+ die();
724
+ }
725
+
726
+ /**
727
+ * The list of products as HTML list
728
+ *
729
+ * @since 1.0.0
730
+ * @author Francesco Licandro
731
+ * @param mixed $lang Current lang loaded, false is default.
732
+ * @return string
733
+ */
734
+ public function list_products_html( $lang = false ) {
735
+ ob_start();
736
+
737
+ global $sitepress;
738
+
739
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
740
+ $sitepress->switch_lang( $lang, true );
741
+ }
742
+
743
+ if ( empty( $this->products_list ) ) {
744
+ echo '<li class="list_empty">' . esc_html__( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
745
+
746
+ return ob_get_clean();
747
+ }
748
+
749
+ foreach ( $this->products_list as $product_id ) {
750
+ $product = $this->wc_get_product( $product_id );
751
+ if ( ! $product ) {
752
+ continue;
753
+ }
754
+ ?>
755
+ <li>
756
+ <a href="<?php echo esc_attr( $this->remove_product_url( $product_id ) ); ?>" data-product_id="<?php echo esc_attr( $product_id ); ?>" class="remove" title="<?php esc_html_e( 'Remove', 'yith-woocommerce-compare' ); ?>">x</a>
757
+ <a class="title" href="<?php echo esc_attr( get_permalink( $product_id ) ); ?>"><?php echo esc_html( $product->get_title() ); ?></a>
758
+ </li>
759
+ <?php
760
+ }
761
+
762
+ $return = ob_get_clean();
763
+
764
+ return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
765
+ }
766
+
767
+ /**
768
+ * Remove a product from the comparison table
769
+ *
770
+ * @since 1.0.0
771
+ * @author Francesco Licandro
772
+ * @param integer $product_id The product ID to remove from the comparison table.
773
+ */
774
+ public function remove_product_from_compare( $product_id ) {
775
+
776
+ if ( 'all' === $product_id ) {
777
+ $this->products_list = array();
778
+ } else {
779
+ foreach ( $this->products_list as $k => $id ) {
780
+ if ( absint( $product_id ) === absint( $id ) ) {
781
+ unset( $this->products_list[ $k ] );
782
+ }
783
+ }
784
+ }
785
+
786
+ setcookie( $this->cookie_name, wp_json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
787
+
788
+ do_action( 'yith_woocompare_after_remove_product', $product_id );
789
+ }
790
+
791
+ /**
792
+ * Remove all styles from the compare template
793
+ *
794
+ * @since 1.0.0
795
+ * @author Francesco Licandro
796
+ */
797
+ public function remove_all_styles() {
798
+ global $wp_styles;
799
+
800
+ $wp_styles->queue = array_filter(
801
+ $wp_styles->queue,
802
+ function ( $v ) {
803
+ return strpos( $v, 'yith-proteo' ) !== false;
804
+ }
805
+ );
806
+ }
807
+
808
+ /**
809
+ * Show the html for the shortcode
810
+ *
811
+ * @since 1.0.0
812
+ * @author Francesco Licandro
813
+ * @param array $atts Shortcode attributes.
814
+ * @param mixed $content Shortcode content.
815
+ * @return string
816
+ */
817
+ public function compare_button_sc( $atts, $content = null ) {
818
+ $atts = shortcode_atts(
819
+ array(
820
+ 'product' => false,
821
+ 'type' => 'default',
822
+ 'container' => 'yes',
823
+ ),
824
+ $atts
825
+ );
826
+
827
+ $product_id = 0;
828
+
829
+ /**
830
+ * Retrieve the product ID in these steps:
831
+ * - If "product" attribute is not set, get the product ID of current product loop
832
+ * - If "product" contains ID, post slug or post title
833
+ */
834
+ if ( ! $atts['product'] ) {
835
+ global $product;
836
+ $product_id = $product->get_id();
837
+ } else {
838
+ global $wpdb;
839
+ $product = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d OR post_name = %s OR post_title = %s LIMIT 1", $atts['product'], $atts['product'], $atts['product'] ) ); // phpcs:ignore
840
+ if ( ! empty( $product ) ) {
841
+ $product_id = $product->ID;
842
+ }
843
+ }
844
+
845
+ // Make sure to get always the product id of current language.
846
+ if ( function_exists( 'wpml_object_id_filter' ) ) {
847
+ $product_id = wpml_object_id_filter( $product_id, 'product', false );
848
+ }
849
+
850
+ // If product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button.
851
+ if ( empty( $product_id ) ) {
852
+ return '';
853
+ }
854
+
855
+ ob_start();
856
+ if ( 'yes' === $atts['container'] ) {
857
+ echo '<div class="woocommerce product compare-button">';
858
+ }
859
+ $this->add_compare_link(
860
+ $product_id,
861
+ array(
862
+ 'button_or_link' => ( 'default' === $atts['type'] ? false : $atts['type'] ),
863
+ 'button_text' => empty( $content ) ? 'default' : $content,
864
+ )
865
+ );
866
+ if ( 'yes' === $atts['container'] ) {
867
+ echo '</div>';
868
+ }
869
+
870
+ return ob_get_clean();
871
+ }
872
+
873
+ /**
874
+ * Wrap for wc_get_product
875
+ *
876
+ * @param integer $product_id The product ID.
877
+ * @return mixed
878
+ * @depreacted
879
+ */
880
+ public function wc_get_product( $product_id ) {
881
+ $wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
882
+
883
+ return $wc_get_product( $product_id );
884
+ }
885
+
886
+
887
+ /**
888
+ * Do action before loads compare popup
889
+ *
890
+ * @since 2.1.1
891
+ * @author Francesco Licandro
892
+ */
893
+ public function actions_before_load_popup() {
894
+ // Removes WooCommerce Product Filter scripts.
895
+ wp_dequeue_script( 'prdctfltr-main-js' );
896
+ wp_dequeue_script( 'prdctfltr-history' );
897
+ wp_dequeue_script( 'prdctfltr-ionrange-js' );
898
+ wp_dequeue_script( 'prdctfltr-isotope-js' );
899
+ wp_dequeue_script( 'prdctfltr-scrollbar-js' );
900
+ }
901
+ }
902
+ }
includes/class.yith-woocompare-helper.php CHANGED
@@ -1,105 +1,89 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author YITH
6
- * @package YITH WooCommerce Compare
7
- * @version 1.1.4
8
- */
9
-
10
- if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
11
-
12
- if( !class_exists( 'YITH_Woocompare_Helper' ) ) {
13
- /**
14
- * YITH Woocommerce Compare helper
15
- *
16
- * @since 1.0.0
17
- */
18
- class YITH_Woocompare_Helper {
19
-
20
- /**
21
- * Set the image size used in the comparison table
22
- *
23
- * @since 1.0.0
24
- */
25
- public static function set_image_size() {
26
- $size = get_option( 'yith_woocompare_image_size' );
27
-
28
- if( ! $size ) {
29
- return;
30
- }
31
-
32
- $size['crop'] = isset( $size['crop'] ) ? true : false;
33
- add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], $size['crop'] );
34
- }
35
-
36
- /*
37
- * The list of standard fields
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- * @param Boolean $with_attr
42
- */
43
- public static function standard_fields( $with_attr = true ) {
44
-
45
- $fields = array(
46
- 'image' => __( 'Image', 'yith-woocommerce-compare' ),
47
- 'title' => __( 'Title', 'yith-woocommerce-compare' ),
48
- 'price' => __( 'Price', 'yith-woocommerce-compare' ),
49
- 'add-to-cart' => __( 'Add to cart', 'yith-woocommerce-compare' ),
50
- 'description' => __( 'Description', 'yith-woocommerce-compare' ),
51
- 'sku' => __( 'Sku', 'yith-woocommerce-compare' ),
52
- 'stock' => __( 'Availability', 'yith-woocommerce-compare' ),
53
- 'weight' => __( 'Weight', 'yith-woocommerce-compare' ),
54
- 'dimensions' => __( 'Dimensions', 'yith-woocommerce-compare' )
55
- );
56
-
57
- if( $with_attr )
58
- $fields = array_merge( $fields, YITH_Woocompare_Helper::attribute_taxonomies() );
59
-
60
- return apply_filters( 'yith_woocompare_standard_fields_array', $fields );
61
- }
62
-
63
- /*
64
- * Get Woocommerce Attribute Taxonomies
65
- *
66
- * @since 1.0.0
67
- * @access public
68
- */
69
- public static function attribute_taxonomies() {
70
- global $woocommerce;
71
-
72
- if ( ! isset( $woocommerce ) ) return array();
73
-
74
- $attributes = array();
75
-
76
- if( function_exists( 'wc_get_attribute_taxonomies' ) && function_exists( 'wc_attribute_taxonomy_name' ) ) {
77
- $attribute_taxonomies = wc_get_attribute_taxonomies();
78
- if( empty( $attribute_taxonomies ) )
79
- return array();
80
- foreach( $attribute_taxonomies as $attribute ) {
81
- $tax = wc_attribute_taxonomy_name( $attribute->attribute_name );
82
- if ( taxonomy_exists( $tax ) ) {
83
- $attributes[$tax] = ucfirst( $attribute->attribute_name );
84
- }
85
- }
86
- }
87
- else{
88
- $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
89
- if( empty( $attribute_taxonomies ) )
90
- return array();
91
- foreach( $attribute_taxonomies as $attribute ) {
92
- $tax = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
93
- if ( taxonomy_exists( $tax ) ) {
94
- $attributes[$tax] = ucfirst( $attribute->attribute_name );
95
- }
96
- }
97
- }
98
-
99
-
100
- return $attributes;
101
- }
102
-
103
-
104
- }
105
- }
1
+ <?php
2
+ /**
3
+ * Helper class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ if ( ! class_exists( 'YITH_Woocompare_Helper' ) ) {
13
+ /**
14
+ * YITH Woocommerce Compare helper
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YITH_Woocompare_Helper {
19
+
20
+ /**
21
+ * Set the image size used in the comparison table
22
+ *
23
+ * @since 1.0.0
24
+ */
25
+ public static function set_image_size() {
26
+ $size = get_option( 'yith_woocompare_image_size' );
27
+ if ( ! $size ) {
28
+ return;
29
+ }
30
+
31
+ add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], isset( $size['crop'] ) );
32
+ }
33
+
34
+ /**
35
+ * The list of standard fields
36
+ *
37
+ * @since 1.0.0
38
+ * @access public
39
+ * @param boolean $with_attr If merge attributes taxonomies to fields.
40
+ * @return array
41
+ */
42
+ public static function standard_fields( $with_attr = true ) {
43
+
44
+ $fields = array(
45
+ 'image' => __( 'Image', 'yith-woocommerce-compare' ),
46
+ 'title' => __( 'Title', 'yith-woocommerce-compare' ),
47
+ 'price' => __( 'Price', 'yith-woocommerce-compare' ),
48
+ 'add-to-cart' => __( 'Add to cart', 'yith-woocommerce-compare' ),
49
+ 'description' => __( 'Description', 'yith-woocommerce-compare' ),
50
+ 'sku' => __( 'Sku', 'yith-woocommerce-compare' ),
51
+ 'stock' => __( 'Availability', 'yith-woocommerce-compare' ),
52
+ 'weight' => __( 'Weight', 'yith-woocommerce-compare' ),
53
+ 'dimensions' => __( 'Dimensions', 'yith-woocommerce-compare' ),
54
+ );
55
+
56
+ if ( $with_attr ) {
57
+ $fields = array_merge( $fields, self::attribute_taxonomies() );
58
+ }
59
+
60
+ return apply_filters( 'yith_woocompare_standard_fields_array', $fields );
61
+ }
62
+
63
+ /**
64
+ * Get Woocommerce Attribute Taxonomies
65
+ *
66
+ * @since 1.0.0
67
+ * @access public
68
+ */
69
+ public static function attribute_taxonomies() {
70
+
71
+ $attributes = array();
72
+
73
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
74
+ if ( empty( $attribute_taxonomies ) ) {
75
+ return array();
76
+ }
77
+ foreach ( $attribute_taxonomies as $attribute ) {
78
+ $tax = wc_attribute_taxonomy_name( $attribute->attribute_name );
79
+ if ( taxonomy_exists( $tax ) ) {
80
+ $attributes[ $tax ] = ucfirst( $attribute->attribute_name );
81
+ }
82
+ }
83
+
84
+ return $attributes;
85
+ }
86
+
87
+
88
+ }
89
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class.yith-woocompare.php CHANGED
@@ -1,145 +1,144 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author YITH
6
- * @package YITH Woocommerce Compare
7
- * @version 1.1.4
8
- */
9
-
10
- if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
11
-
12
- if( !class_exists( 'YITH_Woocompare' ) ) {
13
- /**
14
- * YITH Woocommerce Compare
15
- *
16
- * @since 1.0.0
17
- */
18
- class YITH_Woocompare {
19
-
20
- /**
21
- * Plugin object
22
- *
23
- * @var string
24
- * @since 1.0.0
25
- */
26
- public $obj = null;
27
-
28
- /**
29
- * AJAX Helper
30
- *
31
- * @var string
32
- * @since 1.0.0
33
- */
34
- public $ajax = null;
35
-
36
- /**
37
- * Constructor
38
- *
39
- * @return mixed|YITH_Woocompare_Admin|YITH_Woocompare_Frontend
40
- * @since 1.0.0
41
- */
42
- public function __construct() {
43
-
44
- add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
45
-
46
- // Load Plugin Framework
47
- add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
48
-
49
- if( $this->is_frontend() ) {
50
-
51
- // require frontend class
52
- require_once('class.yith-woocompare-frontend.php');
53
-
54
- $this->obj = new YITH_Woocompare_Frontend();
55
- }
56
- elseif( $this->is_admin() ) {
57
-
58
- // requires admin classes
59
- require_once('class.yith-woocompare-admin.php');
60
-
61
- $this->obj = new YITH_Woocompare_Admin();
62
- }
63
-
64
- // add image size
65
- YITH_Woocompare_Helper::set_image_size();
66
-
67
- // let's filter the woocommerce image size
68
- add_filter( 'woocommerce_get_image_size_yith-woocompare-image', array( $this, 'filter_wc_image_size' ), 10, 1 );
69
-
70
- return $this->obj;
71
- }
72
-
73
- /**
74
- * Detect if is frontend
75
- * @return bool
76
- */
77
- public function is_frontend() {
78
- $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
79
- $context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
80
- $actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
81
- $action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
82
-
83
- return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
84
- }
85
-
86
- /**
87
- * Detect if is admin
88
- * @return bool
89
- */
90
- public function is_admin() {
91
- $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
92
- $is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'admin' );
93
- return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
94
- }
95
-
96
- /**
97
- * Load Plugin Framework
98
- *
99
- * @since 1.0
100
- * @access public
101
- * @return void
102
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
103
- */
104
- public function plugin_fw_loader() {
105
-
106
- if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
107
- global $plugin_fw_data;
108
- if( ! empty( $plugin_fw_data ) ){
109
- $plugin_fw_file = array_shift( $plugin_fw_data );
110
- require_once( $plugin_fw_file );
111
- }
112
- }
113
- }
114
-
115
- /**
116
- * Load and register widgets
117
- *
118
- * @access public
119
- * @since 1.0.0
120
- */
121
- public function registerWidgets() {
122
- register_widget( 'YITH_Woocompare_Widget' );
123
- }
124
-
125
- /**
126
- * Filter WooCommerce image size attr
127
- *
128
- * @since 2.3.5
129
- * @author Francesco Licandro
130
- * @param array $size
131
- * @return array
132
- */
133
- public function filter_wc_image_size( $size ) {
134
-
135
- $size_opt = get_option( 'yith_woocompare_image_size' );
136
-
137
- return array(
138
- 'width' => isset( $size_opt['width'] ) ? absint( $size_opt['width'] ) : 600,
139
- 'height' => isset( $size_opt['height'] ) ? absint( $size_opt['height'] ) : 600,
140
- 'crop' => isset( $size_opt['crop'] ) ? 1 : 0,
141
- );
142
- }
143
-
144
- }
145
- }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ if ( ! class_exists( 'YITH_Woocompare' ) ) {
13
+ /**
14
+ * YITH Woocommerce Compare
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YITH_Woocompare {
19
+
20
+ /**
21
+ * Plugin object
22
+ *
23
+ * @var string
24
+ * @since 1.0.0
25
+ */
26
+ public $obj = null;
27
+
28
+ /**
29
+ * AJAX Helper
30
+ *
31
+ * @var string
32
+ * @since 1.0.0
33
+ */
34
+ public $ajax = null;
35
+
36
+ /**
37
+ * Constructor
38
+ *
39
+ * @return YITH_Woocompare_Admin | YITH_Woocompare_Frontend
40
+ * @since 1.0.0
41
+ */
42
+ public function __construct() {
43
+
44
+ add_action( 'widgets_init', array( $this, 'register_widgets' ) );
45
+
46
+ // Load Plugin Framework.
47
+ add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
48
+
49
+ if ( $this->is_frontend() ) {
50
+ // Require frontend class.
51
+ require_once 'class.yith-woocompare-frontend.php';
52
+
53
+ $this->obj = new YITH_Woocompare_Frontend();
54
+ } elseif ( $this->is_admin() ) {
55
+ // Requires admin classes.
56
+ require_once 'class.yith-woocompare-admin.php';
57
+
58
+ $this->obj = new YITH_Woocompare_Admin();
59
+ }
60
+
61
+ // Add image size.
62
+ YITH_Woocompare_Helper::set_image_size();
63
+
64
+ // Let's filter the woocommerce image size.
65
+ add_filter( 'woocommerce_get_image_size_yith-woocompare-image', array( $this, 'filter_wc_image_size' ), 10, 1 );
66
+
67
+ return $this->obj;
68
+ }
69
+
70
+ /**
71
+ * Detect if is frontend
72
+ *
73
+ * @return bool
74
+ */
75
+ public function is_frontend() {
76
+ $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
77
+ $context_check = isset( $_REQUEST['context'] ) && sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ) === 'frontend'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
78
+ $actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
79
+ $action_check = isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ), $actions_to_check, true ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
80
+
81
+ return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
82
+ }
83
+
84
+ /**
85
+ * Detect if is admin
86
+ *
87
+ * @return bool
88
+ */
89
+ public function is_admin() {
90
+ $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
91
+ $is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ) === 'admin' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
92
+ return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
93
+ }
94
+
95
+ /**
96
+ * Load Plugin Framework
97
+ *
98
+ * @since 1.0
99
+ * @access public
100
+ * @return void
101
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
102
+ */
103
+ public function plugin_fw_loader() {
104
+
105
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
106
+ global $plugin_fw_data;
107
+ if ( ! empty( $plugin_fw_data ) ) {
108
+ $plugin_fw_file = array_shift( $plugin_fw_data );
109
+ require_once $plugin_fw_file;
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Load and register widgets
116
+ *
117
+ * @access public
118
+ * @since 1.0.0
119
+ */
120
+ public function register_widgets() {
121
+ register_widget( 'YITH_Woocompare_Widget' );
122
+ }
123
+
124
+ /**
125
+ * Filter WooCommerce image size attr
126
+ *
127
+ * @since 2.3.5
128
+ * @author Francesco Licandro
129
+ * @param array $size The default image size.
130
+ * @return array
131
+ */
132
+ public function filter_wc_image_size( $size ) {
133
+
134
+ $size_opt = get_option( 'yith_woocompare_image_size', array() );
135
+
136
+ return array(
137
+ 'width' => isset( $size_opt['width'] ) ? absint( $size_opt['width'] ) : 600,
138
+ 'height' => isset( $size_opt['height'] ) ? absint( $size_opt['height'] ) : 600,
139
+ 'crop' => isset( $size_opt['crop'] ) ? 1 : 0,
140
+ );
141
+ }
142
+
143
+ }
144
+ }
 
init.php CHANGED
@@ -3,17 +3,17 @@
3
  * Plugin Name: YITH WooCommerce Compare
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
5
  * Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin allow you to compare in a simple and efficient way products on sale in your shop and analyze their main features in a single table. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
- * Version: 2.4.5
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-compare
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.8
12
- * WC tested up to: 5.0
13
  *
14
  * @author YITH
15
  * @package YITH WooCommerce Compare
16
- * @version 2.4.5
17
  */
18
  /* Copyright 2021 YITH (email : plugins@yithemes.com)
19
 
@@ -30,7 +30,8 @@
30
  along with this program; if not, write to the Free Software
31
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
  */
33
- if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
 
34
 
35
  if ( ! function_exists( 'is_plugin_active' ) ) {
36
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
@@ -39,7 +40,7 @@ if ( ! function_exists( 'is_plugin_active' ) ) {
39
  function yith_woocompare_install_woocommerce_admin_notice() {
40
  ?>
41
  <div class="error">
42
- <p><?php _e( 'YITH WooCommerce Compare is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-compare' ); ?></p>
43
  </div>
44
  <?php
45
  }
@@ -47,7 +48,7 @@ function yith_woocompare_install_woocommerce_admin_notice() {
47
  function yith_woocompare_install_free_admin_notice() {
48
  ?>
49
  <div class="error">
50
- <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Compare while you are using the premium one.', 'yith-woocommerce-compare' ); ?></p>
51
  </div>
52
  <?php
53
  }
@@ -58,7 +59,7 @@ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
58
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
59
 
60
  if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
61
- define( 'YITH_WOOCOMPARE_VERSION', '2.4.5' );
62
  }
63
  if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
64
  define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
@@ -89,7 +90,7 @@ if ( ! defined( 'YITH_WOOCOMPARE_SLUG' ) ) {
89
  }
90
  /* Plugin Framework Version Check */
91
  if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
92
- require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' );
93
  }
94
  yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
95
 
@@ -109,10 +110,10 @@ function yith_woocompare_constructor() {
109
 
110
  load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
111
 
112
- // Load required classes and functions
113
- require_once('includes/class.yith-woocompare-helper.php');
114
- require_once('widgets/class.yith-woocompare-widget.php');
115
- require_once('includes/class.yith-woocompare.php');
116
 
117
  // Let's start the game!
118
  global $yith_woocompare;
3
  * Plugin Name: YITH WooCommerce Compare
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
5
  * Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin allow you to compare in a simple and efficient way products on sale in your shop and analyze their main features in a single table. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
+ * Version: 2.4.6
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-compare
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.8
12
+ * WC tested up to: 5.1
13
  *
14
  * @author YITH
15
  * @package YITH WooCommerce Compare
16
+ * @version 2.4.6
17
  */
18
  /* Copyright 2021 YITH (email : plugins@yithemes.com)
19
 
30
  along with this program; if not, write to the Free Software
31
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
  */
33
+
34
+ defined( 'ABSPATH' ) || exit; // Exit if accessed directly
35
 
36
  if ( ! function_exists( 'is_plugin_active' ) ) {
37
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
40
  function yith_woocompare_install_woocommerce_admin_notice() {
41
  ?>
42
  <div class="error">
43
+ <p><?php esc_html_e( 'YITH WooCommerce Compare is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-compare' ); ?></p>
44
  </div>
45
  <?php
46
  }
48
  function yith_woocompare_install_free_admin_notice() {
49
  ?>
50
  <div class="error">
51
+ <p><?php esc_html_e( 'You can\'t activate the free version of YITH WooCommerce Compare while you are using the premium one.', 'yith-woocommerce-compare' ); ?></p>
52
  </div>
53
  <?php
54
  }
59
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
60
 
61
  if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
62
+ define( 'YITH_WOOCOMPARE_VERSION', '2.4.6' );
63
  }
64
  if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
65
  define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
90
  }
91
  /* Plugin Framework Version Check */
92
  if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
93
+ require_once YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php';
94
  }
95
  yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
96
 
110
 
111
  load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
112
 
113
+ // Load required classes and functions.
114
+ require_once 'includes/class.yith-woocompare-helper.php';
115
+ require_once 'widgets/class.yith-woocompare-widget.php';
116
+ require_once 'includes/class.yith-woocompare.php';
117
 
118
  // Let's start the game!
119
  global $yith_woocompare;
plugin-fw/assets/css/elementor.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Style for Elementor Editor customization
3
+ */
4
+
5
+ .yith-plugin-fw-elementor-widget-description {
6
+ margin-bottom : 10px;
7
+ font-style : italic;
8
+ }
9
+
10
+ .yith-plugin-fw-elementor-shortcode-widget--shortcode,
11
+ .yith-plugin-fw-elementor-shortcode-widget--empty-html {
12
+ font-family : -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
13
+ padding : 1em 1em 1.2em;
14
+ border : 1px solid #1e1e1e;
15
+ border-radius : 4px;
16
+ }
17
+
18
+ .yith-plugin-fw-elementor-shortcode-widget__title {
19
+ font-size : 15px;
20
+ font-weight : 700;
21
+ margin-bottom : 10px;
22
+ }
23
+
24
+ .yith-plugin-fw-elementor-shortcode-widget__message {
25
+ font-style : italic;
26
+ font-size : 13px;
27
+ }
28
+
29
+ .yith-plugin-fw-elementor-shortcode-widget--shortcode .yith-plugin-fw-elementor-shortcode-widget__content {
30
+ font-family : Menlo, Consolas, monaco, monospace;
31
+ color : #1e1e1e;
32
+ font-size : 13px;
33
+ padding : 0.8em 1em;
34
+ border : 1px solid #ddd;
35
+ border-radius : 4px;
36
+ }
plugin-fw/assets/css/metaboxes.css CHANGED
@@ -126,6 +126,7 @@
126
  width : auto !important;
127
  display : inline-block;
128
  font-weight : normal;
 
129
  }
130
 
131
  .metaboxes-tab input[type="checkbox"] {
126
  width : auto !important;
127
  display : inline-block;
128
  font-weight : normal;
129
+ float : none;
130
  }
131
 
132
  .metaboxes-tab input[type="checkbox"] {
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -466,205 +466,6 @@ WordPress 5.3 with old panel fixes
466
  /****************
467
  YITH UI
468
  ****************/
469
- @font-face {
470
- font-family : 'yith-icon';
471
- src : url('../fonts/yith-icon.eot?g6bfgy');
472
- src : url('../fonts/yith-icon.eot?g6bfgy#iefix') format('embedded-opentype'),
473
- url('../fonts/yith-icon.ttf?g6bfgy') format('truetype'),
474
- url('../fonts/yith-icon.woff?g6bfgy') format('woff'),
475
- url('../fonts/yith-icon.svg?g6bfgy#yith-icon') format('svg');
476
- font-weight : normal;
477
- font-style : normal;
478
- }
479
-
480
- [class^="icon-"], [class*=" icon-"][class^="yith-icon-"], [class*=" yith-icon-"] {
481
- /* use !important to prevent issues with browser extensions that change fonts */
482
- font-family : 'yith-icon' !important;
483
- speak : none;
484
- font-style : normal;
485
- font-weight : normal;
486
- font-variant : normal;
487
- text-transform : none;
488
- line-height : 1;
489
-
490
- /* Better Font Rendering =========== */
491
- -webkit-font-smoothing : antialiased;
492
- -moz-osx-font-smoothing : grayscale;
493
- }
494
-
495
- .yith-icon-paypal-svgrepo-com:before {
496
- content : "\e91b";
497
- }
498
-
499
- .yith-icon-check-circle:before {
500
- content : "\e921";
501
- color : #757575;
502
- }
503
-
504
- .yith-icon-info-squared:before {
505
- content : "\e922";
506
- color : #757575;
507
- }
508
-
509
- .yith-icon-warning-triangle:before {
510
- content : "\e923";
511
- color : #757575;
512
- }
513
-
514
- .yith-icon-bank:before {
515
- content : "\e91c";
516
- }
517
-
518
- .yith-icon-accounting:before {
519
- content : "\e91d";
520
- }
521
-
522
- .yith-icon-bank-check:before {
523
- content : "\e91e";
524
- }
525
-
526
- .yith-icon-cash:before {
527
- content : "\e91f";
528
- }
529
-
530
- .yith-icon-credit-card:before {
531
- content : "\e920";
532
- }
533
-
534
- .yith-icon-calendar_add:before {
535
- content : "\e913";
536
- color : #757575;
537
- }
538
-
539
- .yith-icon-calendar_money:before {
540
- content : "\e914";
541
- color : #757575;
542
- }
543
-
544
- .yith-icon-calendar2:before {
545
- content : "\e915";
546
- color : #757575;
547
- }
548
-
549
- .yith-icon-people:before {
550
- content : "\e916";
551
- color : #757575;
552
- }
553
-
554
- .yith-icon-shield_money:before {
555
- content : "\e917";
556
- color : #757575;
557
- }
558
-
559
- .yith-icon-time_check:before {
560
- content : "\e918";
561
- color : #757575;
562
- }
563
-
564
- .yith-icon-world_settings:before {
565
- content : "\e919";
566
- color : #757575;
567
- }
568
-
569
- .yith-icon-arrow_eye_closed:before {
570
- content : "\e912";
571
- color : #757575;
572
- }
573
-
574
- .yith-icon-arrow_eye:before {
575
- content : "\e911";
576
- color : #757575;
577
- }
578
-
579
- .yith-icon-reset:before {
580
- content : "\e910";
581
- color : #757575;
582
- }
583
-
584
- .yith-icon-drag:before {
585
- content : "\e90f";
586
- color : #757575;
587
- }
588
-
589
- .yith-icon-trash:before {
590
- content : "\e90d";
591
- color : #757575;
592
- }
593
-
594
- .yith-icon-info:before {
595
- content : "\e90e";
596
- color : #757575;
597
- }
598
-
599
- .yith-icon-arrow_down:before {
600
- content : "\e900";
601
- color : #757575;
602
- }
603
-
604
- .yith-icon-arrow_left:before {
605
- content : "\e901";
606
- color : #757575;
607
- }
608
-
609
- .yith-icon-arrow_right:before {
610
- content : "\e902";
611
- color : #757575;
612
- }
613
-
614
- .yith-icon-arrow_up:before {
615
- content : "\e903";
616
- color : #757575;
617
- }
618
-
619
- .yith-icon-calendar:before {
620
- content : "\e904";
621
- color : #757575;
622
- }
623
-
624
- .yith-icon-check:before {
625
- content : "\e905";
626
- color : #757575;
627
- }
628
-
629
- .yith-icon-close:before {
630
- content : "\e906";
631
- color : #757575;
632
- }
633
-
634
- .yith-icon-edit:before {
635
- content : "\e907";
636
- color : #757575;
637
- }
638
-
639
- .yith-icon-magnifier:before {
640
- content : "\e908";
641
- color : #757575;
642
- }
643
-
644
- .yith-icon-pencil:before {
645
- content : "\e909";
646
- color : #757575;
647
- }
648
-
649
- .yith-icon-plus:before {
650
- content : "\e90a";
651
- color : #757575;
652
- }
653
-
654
- .yith-icon-update:before {
655
- content : "\e90b";
656
- color : #757575;
657
- }
658
-
659
- .yith-icon-upload:before {
660
- content : "\e90c";
661
- color : #757575;
662
- }
663
-
664
- .yith-icon-reply:before {
665
- content : "\e91a";
666
- }
667
-
668
  .yith-plugin-fw-banner {
669
  width : 100%;
670
  height : 45px;
@@ -1480,16 +1281,16 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
1480
 
1481
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
1482
  .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
1483
- content : attr(data-text-on);
1484
- color : #98aa36;
1485
- height : 14px;
1486
- font-size : 12px;
1487
- font-weight : 600;
1488
- padding-left : 0;
1489
- padding-right: 18px;
1490
- display : block;
1491
- white-space : nowrap;
1492
- text-align : center;
1493
  }
1494
 
1495
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
@@ -2212,6 +2013,11 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2212
  color : #007694;
2213
  }
2214
 
 
 
 
 
 
2215
  .yith-plugin-fw-dimensions__dimensions {
2216
  display : flex;
2217
  margin : 0;
466
  /****************
467
  YITH UI
468
  ****************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  .yith-plugin-fw-banner {
470
  width : 100%;
471
  height : 45px;
1281
 
1282
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
1283
  .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
1284
+ content : attr(data-text-on);
1285
+ color : #98aa36;
1286
+ height : 14px;
1287
+ font-size : 12px;
1288
+ font-weight : 600;
1289
+ padding-left : 0;
1290
+ padding-right : 18px;
1291
+ display : block;
1292
+ white-space : nowrap;
1293
+ text-align : center;
1294
  }
1295
 
1296
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
2013
  color : #007694;
2014
  }
2015
 
2016
+ .yith-plugin-fw-dimensions__unit--unique {
2017
+ text-decoration : none;
2018
+ cursor : default;
2019
+ }
2020
+
2021
  .yith-plugin-fw-dimensions__dimensions {
2022
  display : flex;
2023
  margin : 0;
plugin-fw/assets/css/yith-icon-font.css ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'yith-icon';
3
+ src: url('../fonts/yith-icon.eot?tkn99p');
4
+ src: url('../fonts/yith-icon.eot?tkn99p#iefix') format('embedded-opentype'),
5
+ url('../fonts/yith-icon.ttf?tkn99p') format('truetype'),
6
+ url('../fonts/yith-icon.woff?tkn99p') format('woff'),
7
+ url('../fonts/yith-icon.svg?tkn99p#yith-icon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ font-display: block;
11
+ }
12
+
13
+ [class^="yith-icon-"], [class*=" yith-icon-"] {
14
+ /* use !important to prevent issues with browser extensions that change fonts */
15
+ font-family: 'yith-icon' !important;
16
+ speak: never;
17
+ font-style: normal;
18
+ font-weight: normal;
19
+ font-variant: normal;
20
+ text-transform: none;
21
+ line-height: 1;
22
+
23
+ /* Better Font Rendering =========== */
24
+ -webkit-font-smoothing: antialiased;
25
+ -moz-osx-font-smoothing: grayscale;
26
+ }
27
+
28
+ .yith-icon-paypal-svgrepo-com:before {
29
+ content: "\e91b";
30
+ }
31
+ .yith-icon-check-circle:before {
32
+ content: "\e921";
33
+ color: #757575;
34
+ }
35
+ .yith-icon-info-squared:before {
36
+ content: "\e922";
37
+ color: #757575;
38
+ }
39
+ .yith-icon-warning-triangle:before {
40
+ content: "\e923";
41
+ color: #757575;
42
+ }
43
+ .yith-icon-bank:before {
44
+ content: "\e91c";
45
+ }
46
+ .yith-icon-accounting:before {
47
+ content: "\e91d";
48
+ }
49
+ .yith-icon-bank-check:before {
50
+ content: "\e91e";
51
+ }
52
+ .yith-icon-cash:before {
53
+ content: "\e91f";
54
+ }
55
+ .yith-icon-credit-card:before {
56
+ content: "\e920";
57
+ }
58
+ .yith-icon-yith:before {
59
+ content: "\e924";
60
+ }
61
+ .yith-icon-calendar_add:before {
62
+ content: "\e913";
63
+ color: #757575;
64
+ }
65
+ .yith-icon-calendar_money:before {
66
+ content: "\e914";
67
+ color: #757575;
68
+ }
69
+ .yith-icon-calendar2:before {
70
+ content: "\e915";
71
+ color: #757575;
72
+ }
73
+ .yith-icon-people:before {
74
+ content: "\e916";
75
+ color: #757575;
76
+ }
77
+ .yith-icon-shield_money:before {
78
+ content: "\e917";
79
+ color: #757575;
80
+ }
81
+ .yith-icon-time_check:before {
82
+ content: "\e918";
83
+ color: #757575;
84
+ }
85
+ .yith-icon-world_settings:before {
86
+ content: "\e919";
87
+ color: #757575;
88
+ }
89
+ .yith-icon-arrow_eye_closed:before {
90
+ content: "\e912";
91
+ color: #757575;
92
+ }
93
+ .yith-icon-arrow_eye:before {
94
+ content: "\e911";
95
+ color: #757575;
96
+ }
97
+ .yith-icon-reset:before {
98
+ content: "\e910";
99
+ color: #757575;
100
+ }
101
+ .yith-icon-drag:before {
102
+ content: "\e90f";
103
+ color: #757575;
104
+ }
105
+ .yith-icon-trash:before {
106
+ content: "\e90d";
107
+ color: #757575;
108
+ }
109
+ .yith-icon-info:before {
110
+ content: "\e90e";
111
+ color: #757575;
112
+ }
113
+ .yith-icon-arrow_down:before {
114
+ content: "\e900";
115
+ color: #757575;
116
+ }
117
+ .yith-icon-arrow_left:before {
118
+ content: "\e901";
119
+ color: #757575;
120
+ }
121
+ .yith-icon-arrow_right:before {
122
+ content: "\e902";
123
+ color: #757575;
124
+ }
125
+ .yith-icon-arrow_up:before {
126
+ content: "\e903";
127
+ color: #757575;
128
+ }
129
+ .yith-icon-calendar:before {
130
+ content: "\e904";
131
+ color: #757575;
132
+ }
133
+ .yith-icon-check:before {
134
+ content: "\e905";
135
+ color: #757575;
136
+ }
137
+ .yith-icon-close:before {
138
+ content: "\e906";
139
+ color: #757575;
140
+ }
141
+ .yith-icon-edit:before {
142
+ content: "\e907";
143
+ color: #757575;
144
+ }
145
+ .yith-icon-magnifier:before {
146
+ content: "\e908";
147
+ color: #757575;
148
+ }
149
+ .yith-icon-pencil:before {
150
+ content: "\e909";
151
+ color: #757575;
152
+ }
153
+ .yith-icon-plus:before {
154
+ content: "\e90a";
155
+ color: #757575;
156
+ }
157
+ .yith-icon-update:before {
158
+ content: "\e90b";
159
+ color: #757575;
160
+ }
161
+ .yith-icon-upload:before {
162
+ content: "\e90c";
163
+ color: #757575;
164
+ }
165
+ .yith-icon-reply:before {
166
+ content: "\e91a";
167
+ }
plugin-fw/assets/fonts/yith-icon.eot CHANGED
Binary file
plugin-fw/assets/fonts/yith-icon.svg CHANGED
@@ -43,4 +43,5 @@
43
  <glyph unicode="&#xe921;" glyph-name="check-circle" d="M483.499 298.667c-7.509 0-14.848 3.072-20.139 8.363l-99.499 99.669c-11.093 11.093-11.093 29.184 0 40.277s29.184 11.093 40.277 0l77.141-77.141 179.2 224.085c9.728 12.288 27.648 14.336 39.936 4.437 12.288-9.728 14.336-27.648 4.437-39.936l-199.168-249.173c-5.12-6.315-12.629-10.24-20.651-10.581-0.512 0-1.024 0-1.536 0zM512 35.499c-227.499 0-412.501 185.003-412.501 412.501s185.003 412.501 412.501 412.501 412.501-185.003 412.501-412.501-185.003-412.501-412.501-412.501zM512 803.499c-196.096 0-355.499-159.403-355.499-355.499s159.403-355.499 355.499-355.499 355.499 159.573 355.499 355.499-159.403 355.499-355.499 355.499z" />
44
  <glyph unicode="&#xe922;" glyph-name="info-squared" d="M853.333 35.499h-682.667c-39.253 0-71.168 31.915-71.168 71.168v682.667c0 39.253 31.915 71.168 71.168 71.168h682.667c39.253 0 71.168-31.915 71.168-71.168v-682.667c0-39.253-31.915-71.168-71.168-71.168zM170.667 803.499c-7.851 0-14.165-6.315-14.165-14.165v-682.667c0-7.851 6.315-14.165 14.165-14.165h682.667c7.851 0 14.165 6.315 14.165 14.165v682.667c0 7.851-6.315 14.165-14.165 14.165h-682.667zM504.832 561.835c-19.627 0-35.499 15.872-35.499 35.499s15.872 35.499 35.499 35.499 35.499-15.872 35.499-35.499-15.872-35.499-35.499-35.499zM568.832 291.499h-28.501v199.168c0 15.701-12.8 28.501-28.501 28.501h-28.501c-15.701 0-28.501-12.8-28.501-28.501s12.8-28.501 28.501-28.501v-170.667h-28.501c-15.701 0-28.501-12.8-28.501-28.501s12.8-28.501 28.501-28.501h113.835c15.701 0 28.501 12.8 28.501 28.501s-12.629 28.501-28.331 28.501z" />
45
  <glyph unicode="&#xe923;" glyph-name="warning-triangle" d="M504.832 789.333l384-682.667h-768l384 682.667zM504.832 846.165v0c-20.48 0-39.424-11.093-49.664-29.013l-384-682.667c-9.899-17.579-9.728-39.083 0.512-56.661 10.24-17.408 28.843-28.16 49.152-28.16h768c20.139 0 38.912 10.752 49.152 28.16s10.411 39.083 0.512 56.661l-384 682.667c-10.069 17.92-29.013 29.013-49.664 29.013v0zM504.832 276.48c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667-42.667 19.115-42.667 42.667 19.115 42.667 42.667 42.667zM497.835 334.165c-15.701 0-28.501 12.8-28.501 28.501v227.499c0 15.701 12.8 28.501 28.501 28.501s28.501-12.8 28.501-28.501v-227.499c-0.171-15.701-12.8-28.501-28.501-28.501z" />
 
46
  </font></defs></svg>
43
  <glyph unicode="&#xe921;" glyph-name="check-circle" d="M483.499 298.667c-7.509 0-14.848 3.072-20.139 8.363l-99.499 99.669c-11.093 11.093-11.093 29.184 0 40.277s29.184 11.093 40.277 0l77.141-77.141 179.2 224.085c9.728 12.288 27.648 14.336 39.936 4.437 12.288-9.728 14.336-27.648 4.437-39.936l-199.168-249.173c-5.12-6.315-12.629-10.24-20.651-10.581-0.512 0-1.024 0-1.536 0zM512 35.499c-227.499 0-412.501 185.003-412.501 412.501s185.003 412.501 412.501 412.501 412.501-185.003 412.501-412.501-185.003-412.501-412.501-412.501zM512 803.499c-196.096 0-355.499-159.403-355.499-355.499s159.403-355.499 355.499-355.499 355.499 159.573 355.499 355.499-159.403 355.499-355.499 355.499z" />
44
  <glyph unicode="&#xe922;" glyph-name="info-squared" d="M853.333 35.499h-682.667c-39.253 0-71.168 31.915-71.168 71.168v682.667c0 39.253 31.915 71.168 71.168 71.168h682.667c39.253 0 71.168-31.915 71.168-71.168v-682.667c0-39.253-31.915-71.168-71.168-71.168zM170.667 803.499c-7.851 0-14.165-6.315-14.165-14.165v-682.667c0-7.851 6.315-14.165 14.165-14.165h682.667c7.851 0 14.165 6.315 14.165 14.165v682.667c0 7.851-6.315 14.165-14.165 14.165h-682.667zM504.832 561.835c-19.627 0-35.499 15.872-35.499 35.499s15.872 35.499 35.499 35.499 35.499-15.872 35.499-35.499-15.872-35.499-35.499-35.499zM568.832 291.499h-28.501v199.168c0 15.701-12.8 28.501-28.501 28.501h-28.501c-15.701 0-28.501-12.8-28.501-28.501s12.8-28.501 28.501-28.501v-170.667h-28.501c-15.701 0-28.501-12.8-28.501-28.501s12.8-28.501 28.501-28.501h113.835c15.701 0 28.501 12.8 28.501 28.501s-12.629 28.501-28.331 28.501z" />
45
  <glyph unicode="&#xe923;" glyph-name="warning-triangle" d="M504.832 789.333l384-682.667h-768l384 682.667zM504.832 846.165v0c-20.48 0-39.424-11.093-49.664-29.013l-384-682.667c-9.899-17.579-9.728-39.083 0.512-56.661 10.24-17.408 28.843-28.16 49.152-28.16h768c20.139 0 38.912 10.752 49.152 28.16s10.411 39.083 0.512 56.661l-384 682.667c-10.069 17.92-29.013 29.013-49.664 29.013v0zM504.832 276.48c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667-42.667 19.115-42.667 42.667 19.115 42.667 42.667 42.667zM497.835 334.165c-15.701 0-28.501 12.8-28.501 28.501v227.499c0 15.701 12.8 28.501 28.501 28.501s28.501-12.8 28.501-28.501v-227.499c-0.171-15.701-12.8-28.501-28.501-28.501z" />
46
+ <glyph unicode="&#xe924;" glyph-name="yith" horiz-adv-x="1025" d="M912.045 578.581c-47.452-32.802-108.205-67.153-182.659-103.005 37.852 125.106 58.903 241.862 63.103 350.217 3.15 87.254-35.802 131.956-116.756 134.057-97.805 3.15-161.958-51.503-192.459-164.058 17.101 7.35 34.702 11.051 52.903 11.051 14.901 0 27.201-6.050 36.802-18.151s13.851-26.051 12.801-41.802c-1-41.002-21.951-84.954-62.753-131.706-40.802-46.852-77.104-70.203-108.905-70.203-22.251 0-32.852 18.901-31.802 56.753 1.050 20.001 7.9 60.503 20.501 121.506 11.551 57.803 17.351 96.705 17.351 116.706 0 34.702-8.95 62.853-26.801 84.404-17.901 21.551-43.652 30.752-77.304 27.601-23.151-2.1-57.303-23.151-102.555-63.053-33.702-30.651-67.353-61.103-101.005-91.604l36.302-42.602c29.401 22.101 47.302 33.152 53.603 33.152 20.001 0 29.451-13.701 28.451-41.002 0-2.15-9.5-35.252-28.401-99.405s-28.901-112.005-30.001-143.557c-2.1-43.152 5.8-76.254 23.751-99.355 22.151-28.401 59.103-40.502 110.905-36.302 61.203 4.2 122.456 26.851 183.709 67.803 25.351 16.851 49.602 36.302 72.854 58.403-8.4-42.102-18.401-77.854-30.001-107.305-113.556-51.503-195.56-95.655-246.062-132.506-71.553-51.503-109.905-106.705-115.156-165.608-9.5-102.005 42.052-153.007 154.608-153.007 75.704 0 148.807 46.252 219.261 138.807 59.953 78.854 112.005 184.059 156.158 315.465 76.454 37.952 141.057 75.104 193.959 111.505-1.7-12.251 19.551 92.805 15.601 76.804zM369.668 155.211c-16.851 0-24.751 7.4-23.701 22.101 2.1 27.351 49.452 63.653 142.007 108.855-48.402-87.254-87.854-130.956-118.306-130.956z" />
47
  </font></defs></svg>
plugin-fw/assets/fonts/yith-icon.ttf CHANGED
Binary file
plugin-fw/assets/fonts/yith-icon.woff CHANGED
Binary file
plugin-fw/assets/images/yith-icon.svg CHANGED
@@ -1 +1,14 @@
1
- <?xml version="1.0" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 20.5 20.479" width="20.5" height="20.479"><defs><clipPath id="_clipPath_BBRuGaomYLKjPKjOOHpnNdPxBnLPFPyk"><rect width="20.5" height="20.479"/></clipPath></defs><g clip-path="url(#_clipPath_BBRuGaomYLKjPKjOOHpnNdPxBnLPFPyk)"><g><path d=" M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z " fill="rgb(255,255,255)"/></g></g></svg>
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?><!-- Generator: Gravit.io -->
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 20.5 20.479" width="20.5" height="20.479">
3
+ <defs>
4
+ <clipPath id="_clipPath_BBRuGaomYLKjPKjOOHpnNdPxBnLPFPyk">
5
+ <rect width="20.5" height="20.479"/>
6
+ </clipPath>
7
+ </defs>
8
+ <g clip-path="url(#_clipPath_BBRuGaomYLKjPKjOOHpnNdPxBnLPFPyk)">
9
+ <g>
10
+ <path d=" M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z "
11
+ fill="rgb(255,255,255)"/>
12
+ </g>
13
+ </g>
14
+ </svg>
plugin-fw/assets/js/yith-fields.js CHANGED
@@ -203,8 +203,8 @@
203
  } );
204
 
205
  $image_gallery_ids.val( attachment_ids );
206
- $image_gallery_ids.trigger( 'change' );
207
- } );
208
 
209
  image_gallery_frame.open();
210
 
@@ -426,8 +426,13 @@
426
 
427
  /* on-off */
428
  $( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
429
- var input = $( this ).prev( 'input' ),
430
- checked = input.prop( 'checked' );
 
 
 
 
 
431
 
432
  if ( checked ) {
433
  input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
@@ -605,12 +610,12 @@
605
  counter = 0,
606
  hidden_obj = $( '<input type="hidden">' );
607
 
608
- toggle_element.find( '.yith-toggle-row' ).each( function() {
609
  var key = parseInt( $( this ).data( 'item_key' ) );
610
- if( counter <= key ) {
611
  counter = key + 1;
612
  }
613
- });
614
 
615
  hidden_obj.val( counter );
616
 
203
  } );
204
 
205
  $image_gallery_ids.val( attachment_ids );
206
+ $image_gallery_ids.trigger( 'change' );
207
+ } );
208
 
209
  image_gallery_frame.open();
210
 
426
 
427
  /* on-off */
428
  $( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
429
+ var input = $( this ).prev( 'input' ),
430
+ checked = input.prop( 'checked' ),
431
+ disabled = input.prop( 'disabled' );
432
+
433
+ if ( disabled ) {
434
+ return;
435
+ }
436
 
437
  if ( checked ) {
438
  input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
610
  counter = 0,
611
  hidden_obj = $( '<input type="hidden">' );
612
 
613
+ toggle_element.find( '.yith-toggle-row' ).each( function () {
614
  var key = parseInt( $( this ).data( 'item_key' ) );
615
+ if ( counter <= key ) {
616
  counter = key + 1;
617
  }
618
+ } );
619
 
620
  hidden_obj.val( counter );
621
 
plugin-fw/assets/js/yith-fields.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},a=e(".add_media"),l={rootSelector:".yith-plugin-fw-image-gallery",buttonSelector:".yith-plugin-fw-image-gallery .image-gallery-button",sliderWrapper:e(".yith-plugin-fw-image-gallery ul.slides-wrapper")},o=e(".yith-plugin-fw-sidebar-layout"),s=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),n=e(this).closest(".yith-single-colorpicker"),a=i.find(".wp-picker-input-wrap"),l=n.find(".wp-picker-input-wrap");if(a.length&&i.find("a.wp-color-result").attr("title",t),n.length&&n.find("a.wp-color-result").attr("title",t),!a.find(".wp-picker-default-custom").length){var o=e("<span/>").attr({"class":"wp-picker-default-custom"});a.find(".wp-picker-default").wrap(o)}l.find(".wp-picker-default-custom").length||(o=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(o))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(n.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),a=e(this).parent().find(n.imgPreviewHandler).first();a.length<1&&(a=e(this).parent().parent().find(n.imgPreviewHandler).first()),i.test(t)?a.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):a.html("")}).trigger("change"),e(document).on("click",n.uploadButtonHandler,function(t){t.preventDefault();var i,a=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+a).val(t.url),e("#"+a+"-yith-attachment-id")&&e("#"+a+"-yith-attachment-id").val(t.id),n.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",n.resetButtonHandler,function(t){var i=e(this),a=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),o=e("#"+a).data("default");e("#"+l).val(o),n.imgUrl.trigger("change")}));a.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonSelector,function(t){var i=e(this),n=i.closest(l.rootSelector),a=n.find(".image_gallery_ids"),o=a.val(),s=n.find("ul.slides-wrapper"),r=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});r.on("select",function(){r.state().get("selection").map(function(e){(e=e.toJSON()).id&&(o=o?o+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),a.val(o),a.trigger("change")}),r.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,n){var a="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");a=a+t+","}),t.closest(l.rootSelector).find(".image_gallery_ids").val(a)}})}),l.sliderWrapper.on("click","a.delete",function(t){t.preventDefault();var i=e(this).closest(l.rootSelector),n=i.find("ul.slides-wrapper"),a=i.find(".image_gallery_ids"),o="";e(this).closest("li.image").remove(),n.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");o=o+t+","}),a.val(o)})),o.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),n=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":i.show(),n.hide();break;case"right":n.show(),i.hide();break;case"double":i.show(),n.show();break;default:i.hide(),n.hide()}})}),s.each(function(){var t=e(this).data("val"),i=e(this).data("min"),n=e(this).data("max"),a=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:n,range:"min",step:a,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),e(function(){e(document).on("yith-plugin-fw-codemirror-init",function(){"undefined"!=typeof wp&&"undefined"!=typeof wp.codeEditor&&e(".codemirror:not(.codemirror--initialized)").each(function(){var t=e(this).data("settings"),i=wp.codeEditor.initialize(e(this),t);e(this).addClass("codemirror--initialized"),e(this).data("codemirrorInstance",i)})}).trigger("yith-plugin-fw-codemirror-init")}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),r.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),n=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(a){var l=e(a.target).closest("li"),o=l.data("font"),s=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",o),i.attr("data-icon",s),i.attr("data-key",r),i.attr("data-name",d),n.val(o+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),n=t.closest(".yith-plugin-fw-select-images__wrapper"),a=n.find(".yith-plugin-fw-select-images__item"),l=n.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),a.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var n=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<n.length;a++)l[a]=e(n[a]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var n=e(this),a="yith_plugin_fw_save_toggle_element",l=n.serializeToggleElement(),o=n.find(".yith-toggle_wrapper"),s=o.attr("id"),r=e.urlParam("tab");l.append("security",o.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),n.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+s+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+r+"&toggle_id="+s,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,n])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,n=e(t).find(":input").serializeArray();return e.each(n,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),n=t.find("span.title").data("title_format"),a=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==n)var o=n.match(l);if(void 0!==a)var s=a.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==n&&t.find("span.title").html(n),""!==a&&t.find(".subtitle").html(a),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),n=i.closest(".yith-toggle-row"),a=n.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;n.is(".yith-toggle-row-opened")?a.slideUp(400):a.slideDown(400),n.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),n=i.data("box_id"),a=i.data("closed_label"),l=i.data("opened_label"),o=i.closest(".yith-toggle_wrapper").attr("id"),s=wp.template("yith-toggle-element-add-box-content-"+o);""!==n&&(e("#"+n).html(s({index:"box_id"})).slideToggle(),""!==a&&(i.html()===a?i.html(l).removeClass("closed"):i.html(a).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),n=e(this).closest(".yith-toggle_wrapper").attr("id"),a=i.find(".spinner"),l=e(this).parents(".toggle-element"),o=i.find(":input"),s=0,r=e('<input type="hidden">');l.find(".yith-toggle-row").each(function(){var t=parseInt(e(this).data("item_key"));s<=t&&(s=t+1)}),r.val(s),e(document).trigger("yith-toggle-change-counter",[r,i]),s=r.val();var d=wp.template("yith-toggle-element-item-"+n),c=e(d({index:s}));a.addClass("show"),e.each(o,function(t,i){if(void 0!==e(i).attr("id")){var n=e(i).attr("id"),a=e(i).val();n="radio"===e(i).attr("type")?(n=(n=e(i).closest(".yith-plugin-fw-radio").attr("id")).replace("new_","")+"_"+s)+"-"+a:n.replace("new_","")+"_"+s,e(i).is(":checked")&&e(c).find("#"+n).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+n).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+n).val(a)}}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),n=e(this).closest(".yith-toggle-row"),a=n.find(".spinner");n.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,n,l]),"yes"===l.val()&&(a.addClass("show"),i.saveToggleElement(a))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var n=e(this).closest(t.selectors.units.single),a=n.closest(t.selectors.units.wrapper),l=a.find(t.selectors.units.single),o=a.find(t.selectors.units.value).first(),s=n.data("value");l.removeClass(t.selectors.units.selectedClass),n.addClass(t.selectors.units.selectedClass),o.val(s)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),n=i.closest(t.selectors.wrapper),a=i.find(t.selectors.linked.value);"yes"===a.val()?(n.removeClass(t.selectors.linked.wrapperActiveClass),a.val("no")):(n.addClass(t.selectors.linked.wrapperActiveClass),a.val("yes"),n.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var n=e(this).closest(t.selectors.dimensions.number),a=n.closest(t.selectors.wrapper);a.hasClass(t.selectors.linked.wrapperActiveClass)&&a.find(t.selectors.dimensions.number).val(n.val())}};t.init()}(jQuery);
1
+ !function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},a=e(".add_media"),l={rootSelector:".yith-plugin-fw-image-gallery",buttonSelector:".yith-plugin-fw-image-gallery .image-gallery-button",sliderWrapper:e(".yith-plugin-fw-image-gallery ul.slides-wrapper")},o=e(".yith-plugin-fw-sidebar-layout"),s=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),n=e(this).closest(".yith-single-colorpicker"),a=i.find(".wp-picker-input-wrap"),l=n.find(".wp-picker-input-wrap");if(a.length&&i.find("a.wp-color-result").attr("title",t),n.length&&n.find("a.wp-color-result").attr("title",t),!a.find(".wp-picker-default-custom").length){var o=e("<span/>").attr({"class":"wp-picker-default-custom"});a.find(".wp-picker-default").wrap(o)}l.find(".wp-picker-default-custom").length||(o=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(o))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(n.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),a=e(this).parent().find(n.imgPreviewHandler).first();a.length<1&&(a=e(this).parent().parent().find(n.imgPreviewHandler).first()),i.test(t)?a.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):a.html("")}).trigger("change"),e(document).on("click",n.uploadButtonHandler,function(t){t.preventDefault();var i,a=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+a).val(t.url),e("#"+a+"-yith-attachment-id")&&e("#"+a+"-yith-attachment-id").val(t.id),n.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",n.resetButtonHandler,function(t){var i=e(this),a=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),o=e("#"+a).data("default");e("#"+l).val(o),n.imgUrl.trigger("change")}));a.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonSelector,function(t){var i=e(this),n=i.closest(l.rootSelector),a=n.find(".image_gallery_ids"),o=a.val(),s=n.find("ul.slides-wrapper"),r=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});r.on("select",function(){r.state().get("selection").map(function(e){(e=e.toJSON()).id&&(o=o?o+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),a.val(o),a.trigger("change")}),r.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,n){var a="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");a=a+t+","}),t.closest(l.rootSelector).find(".image_gallery_ids").val(a)}})}),l.sliderWrapper.on("click","a.delete",function(t){t.preventDefault();var i=e(this).closest(l.rootSelector),n=i.find("ul.slides-wrapper"),a=i.find(".image_gallery_ids"),o="";e(this).closest("li.image").remove(),n.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");o=o+t+","}),a.val(o)})),o.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),n=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":i.show(),n.hide();break;case"right":n.show(),i.hide();break;case"double":i.show(),n.show();break;default:i.hide(),n.hide()}})}),s.each(function(){var t=e(this).data("val"),i=e(this).data("min"),n=e(this).data("max"),a=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:n,range:"min",step:a,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),e(function(){e(document).on("yith-plugin-fw-codemirror-init",function(){"undefined"!=typeof wp&&"undefined"!=typeof wp.codeEditor&&e(".codemirror:not(.codemirror--initialized)").each(function(){var t=e(this).data("settings"),i=wp.codeEditor.initialize(e(this),t);e(this).addClass("codemirror--initialized"),e(this).data("codemirrorInstance",i)})}).trigger("yith-plugin-fw-codemirror-init")}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),r.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),n=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(a){var l=e(a.target).closest("li"),o=l.data("font"),s=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",o),i.attr("data-icon",s),i.attr("data-key",r),i.attr("data-name",d),n.val(o+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),n=t.closest(".yith-plugin-fw-select-images__wrapper"),a=n.find(".yith-plugin-fw-select-images__item"),l=n.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),a.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var n=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<n.length;a++)l[a]=e(n[a]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input"),i=t.prop("checked");t.prop("disabled")||(i?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change())}),e.fn.saveToggleElement=function(t,i){var n=e(this),a="yith_plugin_fw_save_toggle_element",l=n.serializeToggleElement(),o=n.find(".yith-toggle_wrapper"),s=o.attr("id"),r=e.urlParam("tab");l.append("security",o.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),n.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+s+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+r+"&toggle_id="+s,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,n])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,n=e(t).find(":input").serializeArray();return e.each(n,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),n=t.find("span.title").data("title_format"),a=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==n)var o=n.match(l);if(void 0!==a)var s=a.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==n&&t.find("span.title").html(n),""!==a&&t.find(".subtitle").html(a),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),n=i.closest(".yith-toggle-row"),a=n.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;n.is(".yith-toggle-row-opened")?a.slideUp(400):a.slideDown(400),n.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),n=i.data("box_id"),a=i.data("closed_label"),l=i.data("opened_label"),o=i.closest(".yith-toggle_wrapper").attr("id"),s=wp.template("yith-toggle-element-add-box-content-"+o);""!==n&&(e("#"+n).html(s({index:"box_id"})).slideToggle(),""!==a&&(i.html()===a?i.html(l).removeClass("closed"):i.html(a).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),n=e(this).closest(".yith-toggle_wrapper").attr("id"),a=i.find(".spinner"),l=e(this).parents(".toggle-element"),o=i.find(":input"),s=0,r=e('<input type="hidden">');l.find(".yith-toggle-row").each(function(){var t=parseInt(e(this).data("item_key"));s<=t&&(s=t+1)}),r.val(s),e(document).trigger("yith-toggle-change-counter",[r,i]),s=r.val();var d=wp.template("yith-toggle-element-item-"+n),c=e(d({index:s}));a.addClass("show"),e.each(o,function(t,i){if(void 0!==e(i).attr("id")){var n=e(i).attr("id"),a=e(i).val();n="radio"===e(i).attr("type")?(n=(n=e(i).closest(".yith-plugin-fw-radio").attr("id")).replace("new_","")+"_"+s)+"-"+a:n.replace("new_","")+"_"+s,e(i).is(":checked")&&e(c).find("#"+n).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+n).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+n).val(a)}}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),n=e(this).closest(".yith-toggle-row"),a=n.find(".spinner");n.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,n,l]),"yes"===l.val()&&(a.addClass("show"),i.saveToggleElement(a))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var n=e(this).closest(t.selectors.units.single),a=n.closest(t.selectors.units.wrapper),l=a.find(t.selectors.units.single),o=a.find(t.selectors.units.value).first(),s=n.data("value");l.removeClass(t.selectors.units.selectedClass),n.addClass(t.selectors.units.selectedClass),o.val(s)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),n=i.closest(t.selectors.wrapper),a=i.find(t.selectors.linked.value);"yes"===a.val()?(n.removeClass(t.selectors.linked.wrapperActiveClass),a.val("no")):(n.addClass(t.selectors.linked.wrapperActiveClass),a.val("yes"),n.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var n=e(this).closest(t.selectors.dimensions.number),a=n.closest(t.selectors.wrapper);a.hasClass(t.selectors.linked.wrapperActiveClass)&&a.find(t.selectors.dimensions.number).val(n.val())}};t.init()}(jQuery);
plugin-fw/assets/js/yith-gutenberg.js DELETED
@@ -1,212 +0,0 @@
1
- (function ($) {
2
- // Get registerBlockType() from wp.blocks in the global scope
3
- var __ = wp.i18n.__,
4
- el = wp.element.createElement,
5
- Fragment = wp.element.Fragment,
6
- PanelBody = wp.components.PanelBody,
7
- registerBlockType = wp.blocks.registerBlockType,
8
- RichText = wp.editor.RichText,
9
- BlockControls = wp.editor.BlockControls,
10
- InspectorControls = wp.editor.InspectorControls,
11
- AlignmentToolbar = wp.editor.AlignmentToolbar,
12
- Components = wp.components,
13
- RawHTML = wp.element.RawHTML,
14
- SelectControl = wp.components.SelectControl,
15
- ToggleControl = wp.components.ToggleControl,
16
- CheckboxControl = wp.components.CheckboxControl,
17
- RangeControl = wp.components.RangeControl,
18
- ColorPicker = wp.components.ColorPicker,
19
- RadioControl = wp.components.RadioControl,
20
- TextControl = wp.components.TextControl,
21
- TextareaControl = wp.components.TextareaControl;
22
-
23
- const yith_icon = el('svg', {width: 22, height: 22},
24
- el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
25
- );
26
-
27
- function create_shortcode(sc_args, props, callback) {
28
- var gt_block = '',
29
- gutenberg_preview = '';
30
-
31
- if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
32
- gt_block = $[props.callback](sc_args, props);
33
- }
34
-
35
- else {
36
- var sc_name = props.shortcode_name,
37
- sc = '[' + sc_name,
38
- do_shortcode = null;
39
-
40
-
41
- $.each(sc_args.attributes, function ($v, $k) {
42
- if ( typeof props.attributes != 'undefined' && typeof props.attributes[$v] != 'undefined' ) {
43
- sc += ' ' + $v + '=';
44
- var arg = props.attributes[$v],
45
- remove_quotes = arg.remove_quotes;
46
-
47
- if( remove_quotes == true ){
48
- sc += $k;
49
- }
50
-
51
- else {
52
- sc += '"' + $k + '"';
53
- }
54
- }
55
- });
56
-
57
- sc += ']';
58
-
59
- var block_id = md5(sc);
60
-
61
- gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
62
-
63
- if (callback == 'edit' && props.do_shortcode != false) {
64
- do_shortcode = (function (block_id) {
65
- var ajax_call_date = null;
66
- $(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
67
- $.ajax({
68
- async: true,
69
- url: yith_gutenberg_ajax.ajaxurl,
70
- method: 'post',
71
- data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
72
- success: function (data) {
73
- ajax_call_date = data;
74
- if (ajax_call_date != '') {
75
- $('.yith_block_' + block_id).html(ajax_call_date);
76
- $(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
77
- }
78
- }
79
- });
80
- $(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
81
- return ajax_call_date;
82
- })(block_id);
83
- }
84
-
85
- gt_block = el(RawHTML, null, gutenberg_preview);
86
- }
87
-
88
- return gt_block;
89
- }
90
-
91
- function onChangeEvent(new_value, attribute_name, args, block_type) {
92
- var attributes = {};
93
-
94
- if (block_type == 'colorpicker' || block_type == 'color') {
95
- new_value = new_value.hex;
96
- }
97
-
98
- attributes[attribute_name] = new_value;
99
- args.setAttributes(attributes);
100
- return args;
101
- }
102
-
103
- $.each(yith_gutenberg, function ($block, $props) {
104
- registerBlockType("yith/" + $block, {
105
- title: $props.title,
106
- description: $props.description,
107
- category: $props.category,
108
- attributes: $props.attributes,
109
- icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
110
- keywords: $props.keywords,
111
- edit: function edit(args) {
112
- var elements = new Array();
113
-
114
- $.each($props.attributes, function ($attribute_name, $attribute_args) {
115
- var ComponentControl = null,
116
- block_type = $attribute_args.blocktype,
117
- name = $attribute_name;
118
- if (typeof block_type != 'undefined') {
119
- switch (block_type) {
120
- case 'select':
121
- ComponentControl = SelectControl;
122
- break;
123
-
124
- case 'text':
125
- ComponentControl = TextControl;
126
- break;
127
-
128
- case 'textarea':
129
- ComponentControl = TextareaControl;
130
- break;
131
-
132
- case 'toggle':
133
- ComponentControl = ToggleControl;
134
- break;
135
-
136
- case 'checkbox':
137
- ComponentControl = CheckboxControl;
138
- break;
139
-
140
- case 'number':
141
- case 'range':
142
- ComponentControl = RangeControl;
143
- break;
144
-
145
- case 'color':
146
- case 'colorpicker':
147
- ComponentControl = ColorPicker;
148
- break;
149
-
150
- case 'radio':
151
- ComponentControl = RadioControl;
152
- break;
153
- }
154
-
155
- if (ComponentControl != null) {
156
- var helpMessageChecked = helpMessageUncheked = '';
157
- if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
158
- helpMessageChecked = $attribute_args.helps.checked;
159
- helpMessageUncheked = $attribute_args.helps.unchecked;
160
- }
161
-
162
- else if (typeof $attribute_args.help != 'undefined') {
163
- helpMessageChecked = helpMessageUncheked = $attribute_args.help;
164
- }
165
-
166
- elements.push(
167
- el(
168
- ComponentControl,
169
- {
170
- value: args.attributes[$attribute_name],
171
- options: $attribute_args.options,
172
- label: $attribute_args.label,
173
- checked: args.attributes[$attribute_name],
174
- selected: args.attributes[$attribute_name],
175
- help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
176
- disableAlpha: $attribute_args.disableAlpha,
177
- min: $attribute_args.min,
178
- max: $attribute_args.max,
179
- multiple: $attribute_args.multiple,
180
- onChange: function (new_value) {
181
- args = onChangeEvent(new_value, name, args, block_type);
182
- },
183
- onChangeComplete: function (new_value) {
184
- args = onChangeEvent(new_value, name, args, block_type);
185
- },
186
- },
187
- )
188
- );
189
- }
190
- }
191
- });
192
-
193
- sc = create_shortcode(args, $props, 'edit');
194
-
195
- return [
196
- el(
197
- Fragment,
198
- null,
199
- el(
200
- InspectorControls,
201
- null,
202
- elements,
203
- ),
204
- sc,
205
- )];
206
- },
207
- save: function save(args) {
208
- return create_shortcode(args, $props, 'save');
209
- }
210
- });
211
- });
212
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/assets/js/yith-gutenberg.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e){wp.i18n.__;var t=wp.element.createElement,o=wp.element.Fragment,n=(wp.components.PanelBody,wp.blocks.registerBlockType),c=(wp.editor.RichText,wp.editor.BlockControls,wp.editor.InspectorControls),r=(wp.editor.AlignmentToolbar,wp.components,wp.element.RawHTML),a=wp.components.SelectControl,i=wp.components.ToggleControl,s=wp.components.CheckboxControl,l=wp.components.RangeControl,p=wp.components.ColorPicker,u=wp.components.RadioControl,d=wp.components.TextControl,h=wp.components.TextareaControl;const C=t("svg",{width:22,height:22},t("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));function b(o,n,c){var a="",i="";if("undefined"!=typeof n.callback&&"function"==typeof e[n.callback])a=e[n.callback](o,n);else{var s="["+n.shortcode_name;e.each(o.attributes,function(e,t){if("undefined"!=typeof n.attributes&&"undefined"!=typeof n.attributes[e]){s+=" "+e+"=";var o=n.attributes[e].remove_quotes;s+=1==o?t:'"'+t+'"'}}),s+="]";var l=md5(s);i='<span class="yith_block_'+l+'">'+s+"</span>","edit"==c&&0!=n.do_shortcode&&function(t){var o=null;return e(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",[s,t]),e.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:s},success:function(n){""!=(o=n)&&(e(".yith_block_"+t).html(o),e(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[s,t,o]))}}),e(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[s,t,o]),o}(l),a=t(r,null,i)}return a}function g(e,t,o,n){var c={};return"colorpicker"!=n&&"color"!=n||(e=e.hex),c[t]=e,o.setAttributes(c),o}e.each(yith_gutenberg,function(r,f){n("yith/"+r,{title:f.title,description:f.description,category:f.category,attributes:f.attributes,icon:"undefined"!=typeof f.icon?f.icon:C,keywords:f.keywords,edit:function(n){var r=new Array;return e.each(f.attributes,function(e,o){var c=null,C=o.blocktype,b=e;if(void 0!==C){switch(C){case"select":c=a;break;case"text":c=d;break;case"textarea":c=h;break;case"toggle":c=i;break;case"checkbox":c=s;break;case"number":case"range":c=l;break;case"color":case"colorpicker":c=p;break;case"radio":c=u}if(null!=c){var f=helpMessageUncheked="";"undefined"!=typeof o.helps&&"undefined"!=typeof o.helps.checked&&"undefined"!=typeof o.helps.unchecked?(f=o.helps.checked,helpMessageUncheked=o.helps.unchecked):"undefined"!=typeof o.help&&(f=helpMessageUncheked=o.help),r.push(t(c,{value:n.attributes[e],options:o.options,label:o.label,checked:n.attributes[e],selected:n.attributes[e],help:n.attributes[e]?f:helpMessageUncheked,disableAlpha:o.disableAlpha,min:o.min,max:o.max,multiple:o.multiple,onChange:function(e){n=g(e,b,n,C)},onChangeComplete:function(e){n=g(e,b,n,C)}}))}}}),sc=b(n,f,"edit"),[t(o,null,t(c,null,r),sc)]},save:function(e){return b(e,f,"save")}})})}(jQuery);
 
plugin-fw/dist/gutenberg/index.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill', 'wp-url'), 'version' => '78c76690eb3cb207e0c4cd2d0a155af6');
plugin-fw/dist/gutenberg/index.js ADDED
@@ -0,0 +1 @@
 
1
+ (window.webpackJsonp_yith_plugin_framewowrk=window.webpackJsonp_yith_plugin_framewowrk||[]).push([[1],{27:function(e,t,n){},28:function(e,t,n){}}]),function(e){function t(t){for(var r,a,l=t[0],i=t[1],s=t[2],f=0,p=[];f<l.length;f++)a=l[f],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(u&&u(t);p.length;)p.shift()();return c.push.apply(c,s||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,l=1;l<n.length;l++){var i=n[l];0!==o[i]&&(r=!1)}r&&(c.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},o={0:0},c=[];function a(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var l=window.webpackJsonp_yith_plugin_framewowrk=window.webpackJsonp_yith_plugin_framewowrk||[],i=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=i;c.push([29,1]),n()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t,n){var r=n(17),o=n(18),c=n(19),a=n(21);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||a()}},function(e,t){e.exports=window.wp.hooks},function(e,t,n){var r,o,c,a,l;r=n(22),o=n(9).utf8,c=n(23),a=n(9).bin,(l=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?a.stringToBytes(e):o.stringToBytes(e):c(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),i=8*e.length,s=1732584193,u=-271733879,f=-1732584194,p=271733878,h=0;h<n.length;h++)n[h]=16711935&(n[h]<<8|n[h]>>>24)|4278255360&(n[h]<<24|n[h]>>>8);n[i>>>5]|=128<<i%32,n[14+(i+64>>>9<<4)]=i;var b=l._ff,d=l._gg,y=l._hh,g=l._ii;for(h=0;h<n.length;h+=16){var m=s,v=u,_=f,w=p;s=b(s,u,f,p,n[h+0],7,-680876936),p=b(p,s,u,f,n[h+1],12,-389564586),f=b(f,p,s,u,n[h+2],17,606105819),u=b(u,f,p,s,n[h+3],22,-1044525330),s=b(s,u,f,p,n[h+4],7,-176418897),p=b(p,s,u,f,n[h+5],12,1200080426),f=b(f,p,s,u,n[h+6],17,-1473231341),u=b(u,f,p,s,n[h+7],22,-45705983),s=b(s,u,f,p,n[h+8],7,1770035416),p=b(p,s,u,f,n[h+9],12,-1958414417),f=b(f,p,s,u,n[h+10],17,-42063),u=b(u,f,p,s,n[h+11],22,-1990404162),s=b(s,u,f,p,n[h+12],7,1804603682),p=b(p,s,u,f,n[h+13],12,-40341101),f=b(f,p,s,u,n[h+14],17,-1502002290),s=d(s,u=b(u,f,p,s,n[h+15],22,1236535329),f,p,n[h+1],5,-165796510),p=d(p,s,u,f,n[h+6],9,-1069501632),f=d(f,p,s,u,n[h+11],14,643717713),u=d(u,f,p,s,n[h+0],20,-373897302),s=d(s,u,f,p,n[h+5],5,-701558691),p=d(p,s,u,f,n[h+10],9,38016083),f=d(f,p,s,u,n[h+15],14,-660478335),u=d(u,f,p,s,n[h+4],20,-405537848),s=d(s,u,f,p,n[h+9],5,568446438),p=d(p,s,u,f,n[h+14],9,-1019803690),f=d(f,p,s,u,n[h+3],14,-187363961),u=d(u,f,p,s,n[h+8],20,1163531501),s=d(s,u,f,p,n[h+13],5,-1444681467),p=d(p,s,u,f,n[h+2],9,-51403784),f=d(f,p,s,u,n[h+7],14,1735328473),s=y(s,u=d(u,f,p,s,n[h+12],20,-1926607734),f,p,n[h+5],4,-378558),p=y(p,s,u,f,n[h+8],11,-2022574463),f=y(f,p,s,u,n[h+11],16,1839030562),u=y(u,f,p,s,n[h+14],23,-35309556),s=y(s,u,f,p,n[h+1],4,-1530992060),p=y(p,s,u,f,n[h+4],11,1272893353),f=y(f,p,s,u,n[h+7],16,-155497632),u=y(u,f,p,s,n[h+10],23,-1094730640),s=y(s,u,f,p,n[h+13],4,681279174),p=y(p,s,u,f,n[h+0],11,-358537222),f=y(f,p,s,u,n[h+3],16,-722521979),u=y(u,f,p,s,n[h+6],23,76029189),s=y(s,u,f,p,n[h+9],4,-640364487),p=y(p,s,u,f,n[h+12],11,-421815835),f=y(f,p,s,u,n[h+15],16,530742520),s=g(s,u=y(u,f,p,s,n[h+2],23,-995338651),f,p,n[h+0],6,-198630844),p=g(p,s,u,f,n[h+7],10,1126891415),f=g(f,p,s,u,n[h+14],15,-1416354905),u=g(u,f,p,s,n[h+5],21,-57434055),s=g(s,u,f,p,n[h+12],6,1700485571),p=g(p,s,u,f,n[h+3],10,-1894986606),f=g(f,p,s,u,n[h+10],15,-1051523),u=g(u,f,p,s,n[h+1],21,-2054922799),s=g(s,u,f,p,n[h+8],6,1873313359),p=g(p,s,u,f,n[h+15],10,-30611744),f=g(f,p,s,u,n[h+6],15,-1560198380),u=g(u,f,p,s,n[h+13],21,1309151649),s=g(s,u,f,p,n[h+4],6,-145523070),p=g(p,s,u,f,n[h+11],10,-1120210379),f=g(f,p,s,u,n[h+2],15,718787259),u=g(u,f,p,s,n[h+9],21,-343485551),s=s+m>>>0,u=u+v>>>0,f=f+_>>>0,p=p+w>>>0}return r.endian([s,u,f,p])})._ff=function(e,t,n,r,o,c,a){var l=e+(t&n|~t&r)+(o>>>0)+a;return(l<<c|l>>>32-c)+t},l._gg=function(e,t,n,r,o,c,a){var l=e+(t&r|n&~r)+(o>>>0)+a;return(l<<c|l>>>32-c)+t},l._hh=function(e,t,n,r,o,c,a){var l=e+(t^n^r)+(o>>>0)+a;return(l<<c|l>>>32-c)+t},l._ii=function(e,t,n,r,o,c,a){var l=e+(n^(t|~r))+(o>>>0)+a;return(l<<c|l>>>32-c)+t},l._blocksize=16,l._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(l(e,t));return t&&t.asBytes?n:t&&t.asString?a.bytesToString(n):r.bytesToHex(n)}},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.compose},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=n},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(24);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(25),o=n(26);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t){e.exports=window.lodash},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw c}}return n}}},function(e,t,n){var r=n(20);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){var n,r;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&r.rotl(e,8)|4278255360&r.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=r.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],r=0;r<e.length;r+=3)for(var o=e[r]<<16|e[r+1]<<8|e[r+2],c=0;c<4;c++)8*r+6*c<=8*e.length?t.push(n.charAt(o>>>6*(3-c)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],r=0,o=0;r<e.length;o=++r%4)0!=o&&t.push((n.indexOf(e.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|n.indexOf(e.charAt(r))>>>6-2*o);return t}},e.exports=r},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},,,function(e,t,n){"use strict";n.r(t);var r=n(3),o=n.n(r),c=n(0),a=n(2),l=n(5),i=n.n(l),s=n(10),u=n(11);function f(e){if(e.status>=200&&e.status<300)return e;throw e}function p(e){return e.json?e.json():e.text()}var h=Object(c.createElement)("svg",{viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",role:"img","aria-hidden":"true",focusable:"false"},Object(c.createElement)("path",{width:"22",height:"22",d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})),b=function(e,t){var n=e.controlType,r=!0;if(e.deps&&e.deps.id&&"value"in e.deps){var o=e.deps.value;"toggle"!==n&&"checkbox"!==n||(o=!0===o||"yes"===o||1===o),r=void 0!==t[e.deps.id]&&o===t[e.deps.id]}return r},d=function(e,t){var n="",r=!1;if(void 0!==e.callback&&(jQuery&&e.callback in jQuery.fn?r=jQuery.fn[e.callback]:e.callback in window&&(r=window[e.callback])),"function"==typeof r)n=r(t,e);else{var c=e.attributes?Object.entries(e.attributes).map((function(e){var n=o()(e,2),r=n[0],c=n[1],a=b(c,t),l=t[r];if(a&&void 0!==l)return r+"="+(c.remove_quotes?l:'"'.concat(l,'"'))})):[],a=c.length?" "+c.join(" "):"";n="[".concat(e.shortcode_name).concat(a,"]")}return n},y=n(1),g=n(6),m=n(12),v=n.n(m),_=n(13),w=n.n(_),j=n(14),x=n.n(j),O=n(15),C=n.n(O),k=n(8),E=n.n(k),S=n(16),T=n(4);n(27);var A=function(e){x()(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=E()(t);if(n){var o=E()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return C()(this,e)});function o(){var e;return v()(this,o),(e=r.apply(this,arguments)).state={html:"",shortcode:"",shortcodeHash:"",ajaxUpdated:!1,ajaxSuccess:!1,ajaxResponse:!1,loading:!1},e.ajaxTimeout=!1,e}return w()(o,[{key:"componentDidMount",value:function(){this.updateShortcode()}},{key:"componentDidUpdate",value:function(e,t,n){var r=this.state,o=r.shortcode,c=r.shortcodeHash,a=r.ajaxSuccess,l=r.ajaxResponse,i=r.ajaxUpdated;Object(S.isEqual)(e,this.props)||this.updateShortcode(),this.props.blockArgs.do_shortcode&&i&&(a&&Object(T.doAction)("yith_plugin_fw_gutenberg_success_do_shortcode",o,c,l),Object(T.doAction)("yith_plugin_fw_gutenberg_after_do_shortcode",o,c,l),this.setState({ajaxUpdated:!1}))}},{key:"updateShortcode",value:function(){var e=this,t=this.props,n=t.attributes,r=t.blockArgs;this.setState({loading:!0,ajaxSuccess:!1,ajaxResponse:!1});var o=d(r,n),c=i()(o);r.do_shortcode?(this.ajaxTimeout&&clearTimeout(this.ajaxTimeout),Object(T.doAction)("yith_plugin_fw_gutenberg_before_do_shortcode",o,c),this.ajaxTimeout=setTimeout((function(){(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yithGutenberg.ajaxurl;return t=Object(u.addQueryArgs)(t,e),fetch(t).then(f).then(p)})({action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:o}).then((function(t){e.setState({loading:!1,html:t.html,shortcode:o,shortcodeHash:c,ajaxSuccess:!0,ajaxUpdated:!0,ajaxResponse:t})})).catch((function(e){console.log({error:e})}))}),300)):this.setState({loading:!1,html:o,shortcode:o,shortcodeHash:c})}},{key:"render",value:function(){var e=this.state,t=e.html,n=e.loading,r=e.shortcode,o=e.shortcodeHash,a=this.props.blockArgs,l=a.do_shortcode,i=a.title,s=a.empty_message,u="block-editor-yith-plugin-fw-shortcode-block",f=[u],p=l?"html":"shortcode",b=t,d="";l&&!t&&(p="empty-html",b=r,s&&(d=s));var g=["shortcode","empty-html"].includes(p),m="empty-html"!==p,v=!!d;return f.push("".concat(u,"--").concat(p)),f.push("".concat(u,v?"--has-message":"--no-message")),f.push("yith_block_".concat(o)),Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:f.join(" ")},n?Object(c.createElement)("div",{className:"".concat(u,"__spinner-wrap")},Object(c.createElement)(y.Spinner,null)):"",g&&Object(c.createElement)("div",{className:"".concat(u,"__title components-placeholder__label")},h,i),v&&Object(c.createElement)(c.RawHTML,{className:"".concat(u,"__message")},d),m&&Object(c.createElement)(c.RawHTML,{className:"".concat(u,"__content")},b)))}}]),o}(a.Component),B=n(7);function N(e){var t=e.className,n=e.label,r=e.onChange,o=e.value,a=e.help,l=e.disableAlpha,i=Object(B.useInstanceId)(N),s="inspector-yith-color-picker-control-".concat(i);return Object(c.createElement)(y.BaseControl,{id:s,label:n,className:"block-editor-yith-color-control ".concat(t),help:a},Object(c.createElement)(y.ColorPicker,{color:o,disableAlpha:l,onChangeComplete:r}))}function R(e){var t=e.label,n=e.colorValue;return Object(c.createElement)(c.Fragment,null,t,!!n&&Object(c.createElement)(y.ColorIndicator,{colorValue:n}))}function P(e){var t=e.className,n=e.label,r=e.onChange,o=e.value,a=e.help,l=e.palette,i=e.clearable;l=l||Object(g.__experimentalUseEditorFeature)("color.palette");var s=Object(B.useInstanceId)(P),u="inspector-yith-color-palette-control-".concat(s);return Object(c.createElement)(y.BaseControl,{id:u,className:"block-editor-yith-color-palette-control ".concat(t),help:a},Object(c.createElement)("fieldset",null,Object(c.createElement)("legend",null,Object(c.createElement)("div",{className:"block-editor-yith-color-palette-control__color-indicator"},Object(c.createElement)(y.BaseControl.VisualLabel,null,Object(c.createElement)(R,{colorValue:o,label:n})))),Object(c.createElement)(y.ColorPalette,{value:o,onChange:r,colors:l,clearable:i})))}n(28);for(var M=function(e,t){return function(n){var r=n.attributes,a=(n.className,n.setAttributes),l=function(e,t,n){["colorpicker","color"].includes(n)&&(e=e.color.getAlpha()<1?e.color.toRgbString():e.color.toHexString());var r={};r[t]=e,a(r)};return Object(c.createElement)(c.Fragment,null,!!t.attributes&&Object(c.createElement)(g.InspectorControls,null,Object(c.createElement)(y.PanelBody,null,Object.entries(t.attributes).map((function(t){var n=o()(t,2),a=function(t,n){var o=n.controlType,a=r[t],i=function(e,t){var n="";return e.helps&&e.helps.checked&&e.helps.unchecked?n=t?e.helps.checked:e.helps.unchecked:e.help&&(n=e.help),n}(n,a),s="".concat(e,"__").concat(t,"-field-wrapper"),u=b(n,r);n.wrapper_class&&(s+=" "+n.wrapper_class);var f=!1;if(u)switch(o){case"select":f=Object(c.createElement)(y.SelectControl,{className:s,key:t,value:a,label:n.label,options:n.options,selected:a,help:i,multiple:!!n.multiple,onChange:function(e){l(e,t,o)}});break;case"text":f=Object(c.createElement)(y.TextControl,{className:s,key:t,value:a,label:n.label,help:i,onChange:function(e){l(e,t,o)}});break;case"textarea":f=Object(c.createElement)(y.TextareaControl,{className:s,key:t,value:a,label:n.label,help:i,onChange:function(e){l(e,t,o)}});break;case"toggle":f=Object(c.createElement)(y.ToggleControl,{className:s,key:t,value:a,label:n.label,help:i,checked:a,onChange:function(e){l(e,t,o)}});break;case"checkbox":f=Object(c.createElement)(y.CheckboxControl,{className:s,key:t,value:a,label:n.label,help:i,checked:a,onChange:function(e){l(e,t,o)}});break;case"number":case"range":f=Object(c.createElement)(y.RangeControl,{className:s,key:t,value:a,label:n.label,help:i,min:n.min,max:n.max,onChange:function(e){l(e,t,o)}});break;case"color":case"colorpicker":f=Object(c.createElement)(N,{className:s,key:t,label:n.label,help:i,value:a,disableAlpha:n.disableAlpha,onChange:function(e){l(e,t,o)}});break;case"color-palette":f=Object(c.createElement)(P,{className:s,key:t,label:n.label,help:i,value:a,clearable:n.clearable||!1,onChange:function(e){l(e,t,o)}});break;case"radio":f=Object(c.createElement)(y.RadioControl,{key:t,value:a,label:n.label,options:n.options,selected:a,checked:a,help:i,onChange:function(e){l(e,t,o)}});break;default:f=!1}return f}(n[0],n[1]);if(a)return a})))),Object(c.createElement)(A,{attributes:r,blockArgs:t}))}},I=function(){var e=U[H];Object(T.addAction)(e,"yith-plugin-fw/jquery-events",(function(){if("jQuery"in window){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];jQuery(document).trigger(e,Object.values(n))}}))},H=0,U=["yith_plugin_fw_gutenberg_before_do_shortcode","yith_plugin_fw_gutenberg_success_do_shortcode","yith_plugin_fw_gutenberg_after_do_shortcode"];H<U.length;H++)I();for(var L=function(){var e=o()(F[Q],2),t=e[0],n=e[1];Object(s.registerBlockType)("yith/"+t,{title:n.title,description:n.description,category:n.category,attributes:n.attributes,icon:void 0!==n.icon?n.icon:h,keywords:n.keywords,edit:M(t,n),save:function(e){var t=e.attributes;return d(n,t)},deprecated:[{attributes:n.attributes,save:function(e){var t=e.attributes,r=d(n,t),o='<span class="yith_block_'+i()(r)+'">'+r+"</span>";return Object(c.createElement)(c.RawHTML,null,o)}}]})},Q=0,F=Object.entries(yithGutenbergBlocks);Q<F.length;Q++)L()}]);
plugin-fw/dist/gutenberg/style-index.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ .block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--empty-html,.block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--shortcode{padding:1em 1em 1.2em;border:1px solid #1e1e1e;border-radius:4px}.block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--shortcode .block-editor-yith-plugin-fw-shortcode-block__content{font-family:Menlo,Consolas,monaco,monospace;color:#1e1e1e;font-size:13px;padding:.8em 1em;border:1px solid #ddd;border-radius:4px}.block-editor-yith-plugin-fw-shortcode-block{position:relative;min-height:30px}.block-editor-yith-plugin-fw-shortcode-block .block-editor-yith-plugin-fw-shortcode-block__spinner-wrap{position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%)}.block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--empty-html.block-editor-yith-plugin-fw-shortcode-block--no-message .block-editor-yith-plugin-fw-shortcode-block__title{margin-bottom:0}.block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--empty-html .block-editor-yith-plugin-fw-shortcode-block__message{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-style:italic;font-size:13px}.block-editor-yith-plugin-fw-shortcode-block.block-editor-yith-plugin-fw-shortcode-block--empty-html .block-editor-yith-plugin-fw-shortcode-block__content{display:none}
2
+ .block-editor-yith-color-palette-control .block-editor-yith-color-palette-control__color-indicator{margin-bottom:12px}.block-editor-yith-color-palette-control .component-color-indicator{vertical-align:text-bottom}
plugin-fw/includes/builders/elementor/class-yith-elementor-widget.php ADDED
@@ -0,0 +1,464 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Elementor Widget Skeleton Class.
4
+ *
5
+ * @class YITH_Elementor_Widget
6
+ * @package YITH\PluginFramework\Classes
7
+ * @since 3.6.0
8
+ */
9
+
10
+ use Elementor\Controls_Manager;
11
+ use Elementor\Plugin;
12
+ use Elementor\Widget_Base;
13
+
14
+ defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
15
+
16
+ if ( ! class_exists( 'YITH_Elementor_Widget' ) ) {
17
+ /**
18
+ * YITH_Elementor_Widget class.
19
+ *
20
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
21
+ */
22
+ class YITH_Elementor_Widget extends Widget_Base {
23
+
24
+ /**
25
+ * YITH Data.
26
+ *
27
+ * @var array
28
+ */
29
+ protected $yith_data = array();
30
+
31
+ /**
32
+ * Widget constructor.
33
+ *
34
+ * @param array $data Widget data. Default is an empty array.
35
+ * @param array|null $args Optional. Widget default arguments. Default is null.
36
+ *
37
+ * @throws Exception If arguments are missing when initializing a full widget instance.
38
+ */
39
+ public function __construct( $data = array(), $args = null ) {
40
+ $this->yith_data = $args['yith_data'];
41
+ $this->init_yith_data();
42
+
43
+ parent::__construct( $data, $args );
44
+ }
45
+
46
+ /**
47
+ * Retrieve an YITH prop.
48
+ *
49
+ * @param string $prop The prop.
50
+ * @param bool|string|array $default Default value.
51
+ *
52
+ * @return mixed|string
53
+ */
54
+ public function get_yith_prop( $prop, $default = null ) {
55
+ if ( is_null( $default ) ) {
56
+ $defaults = $this->get_yith_data_defaults();
57
+ $default = array_key_exists( $prop, $defaults ) ? $defaults[ $prop ] : false;
58
+ }
59
+
60
+ return array_key_exists( $prop, $this->yith_data ) ? $this->yith_data[ $prop ] : $default;
61
+ }
62
+
63
+ /**
64
+ * Get element name.
65
+ *
66
+ * @return string
67
+ */
68
+ public function get_name() {
69
+ return $this->get_yith_prop( 'name', '' );
70
+ }
71
+
72
+ /**
73
+ * Get the element title.
74
+ *
75
+ * @return string
76
+ */
77
+ public function get_title() {
78
+ return $this->get_yith_prop( 'title', '' );
79
+ }
80
+
81
+ /**
82
+ * Get the element icon.
83
+ *
84
+ * @return string
85
+ */
86
+ public function get_icon() {
87
+ return $this->get_yith_prop( 'icon', 'yith-icon yith-icon-yith' );
88
+ }
89
+
90
+ /**
91
+ * Get widget categories.
92
+ *
93
+ * @return array Widget categories.
94
+ */
95
+ public function get_categories() {
96
+ return array( 'yith' ) + (array) $this->get_yith_prop( 'categories', array() );
97
+ }
98
+
99
+ /**
100
+ * Register the widget controls.
101
+ */
102
+ public function _register_controls() { // phpcs:ignore
103
+ $options = $this->get_yith_prop( 'options' );
104
+ $description = $this->get_yith_prop( 'description' );
105
+
106
+ if ( $options ) {
107
+ $this->start_controls_section(
108
+ 'options',
109
+ array(
110
+ 'label' => $this->get_yith_prop( 'section_title' ),
111
+ 'tab' => Controls_Manager::TAB_CONTENT,
112
+ )
113
+ );
114
+
115
+ if ( $description ) {
116
+ $this->add_control(
117
+ 'description',
118
+ array(
119
+ 'type' => Controls_Manager::RAW_HTML,
120
+ 'raw' => $description,
121
+ 'content_classes' => 'yith-plugin-fw-elementor-widget-description',
122
+ )
123
+ );
124
+ }
125
+
126
+ foreach ( $options as $option ) {
127
+ if ( ! isset( $option['type'] ) ) {
128
+ continue;
129
+ }
130
+
131
+ $this->add_control( $option['yith_key'], $option );
132
+ }
133
+
134
+ $this->end_controls_section();
135
+ } elseif ( $description ) {
136
+ $this->start_controls_section(
137
+ 'options',
138
+ array(
139
+ 'label' => $this->get_title(),
140
+ 'tab' => Controls_Manager::TAB_CONTENT,
141
+ )
142
+ );
143
+ $this->add_control(
144
+ 'description',
145
+ array(
146
+ 'type' => Controls_Manager::RAW_HTML,
147
+ 'raw' => $description,
148
+ 'content_classes' => 'yith-plugin-fw-elementor-widget-description',
149
+ )
150
+ );
151
+
152
+ $this->end_controls_section();
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Render the content of the widget
158
+ */
159
+ protected function render() {
160
+ $settings = $this->get_settings_for_display();
161
+ $option_values = $this->get_yith_option_values();
162
+ $options = $this->get_yith_prop( 'options' );
163
+ $shortcode_name = $this->get_yith_prop( 'shortcode_name' );
164
+ $do_shortcode = ! ! $this->get_yith_prop( 'do_shortcode' );
165
+ $render_cb = $this->get_yith_prop( 'render_cb' );
166
+ $editor_render_cb = $this->get_yith_prop( 'editor_render_cb' );
167
+ $empty_message = $this->get_yith_prop( 'empty_message', '' );
168
+
169
+ if ( Plugin::$instance->editor->is_edit_mode() && $editor_render_cb && is_callable( $editor_render_cb ) ) {
170
+ echo call_user_func( $editor_render_cb, $option_values ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
171
+ } elseif ( $render_cb && is_callable( $render_cb ) ) {
172
+ echo call_user_func( $render_cb, $option_values ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
173
+ } else {
174
+ $shortcode_attrs = array();
175
+
176
+ foreach ( $options as $option ) {
177
+ $display_key = $option['yith_display_key'];
178
+ $value = isset( $option_values[ $display_key ] ) ? $option_values[ $display_key ] : null;
179
+ $show = $this->is_control_visible( $option, $settings );
180
+
181
+ if ( $show && ! is_null( $value ) && '' !== $value ) {
182
+ $value = is_array( $value ) ? implode( ',', $value ) : $value;
183
+ $shortcode_value = ! empty( $option['remove_quotes'] ) ? $value : ( '"' . $value . '"' );
184
+ $shortcode_attrs[] = $display_key . '=' . $shortcode_value;
185
+ }
186
+ }
187
+
188
+ $shortcode_attrs = implode( ' ', $shortcode_attrs );
189
+ $shortcode = "[{$shortcode_name} {$shortcode_attrs}]";
190
+
191
+ if ( Plugin::$instance->editor->is_edit_mode() ) {
192
+ $html = esc_html( $shortcode );
193
+ if ( $do_shortcode ) {
194
+ do_action( 'yith_plugin_fw_elementor_editor_before_do_shortcode', $shortcode, $this );
195
+ $html = do_shortcode( apply_filters( 'yith_plugin_fw_elementor_editor_shortcode', $shortcode, $this ) );
196
+ do_action( 'yith_plugin_fw_elementor_editor_after_do_shortcode', $shortcode, $this );
197
+ }
198
+ $type = $do_shortcode ? 'html' : 'shortcode';
199
+ $html_to_show = $html;
200
+ $message = '';
201
+
202
+ if ( $do_shortcode && $empty_message && ! $html ) {
203
+ $type = 'empty-html';
204
+ $html_to_show = esc_html( $shortcode );
205
+ $message = $empty_message;
206
+ }
207
+
208
+ $show_title = in_array( $type, array( 'shortcode', 'empty-html' ), true );
209
+ $show_content = 'empty-html' !== $type;
210
+ ?>
211
+ <div class="yith-plugin-fw-elementor-shortcode-widget yith-plugin-fw-elementor-shortcode-widget--<?php echo esc_attr( $type ); ?>">
212
+ <?php if ( $show_title ) : ?>
213
+ <div class="yith-plugin-fw-elementor-shortcode-widget__title">
214
+ <?php echo esc_html( $this->get_title() ); ?>
215
+ </div>
216
+ <?php endif; ?>
217
+ <?php if ( $message ) : ?>
218
+ <div class="yith-plugin-fw-elementor-shortcode-widget__message">
219
+ <?php echo wp_kses_post( $message ); ?>
220
+ </div>
221
+ <?php endif; ?>
222
+ <?php if ( $show_content ) : ?>
223
+ <div class="yith-plugin-fw-elementor-shortcode-widget__content">
224
+ <?php echo $html_to_show; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
225
+ </div>
226
+ <?php endif; ?>
227
+ </div>
228
+ <?php
229
+ } else {
230
+ do_action( 'yith_plugin_fw_elementor_before_do_shortcode', $shortcode, $this );
231
+ echo do_shortcode( apply_filters( 'yith_plugin_fw_elementor_shortcode', $shortcode, $this ) );
232
+ do_action( 'yith_plugin_fw_elementor_after_do_shortcode', $shortcode, $this );
233
+ }
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Retrieve the YITH Data defaults.
239
+ *
240
+ * @return array
241
+ */
242
+ public function get_yith_data_defaults() {
243
+ return array(
244
+ 'map_from_gutenberg' => false,
245
+ 'shortcode_name' => '',
246
+ 'do_shortcode' => true,
247
+ 'render_cb' => false,
248
+ 'editor_render_cb' => false,
249
+ 'options' => array(),
250
+ 'section_title' => sprintf(
251
+ // translators: %s it the Elementor Widget title.
252
+ _x( '%s - Options', 'Elementor Widget - section title', 'yith-plugin-fw' ),
253
+ $this->get_title()
254
+ ),
255
+ );
256
+ }
257
+
258
+ /**
259
+ * Retrieve YITH options with their values.
260
+ */
261
+ protected function get_yith_option_values() {
262
+ $settings = $this->get_settings_for_display();
263
+ $map_from_gutenberg = $this->get_yith_prop( 'map_from_gutenberg' );
264
+ $options = $this->get_yith_prop( 'options' );
265
+ $option_values = array();
266
+
267
+ foreach ( $options as $option ) {
268
+ $value = isset( $option['default'] ) ? $option['default'] : null;
269
+ $key = $option['yith_key'];
270
+ $display_key = $option['yith_display_key'];
271
+
272
+ if ( isset( $settings[ $key ] ) ) {
273
+ $value = $settings[ $key ];
274
+ }
275
+
276
+ if ( isset( $option['type'] ) && Controls_Manager::SWITCHER === $option['type'] ) {
277
+ $yes_no_values = isset( $option['yes_no_values'] ) ? $option['yes_no_values'] : ! $map_from_gutenberg;
278
+ if ( false === $yes_no_values ) {
279
+ $yes_no_values = array( 'true', 'false' );
280
+ } elseif ( ! is_array( $yes_no_values ) || 2 !== count( $yes_no_values ) ) {
281
+ $yes_no_values = array( 'yes', 'no' );
282
+ }
283
+
284
+ $value = 'yes' === $value ? $yes_no_values[0] : $yes_no_values[1];
285
+ }
286
+
287
+ $option_values[ $display_key ] = $value;
288
+ }
289
+
290
+ return $option_values;
291
+ }
292
+
293
+ /**
294
+ * YITH Data Initialization.
295
+ */
296
+ protected function init_yith_data() {
297
+ $data = wp_parse_args( $this->yith_data, $this->get_yith_data_defaults() );
298
+
299
+ if ( ! ! $data['map_from_gutenberg'] ) {
300
+ $data = $this->override_elementor_specific_data( $data );
301
+
302
+ if ( ! $data['options'] && ! empty( $data['attributes'] ) && is_array( $data['attributes'] ) ) {
303
+ $data['options'] = $data['attributes'];
304
+ unset( $data['attributes'] );
305
+ }
306
+
307
+ if ( $data['options'] ) {
308
+ $data['options'] = array_map( array( $this, 'map_option_from_gutenberg' ), $data['options'] );
309
+ }
310
+ }
311
+
312
+ $data['options'] = $this->validate_yith_options( $data['options'] );
313
+
314
+ $this->yith_data = $data;
315
+ }
316
+
317
+ /**
318
+ * Validate field types
319
+ *
320
+ * @param array $options The options.
321
+ *
322
+ * @return array|false The validate option array; false if the type is not set.
323
+ */
324
+ protected function validate_yith_options( $options ) {
325
+ foreach ( $options as $key => &$option ) {
326
+ if ( ! isset( $option['type'] ) ) {
327
+ unset( $options[ $key ] );
328
+ continue;
329
+ }
330
+
331
+ // Let's fix the option type.
332
+ if ( in_array( $option['type'], array( 'toggle', 'onoff', 'checkbox' ), true ) ) {
333
+ $option['type'] = Controls_Manager::SWITCHER;
334
+
335
+ if ( isset( $option['default'] ) && is_bool( $option['default'] ) ) {
336
+ $option['default'] = yith_plugin_fw_is_true( $option['default'] ) ? 'yes' : 'no';
337
+ }
338
+ } elseif ( in_array( $option['type'], array( 'radio' ), true ) ) {
339
+ $option['type'] = Controls_Manager::SELECT;
340
+ } elseif ( in_array( $option['type'], array( 'color', 'colorpicker', 'color-palette' ), true ) ) {
341
+ $option['type'] = Controls_Manager::COLOR;
342
+ } elseif ( in_array( $option['type'], array( 'select' ), true ) && ! empty( $option['multiple'] ) ) {
343
+ $option['type'] = Controls_Manager::SELECT2;
344
+ }
345
+
346
+ // Set the key, used to store the option, and the display_key, used in the render method.
347
+ $option['yith_key'] = $this->maybe_prefix_yith_key( $key );
348
+ if ( ! isset( $option['yith_display_key'] ) ) {
349
+ $option['yith_display_key'] = $key;
350
+ }
351
+
352
+ // Auto-set the block_label to display label in a separate line.
353
+ if ( ! isset( $option['label_block'] ) ) {
354
+ $option['label_block'] = true;
355
+ }
356
+ }
357
+
358
+ return $options;
359
+ }
360
+
361
+ /**
362
+ * Override Elementor specific data if exists.
363
+ * This allows setting/overriding specific values for Elementor.
364
+ *
365
+ * @param array $data The data array.
366
+ *
367
+ * @return array
368
+ */
369
+ protected function override_elementor_specific_data( $data ) {
370
+ $elementor_data = array_filter(
371
+ $data,
372
+ function ( $key ) {
373
+ return 'elementor_' === substr( $key, 0, 10 );
374
+ },
375
+ ARRAY_FILTER_USE_KEY
376
+ );
377
+
378
+ $elementor_data = array_combine(
379
+ array_map(
380
+ function ( $key ) {
381
+ return substr( $key, 10 );
382
+ },
383
+ array_keys( $elementor_data )
384
+ ),
385
+ array_values( $elementor_data )
386
+ );
387
+
388
+ $data = array_merge( $data, $elementor_data );
389
+
390
+ return $data;
391
+ }
392
+
393
+ /**
394
+ * Map an option from Gutenberg
395
+ *
396
+ * @param array $option The option array.
397
+ *
398
+ * @return array
399
+ */
400
+ protected function map_option_from_gutenberg( $option ) {
401
+ $option = $this->override_elementor_specific_data( $option );
402
+ $type = isset( $option['type'] ) ? $option['type'] : false;
403
+
404
+ if ( isset( $option['deps'], $option['deps']['id'], $option['deps']['value'] ) && ! isset( $option['condition'] ) ) {
405
+
406
+ $value = $option['deps']['value'];
407
+ if ( in_array( $type, array( 'toggle', 'onoff', 'checkbox' ), true ) ) {
408
+ $value = yith_plugin_fw_is_true( $value ) ? 'yes' : 'no';
409
+ }
410
+ $option['condition'] = array(
411
+ $option['deps']['id'] => $value,
412
+ );
413
+ unset( $option['deps'] );
414
+ }
415
+
416
+ switch ( $type ) {
417
+ case 'color':
418
+ case 'colorpicker':
419
+ if ( ! isset( $option['alpha'] ) ) {
420
+ $option['alpha'] = isset( $option['disableAlpha'] ) ? ! $option['disableAlpha'] : false;
421
+ }
422
+
423
+ break;
424
+ case 'color-palette':
425
+ $option['alpha'] = false;
426
+ break;
427
+ }
428
+
429
+ if ( isset( $option['help'] ) && ! isset( $option['description'] ) ) {
430
+ $option['description'] = $option['help'];
431
+ unset( $option['help'] );
432
+ }
433
+
434
+ return $option;
435
+ }
436
+
437
+ /**
438
+ * Return the YITH key prefix.
439
+ *
440
+ * @return string
441
+ */
442
+ public function get_yith_key_prefix() {
443
+ return '_yith_';
444
+ }
445
+
446
+ /**
447
+ * Add YITH prefix to a specific key.
448
+ *
449
+ * @param string $key The key to be prefixed.
450
+ *
451
+ * @return string
452
+ */
453
+ public function maybe_prefix_yith_key( $key ) {
454
+ $reserved_keys = array( 'id', 'elType', 'settings', 'elements', 'isInner' );
455
+ if ( in_array( $key, $reserved_keys, true ) ) {
456
+ $prefix = $this->get_yith_key_prefix();
457
+
458
+ $key = substr( $key, 0, strlen( $prefix ) ) === $prefix ? $key : ( $prefix . $key );
459
+ }
460
+
461
+ return $key;
462
+ }
463
+ }
464
+ }
plugin-fw/includes/builders/elementor/class-yith-elementor.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Elementor Class.
4
+ *
5
+ * @class YITH_Elementor
6
+ * @package YITH\PluginFramework\Classes
7
+ * @since 3.6.0
8
+ */
9
+
10
+ defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
11
+
12
+ if ( ! class_exists( 'YITH_Elementor' ) ) {
13
+ /**
14
+ * YITH_Elementor class.
15
+ *
16
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
17
+ */
18
+ class YITH_Elementor {
19
+
20
+ /**
21
+ * The single instance of the class.
22
+ *
23
+ * @var YITH_Elementor
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * The registered widgets.
29
+ *
30
+ * @var array
31
+ */
32
+ private $widgets;
33
+
34
+ /**
35
+ * Singleton implementation.
36
+ *
37
+ * @return YITH_Elementor
38
+ */
39
+ public static function instance() {
40
+ return ! is_null( self::$instance ) ? self::$instance : self::$instance = new self();
41
+ }
42
+
43
+ /**
44
+ * YITH_Elementor constructor.
45
+ */
46
+ private function __construct() {
47
+ if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) {
48
+ add_action( 'init', array( $this, 'init' ), 20 );
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Register Elementor widget
54
+ *
55
+ * @param string $widget_name The widget name.
56
+ * @param array $widget_options The widget options.
57
+ */
58
+ public function register_widget( $widget_name, $widget_options ) {
59
+ if ( ! isset( $widget_options['name'] ) ) {
60
+ $widget_options['name'] = $widget_name;
61
+ }
62
+ $this->widgets[ $widget_name ] = $widget_options;
63
+ }
64
+
65
+ /**
66
+ * Let's start with Elementor
67
+ */
68
+ public function init() {
69
+ if ( $this->widgets ) {
70
+ $this->load_files();
71
+ add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
72
+ add_action( 'elementor/elements/categories_registered', array( $this, 'add_yith_category' ) );
73
+
74
+ add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'enqueue_styles' ) );
75
+ add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'enqueue_styles' ) );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Load files
81
+ */
82
+ private function load_files() {
83
+ require_once 'class-yith-elementor-widget.php';
84
+ }
85
+
86
+ /**
87
+ * Register Elementor Widgets
88
+ */
89
+ public function register_widgets() {
90
+ foreach ( $this->widgets as $widget ) {
91
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new YITH_Elementor_Widget( array(), array( 'yith_data' => $widget ) ) );
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Add "YITH" group for Elementor widgets
97
+ *
98
+ * @param Elementor\Elements_Manager $elements_manager Elements Manager.
99
+ */
100
+ public function add_yith_category( $elements_manager ) {
101
+ $elements_manager->add_category(
102
+ 'yith',
103
+ array(
104
+ 'title' => 'YITH',
105
+ 'icon' => 'fa fa-plug',
106
+ 'active' => false,
107
+ )
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Enqueue styles in elementor
113
+ */
114
+ public function enqueue_styles() {
115
+ if ( \Elementor\Plugin::$instance->preview->is_preview_mode() || \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
116
+ wp_enqueue_style( 'yith-plugin-fw-icon-font' );
117
+ wp_enqueue_style( 'yith-plugin-fw-elementor' );
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ YITH_Elementor::instance();
plugin-fw/includes/{class-yith-gutenberg.php → builders/gutenberg/class-yith-gutenberg.php} RENAMED
@@ -64,30 +64,46 @@ if ( ! class_exists( 'YITH_Gutenberg' ) ) {
64
  * YITH_Gutenberg constructor.
65
  */
66
  private function __construct() {
 
67
  add_action( 'init', array( $this, 'register_blocks' ), 30 );
68
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
69
  add_action( 'wp_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
70
  add_action( 'wc_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
71
  }
72
 
 
 
 
 
 
 
 
73
  /**
74
  * Enqueue scripts for gutenberg
75
  */
76
  public function enqueue_block_editor_assets() {
77
- $ajax_url = function_exists( 'WC' ) ? add_query_arg( 'wc-ajax', 'yith_plugin_fw_gutenberg_do_shortcode', trailingslashit( site_url() ) ) : admin_url( 'admin-ajax.php' );
78
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
79
- $deps = apply_filters(
80
- 'yith_plugin_fw_gutenberg_script_deps',
81
- array(
82
- 'wp-blocks',
83
- 'wp-element',
84
- 'yith-js-md5',
85
- )
 
 
 
86
  );
87
- wp_register_script( 'yith-js-md5', YIT_CORE_PLUGIN_URL . '/assets/js/javascript-md5/md5.min.js', array(), '2.10.0', true );
88
- wp_enqueue_script( 'yith-gutenberg', YIT_CORE_PLUGIN_URL . '/assets/js/yith-gutenberg' . $suffix . '.js', $deps, yith_plugin_fw_get_version(), true );
89
- wp_localize_script( 'yith-gutenberg', 'yith_gutenberg', $this->blocks_args );
90
- wp_localize_script( 'yith-gutenberg', 'yith_gutenberg_ajax', array( 'ajaxurl' => $ajax_url ) );
 
 
 
 
 
91
  }
92
 
93
  /**
@@ -224,12 +240,10 @@ if ( ! class_exists( 'YITH_Gutenberg' ) ) {
224
  $args[ $block ]['category'] = $this->get_default_blocks_category_slug();
225
  }
226
 
 
 
227
  if ( isset( $block_args['attributes'] ) ) {
228
  foreach ( $block_args['attributes'] as $attr_name => $attributes ) {
229
- // Set the do_shortcode args.
230
- if ( ! empty( $attributes['do_shortcode'] ) ) {
231
- $args[ $block ]['attributes'][ $attr_name ] = true;
232
- }
233
 
234
  if ( ! empty( $attributes['options'] ) && is_array( $attributes['options'] ) ) {
235
  $options = array();
@@ -249,8 +263,8 @@ if ( ! class_exists( 'YITH_Gutenberg' ) ) {
249
 
250
  // Special Requirements for Block Type.
251
  if ( ! empty( $attributes['type'] ) ) {
252
- $args[ $block ]['attributes'][ $attr_name ]['blocktype'] = $attributes['type'];
253
- $args[ $block ]['attributes'][ $attr_name ]['type'] = 'string';
254
 
255
  switch ( $attributes['type'] ) {
256
  case 'select':
@@ -293,20 +307,23 @@ if ( ! class_exists( 'YITH_Gutenberg' ) ) {
293
  * Get a do_shortcode in ajax call to show block preview
294
  **/
295
  public function do_shortcode() {
296
- // phpcs:disable WordPress.Security.NonceVerification.Missing
297
  $current_action = current_action();
298
- $shortcode = ! empty( $_POST['shortcode'] ) ? wp_unslash( $_POST['shortcode'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
299
 
300
  if ( ! apply_filters( 'yith_plugin_fw_gutenberg_skip_shortcode_sanitize', false ) ) {
301
  $shortcode = sanitize_text_field( stripslashes( $shortcode ) );
302
  }
303
 
 
 
304
  do_action( 'yith_plugin_fw_gutenberg_before_do_shortcode', $shortcode, $current_action );
305
  echo do_shortcode( apply_filters( 'yith_plugin_fw_gutenberg_shortcode', $shortcode, $current_action ) );
306
  do_action( 'yith_plugin_fw_gutenberg_after_do_shortcode', $shortcode, $current_action );
307
 
 
308
  if ( is_ajax() ) {
309
- die();
310
  }
311
 
312
  // phpcs:enable
64
  * YITH_Gutenberg constructor.
65
  */
66
  private function __construct() {
67
+ add_action( 'init', array( $this, 'init' ) );
68
  add_action( 'init', array( $this, 'register_blocks' ), 30 );
69
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
70
  add_action( 'wp_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
71
  add_action( 'wc_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
72
  }
73
 
74
+ /**
75
+ * Initialization
76
+ */
77
+ public function init() {
78
+
79
+ }
80
+
81
  /**
82
  * Enqueue scripts for gutenberg
83
  */
84
  public function enqueue_block_editor_assets() {
85
+ $ajax_url = function_exists( 'WC' ) ? add_query_arg( 'wc-ajax', 'yith_plugin_fw_gutenberg_do_shortcode', trailingslashit( site_url() ) ) : admin_url( 'admin-ajax.php' );
86
+ $gutenberg = array( 'ajaxurl' => $ajax_url );
87
+ $asset_file = include YIT_CORE_PLUGIN_PATH . '/dist/gutenberg/index.asset.php';
88
+
89
+ $gutenberg_assets_url = YIT_CORE_PLUGIN_URL . '/dist/gutenberg';
90
+
91
+ wp_register_script(
92
+ 'yith-gutenberg',
93
+ $gutenberg_assets_url . '/index.js',
94
+ $asset_file['dependencies'],
95
+ $asset_file['version'],
96
+ true
97
  );
98
+
99
+ wp_localize_script( 'yith-gutenberg', 'yith_gutenberg_ajax', $gutenberg ); // Deprecated! Kept for backward compatibility.
100
+ wp_localize_script( 'yith-gutenberg', 'yith_gutenberg', $this->blocks_args ); // Deprecated! Kept for backward compatibility.
101
+
102
+ wp_localize_script( 'yith-gutenberg', 'yithGutenberg', $gutenberg );
103
+ wp_localize_script( 'yith-gutenberg', 'yithGutenbergBlocks', $this->blocks_args );
104
+
105
+ wp_enqueue_script( 'yith-gutenberg' );
106
+ wp_enqueue_style( 'yith-gutenberg', $gutenberg_assets_url . '/style-index.css', array(), yith_plugin_fw_get_version() );
107
  }
108
 
109
  /**
240
  $args[ $block ]['category'] = $this->get_default_blocks_category_slug();
241
  }
242
 
243
+ $args[ $block ]['do_shortcode'] = isset( $block_args['do_shortcode'] ) ? ! ! $block_args['do_shortcode'] : true;
244
+
245
  if ( isset( $block_args['attributes'] ) ) {
246
  foreach ( $block_args['attributes'] as $attr_name => $attributes ) {
 
 
 
 
247
 
248
  if ( ! empty( $attributes['options'] ) && is_array( $attributes['options'] ) ) {
249
  $options = array();
263
 
264
  // Special Requirements for Block Type.
265
  if ( ! empty( $attributes['type'] ) ) {
266
+ $args[ $block ]['attributes'][ $attr_name ]['controlType'] = $attributes['type'];
267
+ $args[ $block ]['attributes'][ $attr_name ]['type'] = 'string';
268
 
269
  switch ( $attributes['type'] ) {
270
  case 'select':
307
  * Get a do_shortcode in ajax call to show block preview
308
  **/
309
  public function do_shortcode() {
310
+ // phpcs:disable WordPress.Security.NonceVerification
311
  $current_action = current_action();
312
+ $shortcode = ! empty( $_REQUEST['shortcode'] ) ? wp_unslash( $_REQUEST['shortcode'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
313
 
314
  if ( ! apply_filters( 'yith_plugin_fw_gutenberg_skip_shortcode_sanitize', false ) ) {
315
  $shortcode = sanitize_text_field( stripslashes( $shortcode ) );
316
  }
317
 
318
+ ob_start();
319
+
320
  do_action( 'yith_plugin_fw_gutenberg_before_do_shortcode', $shortcode, $current_action );
321
  echo do_shortcode( apply_filters( 'yith_plugin_fw_gutenberg_shortcode', $shortcode, $current_action ) );
322
  do_action( 'yith_plugin_fw_gutenberg_after_do_shortcode', $shortcode, $current_action );
323
 
324
+ $html = ob_get_clean();
325
  if ( is_ajax() ) {
326
+ wp_send_json( array( 'html' => $html ) );
327
  }
328
 
329
  // phpcs:enable
plugin-fw/includes/builders/gutenberg/src/.jshintrc ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "boss": true,
3
+ "curly": true,
4
+ "eqeqeq": true,
5
+ "eqnull": true,
6
+ "esversion": 6,
7
+ "expr": true,
8
+ "immed": true,
9
+ "noarg": true,
10
+ "onevar": true,
11
+ "trailing": true,
12
+ "undef": true,
13
+ "unused": true,
14
+ "browser": true,
15
+ "globals": {
16
+ "_": false,
17
+ "Backbone": false,
18
+ "jQuery": true,
19
+ "console": true,
20
+ "alert": true,
21
+ "JSON": false,
22
+ "wp": false
23
+ }
24
+ }
plugin-fw/includes/builders/gutenberg/src/common/actions-to-jquery-events.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Actions to jQuery events
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { addAction } from '@wordpress/hooks';
9
+
10
+ const actions = [
11
+ 'yith_plugin_fw_gutenberg_before_do_shortcode',
12
+ 'yith_plugin_fw_gutenberg_success_do_shortcode',
13
+ 'yith_plugin_fw_gutenberg_after_do_shortcode'
14
+ ];
15
+
16
+ for ( const action of actions ) {
17
+ addAction(
18
+ action,
19
+ 'yith-plugin-fw/jquery-events',
20
+ ( ...params ) => {
21
+ if ( 'jQuery' in window ) {
22
+ jQuery( document ).trigger( action, Object.values( params ) );
23
+ }
24
+ }
25
+ );
26
+ }
plugin-fw/includes/builders/gutenberg/src/common/ajaxFetch.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Ajax Fetch
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { addQueryArgs } from '@wordpress/url';
9
+
10
+ /**
11
+ * Check status of ajax call
12
+ * @param response
13
+ * @returns {*}
14
+ */
15
+ function ajaxCheckStatus( response ) {
16
+ if ( response.status >= 200 && response.status < 300 ) {
17
+ return response;
18
+ }
19
+
20
+ throw response;
21
+ }
22
+
23
+ /**
24
+ * Parse the response of the ajax call
25
+ * @param response
26
+ * @returns {*}
27
+ */
28
+ function parseResponse( response ) {
29
+ return response.json ? response.json() : response.text();
30
+ }
31
+
32
+ /**
33
+ * Fetch using WordPress Ajax
34
+ *
35
+ * @param {object} data The data to use in the ajax call.
36
+ * @param {string} url The ajax URL.
37
+ * @returns {Promise<Response>}
38
+ */
39
+ export const ajaxFetch = ( data, url = yithGutenberg.ajaxurl ) => {
40
+ url = addQueryArgs( url, data );
41
+ return fetch( url ).then( ajaxCheckStatus ).then( parseResponse );
42
+ };
plugin-fw/includes/builders/gutenberg/src/common/checkForDeps.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Check for dependencies
3
+ *
4
+ * @param {object} attributeArgs Attribute arguments.
5
+ * @param {object} attributes The attributes.
6
+ * @returns {boolean}
7
+ */
8
+ export const checkForDeps = ( attributeArgs, attributes ) => {
9
+ const { controlType } = attributeArgs;
10
+ let show = true;
11
+
12
+ if ( attributeArgs.deps && attributeArgs.deps.id && 'value' in attributeArgs.deps ) {
13
+ let depsValue = attributeArgs.deps.value;
14
+ if ( 'toggle' === controlType || 'checkbox' === controlType ) {
15
+ depsValue = true === depsValue || 'yes' === depsValue || 1 === depsValue;
16
+ }
17
+ show = typeof attributes[ attributeArgs.deps.id ] !== 'undefined' && depsValue === attributes[ attributeArgs.deps.id ];
18
+ }
19
+
20
+ return show;
21
+ };
plugin-fw/includes/builders/gutenberg/src/common/generateShortcode.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { checkForDeps } from './checkForDeps';
5
+
6
+ /**
7
+ * Generate the shortcode
8
+ *
9
+ * @param {object} blockArgs The block arguments.
10
+ * @param {object} attributes The attributes
11
+ * @returns {string}
12
+ */
13
+ export const generateShortcode = ( blockArgs, attributes ) => {
14
+ let theShortcode = '';
15
+ let callback = false;
16
+
17
+ if ( typeof blockArgs.callback !== 'undefined' ) {
18
+ if ( jQuery && blockArgs.callback in jQuery.fn ) {
19
+ callback = jQuery.fn[ blockArgs.callback ];
20
+ } else if ( blockArgs.callback in window ) {
21
+ callback = window[ blockArgs.callback ];
22
+ }
23
+ }
24
+
25
+ if ( typeof callback === 'function' ) {
26
+ theShortcode = callback( attributes, blockArgs );
27
+ } else {
28
+ const shortcodeAttrs = blockArgs.attributes ? Object.entries( blockArgs.attributes ).map( ( [attributeName, attributeArgs] ) => {
29
+ const show = checkForDeps( attributeArgs, attributes );
30
+ const value = attributes[ attributeName ];
31
+
32
+ if ( show && typeof value !== 'undefined' ) {
33
+ const shortcodeValue = !!attributeArgs.remove_quotes ? value : `"${value}"`;
34
+ return attributeName + '=' + shortcodeValue;
35
+ }
36
+ } ) : [];
37
+
38
+ const shortcodeAttrsText = shortcodeAttrs.length ? ( ' ' + shortcodeAttrs.join( ' ' ) ) : '';
39
+ theShortcode = `[${blockArgs.shortcode_name}${shortcodeAttrsText}]`;
40
+ }
41
+ return theShortcode;
42
+ };
plugin-fw/includes/builders/gutenberg/src/common/icons.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * SVG Icons
3
+ */
4
+
5
+ /**
6
+ * The YITH Logo Icon
7
+ * @type {JSX.Element}
8
+ */
9
+ export const yith_icon = <svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" width="22" height="22" role="img" aria-hidden="true" focusable="false">
10
+ <path width="22" height="22"
11
+ d="M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"/>
12
+ </svg>;
plugin-fw/includes/builders/gutenberg/src/common/index.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ export * from './ajaxFetch';
2
+ export * from './icons';
3
+ export * from './generateShortcode';
4
+ export * from './checkForDeps';
plugin-fw/includes/builders/gutenberg/src/components/color-palette-control/index.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Color Palette Component
3
+ */
4
+
5
+ /**
6
+ * External dependencies
7
+ */
8
+ import React from 'react';
9
+
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+ import { BaseControl, ColorIndicator, ColorPalette } from '@wordpress/components';
14
+ import { __experimentalUseEditorFeature as useEditorFeature } from '@wordpress/block-editor';
15
+ import { useInstanceId } from '@wordpress/compose';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import './style.scss';
21
+
22
+ /**
23
+ * Visual Label Element
24
+ *
25
+ * @param {string} label The label.
26
+ * @param {string} colorValue The color.
27
+ * @returns {JSX.Element}
28
+ * @constructor
29
+ */
30
+ function VisualLabel( {
31
+ label,
32
+ colorValue
33
+ } ) {
34
+
35
+ return (
36
+ <>
37
+ {label}
38
+ {!!colorValue && (
39
+ <ColorIndicator colorValue={colorValue}/>
40
+ )}
41
+ </>
42
+ );
43
+ }
44
+
45
+ /**
46
+ * Color Palette Control
47
+ *
48
+ * @param {string} className The CSS class name.
49
+ * @param {string} label The label.
50
+ * @param {function} onChange The function callback fired on value change.
51
+ * @param {string} value The initial value.
52
+ * @param {string} help The help message.
53
+ * @param {array} palette Array of palette colors.
54
+ * @param {bool} clearable Set true to allow clear.
55
+ * @returns {JSX.Element}
56
+ * @constructor
57
+ */
58
+ export default function ColorPaletteControl( {
59
+ className,
60
+ label,
61
+ onChange,
62
+ value,
63
+ help,
64
+ palette,
65
+ clearable
66
+ } ) {
67
+
68
+ palette = !!palette ? palette : useEditorFeature( 'color.palette' );
69
+
70
+ const instanceId = useInstanceId( ColorPaletteControl );
71
+ const id = `inspector-yith-color-palette-control-${instanceId}`;
72
+
73
+ return (
74
+ <BaseControl
75
+ id={id}
76
+ className={`block-editor-yith-color-palette-control ${className}`}
77
+ help={help}
78
+ >
79
+ <fieldset>
80
+ <legend>
81
+ <div className="block-editor-yith-color-palette-control__color-indicator">
82
+ <BaseControl.VisualLabel>
83
+ <VisualLabel colorValue={value} label={label}/>
84
+ </BaseControl.VisualLabel>
85
+ </div>
86
+ </legend>
87
+
88
+ <ColorPalette
89
+ value={value}
90
+ onChange={onChange}
91
+ colors={palette}
92
+ clearable={clearable}
93
+ />
94
+ </fieldset>
95
+ </BaseControl> );
96
+ }
plugin-fw/includes/builders/gutenberg/src/components/color-palette-control/style.scss ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ .block-editor-yith-color-palette-control {
2
+ .block-editor-yith-color-palette-control__color-indicator {
3
+ margin-bottom: 12px;
4
+ }
5
+
6
+ .component-color-indicator{
7
+ vertical-align: text-bottom;
8
+ }
9
+ }
plugin-fw/includes/builders/gutenberg/src/components/color-picker-control/index.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Color Picker Component
3
+ */
4
+
5
+ /**
6
+ * External dependencies
7
+ */
8
+ import React from 'react';
9
+
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+ import { BaseControl, ColorPicker } from '@wordpress/components';
14
+ import { useInstanceId } from '@wordpress/compose';
15
+
16
+ /**
17
+ * Color Picker Control
18
+ *
19
+ * @param {string} className The CSS class name.
20
+ * @param {string} label The label.
21
+ * @param {function} onChange The function callback fired on value change.
22
+ * @param {string} value The initial value.
23
+ * @param {string} help The help message.
24
+ * @param {bool} disableAlpha Set true to disable the alpha
25
+ * @returns {ColorPickerControl}
26
+ * @constructor
27
+ */
28
+ export default function ColorPickerControl( {
29
+ className,
30
+ label,
31
+ onChange,
32
+ value,
33
+ help,
34
+ disableAlpha,
35
+ } ) {
36
+
37
+ const instanceId = useInstanceId( ColorPickerControl );
38
+ const id = `inspector-yith-color-picker-control-${instanceId}`;
39
+
40
+ return (
41
+ <BaseControl
42
+ id={id}
43
+ label={label}
44
+ className={`block-editor-yith-color-control ${className}`}
45
+ help={help}
46
+ >
47
+ <ColorPicker
48
+ color={value}
49
+ disableAlpha={disableAlpha}
50
+ onChangeComplete={onChange}
51
+ />
52
+ </BaseControl> );
53
+ }
plugin-fw/includes/builders/gutenberg/src/components/shortcode/index.js ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Shortcode Component
3
+ */
4
+
5
+ /**
6
+ * External dependencies
7
+ */
8
+ import React, { Component } from 'react';
9
+ import { isEqual } from 'lodash';
10
+
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+ import { RawHTML } from '@wordpress/element';
15
+ import { Spinner } from '@wordpress/components';
16
+ import { doAction, addAction } from '@wordpress/hooks';
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ import { ajaxFetch, generateShortcode, yith_icon } from '../../common';
22
+ import md5 from 'md5';
23
+ import './style.scss';
24
+
25
+ const BEFORE_DO_SHORTCODE_ACTION = 'yith_plugin_fw_gutenberg_before_do_shortcode';
26
+ const SUCCESS_DO_SHORTCODE_ACTION = 'yith_plugin_fw_gutenberg_success_do_shortcode';
27
+ const AFTER_DO_SHORTCODE_ACTION = 'yith_plugin_fw_gutenberg_after_do_shortcode';
28
+
29
+ /**
30
+ * Shortcode Component
31
+ */
32
+ export class Shortcode extends Component {
33
+ constructor() {
34
+ super( ...arguments );
35
+
36
+ this.state = {
37
+ html : '',
38
+ shortcode : '',
39
+ shortcodeHash: '',
40
+ ajaxUpdated : false,
41
+ ajaxSuccess : false,
42
+ ajaxResponse : false,
43
+ loading : false
44
+ };
45
+
46
+ this.ajaxTimeout = false;
47
+ }
48
+
49
+ componentDidMount() {
50
+ this.updateShortcode();
51
+ }
52
+
53
+ componentDidUpdate( prevProps, prevState, snapshot ) {
54
+ const { shortcode, shortcodeHash, ajaxSuccess, ajaxResponse, ajaxUpdated } = this.state;
55
+
56
+ if ( !isEqual( prevProps, this.props ) ) {
57
+ this.updateShortcode();
58
+ }
59
+
60
+
61
+ if ( this.props.blockArgs.do_shortcode && ajaxUpdated ) {
62
+
63
+ if ( ajaxSuccess ) {
64
+ doAction( SUCCESS_DO_SHORTCODE_ACTION, shortcode, shortcodeHash, ajaxResponse );
65
+ }
66
+
67
+ doAction( AFTER_DO_SHORTCODE_ACTION, shortcode, shortcodeHash, ajaxResponse );
68
+
69
+ this.setState( { ajaxUpdated: false } );
70
+ }
71
+ }
72
+
73
+ updateShortcode() {
74
+ const { attributes, blockArgs } = this.props;
75
+
76
+ this.setState( { loading: true, ajaxSuccess: false, ajaxResponse: false } );
77
+
78
+ const shortcode = generateShortcode( blockArgs, attributes );
79
+ const shortcodeHash = md5( shortcode );
80
+
81
+ if ( blockArgs.do_shortcode ) {
82
+ !!this.ajaxTimeout && clearTimeout( this.ajaxTimeout );
83
+
84
+ doAction( BEFORE_DO_SHORTCODE_ACTION, shortcode, shortcodeHash );
85
+
86
+ this.ajaxTimeout = setTimeout( () => {
87
+ const ajaxData = {
88
+ action : 'yith_plugin_fw_gutenberg_do_shortcode',
89
+ shortcode: shortcode
90
+ };
91
+
92
+ ajaxFetch( ajaxData ).then( response => {
93
+ this.setState( { loading: false, html: response.html, shortcode, shortcodeHash, ajaxSuccess: true, ajaxUpdated: true, ajaxResponse: response } );
94
+ } )
95
+ .catch( error => {
96
+ console.log( { error } );
97
+ } );
98
+ }, 300 );
99
+ } else {
100
+ this.setState( { loading: false, html: shortcode, shortcode, shortcodeHash } );
101
+ }
102
+ }
103
+
104
+ render() {
105
+ const { html, loading, shortcode, shortcodeHash } = this.state;
106
+ const { blockArgs } = this.props;
107
+ const { do_shortcode, title, empty_message } = blockArgs;
108
+
109
+ const mainClass = 'block-editor-yith-plugin-fw-shortcode-block';
110
+
111
+ let wrapperClasses = [mainClass];
112
+ let type = do_shortcode ? 'html' : 'shortcode';
113
+ let htmlToShow = html;
114
+ let message = '';
115
+
116
+ if ( do_shortcode && !html ) {
117
+ type = 'empty-html';
118
+ htmlToShow = shortcode;
119
+ if ( empty_message ) {
120
+ message = empty_message;
121
+ }
122
+ }
123
+
124
+ const showTitle = ['shortcode', 'empty-html'].includes( type );
125
+ const showContent = 'empty-html' !== type;
126
+ const showMessage = !!message;
127
+
128
+ wrapperClasses.push( `${mainClass}--${type}` );
129
+ wrapperClasses.push( showMessage ? `${mainClass}--has-message` : `${mainClass}--no-message` );
130
+ wrapperClasses.push( `yith_block_${shortcodeHash}` );
131
+
132
+ return (
133
+ <>
134
+ <div className={wrapperClasses.join( ' ' )}>
135
+ {!!loading ? <div className={`${mainClass}__spinner-wrap`}><Spinner/></div> : ''}
136
+ {showTitle &&
137
+ <div className={`${mainClass}__title components-placeholder__label`}>{yith_icon}{title}</div>
138
+ }
139
+ {showMessage &&
140
+ <RawHTML className={`${mainClass}__message`}>{message}</RawHTML>
141
+ }
142
+ {showContent &&
143
+ <RawHTML className={`${mainClass}__content`}>{htmlToShow}</RawHTML>
144
+ }
145
+ </div>
146
+ </>
147
+ )
148
+ }
149
+ }
plugin-fw/includes/builders/gutenberg/src/components/shortcode/style.scss ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %bordered-block {
2
+ padding: 1em 1em 1.2em;
3
+ border: 1px solid #1e1e1e;
4
+ border-radius: 4px;
5
+ }
6
+
7
+ %shortcode-box {
8
+ font-family: Menlo, Consolas, monaco, monospace;
9
+ color: #1e1e1e;
10
+ font-size: 13px;
11
+ padding: 0.8em 1em;
12
+ border: 1px solid #ddd;
13
+ border-radius: 4px;
14
+ }
15
+
16
+ .block-editor-yith-plugin-fw-shortcode-block {
17
+ position: relative;
18
+ min-height: 30px;
19
+
20
+ .block-editor-yith-plugin-fw-shortcode-block__spinner-wrap {
21
+ position: absolute;
22
+ top: 50%;
23
+ left: 50%;
24
+ transform: translateX(-50%) translateY(-50%);
25
+ }
26
+
27
+ &.block-editor-yith-plugin-fw-shortcode-block--shortcode {
28
+
29
+ @extend %bordered-block;
30
+
31
+ .block-editor-yith-plugin-fw-shortcode-block__content {
32
+ @extend %shortcode-box;
33
+ }
34
+ }
35
+
36
+ &.block-editor-yith-plugin-fw-shortcode-block--empty-html {
37
+
38
+ @extend %bordered-block;
39
+
40
+ &.block-editor-yith-plugin-fw-shortcode-block--no-message {
41
+ .block-editor-yith-plugin-fw-shortcode-block__title {
42
+ margin-bottom: 0;
43
+ }
44
+ }
45
+
46
+ .block-editor-yith-plugin-fw-shortcode-block__message {
47
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
48
+ font-style: italic;
49
+ font-size: 13px;
50
+ }
51
+
52
+ .block-editor-yith-plugin-fw-shortcode-block__content {
53
+ display: none;
54
+ }
55
+ }
56
+ }
plugin-fw/includes/builders/gutenberg/src/edit.js ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Handle YITH Gutenberg Blocks Edit
3
+ *
4
+ * @var {Object} yithGutenbergBlocks The Gutenberg blocks object.
5
+ */
6
+
7
+ /**
8
+ * External dependencies
9
+ */
10
+ import React from 'react';
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ import { PanelBody, BaseControl, ToggleControl, SelectControl, TextControl, TextareaControl, CheckboxControl, RangeControl, RadioControl } from '@wordpress/components';
16
+ import { InspectorControls } from '@wordpress/block-editor';
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ import { Shortcode } from './components/shortcode';
22
+ import { checkForDeps } from './common';
23
+ import ColorPickerControl from './components/color-picker-control';
24
+ import ColorPaletteControl from './components/color-palette-control';
25
+
26
+ /**
27
+ * Retrieve an help message from arguments.
28
+ *
29
+ * @param {Object} args The arguments.
30
+ * @param {bool} value The value.
31
+ * @returns {string}
32
+ */
33
+ const getHelpMessage = ( args, value ) => {
34
+ let helpMessage = '';
35
+ if ( args.helps && args.helps.checked && args.helps.unchecked ) {
36
+ helpMessage = !!value ? args.helps.checked : args.helps.unchecked;
37
+ } else if ( args.help ) {
38
+ helpMessage = args.help;
39
+ }
40
+ return helpMessage;
41
+ }
42
+
43
+ /**
44
+ * Create edit function.
45
+ *
46
+ * @param {string} blockName The block name.
47
+ * @param {Object} blockArgs The block arguments.
48
+ * @returns {function({attributes?: *, className: *, setAttributes: *})}
49
+ */
50
+ export const createEditFunction = ( blockName, blockArgs ) => {
51
+ return function ( { attributes, className, setAttributes } ) {
52
+
53
+ const onChangeHandler = ( new_value, attribute_name, controlType ) => {
54
+ if ( ['colorpicker', 'color'].includes( controlType ) ) {
55
+ new_value = new_value.color.getAlpha() < 1 ? new_value.color.toRgbString() : new_value.color.toHexString();
56
+ }
57
+
58
+ let updatedAttributes = {};
59
+ updatedAttributes[ attribute_name ] = new_value;
60
+ setAttributes( updatedAttributes );
61
+ }
62
+
63
+ const getComponentControl = ( attributeName, attributeArgs ) => {
64
+ const { controlType } = attributeArgs;
65
+ const value = attributes[ attributeName ];
66
+ const helpMessage = getHelpMessage( attributeArgs, value );
67
+ let wrapperClassName = `${blockName}__${attributeName}-field-wrapper`;
68
+ const show = checkForDeps( attributeArgs, attributes );
69
+
70
+ if ( attributeArgs.wrapper_class ) {
71
+ wrapperClassName += ' ' + attributeArgs.wrapper_class;
72
+ }
73
+
74
+
75
+ let componentControl = false;
76
+ if ( show ) {
77
+ switch ( controlType ) {
78
+ case 'select':
79
+ componentControl = <SelectControl
80
+ className={wrapperClassName}
81
+ key={attributeName}
82
+ value={value}
83
+ label={attributeArgs.label}
84
+ options={attributeArgs.options}
85
+ selected={value}
86
+ help={helpMessage}
87
+ multiple={!!attributeArgs.multiple}
88
+ onChange={( newValue ) => {
89
+ onChangeHandler( newValue, attributeName, controlType )
90
+ }}
91
+ />;
92
+ break;
93
+
94
+ case 'text':
95
+ componentControl = <TextControl
96
+ className={wrapperClassName}
97
+ key={attributeName}
98
+ value={value}
99
+ label={attributeArgs.label}
100
+ help={helpMessage}
101
+ onChange={( newValue ) => {
102
+ onChangeHandler( newValue, attributeName, controlType )
103
+ }}
104
+ />;
105
+ break;
106
+
107
+ case 'textarea':
108
+ componentControl = <TextareaControl
109
+ className={wrapperClassName}
110
+ key={attributeName}
111
+ value={value}
112
+ label={attributeArgs.label}
113
+ help={helpMessage}
114
+ onChange={( newValue ) => {
115
+ onChangeHandler( newValue, attributeName, controlType )
116
+ }}
117
+ />;
118
+ break;
119
+
120
+ case 'toggle':
121
+ componentControl = <ToggleControl
122
+ className={wrapperClassName}
123
+ key={attributeName}
124
+ value={value}
125
+ label={attributeArgs.label}
126
+ help={helpMessage}
127
+ checked={value}
128
+ onChange={( newValue ) => {
129
+ onChangeHandler( newValue, attributeName, controlType )
130
+ }}
131
+ />;
132
+ break;
133
+
134
+ case 'checkbox':
135
+ componentControl = <CheckboxControl
136
+ className={wrapperClassName}
137
+ key={attributeName}
138
+ value={value}
139
+ label={attributeArgs.label}
140
+ help={helpMessage}
141
+ checked={value}
142
+ onChange={( newValue ) => {
143
+ onChangeHandler( newValue, attributeName, controlType )
144
+ }}
145
+ />;
146
+ break;
147
+
148
+ case 'number':
149
+ case 'range':
150
+ componentControl = <RangeControl
151
+ className={wrapperClassName}
152
+ key={attributeName}
153
+ value={value}
154
+ label={attributeArgs.label}
155
+ help={helpMessage}
156
+ min={attributeArgs.min}
157
+ max={attributeArgs.max}
158
+ onChange={( newValue ) => {
159
+ onChangeHandler( newValue, attributeName, controlType )
160
+ }}
161
+ />;
162
+ break;
163
+
164
+ case 'color':
165
+ case 'colorpicker':
166
+ componentControl = <ColorPickerControl
167
+ className={wrapperClassName}
168
+ key={attributeName}
169
+ label={attributeArgs.label}
170
+ help={helpMessage}
171
+ value={value}
172
+ disableAlpha={attributeArgs.disableAlpha}
173
+ onChange={( newValue ) => {
174
+ onChangeHandler( newValue, attributeName, controlType )
175
+ }}/>;
176
+ break;
177
+
178
+ case 'color-palette':
179
+ componentControl = <ColorPaletteControl
180
+ className={wrapperClassName}
181
+ key={attributeName}
182
+ label={attributeArgs.label}
183
+ help={helpMessage}
184
+ value={value}
185
+ clearable={attributeArgs.clearable || false}
186
+ onChange={( newValue ) => {
187
+ onChangeHandler( newValue, attributeName, controlType )
188
+ }}/>;
189
+ break;
190
+
191
+ case 'radio':
192
+ componentControl = <RadioControl
193
+ key={attributeName}
194
+ value={value}
195
+ label={attributeArgs.label}
196
+ options={attributeArgs.options}
197
+ selected={value}
198
+ checked={value}
199
+ help={helpMessage}
200
+ onChange={( newValue ) => {
201
+ onChangeHandler( newValue, attributeName, controlType )
202
+ }}
203
+ />;
204
+ break;
205
+ default:
206
+ componentControl = false;
207
+ }
208
+ }
209
+ return componentControl;
210
+ }
211
+
212
+ return (
213
+ <>
214
+ {!!blockArgs.attributes &&
215
+ <InspectorControls>
216
+ <PanelBody>
217
+ {Object.entries( blockArgs.attributes ).map( ( [attributeName, attributeArgs] ) => {
218
+ const ComponentControl = getComponentControl( attributeName, attributeArgs );
219
+
220
+ if ( ComponentControl ) {
221
+ return ( ComponentControl );
222
+ }
223
+ } )}
224
+ </PanelBody>
225
+ </InspectorControls>
226
+ }
227
+ {
228
+ <Shortcode attributes={attributes} blockArgs={blockArgs}/>
229
+ }
230
+ </>
231
+ );
232
+ }
233
+ }
plugin-fw/includes/builders/gutenberg/src/index.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Handle YITH Gutenberg Blocks
3
+ *
4
+ * @var {Object} yithGutenbergBlocks The Gutenberg blocks object.
5
+ */
6
+
7
+ /**
8
+ * External dependencies
9
+ */
10
+ import React from 'react';
11
+ import md5 from 'md5';
12
+
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+ import { registerBlockType } from '@wordpress/blocks';
17
+ import { RawHTML } from '@wordpress/element';
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+ import { yith_icon, generateShortcode } from './common';
23
+ import { createEditFunction } from './edit';
24
+ import './common/actions-to-jquery-events';
25
+
26
+ for ( const [blockName, blockArgs] of Object.entries( yithGutenbergBlocks ) ) {
27
+ registerBlockType( 'yith/' + blockName, {
28
+ title : blockArgs.title,
29
+ description: blockArgs.description,
30
+ category : blockArgs.category,
31
+ attributes : blockArgs.attributes,
32
+ icon : typeof blockArgs.icon !== 'undefined' ? blockArgs.icon : yith_icon,
33
+ keywords : blockArgs.keywords,
34
+ edit : createEditFunction( blockName, blockArgs ),
35
+ save : ( { attributes } ) => {
36
+ return generateShortcode( blockArgs, attributes );
37
+ },
38
+ deprecated : [
39
+ {
40
+ attributes: blockArgs.attributes,
41
+ save : ( { attributes } ) => {
42
+ const shortcode = generateShortcode( blockArgs, attributes );
43
+ const blockHash = md5( shortcode );
44
+ const shortcodeSpan = '<span class="yith_block_' + blockHash + '">' + shortcode + '</span>';
45
+
46
+ return (
47
+ <RawHTML>{shortcodeSpan}</RawHTML>
48
+ )
49
+ }
50
+ }
51
+ ]
52
+ } );
53
+ }
plugin-fw/includes/class-yit-assets.php CHANGED
@@ -44,9 +44,21 @@ if ( ! class_exists( 'YIT_Assets' ) ) {
44
  */
45
  private function __construct() {
46
  $this->version = yith_plugin_fw_get_version();
 
 
 
 
47
  add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
48
  }
49
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Register styles and scripts
52
  */
@@ -72,7 +84,7 @@ if ( ! class_exists( 'YIT_Assets' ) ) {
72
  wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $this->version );
73
  wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $this->version );
74
  wp_register_style( 'yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css', array(), $this->version );
75
- wp_register_style( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/css/yith-fields.css', false, $this->version );
76
 
77
  wp_register_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900', array(), $this->version );
78
 
44
  */
45
  private function __construct() {
46
  $this->version = yith_plugin_fw_get_version();
47
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_common_scripts' ) );
48
+ add_action( 'wp_enqueue_scripts', array( $this, 'register_common_scripts' ) );
49
+ add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'register_common_scripts' ) );
50
+
51
  add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
52
  }
53
 
54
+ /**
55
+ * Register common scripts
56
+ */
57
+ public function register_common_scripts() {
58
+ wp_register_style( 'yith-plugin-fw-icon-font', YIT_CORE_PLUGIN_URL . '/assets/css/yith-icon-font.css', array(), $this->version );
59
+ wp_register_style( 'yith-plugin-fw-elementor', YIT_CORE_PLUGIN_URL . '/assets/css/elementor.css', array(), $this->version );
60
+ }
61
+
62
  /**
63
  * Register styles and scripts
64
  */
84
  wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $this->version );
85
  wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $this->version );
86
  wp_register_style( 'yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css', array(), $this->version );
87
+ wp_register_style( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/css/yith-fields.css', array( 'yith-plugin-fw-icon-font' ), $this->version );
88
 
89
  wp_register_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900', array(), $this->version );
90
 
plugin-fw/includes/class-yit-plugin-panel-woocommerce.php CHANGED
@@ -304,7 +304,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
304
  if ( version_compare( WC()->version, '2.4.0', '>=' ) ) {
305
  if ( ! empty( $yit_options[ $option_key ] ) ) {
306
  foreach ( $yit_options[ $option_key ] as $option ) {
307
- if ( isset( $option['id'] ) && isset( $_POST[ $option['id'] ], $option['type'] ) && ! in_array( $option['type'], self::$wc_type, true ) ) {
308
  $_POST[ $option['id'] ] = maybe_serialize( $_POST[ $option['id'] ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
309
  }
310
  }
@@ -511,7 +511,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
511
  * @since 2.0
512
  */
513
  public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
514
- if ( ! version_compare( WC()->version, '2.4.0', '>=' ) || ! isset( $option['type'] ) || in_array( $option['type'], self::$wc_type, true ) ) {
515
  return $value;
516
  }
517
 
@@ -532,9 +532,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
532
  /**
533
  * Sanitize Option
534
  *
535
- * @param mixed $value Option value.
536
- * @param mixed $option Option settings array.
537
- * @param string $raw_value Raw option value.
538
  *
539
  * @return mixed Filtered return value
540
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
@@ -542,55 +542,58 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
542
  */
543
  public static function sanitize_option( $value, $option, $raw_value ) {
544
  if ( isset( $option['type'] ) && 'yith-field' === $option['type'] ) {
545
- if ( ! empty( $option['multiple'] ) && is_null( $value ) ) {
546
- $value = array();
547
- }
548
-
549
- // Sanitize the option for the checkbox field: 'yes' or 'no'.
550
- if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'checkbox', 'onoff' ), true ) ) {
551
- $value = yith_plugin_fw_is_true( $raw_value ) ? 'yes' : 'no';
552
- }
553
-
554
- if ( isset( $option['yith-type'] ) && 'checkbox-array' === $option['yith-type'] ) {
555
- $value = maybe_unserialize( $raw_value );
556
- $value = ! ! $value && is_array( $value ) ? $value : array();
557
- }
558
-
559
- if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'textarea', 'textarea-editor', 'textarea-codemirror' ), true ) ) {
560
- $value = $raw_value;
561
- }
562
-
563
- // Sanitize the option date-format when the user choose the custom option.
564
- if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'date-format' ), true ) && '\c\u\s\t\o\m' === $raw_value ) {
565
- $custom = isset( $_REQUEST[ $option['id'] . '_text' ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $option['id'] . '_text' ] ) ) : $option['default']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
566
- $value = $custom;
567
- }
568
-
569
- if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'toggle-element' ), true ) ) {
570
- if ( $value && isset( $option['elements'] ) && ! empty( $option['elements'] ) ) {
571
- $value = maybe_unserialize( $value );
572
-
573
- if ( isset( $value['box_id'] ) ) {
574
- unset( $value['box_id'] );
575
  }
 
 
 
576
 
577
- foreach ( $value as $index => $single_toggle ) {
 
 
578
 
579
- if ( $value && isset( $option['onoff_field'] ) && ! empty( $option['onoff_field'] ) ) {
580
- $onoff = $option['onoff_field'];
581
- $onoff['type'] = 'yith-field';
582
- $onoff['yith-type'] = 'onoff';
583
- $onoff_id = $onoff['id'];
584
 
585
- $value[ $index ][ $onoff_id ] = isset( $single_toggle[ $onoff_id ] ) ? self::sanitize_option( $single_toggle[ $onoff_id ], $onoff, $single_toggle[ $onoff_id ] ) : 'no';
586
- }
 
 
 
 
 
 
587
 
588
- foreach ( $option['elements'] as $element ) {
589
- $element_value = isset( $value[ $index ][ $element['id'] ] ) ? $value[ $index ][ $element['id'] ] : false;
590
- $value[ $index ][ $element['id'] ] = self::sanitize_option( $element_value, $element, $element_value );
 
 
591
  }
592
  }
593
- }
 
 
 
 
594
  }
595
 
596
  if ( ! empty( $option['yith-sanitize-callback'] ) && is_callable( $option['yith-sanitize-callback'] ) ) {
@@ -598,7 +601,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
598
  }
599
  }
600
 
601
- return $value;
602
  }
603
 
604
  /**
@@ -683,6 +686,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
683
 
684
  $value = $new_value;
685
  }
 
 
686
  $value = self::sanitize_option( $value, $option_array[ $option_id ], $value );
687
  $updated = update_option( $option_id, $value );
688
  }
304
  if ( version_compare( WC()->version, '2.4.0', '>=' ) ) {
305
  if ( ! empty( $yit_options[ $option_key ] ) ) {
306
  foreach ( $yit_options[ $option_key ] as $option ) {
307
+ if ( isset( $option['id'] ) && isset( $_POST[ $option['id'] ], $option['type'] ) && ! in_array( $option['type'], self::$wc_type, true ) && 'yith-field' !== $option['type'] ) {
308
  $_POST[ $option['id'] ] = maybe_serialize( $_POST[ $option['id'] ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
309
  }
310
  }
511
  * @since 2.0
512
  */
513
  public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
514
+ if ( ! version_compare( WC()->version, '2.4.0', '>=' ) || ! isset( $option['type'] ) || in_array( $option['type'], self::$wc_type, true ) || 'yith-field' === $option['type'] ) {
515
  return $value;
516
  }
517
 
532
  /**
533
  * Sanitize Option
534
  *
535
+ * @param mixed $value Option value.
536
+ * @param mixed $option Option settings array.
537
+ * @param mixed $raw_value Raw option value.
538
  *
539
  * @return mixed Filtered return value
540
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
542
  */
543
  public static function sanitize_option( $value, $option, $raw_value ) {
544
  if ( isset( $option['type'] ) && 'yith-field' === $option['type'] ) {
545
+ $value = $raw_value; // We need the raw value to avoid the wc_clean. Note: the raw_value is already un-slashed.
546
+ $type = isset( $option['yith-type'] ) ? $option['yith-type'] : false;
547
+ $multiple = ! empty( $option['multiple'] );
548
+
549
+ switch ( $type ) {
550
+ case 'checkbox':
551
+ case 'onoff':
552
+ $value = yith_plugin_fw_is_true( $value ) ? 'yes' : 'no';
553
+ break;
554
+ case 'checkbox-array':
555
+ $value = ! ! $value && is_array( $value ) ? $value : array();
556
+ break;
557
+ case 'select-buttons':
558
+ $value = ! empty( $value ) ? $value : array();
559
+ break;
560
+ case 'date-format':
561
+ if ( '\c\u\s\t\o\m' === $value ) {
562
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
563
+ $custom = isset( $_REQUEST[ $option['id'] . '_text' ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $option['id'] . '_text' ] ) ) : $option['default'];
564
+ $value = $custom;
 
 
 
 
 
 
 
 
 
 
565
  }
566
+ break;
567
+ case 'toggle-element':
568
+ if ( $value && isset( $option['elements'] ) && ! empty( $option['elements'] ) ) {
569
 
570
+ if ( isset( $value['box_id'] ) ) {
571
+ unset( $value['box_id'] );
572
+ }
573
 
574
+ foreach ( $value as $index => $single_toggle ) {
 
 
 
 
575
 
576
+ if ( $value && isset( $option['onoff_field'] ) && ! empty( $option['onoff_field'] ) ) {
577
+ $on_off = $option['onoff_field'];
578
+ $on_off['type'] = 'yith-field';
579
+ $on_off['yith-type'] = 'onoff';
580
+ $on_off_id = $on_off['id'];
581
+
582
+ $value[ $index ][ $on_off_id ] = isset( $single_toggle[ $on_off_id ] ) ? self::sanitize_option( $single_toggle[ $on_off_id ], $on_off, $single_toggle[ $on_off_id ] ) : 'no';
583
+ }
584
 
585
+ foreach ( $option['elements'] as $element ) {
586
+ $element_value = isset( $value[ $index ][ $element['id'] ] ) ? $value[ $index ][ $element['id'] ] : false;
587
+ // We don't need to un-slash the value, since it's already un-slashed.
588
+ $value[ $index ][ $element['id'] ] = self::sanitize_option( $element_value, $element, $element_value );
589
+ }
590
  }
591
  }
592
+ break;
593
+ }
594
+
595
+ if ( $multiple && empty( $value ) ) {
596
+ $value = array();
597
  }
598
 
599
  if ( ! empty( $option['yith-sanitize-callback'] ) && is_callable( $option['yith-sanitize-callback'] ) ) {
601
  }
602
  }
603
 
604
+ return apply_filters( 'yith_plugin_fw_wc_panel_sanitize_option', $value, $option, $raw_value );
605
  }
606
 
607
  /**
686
 
687
  $value = $new_value;
688
  }
689
+
690
+ $value = wp_unslash( $value ); // The value must be un-slashed before using it in self::sanitize_option.
691
  $value = self::sanitize_option( $value, $option_array[ $option_id ], $value );
692
  $updated = update_option( $option_id, $value );
693
  }
plugin-fw/includes/class-yit-plugin-panel.php CHANGED
@@ -1330,7 +1330,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
1330
  ?>
1331
  <?php if ( $this->is_free() && isset( $this->settings['plugin_slug'] ) ) : ?>
1332
  <?php
1333
- $rate_link = apply_filters( 'yith_plugin_fw_rate_url', 'https://wordpress.org/support/plugin/' . $this->settings['plugin_slug'] . '/reviews/?rate=5#new-post' );
1334
  ?>
1335
  <h1 class="notice-container"></h1>
1336
  <div class="yith-plugin-fw-banner">
1330
  ?>
1331
  <?php if ( $this->is_free() && isset( $this->settings['plugin_slug'] ) ) : ?>
1332
  <?php
1333
+ $rate_link = apply_filters( 'yith_plugin_fw_rate_url', 'https://wordpress.org/support/plugin/' . $this->settings['plugin_slug'] . '/reviews/#new-post' );
1334
  ?>
1335
  <h1 class="notice-container"></h1>
1336
  <div class="yith-plugin-fw-banner">
plugin-fw/includes/class-yit-pointers.php CHANGED
@@ -78,7 +78,7 @@ if ( ! class_exists( 'YIT_Pointers' ) ) {
78
  private function __construct() {
79
 
80
  $title = __( 'Plugins Activated', 'yith-plugin-fw' );
81
- $message = __( 'From now on, you can find all plugin options in YITH Plugins menu. Plugin customization settings will be available as a new entry in YITH Plugins menu.', 'yith-plugin-fw' );
82
  $discover_message = sprintf(
83
  // translators: 1. YITH site link; 2. WordPress site link.
84
  __( 'Discover all our plugins available on: %1$s and %2$s', 'yith-plugin-fw' ),
@@ -94,7 +94,7 @@ if ( ! class_exists( 'YIT_Pointers' ) ) {
94
  );
95
 
96
  $title = __( 'Plugins Upgraded', 'yith-plugin-fw' );
97
- $message = __( 'From now on, you can find the option panel of YITH plugins in YITH Plugins menu. Every time one of our plugins is added, a new entry will be added to this menu. For example, after the update, plugin options (such as for YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from previous location to YITH Plugins tab.', 'yith-plugin-fw' );
98
  $discover_message = sprintf(
99
  // translators: 1. YITH site link; 2. WordPress site link.
100
  __( 'Discover all our plugins available on: %1$s and %2$s', 'yith-plugin-fw' ),
78
  private function __construct() {
79
 
80
  $title = __( 'Plugins Activated', 'yith-plugin-fw' );
81
+ $message = __( 'From now on, you can find all plugin options in YITH menu. Plugin customization settings will be available as a new entry in YITH menu.', 'yith-plugin-fw' );
82
  $discover_message = sprintf(
83
  // translators: 1. YITH site link; 2. WordPress site link.
84
  __( 'Discover all our plugins available on: %1$s and %2$s', 'yith-plugin-fw' ),
94
  );
95
 
96
  $title = __( 'Plugins Upgraded', 'yith-plugin-fw' );
97
+ $message = __( 'From now on, you can find the option panel of YITH plugins in YITH menu. Every time one of our plugins is added, a new entry will be added to this menu. For example, after the update, plugin options (such as for YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from previous location to YITH menu.', 'yith-plugin-fw' );
98
  $discover_message = sprintf(
99
  // translators: 1. YITH site link; 2. WordPress site link.
100
  __( 'Discover all our plugins available on: %1$s and %2$s', 'yith-plugin-fw' ),
plugin-fw/includes/class-yith-system-status.php CHANGED
@@ -182,8 +182,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
182
  $this->add_requirements(
183
  esc_html__( 'YITH Plugins', 'yith-plugin-fw' ),
184
  array(
185
- 'min_wp_version' => '5.3',
186
- 'min_wc_version' => '4.2',
187
  'min_php_version' => '5.6.20',
188
  )
189
  );
182
  $this->add_requirements(
183
  esc_html__( 'YITH Plugins', 'yith-plugin-fw' ),
184
  array(
185
+ 'min_wp_version' => '5.4',
186
+ 'min_wc_version' => '4.5',
187
  'min_php_version' => '5.6.20',
188
  )
189
  );
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.5.4
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author YITH
10
- * @version 3.5.4
11
  * @package YITH\PluginFramework
12
  */
13
 
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.6.0
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author YITH
10
+ * @version 3.6.0
11
  * @package YITH\PluginFramework
12
  */
13
 
plugin-fw/languages/yith-plugin-fw-el.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-el.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2021-02-03 16:08:01+00:00\n"
8
- "PO-Revision-Date: 2020-09-25 09:16:07+0000\n"
9
  "Language: el_GR\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -13,27 +13,27 @@ msgstr ""
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
- #: includes/class-yit-assets.php:117
17
  msgid "Clear"
18
  msgstr "Καθαρισμός"
19
 
20
- #: includes/class-yit-assets.php:118
21
  msgid "Clear color"
22
  msgstr "Καθαρισμός χρώματος"
23
 
24
- #: includes/class-yit-assets.php:119
25
  msgid "Default"
26
  msgstr "Προεπιλεγμένο"
27
 
28
- #: includes/class-yit-assets.php:120
29
  msgid "Select default color"
30
  msgstr "Επιλογή προεπιλεγμένου χρώματος"
31
 
32
- #: includes/class-yit-assets.php:121
33
  msgid "Select Color"
34
  msgstr "Επιλογή Χρώματος"
35
 
36
- #: includes/class-yit-assets.php:122
37
  msgid "Color value"
38
  msgstr "Αξία χρώματος"
39
 
@@ -146,14 +146,14 @@ msgstr "Ενεργοποιημένα Πρόσθετα"
146
 
147
  #: includes/class-yit-pointers.php:81
148
  msgid ""
149
- "From now on, you can find all plugin options in YITH Plugins menu. Plugin "
150
- "customization settings will be available as a new entry in YITH Plugins menu."
151
  msgstr ""
152
 
153
  #. translators: 1. YITH site link; 2. WordPress site link.
154
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
155
  msgid "Discover all our plugins available on: %1$s and %2$s"
156
- msgstr ""
157
 
158
  #: includes/class-yit-pointers.php:96
159
  msgid "Plugins Upgraded"
@@ -161,11 +161,11 @@ msgstr "Αναβαθμισμένα Πρόσθετα"
161
 
162
  #: includes/class-yit-pointers.php:97
163
  msgid ""
164
- "From now on, you can find the option panel of YITH plugins in YITH Plugins "
165
- "menu. Every time one of our plugins is added, a new entry will be added to "
166
- "this menu. For example, after the update, plugin options (such as for YITH "
167
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
168
- "previous location to YITH Plugins tab."
169
  msgstr ""
170
 
171
  #: includes/class-yith-dashboard.php:35
@@ -419,7 +419,7 @@ msgstr "Προσαρμογή:"
419
 
420
  #: templates/fields/date-format.php:70
421
  msgid "Preview:"
422
- msgstr ""
423
 
424
  #: templates/fields/icons.php:63
425
  msgid "Set Default"
@@ -492,12 +492,12 @@ msgstr "Επαναφορά Προεπιλεγμένων"
492
 
493
  #: templates/sysinfo/system-information-panel.php:12
494
  msgid "PHPInfo"
495
- msgstr ""
496
 
497
  #: templates/sysinfo/system-information-panel.php:13
498
  #: templates/sysinfo/tabs/error-log.php:25
499
  msgid "Log Files"
500
- msgstr ""
501
 
502
  #: templates/sysinfo/system-information-panel.php:22
503
  msgid "YITH System Information"
@@ -513,11 +513,12 @@ msgstr "Αρχείο PHP error_log"
513
 
514
  #: templates/sysinfo/tabs/error-log.php:60
515
  msgid "Download"
516
- msgstr ""
517
 
518
  #: templates/sysinfo/tabs/error-log.php:72
519
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
520
  msgstr ""
 
521
 
522
  #. translators: %s file name.
523
  #: templates/sysinfo/tabs/error-log.php:96
@@ -525,18 +526,20 @@ msgid ""
525
  "No Log file available. Enable the WordPress debug by adding this in the %s "
526
  "file of your installation"
527
  msgstr ""
 
 
528
 
529
  #: templates/sysinfo/tabs/error-log.php:105
530
  msgid "Copied!"
531
- msgstr ""
532
 
533
  #: templates/sysinfo/tabs/error-log.php:105
534
  msgid "Copy Code"
535
- msgstr ""
536
 
537
  #: templates/sysinfo/tabs/main.php:15
538
  msgid "Site Info"
539
- msgstr ""
540
 
541
  #: templates/sysinfo/tabs/main.php:20
542
  msgid "Site URL"
@@ -560,13 +563,13 @@ msgstr "Όχι"
560
 
561
  #: templates/sysinfo/tabs/main.php:45
562
  msgid "External object cache"
563
- msgstr ""
564
 
565
  #: templates/sysinfo/tabs/main.php:54
566
  msgid "Plugins Requirements"
567
- msgstr ""
568
 
569
- #: yit-plugin.php:187
570
  msgid "License"
571
  msgstr "Άδεια χρήσης προϊόντος"
572
 
@@ -574,6 +577,17 @@ msgstr "Άδεια χρήσης προϊόντος"
574
  msgid "YITH"
575
  msgstr "YITH"
576
 
 
 
 
 
 
 
 
 
 
 
 
577
  #: includes/class-yith-dashboard.php:96
578
  msgctxt "Plugin FW"
579
  msgid "View Changelog"
@@ -589,11 +603,6 @@ msgctxt "Button label"
589
  msgid "Close"
590
  msgstr "Απενεργοποίηση"
591
 
592
- #: includes/class-yith-gutenberg.php:131
593
- msgctxt "[gutenberg]: Category Name"
594
- msgid "YITH"
595
- msgstr "YITH"
596
-
597
  #: includes/privacy/class-yith-privacy.php:61
598
  msgctxt "Privacy Policy Guide Title"
599
  msgid "YITH Plugins"
@@ -658,7 +667,7 @@ msgctxt "Position in the \"Dimensions\" field"
658
  msgid "Left"
659
  msgstr "Αριστερά"
660
 
661
- #: templates/fields/dimensions.php:88
662
  msgctxt "Tooltip in the \"Dimensions\" field"
663
  msgid "Link values together"
664
  msgstr "Συνδέστε αξίες"
@@ -666,34 +675,34 @@ msgstr "Συνδέστε αξίες"
666
  #: templates/fields/onoff.php:28
667
  msgctxt "YES/NO button: use MAX 4 characters!"
668
  msgid "YES"
669
- msgstr ""
670
 
671
  #: templates/fields/onoff.php:29
672
  msgctxt "YES/NO button: use MAX 4 characters!"
673
  msgid "NO"
674
- msgstr ""
675
 
676
- #: yit-plugin.php:75
677
  msgctxt "Plugin Row Meta"
678
  msgid "Live Demo"
679
  msgstr "Live Demo"
680
 
681
- #: yit-plugin.php:79
682
  msgctxt "Plugin Row Meta"
683
  msgid "Documentation"
684
  msgstr "Εγχειρίδιο χρήσης"
685
 
686
- #: yit-plugin.php:83
687
  msgctxt "Plugin Row Meta"
688
  msgid "Support"
689
  msgstr "Υποστήριξη"
690
 
691
- #: yit-plugin.php:87
692
  msgctxt "Plugin Row Meta"
693
  msgid "Premium version"
694
  msgstr "Premium έκδοση"
695
 
696
- #: yit-plugin.php:183
697
  msgctxt "Action links"
698
  msgid "Settings"
699
  msgstr "Ρυθμίσεις"
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2021-02-23 14:12:38+00:00\n"
8
+ "PO-Revision-Date: 2021-02-11 18:07:46+0000\n"
9
  "Language: el_GR\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
+ #: includes/class-yit-assets.php:129
17
  msgid "Clear"
18
  msgstr "Καθαρισμός"
19
 
20
+ #: includes/class-yit-assets.php:130
21
  msgid "Clear color"
22
  msgstr "Καθαρισμός χρώματος"
23
 
24
+ #: includes/class-yit-assets.php:131
25
  msgid "Default"
26
  msgstr "Προεπιλεγμένο"
27
 
28
+ #: includes/class-yit-assets.php:132
29
  msgid "Select default color"
30
  msgstr "Επιλογή προεπιλεγμένου χρώματος"
31
 
32
+ #: includes/class-yit-assets.php:133
33
  msgid "Select Color"
34
  msgstr "Επιλογή Χρώματος"
35
 
36
+ #: includes/class-yit-assets.php:134
37
  msgid "Color value"
38
  msgstr "Αξία χρώματος"
39
 
146
 
147
  #: includes/class-yit-pointers.php:81
148
  msgid ""
149
+ "From now on, you can find all plugin options in YITH menu. Plugin "
150
+ "customization settings will be available as a new entry in YITH menu."
151
  msgstr ""
152
 
153
  #. translators: 1. YITH site link; 2. WordPress site link.
154
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
155
  msgid "Discover all our plugins available on: %1$s and %2$s"
156
+ msgstr "Ανακαλύψτε όλα τα διαθέσιμά μας πρόσθετα στο: %1$s και %2$s"
157
 
158
  #: includes/class-yit-pointers.php:96
159
  msgid "Plugins Upgraded"
161
 
162
  #: includes/class-yit-pointers.php:97
163
  msgid ""
164
+ "From now on, you can find the option panel of YITH plugins in YITH menu. "
165
+ "Every time one of our plugins is added, a new entry will be added to this "
166
+ "menu. For example, after the update, plugin options (such as for YITH "
167
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
168
+ "previous location to YITH menu."
169
  msgstr ""
170
 
171
  #: includes/class-yith-dashboard.php:35
419
 
420
  #: templates/fields/date-format.php:70
421
  msgid "Preview:"
422
+ msgstr "Προεπισκόπηση:"
423
 
424
  #: templates/fields/icons.php:63
425
  msgid "Set Default"
492
 
493
  #: templates/sysinfo/system-information-panel.php:12
494
  msgid "PHPInfo"
495
+ msgstr "PHPInfo"
496
 
497
  #: templates/sysinfo/system-information-panel.php:13
498
  #: templates/sysinfo/tabs/error-log.php:25
499
  msgid "Log Files"
500
+ msgstr "Αρχεία Καταγραφής"
501
 
502
  #: templates/sysinfo/system-information-panel.php:22
503
  msgid "YITH System Information"
513
 
514
  #: templates/sysinfo/tabs/error-log.php:60
515
  msgid "Download"
516
+ msgstr "Κατέβασμα"
517
 
518
  #: templates/sysinfo/tabs/error-log.php:72
519
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
520
  msgstr ""
521
+ "Το μέγεθος αρχείου υπερβαίνει τα 8 megabytes οπότε θα πρέπει να το κατεβάσετε"
522
 
523
  #. translators: %s file name.
524
  #: templates/sysinfo/tabs/error-log.php:96
526
  "No Log file available. Enable the WordPress debug by adding this in the %s "
527
  "file of your installation"
528
  msgstr ""
529
+ "Δεν υπάρχει διαθέσιμο αρχείο Καταγραφής. Ενεργοποιήστε την αποσφαλμάτωση "
530
+ "WordPress προσθέτοντάς το στο αρχείο %s της εγκατάστασής σας"
531
 
532
  #: templates/sysinfo/tabs/error-log.php:105
533
  msgid "Copied!"
534
+ msgstr "Έγινε αντιγραφή!"
535
 
536
  #: templates/sysinfo/tabs/error-log.php:105
537
  msgid "Copy Code"
538
+ msgstr "Αντιγραφή Κώδικα"
539
 
540
  #: templates/sysinfo/tabs/main.php:15
541
  msgid "Site Info"
542
+ msgstr "Στοιχεία Ιστότοπου"
543
 
544
  #: templates/sysinfo/tabs/main.php:20
545
  msgid "Site URL"
563
 
564
  #: templates/sysinfo/tabs/main.php:45
565
  msgid "External object cache"
566
+ msgstr "Cache εξωτερικού αντικειμένου"
567
 
568
  #: templates/sysinfo/tabs/main.php:54
569
  msgid "Plugins Requirements"
570
+ msgstr "Προϋποθέσεις Πρόσθετων"
571
 
572
+ #: yit-plugin.php:190
573
  msgid "License"
574
  msgstr "Άδεια χρήσης προϊόντος"
575
 
577
  msgid "YITH"
578
  msgstr "YITH"
579
 
580
+ #. translators: %s it the Elementor Widget title.
581
+ #: includes/builders/elementor/class-yith-elementor-widget.php:252
582
+ msgctxt "Elementor Widget - section title"
583
+ msgid "%s - Options"
584
+ msgstr ""
585
+
586
+ #: includes/builders/gutenberg/class-yith-gutenberg.php:147
587
+ msgctxt "[gutenberg]: Category Name"
588
+ msgid "YITH"
589
+ msgstr "YITH"
590
+
591
  #: includes/class-yith-dashboard.php:96
592
  msgctxt "Plugin FW"
593
  msgid "View Changelog"
603
  msgid "Close"
604
  msgstr "Απενεργοποίηση"
605
 
 
 
 
 
 
606
  #: includes/privacy/class-yith-privacy.php:61
607
  msgctxt "Privacy Policy Guide Title"
608
  msgid "YITH Plugins"
667
  msgid "Left"
668
  msgstr "Αριστερά"
669
 
670
+ #: templates/fields/dimensions.php:94
671
  msgctxt "Tooltip in the \"Dimensions\" field"
672
  msgid "Link values together"
673
  msgstr "Συνδέστε αξίες"
675
  #: templates/fields/onoff.php:28
676
  msgctxt "YES/NO button: use MAX 4 characters!"
677
  msgid "YES"
678
+ msgstr "ΝΑΙ"
679
 
680
  #: templates/fields/onoff.php:29
681
  msgctxt "YES/NO button: use MAX 4 characters!"
682
  msgid "NO"
683
+ msgstr "ΟΧΙ"
684
 
685
+ #: yit-plugin.php:78
686
  msgctxt "Plugin Row Meta"
687
  msgid "Live Demo"
688
  msgstr "Live Demo"
689
 
690
+ #: yit-plugin.php:82
691
  msgctxt "Plugin Row Meta"
692
  msgid "Documentation"
693
  msgstr "Εγχειρίδιο χρήσης"
694
 
695
+ #: yit-plugin.php:86
696
  msgctxt "Plugin Row Meta"
697
  msgid "Support"
698
  msgstr "Υποστήριξη"
699
 
700
+ #: yit-plugin.php:90
701
  msgctxt "Plugin Row Meta"
702
  msgid "Premium version"
703
  msgstr "Premium έκδοση"
704
 
705
+ #: yit-plugin.php:186
706
  msgctxt "Action links"
707
  msgid "Settings"
708
  msgstr "Ρυθμίσεις"
plugin-fw/languages/yith-plugin-fw-es_ES.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-es_ES.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2021-02-03 16:08:01+00:00\n"
8
- "PO-Revision-Date: 2021-01-19 14:22:57+0000\n"
9
  "Language: es\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -13,27 +13,27 @@ msgstr ""
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
- #: includes/class-yit-assets.php:117
17
  msgid "Clear"
18
  msgstr "Borrar"
19
 
20
- #: includes/class-yit-assets.php:118
21
  msgid "Clear color"
22
  msgstr "Borrar color"
23
 
24
- #: includes/class-yit-assets.php:119
25
  msgid "Default"
26
  msgstr "Predeterminado"
27
 
28
- #: includes/class-yit-assets.php:120
29
  msgid "Select default color"
30
  msgstr "Seleccionar color predeterminado"
31
 
32
- #: includes/class-yit-assets.php:121
33
  msgid "Select Color"
34
  msgstr "Seleccionar color"
35
 
36
- #: includes/class-yit-assets.php:122
37
  msgid "Color value"
38
  msgstr "Valor del color"
39
 
@@ -146,14 +146,17 @@ msgstr "Plugins activados"
146
 
147
  #: includes/class-yit-pointers.php:81
148
  msgid ""
149
- "From now on, you can find all plugin options in YITH Plugins menu. Plugin "
150
- "customization settings will be available as a new entry in YITH Plugins menu."
151
  msgstr ""
 
 
 
152
 
153
  #. translators: 1. YITH site link; 2. WordPress site link.
154
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
155
  msgid "Discover all our plugins available on: %1$s and %2$s"
156
- msgstr ""
157
 
158
  #: includes/class-yit-pointers.php:96
159
  msgid "Plugins Upgraded"
@@ -161,12 +164,18 @@ msgstr "Plugins mejorados"
161
 
162
  #: includes/class-yit-pointers.php:97
163
  msgid ""
164
- "From now on, you can find the option panel of YITH plugins in YITH Plugins "
165
- "menu. Every time one of our plugins is added, a new entry will be added to "
166
- "this menu. For example, after the update, plugin options (such as for YITH "
167
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
168
- "previous location to YITH Plugins tab."
169
  msgstr ""
 
 
 
 
 
 
170
 
171
  #: includes/class-yith-dashboard.php:35
172
  msgid "YITH Latest Updates"
@@ -417,7 +426,7 @@ msgstr "Personalizado:"
417
 
418
  #: templates/fields/date-format.php:70
419
  msgid "Preview:"
420
- msgstr ""
421
 
422
  #: templates/fields/icons.php:63
423
  msgid "Set Default"
@@ -490,12 +499,12 @@ msgstr "Restablecer valores predeterminados"
490
 
491
  #: templates/sysinfo/system-information-panel.php:12
492
  msgid "PHPInfo"
493
- msgstr ""
494
 
495
  #: templates/sysinfo/system-information-panel.php:13
496
  #: templates/sysinfo/tabs/error-log.php:25
497
  msgid "Log Files"
498
- msgstr ""
499
 
500
  #: templates/sysinfo/system-information-panel.php:22
501
  msgid "YITH System Information"
@@ -511,11 +520,11 @@ msgstr "Archivo PHP error_log"
511
 
512
  #: templates/sysinfo/tabs/error-log.php:60
513
  msgid "Download"
514
- msgstr ""
515
 
516
  #: templates/sysinfo/tabs/error-log.php:72
517
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
518
- msgstr ""
519
 
520
  #. translators: %s file name.
521
  #: templates/sysinfo/tabs/error-log.php:96
@@ -523,18 +532,20 @@ msgid ""
523
  "No Log file available. Enable the WordPress debug by adding this in the %s "
524
  "file of your installation"
525
  msgstr ""
 
 
526
 
527
  #: templates/sysinfo/tabs/error-log.php:105
528
  msgid "Copied!"
529
- msgstr ""
530
 
531
  #: templates/sysinfo/tabs/error-log.php:105
532
  msgid "Copy Code"
533
- msgstr ""
534
 
535
  #: templates/sysinfo/tabs/main.php:15
536
  msgid "Site Info"
537
- msgstr ""
538
 
539
  #: templates/sysinfo/tabs/main.php:20
540
  msgid "Site URL"
@@ -558,13 +569,13 @@ msgstr "No"
558
 
559
  #: templates/sysinfo/tabs/main.php:45
560
  msgid "External object cache"
561
- msgstr ""
562
 
563
  #: templates/sysinfo/tabs/main.php:54
564
  msgid "Plugins Requirements"
565
- msgstr ""
566
 
567
- #: yit-plugin.php:187
568
  msgid "License"
569
  msgstr "Licencia"
570
 
@@ -572,6 +583,17 @@ msgstr "Licencia"
572
  msgid "YITH"
573
  msgstr "YITH"
574
 
 
 
 
 
 
 
 
 
 
 
 
575
  #: includes/class-yith-dashboard.php:96
576
  msgctxt "Plugin FW"
577
  msgid "View Changelog"
@@ -587,11 +609,6 @@ msgctxt "Button label"
587
  msgid "Close"
588
  msgstr "Cerrar"
589
 
590
- #: includes/class-yith-gutenberg.php:131
591
- msgctxt "[gutenberg]: Category Name"
592
- msgid "YITH"
593
- msgstr "YITH"
594
-
595
  #: includes/privacy/class-yith-privacy.php:61
596
  msgctxt "Privacy Policy Guide Title"
597
  msgid "YITH Plugins"
@@ -654,7 +671,7 @@ msgctxt "Position in the \"Dimensions\" field"
654
  msgid "Left"
655
  msgstr "Izquierda"
656
 
657
- #: templates/fields/dimensions.php:88
658
  msgctxt "Tooltip in the \"Dimensions\" field"
659
  msgid "Link values together"
660
  msgstr "Enlazar valores juntos"
@@ -662,34 +679,34 @@ msgstr "Enlazar valores juntos"
662
  #: templates/fields/onoff.php:28
663
  msgctxt "YES/NO button: use MAX 4 characters!"
664
  msgid "YES"
665
- msgstr ""
666
 
667
  #: templates/fields/onoff.php:29
668
  msgctxt "YES/NO button: use MAX 4 characters!"
669
  msgid "NO"
670
- msgstr ""
671
 
672
- #: yit-plugin.php:75
673
  msgctxt "Plugin Row Meta"
674
  msgid "Live Demo"
675
  msgstr "Demostración en vivo"
676
 
677
- #: yit-plugin.php:79
678
  msgctxt "Plugin Row Meta"
679
  msgid "Documentation"
680
  msgstr "Documentación"
681
 
682
- #: yit-plugin.php:83
683
  msgctxt "Plugin Row Meta"
684
  msgid "Support"
685
  msgstr "Soporte"
686
 
687
- #: yit-plugin.php:87
688
  msgctxt "Plugin Row Meta"
689
  msgid "Premium version"
690
  msgstr "Versión premium"
691
 
692
- #: yit-plugin.php:183
693
  msgctxt "Action links"
694
  msgid "Settings"
695
  msgstr "Ajustes"
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2021-02-23 14:12:38+00:00\n"
8
+ "PO-Revision-Date: 2021-02-15 20:26:24+0000\n"
9
  "Language: es\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
+ #: includes/class-yit-assets.php:129
17
  msgid "Clear"
18
  msgstr "Borrar"
19
 
20
+ #: includes/class-yit-assets.php:130
21
  msgid "Clear color"
22
  msgstr "Borrar color"
23
 
24
+ #: includes/class-yit-assets.php:131
25
  msgid "Default"
26
  msgstr "Predeterminado"
27
 
28
+ #: includes/class-yit-assets.php:132
29
  msgid "Select default color"
30
  msgstr "Seleccionar color predeterminado"
31
 
32
+ #: includes/class-yit-assets.php:133
33
  msgid "Select Color"
34
  msgstr "Seleccionar color"
35
 
36
+ #: includes/class-yit-assets.php:134
37
  msgid "Color value"
38
  msgstr "Valor del color"
39
 
146
 
147
  #: includes/class-yit-pointers.php:81
148
  msgid ""
149
+ "From now on, you can find all plugin options in YITH menu. Plugin "
150
+ "customization settings will be available as a new entry in YITH menu."
151
  msgstr ""
152
+ "Desde ahora, puedes encontrar todas las opciones de los plugins en el menú "
153
+ "YITH plugins. La personalización de los ajustes del plugins estará "
154
+ "disponible como una nueva entrada en el menú YITH plugins."
155
 
156
  #. translators: 1. YITH site link; 2. WordPress site link.
157
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
158
  msgid "Discover all our plugins available on: %1$s and %2$s"
159
+ msgstr "Descubre todos nuestros plugins disponibles en: %1$s y %2$s"
160
 
161
  #: includes/class-yit-pointers.php:96
162
  msgid "Plugins Upgraded"
164
 
165
  #: includes/class-yit-pointers.php:97
166
  msgid ""
167
+ "From now on, you can find the option panel of YITH plugins in YITH menu. "
168
+ "Every time one of our plugins is added, a new entry will be added to this "
169
+ "menu. For example, after the update, plugin options (such as for YITH "
170
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
171
+ "previous location to YITH menu."
172
  msgstr ""
173
+ "Desde ahora puedes encontrar la opción en el panel de Plugins de YITH en el "
174
+ "menú YITH plugins. Cada vez que uno de nuestros plugins es añadido, una "
175
+ "nueva entrada será añadida a este menú. Por ejemplo, tras la actualización, "
176
+ "las opciones de los plugins (tales como YITH WooCommerce Wishlist, YITH "
177
+ "WooCommerce Ajax Search, etc.) serán movidos de la ubicación previa a la "
178
+ "pestaña de YITH plugins."
179
 
180
  #: includes/class-yith-dashboard.php:35
181
  msgid "YITH Latest Updates"
426
 
427
  #: templates/fields/date-format.php:70
428
  msgid "Preview:"
429
+ msgstr "Vista previa:"
430
 
431
  #: templates/fields/icons.php:63
432
  msgid "Set Default"
499
 
500
  #: templates/sysinfo/system-information-panel.php:12
501
  msgid "PHPInfo"
502
+ msgstr "Información PHP"
503
 
504
  #: templates/sysinfo/system-information-panel.php:13
505
  #: templates/sysinfo/tabs/error-log.php:25
506
  msgid "Log Files"
507
+ msgstr "Archivos de registro"
508
 
509
  #: templates/sysinfo/system-information-panel.php:22
510
  msgid "YITH System Information"
520
 
521
  #: templates/sysinfo/tabs/error-log.php:60
522
  msgid "Download"
523
+ msgstr "Descargar"
524
 
525
  #: templates/sysinfo/tabs/error-log.php:72
526
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
527
+ msgstr "El archivo excede los 8 megabytes por lo que debe ser descargado"
528
 
529
  #. translators: %s file name.
530
  #: templates/sysinfo/tabs/error-log.php:96
532
  "No Log file available. Enable the WordPress debug by adding this in the %s "
533
  "file of your installation"
534
  msgstr ""
535
+ "No hay archivo de registro disponible. Activa la depuración de WordPress "
536
+ "añadiendo esto en el archivo %s de tu instalación"
537
 
538
  #: templates/sysinfo/tabs/error-log.php:105
539
  msgid "Copied!"
540
+ msgstr "¡Copiado!"
541
 
542
  #: templates/sysinfo/tabs/error-log.php:105
543
  msgid "Copy Code"
544
+ msgstr "Copiar código"
545
 
546
  #: templates/sysinfo/tabs/main.php:15
547
  msgid "Site Info"
548
+ msgstr "Información del sitio"
549
 
550
  #: templates/sysinfo/tabs/main.php:20
551
  msgid "Site URL"
569
 
570
  #: templates/sysinfo/tabs/main.php:45
571
  msgid "External object cache"
572
+ msgstr "Caché objeto externo"
573
 
574
  #: templates/sysinfo/tabs/main.php:54
575
  msgid "Plugins Requirements"
576
+ msgstr "Requerimientos de los plugins"
577
 
578
+ #: yit-plugin.php:190
579
  msgid "License"
580
  msgstr "Licencia"
581
 
583
  msgid "YITH"
584
  msgstr "YITH"
585
 
586
+ #. translators: %s it the Elementor Widget title.
587
+ #: includes/builders/elementor/class-yith-elementor-widget.php:252
588
+ msgctxt "Elementor Widget - section title"
589
+ msgid "%s - Options"
590
+ msgstr ""
591
+
592
+ #: includes/builders/gutenberg/class-yith-gutenberg.php:147
593
+ msgctxt "[gutenberg]: Category Name"
594
+ msgid "YITH"
595
+ msgstr "YITH"
596
+
597
  #: includes/class-yith-dashboard.php:96
598
  msgctxt "Plugin FW"
599
  msgid "View Changelog"
609
  msgid "Close"
610
  msgstr "Cerrar"
611
 
 
 
 
 
 
612
  #: includes/privacy/class-yith-privacy.php:61
613
  msgctxt "Privacy Policy Guide Title"
614
  msgid "YITH Plugins"
671
  msgid "Left"
672
  msgstr "Izquierda"
673
 
674
+ #: templates/fields/dimensions.php:94
675
  msgctxt "Tooltip in the \"Dimensions\" field"
676
  msgid "Link values together"
677
  msgstr "Enlazar valores juntos"
679
  #: templates/fields/onoff.php:28
680
  msgctxt "YES/NO button: use MAX 4 characters!"
681
  msgid "YES"
682
+ msgstr ""
683
 
684
  #: templates/fields/onoff.php:29
685
  msgctxt "YES/NO button: use MAX 4 characters!"
686
  msgid "NO"
687
+ msgstr "NO"
688
 
689
+ #: yit-plugin.php:78
690
  msgctxt "Plugin Row Meta"
691
  msgid "Live Demo"
692
  msgstr "Demostración en vivo"
693
 
694
+ #: yit-plugin.php:82
695
  msgctxt "Plugin Row Meta"
696
  msgid "Documentation"
697
  msgstr "Documentación"
698
 
699
+ #: yit-plugin.php:86
700
  msgctxt "Plugin Row Meta"
701
  msgid "Support"
702
  msgstr "Soporte"
703
 
704
+ #: yit-plugin.php:90
705
  msgctxt "Plugin Row Meta"
706
  msgid "Premium version"
707
  msgstr "Versión premium"
708
 
709
+ #: yit-plugin.php:186
710
  msgctxt "Action links"
711
  msgid "Settings"
712
  msgstr "Ajustes"
plugin-fw/languages/yith-plugin-fw-it_IT.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-it_IT.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2021-02-03 16:08:01+00:00\n"
8
- "PO-Revision-Date: 2020-09-24 14:56:37+0000\n"
9
  "Language: it\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -13,27 +13,27 @@ msgstr ""
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
- #: includes/class-yit-assets.php:117
17
  msgid "Clear"
18
  msgstr "Rimuovi"
19
 
20
- #: includes/class-yit-assets.php:118
21
  msgid "Clear color"
22
  msgstr "Rimuovi colore"
23
 
24
- #: includes/class-yit-assets.php:119
25
  msgid "Default"
26
  msgstr "Predefinito"
27
 
28
- #: includes/class-yit-assets.php:120
29
  msgid "Select default color"
30
  msgstr "Seleziona il colore predefinito"
31
 
32
- #: includes/class-yit-assets.php:121
33
  msgid "Select Color"
34
  msgstr "Seleziona il colore"
35
 
36
- #: includes/class-yit-assets.php:122
37
  msgid "Color value"
38
  msgstr "Valore del colore"
39
 
@@ -144,14 +144,17 @@ msgstr "Plugin attivati"
144
 
145
  #: includes/class-yit-pointers.php:81
146
  msgid ""
147
- "From now on, you can find all plugin options in YITH Plugins menu. Plugin "
148
- "customization settings will be available as a new entry in YITH Plugins menu."
149
  msgstr ""
 
 
 
150
 
151
  #. translators: 1. YITH site link; 2. WordPress site link.
152
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
153
  msgid "Discover all our plugins available on: %1$s and %2$s"
154
- msgstr ""
155
 
156
  #: includes/class-yit-pointers.php:96
157
  msgid "Plugins Upgraded"
@@ -159,12 +162,17 @@ msgstr "Plugin aggiornati"
159
 
160
  #: includes/class-yit-pointers.php:97
161
  msgid ""
162
- "From now on, you can find the option panel of YITH plugins in YITH Plugins "
163
- "menu. Every time one of our plugins is added, a new entry will be added to "
164
- "this menu. For example, after the update, plugin options (such as for YITH "
165
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
166
- "previous location to YITH Plugins tab."
167
  msgstr ""
 
 
 
 
 
168
 
169
  #: includes/class-yith-dashboard.php:35
170
  msgid "YITH Latest Updates"
@@ -416,7 +424,7 @@ msgstr "Personalizzato:"
416
 
417
  #: templates/fields/date-format.php:70
418
  msgid "Preview:"
419
- msgstr ""
420
 
421
  #: templates/fields/icons.php:63
422
  msgid "Set Default"
@@ -489,12 +497,12 @@ msgstr "Ripristina impostazioni iniziali"
489
 
490
  #: templates/sysinfo/system-information-panel.php:12
491
  msgid "PHPInfo"
492
- msgstr ""
493
 
494
  #: templates/sysinfo/system-information-panel.php:13
495
  #: templates/sysinfo/tabs/error-log.php:25
496
  msgid "Log Files"
497
- msgstr ""
498
 
499
  #: templates/sysinfo/system-information-panel.php:22
500
  msgid "YITH System Information"
@@ -510,11 +518,13 @@ msgstr "PHP error_log file"
510
 
511
  #: templates/sysinfo/tabs/error-log.php:60
512
  msgid "Download"
513
- msgstr ""
514
 
515
  #: templates/sysinfo/tabs/error-log.php:72
516
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
517
  msgstr ""
 
 
518
 
519
  #. translators: %s file name.
520
  #: templates/sysinfo/tabs/error-log.php:96
@@ -522,18 +532,20 @@ msgid ""
522
  "No Log file available. Enable the WordPress debug by adding this in the %s "
523
  "file of your installation"
524
  msgstr ""
 
 
525
 
526
  #: templates/sysinfo/tabs/error-log.php:105
527
  msgid "Copied!"
528
- msgstr ""
529
 
530
  #: templates/sysinfo/tabs/error-log.php:105
531
  msgid "Copy Code"
532
- msgstr ""
533
 
534
  #: templates/sysinfo/tabs/main.php:15
535
  msgid "Site Info"
536
- msgstr ""
537
 
538
  #: templates/sysinfo/tabs/main.php:20
539
  msgid "Site URL"
@@ -557,13 +569,13 @@ msgstr "No"
557
 
558
  #: templates/sysinfo/tabs/main.php:45
559
  msgid "External object cache"
560
- msgstr ""
561
 
562
  #: templates/sysinfo/tabs/main.php:54
563
  msgid "Plugins Requirements"
564
- msgstr ""
565
 
566
- #: yit-plugin.php:187
567
  msgid "License"
568
  msgstr "Chiave di licenza"
569
 
@@ -571,6 +583,17 @@ msgstr "Chiave di licenza"
571
  msgid "YITH"
572
  msgstr "YITH"
573
 
 
 
 
 
 
 
 
 
 
 
 
574
  #: includes/class-yith-dashboard.php:96
575
  msgctxt "Plugin FW"
576
  msgid "View Changelog"
@@ -586,11 +609,6 @@ msgctxt "Button label"
586
  msgid "Close"
587
  msgstr "Chiudi"
588
 
589
- #: includes/class-yith-gutenberg.php:131
590
- msgctxt "[gutenberg]: Category Name"
591
- msgid "YITH"
592
- msgstr "YITH"
593
-
594
  #: includes/privacy/class-yith-privacy.php:61
595
  msgctxt "Privacy Policy Guide Title"
596
  msgid "YITH Plugins"
@@ -654,7 +672,7 @@ msgctxt "Position in the \"Dimensions\" field"
654
  msgid "Left"
655
  msgstr "A sinistra"
656
 
657
- #: templates/fields/dimensions.php:88
658
  msgctxt "Tooltip in the \"Dimensions\" field"
659
  msgid "Link values together"
660
  msgstr "Collega i valori"
@@ -662,34 +680,34 @@ msgstr "Collega i valori"
662
  #: templates/fields/onoff.php:28
663
  msgctxt "YES/NO button: use MAX 4 characters!"
664
  msgid "YES"
665
- msgstr ""
666
 
667
  #: templates/fields/onoff.php:29
668
  msgctxt "YES/NO button: use MAX 4 characters!"
669
  msgid "NO"
670
- msgstr ""
671
 
672
- #: yit-plugin.php:75
673
  msgctxt "Plugin Row Meta"
674
  msgid "Live Demo"
675
  msgstr "Live Demo"
676
 
677
- #: yit-plugin.php:79
678
  msgctxt "Plugin Row Meta"
679
  msgid "Documentation"
680
  msgstr "Documentazione"
681
 
682
- #: yit-plugin.php:83
683
  msgctxt "Plugin Row Meta"
684
  msgid "Support"
685
  msgstr "Assistenza"
686
 
687
- #: yit-plugin.php:87
688
  msgctxt "Plugin Row Meta"
689
  msgid "Premium version"
690
  msgstr "Versione premium"
691
 
692
- #: yit-plugin.php:183
693
  msgctxt "Action links"
694
  msgid "Settings"
695
  msgstr "Impostazioni"
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2021-02-23 14:12:38+00:00\n"
8
+ "PO-Revision-Date: 2021-02-15 14:59:29+0000\n"
9
  "Language: it\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
+ #: includes/class-yit-assets.php:129
17
  msgid "Clear"
18
  msgstr "Rimuovi"
19
 
20
+ #: includes/class-yit-assets.php:130
21
  msgid "Clear color"
22
  msgstr "Rimuovi colore"
23
 
24
+ #: includes/class-yit-assets.php:131
25
  msgid "Default"
26
  msgstr "Predefinito"
27
 
28
+ #: includes/class-yit-assets.php:132
29
  msgid "Select default color"
30
  msgstr "Seleziona il colore predefinito"
31
 
32
+ #: includes/class-yit-assets.php:133
33
  msgid "Select Color"
34
  msgstr "Seleziona il colore"
35
 
36
+ #: includes/class-yit-assets.php:134
37
  msgid "Color value"
38
  msgstr "Valore del colore"
39
 
144
 
145
  #: includes/class-yit-pointers.php:81
146
  msgid ""
147
+ "From now on, you can find all plugin options in YITH menu. Plugin "
148
+ "customization settings will be available as a new entry in YITH menu."
149
  msgstr ""
150
+ "D'ora in poi puoi trovare tutte le opzioni dei plugin nel menù YITH. Le "
151
+ "impostazioni di personalizzazione saranno disponibili come una nuova voce in "
152
+ "YITH."
153
 
154
  #. translators: 1. YITH site link; 2. WordPress site link.
155
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
156
  msgid "Discover all our plugins available on: %1$s and %2$s"
157
+ msgstr "Scopri tutti i nostri plugin disponibili su: %1$s and %2$s"
158
 
159
  #: includes/class-yit-pointers.php:96
160
  msgid "Plugins Upgraded"
162
 
163
  #: includes/class-yit-pointers.php:97
164
  msgid ""
165
+ "From now on, you can find the option panel of YITH plugins in YITH menu. "
166
+ "Every time one of our plugins is added, a new entry will be added to this "
167
+ "menu. For example, after the update, plugin options (such as for YITH "
168
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
169
+ "previous location to YITH menu."
170
  msgstr ""
171
+ "D'ora in poi puoi trovare il pannello opzioni dei plugin YITH nel menù YITH. "
172
+ "Ogni volta che viene aggiunto uno dei nostri plugin comparirà una nuova voce "
173
+ "in questo menù. Ad esempio, dopo l'aggiornamento, le opzioni del plugin "
174
+ "(come per YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) "
175
+ "saranno spostate dalla posizione precedente al menù YITH."
176
 
177
  #: includes/class-yith-dashboard.php:35
178
  msgid "YITH Latest Updates"
424
 
425
  #: templates/fields/date-format.php:70
426
  msgid "Preview:"
427
+ msgstr "Anteprima"
428
 
429
  #: templates/fields/icons.php:63
430
  msgid "Set Default"
497
 
498
  #: templates/sysinfo/system-information-panel.php:12
499
  msgid "PHPInfo"
500
+ msgstr "PHPInfo"
501
 
502
  #: templates/sysinfo/system-information-panel.php:13
503
  #: templates/sysinfo/tabs/error-log.php:25
504
  msgid "Log Files"
505
+ msgstr "File log"
506
 
507
  #: templates/sysinfo/system-information-panel.php:22
508
  msgid "YITH System Information"
518
 
519
  #: templates/sysinfo/tabs/error-log.php:60
520
  msgid "Download"
521
+ msgstr "Scarica"
522
 
523
  #: templates/sysinfo/tabs/error-log.php:72
524
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
525
  msgstr ""
526
+ "La dimensione del file supera gli 8 megabyte ed è quindi necessario "
527
+ "scaricarlo"
528
 
529
  #. translators: %s file name.
530
  #: templates/sysinfo/tabs/error-log.php:96
532
  "No Log file available. Enable the WordPress debug by adding this in the %s "
533
  "file of your installation"
534
  msgstr ""
535
+ "Nessun file log disponibile. Abilita il debug WordPress aggiungendo questo "
536
+ "nel file %s della tua installazione"
537
 
538
  #: templates/sysinfo/tabs/error-log.php:105
539
  msgid "Copied!"
540
+ msgstr "Copiato!"
541
 
542
  #: templates/sysinfo/tabs/error-log.php:105
543
  msgid "Copy Code"
544
+ msgstr "Copia codice"
545
 
546
  #: templates/sysinfo/tabs/main.php:15
547
  msgid "Site Info"
548
+ msgstr "Info sito"
549
 
550
  #: templates/sysinfo/tabs/main.php:20
551
  msgid "Site URL"
569
 
570
  #: templates/sysinfo/tabs/main.php:45
571
  msgid "External object cache"
572
+ msgstr "External object cache"
573
 
574
  #: templates/sysinfo/tabs/main.php:54
575
  msgid "Plugins Requirements"
576
+ msgstr "Requisiti plugin"
577
 
578
+ #: yit-plugin.php:190
579
  msgid "License"
580
  msgstr "Chiave di licenza"
581
 
583
  msgid "YITH"
584
  msgstr "YITH"
585
 
586
+ #. translators: %s it the Elementor Widget title.
587
+ #: includes/builders/elementor/class-yith-elementor-widget.php:252
588
+ msgctxt "Elementor Widget - section title"
589
+ msgid "%s - Options"
590
+ msgstr ""
591
+
592
+ #: includes/builders/gutenberg/class-yith-gutenberg.php:147
593
+ msgctxt "[gutenberg]: Category Name"
594
+ msgid "YITH"
595
+ msgstr "YITH"
596
+
597
  #: includes/class-yith-dashboard.php:96
598
  msgctxt "Plugin FW"
599
  msgid "View Changelog"
609
  msgid "Close"
610
  msgstr "Chiudi"
611
 
 
 
 
 
 
612
  #: includes/privacy/class-yith-privacy.php:61
613
  msgctxt "Privacy Policy Guide Title"
614
  msgid "YITH Plugins"
672
  msgid "Left"
673
  msgstr "A sinistra"
674
 
675
+ #: templates/fields/dimensions.php:94
676
  msgctxt "Tooltip in the \"Dimensions\" field"
677
  msgid "Link values together"
678
  msgstr "Collega i valori"
680
  #: templates/fields/onoff.php:28
681
  msgctxt "YES/NO button: use MAX 4 characters!"
682
  msgid "YES"
683
+ msgstr ""
684
 
685
  #: templates/fields/onoff.php:29
686
  msgctxt "YES/NO button: use MAX 4 characters!"
687
  msgid "NO"
688
+ msgstr "NO"
689
 
690
+ #: yit-plugin.php:78
691
  msgctxt "Plugin Row Meta"
692
  msgid "Live Demo"
693
  msgstr "Live Demo"
694
 
695
+ #: yit-plugin.php:82
696
  msgctxt "Plugin Row Meta"
697
  msgid "Documentation"
698
  msgstr "Documentazione"
699
 
700
+ #: yit-plugin.php:86
701
  msgctxt "Plugin Row Meta"
702
  msgid "Support"
703
  msgstr "Assistenza"
704
 
705
+ #: yit-plugin.php:90
706
  msgctxt "Plugin Row Meta"
707
  msgid "Premium version"
708
  msgstr "Versione premium"
709
 
710
+ #: yit-plugin.php:186
711
  msgctxt "Action links"
712
  msgid "Settings"
713
  msgstr "Impostazioni"
plugin-fw/languages/yith-plugin-fw-nl_NL.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-nl_NL.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2021-02-03 16:08:01+00:00\n"
8
- "PO-Revision-Date: 2020-09-24 14:36:33+0000\n"
9
  "Language: nl\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -13,27 +13,27 @@ msgstr ""
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
- #: includes/class-yit-assets.php:117
17
  msgid "Clear"
18
  msgstr "Wissen"
19
 
20
- #: includes/class-yit-assets.php:118
21
  msgid "Clear color"
22
  msgstr "Kleur wissen"
23
 
24
- #: includes/class-yit-assets.php:119
25
  msgid "Default"
26
  msgstr "Standaard"
27
 
28
- #: includes/class-yit-assets.php:120
29
  msgid "Select default color"
30
  msgstr "Standaardkleur selecteren"
31
 
32
- #: includes/class-yit-assets.php:121
33
  msgid "Select Color"
34
  msgstr "Kleur selecteren"
35
 
36
- #: includes/class-yit-assets.php:122
37
  msgid "Color value"
38
  msgstr "Kleurwaarde"
39
 
@@ -143,14 +143,14 @@ msgstr "Plugins geactiveerd"
143
 
144
  #: includes/class-yit-pointers.php:81
145
  msgid ""
146
- "From now on, you can find all plugin options in YITH Plugins menu. Plugin "
147
- "customization settings will be available as a new entry in YITH Plugins menu."
148
  msgstr ""
149
 
150
  #. translators: 1. YITH site link; 2. WordPress site link.
151
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
152
  msgid "Discover all our plugins available on: %1$s and %2$s"
153
- msgstr ""
154
 
155
  #: includes/class-yit-pointers.php:96
156
  msgid "Plugins Upgraded"
@@ -158,11 +158,11 @@ msgstr "Plugins Upgraded"
158
 
159
  #: includes/class-yit-pointers.php:97
160
  msgid ""
161
- "From now on, you can find the option panel of YITH plugins in YITH Plugins "
162
- "menu. Every time one of our plugins is added, a new entry will be added to "
163
- "this menu. For example, after the update, plugin options (such as for YITH "
164
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
165
- "previous location to YITH Plugins tab."
166
  msgstr ""
167
 
168
  #: includes/class-yith-dashboard.php:35
@@ -414,7 +414,7 @@ msgstr "Aangepast:"
414
 
415
  #: templates/fields/date-format.php:70
416
  msgid "Preview:"
417
- msgstr ""
418
 
419
  #: templates/fields/icons.php:63
420
  msgid "Set Default"
@@ -487,12 +487,12 @@ msgstr "Reset Standaard instellingen"
487
 
488
  #: templates/sysinfo/system-information-panel.php:12
489
  msgid "PHPInfo"
490
- msgstr ""
491
 
492
  #: templates/sysinfo/system-information-panel.php:13
493
  #: templates/sysinfo/tabs/error-log.php:25
494
  msgid "Log Files"
495
- msgstr ""
496
 
497
  #: templates/sysinfo/system-information-panel.php:22
498
  msgid "YITH System Information"
@@ -508,11 +508,12 @@ msgstr "PHP error_log bestand"
508
 
509
  #: templates/sysinfo/tabs/error-log.php:60
510
  msgid "Download"
511
- msgstr ""
512
 
513
  #: templates/sysinfo/tabs/error-log.php:72
514
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
515
  msgstr ""
 
516
 
517
  #. translators: %s file name.
518
  #: templates/sysinfo/tabs/error-log.php:96
@@ -520,18 +521,20 @@ msgid ""
520
  "No Log file available. Enable the WordPress debug by adding this in the %s "
521
  "file of your installation"
522
  msgstr ""
 
 
523
 
524
  #: templates/sysinfo/tabs/error-log.php:105
525
  msgid "Copied!"
526
- msgstr ""
527
 
528
  #: templates/sysinfo/tabs/error-log.php:105
529
  msgid "Copy Code"
530
- msgstr ""
531
 
532
  #: templates/sysinfo/tabs/main.php:15
533
  msgid "Site Info"
534
- msgstr ""
535
 
536
  #: templates/sysinfo/tabs/main.php:20
537
  msgid "Site URL"
@@ -555,13 +558,13 @@ msgstr "Nee"
555
 
556
  #: templates/sysinfo/tabs/main.php:45
557
  msgid "External object cache"
558
- msgstr ""
559
 
560
  #: templates/sysinfo/tabs/main.php:54
561
  msgid "Plugins Requirements"
562
- msgstr ""
563
 
564
- #: yit-plugin.php:187
565
  msgid "License"
566
  msgstr "Licentie"
567
 
@@ -569,6 +572,17 @@ msgstr "Licentie"
569
  msgid "YITH"
570
  msgstr "YITH"
571
 
 
 
 
 
 
 
 
 
 
 
 
572
  #: includes/class-yith-dashboard.php:96
573
  msgctxt "Plugin FW"
574
  msgid "View Changelog"
@@ -584,11 +598,6 @@ msgctxt "Button label"
584
  msgid "Close"
585
  msgstr "Sluiten"
586
 
587
- #: includes/class-yith-gutenberg.php:131
588
- msgctxt "[gutenberg]: Category Name"
589
- msgid "YITH"
590
- msgstr "YITH"
591
-
592
  #: includes/privacy/class-yith-privacy.php:61
593
  msgctxt "Privacy Policy Guide Title"
594
  msgid "YITH Plugins"
@@ -651,7 +660,7 @@ msgctxt "Position in the \"Dimensions\" field"
651
  msgid "Left"
652
  msgstr "Links"
653
 
654
- #: templates/fields/dimensions.php:88
655
  msgctxt "Tooltip in the \"Dimensions\" field"
656
  msgid "Link values together"
657
  msgstr "Waarden aan elkaar koppelen"
@@ -659,34 +668,34 @@ msgstr "Waarden aan elkaar koppelen"
659
  #: templates/fields/onoff.php:28
660
  msgctxt "YES/NO button: use MAX 4 characters!"
661
  msgid "YES"
662
- msgstr ""
663
 
664
  #: templates/fields/onoff.php:29
665
  msgctxt "YES/NO button: use MAX 4 characters!"
666
  msgid "NO"
667
- msgstr ""
668
 
669
- #: yit-plugin.php:75
670
  msgctxt "Plugin Row Meta"
671
  msgid "Live Demo"
672
  msgstr "Live Demo"
673
 
674
- #: yit-plugin.php:79
675
  msgctxt "Plugin Row Meta"
676
  msgid "Documentation"
677
  msgstr "Documentatie"
678
 
679
- #: yit-plugin.php:83
680
  msgctxt "Plugin Row Meta"
681
  msgid "Support"
682
  msgstr "Ondersteuning"
683
 
684
- #: yit-plugin.php:87
685
  msgctxt "Plugin Row Meta"
686
  msgid "Premium version"
687
  msgstr "Premium versie"
688
 
689
- #: yit-plugin.php:183
690
  msgctxt "Action links"
691
  msgid "Settings"
692
  msgstr "Instellingen"
4
  msgstr ""
5
  "Project-Id-Version: YITH Framework\n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2021-02-23 14:12:38+00:00\n"
8
+ "PO-Revision-Date: 2021-02-05 09:20:16+0000\n"
9
  "Language: nl\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
  "X-Generator: GlotPress/3.0.0-alpha.2\n"
15
 
16
+ #: includes/class-yit-assets.php:129
17
  msgid "Clear"
18
  msgstr "Wissen"
19
 
20
+ #: includes/class-yit-assets.php:130
21
  msgid "Clear color"
22
  msgstr "Kleur wissen"
23
 
24
+ #: includes/class-yit-assets.php:131
25
  msgid "Default"
26
  msgstr "Standaard"
27
 
28
+ #: includes/class-yit-assets.php:132
29
  msgid "Select default color"
30
  msgstr "Standaardkleur selecteren"
31
 
32
+ #: includes/class-yit-assets.php:133
33
  msgid "Select Color"
34
  msgstr "Kleur selecteren"
35
 
36
+ #: includes/class-yit-assets.php:134
37
  msgid "Color value"
38
  msgstr "Kleurwaarde"
39
 
143
 
144
  #: includes/class-yit-pointers.php:81
145
  msgid ""
146
+ "From now on, you can find all plugin options in YITH menu. Plugin "
147
+ "customization settings will be available as a new entry in YITH menu."
148
  msgstr ""
149
 
150
  #. translators: 1. YITH site link; 2. WordPress site link.
151
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
152
  msgid "Discover all our plugins available on: %1$s and %2$s"
153
+ msgstr "Ontdek al onze beschikbare plugins op: %1$s and %2$s"
154
 
155
  #: includes/class-yit-pointers.php:96
156
  msgid "Plugins Upgraded"
158
 
159
  #: includes/class-yit-pointers.php:97
160
  msgid ""
161
+ "From now on, you can find the option panel of YITH plugins in YITH menu. "
162
+ "Every time one of our plugins is added, a new entry will be added to this "
163
+ "menu. For example, after the update, plugin options (such as for YITH "
164
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved from "
165
+ "previous location to YITH menu."
166
  msgstr ""
167
 
168
  #: includes/class-yith-dashboard.php:35
414
 
415
  #: templates/fields/date-format.php:70
416
  msgid "Preview:"
417
+ msgstr "Voorbeeld:"
418
 
419
  #: templates/fields/icons.php:63
420
  msgid "Set Default"
487
 
488
  #: templates/sysinfo/system-information-panel.php:12
489
  msgid "PHPInfo"
490
+ msgstr "PHPInfo"
491
 
492
  #: templates/sysinfo/system-information-panel.php:13
493
  #: templates/sysinfo/tabs/error-log.php:25
494
  msgid "Log Files"
495
+ msgstr "Log bestanden"
496
 
497
  #: templates/sysinfo/system-information-panel.php:22
498
  msgid "YITH System Information"
508
 
509
  #: templates/sysinfo/tabs/error-log.php:60
510
  msgid "Download"
511
+ msgstr "Download"
512
 
513
  #: templates/sysinfo/tabs/error-log.php:72
514
  msgid "The file size exceeds 8 megabytes so it must be downloaded"
515
  msgstr ""
516
+ "De bestandsgrootte overschrijd 8 megabytes, dus het moet worden gedownload "
517
 
518
  #. translators: %s file name.
519
  #: templates/sysinfo/tabs/error-log.php:96
521
  "No Log file available. Enable the WordPress debug by adding this in the %s "
522
  "file of your installation"
523
  msgstr ""
524
+ "Geen log bestand beschikbaar. WordPress debug inschakelen door dit bestand "
525
+ "toe te voegen aan het %s bestand van je installatie "
526
 
527
  #: templates/sysinfo/tabs/error-log.php:105
528
  msgid "Copied!"
529
+ msgstr "Gekopieerd!"
530
 
531
  #: templates/sysinfo/tabs/error-log.php:105
532
  msgid "Copy Code"
533
+ msgstr "Code kopiëren"
534
 
535
  #: templates/sysinfo/tabs/main.php:15
536
  msgid "Site Info"
537
+ msgstr "Site informatie"
538
 
539
  #: templates/sysinfo/tabs/main.php:20
540
  msgid "Site URL"
558
 
559
  #: templates/sysinfo/tabs/main.php:45
560
  msgid "External object cache"
561
+ msgstr "Externe object cache"
562
 
563
  #: templates/sysinfo/tabs/main.php:54
564
  msgid "Plugins Requirements"
565
+ msgstr "Plugin benodigdheden"
566
 
567
+ #: yit-plugin.php:190
568
  msgid "License"
569
  msgstr "Licentie"
570
 
572
  msgid "YITH"
573
  msgstr "YITH"
574
 
575
+ #. translators: %s it the Elementor Widget title.
576
+ #: includes/builders/elementor/class-yith-elementor-widget.php:252
577
+ msgctxt "Elementor Widget - section title"
578
+ msgid "%s - Options"
579
+ msgstr ""
580
+
581
+ #: includes/builders/gutenberg/class-yith-gutenberg.php:147
582
+ msgctxt "[gutenberg]: Category Name"
583
+ msgid "YITH"
584
+ msgstr "YITH"
585
+
586
  #: includes/class-yith-dashboard.php:96
587
  msgctxt "Plugin FW"
588
  msgid "View Changelog"
598
  msgid "Close"
599
  msgstr "Sluiten"
600
 
 
 
 
 
 
601
  #: includes/privacy/class-yith-privacy.php:61
602
  msgctxt "Privacy Policy Guide Title"
603
  msgid "YITH Plugins"
660
  msgid "Left"
661
  msgstr "Links"
662
 
663
+ #: templates/fields/dimensions.php:94
664
  msgctxt "Tooltip in the \"Dimensions\" field"
665
  msgid "Link values together"
666
  msgstr "Waarden aan elkaar koppelen"
668
  #: templates/fields/onoff.php:28
669
  msgctxt "YES/NO button: use MAX 4 characters!"
670
  msgid "YES"
671
+ msgstr "JA"
672
 
673
  #: templates/fields/onoff.php:29
674
  msgctxt "YES/NO button: use MAX 4 characters!"
675
  msgid "NO"
676
+ msgstr "NEE"
677
 
678
+ #: yit-plugin.php:78
679
  msgctxt "Plugin Row Meta"
680
  msgid "Live Demo"
681
  msgstr "Live Demo"
682
 
683
+ #: yit-plugin.php:82
684
  msgctxt "Plugin Row Meta"
685
  msgid "Documentation"
686
  msgstr "Documentatie"
687
 
688
+ #: yit-plugin.php:86
689
  msgctxt "Plugin Row Meta"
690
  msgid "Support"
691
  msgstr "Ondersteuning"
692
 
693
+ #: yit-plugin.php:90
694
  msgctxt "Plugin Row Meta"
695
  msgid "Premium version"
696
  msgstr "Premium versie"
697
 
698
+ #: yit-plugin.php:186
699
  msgctxt "Action links"
700
  msgid "Settings"
701
  msgstr "Instellingen"
plugin-fw/languages/yith-plugin-fw.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2021-02-03 16:08:01+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,27 +24,27 @@ msgstr ""
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
- #: includes/class-yit-assets.php:117
28
  msgid "Clear"
29
  msgstr ""
30
 
31
- #: includes/class-yit-assets.php:118
32
  msgid "Clear color"
33
  msgstr ""
34
 
35
- #: includes/class-yit-assets.php:119
36
  msgid "Default"
37
  msgstr ""
38
 
39
- #: includes/class-yit-assets.php:120
40
  msgid "Select default color"
41
  msgstr ""
42
 
43
- #: includes/class-yit-assets.php:121
44
  msgid "Select Color"
45
  msgstr ""
46
 
47
- #: includes/class-yit-assets.php:122
48
  msgid "Color value"
49
  msgstr ""
50
 
@@ -151,9 +151,8 @@ msgstr ""
151
 
152
  #: includes/class-yit-pointers.php:81
153
  msgid ""
154
- "From now on, you can find all plugin options in YITH Plugins menu. Plugin "
155
- "customization settings will be available as a new entry in YITH Plugins "
156
- "menu."
157
  msgstr ""
158
 
159
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
@@ -167,11 +166,11 @@ msgstr ""
167
 
168
  #: includes/class-yit-pointers.php:97
169
  msgid ""
170
- "From now on, you can find the option panel of YITH plugins in YITH Plugins "
171
- "menu. Every time one of our plugins is added, a new entry will be added to "
172
- "this menu. For example, after the update, plugin options (such as for YITH "
173
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved "
174
- "from previous location to YITH Plugins tab."
175
  msgstr ""
176
 
177
  #: includes/class-yith-dashboard.php:35
@@ -556,7 +555,7 @@ msgstr ""
556
  msgid "Plugins Requirements"
557
  msgstr ""
558
 
559
- #: yit-plugin.php:187
560
  msgid "License"
561
  msgstr ""
562
 
@@ -564,6 +563,17 @@ msgstr ""
564
  msgid "YITH"
565
  msgstr ""
566
 
 
 
 
 
 
 
 
 
 
 
 
567
  #: includes/class-yith-dashboard.php:96
568
  msgctxt "Plugin FW"
569
  msgid "View Changelog"
@@ -579,11 +589,6 @@ msgctxt "Button label"
579
  msgid "Close"
580
  msgstr ""
581
 
582
- #: includes/class-yith-gutenberg.php:131
583
- msgctxt "[gutenberg]: Category Name"
584
- msgid "YITH"
585
- msgstr ""
586
-
587
  #: includes/privacy/class-yith-privacy.php:61
588
  msgctxt "Privacy Policy Guide Title"
589
  msgid "YITH Plugins"
@@ -640,7 +645,7 @@ msgctxt "Position in the \"Dimensions\" field"
640
  msgid "Left"
641
  msgstr ""
642
 
643
- #: templates/fields/dimensions.php:88
644
  msgctxt "Tooltip in the \"Dimensions\" field"
645
  msgid "Link values together"
646
  msgstr ""
@@ -655,27 +660,27 @@ msgctxt "YES/NO button: use MAX 4 characters!"
655
  msgid "NO"
656
  msgstr ""
657
 
658
- #: yit-plugin.php:75
659
  msgctxt "Plugin Row Meta"
660
  msgid "Live Demo"
661
  msgstr ""
662
 
663
- #: yit-plugin.php:79
664
  msgctxt "Plugin Row Meta"
665
  msgid "Documentation"
666
  msgstr ""
667
 
668
- #: yit-plugin.php:83
669
  msgctxt "Plugin Row Meta"
670
  msgid "Support"
671
  msgstr ""
672
 
673
- #: yit-plugin.php:87
674
  msgctxt "Plugin Row Meta"
675
  msgid "Premium version"
676
  msgstr ""
677
 
678
- #: yit-plugin.php:183
679
  msgctxt "Action links"
680
  msgid "Settings"
681
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2021-02-23 14:12:38+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
+ #: includes/class-yit-assets.php:129
28
  msgid "Clear"
29
  msgstr ""
30
 
31
+ #: includes/class-yit-assets.php:130
32
  msgid "Clear color"
33
  msgstr ""
34
 
35
+ #: includes/class-yit-assets.php:131
36
  msgid "Default"
37
  msgstr ""
38
 
39
+ #: includes/class-yit-assets.php:132
40
  msgid "Select default color"
41
  msgstr ""
42
 
43
+ #: includes/class-yit-assets.php:133
44
  msgid "Select Color"
45
  msgstr ""
46
 
47
+ #: includes/class-yit-assets.php:134
48
  msgid "Color value"
49
  msgstr ""
50
 
151
 
152
  #: includes/class-yit-pointers.php:81
153
  msgid ""
154
+ "From now on, you can find all plugin options in YITH menu. Plugin "
155
+ "customization settings will be available as a new entry in YITH menu."
 
156
  msgstr ""
157
 
158
  #: includes/class-yit-pointers.php:84 includes/class-yit-pointers.php:100
166
 
167
  #: includes/class-yit-pointers.php:97
168
  msgid ""
169
+ "From now on, you can find the option panel of YITH plugins in YITH menu. "
170
+ "Every time one of our plugins is added, a new entry will be added to this "
171
+ "menu. For example, after the update, plugin options (such as for YITH "
172
  "WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.) will be moved "
173
+ "from previous location to YITH menu."
174
  msgstr ""
175
 
176
  #: includes/class-yith-dashboard.php:35
555
  msgid "Plugins Requirements"
556
  msgstr ""
557
 
558
+ #: yit-plugin.php:190
559
  msgid "License"
560
  msgstr ""
561
 
563
  msgid "YITH"
564
  msgstr ""
565
 
566
+ #: includes/builders/elementor/class-yith-elementor-widget.php:252
567
+ #. translators: %s it the Elementor Widget title.
568
+ msgctxt "Elementor Widget - section title"
569
+ msgid "%s - Options"
570
+ msgstr ""
571
+
572
+ #: includes/builders/gutenberg/class-yith-gutenberg.php:147
573
+ msgctxt "[gutenberg]: Category Name"
574
+ msgid "YITH"
575
+ msgstr ""
576
+
577
  #: includes/class-yith-dashboard.php:96
578
  msgctxt "Plugin FW"
579
  msgid "View Changelog"
589
  msgid "Close"
590
  msgstr ""
591
 
 
 
 
 
 
592
  #: includes/privacy/class-yith-privacy.php:61
593
  msgctxt "Privacy Policy Guide Title"
594
  msgid "YITH Plugins"
645
  msgid "Left"
646
  msgstr ""
647
 
648
+ #: templates/fields/dimensions.php:94
649
  msgctxt "Tooltip in the \"Dimensions\" field"
650
  msgid "Link values together"
651
  msgstr ""
660
  msgid "NO"
661
  msgstr ""
662
 
663
+ #: yit-plugin.php:78
664
  msgctxt "Plugin Row Meta"
665
  msgid "Live Demo"
666
  msgstr ""
667
 
668
+ #: yit-plugin.php:82
669
  msgctxt "Plugin Row Meta"
670
  msgid "Documentation"
671
  msgstr ""
672
 
673
+ #: yit-plugin.php:86
674
  msgctxt "Plugin Row Meta"
675
  msgid "Support"
676
  msgstr ""
677
 
678
+ #: yit-plugin.php:90
679
  msgctxt "Plugin Row Meta"
680
  msgid "Premium version"
681
  msgstr ""
682
 
683
+ #: yit-plugin.php:186
684
  msgctxt "Action links"
685
  msgid "Settings"
686
  msgstr ""
plugin-fw/lib/yith-gutenberg.php CHANGED
@@ -8,4 +8,4 @@
8
  /**
9
  * Require the correct file
10
  */
11
- require_once __DIR__ . '/../includes/class-yith-gutenberg.php';
8
  /**
9
  * Require the correct file
10
  */
11
+ require_once __DIR__ . '/../includes/builders/gutenberg/class-yith-gutenberg.php';
plugin-fw/templates/fields/dimensions.php CHANGED
@@ -67,11 +67,11 @@ if ( $allow_linked && 'yes' === $linked ) {
67
  }
68
 
69
  if ( false !== $d_max ) {
70
- $d_attributes = " max='{$d_max}' . $d_attributes";
71
  }
72
 
73
  if ( false !== $d_min ) {
74
- $d_attributes = " min='{$d_min}' " . $d_attributes;
75
  }
76
 
77
  ?>
@@ -79,7 +79,13 @@ if ( $allow_linked && 'yes' === $linked ) {
79
  <label for="<?php echo esc_attr( $d_id ); ?>" class="yith-plugin-fw-dimensions__dimension__label"><?php echo esc_html( $d_label ); ?></label>
80
  <input id="<?php echo esc_attr( $d_id ); ?>" class="yith-plugin-fw-dimensions__dimension__number"
81
  type="number" name="<?php echo esc_attr( $d_name ); ?>" value="<?php echo esc_attr( $d_value ); ?>"
82
- <?php echo esc_html( $d_attributes ); ?>
 
 
 
 
 
 
83
  >
84
  </div>
85
  <?php endforeach ?>
@@ -103,6 +109,11 @@ if ( $allow_linked && 'yes' === $linked ) {
103
  if ( $unit_value === $key ) {
104
  $classes[] = 'yith-plugin-fw-dimensions__unit--selected';
105
  }
 
 
 
 
 
106
  $classes = implode( ' ', $classes );
107
  ?>
108
  <span class="<?php echo esc_attr( $classes ); ?>" data-value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></span>
67
  }
68
 
69
  if ( false !== $d_max ) {
70
+ $d_attributes = " max={$d_max} " . $d_attributes;
71
  }
72
 
73
  if ( false !== $d_min ) {
74
+ $d_attributes = " min={$d_min} " . $d_attributes;
75
  }
76
 
77
  ?>
79
  <label for="<?php echo esc_attr( $d_id ); ?>" class="yith-plugin-fw-dimensions__dimension__label"><?php echo esc_html( $d_label ); ?></label>
80
  <input id="<?php echo esc_attr( $d_id ); ?>" class="yith-plugin-fw-dimensions__dimension__number"
81
  type="number" name="<?php echo esc_attr( $d_name ); ?>" value="<?php echo esc_attr( $d_value ); ?>"
82
+ <?php if ( false !== $d_max ) : ?>
83
+ max="<?php echo esc_attr( $d_max ); ?>"
84
+ <?php endif; ?>
85
+ <?php if ( false !== $d_min ) : ?>
86
+ min="<?php echo esc_attr( $d_min ); ?>"
87
+ <?php endif; ?>
88
+ <?php echo $d_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
89
  >
90
  </div>
91
  <?php endforeach ?>
109
  if ( $unit_value === $key ) {
110
  $classes[] = 'yith-plugin-fw-dimensions__unit--selected';
111
  }
112
+
113
+ if ( count( $units ) < 2 ) {
114
+ $classes[] = 'yith-plugin-fw-dimensions__unit--unique';
115
+ }
116
+
117
  $classes = implode( ' ', $classes );
118
  ?>
119
  <span class="<?php echo esc_attr( $classes ); ?>" data-value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></span>
plugin-fw/yit-functions.php CHANGED
@@ -1600,3 +1600,37 @@ if ( ! function_exists( 'yith_plugin_fw_extract' ) ) {
1600
  );
1601
  }
1602
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1600
  );
1601
  }
1602
  }
1603
+
1604
+
1605
+ if ( ! function_exists( 'yith_plugin_fw_register_elementor_widget' ) ) {
1606
+ /**
1607
+ * Register Elementor widget
1608
+ *
1609
+ * @param string $widget_name The widget name.
1610
+ * @param array $widget_options The widget options.
1611
+ *
1612
+ * @since 3.6.0
1613
+ */
1614
+ function yith_plugin_fw_register_elementor_widget( $widget_name, $widget_options ) {
1615
+ YITH_Elementor::instance()->register_widget( $widget_name, $widget_options );
1616
+ }
1617
+ }
1618
+
1619
+ if ( ! function_exists( 'yith_plugin_fw_register_elementor_widgets' ) ) {
1620
+ /**
1621
+ * Register Elementor widgets
1622
+ *
1623
+ * @param array $widgets The widgets.
1624
+ * @param bool $map_from_gutenberg Set to true if you need to map options from Gutenberg blocks array.
1625
+ *
1626
+ * @since 3.6.0
1627
+ */
1628
+ function yith_plugin_fw_register_elementor_widgets( $widgets, $map_from_gutenberg = false ) {
1629
+ foreach ( $widgets as $widget_name => $widget_options ) {
1630
+ if ( $map_from_gutenberg ) {
1631
+ $widget_options = array_merge( array( 'map_from_gutenberg' => true ), $widget_options );
1632
+ }
1633
+ yith_plugin_fw_register_elementor_widget( $widget_name, $widget_options );
1634
+ }
1635
+ }
1636
+ }
plugin-fw/yit-plugin.php CHANGED
@@ -39,8 +39,11 @@ require_once 'includes/class-yith-system-status.php';
39
 
40
  // Gutenberg Support.
41
  if ( class_exists( 'WP_Block_Type_Registry' ) ) {
42
- require_once 'includes/class-yith-gutenberg.php';
43
  }
 
 
 
44
  // load from theme folder...
45
  load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' ) ||
46
  // ...or from plugin folder.
39
 
40
  // Gutenberg Support.
41
  if ( class_exists( 'WP_Block_Type_Registry' ) ) {
42
+ require_once 'includes/builders/gutenberg/class-yith-gutenberg.php';
43
  }
44
+
45
+ require_once 'includes/builders/elementor/class-yith-elementor.php';
46
+
47
  // load from theme folder...
48
  load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' ) ||
49
  // ...or from plugin folder.
plugin-options/general-options.php CHANGED
@@ -1,136 +1,134 @@
1
- <?php
2
- /**
3
- * Main admin class
4
- *
5
- * @author YITH
6
- * @package YITH Woocommerce Compare
7
- * @version 1.1.1
8
- */
9
-
10
- if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- $options = array(
15
- 'general' => array(
16
- array(
17
- 'name' => __( 'General Settings', 'yith-woocommerce-compare' ),
18
- 'type' => 'title',
19
- 'desc' => '',
20
- 'id' => 'yith_woocompare_general'
21
- ),
22
-
23
- array(
24
- 'name' => __( 'Link or Button', 'yith-woocommerce-compare' ),
25
- 'desc_tip' => __( 'Choose if you want to use a link or a button for the comepare actions.', 'yith-woocommerce-compare' ),
26
- 'id' => 'yith_woocompare_is_button',
27
- 'default' => 'button',
28
- 'type' => 'select',
29
- 'class' => 'wc-enhanced-select',
30
- 'options' => array(
31
- 'link' => __( 'Link', 'yith-woocommerce-compare' ),
32
- 'button' => __( 'Button', 'yith-woocommerce-compare' )
33
- )
34
- ),
35
-
36
- array(
37
- 'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
38
- 'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
39
- 'id' => 'yith_woocompare_button_text',
40
- 'default' => __( 'Compare', 'yith-woocommerce-compare' ),
41
- 'type' => 'text'
42
- ),
43
-
44
- array(
45
- 'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
46
- 'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
47
- 'id' => 'yith_woocompare_compare_button_in_product_page',
48
- 'default' => 'yes',
49
- 'type' => 'checkbox'
50
- ),
51
-
52
- array(
53
- 'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
54
- 'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
55
- 'id' => 'yith_woocompare_compare_button_in_products_list',
56
- 'default' => 'no',
57
- 'type' => 'checkbox'
58
- ),
59
-
60
- array(
61
- 'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
62
- 'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
63
- 'id' => 'yith_woocompare_auto_open',
64
- 'default' => 'yes',
65
- 'type' => 'checkbox'
66
- ),
67
-
68
- array(
69
- 'type' => 'sectionend',
70
- 'id' => 'yith_woocompare_general_end'
71
- ),
72
-
73
- array(
74
- 'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
75
- 'type' => 'title',
76
- 'desc' => '',
77
- 'id' => 'yith_woocompare_table'
78
- ),
79
-
80
- array(
81
- 'name' => __( 'Table title', 'yith-woocommerce-compare' ),
82
- 'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
83
- 'id' => 'yith_woocompare_table_text',
84
- 'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
85
- 'type' => 'text'
86
- ),
87
-
88
- array(
89
- 'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
90
- 'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yith-woocommerce-compare' ),
91
- 'id' => 'yith_woocompare_fields_attrs',
92
- 'default' => 'all',
93
- 'type' => 'woocompare_attributes'
94
- ),
95
-
96
- array(
97
- 'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
98
- 'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
99
- 'id' => 'yith_woocompare_price_end',
100
- 'default' => 'yes',
101
- 'type' => 'checkbox'
102
- ),
103
-
104
- array(
105
- 'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
106
- 'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
107
- 'id' => 'yith_woocompare_add_to_cart_end',
108
- 'default' => 'no',
109
- 'type' => 'checkbox'
110
- ),
111
-
112
- array(
113
- 'name' => __( 'Image size', 'yith-woocommerce-compare' ),
114
- 'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
115
- 'id' => 'yith_woocompare_image_size',
116
- 'type' => 'woocompare_image_width',
117
- 'default' => array(
118
- 'width' => 220,
119
- 'height' => 154,
120
- 'crop' => 1
121
- ),
122
- 'std' => array(
123
- 'width' => 220,
124
- 'height' => 154,
125
- 'crop' => 1
126
- )
127
- ),
128
-
129
- array(
130
- 'type' => 'sectionend',
131
- 'id' => 'yith_woocompare_table_end'
132
- )
133
- )
134
- );
135
-
136
- return apply_filters( 'yith_woocompare_general_settings', $options );
1
+ <?php
2
+ /**
3
+ * Main settings array
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ $options = array(
13
+ 'general' => array(
14
+ array(
15
+ 'name' => __( 'General Settings', 'yith-woocommerce-compare' ),
16
+ 'type' => 'title',
17
+ 'desc' => '',
18
+ 'id' => 'yith_woocompare_general',
19
+ ),
20
+
21
+ array(
22
+ 'name' => __( 'Link or Button', 'yith-woocommerce-compare' ),
23
+ 'desc_tip' => __( 'Choose if you want to use a link or a button for the comepare actions.', 'yith-woocommerce-compare' ),
24
+ 'id' => 'yith_woocompare_is_button',
25
+ 'default' => 'button',
26
+ 'type' => 'select',
27
+ 'class' => 'wc-enhanced-select',
28
+ 'options' => array(
29
+ 'link' => __( 'Link', 'yith-woocommerce-compare' ),
30
+ 'button' => __( 'Button', 'yith-woocommerce-compare' ),
31
+ ),
32
+ ),
33
+
34
+ array(
35
+ 'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
36
+ 'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
37
+ 'id' => 'yith_woocompare_button_text',
38
+ 'default' => __( 'Compare', 'yith-woocommerce-compare' ),
39
+ 'type' => 'text',
40
+ ),
41
+
42
+ array(
43
+ 'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
44
+ 'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
45
+ 'id' => 'yith_woocompare_compare_button_in_product_page',
46
+ 'default' => 'yes',
47
+ 'type' => 'checkbox',
48
+ ),
49
+
50
+ array(
51
+ 'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
52
+ 'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
53
+ 'id' => 'yith_woocompare_compare_button_in_products_list',
54
+ 'default' => 'no',
55
+ 'type' => 'checkbox',
56
+ ),
57
+
58
+ array(
59
+ 'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
60
+ 'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
61
+ 'id' => 'yith_woocompare_auto_open',
62
+ 'default' => 'yes',
63
+ 'type' => 'checkbox',
64
+ ),
65
+
66
+ array(
67
+ 'type' => 'sectionend',
68
+ 'id' => 'yith_woocompare_general_end',
69
+ ),
70
+
71
+ array(
72
+ 'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
73
+ 'type' => 'title',
74
+ 'desc' => '',
75
+ 'id' => 'yith_woocompare_table',
76
+ ),
77
+
78
+ array(
79
+ 'name' => __( 'Table title', 'yith-woocommerce-compare' ),
80
+ 'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
81
+ 'id' => 'yith_woocompare_table_text',
82
+ 'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
83
+ 'type' => 'text',
84
+ ),
85
+
86
+ array(
87
+ 'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
88
+ 'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yith-woocommerce-compare' ),
89
+ 'id' => 'yith_woocompare_fields_attrs',
90
+ 'default' => 'all',
91
+ 'type' => 'woocompare_attributes',
92
+ ),
93
+
94
+ array(
95
+ 'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
96
+ 'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
97
+ 'id' => 'yith_woocompare_price_end',
98
+ 'default' => 'yes',
99
+ 'type' => 'checkbox',
100
+ ),
101
+
102
+ array(
103
+ 'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
104
+ 'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
105
+ 'id' => 'yith_woocompare_add_to_cart_end',
106
+ 'default' => 'no',
107
+ 'type' => 'checkbox',
108
+ ),
109
+
110
+ array(
111
+ 'name' => __( 'Image size', 'yith-woocommerce-compare' ),
112
+ 'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
113
+ 'id' => 'yith_woocompare_image_size',
114
+ 'type' => 'woocompare_image_width',
115
+ 'default' => array(
116
+ 'width' => 220,
117
+ 'height' => 154,
118
+ 'crop' => 1,
119
+ ),
120
+ 'std' => array(
121
+ 'width' => 220,
122
+ 'height' => 154,
123
+ 'crop' => 1,
124
+ ),
125
+ ),
126
+
127
+ array(
128
+ 'type' => 'sectionend',
129
+ 'id' => 'yith_woocompare_table_end',
130
+ ),
131
+ ),
132
+ );
133
+
134
+ return apply_filters( 'yith_woocompare_general_settings', $options );
 
 
plugin-options/premium-options.php CHANGED
@@ -1,23 +1,19 @@
1
- <?php
2
- /**
3
- * Main admin class
4
- *
5
- * @author YITH
6
- * @package YITH Woocommerce Compare
7
- * @version 1.1.1
8
- */
9
-
10
- if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- $options = array(
15
- 'premium' => array(
16
- 'landing' => array(
17
- 'type' => 'custom_tab',
18
- 'action' => 'yith_woocompare_premium'
19
- )
20
- )
21
- );
22
-
23
- return $options;
1
+ <?php
2
+ /**
3
+ * Premium tab settings array
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+
12
+ return array(
13
+ 'premium' => array(
14
+ 'landing' => array(
15
+ 'type' => 'custom_tab',
16
+ 'action' => 'yith_woocompare_premium',
17
+ ),
18
+ ),
19
+ );
 
 
 
 
templates/admin/premium.php CHANGED
@@ -1,457 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
1
  <style>
2
  .section{
3
- margin-left: -20px;
4
- margin-right: -20px;
5
- font-family: "Raleway",san-serif;
6
  }
7
  .section h1{
8
- text-align: center;
9
- text-transform: uppercase;
10
- color: #808a97;
11
- font-size: 35px;
12
- font-weight: 700;
13
- line-height: normal;
14
- display: inline-block;
15
- width: 100%;
16
- margin: 50px 0 0;
17
  }
18
  .section ul{
19
- list-style-type: disc;
20
- padding-left: 15px;
21
  }
22
  .section:nth-child(even){
23
- background-color: #fff;
24
  }
25
  .section:nth-child(odd){
26
- background-color: #f1f1f1;
27
  }
28
  .section .section-title img{
29
- display: table-cell;
30
- vertical-align: middle;
31
- width: auto;
32
- margin-right: 15px;
33
  }
34
  .section h2,
35
  .section h3 {
36
- display: inline-block;
37
- vertical-align: middle;
38
- padding: 0;
39
- font-size: 24px;
40
- font-weight: 700;
41
- color: #808a97;
42
- text-transform: uppercase;
43
  }
44
 
45
  .section .section-title h2{
46
- display: table-cell;
47
- vertical-align: middle;
48
- line-height: 25px;
49
- border: none;
50
- background: transparent;
51
  }
52
 
53
  .section-title{
54
- display: table;
55
  }
56
 
57
  .section h3 {
58
- font-size: 14px;
59
- line-height: 28px;
60
- margin-bottom: 0;
61
- display: block;
62
  }
63
 
64
  .section p{
65
- font-size: 13px;
66
- margin: 25px 0;
67
  }
68
  .section ul li{
69
- margin-bottom: 4px;
70
  }
71
  .landing-container{
72
- max-width: 750px;
73
- margin-left: auto;
74
- margin-right: auto;
75
- padding: 50px 0 30px;
76
  }
77
  .landing-container:after{
78
- display: block;
79
- clear: both;
80
- content: '';
81
  }
82
  .landing-container .col-1,
83
  .landing-container .col-2{
84
- float: left;
85
- box-sizing: border-box;
86
- padding: 0 15px;
87
  }
88
  .landing-container .col-1 img{
89
- width: 100%;
90
  }
91
  .landing-container .col-1{
92
- width: 55%;
93
  }
94
  .landing-container .col-2{
95
- width: 45%;
96
  }
97
  .premium-cta{
98
- background-color: #808a97;
99
- color: #fff;
100
- border-radius: 6px;
101
- padding: 20px 15px;
102
  }
103
  .premium-cta:after{
104
- content: '';
105
- display: block;
106
- clear: both;
107
  }
108
  .premium-cta p{
109
- margin: 7px 0;
110
- font-size: 14px;
111
- font-weight: 500;
112
- display: inline-block;
113
- width: 60%;
114
  }
115
  .premium-cta a.button{
116
- border-radius: 6px;
117
- height: 60px;
118
- float: right;
119
- background: url(<?php echo esc_attr( esc_attr( YITH_WOOCOMPARE_URL ) );?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
120
- border-color: #ff643f;
121
- box-shadow: none;
122
- outline: none;
123
- color: #fff;
124
- position: relative;
125
- padding: 9px 50px 9px 70px;
126
  }
127
  .premium-cta a.button:hover,
128
  .premium-cta a.button:active,
129
  .premium-cta a.button:focus{
130
- color: #fff;
131
- background: url(<?php echo esc_attr( esc_attr( YITH_WOOCOMPARE_URL ) );?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
132
- border-color: #971d00;
133
- box-shadow: none;
134
- outline: none;
135
  }
136
  .premium-cta a.button:focus{
137
- top: 1px;
138
  }
139
  .premium-cta a.button span{
140
- line-height: 13px;
141
  }
142
  .premium-cta a.button .highlight{
143
- display: block;
144
- font-size: 20px;
145
- font-weight: 700;
146
- line-height: 20px;
147
  }
148
  .premium-cta .highlight{
149
- text-transform: uppercase;
150
- background: none;
151
- font-weight: 800;
152
- color: #fff;
153
  }
154
 
155
  .section.one{
156
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
157
  }
158
  .section.two{
159
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/02-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
160
  }
161
  .section.three{
162
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
163
  }
164
  .section.four{
165
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/04-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
166
  }
167
  .section.five{
168
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
169
  }
170
  .section.six{
171
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/06-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
172
  }
173
  .section.seven{
174
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
175
  }
176
  .section.eight{
177
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/08-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
178
  }
179
  .section.nine{
180
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/09-bg.png) no-repeat #fff; background-position: 15% 75%
181
  }
182
  .section.ten{
183
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/10-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
184
  }
185
  .section.eleven{
186
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
187
  }
188
  .section.twelve{
189
- background: url(<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/12-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
190
  }
191
 
192
  @media (max-width: 768px) {
193
- .section{margin: 0}
194
- .premium-cta p{
195
- width: 100%;
196
- }
197
- .premium-cta{
198
- text-align: center;
199
- }
200
- .premium-cta a.button{
201
- float: none;
202
- }
203
  }
204
 
205
  @media (max-width: 480px){
206
- .wrap{
207
- margin-right: 0;
208
- }
209
- .section{
210
- margin: 0;
211
- }
212
- .landing-container .col-1,
213
- .landing-container .col-2{
214
- width: 100%;
215
- padding: 0 15px;
216
- }
217
- .section-odd .col-1 {
218
- float: left;
219
- margin-right: -100%;
220
- }
221
- .section-odd .col-2 {
222
- float: right;
223
- margin-top: 65%;
224
- }
225
  }
226
 
227
  @media (max-width: 320px){
228
- .premium-cta a.button{
229
- padding: 9px 20px 9px 70px;
230
- }
231
 
232
- .section .section-title img{
233
- display: none;
234
- }
235
  }
236
  </style>
237
  <div class="landing">
238
- <div class="section section-cta section-odd">
239
- <div class="landing-container">
240
- <div class="premium-cta">
241
- <p>
242
- <?php echo sprintf( esc_html__('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare' ),'<span class="highlight">','</span>' );?>
243
- </p>
244
- <a href="<?php echo esc_attr( $this->get_premium_landing_uri() ); ?>" target="_blank" class="premium-cta-button button btn">
245
- <span class="highlight"><?php esc_html_e('UPGRADE','yith-woocommerce-compare' ); ?></span>
246
- <span><?php esc_html_e('to the premium version','yith-woocommerce-compare' ); ?></span>
247
- </a>
248
- </div>
249
- </div>
250
- </div>
251
- <div class="one section section-even clear">
252
- <h1><?php esc_html_e('Premium Features','yith-woocommerce-compare');?></h1>
253
- <div class="landing-container">
254
- <div class="col-1">
255
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/01.png" alt="Dedicated Page" />
256
- </div>
257
- <div class="col-2">
258
- <div class="section-title">
259
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/01-icon.png" alt="icon 01"/>
260
- <h2><?php esc_html_e('A DEDICATED PAGE','yith-woocommerce-compare' ); ?></h2>
261
- </div>
262
- <p>
263
- <?php echo sprintf( esc_html__('Don\'t you want to compare your products in a modal window anymore?%3$sWith the premium version of %1$sYITH WooCommerce Compare%2$s, a new page will be created automatically in your site and, adding it among the menu entries, you will be able to give to your users the chance to access it easily whenever they want.', 'yith-woocommerce-compare'), '<b>', '</b>','<br>');?>
264
- </p>
265
- </div>
266
- </div>
267
- </div>
268
- <div class="two section section-odd clear">
269
- <div class="landing-container">
270
- <div class="col-2">
271
- <div class="section-title">
272
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/02-icon.png" alt="icon 02" />
273
- <h2><?php esc_html_e('CATEGORY COMPARATION','yith-woocommerce-compare');?></h2>
274
- </div>
275
- <p>
276
- <?php echo sprintf( esc_html__( 'People are often confused by finding products of different categories in the comparison table, creating difficulties in comparing the products they are interested into.The %1$s"Compare by category"%2$s option exists for this need: you will be able to separate the products in the table by category affinity.', 'yith-woocommerce-compare'), '<b>', '</b>');?>
277
- </p>
278
- </div>
279
- <div class="col-1">
280
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
281
- </div>
282
- </div>
283
- </div>
284
- <div class="three section section-even clear">
285
- <div class="landing-container">
286
- <div class="col-1">
287
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/03.png" alt="Category esclusion" />
288
- </div>
289
- <div class="col-2">
290
- <div class="section-title">
291
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/03-icon.png" alt="icon 03" />
292
- <h2><?php esc_html_e( 'CATEGORY EXCLUSION ','yith-woocommerce-compare');?></h2>
293
- </div>
294
- <p>
295
- <?php echo sprintf(esc_html__('In your shop there may be product categories you don\'t want to be affected by the plugin features, deleting the comparison button for them. The premium version of the plugin offers this too.%3$sAnd there\'s more! Activating the %1$s"Reverse exclusion list"%2$s option, you can also invert the behavior of the feature, allowing the comparison only to those products of the selected categories.', 'yith-woocommerce-compare' ), '<b>', '</b>','<br>');?>
296
- </p>
297
- </div>
298
- </div>
299
- </div>
300
- <div class="four section section-odd clear">
301
- <div class="landing-container">
302
- <div class="col-2">
303
- <div class="section-title">
304
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/04-icon.png" alt="icon 04" />
305
- <h2><?php esc_html_e('TABLE IMAGE','yith-woocommerce-compare');?></h2>
306
- </div>
307
- <p>
308
- <?php echo sprintf(esc_html__('Give a personal touch to the %1$scomparison table%2$s your users will see. Select an image, upload it from the option panel and show it ahead of the table to your users. ', 'yith-woocommerce-compare'), '<b>', '</b>');?>
309
- </p>
310
- </div>
311
- <div class="col-1">
312
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/04.png" alt="Shortcode" />
313
- </div>
314
- </div>
315
- </div>
316
- <div class="five section section-even clear">
317
- <div class="landing-container">
318
- <div class="col-1">
319
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/05.png" alt="Dynamic fields" />
320
- </div>
321
- <div class="col-2">
322
- <div class="section-title">
323
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL )?>assets/images/05-icon.png" alt="icon 05" />
324
- <h2><?php esc_html_e('DYNAMIC FIELDS','yith-woocommerce-compare');?></h2>
325
- </div>
326
- <p>
327
- <?php echo sprintf( esc_html__('With this precious feature, you will be able to show in the table only the fields that have information in at least one of the selected products.%3$sActivate the %1$s"Dynamic Attribute fields"%2$s option and there will be no more empty lines in your comparison table.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
328
- </p>
329
- </div>
330
- </div>
331
- </div>
332
- <div class="six section section-odd clear">
333
- <div class="landing-container">
334
- <div class="col-2">
335
- <div class="section-title">
336
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/06-icon.png" alt="icon 06" />
337
- <h2><?php esc_html_e('SOCIAL NETWORK SHARING','yith-woocommerce-compare');?></h2>
338
- </div>
339
- <p>
340
- <?php echo sprintf( esc_html__( 'One of the most appealing features of the premium version of the plugin.Four social network sites for your users (Facebook, Twitter, Google + and Pinterest) and the email system %1$sto share%2$s the comparison table of the products they have selected.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
341
- </p>
342
- </div>
343
- <div class="col-1">
344
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/06.png" alt="Social networks" />
345
- </div>
346
- </div>
347
- </div>
348
- <div class="seven section section-even clear">
349
- <div class="landing-container">
350
- <div class="col-1">
351
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/07.png" alt="Related products" />
352
- </div>
353
- <div class="col-2">
354
- <div class="section-title">
355
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL )?>assets/images/07-icon.png" alt="icon 05" />
356
- <h2><?php esc_html_e('RELATED PRODUCTS','yith-woocommerce-compare');?></h2>
357
- </div>
358
- <p>
359
- <?php echo sprintf( esc_html__('All the products that have common categories and/or tags with those in the comparison table will be showed in a slider, right under the comparison table.%3$sA completely %1$s"touch friendly"%2$s slider to encourage your users to discover the shop products of the shop related to those they are interested into.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
360
- </p>
361
- </div>
362
- </div>
363
- </div>
364
- <div class="eight section section-odd clear">
365
- <div class="landing-container">
366
- <div class="col-2">
367
- <div class="section-title">
368
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/08-icon.png" alt="icon 06" />
369
- <h2><?php esc_html_e('CUSTOMIZABLE STYLE','yith-woocommerce-compare');?></h2>
370
- </div>
371
- <p>
372
- <?php echo sprintf( esc_html__( 'An advanced option panel that let you change all the colors of the plugin, so that you can adapt stylistically all its elements %1$sto the layout%2$s of your shop.We know it, looks also count... and we give you the right tools to get to the best result.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
373
- </p>
374
- </div>
375
- <div class="col-1">
376
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/08.png" alt="Social networks" />
377
- </div>
378
- </div>
379
- </div>
380
- <div class="nine section section-even clear">
381
- <div class="landing-container">
382
- <div class="col-1">
383
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/09.png" alt="Related products" />
384
- </div>
385
- <div class="col-2">
386
- <div class="section-title">
387
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL )?>assets/images/09-icon.png" alt="icon 09" />
388
- <h2><?php esc_html_e('CUSTOMIZED ATTRIBUTES','yith-woocommerce-compare');?></h2>
389
- </div>
390
- <p>
391
- <?php echo sprintf( esc_html__('Let you users compare products following every feature, and considering also all those %1$sattributes%2$s that can be manually created in within the product detail page. Every single detail will be included.','yith-woocommerce-compare'),'<b>','</b>'); ?>
392
- </p>
393
- </div>
394
- </div>
395
- </div>
396
- <div class="ten section section-odd clear">
397
- <div class="landing-container">
398
- <div class="col-2">
399
- <div class="section-title">
400
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/10-icon.png" alt="icon 10" />
401
- <h2><?php esc_html_e('A TAILORED TABLE','yith-woocommerce-compare');?></h2>
402
- </div>
403
- <p>
404
- <?php echo sprintf( esc_html__( 'Select the products you want to compare and the system will offer you the %1$sshortcode%2$s to generate a comparing table. Simple, rapid and useful.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
405
- </p>
406
- </div>
407
- <div class="col-1">
408
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/10.png" alt="Social networks" />
409
- </div>
410
- </div>
411
- </div>
412
- <div class="eleven section section-even clear">
413
- <div class="landing-container">
414
- <div class="col-1">
415
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/11.png" alt="Widget" />
416
- </div>
417
- <div class="col-2">
418
- <div class="section-title">
419
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL )?>assets/images/11-icon.png" alt="icon 11" />
420
- <h2><?php esc_html_e('Compare list - widget','yith-woocommerce-compare');?></h2>
421
- </div>
422
- <p>
423
- <?php echo sprintf( esc_html__('Thanks to YITH WooCommerce Comapre Widget users could verify at any time the complete list of products added to the compare tab and avoid to open the popup to check its existence. ','yith-woocommerce-compare'),'<b>','</b>'); ?>
424
- </p>
425
- </div>
426
- </div>
427
- </div>
428
- <div class="twelve section section-odd clear">
429
- <div class="landing-container">
430
- <div class="col-2">
431
- <div class="section-title">
432
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/12-icon.png" alt="icon 12" />
433
- <h2><?php esc_html_e('Compare counter - widget and shortcode','yith-woocommerce-compare');?></h2>
434
- </div>
435
- <p>
436
- <?php echo sprintf( esc_html__( 'Moreover, if you want to give your users the chance to see in a glance how many products they have added to the Compare list, feel free to use the widget or the shortcode included. And their Compare list is always no more than one click away.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
437
- </p>
438
- </div>
439
- <div class="col-1">
440
- <img src="<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/12.png" alt="Social networks" />
441
- </div>
442
- </div>
443
- </div>
444
- <div class="section section-cta section-odd">
445
- <div class="landing-container">
446
- <div class="premium-cta">
447
- <p>
448
- <?php echo sprintf( esc_html__('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare'),'<span class="highlight">','</span>' );?>
449
- </p>
450
- <a href="<?php echo esc_attr( $this->get_premium_landing_uri() ); ?>" target="_blank" class="premium-cta-button button btn">
451
- <span class="highlight"><?php esc_html_e('UPGRADE','yith-woocommerce-compare');?></span>
452
- <span><?php esc_html_e('to the premium version','yith-woocommerce-compare');?></span>
453
- </a>
454
- </div>
455
- </div>
456
- </div>
457
- </div>
1
+ <?php
2
+ /**
3
+ * Premium tab template
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ */
9
+
10
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
11
+ ?>
12
  <style>
13
  .section{
14
+ margin-left: -20px;
15
+ margin-right: -20px;
16
+ font-family: "Raleway",san-serif;
17
  }
18
  .section h1{
19
+ text-align: center;
20
+ text-transform: uppercase;
21
+ color: #808a97;
22
+ font-size: 35px;
23
+ font-weight: 700;
24
+ line-height: normal;
25
+ display: inline-block;
26
+ width: 100%;
27
+ margin: 50px 0 0;
28
  }
29
  .section ul{
30
+ list-style-type: disc;
31
+ padding-left: 15px;
32
  }
33
  .section:nth-child(even){
34
+ background-color: #fff;
35
  }
36
  .section:nth-child(odd){
37
+ background-color: #f1f1f1;
38
  }
39
  .section .section-title img{
40
+ display: table-cell;
41
+ vertical-align: middle;
42
+ width: auto;
43
+ margin-right: 15px;
44
  }
45
  .section h2,
46
  .section h3 {
47
+ display: inline-block;
48
+ vertical-align: middle;
49
+ padding: 0;
50
+ font-size: 24px;
51
+ font-weight: 700;
52
+ color: #808a97;
53
+ text-transform: uppercase;
54
  }
55
 
56
  .section .section-title h2{
57
+ display: table-cell;
58
+ vertical-align: middle;
59
+ line-height: 25px;
60
+ border: none;
61
+ background: transparent;
62
  }
63
 
64
  .section-title{
65
+ display: table;
66
  }
67
 
68
  .section h3 {
69
+ font-size: 14px;
70
+ line-height: 28px;
71
+ margin-bottom: 0;
72
+ display: block;
73
  }
74
 
75
  .section p{
76
+ font-size: 13px;
77
+ margin: 25px 0;
78
  }
79
  .section ul li{
80
+ margin-bottom: 4px;
81
  }
82
  .landing-container{
83
+ max-width: 750px;
84
+ margin-left: auto;
85
+ margin-right: auto;
86
+ padding: 50px 0 30px;
87
  }
88
  .landing-container:after{
89
+ display: block;
90
+ clear: both;
91
+ content: '';
92
  }
93
  .landing-container .col-1,
94
  .landing-container .col-2{
95
+ float: left;
96
+ box-sizing: border-box;
97
+ padding: 0 15px;
98
  }
99
  .landing-container .col-1 img{
100
+ width: 100%;
101
  }
102
  .landing-container .col-1{
103
+ width: 55%;
104
  }
105
  .landing-container .col-2{
106
+ width: 45%;
107
  }
108
  .premium-cta{
109
+ background-color: #808a97;
110
+ color: #fff;
111
+ border-radius: 6px;
112
+ padding: 20px 15px;
113
  }
114
  .premium-cta:after{
115
+ content: '';
116
+ display: block;
117
+ clear: both;
118
  }
119
  .premium-cta p{
120
+ margin: 7px 0;
121
+ font-size: 14px;
122
+ font-weight: 500;
123
+ display: inline-block;
124
+ width: 60%;
125
  }
126
  .premium-cta a.button{
127
+ border-radius: 6px;
128
+ height: 60px;
129
+ float: right;
130
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL); ?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
131
+ border-color: #ff643f;
132
+ box-shadow: none;
133
+ outline: none;
134
+ color: #fff;
135
+ position: relative;
136
+ padding: 9px 50px 9px 70px;
137
  }
138
  .premium-cta a.button:hover,
139
  .premium-cta a.button:active,
140
  .premium-cta a.button:focus{
141
+ color: #fff;
142
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
143
+ border-color: #971d00;
144
+ box-shadow: none;
145
+ outline: none;
146
  }
147
  .premium-cta a.button:focus{
148
+ top: 1px;
149
  }
150
  .premium-cta a.button span{
151
+ line-height: 13px;
152
  }
153
  .premium-cta a.button .highlight{
154
+ display: block;
155
+ font-size: 20px;
156
+ font-weight: 700;
157
+ line-height: 20px;
158
  }
159
  .premium-cta .highlight{
160
+ text-transform: uppercase;
161
+ background: none;
162
+ font-weight: 800;
163
+ color: #fff;
164
  }
165
 
166
  .section.one{
167
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
168
  }
169
  .section.two{
170
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/02-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
171
  }
172
  .section.three{
173
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
174
  }
175
  .section.four{
176
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/04-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
177
  }
178
  .section.five{
179
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
180
  }
181
  .section.six{
182
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/06-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
183
  }
184
  .section.seven{
185
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
186
  }
187
  .section.eight{
188
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/08-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
189
  }
190
  .section.nine{
191
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/09-bg.png) no-repeat #fff; background-position: 15% 75%
192
  }
193
  .section.ten{
194
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/10-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
195
  }
196
  .section.eleven{
197
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
198
  }
199
  .section.twelve{
200
+ background: url(<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/12-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
201
  }
202
 
203
  @media (max-width: 768px) {
204
+ .section{margin: 0}
205
+ .premium-cta p{
206
+ width: 100%;
207
+ }
208
+ .premium-cta{
209
+ text-align: center;
210
+ }
211
+ .premium-cta a.button{
212
+ float: none;
213
+ }
214
  }
215
 
216
  @media (max-width: 480px){
217
+ .wrap{
218
+ margin-right: 0;
219
+ }
220
+ .section{
221
+ margin: 0;
222
+ }
223
+ .landing-container .col-1,
224
+ .landing-container .col-2{
225
+ width: 100%;
226
+ padding: 0 15px;
227
+ }
228
+ .section-odd .col-1 {
229
+ float: left;
230
+ margin-right: -100%;
231
+ }
232
+ .section-odd .col-2 {
233
+ float: right;
234
+ margin-top: 65%;
235
+ }
236
  }
237
 
238
  @media (max-width: 320px){
239
+ .premium-cta a.button{
240
+ padding: 9px 20px 9px 70px;
241
+ }
242
 
243
+ .section .section-title img{
244
+ display: none;
245
+ }
246
  }
247
  </style>
248
  <div class="landing">
249
+ <div class="section section-cta section-odd">
250
+ <div class="landing-container">
251
+ <div class="premium-cta">
252
+ <p>
253
+ <?php echo sprintf( esc_html__( 'Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!', 'yith-woocommerce-compare' ), '<span class="highlight">', '</span>' ); ?>
254
+ </p>
255
+ <a href="<?php echo esc_attr( $this->get_premium_landing_uri() ); ?>" target="_blank" class="premium-cta-button button btn">
256
+ <span class="highlight"><?php esc_html_e( 'UPGRADE', 'yith-woocommerce-compare' ); ?></span>
257
+ <span><?php esc_html_e( 'to the premium version', 'yith-woocommerce-compare' ); ?></span>
258
+ </a>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ <div class="one section section-even clear">
263
+ <h1><?php esc_html_e( 'Premium Features', 'yith-woocommerce-compare' ); ?></h1>
264
+ <div class="landing-container">
265
+ <div class="col-1">
266
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/01.png" alt="Dedicated Page" />
267
+ </div>
268
+ <div class="col-2">
269
+ <div class="section-title">
270
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/01-icon.png" alt="icon 01"/>
271
+ <h2><?php esc_html_e( 'A DEDICATED PAGE', 'yith-woocommerce-compare' ); ?></h2>
272
+ </div>
273
+ <p>
274
+ <?php echo sprintf( esc_html__( 'Don\'t you want to compare your products in a modal window anymore?%3$sWith the premium version of %1$sYITH WooCommerce Compare%2$s, a new page will be created automatically in your site and, adding it among the menu entries, you will be able to give to your users the chance to access it easily whenever they want.', 'yith-woocommerce-compare' ), '<b>', '</b>', '<br>' ); ?>
275
+ </p>
276
+ </div>
277
+ </div>
278
+ </div>
279
+ <div class="two section section-odd clear">
280
+ <div class="landing-container">
281
+ <div class="col-2">
282
+ <div class="section-title">
283
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/02-icon.png" alt="icon 02" />
284
+ <h2><?php esc_html_e( 'CATEGORY COMPARATION', 'yith-woocommerce-compare' ); ?></h2>
285
+ </div>
286
+ <p>
287
+ <?php echo sprintf( esc_html__( 'People are often confused by finding products of different categories in the comparison table, creating difficulties in comparing the products they are interested into.The %1$s"Compare by category"%2$s option exists for this need: you will be able to separate the products in the table by category affinity.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
288
+ </p>
289
+ </div>
290
+ <div class="col-1">
291
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
292
+ </div>
293
+ </div>
294
+ </div>
295
+ <div class="three section section-even clear">
296
+ <div class="landing-container">
297
+ <div class="col-1">
298
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/03.png" alt="Category esclusion" />
299
+ </div>
300
+ <div class="col-2">
301
+ <div class="section-title">
302
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/03-icon.png" alt="icon 03" />
303
+ <h2><?php esc_html_e( 'CATEGORY EXCLUSION ', 'yith-woocommerce-compare' ); ?></h2>
304
+ </div>
305
+ <p>
306
+ <?php echo sprintf( esc_html__( 'In your shop there may be product categories you don\'t want to be affected by the plugin features, deleting the comparison button for them. The premium version of the plugin offers this too.%3$sAnd there\'s more! Activating the %1$s"Reverse exclusion list"%2$s option, you can also invert the behavior of the feature, allowing the comparison only to those products of the selected categories.', 'yith-woocommerce-compare' ), '<b>', '</b>', '<br>' ); ?>
307
+ </p>
308
+ </div>
309
+ </div>
310
+ </div>
311
+ <div class="four section section-odd clear">
312
+ <div class="landing-container">
313
+ <div class="col-2">
314
+ <div class="section-title">
315
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/04-icon.png" alt="icon 04" />
316
+ <h2><?php esc_html_e( 'TABLE IMAGE', 'yith-woocommerce-compare' ); ?></h2>
317
+ </div>
318
+ <p>
319
+ <?php echo sprintf( esc_html__( 'Give a personal touch to the %1$scomparison table%2$s your users will see. Select an image, upload it from the option panel and show it ahead of the table to your users. ', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
320
+ </p>
321
+ </div>
322
+ <div class="col-1">
323
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/04.png" alt="Shortcode" />
324
+ </div>
325
+ </div>
326
+ </div>
327
+ <div class="five section section-even clear">
328
+ <div class="landing-container">
329
+ <div class="col-1">
330
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/05.png" alt="Dynamic fields" />
331
+ </div>
332
+ <div class="col-2">
333
+ <div class="section-title">
334
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/05-icon.png" alt="icon 05" />
335
+ <h2><?php esc_html_e( 'DYNAMIC FIELDS', 'yith-woocommerce-compare' ); ?></h2>
336
+ </div>
337
+ <p>
338
+ <?php echo sprintf( esc_html__( 'With this precious feature, you will be able to show in the table only the fields that have information in at least one of the selected products.%3$sActivate the %1$s"Dynamic Attribute fields"%2$s option and there will be no more empty lines in your comparison table.', 'yith-woocommerce-compare' ), '<b>', '</b>', '<br>' ); ?>
339
+ </p>
340
+ </div>
341
+ </div>
342
+ </div>
343
+ <div class="six section section-odd clear">
344
+ <div class="landing-container">
345
+ <div class="col-2">
346
+ <div class="section-title">
347
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/06-icon.png" alt="icon 06" />
348
+ <h2><?php esc_html_e( 'SOCIAL NETWORK SHARING', 'yith-woocommerce-compare' ); ?></h2>
349
+ </div>
350
+ <p>
351
+ <?php echo sprintf( esc_html__( 'One of the most appealing features of the premium version of the plugin.Four social network sites for your users (Facebook, Twitter, Google + and Pinterest) and the email system %1$sto share%2$s the comparison table of the products they have selected.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
352
+ </p>
353
+ </div>
354
+ <div class="col-1">
355
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/06.png" alt="Social networks" />
356
+ </div>
357
+ </div>
358
+ </div>
359
+ <div class="seven section section-even clear">
360
+ <div class="landing-container">
361
+ <div class="col-1">
362
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/07.png" alt="Related products" />
363
+ </div>
364
+ <div class="col-2">
365
+ <div class="section-title">
366
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/07-icon.png" alt="icon 05" />
367
+ <h2><?php esc_html_e( 'RELATED PRODUCTS', 'yith-woocommerce-compare' ); ?></h2>
368
+ </div>
369
+ <p>
370
+ <?php echo sprintf( esc_html__( 'All the products that have common categories and/or tags with those in the comparison table will be showed in a slider, right under the comparison table.%3$sA completely %1$s"touch friendly"%2$s slider to encourage your users to discover the shop products of the shop related to those they are interested into.', 'yith-woocommerce-compare' ), '<b>', '</b>', '<br>' ); ?>
371
+ </p>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ <div class="eight section section-odd clear">
376
+ <div class="landing-container">
377
+ <div class="col-2">
378
+ <div class="section-title">
379
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/08-icon.png" alt="icon 06" />
380
+ <h2><?php esc_html_e( 'CUSTOMIZABLE STYLE', 'yith-woocommerce-compare' ); ?></h2>
381
+ </div>
382
+ <p>
383
+ <?php echo sprintf( esc_html__( 'An advanced option panel that let you change all the colors of the plugin, so that you can adapt stylistically all its elements %1$sto the layout%2$s of your shop.We know it, looks also count... and we give you the right tools to get to the best result.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
384
+ </p>
385
+ </div>
386
+ <div class="col-1">
387
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/08.png" alt="Social networks" />
388
+ </div>
389
+ </div>
390
+ </div>
391
+ <div class="nine section section-even clear">
392
+ <div class="landing-container">
393
+ <div class="col-1">
394
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/09.png" alt="Related products" />
395
+ </div>
396
+ <div class="col-2">
397
+ <div class="section-title">
398
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/09-icon.png" alt="icon 09" />
399
+ <h2><?php esc_html_e( 'CUSTOMIZED ATTRIBUTES', 'yith-woocommerce-compare' ); ?></h2>
400
+ </div>
401
+ <p>
402
+ <?php echo sprintf( esc_html__( 'Let you users compare products following every feature, and considering also all those %1$sattributes%2$s that can be manually created in within the product detail page. Every single detail will be included.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
403
+ </p>
404
+ </div>
405
+ </div>
406
+ </div>
407
+ <div class="ten section section-odd clear">
408
+ <div class="landing-container">
409
+ <div class="col-2">
410
+ <div class="section-title">
411
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/10-icon.png" alt="icon 10" />
412
+ <h2><?php esc_html_e( 'A TAILORED TABLE', 'yith-woocommerce-compare' ); ?></h2>
413
+ </div>
414
+ <p>
415
+ <?php echo sprintf( esc_html__( 'Select the products you want to compare and the system will offer you the %1$sshortcode%2$s to generate a comparing table. Simple, rapid and useful.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
416
+ </p>
417
+ </div>
418
+ <div class="col-1">
419
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/10.png" alt="Social networks" />
420
+ </div>
421
+ </div>
422
+ </div>
423
+ <div class="eleven section section-even clear">
424
+ <div class="landing-container">
425
+ <div class="col-1">
426
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/11.png" alt="Widget" />
427
+ </div>
428
+ <div class="col-2">
429
+ <div class="section-title">
430
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/11-icon.png" alt="icon 11" />
431
+ <h2><?php esc_html_e( 'Compare list - widget', 'yith-woocommerce-compare' ); ?></h2>
432
+ </div>
433
+ <p>
434
+ <?php echo sprintf( esc_html__( 'Thanks to YITH WooCommerce Comapre Widget users could verify at any time the complete list of products added to the compare tab and avoid to open the popup to check its existence. ', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
435
+ </p>
436
+ </div>
437
+ </div>
438
+ </div>
439
+ <div class="twelve section section-odd clear">
440
+ <div class="landing-container">
441
+ <div class="col-2">
442
+ <div class="section-title">
443
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/12-icon.png" alt="icon 12" />
444
+ <h2><?php esc_html_e( 'Compare counter - widget and shortcode', 'yith-woocommerce-compare' ); ?></h2>
445
+ </div>
446
+ <p>
447
+ <?php echo sprintf( esc_html__( 'Moreover, if you want to give your users the chance to see in a glance how many products they have added to the Compare list, feel free to use the widget or the shortcode included. And their Compare list is always no more than one click away.', 'yith-woocommerce-compare' ), '<b>', '</b>' ); ?>
448
+ </p>
449
+ </div>
450
+ <div class="col-1">
451
+ <img src="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/12.png" alt="Social networks" />
452
+ </div>
453
+ </div>
454
+ </div>
455
+ <div class="section section-cta section-odd">
456
+ <div class="landing-container">
457
+ <div class="premium-cta">
458
+ <p>
459
+ <?php echo sprintf( esc_html__( 'Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!', 'yith-woocommerce-compare' ), '<span class="highlight">', '</span>' ); ?>
460
+ </p>
461
+ <a href="<?php echo esc_url( $this->get_premium_landing_uri() ); ?>" target="_blank" class="premium-cta-button button btn">
462
+ <span class="highlight"><?php esc_html_e( 'UPGRADE', 'yith-woocommerce-compare' ); ?></span>
463
+ <span><?php esc_html_e( 'to the premium version', 'yith-woocommerce-compare' ); ?></span>
464
+ </a>
465
+ </div>
466
+ </div>
467
+ </div>
468
+ </div>
templates/compare.php CHANGED
@@ -1,288 +1,322 @@
1
- <?php
2
- /**
3
- * Woocommerce Compare page
4
- *
5
- * @author YITH
6
- * @package YITH Woocommerce Compare
7
- * @version 2.3.2
8
- */
9
-
10
- // remove the style of woocommerce
11
- if (defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS) wp_dequeue_style('woocommerce_frontend_styles');
12
-
13
- $is_iframe = (bool)(isset($_REQUEST['iframe']) && $_REQUEST['iframe']);
14
-
15
- wp_enqueue_script('jquery-imagesloaded', YITH_WOOCOMPARE_ASSETS_URL . '/js/imagesloaded.pkgd.min.js', array('jquery'), '3.1.8', true);
16
- wp_enqueue_script('jquery-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.10.19', true);
17
- wp_enqueue_script('jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '3.2.6', true);
18
-
19
- $widths = array();
20
- foreach ($products as $product) $widths[] = '{ "sWidth": "205px", resizeable:true }';
21
-
22
- $table_text = get_option('yith_woocompare_table_text', __('Compare products', 'yith-woocommerce-compare'));
23
- do_action('wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text);
24
- $localized_table_text = apply_filters('wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text');
25
-
26
- ?><!DOCTYPE html>
27
- <!--[if IE 6]>
28
- <html id="ie6" class="ie"<?php language_attributes() ?>>
29
- <![endif]-->
30
- <!--[if IE 7]>
31
- <html id="ie7" class="ie"<?php language_attributes() ?>>
32
- <![endif]-->
33
- <!--[if IE 8]>
34
- <html id="ie8" class="ie"<?php language_attributes() ?>>
35
- <![endif]-->
36
- <!--[if IE 9]>
37
- <html id="ie9" class="ie"<?php language_attributes() ?>>
38
- <![endif]-->
39
- <!--[if gt IE 9]>
40
- <html class="ie"<?php language_attributes() ?>>
41
- <![endif]-->
42
- <!--[if !IE]>
43
- <html <?php language_attributes() ?>>
44
- <![endif]-->
45
-
46
- <!-- START HEAD -->
47
- <head>
48
- <meta charset="<?php bloginfo('charset'); ?>"/>
49
- <meta name="viewport" content="width=device-width"/>
50
- <title><?php esc_html_e('Product Comparison', 'yith-woocommerce-compare') ?></title>
51
- <link rel="profile" href="http://gmpg.org/xfn/11"/>
52
-
53
- <?php wp_head() ?>
54
-
55
- <?php do_action('yith_woocompare_popup_head') ?>
56
-
57
- <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"/>
58
- <link rel="stylesheet" href="<?php echo esc_attr(YITH_WOOCOMPARE_URL) ?>assets/css/colorbox.css"/>
59
- <link rel="stylesheet" href="<?php echo esc_attr(YITH_WOOCOMPARE_URL) ?>assets/css/jquery.dataTables.css"/>
60
- <link rel="stylesheet" href="<?php echo esc_attr($this->stylesheet_url()); ?>" type="text/css"/>
61
-
62
- <style type="text/css">
63
- body.loading {
64
- background: url("<?php echo esc_attr( YITH_WOOCOMPARE_URL ) ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
65
- }
66
- </style>
67
- </head>
68
- <!-- END HEAD -->
69
-
70
- <?php global $product; ?>
71
-
72
- <!-- START BODY -->
73
- <body <?php body_class('woocommerce yith-woocompare-popup') ?>>
74
-
75
- <h1>
76
- <?php echo wp_kses_post($localized_table_text); ?>
77
- <?php if (!$is_iframe) : ?><a class="close" href="#"><?php esc_html_e('Close window [X]', 'yith-woocommerce-compare' ) ?></a><?php endif; ?>
78
- </h1>
79
-
80
- <div id="yith-woocompare" class="woocommerce">
81
-
82
- <?php do_action('yith_woocompare_before_main_table'); ?>
83
-
84
- <table class="compare-list" cellpadding="0"
85
- cellspacing="0"<?php if (empty($products)) echo ' style="width:100%"' ?>>
86
- <thead>
87
- <tr>
88
- <th>&nbsp;</th>
89
- <?php foreach ($products as $product_id => $product) : ?>
90
- <td></td>
91
- <?php endforeach; ?>
92
- </tr>
93
- </thead>
94
- <tfoot>
95
- <tr>
96
- <th>&nbsp;</th>
97
- <?php foreach ($products as $product_id => $product) : ?>
98
- <td></td>
99
- <?php endforeach; ?>
100
- </tr>
101
- </tfoot>
102
- <tbody>
103
-
104
- <?php if (empty($products)) : ?>
105
-
106
- <tr class="no-products">
107
- <td><?php esc_html_e('No products added in the compare table.', 'yith-woocommerce-compare') ?></td>
108
- </tr>
109
-
110
- <?php else : ?>
111
- <tr class="remove">
112
- <th>&nbsp;</th>
113
- <?php
114
- $index = 0;
115
- foreach ($products as $product_id => $product) :
116
- $product_class = ($index % 2 == 0 ? 'odd' : 'even') . ' product_' . $product_id ?>
117
- <td class="<?php echo esc_attr( $product_class ); ?>">
118
- <a href="<?php echo add_query_arg('redirect', 'view', $this->remove_product_url($product_id)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"
119
- data-product_id="<?php echo esc_attr( $product_id ); ?>"><?php esc_html_e('Remove', 'yith-woocommerce-compare') ?>
120
- <span class="remove">x</span></a>
121
- </td>
122
- <?php
123
- ++$index;
124
- endforeach;
125
- ?>
126
- </tr>
127
-
128
- <?php foreach ($fields as $field => $name) : ?>
129
-
130
- <tr class="<?php echo esc_attr( $field ); ?>">
131
-
132
- <th>
133
- <?php if ($field != 'image') echo esc_html( $name ); ?>
134
- </th>
135
-
136
- <?php
137
- $index = 0;
138
- foreach ($products as $product_id => $product) :
139
- $product_class = ($index % 2 == 0 ? 'odd' : 'even') . ' product_' . $product_id; ?>
140
- <td class="<?php echo esc_attr( $product_class ); ?>"><?php
141
- switch ($field) {
142
-
143
- case 'image':
144
- echo '<div class="image-wrap">' . $product->get_image('yith-woocompare-image') . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
145
- break;
146
-
147
- case 'add-to-cart':
148
- woocommerce_template_loop_add_to_cart();
149
- break;
150
-
151
- default:
152
- echo empty($product->fields[$field]) ? '&nbsp;' : $product->fields[$field]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
153
- break;
154
- }
155
- ?>
156
- </td>
157
- <?php
158
- ++$index;
159
- endforeach; ?>
160
-
161
- </tr>
162
-
163
- <?php endforeach; ?>
164
-
165
- <?php if ($repeat_price == 'yes' && isset($fields['price'])) : ?>
166
- <tr class="price repeated">
167
- <th><?php echo wp_kses_post($fields['price']) ?></th>
168
-
169
- <?php
170
- $index = 0;
171
- foreach ($products as $product_id => $product) :
172
- $product_class = ($index % 2 == 0 ? 'odd' : 'even') . ' product_' . $product_id ?>
173
- <td class="<?php echo esc_attr( $product_class ) ?>"><?php echo wp_kses_post( $product->fields['price'] ); ?></td>
174
- <?php
175
- ++$index;
176
- endforeach; ?>
177
-
178
- </tr>
179
- <?php endif; ?>
180
-
181
- <?php if ($repeat_add_to_cart == 'yes' && isset($fields['add-to-cart'])) : ?>
182
- <tr class="add-to-cart repeated">
183
- <th><?php echo wp_kses_post( $fields['add-to-cart'] ); ?></th>
184
-
185
- <?php
186
- $index = 0;
187
- foreach ($products as $product_id => $product) :
188
- $product_class = ($index % 2 == 0 ? 'odd' : 'even') . ' product_' . $product_id ?>
189
- <td class="<?php echo esc_attr( $product_class ); ?>">
190
- <?php woocommerce_template_loop_add_to_cart(); ?>
191
- </td>
192
- <?php
193
- ++$index;
194
- endforeach; ?>
195
-
196
- </tr>
197
- <?php endif; ?>
198
-
199
- <?php endif; ?>
200
-
201
- </tbody>
202
- </table>
203
-
204
- <?php do_action('yith_woocompare_after_main_table'); ?>
205
-
206
- </div>
207
-
208
- <?php if (wp_script_is('responsive-theme', 'enqueued')) wp_dequeue_script('responsive-theme') ?><?php if (wp_script_is('responsive-theme', 'enqueued')) wp_dequeue_script('responsive-theme') ?>
209
- <?php print_footer_scripts(); ?>
210
-
211
- <script type="text/javascript">
212
-
213
- jQuery(document).ready(function ($) {
214
- $('a').attr('target', '_parent');
215
-
216
- var oTable;
217
- $('body').on('yith_woocompare_render_table', function () {
218
-
219
- var t = $('table.compare-list');
220
-
221
- if (typeof $.fn.DataTable != 'undefined' && typeof $.fn.imagesLoaded != 'undefined' ) {
222
- t.imagesLoaded(function () {
223
- oTable = t.DataTable({
224
- 'info': false,
225
- 'scrollX': true,
226
- 'scrollCollapse': true,
227
- 'paging': false,
228
- 'ordering': false,
229
- 'searching': false,
230
- 'autoWidth': false,
231
- 'destroy': true,
232
- 'fixedColumns': true
233
- });
234
- });
235
- }
236
- }).trigger('yith_woocompare_render_table');
237
-
238
- // add to cart
239
- var redirect_to_cart = false,
240
- body = $('body');
241
-
242
- // close colorbox if redirect to cart is active after add to cart
243
- body.on('adding_to_cart', function ($thisbutton, data) {
244
- if (wc_add_to_cart_params.cart_redirect_after_add == 'yes') {
245
- wc_add_to_cart_params.cart_redirect_after_add = 'no';
246
- redirect_to_cart = true;
247
- }
248
- });
249
-
250
- body.on('wc_cart_button_updated', function (ev, button) {
251
- $('a.added_to_cart').attr('target', '_parent');
252
- });
253
-
254
- // remove add to cart button after added
255
- body.on('added_to_cart', function (ev, fragments, cart_hash, button) {
256
-
257
- $('a').attr('target', '_parent');
258
-
259
- if (redirect_to_cart == true) {
260
- // redirect
261
- parent.window.location = wc_add_to_cart_params.cart_url;
262
- return;
263
- }
264
-
265
- // Replace fragments
266
- if (fragments) {
267
- $.each(fragments, function (key, value) {
268
- $(key, window.parent.document).replaceWith(value);
269
- });
270
- }
271
- });
272
-
273
- // close window
274
- $(document).on('click', 'a.close', function (e) {
275
- e.preventDefault();
276
- window.close();
277
- });
278
-
279
- $(window).on('resize yith_woocompare_product_removed', function () {
280
- $('body').trigger('yith_woocompare_render_table');
281
- });
282
-
283
- });
284
-
285
- </script>
286
-
287
- </body>
288
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Compare table
4
+ *
5
+ * @author YITH
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
8
+ * @var array $products An array of products to compare.
9
+ */
10
+
11
+ defined( 'YITH_WOOCOMPARE' ) || exit; // Exit if accessed directly.
12
+
13
+ // Remove the style of WooCommerce.
14
+ if ( defined( 'WOOCOMMERCE_USE_CSS' ) && WOOCOMMERCE_USE_CSS ) {
15
+ wp_dequeue_style( 'woocommerce_frontend_styles' );
16
+ }
17
+
18
+ $is_iframe = ! empty( $_REQUEST['iframe'] );
19
+
20
+ wp_enqueue_script( 'jquery-imagesloaded', YITH_WOOCOMPARE_ASSETS_URL . '/js/imagesloaded.pkgd.min.js', array( 'jquery' ), '3.1.8', true );
21
+ wp_enqueue_script( 'jquery-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array( 'jquery' ), '1.10.19', true );
22
+ wp_enqueue_script( 'jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array( 'jquery', 'jquery-fixedheadertable' ), '3.2.6', true );
23
+
24
+ $widths = array();
25
+ foreach ( $products as $product ) {
26
+ $widths[] = '{ "sWidth": "205px", resizeable:true }';
27
+ }
28
+
29
+ $table_text = get_option( 'yith_woocompare_table_text', __( 'Compare products', 'yith-woocommerce-compare' ) );
30
+ do_action( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text );
31
+ $localized_table_text = apply_filters( 'wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text' );
32
+
33
+ ?><!DOCTYPE html>
34
+ <!--[if IE 6]>
35
+ <html id="ie6" class="ie"<?php language_attributes(); ?>>
36
+ <![endif]-->
37
+ <!--[if IE 7]>
38
+ <html id="ie7" class="ie"<?php language_attributes(); ?>>
39
+ <![endif]-->
40
+ <!--[if IE 8]>
41
+ <html id="ie8" class="ie"<?php language_attributes(); ?>>
42
+ <![endif]-->
43
+ <!--[if IE 9]>
44
+ <html id="ie9" class="ie"<?php language_attributes(); ?>>
45
+ <![endif]-->
46
+ <!--[if gt IE 9]>
47
+ <html class="ie"<?php language_attributes(); ?>>
48
+ <![endif]-->
49
+ <!--[if !IE]>
50
+ <html <?php language_attributes(); ?>>
51
+ <![endif]-->
52
+
53
+ <!-- START HEAD -->
54
+ <head>
55
+ <meta charset="<?php bloginfo( 'charset' ); ?>"/>
56
+ <meta name="viewport" content="width=device-width"/>
57
+ <title><?php esc_html_e( 'Product Comparison', 'yith-woocommerce-compare' ); ?></title>
58
+ <link rel="profile" href="http://gmpg.org/xfn/11"/>
59
+
60
+ <?php wp_head(); ?>
61
+
62
+ <?php do_action( 'yith_woocompare_popup_head' ); ?>
63
+
64
+ <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"/>
65
+ <link rel="stylesheet" href="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/css/colorbox.css"/>
66
+ <link rel="stylesheet" href="<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/css/jquery.dataTables.css"/>
67
+ <link rel="stylesheet" href="<?php echo esc_url( $this->stylesheet_url() ); ?>" type="text/css"/>
68
+
69
+ <style type="text/css">
70
+ body.loading {
71
+ background: url("<?php echo esc_url( YITH_WOOCOMPARE_URL ); ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
72
+ }
73
+ </style>
74
+ </head>
75
+ <!-- END HEAD -->
76
+
77
+ <?php global $product; ?>
78
+
79
+ <!-- START BODY -->
80
+ <body <?php body_class( 'woocommerce yith-woocompare-popup' ); ?>>
81
+
82
+ <h1>
83
+ <?php echo wp_kses_post( $localized_table_text ); ?>
84
+ <?php
85
+ if ( ! $is_iframe ) :
86
+ ?>
87
+ <a class="close" href="#"><?php esc_html_e( 'Close window [X]', 'yith-woocommerce-compare' ); ?></a><?php endif; ?>
88
+ </h1>
89
+
90
+ <div id="yith-woocompare" class="woocommerce">
91
+
92
+ <?php do_action( 'yith_woocompare_before_main_table' ); ?>
93
+
94
+ <table class="compare-list" cellpadding="0" cellspacing="0" <?php if ( empty( $products ) ) {
95
+ echo ' style="width:100%"';
96
+ } ?>>
97
+ <thead>
98
+ <tr>
99
+ <th>&nbsp;</th>
100
+ <?php foreach ( $products as $product_id => $product ) : ?>
101
+ <td></td>
102
+ <?php endforeach; ?>
103
+ </tr>
104
+ </thead>
105
+ <tfoot>
106
+ <tr>
107
+ <th>&nbsp;</th>
108
+ <?php foreach ( $products as $product_id => $product ) : ?>
109
+ <td></td>
110
+ <?php endforeach; ?>
111
+ </tr>
112
+ </tfoot>
113
+ <tbody>
114
+
115
+ <?php if ( empty( $products ) ) : ?>
116
+
117
+ <tr class="no-products">
118
+ <td><?php esc_html_e( 'No products added in the compare table.', 'yith-woocommerce-compare' ); ?></td>
119
+ </tr>
120
+
121
+ <?php else : ?>
122
+ <tr class="remove">
123
+ <th>&nbsp;</th>
124
+ <?php
125
+ $index = 0;
126
+ foreach ( $products as $product_id => $product ) :
127
+ $product_class = ( ( 0 === ( $index % 2 ) ) ? 'odd' : 'even' ) . ' product_' . $product_id
128
+ ?>
129
+ <td class="<?php echo esc_attr( $product_class ); ?>">
130
+ <a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $product_id ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
131
+ ?>"
132
+ data-product_id="<?php echo esc_attr( $product_id ); ?>"><?php esc_html_e( 'Remove', 'yith-woocommerce-compare' ); ?>
133
+ <span class="remove">x</span></a>
134
+ </td>
135
+ <?php
136
+ ++ $index;
137
+ endforeach;
138
+ ?>
139
+ </tr>
140
+
141
+ <?php foreach ( $fields as $field => $name ) : ?>
142
+
143
+ <tr class="<?php echo esc_attr( $field ); ?>">
144
+
145
+ <th>
146
+ <?php
147
+ if ( 'image' !== $field ) {
148
+ echo esc_html( $name );
149
+ }
150
+ ?>
151
+ </th>
152
+
153
+ <?php
154
+ $index = 0;
155
+ foreach ( $products as $product_id => $product ) :
156
+ $product_class = ( ( 0 === ( $index % 2 ) ) ? 'odd' : 'even' ) . ' product_' . $product_id;
157
+ ?>
158
+ <td class="<?php echo esc_attr( $product_class ); ?>">
159
+ <?php
160
+ switch ( $field ) {
161
+
162
+ case 'image':
163
+ echo '<div class="image-wrap">' . $product->get_image( 'yith-woocompare-image' ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
164
+ break;
165
+
166
+ case 'add-to-cart':
167
+ woocommerce_template_loop_add_to_cart();
168
+ break;
169
+
170
+ default:
171
+ echo empty( $product->fields[ $field ] ) ? '&nbsp;' : $product->fields[ $field ]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
172
+ break;
173
+ }
174
+ ?>
175
+ </td>
176
+ <?php
177
+ ++ $index;
178
+ endforeach;
179
+ ?>
180
+
181
+ </tr>
182
+
183
+ <?php endforeach; ?>
184
+
185
+ <?php if ( 'yes' === $repeat_price && isset( $fields['price'] ) ) : ?>
186
+ <tr class="price repeated">
187
+ <th><?php echo wp_kses_post( $fields['price'] ); ?></th>
188
+
189
+ <?php
190
+ $index = 0;
191
+ foreach ( $products as $product_id => $product ) :
192
+ $product_class = ( ( 0 === ( $index % 2 ) ) ? 'odd' : 'even' ) . ' product_' . $product_id
193
+ ?>
194
+ <td class="<?php echo esc_attr( $product_class ); ?>"><?php echo wp_kses_post( $product->fields['price'] ); ?></td>
195
+ <?php
196
+ ++ $index;
197
+ endforeach;
198
+ ?>
199
+
200
+ </tr>
201
+ <?php endif; ?>
202
+
203
+ <?php if ( 'yes' === $repeat_add_to_cart && isset( $fields['add-to-cart'] ) ) : ?>
204
+ <tr class="add-to-cart repeated">
205
+ <th><?php echo wp_kses_post( $fields['add-to-cart'] ); ?></th>
206
+
207
+ <?php
208
+ $index = 0;
209
+ foreach ( $products as $product_id => $product ) :
210
+ $product_class = ( ( 0 === ( $index % 2 ) ) ? 'odd' : 'even' ) . ' product_' . $product_id
211
+ ?>
212
+ <td class="<?php echo esc_attr( $product_class ); ?>">
213
+ <?php woocommerce_template_loop_add_to_cart(); ?>
214
+ </td>
215
+ <?php
216
+ ++ $index;
217
+ endforeach;
218
+ ?>
219
+
220
+ </tr>
221
+ <?php endif; ?>
222
+
223
+ <?php endif; ?>
224
+
225
+ </tbody>
226
+ </table>
227
+
228
+ <?php do_action( 'yith_woocompare_after_main_table' ); ?>
229
+
230
+ </div>
231
+
232
+ <?php
233
+ if ( wp_script_is( 'responsive-theme', 'enqueued' ) ) {
234
+ wp_dequeue_script( 'responsive-theme' );
235
+ }
236
+ ?>
237
+
238
+ <?php
239
+ if ( wp_script_is( 'responsive-theme', 'enqueued' ) ) {
240
+ wp_dequeue_script( 'responsive-theme' );
241
+ }
242
+ ?>
243
+ <?php print_footer_scripts(); ?>
244
+
245
+ <script type="text/javascript">
246
+
247
+ jQuery( document ).ready( function( $ ) {
248
+ $( 'a' ).attr( 'target', '_parent' );
249
+
250
+ var oTable;
251
+ $( 'body' ).on( 'yith_woocompare_render_table', function() {
252
+
253
+ var t = $( 'table.compare-list' );
254
+
255
+ if ( typeof $.fn.DataTable != 'undefined' && typeof $.fn.imagesLoaded != 'undefined' ) {
256
+ t.imagesLoaded( function() {
257
+ oTable = t.DataTable( {
258
+ 'info': false,
259
+ 'scrollX': true,
260
+ 'scrollCollapse': true,
261
+ 'paging': false,
262
+ 'ordering': false,
263
+ 'searching': false,
264
+ 'autoWidth': false,
265
+ 'destroy': true,
266
+ 'fixedColumns': true
267
+ } );
268
+ } );
269
+ }
270
+ } ).trigger( 'yith_woocompare_render_table' );
271
+
272
+ // add to cart
273
+ var redirect_to_cart = false,
274
+ body = $( 'body' );
275
+
276
+ // close colorbox if redirect to cart is active after add to cart
277
+ body.on( 'adding_to_cart', function( $thisbutton, data ) {
278
+ if ( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) {
279
+ wc_add_to_cart_params.cart_redirect_after_add = 'no';
280
+ redirect_to_cart = true;
281
+ }
282
+ } );
283
+
284
+ body.on( 'wc_cart_button_updated', function( ev, button ) {
285
+ $( 'a.added_to_cart' ).attr( 'target', '_parent' );
286
+ } );
287
+
288
+ // remove add to cart button after added
289
+ body.on( 'added_to_cart', function( ev, fragments, cart_hash, button ) {
290
+
291
+ $( 'a' ).attr( 'target', '_parent' );
292
+
293
+ if ( redirect_to_cart == true ) {
294
+ // redirect
295
+ parent.window.location = wc_add_to_cart_params.cart_url;
296
+ return;
297
+ }
298
+
299
+ // Replace fragments
300
+ if ( fragments ) {
301
+ $.each( fragments, function( key, value ) {
302
+ $( key, window.parent.document ).replaceWith( value );
303
+ } );
304
+ }
305
+ } );
306
+
307
+ // close window
308
+ $( document ).on( 'click', 'a.close', function( e ) {
309
+ e.preventDefault();
310
+ window.close();
311
+ } );
312
+
313
+ $( window ).on( 'resize yith_woocompare_product_removed', function() {
314
+ $( 'body' ).trigger( 'yith_woocompare_render_table' );
315
+ } );
316
+
317
+ } );
318
+
319
+ </script>
320
+
321
+ </body>
322
+ </html>