YITH WooCommerce Compare - Version 2.3.1

Version Description

Released on Jun 5, 2018

  • New: Support to WooCommerce 3.4.1.
  • New: Support to WordPress 4.9.6.
  • Update: Plugin Core.
  • Fix: WPML table fields translation.
Download this release

Release Info

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

Code changes from version 2.3.0 to 2.3.1

Files changed (40) hide show
  1. README.txt +290 -282
  2. assets/css/admin.css +28 -28
  3. assets/css/style.css +290 -290
  4. assets/css/widget.css +64 -64
  5. assets/js/woocompare-admin.js +18 -18
  6. includes/class.yith-woocompare-admin.php +472 -472
  7. includes/class.yith-woocompare-frontend.php +802 -802
  8. includes/class.yith-woocompare-helper.php +113 -104
  9. includes/class.yith-woocompare.php +122 -122
  10. init.php +119 -119
  11. plugin-fw/assets/css/yit-plugin-panel.css +2 -66
  12. plugin-fw/assets/css/yith-fields.css +42 -12
  13. plugin-fw/assets/js/multisite-updater.js +75 -79
  14. plugin-fw/assets/js/multisite-updater.min.js +7 -4
  15. plugin-fw/assets/js/yit-plugin-panel.js +0 -31
  16. plugin-fw/assets/js/yit-plugin-panel.min.js +7 -5
  17. plugin-fw/init.php +2 -2
  18. plugin-fw/lib/privacy/yit-privacy-plugin-abstract.php +29 -0
  19. plugin-fw/lib/privacy/yit-privacy.php +79 -0
  20. plugin-fw/lib/yit-metabox.php +5 -1
  21. plugin-fw/lib/yit-plugin-panel-wc.php +5 -2
  22. plugin-fw/lib/yit-plugin-panel.php +13 -18
  23. plugin-fw/lib/yit-plugin-subpanel.php +0 -1
  24. plugin-fw/lib/yit-upgrade.php +76 -36
  25. plugin-fw/lib/yit-video.php +3 -1
  26. plugin-fw/licence/lib/yit-licence.php +2 -2
  27. plugin-fw/licence/lib/yit-plugin-licence.php +1 -1
  28. plugin-fw/templates/fields/onoff.php +6 -1
  29. plugin-fw/templates/fields/radio.php +33 -0
  30. plugin-fw/templates/panel/videobox.php +0 -83
  31. plugin-fw/templates/privacy/html-policy-content.php +37 -0
  32. plugin-fw/templates/upgrade/changelog.php +51 -0
  33. plugin-fw/templates/upgrade/error.php +147 -0
  34. plugin-fw/yit-plugin.php +2 -0
  35. plugin-options/general-options.php +145 -145
  36. plugin-options/premium-options.php +23 -23
  37. templates/admin/premium.php +429 -429
  38. templates/compare.php +281 -281
  39. widgets/class.yith-woocompare-widget.php +83 -83
  40. wpml-config.xml +5 -5
README.txt CHANGED
@@ -1,282 +1,290 @@
1
- === YITH WooCommerce Compare ===
2
-
3
- Contributors: yithemes
4
- Tags: woocommerce compare, compare products, product compare, product comparison, compare table
5
- Requires at least: 3.5.1
6
- Tested up to: 4.9.2
7
- Stable tag: 2.3.0
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 3.3
13
-
14
- == Description ==
15
-
16
- YITH WooCommerce Compare plugin is an extension of WooCommerce plugin that allow your users to compare some products of your shop.
17
- All products are saved in one complete table where the user can see the difference between the products. Each product features can be
18
- 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](http://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
-
26
-
27
- = Installation =
28
-
29
- 1. Unzip the downloaded zip file.
30
- 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
31
- 3. Activate `YITH WooCommerce Compare` from Plugins page
32
-
33
- = Configuration =
34
-
35
- 1. Add the features in each product by setting the attributes in prouct configuration;
36
- 2. Configure the options in YIT Plugin -> Compare;
37
- 3. The user of your shop will click in the "Compare" button located in the single product page;
38
- 4. Will be open a popup with the compare table inside.
39
-
40
- You can also add the widget with the product list of compare table, in Appearance -> Widgets and adding the widget "YITH WooCommerce Compare Widget".
41
-
42
- == Frequently Asked Questions ==
43
-
44
- = Can I customize the compare table? =
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.
55
- In order to import correctly the plugin strings in the new system, we had to change the text domain form 'yit' to 'yith-woocommerce-compare'.
56
- Once the plugin will be imported in the translate.wordpress.org system, the translations of other languages will be downloaded directly from WordPress, without using any .po and .mo files. Moreover, users will be able to participate in a more direct way to plugin translations, suggesting texts in their languages in the dedicated tab on translate.wordpress.org.
57
- During this transition step, .po and .mo files will be used as always, but in order to be recognized by WordPress, they will need to have a new nomenclature, renaming them in:
58
- yith-woocommerce-compare-<WORDPRESS LOCALE>.po
59
- yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
60
-
61
- == Screenshots ==
62
-
63
- 1. The popup with compare table.
64
- 2. The button compare.
65
- 3. The settings of plugin
66
-
67
- == Changelog ==
68
-
69
- = 2.3.0 = Released on Feb 2, 2018
70
-
71
- * New: Support to WooCommerce 3.3.0.
72
- * New: Support to WordPress 4.9.2.
73
- * Update: Plugin Core.
74
-
75
- = 2.2.3 = Released on Dec 21, 2017
76
-
77
- * New: Support to WooCommerce 3.2.6.
78
- * New: Support to WordPress 4.9.1.
79
- * New: Product SKU field in compare table.
80
- * Update: Plugin Core.
81
- * Update: Language Files.
82
- * Dev: New filter yith_woocompare_standard_fields_array to filter standard compare fields.
83
-
84
- = 2.2.2 = Released on Oct 24, 2017
85
-
86
- * New: Support to WooCommerce 3.2.1.
87
- * New: Support to WordPress 4.8.2.
88
- * Update: Plugin Core.
89
- * Update: Language Files.
90
-
91
- = 2.2.1 = Released on Jul 05, 2017
92
-
93
- * New: Support to WooCommerce 3.1.
94
- * New: Support to WordPress 4.8.
95
- * New: Russian Translation.
96
- * New: Slovenian Translation.
97
- * Update: Plugin Core.
98
- * Update: Language Files.
99
- * Fix: WPML and Add to cart action from popup.
100
-
101
- = 2.2.0 = Released on Mar 29, 2017
102
-
103
- * New: Support to WooCommerce 3.0.0 RC2.
104
- * New: Support to WordPress 4.7.3
105
- * Update: Plugin Core.
106
- * Update: Language Files.
107
-
108
- = 2.1.0 = Released on Oct 19, 2016
109
-
110
- * New: Support to WooCommerce 2.6.4
111
- * New: Support to WordPress 4.6
112
- * New: Auto remove from compare list for products that are private or were cancelled.
113
- * New: Add as default fields Weight and Dimensions.
114
- * Update: Plugin Core.
115
- * Update: Language Files.
116
- * Fix: Uncaught ReferenceError "redirect_to_cart is not defined" error on "add to cart" action.
117
- * Fix: Compatibility issue with NextGen Gallery plugin.
118
-
119
- = 2.0.9 = Released on Jun 13, 2016
120
-
121
- * New: Support to WooCommerce 2.6 RC1
122
- * Update: Plugin Core.
123
-
124
- = 2.0.8 = Released on Apr 19, 2016
125
-
126
- * New: Compatibility with WordPress 4.5
127
- * Update: Plugin Core.
128
- * Fix: Fatal error call to undefined method WC_AJAX::get_endpoint() for WooCommerce version older then 2.4
129
-
130
- = 2.0.7 = Released on Apr 01, 2016
131
-
132
- * Update: Plugin template compare.php
133
- * Update: Plugin Core.
134
- * Update: Language file.
135
- * Fix: Product status now updates automatically when the product is removed from the compare widget.
136
- * Fix: Redirect correctly to cart page after "Add to cart" is clicked if "Redirect to the cart page after successful addition" option is enabled.
137
- * Fix: Redirect correctly to product page after "Add to cart" is clicked when "Enable AJAX add to cart buttons on archives" option is disabled.
138
-
139
- = 2.0.6 = Released on Jan 11, 2016
140
-
141
- * New: Compatibility with WooCommerce 2.5 RC
142
- * Update: Change ajax call fron admin-ajax to wc-ajax
143
- * Update: Plugin template compare.php
144
- * Update: Plugin Core
145
-
146
- = 2.0.5 = Released on Oct 30, 2015
147
-
148
- * Update: Plugin Core
149
- * Fix: After you remove product from compare, you can re-add it without reload page
150
-
151
- = 2.0.4 = Released on Sep 22, 2015
152
-
153
- * Update: Changed Text Domain from 'yith-wcmp' to 'yith-woocommerce-compare'
154
- * Update: Plugin Core Framework
155
- * Fix: JS error when loading compare window
156
-
157
- = 2.0.3 = Released on Aug 21, 2015
158
-
159
- * New: Compatibility with WooPress 4.3
160
-
161
- = 2.0.2 = Released on Aug 12, 2015
162
-
163
- * New: Compatibility with WooCommerce 2.4
164
- * Update: Core plugin
165
-
166
- = 2.0.1 = Released on Aug 10, 2015
167
-
168
- * Update: Core plugin
169
- * Fix: Compare table layout
170
- * Fix: undefined function unblock() in main js
171
-
172
- = 2.0.0 = Released on Jul 15, 2015
173
-
174
- * New: New plugin core
175
- * Update: Language files
176
- * Removed: old default.po catalog language file
177
- * Fix: Error in class yith-woocompare-fontend
178
- * Fix: Lightbox doesn't close after click view cart
179
- * Fix: minor bug fix
180
-
181
- = 1.2.3 = Released on Feb 13, 2015
182
-
183
- * New: Bulgarian Translation by Joanna Mikova
184
- * New: Spanish Translation by Rodoslav Angelov and Mariano Rivas
185
-
186
- = 1.2.2 = Released on Dec 03, 2014
187
-
188
- * Fix: Shortcode compare
189
-
190
- = 1.2.1 = Released on Sep 17, 2014
191
-
192
- * New: Support to WC 2.2.3
193
-
194
- = 1.2.0 = Released on Sep 16, 2014
195
-
196
- * New: Support to WC 2.2.2
197
- * Update: Compare Template
198
- * Update: Plugin Core Framework
199
- * Fix: Fields orders
200
- * Tweek: WPML Support improved
201
-
202
- = 1.1.4 = Released on Jun 30, 2014
203
-
204
- * Update: Colorbox Library Version 1.5.10
205
- * Fix: Horizontal scroll bar issue: show at the end of iframe
206
-
207
- = 1.1.3 = Released on Jun 05, 2014
208
-
209
- * New: RTL Support
210
-
211
- = 1.1.2 = Released on Mar 21, 2014
212
-
213
- * Fix: WPML Support on Compare Widget
214
-
215
- = 1.1.1 = Released on Feb 19, 2014
216
-
217
- * Fix: Add to cart Button on Compare page
218
-
219
- = 1.1.0 = Released on Feb 13, 2014
220
-
221
- * New: Support to WooCommerce 2.1.X
222
- * New: French translation by Paumo
223
-
224
- = 1.0.5 = Released on Oct 14, 2013
225
-
226
- * New: Persian translation by Khalil Delavaran
227
- * New: Compare table title option
228
- * New: Compatibility with WPML plugin
229
- * New: Brazilian Portuguese translation by hotelwww
230
- * Fix: Responsive features
231
- * Fix: Dequeued wrong JS scripts
232
- * Update: Dutch translation by Frans Pronk
233
-
234
- = 1.0.4 = Released on Sep 04, 2013
235
-
236
- * New: complete Dutch translation. Thanks to Frans Pronk
237
- * Fix: Sortable scripts included only in the plugin admin page
238
- * Fix: products list in popup don't update after have added a product
239
-
240
- = 1.0.3 = Released on Jul 31, 2013
241
-
242
- * Minor bugs fixes
243
-
244
- = 1.0.2 = Released on Jul 20, 2013
245
-
246
- * Tweak: trigger in javascript file for add to compare event
247
-
248
- = 1.0.1 = Released on Jun 27, 2013
249
-
250
- * New: Link/Button text option in plugin options
251
- * New: ability to add a link in the menu top open the popup
252
- * Fix: bug with attributes added after installation
253
- * Fix: bug with plugin activated but not working for multisites
254
-
255
- = 1.0.0 = Released on Jun 24, 2013
256
-
257
- * Initial release
258
-
259
- == Suggestions ==
260
-
261
- If you have suggestions about how to improve YITH WooCommerce Compare, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Compare.
262
-
263
- == Translators ==
264
-
265
- = Available Languages =
266
- * English (Default)
267
- * Italiano
268
-
269
- If you can't find this plugin in your language and want to translate it, use the dedicated tool at [Translating WordPress](https://translate.wordpress.org/locale/it/default/wp-plugins/yith-woocommerce-compare "Translating WordPress").
270
- Or, if you have created your own language pack, or have an update for an existing one, you can send it as an email attachment from our [Contacts page](http://yithemes.com/contact/ "Your Inspiration Themes") and we will bundle into YITH WooCommerce Compare.
271
-
272
- == Documentation ==
273
-
274
- Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-compare).
275
-
276
- == Upgrade notice ==
277
-
278
- = 2.3.0 = Released on Feb 2, 2018
279
-
280
- * New: Support to WooCommerce 3.3.0.
281
- * New: Support to WordPress 4.9.2.
282
- * Update: Plugin Core.
 
 
 
 
 
 
 
 
1
+ === YITH WooCommerce Compare ===
2
+
3
+ Contributors: yithemes
4
+ Tags: woocommerce compare, compare products, product compare, product comparison, compare table
5
+ Requires at least: 3.5.1
6
+ Tested up to: 4.9.6
7
+ Stable tag: 2.3.1
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 3.4
13
+
14
+ == Description ==
15
+
16
+ YITH WooCommerce Compare plugin is an extension of WooCommerce plugin that allow your users to compare some products of your shop.
17
+ All products are saved in one complete table where the user can see the difference between the products. Each product features can be
18
+ 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](http://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
+
26
+
27
+ = Installation =
28
+
29
+ 1. Unzip the downloaded zip file.
30
+ 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
31
+ 3. Activate `YITH WooCommerce Compare` from Plugins page
32
+
33
+ = Configuration =
34
+
35
+ 1. Add the features in each product by setting the attributes in prouct configuration;
36
+ 2. Configure the options in YIT Plugin -> Compare;
37
+ 3. The user of your shop will click in the "Compare" button located in the single product page;
38
+ 4. Will be open a popup with the compare table inside.
39
+
40
+ You can also add the widget with the product list of compare table, in Appearance -> Widgets and adding the widget "YITH WooCommerce Compare Widget".
41
+
42
+ == Frequently Asked Questions ==
43
+
44
+ = Can I customize the compare table? =
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.
55
+ In order to import correctly the plugin strings in the new system, we had to change the text domain form 'yit' to 'yith-woocommerce-compare'.
56
+ Once the plugin will be imported in the translate.wordpress.org system, the translations of other languages will be downloaded directly from WordPress, without using any .po and .mo files. Moreover, users will be able to participate in a more direct way to plugin translations, suggesting texts in their languages in the dedicated tab on translate.wordpress.org.
57
+ During this transition step, .po and .mo files will be used as always, but in order to be recognized by WordPress, they will need to have a new nomenclature, renaming them in:
58
+ yith-woocommerce-compare-<WORDPRESS LOCALE>.po
59
+ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
60
+
61
+ == Screenshots ==
62
+
63
+ 1. The popup with compare table.
64
+ 2. The button compare.
65
+ 3. The settings of plugin
66
+
67
+ == Changelog ==
68
+
69
+ = 2.3.1 = Released on Jun 5, 2018
70
+
71
+ * New: Support to WooCommerce 3.4.1.
72
+ * New: Support to WordPress 4.9.6.
73
+ * Update: Plugin Core.
74
+ * Fix: WPML table fields translation.
75
+
76
+ = 2.3.0 = Released on Feb 2, 2018
77
+
78
+ * New: Support to WooCommerce 3.3.0.
79
+ * New: Support to WordPress 4.9.2.
80
+ * Update: Plugin Core.
81
+
82
+ = 2.2.3 = Released on Dec 21, 2017
83
+
84
+ * New: Support to WooCommerce 3.2.6.
85
+ * New: Support to WordPress 4.9.1.
86
+ * New: Product SKU field in compare table.
87
+ * Update: Plugin Core.
88
+ * Update: Language Files.
89
+ * Dev: New filter yith_woocompare_standard_fields_array to filter standard compare fields.
90
+
91
+ = 2.2.2 = Released on Oct 24, 2017
92
+
93
+ * New: Support to WooCommerce 3.2.1.
94
+ * New: Support to WordPress 4.8.2.
95
+ * Update: Plugin Core.
96
+ * Update: Language Files.
97
+
98
+ = 2.2.1 = Released on Jul 05, 2017
99
+
100
+ * New: Support to WooCommerce 3.1.
101
+ * New: Support to WordPress 4.8.
102
+ * New: Russian Translation.
103
+ * New: Slovenian Translation.
104
+ * Update: Plugin Core.
105
+ * Update: Language Files.
106
+ * Fix: WPML and Add to cart action from popup.
107
+
108
+ = 2.2.0 = Released on Mar 29, 2017
109
+
110
+ * New: Support to WooCommerce 3.0.0 RC2.
111
+ * New: Support to WordPress 4.7.3
112
+ * Update: Plugin Core.
113
+ * Update: Language Files.
114
+
115
+ = 2.1.0 = Released on Oct 19, 2016
116
+
117
+ * New: Support to WooCommerce 2.6.4
118
+ * New: Support to WordPress 4.6
119
+ * New: Auto remove from compare list for products that are private or were cancelled.
120
+ * New: Add as default fields Weight and Dimensions.
121
+ * Update: Plugin Core.
122
+ * Update: Language Files.
123
+ * Fix: Uncaught ReferenceError "redirect_to_cart is not defined" error on "add to cart" action.
124
+ * Fix: Compatibility issue with NextGen Gallery plugin.
125
+
126
+ = 2.0.9 = Released on Jun 13, 2016
127
+
128
+ * New: Support to WooCommerce 2.6 RC1
129
+ * Update: Plugin Core.
130
+
131
+ = 2.0.8 = Released on Apr 19, 2016
132
+
133
+ * New: Compatibility with WordPress 4.5
134
+ * Update: Plugin Core.
135
+ * Fix: Fatal error call to undefined method WC_AJAX::get_endpoint() for WooCommerce version older then 2.4
136
+
137
+ = 2.0.7 = Released on Apr 01, 2016
138
+
139
+ * Update: Plugin template compare.php
140
+ * Update: Plugin Core.
141
+ * Update: Language file.
142
+ * Fix: Product status now updates automatically when the product is removed from the compare widget.
143
+ * Fix: Redirect correctly to cart page after "Add to cart" is clicked if "Redirect to the cart page after successful addition" option is enabled.
144
+ * Fix: Redirect correctly to product page after "Add to cart" is clicked when "Enable AJAX add to cart buttons on archives" option is disabled.
145
+
146
+ = 2.0.6 = Released on Jan 11, 2016
147
+
148
+ * New: Compatibility with WooCommerce 2.5 RC
149
+ * Update: Change ajax call fron admin-ajax to wc-ajax
150
+ * Update: Plugin template compare.php
151
+ * Update: Plugin Core
152
+
153
+ = 2.0.5 = Released on Oct 30, 2015
154
+
155
+ * Update: Plugin Core
156
+ * Fix: After you remove product from compare, you can re-add it without reload page
157
+
158
+ = 2.0.4 = Released on Sep 22, 2015
159
+
160
+ * Update: Changed Text Domain from 'yith-wcmp' to 'yith-woocommerce-compare'
161
+ * Update: Plugin Core Framework
162
+ * Fix: JS error when loading compare window
163
+
164
+ = 2.0.3 = Released on Aug 21, 2015
165
+
166
+ * New: Compatibility with WooPress 4.3
167
+
168
+ = 2.0.2 = Released on Aug 12, 2015
169
+
170
+ * New: Compatibility with WooCommerce 2.4
171
+ * Update: Core plugin
172
+
173
+ = 2.0.1 = Released on Aug 10, 2015
174
+
175
+ * Update: Core plugin
176
+ * Fix: Compare table layout
177
+ * Fix: undefined function unblock() in main js
178
+
179
+ = 2.0.0 = Released on Jul 15, 2015
180
+
181
+ * New: New plugin core
182
+ * Update: Language files
183
+ * Removed: old default.po catalog language file
184
+ * Fix: Error in class yith-woocompare-fontend
185
+ * Fix: Lightbox doesn't close after click view cart
186
+ * Fix: minor bug fix
187
+
188
+ = 1.2.3 = Released on Feb 13, 2015
189
+
190
+ * New: Bulgarian Translation by Joanna Mikova
191
+ * New: Spanish Translation by Rodoslav Angelov and Mariano Rivas
192
+
193
+ = 1.2.2 = Released on Dec 03, 2014
194
+
195
+ * Fix: Shortcode compare
196
+
197
+ = 1.2.1 = Released on Sep 17, 2014
198
+
199
+ * New: Support to WC 2.2.3
200
+
201
+ = 1.2.0 = Released on Sep 16, 2014
202
+
203
+ * New: Support to WC 2.2.2
204
+ * Update: Compare Template
205
+ * Update: Plugin Core Framework
206
+ * Fix: Fields orders
207
+ * Tweek: WPML Support improved
208
+
209
+ = 1.1.4 = Released on Jun 30, 2014
210
+
211
+ * Update: Colorbox Library Version 1.5.10
212
+ * Fix: Horizontal scroll bar issue: show at the end of iframe
213
+
214
+ = 1.1.3 = Released on Jun 05, 2014
215
+
216
+ * New: RTL Support
217
+
218
+ = 1.1.2 = Released on Mar 21, 2014
219
+
220
+ * Fix: WPML Support on Compare Widget
221
+
222
+ = 1.1.1 = Released on Feb 19, 2014
223
+
224
+ * Fix: Add to cart Button on Compare page
225
+
226
+ = 1.1.0 = Released on Feb 13, 2014
227
+
228
+ * New: Support to WooCommerce 2.1.X
229
+ * New: French translation by Paumo
230
+
231
+ = 1.0.5 = Released on Oct 14, 2013
232
+
233
+ * New: Persian translation by Khalil Delavaran
234
+ * New: Compare table title option
235
+ * New: Compatibility with WPML plugin
236
+ * New: Brazilian Portuguese translation by hotelwww
237
+ * Fix: Responsive features
238
+ * Fix: Dequeued wrong JS scripts
239
+ * Update: Dutch translation by Frans Pronk
240
+
241
+ = 1.0.4 = Released on Sep 04, 2013
242
+
243
+ * New: complete Dutch translation. Thanks to Frans Pronk
244
+ * Fix: Sortable scripts included only in the plugin admin page
245
+ * Fix: products list in popup don't update after have added a product
246
+
247
+ = 1.0.3 = Released on Jul 31, 2013
248
+
249
+ * Minor bugs fixes
250
+
251
+ = 1.0.2 = Released on Jul 20, 2013
252
+
253
+ * Tweak: trigger in javascript file for add to compare event
254
+
255
+ = 1.0.1 = Released on Jun 27, 2013
256
+
257
+ * New: Link/Button text option in plugin options
258
+ * New: ability to add a link in the menu top open the popup
259
+ * Fix: bug with attributes added after installation
260
+ * Fix: bug with plugin activated but not working for multisites
261
+
262
+ = 1.0.0 = Released on Jun 24, 2013
263
+
264
+ * Initial release
265
+
266
+ == Suggestions ==
267
+
268
+ If you have suggestions about how to improve YITH WooCommerce Compare, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Compare.
269
+
270
+ == Translators ==
271
+
272
+ = Available Languages =
273
+ * English (Default)
274
+ * Italiano
275
+
276
+ If you can't find this plugin in your language and want to translate it, use the dedicated tool at [Translating WordPress](https://translate.wordpress.org/locale/it/default/wp-plugins/yith-woocommerce-compare "Translating WordPress").
277
+ Or, if you have created your own language pack, or have an update for an existing one, you can send it as an email attachment from our [Contacts page](http://yithemes.com/contact/ "Your Inspiration Themes") and we will bundle into YITH WooCommerce Compare.
278
+
279
+ == Documentation ==
280
+
281
+ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-compare).
282
+
283
+ == Upgrade notice ==
284
+
285
+ = 2.3.1 = Released on Jun 5, 2018
286
+
287
+ * New: Support to WooCommerce 3.4.1.
288
+ * New: Support to WordPress 4.9.6.
289
+ * Update: Plugin Core.
290
+ * Fix: WPML table fields translation.
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,291 +1,291 @@
1
- /**
2
- * The style of the woocommerce compare products
3
- */
4
-
5
- * {
6
- margin: 0;
7
- padding: 0;
8
- }
9
-
10
- body {
11
- font-family: 'Open Sans', san-serif;
12
- font-size: 13px;
13
- line-height: 1.51em;
14
- color: #747373;
15
- background: none !important;
16
- }
17
-
18
- table.compare-list {
19
- margin: 10px;
20
- table-layout: fixed;
21
- }
22
-
23
- /* plugin fixedheadertable fix */
24
- table.compare-list thead, table.compare-list tfoot {
25
- display: none;
26
- }
27
-
28
- .table-wrapper {
29
- width: 100%;
30
- }
31
-
32
- table.compare-list thead th, h1 {
33
- background: #4F4F4F;
34
- color: #fff;
35
- font-weight: 800;
36
- padding: 6px 10px;
37
- border-bottom: 2px solid #fff;
38
- display: block;
39
- text-transform: uppercase;
40
- font-size: 1.076em;
41
- }
42
-
43
- table.compare-list thead th a.close, h1 a.close {
44
- float: right;
45
- margin-right: 10px;
46
- font-weight: 600;
47
- font-size: 0.9em;
48
- color: #fff;
49
- text-decoration: none;
50
- }
51
-
52
- table.compare-list th, table.compare-list td,
53
- table.compare-list th, table.compare-list .price.repeated td {
54
- padding: 10px;
55
- }
56
-
57
- table.compare-list th, table.compare-list td {
58
- border-bottom: 1px solid #D6D6D6;
59
- }
60
-
61
- table.compare-list tr.remove th, table.compare-list tr.remove td,
62
- table.compare-list tr.image th, table.compare-list tr.image td,
63
- table.compare-list tr.title th, table.compare-list tr.title td,
64
- table.compare-list tr.price th, table.compare-list tr.price td {
65
- border-bottom: 0;
66
- padding-bottom: 0;
67
- }
68
-
69
- table.compare-list tr.image th, table.compare-list tr.image td {
70
- height: 186px;
71
- }
72
-
73
- table.compare-list tr.image th, table.compare-list tr.image td,
74
- table.compare-list tr.title th, table.compare-list tr.title td,
75
- table.compare-list tr.price th, table.compare-list tr.price td {
76
- color: #333;
77
- text-transform: uppercase;
78
- font-size: 1.076em;
79
- }
80
-
81
- table.compare-list tr.image th, table.compare-list tr.image td,
82
- table.compare-list tr.price th, table.compare-list tr.price td,
83
- table.compare-list tr.add-to-cart th, table.compare-list tr.add-to-cart td {
84
- padding-top: 4px;
85
- }
86
-
87
- table.compare-list tr.image th,
88
- table.compare-list tr.title th,
89
- table.compare-list tr.price th,
90
- table.compare-list tr.add-to-cart th {
91
- text-indent: 150%;
92
- overflow: hidden;
93
- white-space: nowrap;
94
- }
95
-
96
- table.compare-list .remove td a {
97
- color: #747373;
98
- text-decoration: none;
99
- }
100
-
101
- table.compare-list .remove td a:hover {
102
- color: #333333;
103
- }
104
-
105
- table.compare-list .remove td a .remove {
106
- border-radius: 100% 100% 100% 100%;
107
- color: red;
108
- display: inline-block;
109
- font-size: 1em;
110
- font-weight: 600;
111
- height: 1em;
112
- line-height: 0.81em;
113
- text-align: center;
114
- text-decoration: none;
115
- width: 1em;
116
- }
117
-
118
- .yith-woocompare-widget ul.products-list a.remove {
119
- float: left;
120
- }
121
-
122
- table.compare-list .remove td a:hover .remove {
123
- background-color: red;
124
- color: #ffffff;
125
- }
126
-
127
- table.compare-list .add-to-cart td a {
128
- display: inline-block;
129
- margin: 10px 0;
130
- background-color: #4F4F4F;
131
- border: 0 none;
132
- color: #FFFFFF;
133
- font-weight: normal;
134
- line-height: normal;
135
- padding: 5px 20px;
136
- text-decoration: none;
137
- text-transform: uppercase;
138
- cursor: pointer;
139
- }
140
-
141
- table.compare-list .add-to-cart td a:hover {
142
- background: #868686;
143
- color: #fff;
144
- }
145
-
146
- table.compare-list .stock td span {
147
- color: #009900;
148
- }
149
-
150
- table.compare-list .stock td span.out-of-stock {
151
- color: #990000;
152
- }
153
-
154
- table.compare-list .price td {
155
- text-decoration: underline;
156
- }
157
-
158
- table.compare-list th .fixed-th {
159
- width: 205px;
160
- }
161
-
162
- table.compare-list th {
163
- width: 205px;
164
- max-width: 205px;
165
- min-width: 205px;
166
- overflow: hidden;
167
- text-align: left;
168
- font-size: 1.076em;
169
- color: #333333;
170
- font-weight: 400;
171
- text-transform: uppercase;
172
- }
173
-
174
- table.compare-list td {
175
- width: 230px;
176
- max-width: 230px;
177
- min-width: 230px;
178
- text-align: center;
179
- }
180
-
181
- table.compare-list td.odd {
182
- background: #F7F7F7;
183
- }
184
-
185
- table.compare-list td.even {
186
- background: #fff;
187
- }
188
-
189
- table.compare-list td img {
190
- background: none repeat scroll 0 0 #FFFFFF;
191
- border: 1px solid #DADADA;
192
- height: auto;
193
- max-width: 100%;
194
- padding: 3px;
195
- margin-bottom: 20px;
196
- max-width: none;
197
- }
198
-
199
- /** Fixed Header Table Style */
200
- /*!
201
- * jquery.fixedHeaderTable. The jQuery fixedHeaderTable plugin
202
- *
203
- * Copyright (c) 2011 Mark Malek
204
- * http://fixedheadertable.com
205
- *
206
- * Licensed under MIT
207
- * http://www.opensource.org/licenses/mit-license.php
208
- *
209
- * http://docs.jquery.com/Plugins/Authoring
210
- * jQuery authoring guidelines
211
- *
212
- * Launch : October 2009
213
- * Version : 1.3
214
- * Released: May 9th, 2011
215
- *
216
- *
217
- * all CSS sizing (width,height) is done in pixels (px)
218
- */
219
-
220
- /* @group Reset */
221
-
222
- .fht-table,
223
- .fht-table thead,
224
- .fht-table tfoot,
225
- .fht-table tbody,
226
- .fht-table tr,
227
- .fht-table th,
228
- .fht-table td {
229
- /* position */
230
- margin: 0;
231
-
232
- /* size */
233
- padding: 0;
234
-
235
- /* text */
236
- font-size: 100%;
237
- font: inherit;
238
- vertical-align: top;
239
- }
240
-
241
- .fht-table {
242
- /* appearance */
243
- border-collapse: collapse;
244
- border-spacing: 0;
245
- }
246
-
247
- /* @end */
248
-
249
- /* @group Content */
250
-
251
- .fht-table-wrapper,
252
- .fht-table-wrapper .fht-thead,
253
- .fht-table-wrapper .fht-tfoot,
254
- .fht-table-wrapper .fht-fixed-column .fht-tbody,
255
- .fht-table-wrapper .fht-fixed-body .fht-tbody,
256
- .fht-table-wrapper .fht-tbody {
257
- /* appearance */
258
- overflow: hidden;
259
-
260
- /* position */
261
- position: relative;
262
- }
263
-
264
- .fht-table-wrapper .fht-fixed-body .fht-tbody,
265
- .fht-table-wrapper .fht-tbody {
266
- /* appearance */
267
- overflow: auto;
268
- }
269
-
270
- .fht-table-wrapper .fht-table .fht-cell {
271
- /* appearance */
272
- overflow: hidden;
273
-
274
- /* size */
275
- height: 1px;
276
- }
277
-
278
- .fht-table-wrapper .fht-fixed-column,
279
- .fht-table-wrapper .fht-fixed-body {
280
- /* position */
281
- top: 0;
282
- left: 0;
283
- position: absolute;
284
- }
285
-
286
- .fht-table-wrapper .fht-fixed-column {
287
- /* position */
288
- z-index: 1;
289
- }
290
-
291
  /* @end */
1
+ /**
2
+ * The style of the woocommerce compare products
3
+ */
4
+
5
+ * {
6
+ margin: 0;
7
+ padding: 0;
8
+ }
9
+
10
+ body {
11
+ font-family: 'Open Sans', san-serif;
12
+ font-size: 13px;
13
+ line-height: 1.51em;
14
+ color: #747373;
15
+ background: none !important;
16
+ }
17
+
18
+ table.compare-list {
19
+ margin: 10px;
20
+ table-layout: fixed;
21
+ }
22
+
23
+ /* plugin fixedheadertable fix */
24
+ table.compare-list thead, table.compare-list tfoot {
25
+ display: none;
26
+ }
27
+
28
+ .table-wrapper {
29
+ width: 100%;
30
+ }
31
+
32
+ table.compare-list thead th, h1 {
33
+ background: #4F4F4F;
34
+ color: #fff;
35
+ font-weight: 800;
36
+ padding: 6px 10px;
37
+ border-bottom: 2px solid #fff;
38
+ display: block;
39
+ text-transform: uppercase;
40
+ font-size: 1.076em;
41
+ }
42
+
43
+ table.compare-list thead th a.close, h1 a.close {
44
+ float: right;
45
+ margin-right: 10px;
46
+ font-weight: 600;
47
+ font-size: 0.9em;
48
+ color: #fff;
49
+ text-decoration: none;
50
+ }
51
+
52
+ table.compare-list th, table.compare-list td,
53
+ table.compare-list th, table.compare-list .price.repeated td {
54
+ padding: 10px;
55
+ }
56
+
57
+ table.compare-list th, table.compare-list td {
58
+ border-bottom: 1px solid #D6D6D6;
59
+ }
60
+
61
+ table.compare-list tr.remove th, table.compare-list tr.remove td,
62
+ table.compare-list tr.image th, table.compare-list tr.image td,
63
+ table.compare-list tr.title th, table.compare-list tr.title td,
64
+ table.compare-list tr.price th, table.compare-list tr.price td {
65
+ border-bottom: 0;
66
+ padding-bottom: 0;
67
+ }
68
+
69
+ table.compare-list tr.image th, table.compare-list tr.image td {
70
+ height: 186px;
71
+ }
72
+
73
+ table.compare-list tr.image th, table.compare-list tr.image td,
74
+ table.compare-list tr.title th, table.compare-list tr.title td,
75
+ table.compare-list tr.price th, table.compare-list tr.price td {
76
+ color: #333;
77
+ text-transform: uppercase;
78
+ font-size: 1.076em;
79
+ }
80
+
81
+ table.compare-list tr.image th, table.compare-list tr.image td,
82
+ table.compare-list tr.price th, table.compare-list tr.price td,
83
+ table.compare-list tr.add-to-cart th, table.compare-list tr.add-to-cart td {
84
+ padding-top: 4px;
85
+ }
86
+
87
+ table.compare-list tr.image th,
88
+ table.compare-list tr.title th,
89
+ table.compare-list tr.price th,
90
+ table.compare-list tr.add-to-cart th {
91
+ text-indent: 150%;
92
+ overflow: hidden;
93
+ white-space: nowrap;
94
+ }
95
+
96
+ table.compare-list .remove td a {
97
+ color: #747373;
98
+ text-decoration: none;
99
+ }
100
+
101
+ table.compare-list .remove td a:hover {
102
+ color: #333333;
103
+ }
104
+
105
+ table.compare-list .remove td a .remove {
106
+ border-radius: 100% 100% 100% 100%;
107
+ color: red;
108
+ display: inline-block;
109
+ font-size: 1em;
110
+ font-weight: 600;
111
+ height: 1em;
112
+ line-height: 0.81em;
113
+ text-align: center;
114
+ text-decoration: none;
115
+ width: 1em;
116
+ }
117
+
118
+ .yith-woocompare-widget ul.products-list a.remove {
119
+ float: left;
120
+ }
121
+
122
+ table.compare-list .remove td a:hover .remove {
123
+ background-color: red;
124
+ color: #ffffff;
125
+ }
126
+
127
+ table.compare-list .add-to-cart td a {
128
+ display: inline-block;
129
+ margin: 10px 0;
130
+ background-color: #4F4F4F;
131
+ border: 0 none;
132
+ color: #FFFFFF;
133
+ font-weight: normal;
134
+ line-height: normal;
135
+ padding: 5px 20px;
136
+ text-decoration: none;
137
+ text-transform: uppercase;
138
+ cursor: pointer;
139
+ }
140
+
141
+ table.compare-list .add-to-cart td a:hover {
142
+ background: #868686;
143
+ color: #fff;
144
+ }
145
+
146
+ table.compare-list .stock td span {
147
+ color: #009900;
148
+ }
149
+
150
+ table.compare-list .stock td span.out-of-stock {
151
+ color: #990000;
152
+ }
153
+
154
+ table.compare-list .price td {
155
+ text-decoration: underline;
156
+ }
157
+
158
+ table.compare-list th .fixed-th {
159
+ width: 205px;
160
+ }
161
+
162
+ table.compare-list th {
163
+ width: 205px;
164
+ max-width: 205px;
165
+ min-width: 205px;
166
+ overflow: hidden;
167
+ text-align: left;
168
+ font-size: 1.076em;
169
+ color: #333333;
170
+ font-weight: 400;
171
+ text-transform: uppercase;
172
+ }
173
+
174
+ table.compare-list td {
175
+ width: 230px;
176
+ max-width: 230px;
177
+ min-width: 230px;
178
+ text-align: center;
179
+ }
180
+
181
+ table.compare-list td.odd {
182
+ background: #F7F7F7;
183
+ }
184
+
185
+ table.compare-list td.even {
186
+ background: #fff;
187
+ }
188
+
189
+ table.compare-list td img {
190
+ background: none repeat scroll 0 0 #FFFFFF;
191
+ border: 1px solid #DADADA;
192
+ height: auto;
193
+ max-width: 100%;
194
+ padding: 3px;
195
+ margin-bottom: 20px;
196
+ max-width: none;
197
+ }
198
+
199
+ /** Fixed Header Table Style */
200
+ /*!
201
+ * jquery.fixedHeaderTable. The jQuery fixedHeaderTable plugin
202
+ *
203
+ * Copyright (c) 2011 Mark Malek
204
+ * http://fixedheadertable.com
205
+ *
206
+ * Licensed under MIT
207
+ * http://www.opensource.org/licenses/mit-license.php
208
+ *
209
+ * http://docs.jquery.com/Plugins/Authoring
210
+ * jQuery authoring guidelines
211
+ *
212
+ * Launch : October 2009
213
+ * Version : 1.3
214
+ * Released: May 9th, 2011
215
+ *
216
+ *
217
+ * all CSS sizing (width,height) is done in pixels (px)
218
+ */
219
+
220
+ /* @group Reset */
221
+
222
+ .fht-table,
223
+ .fht-table thead,
224
+ .fht-table tfoot,
225
+ .fht-table tbody,
226
+ .fht-table tr,
227
+ .fht-table th,
228
+ .fht-table td {
229
+ /* position */
230
+ margin: 0;
231
+
232
+ /* size */
233
+ padding: 0;
234
+
235
+ /* text */
236
+ font-size: 100%;
237
+ font: inherit;
238
+ vertical-align: top;
239
+ }
240
+
241
+ .fht-table {
242
+ /* appearance */
243
+ border-collapse: collapse;
244
+ border-spacing: 0;
245
+ }
246
+
247
+ /* @end */
248
+
249
+ /* @group Content */
250
+
251
+ .fht-table-wrapper,
252
+ .fht-table-wrapper .fht-thead,
253
+ .fht-table-wrapper .fht-tfoot,
254
+ .fht-table-wrapper .fht-fixed-column .fht-tbody,
255
+ .fht-table-wrapper .fht-fixed-body .fht-tbody,
256
+ .fht-table-wrapper .fht-tbody {
257
+ /* appearance */
258
+ overflow: hidden;
259
+
260
+ /* position */
261
+ position: relative;
262
+ }
263
+
264
+ .fht-table-wrapper .fht-fixed-body .fht-tbody,
265
+ .fht-table-wrapper .fht-tbody {
266
+ /* appearance */
267
+ overflow: auto;
268
+ }
269
+
270
+ .fht-table-wrapper .fht-table .fht-cell {
271
+ /* appearance */
272
+ overflow: hidden;
273
+
274
+ /* size */
275
+ height: 1px;
276
+ }
277
+
278
+ .fht-table-wrapper .fht-fixed-column,
279
+ .fht-table-wrapper .fht-fixed-body {
280
+ /* position */
281
+ top: 0;
282
+ left: 0;
283
+ position: absolute;
284
+ }
285
+
286
+ .fht-table-wrapper .fht-fixed-column {
287
+ /* position */
288
+ z-index: 1;
289
+ }
290
+
291
  /* @end */
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,472 +1,472 @@
1
- <?php
2
- /**
3
- * Admin class
4
- *
5
- * @author Your Inspiration Themes
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( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
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="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', '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( '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' => 'yit_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
- );
162
-
163
-
164
- /* === Fixed: not updated theme === */
165
- if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
166
- require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php' );
167
- }
168
-
169
- $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
170
- $this->options = $this->_panel->get_main_array_options();
171
- }
172
-
173
- /**
174
- * Set default custom options
175
- *
176
- */
177
- public function default_options() {
178
- $this->_default_options();
179
- }
180
-
181
- /**
182
- * Premium Tab Template
183
- *
184
- * Load the premium tab template on admin page
185
- *
186
- * @return void
187
- * @since 1.0
188
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
189
- * @return void
190
- */
191
- public function premium_tab() {
192
- $premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->_premium;
193
- if ( file_exists( $premium_tab_template ) ) {
194
- include_once( $premium_tab_template );
195
- }
196
-
197
- }
198
-
199
- /**
200
- * plugin_row_meta
201
- *
202
- * add the action links to plugin admin page
203
- *
204
- * @param $plugin_meta
205
- * @param $plugin_file
206
- * @param $plugin_data
207
- * @param $status
208
- *
209
- * @return Array
210
- * @since 1.0
211
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
212
- * @use plugin_row_meta
213
- */
214
- public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
215
-
216
- if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT == $plugin_file ) {
217
- $plugin_meta[] = '<a href="' . $this->doc_url . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-compare' ) . '</a>';
218
- }
219
-
220
- return $plugin_meta;
221
- }
222
-
223
- /**
224
- * Register Pointer
225
- */
226
- public function register_pointer(){
227
-
228
- if( ! class_exists( 'YIT_Pointers' ) ){
229
- include_once( 'plugin-fw/lib/yit-pointers.php' );
230
- }
231
-
232
- $args[] = array(
233
- 'screen_id' => 'plugins',
234
- 'pointer_id' => 'yith_woocompare_panel',
235
- 'target' => '#toplevel_page_yit_plugin_panel',
236
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
237
- __( 'YITH WooCommerce Compare Activated', 'yith-woocommerce-compare' ),
238
- 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() ) )
239
- ),
240
- 'position' => array( 'edge' => 'left', 'align' => 'center' ),
241
- 'init' => YITH_WOOCOMPARE_INIT
242
- );
243
-
244
- $args[] = array(
245
- 'screen_id' => 'update',
246
- 'pointer_id' => 'yith_woocompare_panel',
247
- 'target' => '#toplevel_page_yit_plugin_panel',
248
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
249
- __( 'YITH WooCommerce Compare Updated', 'yith-woocommerce-compare' ),
250
- 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() ) )
251
- ),
252
- 'position' => array( 'edge' => 'left', 'align' => 'center' ),
253
- 'init' => YITH_WOOCOMPARE_INIT
254
- );
255
-
256
- YIT_Pointers()->register( $args );
257
- }
258
-
259
- /**
260
- * Get the premium landing uri
261
- *
262
- * @since 1.0.0
263
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
264
- * @return string The premium landing link
265
- */
266
- public function get_premium_landing_uri() {
267
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
268
- }
269
-
270
- /**
271
- * Default options
272
- *
273
- * Sets up the default options used on the settings page
274
- *
275
- * @access protected
276
- * @return void
277
- * @since 1.0.0
278
- */
279
- protected function _default_options() {
280
-
281
- foreach ( $this->options as $section ) {
282
-
283
- foreach ( $section as $value ) {
284
-
285
- if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
286
-
287
- if ( $value['type'] == 'image_width' ) {
288
- add_option( $value['id'], $value['std'] );
289
- } elseif ( $value['type'] == 'woocompare_attributes' ) {
290
-
291
- $value_id = str_replace( '_attrs', '', $value['id'] );
292
-
293
- $in_db = get_option( $value_id );
294
- $in_db_original = get_option( $value['id'] );
295
-
296
- // if options is already in db and not reset defaults continue
297
- if ( $in_db && $in_db_original != 'all' ) {
298
- continue;
299
- }
300
-
301
- if ( $value['default'] == 'all' ) {
302
- $fields = YITH_Woocompare_Helper::standard_fields();
303
- $all = array();
304
-
305
- foreach ( array_keys( $fields ) as $field ) {
306
- $all[ $field ] = true;
307
- }
308
-
309
- update_option( $value_id, $all );
310
- } else {
311
- update_option( $value_id, $value['std'] );
312
- }
313
- }
314
- }
315
- }
316
- }
317
- }
318
-
319
- /**
320
- * Create new Woocommerce admin field: checkboxes
321
- *
322
- * @access public
323
- * @param array $value
324
- * @return void
325
- * @since 1.0.0
326
- */
327
- public function admin_fields_attributes( $value ) {
328
- $fields = YITH_Woocompare_Helper::standard_fields();
329
- $all = array();
330
- $checked = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
331
-
332
- foreach ( array_keys( $fields ) as $field ) {
333
- $all[ $field ] = true;
334
- }
335
- // then add fields that are not still saved
336
- foreach ( $checked as $k => $v ) {
337
- unset( $all[ $k ] );
338
- }
339
- $checkboxes = array_merge( $checked, $all );
340
-
341
-
342
- ?>
343
- <tr valign="top">
344
- <th scope="row" class="titledesc">
345
- <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
346
- </th>
347
-
348
- <td class="forminp attributes">
349
- <p class="description"><?php echo $value['desc'] ?></p>
350
- <ul class="fields">
351
- <?php foreach ( $checkboxes as $slug => $checked ) :
352
- if( ! isset( $fields[ $slug ] ) )
353
- continue;
354
- ?>
355
- <li>
356
- <label>
357
- <input type="checkbox" name="<?php echo $value['id'] ?>[]" id="<?php echo $value['id'] ?>_<?php echo $slug ?>" value="<?php echo $slug ?>"<?php checked( $checked ) ?> /> <?php echo $fields[ $slug ] ?>
358
- </label>
359
- </li>
360
- <?php
361
- endforeach;
362
- ?>
363
- </ul>
364
- <input type="hidden" name="<?php echo $value['id'] ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ) ?>" />
365
- </td>
366
- </tr>
367
- <?php
368
- }
369
-
370
- /**
371
- * Create new Woocommerce admin field: yit_wc_image_width
372
- *
373
- * @access public
374
- * @param array $value
375
- * @return void
376
- * @since 1.0.0
377
- */
378
- public function admin_fields_woocompare_image_width( $value ) {
379
-
380
- $width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
381
- $height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
382
- $crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
383
- $crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
384
- $crop = checked( 1, $crop, false );
385
-
386
- ?>
387
- <tr valign="top">
388
- <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
389
- <td class="forminp image_width_settings">
390
-
391
- <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> &times;
392
- <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
393
-
394
- <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
395
- </label>
396
- <p class="description"><?php echo $value['desc'] ?></p>
397
-
398
- </td>
399
- </tr><?php
400
-
401
- }
402
-
403
- /**
404
- * Save the admin field: slider
405
- *
406
- * @access public
407
- * @param mixed $value
408
- * @param mixed $option
409
- * @param mixed $raw_value
410
- * @return mixed
411
- * @since 1.0.0
412
- */
413
- public function admin_update_custom_option( $value, $option, $raw_value ) {
414
-
415
- $val = array();
416
- $checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( $_POST[ $option['id'] ] ) : array();
417
- $fields = array_map( 'trim', explode( ',', $_POST[ $option['id'] . '_positions' ] ) );
418
-
419
- foreach ( $fields as $field ) {
420
- $val[ $field ] = in_array( $field, $checked_fields );
421
- }
422
-
423
- update_option( str_replace( '_attrs', '', $option['id'] ), $val );
424
-
425
- return $value;
426
- }
427
-
428
- /**
429
- * Save the admin field: slider
430
- *
431
- * @access public
432
- * @param mixed $value
433
- * @return void
434
- * @since 1.0.0
435
- */
436
- public function admin_update_custom_option_pre_24( $value ) {
437
-
438
- $val = array();
439
- $checked_fields = isset( $_POST[ $value['id'] ] ) ? $_POST[ $value['id'] ] : array();
440
- $fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
441
-
442
- foreach ( $fields as $field ) {
443
- $val[ $field ] = in_array( $field, $checked_fields );
444
- }
445
-
446
- update_option( str_replace( '_attrs', '', $value['id'] ), $val );
447
- }
448
-
449
- /**
450
- * Enqueue admin styles and scripts
451
- *
452
- * @access public
453
- * @return void
454
- * @since 1.0.0
455
- */
456
- public function enqueue_styles_scripts() {
457
-
458
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'yith_woocompare_panel' ) {
459
- wp_enqueue_script( 'jquery-ui' );
460
- wp_enqueue_script( 'jquery-ui-core' );
461
- wp_enqueue_script( 'jquery-ui-mouse' );
462
- wp_enqueue_script( 'jquery-ui-slider' );
463
- wp_enqueue_script( 'jquery-ui-sortable' );
464
-
465
- wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css' );
466
- wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin.js', array( 'jquery', 'jquery-ui-sortable' ) );
467
- }
468
-
469
- do_action( 'yith_woocompare_enqueue_styles_scripts' );
470
- }
471
- }
472
- }
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author Your Inspiration Themes
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( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
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="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', '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( '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' => 'yit_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
+ );
162
+
163
+
164
+ /* === Fixed: not updated theme === */
165
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
166
+ require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php' );
167
+ }
168
+
169
+ $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
170
+ $this->options = $this->_panel->get_main_array_options();
171
+ }
172
+
173
+ /**
174
+ * Set default custom options
175
+ *
176
+ */
177
+ public function default_options() {
178
+ $this->_default_options();
179
+ }
180
+
181
+ /**
182
+ * Premium Tab Template
183
+ *
184
+ * Load the premium tab template on admin page
185
+ *
186
+ * @return void
187
+ * @since 1.0
188
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
189
+ * @return void
190
+ */
191
+ public function premium_tab() {
192
+ $premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->_premium;
193
+ if ( file_exists( $premium_tab_template ) ) {
194
+ include_once( $premium_tab_template );
195
+ }
196
+
197
+ }
198
+
199
+ /**
200
+ * plugin_row_meta
201
+ *
202
+ * add the action links to plugin admin page
203
+ *
204
+ * @param $plugin_meta
205
+ * @param $plugin_file
206
+ * @param $plugin_data
207
+ * @param $status
208
+ *
209
+ * @return Array
210
+ * @since 1.0
211
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
212
+ * @use plugin_row_meta
213
+ */
214
+ public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
215
+
216
+ if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT == $plugin_file ) {
217
+ $plugin_meta[] = '<a href="' . $this->doc_url . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-compare' ) . '</a>';
218
+ }
219
+
220
+ return $plugin_meta;
221
+ }
222
+
223
+ /**
224
+ * Register Pointer
225
+ */
226
+ public function register_pointer(){
227
+
228
+ if( ! class_exists( 'YIT_Pointers' ) ){
229
+ include_once( 'plugin-fw/lib/yit-pointers.php' );
230
+ }
231
+
232
+ $args[] = array(
233
+ 'screen_id' => 'plugins',
234
+ 'pointer_id' => 'yith_woocompare_panel',
235
+ 'target' => '#toplevel_page_yit_plugin_panel',
236
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
237
+ __( 'YITH WooCommerce Compare Activated', 'yith-woocommerce-compare' ),
238
+ 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() ) )
239
+ ),
240
+ 'position' => array( 'edge' => 'left', 'align' => 'center' ),
241
+ 'init' => YITH_WOOCOMPARE_INIT
242
+ );
243
+
244
+ $args[] = array(
245
+ 'screen_id' => 'update',
246
+ 'pointer_id' => 'yith_woocompare_panel',
247
+ 'target' => '#toplevel_page_yit_plugin_panel',
248
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
249
+ __( 'YITH WooCommerce Compare Updated', 'yith-woocommerce-compare' ),
250
+ 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() ) )
251
+ ),
252
+ 'position' => array( 'edge' => 'left', 'align' => 'center' ),
253
+ 'init' => YITH_WOOCOMPARE_INIT
254
+ );
255
+
256
+ YIT_Pointers()->register( $args );
257
+ }
258
+
259
+ /**
260
+ * Get the premium landing uri
261
+ *
262
+ * @since 1.0.0
263
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
264
+ * @return string The premium landing link
265
+ */
266
+ public function get_premium_landing_uri() {
267
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
268
+ }
269
+
270
+ /**
271
+ * Default options
272
+ *
273
+ * Sets up the default options used on the settings page
274
+ *
275
+ * @access protected
276
+ * @return void
277
+ * @since 1.0.0
278
+ */
279
+ protected function _default_options() {
280
+
281
+ foreach ( $this->options as $section ) {
282
+
283
+ foreach ( $section as $value ) {
284
+
285
+ if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
286
+
287
+ if ( $value['type'] == 'image_width' ) {
288
+ add_option( $value['id'], $value['std'] );
289
+ } elseif ( $value['type'] == 'woocompare_attributes' ) {
290
+
291
+ $value_id = str_replace( '_attrs', '', $value['id'] );
292
+
293
+ $in_db = get_option( $value_id );
294
+ $in_db_original = get_option( $value['id'] );
295
+
296
+ // if options is already in db and not reset defaults continue
297
+ if ( $in_db && $in_db_original != 'all' ) {
298
+ continue;
299
+ }
300
+
301
+ if ( $value['default'] == 'all' ) {
302
+ $fields = YITH_Woocompare_Helper::standard_fields();
303
+ $all = array();
304
+
305
+ foreach ( array_keys( $fields ) as $field ) {
306
+ $all[ $field ] = true;
307
+ }
308
+
309
+ update_option( $value_id, $all );
310
+ } else {
311
+ update_option( $value_id, $value['std'] );
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Create new Woocommerce admin field: checkboxes
321
+ *
322
+ * @access public
323
+ * @param array $value
324
+ * @return void
325
+ * @since 1.0.0
326
+ */
327
+ public function admin_fields_attributes( $value ) {
328
+ $fields = YITH_Woocompare_Helper::standard_fields();
329
+ $all = array();
330
+ $checked = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
331
+
332
+ foreach ( array_keys( $fields ) as $field ) {
333
+ $all[ $field ] = true;
334
+ }
335
+ // then add fields that are not still saved
336
+ foreach ( $checked as $k => $v ) {
337
+ unset( $all[ $k ] );
338
+ }
339
+ $checkboxes = array_merge( $checked, $all );
340
+
341
+
342
+ ?>
343
+ <tr valign="top">
344
+ <th scope="row" class="titledesc">
345
+ <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
346
+ </th>
347
+
348
+ <td class="forminp attributes">
349
+ <p class="description"><?php echo $value['desc'] ?></p>
350
+ <ul class="fields">
351
+ <?php foreach ( $checkboxes as $slug => $checked ) :
352
+ if( ! isset( $fields[ $slug ] ) )
353
+ continue;
354
+ ?>
355
+ <li>
356
+ <label>
357
+ <input type="checkbox" name="<?php echo $value['id'] ?>[]" id="<?php echo $value['id'] ?>_<?php echo $slug ?>" value="<?php echo $slug ?>"<?php checked( $checked ) ?> /> <?php echo $fields[ $slug ] ?>
358
+ </label>
359
+ </li>
360
+ <?php
361
+ endforeach;
362
+ ?>
363
+ </ul>
364
+ <input type="hidden" name="<?php echo $value['id'] ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ) ?>" />
365
+ </td>
366
+ </tr>
367
+ <?php
368
+ }
369
+
370
+ /**
371
+ * Create new Woocommerce admin field: yit_wc_image_width
372
+ *
373
+ * @access public
374
+ * @param array $value
375
+ * @return void
376
+ * @since 1.0.0
377
+ */
378
+ public function admin_fields_woocompare_image_width( $value ) {
379
+
380
+ $width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
381
+ $height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
382
+ $crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
383
+ $crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
384
+ $crop = checked( 1, $crop, false );
385
+
386
+ ?>
387
+ <tr valign="top">
388
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
389
+ <td class="forminp image_width_settings">
390
+
391
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> &times;
392
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
393
+
394
+ <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
395
+ </label>
396
+ <p class="description"><?php echo $value['desc'] ?></p>
397
+
398
+ </td>
399
+ </tr><?php
400
+
401
+ }
402
+
403
+ /**
404
+ * Save the admin field: slider
405
+ *
406
+ * @access public
407
+ * @param mixed $value
408
+ * @param mixed $option
409
+ * @param mixed $raw_value
410
+ * @return mixed
411
+ * @since 1.0.0
412
+ */
413
+ public function admin_update_custom_option( $value, $option, $raw_value ) {
414
+
415
+ $val = array();
416
+ $checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( $_POST[ $option['id'] ] ) : array();
417
+ $fields = array_map( 'trim', explode( ',', $_POST[ $option['id'] . '_positions' ] ) );
418
+
419
+ foreach ( $fields as $field ) {
420
+ $val[ $field ] = in_array( $field, $checked_fields );
421
+ }
422
+
423
+ update_option( str_replace( '_attrs', '', $option['id'] ), $val );
424
+
425
+ return $value;
426
+ }
427
+
428
+ /**
429
+ * Save the admin field: slider
430
+ *
431
+ * @access public
432
+ * @param mixed $value
433
+ * @return void
434
+ * @since 1.0.0
435
+ */
436
+ public function admin_update_custom_option_pre_24( $value ) {
437
+
438
+ $val = array();
439
+ $checked_fields = isset( $_POST[ $value['id'] ] ) ? $_POST[ $value['id'] ] : array();
440
+ $fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
441
+
442
+ foreach ( $fields as $field ) {
443
+ $val[ $field ] = in_array( $field, $checked_fields );
444
+ }
445
+
446
+ update_option( str_replace( '_attrs', '', $value['id'] ), $val );
447
+ }
448
+
449
+ /**
450
+ * Enqueue admin styles and scripts
451
+ *
452
+ * @access public
453
+ * @return void
454
+ * @since 1.0.0
455
+ */
456
+ public function enqueue_styles_scripts() {
457
+
458
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'yith_woocompare_panel' ) {
459
+ wp_enqueue_script( 'jquery-ui' );
460
+ wp_enqueue_script( 'jquery-ui-core' );
461
+ wp_enqueue_script( 'jquery-ui-mouse' );
462
+ wp_enqueue_script( 'jquery-ui-slider' );
463
+ wp_enqueue_script( 'jquery-ui-sortable' );
464
+
465
+ wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css' );
466
+ wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin.js', array( 'jquery', 'jquery-ui-sortable' ) );
467
+ }
468
+
469
+ do_action( 'yith_woocompare_enqueue_styles_scripts' );
470
+ }
471
+ }
472
+ }
includes/class.yith-woocompare-frontend.php CHANGED
@@ -1,803 +1,803 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
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
- // set coookiename
108
- if ( is_multisite() ) $this->cookie_name .= '_' . get_current_blog_id();
109
-
110
- add_action( 'init', array( $this, 'populate_products_list' ), 10 );
111
-
112
- // populate default fields for the comparison table
113
- $this->default_fields = YITH_Woocompare_Helper::standard_fields();
114
-
115
- // Add link or button in the products list or
116
- if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
117
- if ( get_option('yith_woocompare_compare_button_in_products_list') == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
118
- add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
119
- add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
120
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
121
- add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
122
-
123
- // add the shortcode
124
- add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
125
-
126
- // AJAX
127
- if( version_compare( WC()->version, '2.4', '>=' ) ){
128
- add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
129
- add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
130
- add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
131
- }
132
- else {
133
- add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
134
- add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
135
- add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
136
- }
137
- // no priv
138
- add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
139
- add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
140
- add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
141
-
142
- return $this;
143
- }
144
-
145
- /**
146
- * Populate the compare product list
147
- */
148
- public function populate_products_list(){
149
-
150
- global $sitepress;
151
-
152
- /**
153
- * WPML Support
154
- */
155
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
156
-
157
- // get cookie val
158
- $the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
159
-
160
- // switch lang for WPML
161
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
162
- $sitepress->switch_lang( $lang, true );
163
- }
164
-
165
- foreach( $the_list as $product_id ) {
166
- if( function_exists( 'wpml_object_id_filter' ) ) {
167
- $product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
168
- // get all product of current lang
169
- if ( $product_id_translated !== $product_id ) {
170
- continue;
171
- }
172
- }
173
-
174
- // check for deleted|private products
175
- $product = wc_get_product( $product_id );
176
- $post_status = yit_get_prop( $product, 'post_status' );
177
-
178
- if( ! $product || $post_status !== 'publish' ) {
179
- continue;
180
- }
181
-
182
- $this->products_list[] = $product_id;
183
- }
184
-
185
- do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
186
- }
187
-
188
- /**
189
- * Enqueue the scripts and styles in the page
190
- */
191
- public function enqueue_scripts() {
192
-
193
- // scripts
194
- $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
195
- wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min .'.js', array('jquery'), $this->version, true );
196
-
197
- // enqueue and add localize
198
- wp_enqueue_script( 'yith-woocompare-main' );
199
-
200
- // localize script args
201
- $args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
202
- 'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
203
- 'actionadd' => $this->action_add,
204
- 'actionremove' => $this->action_remove,
205
- 'actionview' => $this->action_view,
206
- 'actionreload' => $this->action_reload,
207
- 'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
208
- 'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
209
- 'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
210
- 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
211
- 'button_text' => get_option('yith_woocompare_button_text'),
212
- 'cookie_name' => $this->cookie_name,
213
- 'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' )
214
- ));
215
-
216
- wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
217
-
218
- // colorbox
219
- wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
220
- wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
221
-
222
- // widget
223
- if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
224
- wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css' );
225
- }
226
- }
227
-
228
- /**
229
- * The fields to show in the table
230
- *
231
- * @param array $products
232
- * @return mixed|void
233
- * @since 1.0.0
234
- */
235
- public function fields( $products = array() ) {
236
-
237
- $fields = get_option( 'yith_woocompare_fields', array() );
238
-
239
- foreach ( $fields as $field => $show ) {
240
- if ( $show ) {
241
- if ( isset( $this->default_fields[$field] ) ) {
242
- $fields[$field] = $this->default_fields[$field];
243
- }
244
- else {
245
- if ( taxonomy_exists( $field ) ) {
246
- $fields[$field] = wc_attribute_label( $field );
247
- }
248
- }
249
- }
250
- else {
251
- unset( $fields[$field] );
252
- }
253
- }
254
-
255
- return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
256
- }
257
-
258
- /**
259
- * Render the maintenance page
260
- *
261
- */
262
- public function compare_table_html() {
263
-
264
- if ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_view ) ) return;
265
-
266
- // check if is add to cart
267
- if( isset( $_REQUEST['add-to-cart'] ) ) {
268
- $product_id = intval( $_REQUEST['add-to-cart'] );
269
-
270
- wp_redirect( get_permalink( $product_id ) );
271
- exit;
272
- }
273
-
274
- global $woocommerce, $sitepress;
275
-
276
- /**
277
- * WPML Suppot: Localize Ajax Call
278
- */
279
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
280
-
281
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
282
- $sitepress->switch_lang( $lang, true );
283
- }
284
-
285
- $args = $this->_vars();
286
- $args['fixed'] = false;
287
- $args['iframe'] = 'yes';
288
-
289
- //extract args
290
- extract( $args );
291
-
292
- // remove all styles from compare template
293
- add_action('wp_print_styles', array( $this, 'remove_all_styles' ), 100);
294
-
295
- // remove admin bar
296
- remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
297
- remove_action( 'wp_head', '_admin_bar_bump_cb' );
298
-
299
- // remove filters before render compare popup
300
- add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
301
-
302
- $plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
303
-
304
- if ( defined('WC_TEMPLATE_PATH') ) {
305
-
306
- $template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
307
- $child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
308
- }
309
- else {
310
- $template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
311
- $child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
312
- }
313
-
314
- foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
315
- if ( file_exists( ${$var} ) ) {
316
- include ${$var};
317
- exit();
318
- }
319
- }
320
- }
321
-
322
- /**
323
- * Return the array with all products and all attributes values
324
- *
325
- * @param mixed $products
326
- * @return array The complete list of products with all attributes value
327
- */
328
- public function get_products_list( $products = array() ) {
329
- $list = array();
330
-
331
- empty( $products ) && $products = $this->products_list;
332
- $products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
333
-
334
- $fields = $this->fields( $products );
335
-
336
- foreach ( $products as $product_id ) {
337
-
338
- /**
339
- * @type object $product /WC_Product
340
- */
341
- $product = $this->wc_get_product( $product_id );
342
-
343
- if ( ! $product )
344
- continue;
345
-
346
- $product->fields = array();
347
-
348
- // custom attributes
349
- foreach ( $fields as $field => $name ) {
350
-
351
- switch( $field ) {
352
- case 'title':
353
- $product->fields[$field] = $product->get_title();
354
- break;
355
- case 'price':
356
- $product->fields[$field] = $product->get_price_html();
357
- break;
358
- case 'image':
359
- $product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
360
- break;
361
- case 'description':
362
- $description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
363
- $product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
364
- break;
365
- case 'stock':
366
- $availability = $product->get_availability();
367
- if ( empty( $availability['availability'] ) ) {
368
- $availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
369
- }
370
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
371
- break;
372
- case 'sku':
373
- $sku = $product->get_sku();
374
- ! $sku && $sku = '-';
375
- $product->fields[$field] = $sku;
376
- break;
377
- case 'weight':
378
- if( $weight = $product->get_weight() ){
379
- $weight = wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) );
380
- }
381
- else {
382
- $weight = '-';
383
- }
384
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
385
- break;
386
- case 'dimensions':
387
- $dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
388
- ! $dimensions && $dimensions = '-';
389
-
390
- $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
391
- break;
392
- default:
393
- if ( taxonomy_exists( $field ) ) {
394
- $product->fields[$field] = array();
395
- $terms = get_the_terms( $product_id, $field );
396
- if ( ! empty( $terms ) ) {
397
- foreach ( $terms as $term ) {
398
- $term = sanitize_term( $term, $field );
399
- $product->fields[$field][] = $term->name;
400
- }
401
- }
402
- $product->fields[$field] = implode( ', ', $product->fields[$field] );
403
- }
404
- else {
405
- do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
406
- }
407
- break;
408
- }
409
- }
410
-
411
- $list[ $product_id ] = $product;
412
- }
413
-
414
- return $list;
415
- }
416
-
417
- /**
418
- * The URL of product comparison table
419
- *
420
- * @param bool | int $product_id
421
- * @return string The url to add the product in the comparison table
422
- */
423
- public function view_table_url( $product_id = false ) {
424
- $url_args = array(
425
- 'action' => $this->action_view,
426
- 'iframe' => 'yes'
427
- );
428
-
429
- $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
430
- if( $lang ) {
431
- $url_args['lang'] = $lang;
432
- }
433
-
434
- return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $product_id );
435
- }
436
-
437
- /**
438
- * The URL to add the product into the comparison table
439
- *
440
- * @param int $product_id ID of the product to add
441
- * @return string The url to add the product in the comparison table
442
- */
443
- public function add_product_url( $product_id ) {
444
- $url_args = array(
445
- 'action' => $this->action_add,
446
- 'id' => $product_id
447
- );
448
-
449
- $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
450
- if( $lang ) {
451
- $url_args['lang'] = $lang;
452
- }
453
-
454
- return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
455
- }
456
-
457
- /**
458
- * The URL to remove the product into the comparison table
459
- *
460
- * @param string $product_id The ID of the product to remove
461
- * @return string The url to remove the product in the comparison table
462
- */
463
- public function remove_product_url( $product_id ) {
464
- $url_args = array(
465
- 'action' => $this->action_remove,
466
- 'id' => $product_id
467
- );
468
- return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
469
- }
470
-
471
- /**
472
- * Add the link to compare
473
- */
474
- public function add_compare_link( $product_id = false, $args = array() ) {
475
- extract( $args );
476
-
477
- if ( ! $product_id ) {
478
- global $product;
479
- $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
480
- }
481
-
482
- // return if product doesn't exist
483
- if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) )
484
- return;
485
-
486
- $is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
487
-
488
- if ( ! isset( $button_text ) || $button_text == 'default' ) {
489
- $button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
490
- do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
491
- $button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
492
- }
493
-
494
- 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 );
495
- }
496
-
497
- /**
498
- * Return the url of stylesheet position
499
- */
500
- public function stylesheet_url() {
501
- global $woocommerce;
502
-
503
- $filename = $this->stylesheet_file;
504
-
505
- $plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
506
-
507
- if ( defined('WC_TEMPLATE_PATH') ) {
508
- $template_path = array( 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
509
- $child_path = array( 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
510
- }
511
- else {
512
- $template_path = array( 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename );
513
- $child_path = array( 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename );
514
- }
515
-
516
- foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
517
- if ( file_exists( ${$var}['path'] ) ) {
518
- return ${$var}['url'];
519
- }
520
- }
521
- }
522
-
523
-
524
- /**
525
- * Generate template vars
526
- *
527
- * @return array
528
- * @since 1.0.0
529
- * @access protected
530
- */
531
- protected function _vars() {
532
- $vars = array(
533
- 'products' => $this->get_products_list(),
534
- 'fields' => $this->fields(),
535
- 'repeat_price' => get_option( 'yith_woocompare_price_end' ),
536
- 'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end' ),
537
- );
538
-
539
- return $vars;
540
- }
541
-
542
- /**
543
- * The action called by the query string
544
- */
545
- public function add_product_to_compare_action() {
546
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ) {
547
- return;
548
- }
549
-
550
- $product_id = intval( $_REQUEST['id'] );
551
- $product = $this->wc_get_product( $product_id );
552
-
553
- // don't add the product if doesn't exist
554
- if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
555
- $this->add_product_to_compare( $product_id );
556
- }
557
-
558
- wp_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
559
- exit();
560
- }
561
-
562
- /**
563
- * The action called by AJAX
564
- */
565
- public function add_product_to_compare_ajax() {
566
-
567
- if( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ){
568
- die();
569
- }
570
-
571
- $product_id = intval( $_REQUEST['id'] );
572
- $product = $this->wc_get_product( $product_id );
573
-
574
- // don't add the product if doesn't exist
575
- if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
576
- $this->add_product_to_compare( $product_id );
577
- }
578
-
579
- do_action( 'yith_woocompare_add_product_action_ajax' );
580
-
581
- $json = apply_filters( 'yith_woocompare_add_product_action_json', array(
582
- 'table_url' => $this->view_table_url( $product_id ),
583
- 'widget_table' => $this->list_products_html(),
584
- ) );
585
-
586
- echo json_encode( $json );
587
- die();
588
- }
589
-
590
- /**
591
- * Add a product in the products comparison table
592
- *
593
- * @param int $product_id product ID to add in the comparison table
594
- */
595
- public function add_product_to_compare( $product_id ) {
596
-
597
- $this->products_list[] = $product_id;
598
- setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
599
-
600
- do_action( 'yith_woocompare_after_add_product', $product_id );
601
- }
602
-
603
- /**
604
- * The action called by the query string
605
- */
606
- public function remove_product_from_compare_action() {
607
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ) {
608
- return;
609
- }
610
-
611
- $this->remove_product_from_compare( $_REQUEST['id'] );
612
-
613
- // redirect
614
- $redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
615
-
616
- if ( isset( $_REQUEST['redirect'] ) && $_REQUEST['redirect'] == 'view' )
617
- $redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
618
-
619
- wp_redirect( $redirect );
620
- exit();
621
- }
622
-
623
- /**
624
- * The action called by AJAX
625
- */
626
- public function remove_product_from_compare_ajax() {
627
-
628
- if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ){
629
- die();
630
- }
631
-
632
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
633
-
634
- $this->remove_product_from_compare( $_REQUEST['id'] );
635
-
636
- do_action( 'yith_woocompare_remove_product_action_ajax' );
637
-
638
- header('Content-Type: text/html; charset=utf-8');
639
-
640
- if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
641
- echo $this->list_products_html( $lang );
642
- } else {
643
- $this->compare_table_html();
644
- }
645
-
646
- die();
647
- }
648
-
649
- /**
650
- * Return the list of widget table, used in AJAX
651
- */
652
- public function reload_widget_list_ajax() {
653
-
654
- if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
655
- die();
656
- }
657
-
658
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
659
-
660
- echo $this->list_products_html( $lang );
661
- die();
662
- }
663
-
664
- /**
665
- * The list of products as HTML list
666
- */
667
- public function list_products_html( $lang = false ) {
668
- ob_start();
669
-
670
- /**
671
- * WPML Suppot: Localize Ajax Call
672
- */
673
- global $sitepress;
674
-
675
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
676
- $sitepress->switch_lang( $lang, true );
677
- }
678
-
679
- if ( empty( $this->products_list ) ) {
680
- echo '<li class="list_empty">' . __( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
681
- return ob_get_clean();
682
- }
683
-
684
- foreach ( $this->products_list as $product_id ) {
685
- /**
686
- * @type object $product /WC_Product
687
- */
688
- $product = $this->wc_get_product( $product_id );
689
- if ( ! $product )
690
- continue;
691
- ?>
692
- <li>
693
- <a href="<?php echo $this->remove_product_url( $product_id ) ?>" data-product_id="<?php echo $product_id; ?>" class="remove" title="<?php _e( 'Remove', 'yith-woocommerce-compare' ) ?>">x</a>
694
- <a class="title" href="<?php echo get_permalink( $product_id ) ?>"><?php echo $product->get_title() ?></a>
695
- </li>
696
- <?php
697
- }
698
-
699
- $return = ob_get_clean();
700
-
701
- return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
702
- }
703
-
704
- /**
705
- * Remove a product from the comparison table
706
- *
707
- * @param $product_id The product ID to remove from the comparison table
708
- */
709
- public function remove_product_from_compare( $product_id ) {
710
-
711
- if( $product_id == 'all' ) {
712
- $this->products_list = array();
713
- }
714
- else {
715
- foreach ( $this->products_list as $k => $id ) {
716
- if ( intval( $product_id ) == $id ) {
717
- unset( $this->products_list[ $k ] );
718
- }
719
- }
720
- }
721
-
722
- setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
723
-
724
- do_action( 'yith_woocompare_after_remove_product', $product_id );
725
- }
726
-
727
- /**
728
- * Remove all styles from the compare template
729
- */
730
- public function remove_all_styles() {
731
- global $wp_styles;
732
- $wp_styles->queue = array();
733
- }
734
-
735
- /**
736
- * Show the html for the shortcode
737
- */
738
- public function compare_button_sc( $atts, $content = null ) {
739
- $atts = shortcode_atts(array(
740
- 'product' => false,
741
- 'type' => 'default',
742
- 'container' => 'yes'
743
- ), $atts);
744
-
745
- $product_id = 0;
746
-
747
- /**
748
- * Retrieve the product ID in these steps:
749
- * - If "product" attribute is not set, get the product ID of current product loop
750
- * - If "product" contains ID, post slug or post title
751
- */
752
- if ( ! $atts['product'] ) {
753
- global $product;
754
- $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
755
- } else {
756
- global $wpdb;
757
- $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'] ) );
758
- if ( ! empty( $product ) ) {
759
- $product_id = $product->ID;
760
- }
761
- }
762
-
763
- // make sure to get always the product id of current language
764
- if( function_exists( 'wpml_object_id_filter' ) ) {
765
- $product_id = wpml_object_id_filter( $product_id, 'product', false );
766
- }
767
-
768
- // if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
769
- if ( empty( $product_id ) )
770
- return '';
771
-
772
- ob_start();
773
- if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
774
- $this->add_compare_link( $product_id, array(
775
- 'button_or_link' => ( $atts['type'] == 'default' ? false : $atts['type'] ),
776
- 'button_text' => empty( $content ) ? 'default' : $content
777
- ) );
778
- if ( $atts['container'] == 'yes' ) echo '</div>';
779
- return ob_get_clean();
780
- }
781
-
782
- public function wc_get_product( $product_id ){
783
- $wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
784
- return $wc_get_product( $product_id );
785
- }
786
-
787
-
788
- /**
789
- * Do action before loads compare popup
790
- *
791
- * @since 2.1.1
792
- * @author Francesco Licandro
793
- */
794
- public function actions_before_load_popup(){
795
- // removes WooCommerce Product Filter scripts
796
- wp_dequeue_script( 'prdctfltr-main-js' );
797
- wp_dequeue_script( 'prdctfltr-history' );
798
- wp_dequeue_script( 'prdctfltr-ionrange-js' );
799
- wp_dequeue_script( 'prdctfltr-isotope-js' );
800
- wp_dequeue_script( 'prdctfltr-scrollbar-js' );
801
- }
802
- }
803
  }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
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
+ // set coookiename
108
+ if ( is_multisite() ) $this->cookie_name .= '_' . get_current_blog_id();
109
+
110
+ add_action( 'init', array( $this, 'populate_products_list' ), 10 );
111
+
112
+ // populate default fields for the comparison table
113
+ $this->default_fields = YITH_Woocompare_Helper::standard_fields();
114
+
115
+ // Add link or button in the products list or
116
+ if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
117
+ if ( get_option('yith_woocompare_compare_button_in_products_list') == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
118
+ add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
119
+ add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
120
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
121
+ add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
122
+
123
+ // add the shortcode
124
+ add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
125
+
126
+ // AJAX
127
+ if( version_compare( WC()->version, '2.4', '>=' ) ){
128
+ add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
129
+ add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
130
+ add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
131
+ }
132
+ else {
133
+ add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
134
+ add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
135
+ add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
136
+ }
137
+ // no priv
138
+ add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
139
+ add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
140
+ add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
141
+
142
+ return $this;
143
+ }
144
+
145
+ /**
146
+ * Populate the compare product list
147
+ */
148
+ public function populate_products_list(){
149
+
150
+ global $sitepress;
151
+
152
+ /**
153
+ * WPML Support
154
+ */
155
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
156
+
157
+ // get cookie val
158
+ $the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
159
+
160
+ // switch lang for WPML
161
+ if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
162
+ $sitepress->switch_lang( $lang, true );
163
+ }
164
+
165
+ foreach( $the_list as $product_id ) {
166
+ if( function_exists( 'wpml_object_id_filter' ) ) {
167
+ $product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
168
+ // get all product of current lang
169
+ if ( $product_id_translated !== $product_id ) {
170
+ continue;
171
+ }
172
+ }
173
+
174
+ // check for deleted|private products
175
+ $product = wc_get_product( $product_id );
176
+ $post_status = yit_get_prop( $product, 'post_status' );
177
+
178
+ if( ! $product || $post_status !== 'publish' ) {
179
+ continue;
180
+ }
181
+
182
+ $this->products_list[] = $product_id;
183
+ }
184
+
185
+ do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
186
+ }
187
+
188
+ /**
189
+ * Enqueue the scripts and styles in the page
190
+ */
191
+ public function enqueue_scripts() {
192
+
193
+ // scripts
194
+ $min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
195
+ wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min .'.js', array('jquery'), $this->version, true );
196
+
197
+ // enqueue and add localize
198
+ wp_enqueue_script( 'yith-woocompare-main' );
199
+
200
+ // localize script args
201
+ $args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
202
+ 'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
203
+ 'actionadd' => $this->action_add,
204
+ 'actionremove' => $this->action_remove,
205
+ 'actionview' => $this->action_view,
206
+ 'actionreload' => $this->action_reload,
207
+ 'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
208
+ 'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
209
+ 'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
210
+ 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
211
+ 'button_text' => get_option('yith_woocompare_button_text'),
212
+ 'cookie_name' => $this->cookie_name,
213
+ 'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' )
214
+ ));
215
+
216
+ wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
217
+
218
+ // colorbox
219
+ wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
220
+ wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
221
+
222
+ // widget
223
+ if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
224
+ wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css' );
225
+ }
226
+ }
227
+
228
+ /**
229
+ * The fields to show in the table
230
+ *
231
+ * @param array $products
232
+ * @return mixed|void
233
+ * @since 1.0.0
234
+ */
235
+ public function fields( $products = array() ) {
236
+
237
+ $fields = get_option( 'yith_woocompare_fields', array() );
238
+
239
+ foreach ( $fields as $field => $show ) {
240
+ if ( $show ) {
241
+ if ( isset( $this->default_fields[$field] ) ) {
242
+ $fields[$field] = $this->default_fields[$field];
243
+ }
244
+ else {
245
+ if ( taxonomy_exists( $field ) ) {
246
+ $fields[$field] = wc_attribute_label( $field );
247
+ }
248
+ }
249
+ }
250
+ else {
251
+ unset( $fields[$field] );
252
+ }
253
+ }
254
+
255
+ return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
256
+ }
257
+
258
+ /**
259
+ * Render the maintenance page
260
+ *
261
+ */
262
+ public function compare_table_html() {
263
+
264
+ if ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_view ) ) return;
265
+
266
+ // check if is add to cart
267
+ if( isset( $_REQUEST['add-to-cart'] ) ) {
268
+ $product_id = intval( $_REQUEST['add-to-cart'] );
269
+
270
+ wp_redirect( get_permalink( $product_id ) );
271
+ exit;
272
+ }
273
+
274
+ global $woocommerce, $sitepress;
275
+
276
+ /**
277
+ * WPML Suppot: Localize Ajax Call
278
+ */
279
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
280
+
281
+ if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
282
+ $sitepress->switch_lang( $lang, true );
283
+ }
284
+
285
+ $args = $this->_vars();
286
+ $args['fixed'] = false;
287
+ $args['iframe'] = 'yes';
288
+
289
+ //extract args
290
+ extract( $args );
291
+
292
+ // remove all styles from compare template
293
+ add_action('wp_print_styles', array( $this, 'remove_all_styles' ), 100);
294
+
295
+ // remove admin bar
296
+ remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
297
+ remove_action( 'wp_head', '_admin_bar_bump_cb' );
298
+
299
+ // remove filters before render compare popup
300
+ add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
301
+
302
+ $plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
303
+
304
+ if ( defined('WC_TEMPLATE_PATH') ) {
305
+
306
+ $template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
307
+ $child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
308
+ }
309
+ else {
310
+ $template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
311
+ $child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
312
+ }
313
+
314
+ foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
315
+ if ( file_exists( ${$var} ) ) {
316
+ include ${$var};
317
+ exit();
318
+ }
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Return the array with all products and all attributes values
324
+ *
325
+ * @param mixed $products
326
+ * @return array The complete list of products with all attributes value
327
+ */
328
+ public function get_products_list( $products = array() ) {
329
+ $list = array();
330
+
331
+ empty( $products ) && $products = $this->products_list;
332
+ $products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
333
+
334
+ $fields = $this->fields( $products );
335
+
336
+ foreach ( $products as $product_id ) {
337
+
338
+ /**
339
+ * @type object $product /WC_Product
340
+ */
341
+ $product = $this->wc_get_product( $product_id );
342
+
343
+ if ( ! $product )
344
+ continue;
345
+
346
+ $product->fields = array();
347
+
348
+ // custom attributes
349
+ foreach ( $fields as $field => $name ) {
350
+
351
+ switch( $field ) {
352
+ case 'title':
353
+ $product->fields[$field] = $product->get_title();
354
+ break;
355
+ case 'price':
356
+ $product->fields[$field] = $product->get_price_html();
357
+ break;
358
+ case 'image':
359
+ $product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
360
+ break;
361
+ case 'description':
362
+ $description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
363
+ $product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
364
+ break;
365
+ case 'stock':
366
+ $availability = $product->get_availability();
367
+ if ( empty( $availability['availability'] ) ) {
368
+ $availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
369
+ }
370
+ $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
371
+ break;
372
+ case 'sku':
373
+ $sku = $product->get_sku();
374
+ ! $sku && $sku = '-';
375
+ $product->fields[$field] = $sku;
376
+ break;
377
+ case 'weight':
378
+ if( $weight = $product->get_weight() ){
379
+ $weight = wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) );
380
+ }
381
+ else {
382
+ $weight = '-';
383
+ }
384
+ $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
385
+ break;
386
+ case 'dimensions':
387
+ $dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
388
+ ! $dimensions && $dimensions = '-';
389
+
390
+ $product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
391
+ break;
392
+ default:
393
+ if ( taxonomy_exists( $field ) ) {
394
+ $product->fields[$field] = array();
395
+ $terms = get_the_terms( $product_id, $field );
396
+ if ( ! empty( $terms ) ) {
397
+ foreach ( $terms as $term ) {
398
+ $term = sanitize_term( $term, $field );
399
+ $product->fields[$field][] = $term->name;
400
+ }
401
+ }
402
+ $product->fields[$field] = implode( ', ', $product->fields[$field] );
403
+ }
404
+ else {
405
+ do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
406
+ }
407
+ break;
408
+ }
409
+ }
410
+
411
+ $list[ $product_id ] = $product;
412
+ }
413
+
414
+ return $list;
415
+ }
416
+
417
+ /**
418
+ * The URL of product comparison table
419
+ *
420
+ * @param bool | int $product_id
421
+ * @return string The url to add the product in the comparison table
422
+ */
423
+ public function view_table_url( $product_id = false ) {
424
+ $url_args = array(
425
+ 'action' => $this->action_view,
426
+ 'iframe' => 'yes'
427
+ );
428
+
429
+ $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
430
+ if( $lang ) {
431
+ $url_args['lang'] = $lang;
432
+ }
433
+ // fix by WPML
434
+ return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, remove_query_arg( 'wc-ajax' ) ) ), $product_id );
435
+ }
436
+
437
+ /**
438
+ * The URL to add the product into the comparison table
439
+ *
440
+ * @param int $product_id ID of the product to add
441
+ * @return string The url to add the product in the comparison table
442
+ */
443
+ public function add_product_url( $product_id ) {
444
+ $url_args = array(
445
+ 'action' => $this->action_add,
446
+ 'id' => $product_id
447
+ );
448
+
449
+ $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
450
+ if( $lang ) {
451
+ $url_args['lang'] = $lang;
452
+ }
453
+
454
+ return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
455
+ }
456
+
457
+ /**
458
+ * The URL to remove the product into the comparison table
459
+ *
460
+ * @param string $product_id The ID of the product to remove
461
+ * @return string The url to remove the product in the comparison table
462
+ */
463
+ public function remove_product_url( $product_id ) {
464
+ $url_args = array(
465
+ 'action' => $this->action_remove,
466
+ 'id' => $product_id
467
+ );
468
+ return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
469
+ }
470
+
471
+ /**
472
+ * Add the link to compare
473
+ */
474
+ public function add_compare_link( $product_id = false, $args = array() ) {
475
+ extract( $args );
476
+
477
+ if ( ! $product_id ) {
478
+ global $product;
479
+ $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
480
+ }
481
+
482
+ // return if product doesn't exist
483
+ if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) )
484
+ return;
485
+
486
+ $is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
487
+
488
+ if ( ! isset( $button_text ) || $button_text == 'default' ) {
489
+ $button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
490
+ do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
491
+ $button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
492
+ }
493
+
494
+ 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 );
495
+ }
496
+
497
+ /**
498
+ * Return the url of stylesheet position
499
+ */
500
+ public function stylesheet_url() {
501
+ global $woocommerce;
502
+
503
+ $filename = $this->stylesheet_file;
504
+
505
+ $plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
506
+
507
+ if ( defined('WC_TEMPLATE_PATH') ) {
508
+ $template_path = array( 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
509
+ $child_path = array( 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
510
+ }
511
+ else {
512
+ $template_path = array( 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename );
513
+ $child_path = array( 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename );
514
+ }
515
+
516
+ foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
517
+ if ( file_exists( ${$var}['path'] ) ) {
518
+ return ${$var}['url'];
519
+ }
520
+ }
521
+ }
522
+
523
+
524
+ /**
525
+ * Generate template vars
526
+ *
527
+ * @return array
528
+ * @since 1.0.0
529
+ * @access protected
530
+ */
531
+ protected function _vars() {
532
+ $vars = array(
533
+ 'products' => $this->get_products_list(),
534
+ 'fields' => $this->fields(),
535
+ 'repeat_price' => get_option( 'yith_woocompare_price_end' ),
536
+ 'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end' ),
537
+ );
538
+
539
+ return $vars;
540
+ }
541
+
542
+ /**
543
+ * The action called by the query string
544
+ */
545
+ public function add_product_to_compare_action() {
546
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ) {
547
+ return;
548
+ }
549
+
550
+ $product_id = intval( $_REQUEST['id'] );
551
+ $product = $this->wc_get_product( $product_id );
552
+
553
+ // don't add the product if doesn't exist
554
+ if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
555
+ $this->add_product_to_compare( $product_id );
556
+ }
557
+
558
+ wp_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
559
+ exit();
560
+ }
561
+
562
+ /**
563
+ * The action called by AJAX
564
+ */
565
+ public function add_product_to_compare_ajax() {
566
+
567
+ if( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ){
568
+ die();
569
+ }
570
+
571
+ $product_id = intval( $_REQUEST['id'] );
572
+ $product = $this->wc_get_product( $product_id );
573
+
574
+ // don't add the product if doesn't exist
575
+ if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
576
+ $this->add_product_to_compare( $product_id );
577
+ }
578
+
579
+ do_action( 'yith_woocompare_add_product_action_ajax' );
580
+
581
+ $json = apply_filters( 'yith_woocompare_add_product_action_json', array(
582
+ 'table_url' => $this->view_table_url( $product_id ),
583
+ 'widget_table' => $this->list_products_html(),
584
+ ) );
585
+
586
+ echo json_encode( $json );
587
+ die();
588
+ }
589
+
590
+ /**
591
+ * Add a product in the products comparison table
592
+ *
593
+ * @param int $product_id product ID to add in the comparison table
594
+ */
595
+ public function add_product_to_compare( $product_id ) {
596
+
597
+ $this->products_list[] = $product_id;
598
+ setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
599
+
600
+ do_action( 'yith_woocompare_after_add_product', $product_id );
601
+ }
602
+
603
+ /**
604
+ * The action called by the query string
605
+ */
606
+ public function remove_product_from_compare_action() {
607
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ) {
608
+ return;
609
+ }
610
+
611
+ $this->remove_product_from_compare( $_REQUEST['id'] );
612
+
613
+ // redirect
614
+ $redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
615
+
616
+ if ( isset( $_REQUEST['redirect'] ) && $_REQUEST['redirect'] == 'view' )
617
+ $redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
618
+
619
+ wp_redirect( $redirect );
620
+ exit();
621
+ }
622
+
623
+ /**
624
+ * The action called by AJAX
625
+ */
626
+ public function remove_product_from_compare_ajax() {
627
+
628
+ if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ){
629
+ die();
630
+ }
631
+
632
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
633
+
634
+ $this->remove_product_from_compare( $_REQUEST['id'] );
635
+
636
+ do_action( 'yith_woocompare_remove_product_action_ajax' );
637
+
638
+ header('Content-Type: text/html; charset=utf-8');
639
+
640
+ if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
641
+ echo $this->list_products_html( $lang );
642
+ } else {
643
+ $this->compare_table_html();
644
+ }
645
+
646
+ die();
647
+ }
648
+
649
+ /**
650
+ * Return the list of widget table, used in AJAX
651
+ */
652
+ public function reload_widget_list_ajax() {
653
+
654
+ if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
655
+ die();
656
+ }
657
+
658
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
659
+
660
+ echo $this->list_products_html( $lang );
661
+ die();
662
+ }
663
+
664
+ /**
665
+ * The list of products as HTML list
666
+ */
667
+ public function list_products_html( $lang = false ) {
668
+ ob_start();
669
+
670
+ /**
671
+ * WPML Suppot: Localize Ajax Call
672
+ */
673
+ global $sitepress;
674
+
675
+ if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
676
+ $sitepress->switch_lang( $lang, true );
677
+ }
678
+
679
+ if ( empty( $this->products_list ) ) {
680
+ echo '<li class="list_empty">' . __( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
681
+ return ob_get_clean();
682
+ }
683
+
684
+ foreach ( $this->products_list as $product_id ) {
685
+ /**
686
+ * @type object $product /WC_Product
687
+ */
688
+ $product = $this->wc_get_product( $product_id );
689
+ if ( ! $product )
690
+ continue;
691
+ ?>
692
+ <li>
693
+ <a href="<?php echo $this->remove_product_url( $product_id ) ?>" data-product_id="<?php echo $product_id; ?>" class="remove" title="<?php _e( 'Remove', 'yith-woocommerce-compare' ) ?>">x</a>
694
+ <a class="title" href="<?php echo get_permalink( $product_id ) ?>"><?php echo $product->get_title() ?></a>
695
+ </li>
696
+ <?php
697
+ }
698
+
699
+ $return = ob_get_clean();
700
+
701
+ return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
702
+ }
703
+
704
+ /**
705
+ * Remove a product from the comparison table
706
+ *
707
+ * @param $product_id The product ID to remove from the comparison table
708
+ */
709
+ public function remove_product_from_compare( $product_id ) {
710
+
711
+ if( $product_id == 'all' ) {
712
+ $this->products_list = array();
713
+ }
714
+ else {
715
+ foreach ( $this->products_list as $k => $id ) {
716
+ if ( intval( $product_id ) == $id ) {
717
+ unset( $this->products_list[ $k ] );
718
+ }
719
+ }
720
+ }
721
+
722
+ setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
723
+
724
+ do_action( 'yith_woocompare_after_remove_product', $product_id );
725
+ }
726
+
727
+ /**
728
+ * Remove all styles from the compare template
729
+ */
730
+ public function remove_all_styles() {
731
+ global $wp_styles;
732
+ $wp_styles->queue = array();
733
+ }
734
+
735
+ /**
736
+ * Show the html for the shortcode
737
+ */
738
+ public function compare_button_sc( $atts, $content = null ) {
739
+ $atts = shortcode_atts(array(
740
+ 'product' => false,
741
+ 'type' => 'default',
742
+ 'container' => 'yes'
743
+ ), $atts);
744
+
745
+ $product_id = 0;
746
+
747
+ /**
748
+ * Retrieve the product ID in these steps:
749
+ * - If "product" attribute is not set, get the product ID of current product loop
750
+ * - If "product" contains ID, post slug or post title
751
+ */
752
+ if ( ! $atts['product'] ) {
753
+ global $product;
754
+ $product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
755
+ } else {
756
+ global $wpdb;
757
+ $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'] ) );
758
+ if ( ! empty( $product ) ) {
759
+ $product_id = $product->ID;
760
+ }
761
+ }
762
+
763
+ // make sure to get always the product id of current language
764
+ if( function_exists( 'wpml_object_id_filter' ) ) {
765
+ $product_id = wpml_object_id_filter( $product_id, 'product', false );
766
+ }
767
+
768
+ // if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
769
+ if ( empty( $product_id ) )
770
+ return '';
771
+
772
+ ob_start();
773
+ if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
774
+ $this->add_compare_link( $product_id, array(
775
+ 'button_or_link' => ( $atts['type'] == 'default' ? false : $atts['type'] ),
776
+ 'button_text' => empty( $content ) ? 'default' : $content
777
+ ) );
778
+ if ( $atts['container'] == 'yes' ) echo '</div>';
779
+ return ob_get_clean();
780
+ }
781
+
782
+ public function wc_get_product( $product_id ){
783
+ $wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
784
+ return $wc_get_product( $product_id );
785
+ }
786
+
787
+
788
+ /**
789
+ * Do action before loads compare popup
790
+ *
791
+ * @since 2.1.1
792
+ * @author Francesco Licandro
793
+ */
794
+ public function actions_before_load_popup(){
795
+ // removes WooCommerce Product Filter scripts
796
+ wp_dequeue_script( 'prdctfltr-main-js' );
797
+ wp_dequeue_script( 'prdctfltr-history' );
798
+ wp_dequeue_script( 'prdctfltr-ionrange-js' );
799
+ wp_dequeue_script( 'prdctfltr-isotope-js' );
800
+ wp_dequeue_script( 'prdctfltr-scrollbar-js' );
801
+ }
802
+ }
803
  }
includes/class.yith-woocompare-helper.php CHANGED
@@ -1,105 +1,114 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
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
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
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
+ global $sitepress;
46
+
47
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
48
+
49
+ if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
50
+ $sitepress->switch_lang( $lang, true );
51
+ }
52
+
53
+
54
+ $fields = array(
55
+ 'image' => __( 'Image', 'yith-woocommerce-compare' ),
56
+ 'title' => __( 'Title', 'yith-woocommerce-compare' ),
57
+ 'price' => __( 'Price', 'yith-woocommerce-compare' ),
58
+ 'add-to-cart' => __( 'Add to cart', 'yith-woocommerce-compare' ),
59
+ 'description' => __( 'Description', 'yith-woocommerce-compare' ),
60
+ 'sku' => __( 'Sku', 'yith-woocommerce-compare' ),
61
+ 'stock' => __( 'Availability', 'yith-woocommerce-compare' ),
62
+ 'weight' => __( 'Weight', 'yith-woocommerce-compare' ),
63
+ 'dimensions' => __( 'Dimensions', 'yith-woocommerce-compare' )
64
+ );
65
+
66
+ if( $with_attr )
67
+ $fields = array_merge( $fields, YITH_Woocompare_Helper::attribute_taxonomies() );
68
+
69
+ return apply_filters( 'yith_woocompare_standard_fields_array', $fields );
70
+ }
71
+
72
+ /*
73
+ * Get Woocommerce Attribute Taxonomies
74
+ *
75
+ * @since 1.0.0
76
+ * @access public
77
+ */
78
+ public static function attribute_taxonomies() {
79
+ global $woocommerce;
80
+
81
+ if ( ! isset( $woocommerce ) ) return array();
82
+
83
+ $attributes = array();
84
+
85
+ if( function_exists( 'wc_get_attribute_taxonomies' ) && function_exists( 'wc_attribute_taxonomy_name' ) ) {
86
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
87
+ if( empty( $attribute_taxonomies ) )
88
+ return array();
89
+ foreach( $attribute_taxonomies as $attribute ) {
90
+ $tax = wc_attribute_taxonomy_name( $attribute->attribute_name );
91
+ if ( taxonomy_exists( $tax ) ) {
92
+ $attributes[$tax] = ucfirst( $attribute->attribute_name );
93
+ }
94
+ }
95
+ }
96
+ else{
97
+ $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
98
+ if( empty( $attribute_taxonomies ) )
99
+ return array();
100
+ foreach( $attribute_taxonomies as $attribute ) {
101
+ $tax = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
102
+ if ( taxonomy_exists( $tax ) ) {
103
+ $attributes[$tax] = ucfirst( $attribute->attribute_name );
104
+ }
105
+ }
106
+ }
107
+
108
+
109
+ return $attributes;
110
+ }
111
+
112
+
113
+ }
114
  }
includes/class.yith-woocompare.php CHANGED
@@ -1,123 +1,123 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
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
- return $this->obj;
68
- }
69
-
70
- /**
71
- * Detect if is frontend
72
- * @return bool
73
- */
74
- public function is_frontend() {
75
- $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
76
- $context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
77
- $actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
78
- $action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
79
-
80
- return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
81
- }
82
-
83
- /**
84
- * Detect if is admin
85
- * @return bool
86
- */
87
- public function is_admin() {
88
- $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
89
- $is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'admin' );
90
- return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
91
- }
92
-
93
- /**
94
- * Load Plugin Framework
95
- *
96
- * @since 1.0
97
- * @access public
98
- * @return void
99
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
100
- */
101
- public function plugin_fw_loader() {
102
-
103
- if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
104
- global $plugin_fw_data;
105
- if( ! empty( $plugin_fw_data ) ){
106
- $plugin_fw_file = array_shift( $plugin_fw_data );
107
- require_once( $plugin_fw_file );
108
- }
109
- }
110
- }
111
-
112
- /**
113
- * Load and register widgets
114
- *
115
- * @access public
116
- * @since 1.0.0
117
- */
118
- public function registerWidgets() {
119
- register_widget( 'YITH_Woocompare_Widget' );
120
- }
121
-
122
- }
123
  }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
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
+ return $this->obj;
68
+ }
69
+
70
+ /**
71
+ * Detect if is frontend
72
+ * @return bool
73
+ */
74
+ public function is_frontend() {
75
+ $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
76
+ $context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
77
+ $actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
78
+ $action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
79
+
80
+ return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
81
+ }
82
+
83
+ /**
84
+ * Detect if is admin
85
+ * @return bool
86
+ */
87
+ public function is_admin() {
88
+ $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
89
+ $is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'admin' );
90
+ return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
91
+ }
92
+
93
+ /**
94
+ * Load Plugin Framework
95
+ *
96
+ * @since 1.0
97
+ * @access public
98
+ * @return void
99
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
100
+ */
101
+ public function plugin_fw_loader() {
102
+
103
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
104
+ global $plugin_fw_data;
105
+ if( ! empty( $plugin_fw_data ) ){
106
+ $plugin_fw_file = array_shift( $plugin_fw_data );
107
+ require_once( $plugin_fw_file );
108
+ }
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Load and register widgets
114
+ *
115
+ * @access public
116
+ * @since 1.0.0
117
+ */
118
+ public function registerWidgets() {
119
+ register_widget( 'YITH_Woocompare_Widget' );
120
+ }
121
+
122
+ }
123
  }
init.php CHANGED
@@ -1,119 +1,119 @@
1
- <?php
2
- /**
3
- * Plugin Name: YITH WooCommerce Compare
4
- * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
5
- * Description: YITH WooCommerce Compare allows you to compare more products with WooCommerce plugin, through product attributes.
6
- * Version: 2.3.0
7
- * Author: YITHEMES
8
- * Author URI: https://yithemes.com/
9
- * Text Domain: yith-woocommerce-compare
10
- * Domain Path: /languages/
11
- * WC requires at least: 2.5.0
12
- * WC tested up to: 3.3.0
13
- *
14
- * @author Yithemes
15
- * @package YITH WooCommerce Compare
16
- * @version 2.3.0
17
- */
18
- /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
19
-
20
- This program is free software; you can redistribute it and/or modify
21
- it under the terms of the GNU General Public License, version 2, as
22
- published by the Free Software Foundation.
23
-
24
- This program is distributed in the hope that it will be useful,
25
- but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
- GNU General Public License for more details.
28
-
29
- You should have received a copy of the GNU General Public License
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' );
37
- }
38
-
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
- }
46
-
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
- }
54
-
55
- if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
56
- require_once 'plugin-fw/yit-plugin-registration-hook.php';
57
- }
58
- register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
59
-
60
- if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
61
- define( 'YITH_WOOCOMPARE_VERSION', '2.3.0' );
62
- }
63
- if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
64
- define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
65
- }
66
- if ( ! defined( 'YITH_WOOCOMPARE_INIT' ) ) {
67
- define( 'YITH_WOOCOMPARE_INIT', plugin_basename( __FILE__ ) );
68
- }
69
- if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
70
- define( 'YITH_WOOCOMPARE', true );
71
- }
72
- if ( ! defined( 'YITH_WOOCOMPARE_FILE' ) ) {
73
- define( 'YITH_WOOCOMPARE_FILE', __FILE__ );
74
- }
75
- if ( ! defined( 'YITH_WOOCOMPARE_URL' ) ) {
76
- define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
77
- }
78
- if ( ! defined( 'YITH_WOOCOMPARE_DIR' ) ) {
79
- define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
80
- }
81
- if ( ! defined( 'YITH_WOOCOMPARE_TEMPLATE_PATH' ) ) {
82
- define( 'YITH_WOOCOMPARE_TEMPLATE_PATH', YITH_WOOCOMPARE_DIR . 'templates' );
83
- }
84
- if ( ! defined( 'YITH_WOOCOMPARE_ASSETS_URL' ) ) {
85
- define( 'YITH_WOOCOMPARE_ASSETS_URL', YITH_WOOCOMPARE_URL . 'assets' );
86
- }
87
-
88
- /* Plugin Framework Version Check */
89
- if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
90
- require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' );
91
- }
92
- yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
93
-
94
- function yith_woocompare_constructor() {
95
-
96
- global $woocommerce;
97
-
98
- if ( ! isset( $woocommerce ) || ! function_exists( 'WC' ) ) {
99
- add_action( 'admin_notices', 'yith_woocompare_install_woocommerce_admin_notice' );
100
- return;
101
- }
102
- elseif ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ) {
103
- add_action( 'admin_notices', 'yith_woocompare_install_free_admin_notice' );
104
- deactivate_plugins( plugin_basename( __FILE__ ) );
105
- return;
106
- }
107
-
108
- load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
109
-
110
- // Load required classes and functions
111
- require_once('includes/class.yith-woocompare-helper.php');
112
- require_once('widgets/class.yith-woocompare-widget.php');
113
- require_once('includes/class.yith-woocompare.php');
114
-
115
- // Let's start the game!
116
- global $yith_woocompare;
117
- $yith_woocompare = new YITH_Woocompare();
118
- }
119
- add_action( 'plugins_loaded', 'yith_woocompare_constructor', 11 );
1
+ <?php
2
+ /**
3
+ * Plugin Name: YITH WooCommerce Compare
4
+ * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
5
+ * Description: YITH WooCommerce Compare allows you to compare more products with WooCommerce plugin, through product attributes.
6
+ * Version: 2.3.1
7
+ * Author: YITHEMES
8
+ * Author URI: https://yithemes.com/
9
+ * Text Domain: yith-woocommerce-compare
10
+ * Domain Path: /languages/
11
+ * WC requires at least: 2.5.0
12
+ * WC tested up to: 3.4.0
13
+ *
14
+ * @author Yithemes
15
+ * @package YITH WooCommerce Compare
16
+ * @version 2.3.1
17
+ */
18
+ /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
19
+
20
+ This program is free software; you can redistribute it and/or modify
21
+ it under the terms of the GNU General Public License, version 2, as
22
+ published by the Free Software Foundation.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
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' );
37
+ }
38
+
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
+ }
46
+
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
+ }
54
+
55
+ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
56
+ require_once 'plugin-fw/yit-plugin-registration-hook.php';
57
+ }
58
+ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
59
+
60
+ if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
61
+ define( 'YITH_WOOCOMPARE_VERSION', '2.3.1' );
62
+ }
63
+ if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
64
+ define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
65
+ }
66
+ if ( ! defined( 'YITH_WOOCOMPARE_INIT' ) ) {
67
+ define( 'YITH_WOOCOMPARE_INIT', plugin_basename( __FILE__ ) );
68
+ }
69
+ if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
70
+ define( 'YITH_WOOCOMPARE', true );
71
+ }
72
+ if ( ! defined( 'YITH_WOOCOMPARE_FILE' ) ) {
73
+ define( 'YITH_WOOCOMPARE_FILE', __FILE__ );
74
+ }
75
+ if ( ! defined( 'YITH_WOOCOMPARE_URL' ) ) {
76
+ define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
77
+ }
78
+ if ( ! defined( 'YITH_WOOCOMPARE_DIR' ) ) {
79
+ define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
80
+ }
81
+ if ( ! defined( 'YITH_WOOCOMPARE_TEMPLATE_PATH' ) ) {
82
+ define( 'YITH_WOOCOMPARE_TEMPLATE_PATH', YITH_WOOCOMPARE_DIR . 'templates' );
83
+ }
84
+ if ( ! defined( 'YITH_WOOCOMPARE_ASSETS_URL' ) ) {
85
+ define( 'YITH_WOOCOMPARE_ASSETS_URL', YITH_WOOCOMPARE_URL . 'assets' );
86
+ }
87
+
88
+ /* Plugin Framework Version Check */
89
+ if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
90
+ require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' );
91
+ }
92
+ yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
93
+
94
+ function yith_woocompare_constructor() {
95
+
96
+ global $woocommerce;
97
+
98
+ if ( ! isset( $woocommerce ) || ! function_exists( 'WC' ) ) {
99
+ add_action( 'admin_notices', 'yith_woocompare_install_woocommerce_admin_notice' );
100
+ return;
101
+ }
102
+ elseif ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ) {
103
+ add_action( 'admin_notices', 'yith_woocompare_install_free_admin_notice' );
104
+ deactivate_plugins( plugin_basename( __FILE__ ) );
105
+ return;
106
+ }
107
+
108
+ load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
109
+
110
+ // Load required classes and functions
111
+ require_once('includes/class.yith-woocompare-helper.php');
112
+ require_once('widgets/class.yith-woocompare-widget.php');
113
+ require_once('includes/class.yith-woocompare.php');
114
+
115
+ // Let's start the game!
116
+ global $yith_woocompare;
117
+ $yith_woocompare = new YITH_Woocompare();
118
+ }
119
+ add_action( 'plugins_loaded', 'yith_woocompare_constructor', 11 );
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
@@ -46,72 +46,8 @@
46
  }
47
 
48
  #plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
49
- padding : 0px 10px 10px;
50
- border-bottom : 1px solid #eee;
51
- }
52
-
53
- /* === VIDEO BOX === */
54
- .yith-videobox-wrapper {
55
- padding-top : 20px;
56
- }
57
-
58
- .yith-videobox-wrapper h3 {
59
- padding : 0px 10px 10px;
60
- border-bottom : 1px solid #eee;
61
- }
62
-
63
- .yith-videobox-wrapper .postbox {
64
- display : inline-block;
65
- }
66
-
67
- .yith-videobox-wrapper .yith_videobox .column {
68
- width : 45%;
69
- float : left;
70
- padding-right : 2.5%;
71
- border-right : 1px solid #ebebeb;
72
- padding-bottom : 2em;
73
- }
74
-
75
- .yith-videobox-wrapper .yith_videobox .column.two {
76
- margin-right : 0;
77
- padding-right : 0;
78
- padding-left : 2.5%;
79
- border : 0;
80
- max-width : 49%;
81
- }
82
-
83
- .yith-videobox-wrapper .yith_videobox h2 {
84
- font-size : 16px;
85
- margin-bottom : 20px;
86
- }
87
-
88
- .yith-videobox-wrapper .yith-video-link {
89
- width : 100%;
90
- max-width : 200px;
91
- float : left;
92
- margin : 0 1.5em 1.5em 0;
93
- }
94
-
95
- .yith-videobox-wrapper .yith-video-link {
96
- width : 100%;
97
- max-width : 200px;
98
- float : left;
99
- margin : 0 1.5em 1.5em 0;
100
- }
101
-
102
- .yith-videobox-wrapper .yith-image-frame img {
103
- max-width : 100%;
104
- height : auto;
105
- }
106
-
107
- .yith-videobox-wrapper .yith-video-link img {
108
- max-width : 100%;
109
- height : auto;
110
- }
111
-
112
- .yith-videobox-wrapper .yith-video-iframe {
113
- display : none;
114
-
115
  }
116
 
117
  /* === Plugins Upgrader === */
46
  }
47
 
48
  #plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
49
+ padding : 0 0 0 10px;
50
+ margin : 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
  /* === Plugins Upgrader === */
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -7,6 +7,11 @@
7
  clear : both;
8
  }
9
 
 
 
 
 
 
10
  .yith-disabled {
11
  opacity : 0.3;
12
  pointer-events : none;
@@ -32,8 +37,11 @@
32
 
33
  .yith-plugin-fw input[type=email],
34
  .yith-plugin-fw input[type=number],
35
- .yith-plugin-fw input[type=text]:not(.select2-search__field):not(.wp-color-picker),
36
  .yith-plugin-fw select,
 
 
 
37
  .woocommerce .yith-plugin-fw table.form-table select {
38
  width : 400px;
39
  max-width : 100%;
@@ -41,14 +49,29 @@
41
  padding : 5px;
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
44
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
45
  .yith-plugin-fw input[type=text].colorpick {
46
- width : 6em;
 
 
 
47
  }
48
 
49
- .woocommerce .yith-plugin-fw input[type=text].select2-search__field {
50
- margin : 10px 0 0 2px;
51
- padding : 0;
 
 
52
  }
53
 
54
  .yith-plugin-fw textarea {
@@ -57,12 +80,6 @@
57
  padding : 5px;
58
  }
59
 
60
- .yith-plugin-fw input[type=email],
61
- .yith-plugin-fw input[type=number],
62
- .yith-plugin-fw input[type=text]:not(.select2-search__field) {
63
- padding : 5px 10px;
64
- }
65
-
66
  /* ------------- ICONS ------------- */
67
  .yit-icons-manager-wrapper {
68
  width : 100%;
@@ -175,6 +192,10 @@ ul.yit-icons-manager-list li.active {
175
  }
176
 
177
  /* ------- OnOff ------- */
 
 
 
 
178
  .yith-plugin-fw-onoff-container input {
179
  display : none;
180
  }
@@ -218,6 +239,15 @@ ul.yit-icons-manager-list li.active {
218
  max-height : 200px;
219
  }
220
 
 
 
 
 
 
 
 
 
 
221
  /* ------- Sidebar Layout ------- */
222
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
223
  display : none;
@@ -324,7 +354,7 @@ ul.yit-icons-manager-list li.active {
324
  }
325
 
326
  .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area,
327
- .woocommerce table.form-table .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area{
328
  width : 100%;
329
  }
330
 
7
  clear : both;
8
  }
9
 
10
+ .yith-plugin-fw span.description.inline {
11
+ display : inline-block;
12
+ margin : 0 0 0 5px;
13
+ }
14
+
15
  .yith-disabled {
16
  opacity : 0.3;
17
  pointer-events : none;
37
 
38
  .yith-plugin-fw input[type=email],
39
  .yith-plugin-fw input[type=number],
40
+ .yith-plugin-fw input[type=text]:not(.select2-search__field),
41
  .yith-plugin-fw select,
42
+ .woocommerce .yith-plugin-fw table.form-table input[type=email],
43
+ .woocommerce .yith-plugin-fw table.form-table input[type=number],
44
+ .woocommerce .yith-plugin-fw table.form-table input[type=text]:not(.select2-search__field),
45
  .woocommerce .yith-plugin-fw table.form-table select {
46
  width : 400px;
47
  max-width : 100%;
49
  padding : 5px;
50
  }
51
 
52
+ .woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
53
+ .woocommerce .yith-plugin-fw table.form-table input[type=text].yith-plugin-fw-colorpicker,
54
+ .yith-plugin-fw input[type=text].wp-color-picker,
55
+ .yith-plugin-fw input[type=text].yith-plugin-fw-colorpicker {
56
+ width : 6em;
57
+ max-width : none;
58
+ height : auto;
59
+ padding : 3px 5px;
60
+ }
61
+
62
  .woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
63
  .yith-plugin-fw input[type=text].colorpick {
64
+ width : 6em;
65
+ max-width : none;
66
+ height : auto;
67
+ padding : 6px;
68
  }
69
 
70
+ .yith-plugin-fw input.select2-search__field,
71
+ .yith-plugin-fw .select2-container .select2-search--inline .select2-search__field,
72
+ .woocommerce .yith-plugin-fw input.select2-search__field,
73
+ .woocommerce .yith-plugin-fw table.form-table input.select2-search__field {
74
+ padding : 3px;
75
  }
76
 
77
  .yith-plugin-fw textarea {
80
  padding : 5px;
81
  }
82
 
 
 
 
 
 
 
83
  /* ------------- ICONS ------------- */
84
  .yit-icons-manager-wrapper {
85
  width : 100%;
192
  }
193
 
194
  /* ------- OnOff ------- */
195
+ .yith-plugin-fw-onoff-container {
196
+ display : inline-block;
197
+ }
198
+
199
  .yith-plugin-fw-onoff-container input {
200
  display : none;
201
  }
239
  max-height : 200px;
240
  }
241
 
242
+ /* ------- Radio ------- */
243
+ .yith-plugin-fw-radio input[type=radio] {
244
+ margin : 0 3px 0 0;
245
+ }
246
+
247
+ .yith-plugin-fw-radio__row {
248
+ margin-bottom : 8px;
249
+ }
250
+
251
  /* ------- Sidebar Layout ------- */
252
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
253
  display : none;
354
  }
355
 
356
  .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area,
357
+ .woocommerce table.form-table .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area {
358
  width : 100%;
359
  }
360
 
plugin-fw/assets/js/multisite-updater.js CHANGED
@@ -6,18 +6,18 @@
6
  * It is also available through the world-wide-web at this URL:
7
  * http://www.gnu.org/licenses/gpl-3.0.txt
8
  */
9
- (function ($) {
10
 
11
- var plugins_menu_item = $( '#menu-plugins' ),
12
- update = plugins_menu_item.find('.update-plugins'),
13
- count = update.find(".update-count").text(),
14
- registered = plugins.registered,
15
- activated = plugins.activated;
16
 
17
- if( count == 0 || count == ''){
18
  var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
19
- count = 0;
20
- plugins_menu_item.find( '.wp-menu-name').append( update_row );
21
  }
22
 
23
  /**
@@ -38,51 +38,47 @@
38
  *
39
  * @return void
40
  */
41
- function update_plugins_row( registered, activated, count, localize ){
42
- for( var init in registered ){
43
- var plugin = registered[init];
44
- for( var headers in plugin ){
45
 
46
- if( headers == 'slug' || version_compare( plugin[headers].Version, plugin[headers].Latest, '>=' ) ) {
47
  continue;
48
  }
49
 
50
- count = parseInt(count) + 1;
51
- $(".plugin-count").empty().html(count);
52
 
53
- var regex = new RegExp(' ', 'g'),
54
- info = plugin[headers],
55
- name = '' + info.Name,
56
- id = name.replace(regex, '-').trim(),
57
- row = '*[data-slug="' + id.toLowerCase() +'"]';
58
 
59
- $(row).addClass("update");
60
 
61
  var html = '<tr class="plugin-update-tr">' +
62
- '<td colspan="3" class="plugin-update colspanchange">' +
63
- '<div class="update-message">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
64
- '<a class="thickbox" href="' + localize.details_url[init] + '">' + localize.strings.latest.replace( '%latest%', plugin[headers].Latest ) + '</a>';
65
 
66
- if( typeof activated[init] == "undefined" ) {
67
 
68
  html = html +
69
- ' <em>' + localize.strings.unavailable + '</em>' +
70
- localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
71
  } else {
72
  html = html +
73
- '. <a href="' + localize.update_url[init] + '">' + localize.strings.update_now + '</a>';
74
- }
75
-
76
- if( typeof localize.changelogs[init] != 'undefined' ){
77
- html = html + localize.changelogs[init];
78
  }
79
 
80
  html = html +
81
- '</div>' +
82
- '</td>' +
83
- '</tr>';
84
 
85
- $(html).insertAfter(row);
86
  }
87
  }
88
  }
@@ -96,7 +92,7 @@
96
  *
97
  * @see php.js library http://phpjs.org/
98
  */
99
- function version_compare(v1, v2, operator) {
100
  // discuss at: http://phpjs.org/functions/version_compare/
101
  // original by: Philippe Jausions (http://pear.php.net/user/jausions)
102
  // original by: Aidan Lister (http://aidanlister.com/)
@@ -113,21 +109,21 @@
113
  // example 4: version_compare('4.1.0.52','4.01.0.51');
114
  // returns 4: 1
115
 
116
- this.php_js = this.php_js || {};
117
  this.php_js.ENV = this.php_js.ENV || {};
118
  // END REDUNDANT
119
  // Important: compare must be initialized at 0.
120
- var i = 0,
121
- x = 0,
122
- compare = 0,
123
- // vm maps textual PHP versions to negatives so they're less than 0.
124
- // PHP currently defines these as CASE-SENSITIVE. It is important to
125
- // leave these as negatives so that they can come before numerical versions
126
- // and as if no letters were there to begin with.
127
- // (1alpha is < 1 and < 1.1 but > 1dev1)
128
- // If a non-numerical value can't be mapped to this table, it receives
129
- // -7 as its value.
130
- vm = {
131
  'dev' : -6,
132
  'alpha': -5,
133
  'a' : -5,
@@ -139,54 +135,54 @@
139
  'p' : 1,
140
  'pl' : 1
141
  },
142
- // This function will be called to prepare each version argument.
143
- // It replaces every _, -, and + with a dot.
144
- // It surrounds any nonsequence of numbers/dots with dots.
145
- // It replaces sequences of dots with a single dot.
146
- // version_compare('4..0', '4.0') == 0
147
- // Important: A string of 0 length needs to be converted into a value
148
- // even less than an unexisting value in vm (-7), hence [-8].
149
- // It's also important to not strip spaces because of this.
150
- // version_compare('', ' ') == 1
151
- prepVersion = function (v) {
152
  v = ('' + v)
153
- .replace(/[_\-+]/g, '.');
154
- v = v.replace(/([^.\d]+)/g, '.$1.')
155
- .replace(/\.{2,}/g, '.');
156
- return (!v.length ? [-8] : v.split('.'));
157
  };
158
  // This converts a version component to a number.
159
  // Empty component becomes 0.
160
  // Non-numerical component becomes a negative number.
161
  // Numerical component becomes itself as an integer.
162
- numVersion = function (v) {
163
- return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
164
  };
165
- v1 = prepVersion(v1);
166
- v2 = prepVersion(v2);
167
- x = Math.max(v1.length, v2.length);
168
- for (i = 0; i < x; i++) {
169
- if (v1[i] == v2[i]) {
170
  continue;
171
  }
172
- v1[i] = numVersion(v1[i]);
173
- v2[i] = numVersion(v2[i]);
174
- if (v1[i] < v2[i]) {
175
  compare = -1;
176
  break;
177
- } else if (v1[i] > v2[i]) {
178
  compare = 1;
179
  break;
180
  }
181
  }
182
- if (!operator) {
183
  return compare;
184
  }
185
 
186
  // Important: operator is CASE-SENSITIVE.
187
  // "No operator" seems to be treated as "<."
188
  // Any other values seem to make the function return null.
189
- switch (operator) {
190
  case '>':
191
  case 'gt':
192
  return (compare > 0);
@@ -217,6 +213,6 @@
217
  $( 'body' ).on( 'click', '.yit-changelog-button', function () {
218
  $( '#TB_window' ).remove();
219
  } );
220
-
221
 
222
- })(jQuery);
 
6
  * It is also available through the world-wide-web at this URL:
7
  * http://www.gnu.org/licenses/gpl-3.0.txt
8
  */
9
+ (function ( $ ) {
10
 
11
+ var plugins_menu_item = $( '#menu-plugins' ),
12
+ update = plugins_menu_item.find( '.update-plugins' ),
13
+ count = update.find( ".update-count" ).text(),
14
+ registered = plugins.registered,
15
+ activated = plugins.activated;
16
 
17
+ if ( count == 0 || count == '' ) {
18
  var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
19
+ count = 0;
20
+ plugins_menu_item.find( '.wp-menu-name' ).append( update_row );
21
  }
22
 
23
  /**
38
  *
39
  * @return void
40
  */
41
+ function update_plugins_row( registered, activated, count, localize ) {
42
+ for ( var init in registered ) {
43
+ var plugin = registered[ init ];
44
+ for ( var headers in plugin ) {
45
 
46
+ if ( headers == 'slug' || version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '>=' ) ) {
47
  continue;
48
  }
49
 
50
+ count = parseInt( count ) + 1;
51
+ $( ".plugin-count" ).empty().html( count );
52
 
53
+ var regex = new RegExp( ' ', 'g' ),
54
+ info = plugin[ headers ],
55
+ name = '' + info.Name,
56
+ id = name.replace( regex, '-' ).trim(),
57
+ row = '*[data-slug="' + id.toLowerCase() + '"]';
58
 
59
+ $( row ).addClass( "update" );
60
 
61
  var html = '<tr class="plugin-update-tr">' +
62
+ '<td colspan="3" class="plugin-update colspanchange">' +
63
+ '<div class="update-message">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
64
+ '<a class="thickbox open-plugin-details-modal" href="' + localize.details_url[ init ] + '">' + localize.strings.latest.replace( '%latest%', plugin[ headers ].Latest ) + '</a>';
65
 
66
+ if ( typeof activated[ init ] == "undefined" ) {
67
 
68
  html = html +
69
+ ' <em>' + localize.strings.unavailable + '</em>' +
70
+ localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
71
  } else {
72
  html = html +
73
+ '. <a href="' + localize.update_url[ init ] + '">' + localize.strings.update_now + '</a>';
 
 
 
 
74
  }
75
 
76
  html = html +
77
+ '</div>' +
78
+ '</td>' +
79
+ '</tr>';
80
 
81
+ $( html ).insertAfter( row );
82
  }
83
  }
84
  }
92
  *
93
  * @see php.js library http://phpjs.org/
94
  */
95
+ function version_compare( v1, v2, operator ) {
96
  // discuss at: http://phpjs.org/functions/version_compare/
97
  // original by: Philippe Jausions (http://pear.php.net/user/jausions)
98
  // original by: Aidan Lister (http://aidanlister.com/)
109
  // example 4: version_compare('4.1.0.52','4.01.0.51');
110
  // returns 4: 1
111
 
112
+ this.php_js = this.php_js || {};
113
  this.php_js.ENV = this.php_js.ENV || {};
114
  // END REDUNDANT
115
  // Important: compare must be initialized at 0.
116
+ var i = 0,
117
+ x = 0,
118
+ compare = 0,
119
+ // vm maps textual PHP versions to negatives so they're less than 0.
120
+ // PHP currently defines these as CASE-SENSITIVE. It is important to
121
+ // leave these as negatives so that they can come before numerical versions
122
+ // and as if no letters were there to begin with.
123
+ // (1alpha is < 1 and < 1.1 but > 1dev1)
124
+ // If a non-numerical value can't be mapped to this table, it receives
125
+ // -7 as its value.
126
+ vm = {
127
  'dev' : -6,
128
  'alpha': -5,
129
  'a' : -5,
135
  'p' : 1,
136
  'pl' : 1
137
  },
138
+ // This function will be called to prepare each version argument.
139
+ // It replaces every _, -, and + with a dot.
140
+ // It surrounds any nonsequence of numbers/dots with dots.
141
+ // It replaces sequences of dots with a single dot.
142
+ // version_compare('4..0', '4.0') == 0
143
+ // Important: A string of 0 length needs to be converted into a value
144
+ // even less than an unexisting value in vm (-7), hence [-8].
145
+ // It's also important to not strip spaces because of this.
146
+ // version_compare('', ' ') == 1
147
+ prepVersion = function ( v ) {
148
  v = ('' + v)
149
+ .replace( /[_\-+]/g, '.' );
150
+ v = v.replace( /([^.\d]+)/g, '.$1.' )
151
+ .replace( /\.{2,}/g, '.' );
152
+ return (!v.length ? [ -8 ] : v.split( '.' ));
153
  };
154
  // This converts a version component to a number.
155
  // Empty component becomes 0.
156
  // Non-numerical component becomes a negative number.
157
  // Numerical component becomes itself as an integer.
158
+ numVersion = function ( v ) {
159
+ return !v ? 0 : (isNaN( v ) ? vm[ v ] || -7 : parseInt( v, 10 ));
160
  };
161
+ v1 = prepVersion( v1 );
162
+ v2 = prepVersion( v2 );
163
+ x = Math.max( v1.length, v2.length );
164
+ for ( i = 0; i < x; i++ ) {
165
+ if ( v1[ i ] == v2[ i ] ) {
166
  continue;
167
  }
168
+ v1[ i ] = numVersion( v1[ i ] );
169
+ v2[ i ] = numVersion( v2[ i ] );
170
+ if ( v1[ i ] < v2[ i ] ) {
171
  compare = -1;
172
  break;
173
+ } else if ( v1[ i ] > v2[ i ] ) {
174
  compare = 1;
175
  break;
176
  }
177
  }
178
+ if ( !operator ) {
179
  return compare;
180
  }
181
 
182
  // Important: operator is CASE-SENSITIVE.
183
  // "No operator" seems to be treated as "<."
184
  // Any other values seem to make the function return null.
185
+ switch ( operator ) {
186
  case '>':
187
  case 'gt':
188
  return (compare > 0);
213
  $( 'body' ).on( 'click', '.yit-changelog-button', function () {
214
  $( '#TB_window' ).remove();
215
  } );
 
216
 
217
+
218
+ })( jQuery );
plugin-fw/assets/js/multisite-updater.min.js CHANGED
@@ -1,4 +1,7 @@
1
- (function(e){function n(c,d,e){this.php_js=this.php_js||{};this.php_js.ENV=this.php_js.ENV||{};var a=0,f=0,b=0,g={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},a=function(a){a=(""+a).replace(/[_\-+]/g,".");a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return a.length?a.split("."):[-8]};numVersion=function(a){return a?isNaN(a)?g[a]||-7:parseInt(a,10):0};c=a(c);d=a(d);f=Math.max(c.length,d.length);for(a=0;a<f;a++)if(c[a]!=d[a])if(c[a]=numVersion(c[a]),d[a]=numVersion(d[a]),
2
- c[a]<d[a]){b=-1;break}else if(c[a]>d[a]){b=1;break}if(!e)return b;switch(e){case ">":case "gt":return 0<b;case ">=":case "ge":return 0<=b;case "<=":case "le":return 0>=b;case "==":case "=":case "eq":return 0===b;case "<>":case "!=":case "ne":return 0!==b;case "":case "<":case "lt":return 0>b;default:return null}}var l=e("#menu-plugins"),h=l.find(".update-plugins").find(".update-count").text(),p=plugins.registered,q=plugins.activated;if(0==h||""==h)h=0,l.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
3
- (function(c,d,h,a){for(var f in c){var b=c[f],g;for(g in b)if("slug"!=g&&!n(b[g].Version,b[g].Latest,">=")){h=parseInt(h)+1;e(".plugin-count").empty().html(h);var m=""+b[g].Name,l='*[data-slug="'+m.replace(RegExp(" ","g"),"-").trim().toLowerCase()+'"]';e(l).addClass("update");var k='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">'+a.strings.new_version.replace("%plugin_name%",m)+'<a class="thickbox" href="'+a.details_url[f]+'">'+a.strings.latest.replace("%latest%",
4
- b[g].Latest)+"</a>",k="undefined"==typeof d[f]?k+" <em>"+a.strings.unavailable+"</em>"+a.strings.activate.replace("%activate_link%",a.licence_activation_url).replace("%plugin_name%",m):k+'. <a href="'+a.update_url[f]+'">'+a.strings.update_now+"</a>";"undefined"!=typeof a.changelogs[f]&&(k+=a.changelogs[f]);k+="</div></td></tr>";e(k).insertAfter(l)}}})(p,q,h,plugins);e("body").on("click",".yit-changelog-button",function(){e("#TB_window").remove()})})(jQuery);
 
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,f,b){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var h=a[e];if(f.call(b,h,e,a))return{i:e,v:h}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,f,b){a!=Array.prototype&&a!=Object.prototype&&(a[f]=b.value)};
2
+ $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,f,b,d){if(f){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];f=f(d);f!=d&&null!=f&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:f})}};
3
+ $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
4
+ (function(a){function f(a,b,d){this.php_js=this.php_js||{};this.php_js.ENV=this.php_js.ENV||{};var c=0,f=0,g=0,e={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1};c=function(a){a=(""+a).replace(/[_\-+]/g,".");a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return a.length?a.split("."):[-8]};numVersion=function(a){return a?isNaN(a)?e[a]||-7:parseInt(a,10):0};a=c(a);b=c(b);f=Math.max(a.length,b.length);for(c=0;c<f;c++)if(a[c]!=b[c])if(a[c]=numVersion(a[c]),b[c]=numVersion(b[c]),
5
+ a[c]<b[c]){g=-1;break}else if(a[c]>b[c]){g=1;break}if(!d)return g;switch(d){case ">":case "gt":return 0<g;case ">=":case "ge":return 0<=g;case "<=":case "le":return 0>=g;case "==":case "=":case "eq":return 0===g;case "<>":case "!=":case "ne":return 0!==g;case "":case "<":case "lt":return 0>g;default:return null}}var b=a("#menu-plugins"),d=b.find(".update-plugins").find(".update-count").text(),e=plugins.registered,h=plugins.activated;if(0==d||""==d)d=0,b.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
6
+ (function(b,d,e,c){for(var h in b){var g=b[h],k;for(k in g)if("slug"!=k&&!f(g[k].Version,g[k].Latest,">=")){e=parseInt(e)+1;a(".plugin-count").empty().html(e);var m=""+g[k].Name,n='*[data-slug="'+m.replace(/ /g,"-").trim().toLowerCase()+'"]';a(n).addClass("update");var l='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">'+c.strings.new_version.replace("%plugin_name%",m)+'<a class="thickbox open-plugin-details-modal" href="'+c.details_url[h]+
7
+ '">'+c.strings.latest.replace("%latest%",g[k].Latest)+"</a>";l="undefined"==typeof d[h]?l+" <em>"+c.strings.unavailable+"</em>"+c.strings.activate.replace("%activate_link%",c.licence_activation_url).replace("%plugin_name%",m):l+'. <a href="'+c.update_url[h]+'">'+c.strings.update_now+"</a>";l+="</div></td></tr>";a(l).insertAfter(n)}}})(e,h,d,plugins);a("body").on("click",".yit-changelog-button",function(){a("#TB_window").remove()})})(jQuery);
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -125,37 +125,6 @@
125
  } ).disableSelection();
126
  } );
127
 
128
- $( document ).ready( function () {
129
-
130
- $( '.yith-video-link' ).click( function ( event ) {
131
- event.preventDefault();
132
- var target = $( this ).data( 'video-id' );
133
-
134
- $( '.' + target ).dialog( {
135
- dialogClass : 'wp-dialog yit-dialog yit-video-dialog',
136
- modal : true,
137
- closeOnEscape: true,
138
- width : 'auto',
139
- resizable : false,
140
- draggable : false,
141
- create : function ( event, ui ) {
142
- $( this ).css( "maxWidth", "853px" );
143
- },
144
- open : function ( event, ui ) {
145
-
146
- $( '.ui-widget-overlay' ).bind( 'click', function () {
147
- $( this ).siblings( '.ui-dialog' ).find( '.ui-dialog-content' ).dialog( 'close' );
148
- } );
149
-
150
- }
151
-
152
- } );
153
-
154
- $( '.ui-dialog :button' ).blur();
155
-
156
- } );
157
- } );
158
-
159
  //google analytics generation
160
  $( document ).ready( function () {
161
  $( '.google-analytic-generate' ).click( function () {
125
  } ).disableSelection();
126
  } );
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  //google analytics generation
129
  $( document ).ready( function () {
130
  $( '.google-analytic-generate' ).click( function () {
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1,5 +1,7 @@
1
- (function(a){function h(b,d,c,f){var e=!0;if("string"==typeof d){":radio"==d.substr(0,6)&&(d+=":checked");var g=a(d).val();"checkbox"==a(d).attr("type")&&(g=a(d).is(":checked")?"yes":"no");c=c.split(",");for(d=0;d<c.length;d++)if(g!=c[d])e=!1;else{e=!0;break}}c=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=c.closest(".yith-plugin-fw-panel-wc-row"));f=f.split("-");for(var h in f)if(g=f[h],e)switch(g){case "disable":b.removeClass("yith-disabled");c.attr("disabled",!1);break;case "hideme":c.show();
2
- break;default:b.show()}else switch(g){case "disable":b.addClass("yith-disabled");c.attr("disabled",!0);break;case "hideme":c.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),d="#"+b.data("dep-target"),c="#"+b.data("dep-id"),f=b.data("dep-value"),e=b.data("dep-type");h(d,c,f.toString(),e);a(c).on("change",function(){h(d,c,f.toString(),e)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),d=a(this).find(":hidden");b.sortable({connectWith:b,
3
- update:function(c,f){var e={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});e[a(this).data("list")]=b});d.val(JSON.stringify(e).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,
4
- create:function(b,c){a(this).css("maxWidth","853px")},open:function(b,c){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),d=a("#"+a(this).data("input")).val(),c=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
5
- ("ga('create', '"+d+"', '"+c+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")})(jQuery);
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var c=a.length,d=0;d<c;d++){var g=a[d];if(e.call(b,g,d,a))return{i:d,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};
2
+ $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,b,c){if(e){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var d=a[c];d in b||(b[d]={});b=b[d]}a=a[a.length-1];c=b[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};
3
+ $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
4
+ (function(a){function e(b,c,d,e){var f=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var h=a(c).val();"checkbox"==a(c).attr("type")&&(h=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(h!=d[c])f=!1;else{f=!0;break}}d=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=d.closest(".yith-plugin-fw-panel-wc-row"));e=e.split("-");for(var g in e)if(h=e[g],f)switch(h){case "disable":b.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();
5
+ break;default:b.show()}else switch(h){case "disable":b.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),g=b.data("dep-value"),f=b.data("dep-type");e(c,d,g.toString(),f);a(d).on("change",function(){e(c,d,g.toString(),f)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,
6
+ update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
7
+ ("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")})(jQuery);
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.0.11
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.0.11
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.0.16
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.0.16
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/lib/privacy/yit-privacy-plugin-abstract.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
3
+
4
+ if ( !class_exists( 'YITH_Privacy_Plugin_Abstract' ) ) {
5
+ class YITH_Privacy_Plugin_Abstract {
6
+ private $_name;
7
+
8
+ public function __construct( $name ) {
9
+ $this->_name = $name;
10
+ $this->init();
11
+ }
12
+
13
+ protected function init() {
14
+ add_filter( 'yith_plugin_fw_privacy_guide_content', array( $this, 'add_message_in_section' ), 10, 2 );
15
+ }
16
+
17
+ public function add_message_in_section( $html, $section ) {
18
+ if ( $message = $this->get_privacy_message( $section ) ) {
19
+ $html .= "<p class='privacy-policy-tutorial'><strong>{$this->_name}</strong></p>";
20
+ $html .= $message;
21
+ }
22
+ return $html;
23
+ }
24
+
25
+ public function get_privacy_message( $section ) {
26
+ return '';
27
+ }
28
+ }
29
+ }
plugin-fw/lib/privacy/yit-privacy.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
3
+
4
+ if ( !class_exists( 'YITH_Privacy' ) ) {
5
+ /**
6
+ * Class YITH_Privacy
7
+ * Privacy Class
8
+ *
9
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
10
+ */
11
+ class YITH_Privacy {
12
+ private static $_instance;
13
+
14
+ private $_title;
15
+
16
+ public static function get_instance() {
17
+ return !is_null( self::$_instance ) ? self::$_instance : self::$_instance = new self();
18
+ }
19
+
20
+ /**
21
+ * YITH_Privacy constructor.
22
+ */
23
+ private function __construct() {
24
+ $this->_title = apply_filters( 'yith_plugin_fw_privacy_policy_guide_title', _x( 'YITH Plugins', 'Privacy Policy Guide Title', 'yith-plugin-fw' ) );
25
+ add_action( 'admin_init', array( $this, 'add_privacy_message' ) );
26
+ }
27
+
28
+ /**
29
+ * Adds the privacy message on YITH privacy page.
30
+ */
31
+ public function add_privacy_message() {
32
+ if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
33
+ $content = $this->get_privacy_message();
34
+
35
+ if ( $content ) {
36
+ wp_add_privacy_policy_content( $this->_title, $this->get_privacy_message() );
37
+ }
38
+ }
39
+ }
40
+
41
+ /**
42
+ * get the privacy message
43
+ *
44
+ * @return string
45
+ */
46
+ public function get_privacy_message() {
47
+ $privacy_content_path = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/privacy/html-policy-content.php';
48
+ ob_start();
49
+ $sections = $this->get_sections();
50
+ if ( file_exists( $privacy_content_path ) )
51
+ include $privacy_content_path;
52
+
53
+ return apply_filters( 'yith_wcbk_privacy_policy_content', ob_get_clean() );
54
+ }
55
+
56
+ public function get_sections() {
57
+ return apply_filters( 'yith_wcbk_privacy_policy_content_sections', array(
58
+ 'general' => array(
59
+ 'tutorial' => _x( 'This sample language includes the basics around what personal data your store may be collecting, storing and sharing, as well as who may have access to that data. Depending on what settings are enabled and which additional plugins are used, the specific information shared by your store will vary. We recommend consulting with a lawyer when deciding what information to disclose on your privacy policy.', 'Privacy Policy Content', 'yith-plugin-fw' ),
60
+ 'description' => '',
61
+ ),
62
+ 'collect_and_store' => array(
63
+ 'title' => _x( 'What we collect and store', 'Privacy Policy Content', 'yith-plugin-fw' )
64
+ ),
65
+ 'has_access' => array(
66
+ 'title' => _x( 'Who on our team has access', 'Privacy Policy Content', 'yith-plugin-fw' )
67
+ ),
68
+ 'share' => array(
69
+ 'title' => _x( 'What we share with others', 'Privacy Policy Content', 'yith-plugin-fw' ),
70
+ ),
71
+ 'payments' => array(
72
+ 'title' => _x( 'Payments', 'Privacy Policy Content', 'yith-plugin-fw' )
73
+ ),
74
+ ) );
75
+ }
76
+ }
77
+ }
78
+
79
+ YITH_Privacy::get_instance();
plugin-fw/lib/yit-metabox.php CHANGED
@@ -520,7 +520,11 @@ if ( !class_exists( 'YIT_Metabox' ) ) {
520
  if ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
521
  update_post_meta( $post_id, $field[ 'id' ], '1' );
522
  } else {
523
- add_post_meta( $post_id, $field[ 'id' ], $_POST[ 'yit_metaboxes' ][ $field[ 'id' ] ], true ) || update_post_meta( $post_id, $field[ 'id' ], $_POST[ 'yit_metaboxes' ][ $field[ 'id' ] ] );
 
 
 
 
524
  }
525
  } elseif ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
526
  update_post_meta( $post_id, $field[ 'id' ], '0' );
520
  if ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
521
  update_post_meta( $post_id, $field[ 'id' ], '1' );
522
  } else {
523
+ $value = $_POST[ 'yit_metaboxes' ][ $field[ 'id' ] ];
524
+ if ( !empty( $field[ 'yith-sanitize-callback' ] ) && is_callable( $field[ 'yith-sanitize-callback' ] ) ) {
525
+ $value = call_user_func( $field[ 'yith-sanitize-callback' ], $value );
526
+ }
527
+ add_post_meta( $post_id, $field[ 'id' ], $value, true ) || update_post_meta( $post_id, $field[ 'id' ], $value );
528
  }
529
  } elseif ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
530
  update_post_meta( $post_id, $field[ 'id' ], '0' );
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -93,7 +93,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
93
  if ( !static::$_actions_initialized ) {
94
  /* Add VideoBox and InfoBox */
95
  add_action( 'woocommerce_admin_field_boxinfo', array( __CLASS__, 'add_infobox' ), 10, 1 );
96
- add_action( 'woocommerce_admin_field_videobox', array( __CLASS__, 'add_videobox' ), 10, 1 );
97
 
98
  /* Add YITH Fields */
99
  add_action( 'woocommerce_admin_field_yith-field', array( __CLASS__, 'add_yith_field' ), 10, 1 );
@@ -521,9 +520,13 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
521
  $value = yith_plugin_fw_is_true( $raw_value ) ? 'yes' : 'no';
522
  }
523
 
524
- if ( isset( $option[ 'yith-type' ] ) && in_array( $option[ 'yith-type' ], array( 'textarea-editor', 'textarea-codemirror' ) ) ) {
525
  $value = $raw_value;
526
  }
 
 
 
 
527
  }
528
 
529
  return $value;
93
  if ( !static::$_actions_initialized ) {
94
  /* Add VideoBox and InfoBox */
95
  add_action( 'woocommerce_admin_field_boxinfo', array( __CLASS__, 'add_infobox' ), 10, 1 );
 
96
 
97
  /* Add YITH Fields */
98
  add_action( 'woocommerce_admin_field_yith-field', array( __CLASS__, 'add_yith_field' ), 10, 1 );
520
  $value = yith_plugin_fw_is_true( $raw_value ) ? 'yes' : 'no';
521
  }
522
 
523
+ if ( isset( $option[ 'yith-type' ] ) && in_array( $option[ 'yith-type' ], array( 'textarea', 'textarea-editor', 'textarea-codemirror' ) ) ) {
524
  $value = $raw_value;
525
  }
526
+
527
+ if ( !empty( $option[ 'yith-sanitize-callback' ] ) && is_callable( $option[ 'yith-sanitize-callback' ] ) ) {
528
+ $value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
529
+ }
530
  }
531
 
532
  return $value;
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -274,6 +274,11 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
274
  if ( isset( $option[ 'type' ] ) && in_array( $option[ 'type' ], array( 'checkbox', 'onoff' ) ) ) {
275
  $value = yith_plugin_fw_is_true( $value ) ? 'yes' : 'no';
276
  }
 
 
 
 
 
277
  $valid_input[ $option[ 'id' ] ] = $value;
278
  }
279
  }
@@ -363,7 +368,6 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
363
  return;
364
  }
365
  ?>
366
- <?php $this->print_video_box(); ?>
367
  <?php
368
  $panel_content_class = apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' );
369
  ?>
@@ -605,8 +609,11 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
605
  return $this->_main_array_options;
606
  }
607
 
 
 
608
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $v ) {
609
- $path = $this->settings[ 'options-path' ] . '/' . $item . '-options.php';
 
610
  if ( file_exists( $path ) ) {
611
  $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
612
  }
@@ -854,36 +861,24 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
854
  /**
855
  * Show a box panel with specific content in two columns as a new woocommerce type
856
  *
 
 
857
  * @param array $args
858
  *
859
  * @return void
860
- * @since 1.0
861
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
862
  */
863
  public static function add_videobox( $args = array() ) {
864
- if ( !empty( $args ) ) {
865
- extract( $args );
866
- require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/videobox.php' );
867
- }
868
  }
869
 
870
  /**
871
  * Fire the action to print the custom tab
872
  *
 
873
  * @return void
874
- * @since 1.0
875
- * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
876
  */
877
  public function print_video_box() {
878
- $file = $this->settings[ 'options-path' ] . '/video-box.php';
879
-
880
- if ( !file_exists( $file ) ) {
881
- return;
882
- }
883
-
884
- $args = include_once( $file );
885
 
886
- $this->add_videobox( $args );
887
  }
888
 
889
  /**
274
  if ( isset( $option[ 'type' ] ) && in_array( $option[ 'type' ], array( 'checkbox', 'onoff' ) ) ) {
275
  $value = yith_plugin_fw_is_true( $value ) ? 'yes' : 'no';
276
  }
277
+
278
+ if ( !empty( $option[ 'yith-sanitize-callback' ] ) && is_callable( $option[ 'yith-sanitize-callback' ] ) ) {
279
+ $value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
280
+ }
281
+
282
  $valid_input[ $option[ 'id' ] ] = $value;
283
  }
284
  }
368
  return;
369
  }
370
  ?>
 
371
  <?php
372
  $panel_content_class = apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' );
373
  ?>
609
  return $this->_main_array_options;
610
  }
611
 
612
+ $options_path = $this->settings[ 'options-path' ];
613
+
614
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $v ) {
615
+ $path = $options_path . '/' . $item . '-options.php';
616
+ $path = apply_filters( 'yith_plugin_panel_item_options_path', $path, $options_path, $item, $this );
617
  if ( file_exists( $path ) ) {
618
  $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
619
  }
861
  /**
862
  * Show a box panel with specific content in two columns as a new woocommerce type
863
  *
864
+ * @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
865
+ *
866
  * @param array $args
867
  *
868
  * @return void
 
 
869
  */
870
  public static function add_videobox( $args = array() ) {
871
+
 
 
 
872
  }
873
 
874
  /**
875
  * Fire the action to print the custom tab
876
  *
877
+ * @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
878
  * @return void
 
 
879
  */
880
  public function print_video_box() {
 
 
 
 
 
 
 
881
 
 
882
  }
883
 
884
  /**
plugin-fw/lib/yit-plugin-subpanel.php CHANGED
@@ -139,7 +139,6 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
139
  return;
140
  }
141
  ?>
142
- <?php $this->print_video_box(); ?>
143
  <?php
144
  $panel_content_class = apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' );
145
  ?>
139
  return;
140
  }
141
  ?>
 
142
  <?php
143
  $panel_content_class = apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' );
144
  ?>
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -62,6 +62,40 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
62
  $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
  add_filter( 'block_local_requests', '__return_false' );
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
67
  /**
@@ -89,36 +123,49 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
89
  'slug' => $plugin_slug,
90
  );
91
 
92
- /* === HOOKS === */
93
- if ( !is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
94
- add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
95
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
96
- } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
97
- $transient = 'yith_register_' . md5( $plugin_slug );
98
- if ( apply_filters( 'yith_register_delete_transient', false ) ) {
99
- delete_transient( $transient );
100
- }
101
- $info = get_transient( $transient );
102
- if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
103
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
104
- $remote_xml = wp_remote_get( $xml );
105
-
106
- if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
107
- $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
108
- if ( $plugin_remote_info ) {
109
- $info[ 'Latest' ] = (string) $plugin_remote_info->latest;
110
- $info[ 'changelog' ] = (string) $plugin_remote_info->changelog;
111
  YIT_Plugin_Licence()->check( $plugin_slug, false );
112
- set_transient( $transient, $info, DAY_IN_SECONDS );
113
- } else {
114
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
115
- __FILE__, __FUNCTION__, $plugin_slug ) );
116
  }
 
 
 
 
 
117
  }
 
 
118
  }
119
 
120
- $this->_plugins[ $plugin_init ][ 'info' ][ 'Latest' ] = $info[ 'Latest' ];
121
- $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] = $info[ 'changelog' ];
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
123
  }
124
  }
@@ -132,7 +179,6 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
132
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
133
  */
134
  public function multisite_updater_script() {
135
-
136
  $update_url = $changelogs = $details_url = array();
137
  $strings = array(
138
  'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
@@ -145,10 +191,7 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
145
 
146
  foreach ( $this->_plugins as $init => $info ) {
147
  $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
148
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
149
- $details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ), '' ) );
150
- $plugin_changelog = isset( $this->_plugins[ $init ][ 'info' ][ 'changelog' ] ) ? $this->_plugins[ $init ][ 'info' ][ 'changelog' ] : '';
151
- $changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $plugin_changelog, $changelog_id, false );
152
  }
153
 
154
  $localize_script_args = array(
@@ -158,7 +201,6 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
158
  'update_url' => $update_url,
159
  'details_url' => $details_url,
160
  'strings' => $strings,
161
- 'changelogs' => $changelogs
162
  );
163
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
164
  yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
@@ -432,7 +474,7 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
432
  $r = $current->response[ $init ];
433
 
434
  $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
435
- $details_url = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ), '' ) );
436
 
437
  /**
438
  * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
@@ -493,14 +535,12 @@ if ( !class_exists( 'YIT_Upgrade' ) ) {
493
  foreach ( $this->_plugins as $init => $plugin ) {
494
  remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
495
  add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
496
- add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
497
  }
498
  }
499
 
500
  public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
501
-
502
- $res
503
- = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
504
  <div class='yit-plugin-changelog'>
505
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
506
  <p>{$changelog}</p>
62
  $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
  add_filter( 'block_local_requests', '__return_false' );
64
  }
65
+
66
+ add_action( 'install_plugins_pre_plugin-information', array( $this, 'show_changelog_for_premium_plugins' ) );
67
+ add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array( $this, 'show_changelog_for_premium_plugins' ) );
68
+ }
69
+
70
+ /**
71
+ * show changelog for premium plugins
72
+ *
73
+ * @since 3.0.14
74
+ */
75
+ public function show_changelog_for_premium_plugins() {
76
+ if ( isset( $_GET[ 'plugin' ] ) && isset( $_GET[ 'section' ] ) && 'changelog' === $_GET[ 'section' ] ) {
77
+ $plugin_init = $_GET[ 'plugin' ];
78
+ if ( isset( $this->_plugins[ $plugin_init ] ) ) {
79
+ // this is YITH Premium Plugin
80
+ if ( !empty( $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] ) ) {
81
+ $plugin_name = $this->_plugins[ $plugin_init ][ 'info' ][ 'Name' ];
82
+ $changelog = $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ];
83
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
84
+ if ( file_exists( $template ) ) {
85
+ include( $template );
86
+ }
87
+ die();
88
+ }
89
+ $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
90
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
91
+ if ( file_exists( $template ) ) {
92
+ include( $template );
93
+ } else {
94
+ echo "<p>$error</p>";
95
+ }
96
+ die();
97
+ }
98
+ }
99
  }
100
 
101
  /**
123
  'slug' => $plugin_slug,
124
  );
125
 
126
+ $transient = 'yith_register_' . md5( $plugin_slug );
127
+ if ( apply_filters( 'yith_register_delete_transient', false ) ) {
128
+ delete_transient( $transient );
129
+ }
130
+ $info = get_transient( $transient );
131
+ if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
132
+ $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
133
+ $remote_xml = wp_remote_get( $xml );
134
+
135
+ $error = false;
136
+ if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
137
+ $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
138
+ if ( $plugin_remote_info ) {
139
+ $info[ 'Latest' ] = (string) $plugin_remote_info->latest;
140
+ $info[ 'changelog' ] = (string) $plugin_remote_info->changelog;
141
+ if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
 
 
 
142
  YIT_Plugin_Licence()->check( $plugin_slug, false );
 
 
 
 
143
  }
144
+ set_transient( $transient, $info, DAY_IN_SECONDS );
145
+ } else {
146
+ $error = true;
147
+ error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
148
+ __FILE__, __FUNCTION__, $plugin_slug ) );
149
  }
150
+ } else {
151
+ $error = true;
152
  }
153
 
154
+ if ( $error ) {
155
+ // If error, set empty value in the transient to prevent multiple requests
156
+ $info = array( 'Latest' => '', 'changelog' => '' );
157
+ set_transient( $transient, $info, HOUR_IN_SECONDS );
158
+ }
159
+ }
160
+
161
+ $this->_plugins[ $plugin_init ][ 'info' ][ 'Latest' ] = $info[ 'Latest' ];
162
+ $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] = $info[ 'changelog' ];
163
+
164
+ /* === HOOKS === */
165
+ if ( !is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
166
+ add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
167
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
168
+ } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
169
  add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
170
  }
171
  }
179
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
180
  */
181
  public function multisite_updater_script() {
 
182
  $update_url = $changelogs = $details_url = array();
183
  $strings = array(
184
  'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
191
 
192
  foreach ( $this->_plugins as $init => $info ) {
193
  $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
194
+ $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
 
 
 
195
  }
196
 
197
  $localize_script_args = array(
201
  'update_url' => $update_url,
202
  'details_url' => $details_url,
203
  'strings' => $strings,
 
204
  );
205
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
206
  yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
474
  $r = $current->response[ $init ];
475
 
476
  $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
477
+ $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
478
 
479
  /**
480
  * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
535
  foreach ( $this->_plugins as $init => $plugin ) {
536
  remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
537
  add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
538
+ //add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
539
  }
540
  }
541
 
542
  public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
543
+ $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
 
 
544
  <div class='yit-plugin-changelog'>
545
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
546
  <p>{$changelog}</p>
plugin-fw/lib/yit-video.php CHANGED
@@ -135,6 +135,7 @@ if ( ! class_exists( 'YIT_Video' ) ) {
135
  public static function video_id_by_url( $url ) {
136
  $parsed = parse_url( esc_url( $url ) );
137
 
 
138
  if ( ! isset( $parsed['host'] ) ) {
139
  return false;
140
  }
@@ -150,7 +151,8 @@ if ( ! class_exists( 'YIT_Video' ) ) {
150
 
151
  case 'www.vimeo.com' :
152
  case 'vimeo.com' :
153
- preg_match( '/http(s)?:\/\/(\w+.)?vimeo\.com\/(.*)?(\/[0-9]+)/', $url, $matches );
 
154
  $id = trim( $matches[4], '/' );
155
  return "vimeo:$id";
156
 
135
  public static function video_id_by_url( $url ) {
136
  $parsed = parse_url( esc_url( $url ) );
137
 
138
+
139
  if ( ! isset( $parsed['host'] ) ) {
140
  return false;
141
  }
151
 
152
  case 'www.vimeo.com' :
153
  case 'vimeo.com' :
154
+ preg_match( '/http(s)?:\/\/(\w+.)?vimeo\.com\/(.*\/)?([0-9]+)/', $url, $matches );
155
+
156
  $id = trim( $matches[4], '/' );
157
  return "vimeo:$id";
158
 
plugin-fw/licence/lib/yit-licence.php CHANGED
@@ -198,8 +198,8 @@ if ( !class_exists( 'YIT_Licence' ) ) {
198
  )
199
  );
200
 
201
- /* Enqueue Scripts only in Licence Activation page */
202
- if ( strpos( get_current_screen()->id, 'yith_plugins_activation' ) !== false ) {
203
  wp_enqueue_script( 'yit-licence' );
204
  wp_enqueue_style( 'yit-theme-licence' );
205
  }
198
  )
199
  );
200
 
201
+ /* Enqueue Scripts only in Licence Activation page of plugins and themes */
202
+ if ( strpos( get_current_screen()->id, 'yith_plugins_activation' ) !== false || strpos( get_current_screen()->id, 'yit_panel_license' ) !== false ) {
203
  wp_enqueue_script( 'yit-licence' );
204
  wp_enqueue_style( 'yit-theme-licence' );
205
  }
plugin-fw/licence/lib/yit-plugin-licence.php CHANGED
@@ -105,7 +105,7 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
105
  <div class="notice notice-error">
106
  <p><strong>Warning!</strong> You didn't set license key for the following products:
107
  <?php echo $product_list ?>
108
- which means you're missing out on updates and support. <a href='<?php echo $activation_url ?>'>Enter your license key</a></p>
109
  </div>
110
  <?php
111
  }
105
  <div class="notice notice-error">
106
  <p><strong>Warning!</strong> You didn't set license key for the following products:
107
  <?php echo $product_list ?>
108
+ which means you're missing out on updates and support. <a href='<?php echo $activation_url ?>'>Enter your license key</a>, please.</p>
109
  </div>
110
  <?php
111
  }
plugin-fw/templates/fields/onoff.php CHANGED
@@ -18,4 +18,9 @@ extract( $field );
18
  <div class="yith-plugin-fw-onoff-container">
19
  <input type="checkbox" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php checked( yith_plugin_fw_is_true( $value ) ) ?> class="on_off" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?> />
20
  <span class="yith-plugin-fw-onoff">&nbsp;</span>
21
- </div>
 
 
 
 
 
18
  <div class="yith-plugin-fw-onoff-container">
19
  <input type="checkbox" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php checked( yith_plugin_fw_is_true( $value ) ) ?> class="on_off" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?> />
20
  <span class="yith-plugin-fw-onoff">&nbsp;</span>
21
+ </div>
22
+ <?php
23
+ if ( isset( $field[ 'desc-inline' ] ) ) {
24
+ echo "<span class='description inline'>" . $field[ 'desc-inline' ] . "</span>";
25
+ }
26
+ ?>
plugin-fw/templates/fields/radio.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var array $field
11
+ */
12
+
13
+ /** @since 3.0.13 */
14
+
15
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
16
+
17
+ extract( $field );
18
+
19
+ $class = isset( $class ) ? $class : '';
20
+ $class = 'yith-plugin-fw-radio ' . $class;
21
+ ?>
22
+ <div class="<?php echo $class ?>" id="<?php echo $id ?>"
23
+ <?php echo $custom_attributes ?>
24
+ <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?> value="<?php echo $value ?>">
25
+ <?php foreach ( $options as $key => $label ) :
26
+ $radio_id = sanitize_key( $id . '-' . $key );
27
+ ?>
28
+ <div class="yith-plugin-fw-radio__row">
29
+ <input type="radio" id="<?php echo $radio_id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $key ) ?>" <?php checked( $key, $value ); ?> />
30
+ <label for="<?php echo $radio_id ?>"><?php echo $label ?></label>
31
+ </div>
32
+ <?php endforeach; ?>
33
+ </div>
plugin-fw/templates/panel/videobox.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- /**
16
- * Example to call this template
17
- *
18
- * 'section_general_settings_videobox' => array(
19
- * 'name' => __( 'Title of box', 'yith-plugin-fw' ),
20
- * 'type' => 'videobox',
21
- * 'default' => array(
22
- * 'plugin_name' => __( 'Plugin Name', 'yith-plugin-fw' ),
23
- * 'title_first_column' => __( 'Title first column', 'yith-plugin-fw' ),
24
- * 'description_first_column' => __('Lorem ipsum ... ', 'yith-plugin-fw'),
25
- * 'video' => array(
26
- * 'video_id' => 'vimeo_code',
27
- * 'video_image_url' => '#',
28
- * 'video_description' => __( 'Lorem ipsum dolor sit amet....', 'yith-plugin-fw' ),
29
- * ),
30
- * 'title_second_column' => __( 'Title first column', 'yith-plugin-fw' ),
31
- * 'description_second_column' => __('Lorem ipsum dolor sit amet.... ', 'yith-plugin-fw'),
32
- * 'button' => array(
33
- * 'href' => 'http://www.yithemes.com',
34
- * 'title' => 'Get Support and Pro Features'
35
- * )
36
- * ),
37
- * 'id' => 'yith_wcas_general_videobox'
38
- * ),
39
- */
40
- ?>
41
- <div id="normal-sortables" class="meta-box-sortables yith-videobox-wrapper">
42
- <div id="<?php echo $id ?>" class="postbox">
43
- <h3><span><?php echo $name ?></span></h3>
44
- <div class="inside">
45
- <div class="yith_videobox">
46
- <div class="column"><h2><?php echo $default['title_first_column'] ?></h2>
47
- <?php if ( isset( $default['video'] ) && !empty( $default['video'] ) ): ?>
48
- <a class="yith-video-link" href="#" data-video-id="yith-video-iframe">
49
- <img src="<?php echo $default['video']['video_image_url'] ?>">
50
- </a>
51
-
52
- <p class="yit-video-description">
53
- <?php echo $default['video']['video_description'] ?>
54
- </p>
55
-
56
- <p class="yith-video-iframe">
57
- <iframe src="//player.vimeo.com/video/<?php echo $default['video']['video_id'] ?>?title=0&amp;byline=0&amp;portrait=0" width="853" height="480" frameborder="0"></iframe>
58
- </p>
59
- <?php endif ?>
60
- <?php if ( isset( $default['image'] ) && !empty( $default['image'] ) ): ?>
61
- <a href="<?php echo $default['image']['image_link'] ?>" target="_blank" class="yith-image-frame">
62
- <img src="<?php echo $default['image']['image_url'] ?>">
63
- </a>
64
- <?php endif ?>
65
- <?php if ( isset( $default['description_first_column'] ) && $default['description_first_column'] != '' ): ?>
66
- <p><?php echo $default['description_first_column'] ?></p>
67
- <?php endif ?>
68
- </div>
69
- <div class="column two">
70
- <h2><?php echo $default['title_second_column'] ?>?</h2>
71
-
72
- <p><?php echo $default['description_second_column'] ?></p>
73
-
74
- <?php if ( isset( $default['button'] ) && !empty( $default['button'] ) ): ?>
75
- <p>
76
- <a class="button-primary" href="<?php echo $default['button']['href'] ?>" target="_blank"><?php echo $default['button']['title'] ?></a>
77
- </p>
78
- <?php endif ?>
79
- </div>
80
- </div>
81
- </div>
82
- </div>
83
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/templates/privacy/html-policy-content.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var array $sections
4
+ */
5
+ ?>
6
+ <div class="wp-suggested-text">
7
+ <?php do_action( 'yith_plugin_fw_privacy_guide_content_before' ); ?>
8
+
9
+ <?php
10
+ foreach ( $sections as $key => $section ) {
11
+ $action = "yith_plugin_fw_privacy_guide_content_{$key}";
12
+ $content = apply_filters( 'yith_plugin_fw_privacy_guide_content', '', $key );
13
+
14
+ if ( has_action( $action ) || !empty( $section[ 'tutorial' ] ) || !empty( $section[ 'description' ] ) || $content ) {
15
+ if ( !empty( $section[ 'title' ] ) ) {
16
+ echo "<h2>{$section['title']}</h2>";
17
+ }
18
+
19
+ if ( !empty( $section[ 'tutorial' ] ) ) {
20
+ echo "<p class='privacy-policy-tutorial'>{$section['tutorial']}</p>";
21
+ }
22
+
23
+ if ( !empty( $section[ 'description' ] ) ) {
24
+ echo "<p>{$section['description']}</p>";
25
+ }
26
+
27
+ if ( !empty( $content ) ) {
28
+ echo $content;
29
+ }
30
+ }
31
+
32
+ do_action( $action );
33
+ }
34
+ ?>
35
+
36
+ <?php do_action( 'yith_plugin_fw_privacy_guide_content_after' ); ?>
37
+ </div>
plugin-fw/templates/upgrade/changelog.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var string $plugin_name
11
+ * @var string $changelog
12
+ *
13
+ */
14
+ ?>
15
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
16
+ <head>
17
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
18
+ <meta name="viewport" content="width=device-width">
19
+ <meta name="robots" content="noindex,follow">
20
+ <title><?php echo $plugin_name ?> - Changelog</title>
21
+ <style type="text/css">
22
+ body {
23
+ background : #ffffff;
24
+ color : #444;
25
+ font-family : -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
26
+ font-size : 13px;
27
+ line-height : 1.4em;
28
+ padding : 10px;
29
+ }
30
+
31
+ h2.yith-plugin-changelog-title {
32
+ text-transform : uppercase;
33
+ font-size : 17px;
34
+ }
35
+
36
+ ul {
37
+ list-style : none;
38
+ padding : 0;
39
+ }
40
+
41
+ li {
42
+ display : list-item;
43
+ margin-bottom : 6px;
44
+ }
45
+ </style>
46
+ </head>
47
+ <body>
48
+ <h2 class='yith-plugin-changelog-title'><?php echo $plugin_name ?> - Changelog</h2>
49
+ <div class='yith-plugin-changelog'><?php echo $changelog ?></div>
50
+ </body>
51
+ </html>
plugin-fw/templates/upgrade/error.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var string $plugin_name
11
+ * @var string $changelog
12
+ *
13
+ */
14
+ ?>
15
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
16
+ <head>
17
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
18
+ <meta name="viewport" content="width=device-width">
19
+ <meta name="robots" content="noindex,follow">
20
+ <title>WordPress › Error</title>
21
+ <style type="text/css">
22
+ html {
23
+ background : #f1f1f1;
24
+ }
25
+
26
+ .container {
27
+ background : #fff;
28
+ color : #444;
29
+ font-family : -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
30
+ margin : 2em auto;
31
+ padding : 1em 2em;
32
+ max-width : 700px;
33
+ -webkit-box-shadow : 0 1px 3px rgba(0, 0, 0, 0.13);
34
+ box-shadow : 0 1px 3px rgba(0, 0, 0, 0.13);
35
+ }
36
+
37
+ h1 {
38
+ border-bottom : 1px solid #dadada;
39
+ clear : both;
40
+ color : #666;
41
+ font-size : 24px;
42
+ margin : 30px 0 0 0;
43
+ padding : 0;
44
+ padding-bottom : 7px;
45
+ }
46
+
47
+ #error {
48
+ margin-top : 50px;
49
+ }
50
+
51
+ #error p {
52
+ font-size : 14px;
53
+ line-height : 1.5;
54
+ margin : 25px 0 20px;
55
+ }
56
+
57
+ #error code {
58
+ font-family : Consolas, Monaco, monospace;
59
+ }
60
+
61
+ ul li {
62
+ margin-bottom : 10px;
63
+ font-size : 14px;
64
+ }
65
+
66
+ a {
67
+ color : #0073aa;
68
+ }
69
+
70
+ a:hover,
71
+ a:active {
72
+ color : #00a0d2;
73
+ }
74
+
75
+ a:focus {
76
+ color : #124964;
77
+ -webkit-box-shadow : 0 0 0 1px #5b9dd9,
78
+ 0 0 2px 1px rgba(30, 140, 190, .8);
79
+ box-shadow : 0 0 0 1px #5b9dd9,
80
+ 0 0 2px 1px rgba(30, 140, 190, .8);
81
+ outline : none;
82
+ }
83
+
84
+ .button {
85
+ background : #f7f7f7;
86
+ border : 1px solid #ccc;
87
+ color : #555;
88
+ display : inline-block;
89
+ text-decoration : none;
90
+ font-size : 13px;
91
+ line-height : 26px;
92
+ height : 28px;
93
+ margin : 0;
94
+ padding : 0 10px 1px;
95
+ cursor : pointer;
96
+ -webkit-border-radius : 3px;
97
+ -webkit-appearance : none;
98
+ border-radius : 3px;
99
+ white-space : nowrap;
100
+ -webkit-box-sizing : border-box;
101
+ -moz-box-sizing : border-box;
102
+ box-sizing : border-box;
103
+
104
+ -webkit-box-shadow : 0 1px 0 #ccc;
105
+ box-shadow : 0 1px 0 #ccc;
106
+ vertical-align : top;
107
+ }
108
+
109
+ .button.button-large {
110
+ height : 30px;
111
+ line-height : 28px;
112
+ padding : 0 12px 2px;
113
+ }
114
+
115
+ .button:hover,
116
+ .button:focus {
117
+ background : #fafafa;
118
+ border-color : #999;
119
+ color : #23282d;
120
+ }
121
+
122
+ .button:focus {
123
+ border-color : #5b9dd9;
124
+ -webkit-box-shadow : 0 0 3px rgba(0, 115, 170, .8);
125
+ box-shadow : 0 0 3px rgba(0, 115, 170, .8);
126
+ outline : none;
127
+ }
128
+
129
+ .button:active {
130
+ background : #eee;
131
+ border-color : #999;
132
+ -webkit-box-shadow : inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
133
+ box-shadow : inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
134
+ -webkit-transform : translateY(1px);
135
+ -ms-transform : translateY(1px);
136
+ transform : translateY(1px);
137
+ }
138
+
139
+ </style>
140
+ </head>
141
+ <body>
142
+ <div id="error" class="container">
143
+ <p><?php echo $error ?></p>
144
+ </div>
145
+
146
+ </body>
147
+ </html>
plugin-fw/yit-plugin.php CHANGED
@@ -37,6 +37,8 @@ include_once( 'lib/yit-pointers.php');
37
  include_once( 'lib/yit-icons.php');
38
  include_once( 'lib/yit-assets.php');
39
  include_once( 'lib/yit-debug.php');
 
 
40
 
41
  // load from theme folder...
42
  load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' )
37
  include_once( 'lib/yit-icons.php');
38
  include_once( 'lib/yit-assets.php');
39
  include_once( 'lib/yit-debug.php');
40
+ include_once( 'lib/privacy/yit-privacy.php' );
41
+ include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
42
 
43
  // load from theme folder...
44
  load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' )
plugin-options/general-options.php CHANGED
@@ -1,145 +1,145 @@
1
- <?php
2
- /**
3
- * Main admin class
4
- *
5
- * @author Your Inspiration Themes
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
- 'std' => 'button',
28
- 'default' => 'button',
29
- 'type' => 'select',
30
- 'class' => 'wc-enhanced-select',
31
- 'options' => array(
32
- 'link' => __( 'Link', 'yith-woocommerce-compare' ),
33
- 'button' => __( 'Button', 'yith-woocommerce-compare' )
34
- )
35
- ),
36
-
37
- array(
38
- 'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
39
- 'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
40
- 'id' => 'yith_woocompare_button_text',
41
- 'std' => __( 'Compare', 'yith-woocommerce-compare' ),
42
- 'default' => __( 'Compare', 'yith-woocommerce-compare' ),
43
- 'type' => 'text'
44
- ),
45
-
46
- array(
47
- 'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
48
- 'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
49
- 'id' => 'yith_woocompare_compare_button_in_product_page',
50
- 'std' => 'yes',
51
- 'default' => 'yes',
52
- 'type' => 'checkbox'
53
- ),
54
-
55
- array(
56
- 'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
57
- 'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
58
- 'id' => 'yith_woocompare_compare_button_in_products_list',
59
- 'std' => 'no',
60
- 'default' => 'no',
61
- 'type' => 'checkbox'
62
- ),
63
-
64
- array(
65
- 'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
66
- 'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
67
- 'id' => 'yith_woocompare_auto_open',
68
- 'std' => 'yes',
69
- 'default' => 'yes',
70
- 'type' => 'checkbox'
71
- ),
72
-
73
- array(
74
- 'type' => 'sectionend',
75
- 'id' => 'yith_woocompare_general_end'
76
- ),
77
-
78
- array(
79
- 'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
80
- 'type' => 'title',
81
- 'desc' => '',
82
- 'id' => 'yith_woocompare_table'
83
- ),
84
-
85
- array(
86
- 'name' => __( 'Table title', 'yith-woocommerce-compare' ),
87
- 'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
88
- 'id' => 'yith_woocompare_table_text',
89
- 'std' => __( 'Compare products', 'yith-woocommerce-compare' ),
90
- 'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
91
- 'type' => 'text'
92
- ),
93
-
94
- array(
95
- 'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
96
- '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' ),
97
- 'id' => 'yith_woocompare_fields_attrs',
98
- 'std' => 'all',
99
- 'default' => 'all',
100
- 'type' => 'woocompare_attributes'
101
- ),
102
-
103
- array(
104
- 'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
105
- 'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
106
- 'id' => 'yith_woocompare_price_end',
107
- 'std' => 'yes',
108
- 'default' => 'yes',
109
- 'type' => 'checkbox'
110
- ),
111
-
112
- array(
113
- 'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
114
- 'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
115
- 'id' => 'yith_woocompare_add_to_cart_end',
116
- 'std' => 'no',
117
- 'default' => 'no',
118
- 'type' => 'checkbox'
119
- ),
120
-
121
- array(
122
- 'name' => __( 'Image size', 'yith-woocommerce-compare' ),
123
- 'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
124
- 'id' => 'yith_woocompare_image_size',
125
- 'type' => 'woocompare_image_width',
126
- 'default' => array(
127
- 'width' => 220,
128
- 'height' => 154,
129
- 'crop' => 1
130
- ),
131
- 'std' => array(
132
- 'width' => 220,
133
- 'height' => 154,
134
- 'crop' => 1
135
- )
136
- ),
137
-
138
- array(
139
- 'type' => 'sectionend',
140
- 'id' => 'yith_woocompare_table_end'
141
- )
142
- )
143
- );
144
-
145
- return apply_filters( 'yith_woocompare_general_settings', $options );
1
+ <?php
2
+ /**
3
+ * Main admin class
4
+ *
5
+ * @author Your Inspiration Themes
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
+ 'std' => 'button',
28
+ 'default' => 'button',
29
+ 'type' => 'select',
30
+ 'class' => 'wc-enhanced-select',
31
+ 'options' => array(
32
+ 'link' => __( 'Link', 'yith-woocommerce-compare' ),
33
+ 'button' => __( 'Button', 'yith-woocommerce-compare' )
34
+ )
35
+ ),
36
+
37
+ array(
38
+ 'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
39
+ 'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
40
+ 'id' => 'yith_woocompare_button_text',
41
+ 'std' => __( 'Compare', 'yith-woocommerce-compare' ),
42
+ 'default' => __( 'Compare', 'yith-woocommerce-compare' ),
43
+ 'type' => 'text'
44
+ ),
45
+
46
+ array(
47
+ 'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
48
+ 'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
49
+ 'id' => 'yith_woocompare_compare_button_in_product_page',
50
+ 'std' => 'yes',
51
+ 'default' => 'yes',
52
+ 'type' => 'checkbox'
53
+ ),
54
+
55
+ array(
56
+ 'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
57
+ 'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
58
+ 'id' => 'yith_woocompare_compare_button_in_products_list',
59
+ 'std' => 'no',
60
+ 'default' => 'no',
61
+ 'type' => 'checkbox'
62
+ ),
63
+
64
+ array(
65
+ 'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
66
+ 'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
67
+ 'id' => 'yith_woocompare_auto_open',
68
+ 'std' => 'yes',
69
+ 'default' => 'yes',
70
+ 'type' => 'checkbox'
71
+ ),
72
+
73
+ array(
74
+ 'type' => 'sectionend',
75
+ 'id' => 'yith_woocompare_general_end'
76
+ ),
77
+
78
+ array(
79
+ 'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
80
+ 'type' => 'title',
81
+ 'desc' => '',
82
+ 'id' => 'yith_woocompare_table'
83
+ ),
84
+
85
+ array(
86
+ 'name' => __( 'Table title', 'yith-woocommerce-compare' ),
87
+ 'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
88
+ 'id' => 'yith_woocompare_table_text',
89
+ 'std' => __( 'Compare products', 'yith-woocommerce-compare' ),
90
+ 'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
91
+ 'type' => 'text'
92
+ ),
93
+
94
+ array(
95
+ 'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
96
+ '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' ),
97
+ 'id' => 'yith_woocompare_fields_attrs',
98
+ 'std' => 'all',
99
+ 'default' => 'all',
100
+ 'type' => 'woocompare_attributes'
101
+ ),
102
+
103
+ array(
104
+ 'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
105
+ 'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
106
+ 'id' => 'yith_woocompare_price_end',
107
+ 'std' => 'yes',
108
+ 'default' => 'yes',
109
+ 'type' => 'checkbox'
110
+ ),
111
+
112
+ array(
113
+ 'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
114
+ 'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
115
+ 'id' => 'yith_woocompare_add_to_cart_end',
116
+ 'std' => 'no',
117
+ 'default' => 'no',
118
+ 'type' => 'checkbox'
119
+ ),
120
+
121
+ array(
122
+ 'name' => __( 'Image size', 'yith-woocommerce-compare' ),
123
+ 'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
124
+ 'id' => 'yith_woocompare_image_size',
125
+ 'type' => 'woocompare_image_width',
126
+ 'default' => array(
127
+ 'width' => 220,
128
+ 'height' => 154,
129
+ 'crop' => 1
130
+ ),
131
+ 'std' => array(
132
+ 'width' => 220,
133
+ 'height' => 154,
134
+ 'crop' => 1
135
+ )
136
+ ),
137
+
138
+ array(
139
+ 'type' => 'sectionend',
140
+ 'id' => 'yith_woocompare_table_end'
141
+ )
142
+ )
143
+ );
144
+
145
+ return apply_filters( 'yith_woocompare_general_settings', $options );
plugin-options/premium-options.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- /**
3
- * Main admin class
4
- *
5
- * @author Your Inspiration Themes
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
+ * Main admin class
4
+ *
5
+ * @author Your Inspiration Themes
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;
templates/admin/premium.php CHANGED
@@ -1,430 +1,430 @@
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
- }
50
-
51
- .section-title{
52
- display: table;
53
- }
54
-
55
- .section h3 {
56
- font-size: 14px;
57
- line-height: 28px;
58
- margin-bottom: 0;
59
- display: block;
60
- }
61
-
62
- .section p{
63
- font-size: 13px;
64
- margin: 25px 0;
65
- }
66
- .section ul li{
67
- margin-bottom: 4px;
68
- }
69
- .landing-container{
70
- max-width: 750px;
71
- margin-left: auto;
72
- margin-right: auto;
73
- padding: 50px 0 30px;
74
- }
75
- .landing-container:after{
76
- display: block;
77
- clear: both;
78
- content: '';
79
- }
80
- .landing-container .col-1,
81
- .landing-container .col-2{
82
- float: left;
83
- box-sizing: border-box;
84
- padding: 0 15px;
85
- }
86
- .landing-container .col-1 img{
87
- width: 100%;
88
- }
89
- .landing-container .col-1{
90
- width: 55%;
91
- }
92
- .landing-container .col-2{
93
- width: 45%;
94
- }
95
- .premium-cta{
96
- background-color: #808a97;
97
- color: #fff;
98
- border-radius: 6px;
99
- padding: 20px 15px;
100
- }
101
- .premium-cta:after{
102
- content: '';
103
- display: block;
104
- clear: both;
105
- }
106
- .premium-cta p{
107
- margin: 7px 0;
108
- font-size: 14px;
109
- font-weight: 500;
110
- display: inline-block;
111
- width: 60%;
112
- }
113
- .premium-cta a.button{
114
- border-radius: 6px;
115
- height: 60px;
116
- float: right;
117
- background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
118
- border-color: #ff643f;
119
- box-shadow: none;
120
- outline: none;
121
- color: #fff;
122
- position: relative;
123
- padding: 9px 50px 9px 70px;
124
- }
125
- .premium-cta a.button:hover,
126
- .premium-cta a.button:active,
127
- .premium-cta a.button:focus{
128
- color: #fff;
129
- background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
130
- border-color: #971d00;
131
- box-shadow: none;
132
- outline: none;
133
- }
134
- .premium-cta a.button:focus{
135
- top: 1px;
136
- }
137
- .premium-cta a.button span{
138
- line-height: 13px;
139
- }
140
- .premium-cta a.button .highlight{
141
- display: block;
142
- font-size: 20px;
143
- font-weight: 700;
144
- line-height: 20px;
145
- }
146
- .premium-cta .highlight{
147
- text-transform: uppercase;
148
- background: none;
149
- font-weight: 800;
150
- color: #fff;
151
- }
152
-
153
- .section.one{
154
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
155
- }
156
- .section.two{
157
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-bg.png) no-repeat #fff; background-position: 15% 75%
158
- }
159
- .section.three{
160
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
161
- }
162
- .section.four{
163
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-bg.png) no-repeat #fff; background-position: 15% 75%
164
- }
165
- .section.five{
166
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
167
- }
168
- .section.six{
169
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-bg.png) no-repeat #fff; background-position: 15% 75%
170
- }
171
- .section.seven{
172
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
173
- }
174
- .section.eight{
175
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-bg.png) no-repeat #fff; background-position: 15% 75%
176
- }
177
- .section.eleven{
178
- background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
179
- }
180
-
181
- @media (max-width: 768px) {
182
- .section{margin: 0}
183
- .premium-cta p{
184
- width: 100%;
185
- }
186
- .premium-cta{
187
- text-align: center;
188
- }
189
- .premium-cta a.button{
190
- float: none;
191
- }
192
- }
193
-
194
- @media (max-width: 480px){
195
- .wrap{
196
- margin-right: 0;
197
- }
198
- .section{
199
- margin: 0;
200
- }
201
- .landing-container .col-1,
202
- .landing-container .col-2{
203
- width: 100%;
204
- padding: 0 15px;
205
- }
206
- .section-odd .col-1 {
207
- float: left;
208
- margin-right: -100%;
209
- }
210
- .section-odd .col-2 {
211
- float: right;
212
- margin-top: 65%;
213
- }
214
- }
215
-
216
- @media (max-width: 320px){
217
- .premium-cta a.button{
218
- padding: 9px 20px 9px 70px;
219
- }
220
-
221
- .section .section-title img{
222
- display: none;
223
- }
224
- }
225
- </style>
226
- <div class="landing">
227
- <div class="section section-cta section-odd">
228
- <div class="landing-container">
229
- <div class="premium-cta">
230
- <p>
231
- <?php echo sprintf( __('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>' );?>
232
- </p>
233
- <a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
234
- <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare' ); ?></span>
235
- <span><?php _e('to the premium version','yith-woocommerce-compare' ); ?></span>
236
- </a>
237
- </div>
238
- </div>
239
- </div>
240
- <div class="one section section-even clear">
241
- <h1><?php _e('Premium Features','yith-woocommerce-compare');?></h1>
242
- <div class="landing-container">
243
- <div class="col-1">
244
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01.png" alt="Dedicated Page" />
245
- </div>
246
- <div class="col-2">
247
- <div class="section-title">
248
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-icon.png" alt="icon 01"/>
249
- <h2><?php _e('A DEDICATED PAGE','yith-woocommerce-compare' ); ?></h2>
250
- </div>
251
- <p>
252
- <?php echo sprintf(__('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>');?>
253
- </p>
254
- </div>
255
- </div>
256
- </div>
257
- <div class="two section section-odd clear">
258
- <div class="landing-container">
259
- <div class="col-2">
260
- <div class="section-title">
261
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-icon.png" alt="icon 02" />
262
- <h2><?php _e('CATEGORY COMPARATION','yith-woocommerce-compare');?></h2>
263
- </div>
264
- <p>
265
- <?php echo sprintf( __( '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>');?>
266
- </p>
267
- </div>
268
- <div class="col-1">
269
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
270
- </div>
271
- </div>
272
- </div>
273
- <div class="three section section-even clear">
274
- <div class="landing-container">
275
- <div class="col-1">
276
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03.png" alt="Category esclusion" />
277
- </div>
278
- <div class="col-2">
279
- <div class="section-title">
280
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-icon.png" alt="icon 03" />
281
- <h2><?php _e( 'CATEGORY EXCLUSION ','yith-woocommerce-compare');?></h2>
282
- </div>
283
- <p>
284
- <?php echo sprintf(__('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>');?>
285
- </p>
286
- </div>
287
- </div>
288
- </div>
289
- <div class="four section section-odd clear">
290
- <div class="landing-container">
291
- <div class="col-2">
292
- <div class="section-title">
293
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-icon.png" alt="icon 04" />
294
- <h2><?php _e('TABLE IMAGE','yith-woocommerce-compare');?></h2>
295
- </div>
296
- <p>
297
- <?php echo sprintf(__('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>');?>
298
- </p>
299
- </div>
300
- <div class="col-1">
301
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04.png" alt="Shortcode" />
302
- </div>
303
- </div>
304
- </div>
305
- <div class="five section section-even clear">
306
- <div class="landing-container">
307
- <div class="col-1">
308
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05.png" alt="Dynamic fields" />
309
- </div>
310
- <div class="col-2">
311
- <div class="section-title">
312
- <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/05-icon.png" alt="icon 05" />
313
- <h2><?php _e('DYNAMIC FIELDS','yith-woocommerce-compare');?></h2>
314
- </div>
315
- <p>
316
- <?php echo sprintf( __('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>'); ?>
317
- </p>
318
- </div>
319
- </div>
320
- </div>
321
- <div class="six section section-odd clear">
322
- <div class="landing-container">
323
- <div class="col-2">
324
- <div class="section-title">
325
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-icon.png" alt="icon 06" />
326
- <h2><?php _e('SOCIAL NETWORK SHARING','yith-woocommerce-compare');?></h2>
327
- </div>
328
- <p>
329
- <?php echo sprintf( __( '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>' ) ?>
330
- </p>
331
- </div>
332
- <div class="col-1">
333
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06.png" alt="Social networks" />
334
- </div>
335
- </div>
336
- </div>
337
- <div class="seven section section-even clear">
338
- <div class="landing-container">
339
- <div class="col-1">
340
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07.png" alt="Related products" />
341
- </div>
342
- <div class="col-2">
343
- <div class="section-title">
344
- <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/07-icon.png" alt="icon 05" />
345
- <h2><?php _e('RELATED PRODUCTS','yith-woocommerce-compare');?></h2>
346
- </div>
347
- <p>
348
- <?php echo sprintf( __('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>'); ?>
349
- </p>
350
- </div>
351
- </div>
352
- </div>
353
- <div class="six section section-odd clear">
354
- <div class="landing-container">
355
- <div class="col-2">
356
- <div class="section-title">
357
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-icon.png" alt="icon 06" />
358
- <h2><?php _e('CUSTOMIZABLE STYLE','yith-woocommerce-compare');?></h2>
359
- </div>
360
- <p>
361
- <?php echo sprintf( __( '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>' ) ?>
362
- </p>
363
- </div>
364
- <div class="col-1">
365
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08.png" alt="Social networks" />
366
- </div>
367
- </div>
368
- </div>
369
- <div class="seven section section-even clear">
370
- <div class="landing-container">
371
- <div class="col-1">
372
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09.png" alt="Related products" />
373
- </div>
374
- <div class="col-2">
375
- <div class="section-title">
376
- <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/09-icon.png" alt="icon 09" />
377
- <h2><?php _e('CUSTOMIZED ATTRIBUTES','yith-woocommerce-compare');?></h2>
378
- </div>
379
- <p>
380
- <?php echo sprintf( __('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>'); ?>
381
- </p>
382
- </div>
383
- </div>
384
- </div>
385
- <div class="six section section-odd clear">
386
- <div class="landing-container">
387
- <div class="col-2">
388
- <div class="section-title">
389
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-icon.png" alt="icon 10" />
390
- <h2><?php _e('A TAILORED TABLE','yith-woocommerce-compare');?></h2>
391
- </div>
392
- <p>
393
- <?php echo sprintf( __( '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>' ) ?>
394
- </p>
395
- </div>
396
- <div class="col-1">
397
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10.png" alt="Social networks" />
398
- </div>
399
- </div>
400
- </div>
401
- <div class="eleven section section-even clear">
402
- <div class="landing-container">
403
- <div class="col-1">
404
- <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11.png" alt="Widget" />
405
- </div>
406
- <div class="col-2">
407
- <div class="section-title">
408
- <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/11-icon.png" alt="icon 11" />
409
- <h2><?php _e('WIDGET','yith-woocommerce-compare');?></h2>
410
- </div>
411
- <p>
412
- <?php echo sprintf( __('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>'); ?>
413
- </p>
414
- </div>
415
- </div>
416
- </div>
417
- <div class="section section-cta section-odd">
418
- <div class="landing-container">
419
- <div class="premium-cta">
420
- <p>
421
- <?php echo sprintf( __('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>' );?>
422
- </p>
423
- <a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
424
- <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare');?></span>
425
- <span><?php _e('to the premium version','yith-woocommerce-compare');?></span>
426
- </a>
427
- </div>
428
- </div>
429
- </div>
430
  </div>
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
+ }
50
+
51
+ .section-title{
52
+ display: table;
53
+ }
54
+
55
+ .section h3 {
56
+ font-size: 14px;
57
+ line-height: 28px;
58
+ margin-bottom: 0;
59
+ display: block;
60
+ }
61
+
62
+ .section p{
63
+ font-size: 13px;
64
+ margin: 25px 0;
65
+ }
66
+ .section ul li{
67
+ margin-bottom: 4px;
68
+ }
69
+ .landing-container{
70
+ max-width: 750px;
71
+ margin-left: auto;
72
+ margin-right: auto;
73
+ padding: 50px 0 30px;
74
+ }
75
+ .landing-container:after{
76
+ display: block;
77
+ clear: both;
78
+ content: '';
79
+ }
80
+ .landing-container .col-1,
81
+ .landing-container .col-2{
82
+ float: left;
83
+ box-sizing: border-box;
84
+ padding: 0 15px;
85
+ }
86
+ .landing-container .col-1 img{
87
+ width: 100%;
88
+ }
89
+ .landing-container .col-1{
90
+ width: 55%;
91
+ }
92
+ .landing-container .col-2{
93
+ width: 45%;
94
+ }
95
+ .premium-cta{
96
+ background-color: #808a97;
97
+ color: #fff;
98
+ border-radius: 6px;
99
+ padding: 20px 15px;
100
+ }
101
+ .premium-cta:after{
102
+ content: '';
103
+ display: block;
104
+ clear: both;
105
+ }
106
+ .premium-cta p{
107
+ margin: 7px 0;
108
+ font-size: 14px;
109
+ font-weight: 500;
110
+ display: inline-block;
111
+ width: 60%;
112
+ }
113
+ .premium-cta a.button{
114
+ border-radius: 6px;
115
+ height: 60px;
116
+ float: right;
117
+ background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
118
+ border-color: #ff643f;
119
+ box-shadow: none;
120
+ outline: none;
121
+ color: #fff;
122
+ position: relative;
123
+ padding: 9px 50px 9px 70px;
124
+ }
125
+ .premium-cta a.button:hover,
126
+ .premium-cta a.button:active,
127
+ .premium-cta a.button:focus{
128
+ color: #fff;
129
+ background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
130
+ border-color: #971d00;
131
+ box-shadow: none;
132
+ outline: none;
133
+ }
134
+ .premium-cta a.button:focus{
135
+ top: 1px;
136
+ }
137
+ .premium-cta a.button span{
138
+ line-height: 13px;
139
+ }
140
+ .premium-cta a.button .highlight{
141
+ display: block;
142
+ font-size: 20px;
143
+ font-weight: 700;
144
+ line-height: 20px;
145
+ }
146
+ .premium-cta .highlight{
147
+ text-transform: uppercase;
148
+ background: none;
149
+ font-weight: 800;
150
+ color: #fff;
151
+ }
152
+
153
+ .section.one{
154
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
155
+ }
156
+ .section.two{
157
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-bg.png) no-repeat #fff; background-position: 15% 75%
158
+ }
159
+ .section.three{
160
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
161
+ }
162
+ .section.four{
163
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-bg.png) no-repeat #fff; background-position: 15% 75%
164
+ }
165
+ .section.five{
166
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
167
+ }
168
+ .section.six{
169
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-bg.png) no-repeat #fff; background-position: 15% 75%
170
+ }
171
+ .section.seven{
172
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
173
+ }
174
+ .section.eight{
175
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-bg.png) no-repeat #fff; background-position: 15% 75%
176
+ }
177
+ .section.eleven{
178
+ background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
179
+ }
180
+
181
+ @media (max-width: 768px) {
182
+ .section{margin: 0}
183
+ .premium-cta p{
184
+ width: 100%;
185
+ }
186
+ .premium-cta{
187
+ text-align: center;
188
+ }
189
+ .premium-cta a.button{
190
+ float: none;
191
+ }
192
+ }
193
+
194
+ @media (max-width: 480px){
195
+ .wrap{
196
+ margin-right: 0;
197
+ }
198
+ .section{
199
+ margin: 0;
200
+ }
201
+ .landing-container .col-1,
202
+ .landing-container .col-2{
203
+ width: 100%;
204
+ padding: 0 15px;
205
+ }
206
+ .section-odd .col-1 {
207
+ float: left;
208
+ margin-right: -100%;
209
+ }
210
+ .section-odd .col-2 {
211
+ float: right;
212
+ margin-top: 65%;
213
+ }
214
+ }
215
+
216
+ @media (max-width: 320px){
217
+ .premium-cta a.button{
218
+ padding: 9px 20px 9px 70px;
219
+ }
220
+
221
+ .section .section-title img{
222
+ display: none;
223
+ }
224
+ }
225
+ </style>
226
+ <div class="landing">
227
+ <div class="section section-cta section-odd">
228
+ <div class="landing-container">
229
+ <div class="premium-cta">
230
+ <p>
231
+ <?php echo sprintf( __('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>' );?>
232
+ </p>
233
+ <a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
234
+ <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare' ); ?></span>
235
+ <span><?php _e('to the premium version','yith-woocommerce-compare' ); ?></span>
236
+ </a>
237
+ </div>
238
+ </div>
239
+ </div>
240
+ <div class="one section section-even clear">
241
+ <h1><?php _e('Premium Features','yith-woocommerce-compare');?></h1>
242
+ <div class="landing-container">
243
+ <div class="col-1">
244
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01.png" alt="Dedicated Page" />
245
+ </div>
246
+ <div class="col-2">
247
+ <div class="section-title">
248
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-icon.png" alt="icon 01"/>
249
+ <h2><?php _e('A DEDICATED PAGE','yith-woocommerce-compare' ); ?></h2>
250
+ </div>
251
+ <p>
252
+ <?php echo sprintf(__('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>');?>
253
+ </p>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ <div class="two section section-odd clear">
258
+ <div class="landing-container">
259
+ <div class="col-2">
260
+ <div class="section-title">
261
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-icon.png" alt="icon 02" />
262
+ <h2><?php _e('CATEGORY COMPARATION','yith-woocommerce-compare');?></h2>
263
+ </div>
264
+ <p>
265
+ <?php echo sprintf( __( '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>');?>
266
+ </p>
267
+ </div>
268
+ <div class="col-1">
269
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
270
+ </div>
271
+ </div>
272
+ </div>
273
+ <div class="three section section-even clear">
274
+ <div class="landing-container">
275
+ <div class="col-1">
276
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03.png" alt="Category esclusion" />
277
+ </div>
278
+ <div class="col-2">
279
+ <div class="section-title">
280
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-icon.png" alt="icon 03" />
281
+ <h2><?php _e( 'CATEGORY EXCLUSION ','yith-woocommerce-compare');?></h2>
282
+ </div>
283
+ <p>
284
+ <?php echo sprintf(__('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>');?>
285
+ </p>
286
+ </div>
287
+ </div>
288
+ </div>
289
+ <div class="four section section-odd clear">
290
+ <div class="landing-container">
291
+ <div class="col-2">
292
+ <div class="section-title">
293
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-icon.png" alt="icon 04" />
294
+ <h2><?php _e('TABLE IMAGE','yith-woocommerce-compare');?></h2>
295
+ </div>
296
+ <p>
297
+ <?php echo sprintf(__('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>');?>
298
+ </p>
299
+ </div>
300
+ <div class="col-1">
301
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04.png" alt="Shortcode" />
302
+ </div>
303
+ </div>
304
+ </div>
305
+ <div class="five section section-even clear">
306
+ <div class="landing-container">
307
+ <div class="col-1">
308
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05.png" alt="Dynamic fields" />
309
+ </div>
310
+ <div class="col-2">
311
+ <div class="section-title">
312
+ <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/05-icon.png" alt="icon 05" />
313
+ <h2><?php _e('DYNAMIC FIELDS','yith-woocommerce-compare');?></h2>
314
+ </div>
315
+ <p>
316
+ <?php echo sprintf( __('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>'); ?>
317
+ </p>
318
+ </div>
319
+ </div>
320
+ </div>
321
+ <div class="six section section-odd clear">
322
+ <div class="landing-container">
323
+ <div class="col-2">
324
+ <div class="section-title">
325
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-icon.png" alt="icon 06" />
326
+ <h2><?php _e('SOCIAL NETWORK SHARING','yith-woocommerce-compare');?></h2>
327
+ </div>
328
+ <p>
329
+ <?php echo sprintf( __( '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>' ) ?>
330
+ </p>
331
+ </div>
332
+ <div class="col-1">
333
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06.png" alt="Social networks" />
334
+ </div>
335
+ </div>
336
+ </div>
337
+ <div class="seven section section-even clear">
338
+ <div class="landing-container">
339
+ <div class="col-1">
340
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07.png" alt="Related products" />
341
+ </div>
342
+ <div class="col-2">
343
+ <div class="section-title">
344
+ <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/07-icon.png" alt="icon 05" />
345
+ <h2><?php _e('RELATED PRODUCTS','yith-woocommerce-compare');?></h2>
346
+ </div>
347
+ <p>
348
+ <?php echo sprintf( __('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>'); ?>
349
+ </p>
350
+ </div>
351
+ </div>
352
+ </div>
353
+ <div class="six section section-odd clear">
354
+ <div class="landing-container">
355
+ <div class="col-2">
356
+ <div class="section-title">
357
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-icon.png" alt="icon 06" />
358
+ <h2><?php _e('CUSTOMIZABLE STYLE','yith-woocommerce-compare');?></h2>
359
+ </div>
360
+ <p>
361
+ <?php echo sprintf( __( '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>' ) ?>
362
+ </p>
363
+ </div>
364
+ <div class="col-1">
365
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08.png" alt="Social networks" />
366
+ </div>
367
+ </div>
368
+ </div>
369
+ <div class="seven section section-even clear">
370
+ <div class="landing-container">
371
+ <div class="col-1">
372
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09.png" alt="Related products" />
373
+ </div>
374
+ <div class="col-2">
375
+ <div class="section-title">
376
+ <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/09-icon.png" alt="icon 09" />
377
+ <h2><?php _e('CUSTOMIZED ATTRIBUTES','yith-woocommerce-compare');?></h2>
378
+ </div>
379
+ <p>
380
+ <?php echo sprintf( __('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>'); ?>
381
+ </p>
382
+ </div>
383
+ </div>
384
+ </div>
385
+ <div class="six section section-odd clear">
386
+ <div class="landing-container">
387
+ <div class="col-2">
388
+ <div class="section-title">
389
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-icon.png" alt="icon 10" />
390
+ <h2><?php _e('A TAILORED TABLE','yith-woocommerce-compare');?></h2>
391
+ </div>
392
+ <p>
393
+ <?php echo sprintf( __( '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>' ) ?>
394
+ </p>
395
+ </div>
396
+ <div class="col-1">
397
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10.png" alt="Social networks" />
398
+ </div>
399
+ </div>
400
+ </div>
401
+ <div class="eleven section section-even clear">
402
+ <div class="landing-container">
403
+ <div class="col-1">
404
+ <img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11.png" alt="Widget" />
405
+ </div>
406
+ <div class="col-2">
407
+ <div class="section-title">
408
+ <img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/11-icon.png" alt="icon 11" />
409
+ <h2><?php _e('WIDGET','yith-woocommerce-compare');?></h2>
410
+ </div>
411
+ <p>
412
+ <?php echo sprintf( __('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>'); ?>
413
+ </p>
414
+ </div>
415
+ </div>
416
+ </div>
417
+ <div class="section section-cta section-odd">
418
+ <div class="landing-container">
419
+ <div class="premium-cta">
420
+ <p>
421
+ <?php echo sprintf( __('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>' );?>
422
+ </p>
423
+ <a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
424
+ <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare');?></span>
425
+ <span><?php _e('to the premium version','yith-woocommerce-compare');?></span>
426
+ </a>
427
+ </div>
428
+ </div>
429
+ </div>
430
  </div>
templates/compare.php CHANGED
@@ -1,282 +1,282 @@
1
- <?php
2
- /**
3
- * Woocommerce Compare page
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH Woocommerce Compare
7
- * @version 1.1.4
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-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.3', true );
16
- wp_enqueue_script( 'jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '1.3', true );
17
-
18
- $widths = array();
19
- foreach( $products as $product ) $widths[] = '{ "sWidth": "205px", resizeable:true }';
20
-
21
- $table_text = get_option( 'yith_woocompare_table_text' );
22
- do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text );
23
- $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text' );
24
-
25
- ?><!DOCTYPE html>
26
- <!--[if IE 6]>
27
- <html id="ie6" class="ie"<?php language_attributes() ?>>
28
- <![endif]-->
29
- <!--[if IE 7]>
30
- <html id="ie7" class="ie"<?php language_attributes() ?>>
31
- <![endif]-->
32
- <!--[if IE 8]>
33
- <html id="ie8" class="ie"<?php language_attributes() ?>>
34
- <![endif]-->
35
- <!--[if IE 9]>
36
- <html id="ie9" class="ie"<?php language_attributes() ?>>
37
- <![endif]-->
38
- <!--[if gt IE 9]>
39
- <html class="ie"<?php language_attributes() ?>>
40
- <![endif]-->
41
- <!--[if !IE]>
42
- <html <?php language_attributes() ?>>
43
- <![endif]-->
44
-
45
- <!-- START HEAD -->
46
- <head>
47
- <meta charset="<?php bloginfo( 'charset' ); ?>" />
48
- <meta name="viewport" content="width=device-width" />
49
- <title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
50
- <link rel="profile" href="http://gmpg.org/xfn/11" />
51
-
52
- <?php wp_head() ?>
53
-
54
- <?php do_action( 'yith_woocompare_popup_head' ) ?>
55
-
56
- <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" />
57
- <link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
58
- <link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/colorbox.css"/>
59
- <link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/jquery.dataTables.css"/>
60
-
61
- <style type="text/css">
62
- body.loading {
63
- background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
64
- }
65
- </style>
66
- </head>
67
- <!-- END HEAD -->
68
-
69
- <?php global $product; ?>
70
-
71
- <!-- START BODY -->
72
- <body <?php body_class('woocommerce') ?>>
73
-
74
- <h1>
75
- <?php echo $localized_table_text ?>
76
- <?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yith-woocommerce-compare' ) ?></a><?php endif; ?>
77
- </h1>
78
-
79
- <?php do_action( 'yith_woocompare_before_main_table' ); ?>
80
-
81
- <table class="compare-list" cellpadding="0" cellspacing="0"<?php if ( empty( $products ) ) echo ' style="width:100%"' ?>>
82
- <thead>
83
- <tr>
84
- <th>&nbsp;</th>
85
- <?php foreach( $products as $product_id => $product ) : ?>
86
- <td></td>
87
- <?php endforeach; ?>
88
- </tr>
89
- </thead>
90
- <tfoot>
91
- <tr>
92
- <th>&nbsp;</th>
93
- <?php foreach( $products as $product_id => $product ) : ?>
94
- <td></td>
95
- <?php endforeach; ?>
96
- </tr>
97
- </tfoot>
98
- <tbody>
99
-
100
- <?php if ( empty( $products ) ) : ?>
101
-
102
- <tr class="no-products">
103
- <td><?php _e( 'No products added in the compare table.', 'yith-woocommerce-compare' ) ?></td>
104
- </tr>
105
-
106
- <?php else : ?>
107
- <tr class="remove">
108
- <th>&nbsp;</th>
109
- <?php
110
- $index = 0;
111
- foreach( $products as $product_id => $product ) :
112
- $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
113
- <td class="<?php echo $product_class; ?>">
114
- <a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $product_id ) ) ?>" data-product_id="<?php echo $product_id; ?>"><?php _e( 'Remove', 'yith-woocommerce-compare' ) ?> <span class="remove">x</span></a>
115
- </td>
116
- <?php
117
- ++$index;
118
- endforeach;
119
- ?>
120
- </tr>
121
-
122
- <?php foreach ( $fields as $field => $name ) : ?>
123
-
124
- <tr class="<?php echo $field ?>">
125
-
126
- <th>
127
- <?php echo $name ?>
128
- <?php if ( $field == 'image' ) echo '<div class="fixed-th"></div>'; ?>
129
- </th>
130
-
131
- <?php
132
- $index = 0;
133
- foreach( $products as $product_id => $product ) :
134
- $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id; ?>
135
- <td class="<?php echo $product_class; ?>"><?php
136
- switch( $field ) {
137
-
138
- case 'image':
139
- echo '<div class="image-wrap">' . wp_get_attachment_image( $product->fields[$field], 'yith-woocompare-image' ) . '</div>';
140
- break;
141
-
142
- case 'add-to-cart':
143
- woocommerce_template_loop_add_to_cart();
144
- break;
145
-
146
- default:
147
- echo empty( $product->fields[$field] ) ? '&nbsp;' : $product->fields[$field];
148
- break;
149
- }
150
- ?>
151
- </td>
152
- <?php
153
- ++$index;
154
- endforeach; ?>
155
-
156
- </tr>
157
-
158
- <?php endforeach; ?>
159
-
160
- <?php if ( $repeat_price == 'yes' && isset( $fields['price'] ) ) : ?>
161
- <tr class="price repeated">
162
- <th><?php echo $fields['price'] ?></th>
163
-
164
- <?php
165
- $index = 0;
166
- foreach( $products as $product_id => $product ) :
167
- $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
168
- <td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
169
- <?php
170
- ++$index;
171
- endforeach; ?>
172
-
173
- </tr>
174
- <?php endif; ?>
175
-
176
- <?php if ( $repeat_add_to_cart == 'yes' && isset( $fields['add-to-cart'] ) ) : ?>
177
- <tr class="add-to-cart repeated">
178
- <th><?php echo $fields['add-to-cart'] ?></th>
179
-
180
- <?php
181
- $index = 0;
182
- foreach( $products as $product_id => $product ) :
183
- $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
184
- <td class="<?php echo $product_class ?>">
185
- <?php woocommerce_template_loop_add_to_cart(); ?>
186
- </td>
187
- <?php
188
- ++$index;
189
- endforeach; ?>
190
-
191
- </tr>
192
- <?php endif; ?>
193
-
194
- <?php endif; ?>
195
-
196
- </tbody>
197
- </table>
198
-
199
- <?php do_action( 'yith_woocompare_after_main_table' ); ?>
200
-
201
- <?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' ) ?>
202
- <?php print_footer_scripts(); ?>
203
-
204
- <script type="text/javascript">
205
-
206
- jQuery(document).ready(function($){
207
- $('a').attr('target', '_parent');
208
-
209
- var oTable;
210
- $('body').on( 'yith_woocompare_render_table', function(){
211
- if( $( window ).width() > 767 ) {
212
- oTable = $('table.compare-list').dataTable( {
213
- "sScrollX": "100%",
214
- //"sScrollXInner": "150%",
215
- "bScrollInfinite": true,
216
- "bScrollCollapse": true,
217
- "bPaginate": false,
218
- "bSort": false,
219
- "bInfo": false,
220
- "bFilter": false,
221
- "bAutoWidth": false
222
- } );
223
-
224
- new FixedColumns( oTable );
225
- $('<table class="compare-list" />').insertAfter( $('h1') ).hide();
226
- }
227
- }).trigger('yith_woocompare_render_table');
228
-
229
- // add to cart
230
- var redirect_to_cart = false,
231
- body = $('body');
232
-
233
- // close colorbox if redirect to cart is active after add to cart
234
- body.on( 'adding_to_cart', function ( $thisbutton, data ) {
235
- if( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) {
236
- wc_add_to_cart_params.cart_redirect_after_add = 'no';
237
- redirect_to_cart = true;
238
- }
239
- });
240
-
241
- body.on('wc_cart_button_updated', function( ev, button ){
242
- $('a.added_to_cart').attr('target', '_parent');
243
- });
244
-
245
- // remove add to cart button after added
246
- body.on('added_to_cart', function( ev, fragments, cart_hash, button ){
247
-
248
- $('a').attr('target', '_parent');
249
-
250
- if( redirect_to_cart == true ) {
251
- // redirect
252
- parent.window.location = wc_add_to_cart_params.cart_url;
253
- return;
254
- }
255
-
256
- // Replace fragments
257
- if ( fragments ) {
258
- $.each(fragments, function(key, value) {
259
- $(key, window.parent.document).replaceWith(value);
260
- });
261
- }
262
- });
263
-
264
- // close window
265
- $(document).on( 'click', 'a.close', function(e){
266
- e.preventDefault();
267
- window.close();
268
- });
269
-
270
- $(window).on( 'yith_woocompare_product_removed', function(){
271
- if( $( window ).width() > 767 ) {
272
- oTable.fnDestroy(true);
273
- }
274
- $('body').trigger('yith_woocompare_render_table');
275
- });
276
-
277
- });
278
-
279
- </script>
280
-
281
- </body>
282
  </html>
1
+ <?php
2
+ /**
3
+ * Woocommerce Compare page
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH Woocommerce Compare
7
+ * @version 1.1.4
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-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.3', true );
16
+ wp_enqueue_script( 'jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '1.3', true );
17
+
18
+ $widths = array();
19
+ foreach( $products as $product ) $widths[] = '{ "sWidth": "205px", resizeable:true }';
20
+
21
+ $table_text = get_option( 'yith_woocompare_table_text' );
22
+ do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text );
23
+ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text' );
24
+
25
+ ?><!DOCTYPE html>
26
+ <!--[if IE 6]>
27
+ <html id="ie6" class="ie"<?php language_attributes() ?>>
28
+ <![endif]-->
29
+ <!--[if IE 7]>
30
+ <html id="ie7" class="ie"<?php language_attributes() ?>>
31
+ <![endif]-->
32
+ <!--[if IE 8]>
33
+ <html id="ie8" class="ie"<?php language_attributes() ?>>
34
+ <![endif]-->
35
+ <!--[if IE 9]>
36
+ <html id="ie9" class="ie"<?php language_attributes() ?>>
37
+ <![endif]-->
38
+ <!--[if gt IE 9]>
39
+ <html class="ie"<?php language_attributes() ?>>
40
+ <![endif]-->
41
+ <!--[if !IE]>
42
+ <html <?php language_attributes() ?>>
43
+ <![endif]-->
44
+
45
+ <!-- START HEAD -->
46
+ <head>
47
+ <meta charset="<?php bloginfo( 'charset' ); ?>" />
48
+ <meta name="viewport" content="width=device-width" />
49
+ <title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
50
+ <link rel="profile" href="http://gmpg.org/xfn/11" />
51
+
52
+ <?php wp_head() ?>
53
+
54
+ <?php do_action( 'yith_woocompare_popup_head' ) ?>
55
+
56
+ <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" />
57
+ <link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
58
+ <link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/colorbox.css"/>
59
+ <link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/jquery.dataTables.css"/>
60
+
61
+ <style type="text/css">
62
+ body.loading {
63
+ background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
64
+ }
65
+ </style>
66
+ </head>
67
+ <!-- END HEAD -->
68
+
69
+ <?php global $product; ?>
70
+
71
+ <!-- START BODY -->
72
+ <body <?php body_class('woocommerce') ?>>
73
+
74
+ <h1>
75
+ <?php echo $localized_table_text ?>
76
+ <?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yith-woocommerce-compare' ) ?></a><?php endif; ?>
77
+ </h1>
78
+
79
+ <?php do_action( 'yith_woocompare_before_main_table' ); ?>
80
+
81
+ <table class="compare-list" cellpadding="0" cellspacing="0"<?php if ( empty( $products ) ) echo ' style="width:100%"' ?>>
82
+ <thead>
83
+ <tr>
84
+ <th>&nbsp;</th>
85
+ <?php foreach( $products as $product_id => $product ) : ?>
86
+ <td></td>
87
+ <?php endforeach; ?>
88
+ </tr>
89
+ </thead>
90
+ <tfoot>
91
+ <tr>
92
+ <th>&nbsp;</th>
93
+ <?php foreach( $products as $product_id => $product ) : ?>
94
+ <td></td>
95
+ <?php endforeach; ?>
96
+ </tr>
97
+ </tfoot>
98
+ <tbody>
99
+
100
+ <?php if ( empty( $products ) ) : ?>
101
+
102
+ <tr class="no-products">
103
+ <td><?php _e( 'No products added in the compare table.', 'yith-woocommerce-compare' ) ?></td>
104
+ </tr>
105
+
106
+ <?php else : ?>
107
+ <tr class="remove">
108
+ <th>&nbsp;</th>
109
+ <?php
110
+ $index = 0;
111
+ foreach( $products as $product_id => $product ) :
112
+ $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
113
+ <td class="<?php echo $product_class; ?>">
114
+ <a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $product_id ) ) ?>" data-product_id="<?php echo $product_id; ?>"><?php _e( 'Remove', 'yith-woocommerce-compare' ) ?> <span class="remove">x</span></a>
115
+ </td>
116
+ <?php
117
+ ++$index;
118
+ endforeach;
119
+ ?>
120
+ </tr>
121
+
122
+ <?php foreach ( $fields as $field => $name ) : ?>
123
+
124
+ <tr class="<?php echo $field ?>">
125
+
126
+ <th>
127
+ <?php echo $name ?>
128
+ <?php if ( $field == 'image' ) echo '<div class="fixed-th"></div>'; ?>
129
+ </th>
130
+
131
+ <?php
132
+ $index = 0;
133
+ foreach( $products as $product_id => $product ) :
134
+ $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id; ?>
135
+ <td class="<?php echo $product_class; ?>"><?php
136
+ switch( $field ) {
137
+
138
+ case 'image':
139
+ echo '<div class="image-wrap">' . wp_get_attachment_image( $product->fields[$field], 'yith-woocompare-image' ) . '</div>';
140
+ break;
141
+
142
+ case 'add-to-cart':
143
+ woocommerce_template_loop_add_to_cart();
144
+ break;
145
+
146
+ default:
147
+ echo empty( $product->fields[$field] ) ? '&nbsp;' : $product->fields[$field];
148
+ break;
149
+ }
150
+ ?>
151
+ </td>
152
+ <?php
153
+ ++$index;
154
+ endforeach; ?>
155
+
156
+ </tr>
157
+
158
+ <?php endforeach; ?>
159
+
160
+ <?php if ( $repeat_price == 'yes' && isset( $fields['price'] ) ) : ?>
161
+ <tr class="price repeated">
162
+ <th><?php echo $fields['price'] ?></th>
163
+
164
+ <?php
165
+ $index = 0;
166
+ foreach( $products as $product_id => $product ) :
167
+ $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
168
+ <td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
169
+ <?php
170
+ ++$index;
171
+ endforeach; ?>
172
+
173
+ </tr>
174
+ <?php endif; ?>
175
+
176
+ <?php if ( $repeat_add_to_cart == 'yes' && isset( $fields['add-to-cart'] ) ) : ?>
177
+ <tr class="add-to-cart repeated">
178
+ <th><?php echo $fields['add-to-cart'] ?></th>
179
+
180
+ <?php
181
+ $index = 0;
182
+ foreach( $products as $product_id => $product ) :
183
+ $product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
184
+ <td class="<?php echo $product_class ?>">
185
+ <?php woocommerce_template_loop_add_to_cart(); ?>
186
+ </td>
187
+ <?php
188
+ ++$index;
189
+ endforeach; ?>
190
+
191
+ </tr>
192
+ <?php endif; ?>
193
+
194
+ <?php endif; ?>
195
+
196
+ </tbody>
197
+ </table>
198
+
199
+ <?php do_action( 'yith_woocompare_after_main_table' ); ?>
200
+
201
+ <?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' ) ?>
202
+ <?php print_footer_scripts(); ?>
203
+
204
+ <script type="text/javascript">
205
+
206
+ jQuery(document).ready(function($){
207
+ $('a').attr('target', '_parent');
208
+
209
+ var oTable;
210
+ $('body').on( 'yith_woocompare_render_table', function(){
211
+ if( $( window ).width() > 767 ) {
212
+ oTable = $('table.compare-list').dataTable( {
213
+ "sScrollX": "100%",
214
+ //"sScrollXInner": "150%",
215
+ "bScrollInfinite": true,
216
+ "bScrollCollapse": true,
217
+ "bPaginate": false,
218
+ "bSort": false,
219
+ "bInfo": false,
220
+ "bFilter": false,
221
+ "bAutoWidth": false
222
+ } );
223
+
224
+ new FixedColumns( oTable );
225
+ $('<table class="compare-list" />').insertAfter( $('h1') ).hide();
226
+ }
227
+ }).trigger('yith_woocompare_render_table');
228
+
229
+ // add to cart
230
+ var redirect_to_cart = false,
231
+ body = $('body');
232
+
233
+ // close colorbox if redirect to cart is active after add to cart
234
+ body.on( 'adding_to_cart', function ( $thisbutton, data ) {
235
+ if( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) {
236
+ wc_add_to_cart_params.cart_redirect_after_add = 'no';
237
+ redirect_to_cart = true;
238
+ }
239
+ });
240
+
241
+ body.on('wc_cart_button_updated', function( ev, button ){
242
+ $('a.added_to_cart').attr('target', '_parent');
243
+ });
244
+
245
+ // remove add to cart button after added
246
+ body.on('added_to_cart', function( ev, fragments, cart_hash, button ){
247
+
248
+ $('a').attr('target', '_parent');
249
+
250
+ if( redirect_to_cart == true ) {
251
+ // redirect
252
+ parent.window.location = wc_add_to_cart_params.cart_url;
253
+ return;
254
+ }
255
+
256
+ // Replace fragments
257
+ if ( fragments ) {
258
+ $.each(fragments, function(key, value) {
259
+ $(key, window.parent.document).replaceWith(value);
260
+ });
261
+ }
262
+ });
263
+
264
+ // close window
265
+ $(document).on( 'click', 'a.close', function(e){
266
+ e.preventDefault();
267
+ window.close();
268
+ });
269
+
270
+ $(window).on( 'yith_woocompare_product_removed', function(){
271
+ if( $( window ).width() > 767 ) {
272
+ oTable.fnDestroy(true);
273
+ }
274
+ $('body').trigger('yith_woocompare_render_table');
275
+ });
276
+
277
+ });
278
+
279
+ </script>
280
+
281
+ </body>
282
  </html>
widgets/class.yith-woocompare-widget.php CHANGED
@@ -1,84 +1,84 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
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 Ajax Navigation Widget
15
- *
16
- * @since 1.0.0
17
- */
18
- class YITH_Woocompare_Widget extends WP_Widget {
19
-
20
- function __construct() {
21
- $widget_ops = array (
22
- 'classname' => 'yith-woocompare-widget',
23
- 'description' => __( 'The widget shows the list of products added in the comparison table.', 'yith-woocommerce-compare'
24
- )
25
- );
26
-
27
- parent::__construct( 'yith-woocompare-widget', __( 'YITH WooCommerce Compare Widget', 'yith-woocommerce-compare' ), $widget_ops );
28
- }
29
-
30
-
31
- function widget( $args, $instance ) {
32
- global $yith_woocompare;
33
-
34
- /**
35
- * WPML Support
36
- */
37
- $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
38
-
39
- extract( $args );
40
-
41
- do_action ( 'wpml_register_single_string', 'Widget', 'widget_yit_compare_title_text', $instance['title'] );
42
- $localized_widget_title = apply_filters ( 'wpml_translate_single_string', $instance['title'], 'Widget', 'widget_yit_compare_title_text' );
43
-
44
- echo $before_widget . $before_title . $localized_widget_title . $after_title; ?>
45
-
46
- <ul class="products-list" data-lang="<?php echo $lang ?>">
47
- <?php echo $yith_woocompare->obj->list_products_html(); ?>
48
- </ul>
49
-
50
- <a href="<?php echo $yith_woocompare->obj->remove_product_url('all') ?>" data-product_id="all" class="clear-all" rel="nofollow"><?php _e( 'Clear all', 'yith-woocommerce-compare' ) ?></a>
51
- <a href="<?php echo $yith_woocompare->obj->view_table_url() ?>" class="compare added button" rel="nofollow"><?php _e( 'Compare', 'yith-woocommerce-compare' ) ?></a>
52
-
53
- <?php echo $after_widget;
54
- }
55
-
56
-
57
- function form( $instance ) {
58
- global $woocommerce;
59
-
60
- $defaults = array(
61
- 'title' => '',
62
- );
63
-
64
- $instance = wp_parse_args( (array) $instance, $defaults ); ?>
65
-
66
- <p>
67
- <label>
68
- <?php _e( 'Title', 'yith-woocommerce-compare' ) ?>:<br />
69
- <input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
70
- </label>
71
- </p>
72
- <?php
73
- }
74
-
75
- function update( $new_instance, $old_instance ) {
76
- $instance = $old_instance;
77
-
78
- $instance['title'] = strip_tags( $new_instance['title'] );
79
-
80
- return $instance;
81
- }
82
-
83
- }
84
  }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Ajax Navigation
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 Ajax Navigation Widget
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YITH_Woocompare_Widget extends WP_Widget {
19
+
20
+ function __construct() {
21
+ $widget_ops = array (
22
+ 'classname' => 'yith-woocompare-widget',
23
+ 'description' => __( 'The widget shows the list of products added in the comparison table.', 'yith-woocommerce-compare'
24
+ )
25
+ );
26
+
27
+ parent::__construct( 'yith-woocompare-widget', __( 'YITH WooCommerce Compare Widget', 'yith-woocommerce-compare' ), $widget_ops );
28
+ }
29
+
30
+
31
+ function widget( $args, $instance ) {
32
+ global $yith_woocompare;
33
+
34
+ /**
35
+ * WPML Support
36
+ */
37
+ $lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
38
+
39
+ extract( $args );
40
+
41
+ do_action ( 'wpml_register_single_string', 'Widget', 'widget_yit_compare_title_text', $instance['title'] );
42
+ $localized_widget_title = apply_filters ( 'wpml_translate_single_string', $instance['title'], 'Widget', 'widget_yit_compare_title_text' );
43
+
44
+ echo $before_widget . $before_title . $localized_widget_title . $after_title; ?>
45
+
46
+ <ul class="products-list" data-lang="<?php echo $lang ?>">
47
+ <?php echo $yith_woocompare->obj->list_products_html(); ?>
48
+ </ul>
49
+
50
+ <a href="<?php echo $yith_woocompare->obj->remove_product_url('all') ?>" data-product_id="all" class="clear-all" rel="nofollow"><?php _e( 'Clear all', 'yith-woocommerce-compare' ) ?></a>
51
+ <a href="<?php echo $yith_woocompare->obj->view_table_url() ?>" class="compare added button" rel="nofollow"><?php _e( 'Compare', 'yith-woocommerce-compare' ) ?></a>
52
+
53
+ <?php echo $after_widget;
54
+ }
55
+
56
+
57
+ function form( $instance ) {
58
+ global $woocommerce;
59
+
60
+ $defaults = array(
61
+ 'title' => '',
62
+ );
63
+
64
+ $instance = wp_parse_args( (array) $instance, $defaults ); ?>
65
+
66
+ <p>
67
+ <label>
68
+ <?php _e( 'Title', 'yith-woocommerce-compare' ) ?>:<br />
69
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
70
+ </label>
71
+ </p>
72
+ <?php
73
+ }
74
+
75
+ function update( $new_instance, $old_instance ) {
76
+ $instance = $old_instance;
77
+
78
+ $instance['title'] = strip_tags( $new_instance['title'] );
79
+
80
+ return $instance;
81
+ }
82
+
83
+ }
84
  }
wpml-config.xml CHANGED
@@ -1,6 +1,6 @@
1
- <wpml-config>
2
- <admin-texts>
3
- <key name="yith_woocompare_button_text" />
4
- <key name="yith_woocompare_table_text" />
5
- </admin-texts>
6
  </wpml-config>
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="yith_woocompare_button_text" />
4
+ <key name="yith_woocompare_table_text" />
5
+ </admin-texts>
6
  </wpml-config>