Version Description
- Fixed: Product grid featured products loop not working
- Few minor bugfix and improvements
Download this release
Release Info
Developer | re_enter_rupok |
Plugin | Elementor Essential Addons |
Version | 2.9.5 |
Comparing to | |
See all releases |
Code changes from version 2.9.4 to 2.9.5
- admin/assets/css/admin.css +0 -0
- admin/assets/images/wpsp-logo.svg +1 -1
- assets/sass/_particles.scss +0 -0
- elements/product-grid/product-grid.php +512 -502
- essential_adons_elementor.php +5 -5
- extensions/eael-particle-section/eael-particle-section.php +0 -0
- extensions/eael-particle-section/particle-themes.php +0 -0
- includes/class-plugin-usage-tracker.php +268 -108
- includes/class-wpdev-core-install.php +0 -0
- includes/class-wpdev-notices.php +3 -6
- includes/eael-rollback.php +2 -0
- includes/extensions.php +0 -0
- readme.txt +6 -1
admin/assets/css/admin.css
CHANGED
File without changes
|
admin/assets/images/wpsp-logo.svg
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 960 960" style="enable-background:new 0 0 960 960;" xml:space="preserve">
|
3 |
<style type="text/css">
|
4 |
.st0{fill:#FFFFFF;}
|
5 |
.st1{fill:#6c63ff;}
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg version="1.1" width="80px" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 960 960" style="enable-background:new 0 0 960 960;" xml:space="preserve">
|
3 |
<style type="text/css">
|
4 |
.st0{fill:#FFFFFF;}
|
5 |
.st1{fill:#6c63ff;}
|
assets/sass/_particles.scss
CHANGED
File without changes
|
elements/product-grid/product-grid.php
CHANGED
@@ -2,517 +2,527 @@
|
|
2 |
namespace Elementor;
|
3 |
|
4 |
if (!defined('ABSPATH')) {
|
5 |
-
|
6 |
}
|
7 |
// If this file is called directly, abort.
|
8 |
|
9 |
-
class Widget_Eael_Product_Grid extends Widget_Base
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
]
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
);
|
196 |
-
|
197 |
-
$this->add_control(
|
198 |
-
'eael_product_grid_product_title_color',
|
199 |
-
[
|
200 |
-
'label' => esc_html__('Product Title Color', 'essential-addons-elementor'),
|
201 |
-
'type' => Controls_Manager::COLOR,
|
202 |
-
'default' => '#272727',
|
203 |
-
'selectors' => [
|
204 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title' => 'color: {{VALUE}};',
|
205 |
-
],
|
206 |
-
]
|
207 |
-
);
|
208 |
-
|
209 |
-
$this->add_group_control(
|
210 |
-
Group_Control_Typography::get_type(),
|
211 |
-
[
|
212 |
-
'name' => 'eael_product_grid_product_title_typography',
|
213 |
-
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title',
|
214 |
-
]
|
215 |
-
);
|
216 |
-
|
217 |
-
$this->add_control(
|
218 |
-
'eael_product_grid_product_price_heading',
|
219 |
-
[
|
220 |
-
'label' => __('Product Price', 'essential-addons-elementor'),
|
221 |
-
'type' => Controls_Manager::HEADING,
|
222 |
-
]
|
223 |
-
);
|
224 |
-
|
225 |
-
$this->add_control(
|
226 |
-
'eael_product_grid_product_price_color',
|
227 |
-
[
|
228 |
-
'label' => esc_html__('Product Price Color', 'essential-addons-elementor'),
|
229 |
-
'type' => Controls_Manager::COLOR,
|
230 |
-
'default' => '#272727',
|
231 |
-
'selectors' => [
|
232 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price' => 'color: {{VALUE}};',
|
233 |
-
],
|
234 |
-
]
|
235 |
-
);
|
236 |
-
|
237 |
-
$this->add_group_control(
|
238 |
-
Group_Control_Typography::get_type(),
|
239 |
-
[
|
240 |
-
'name' => 'eael_product_grid_product_price_typography',
|
241 |
-
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price',
|
242 |
-
]
|
243 |
-
);
|
244 |
-
|
245 |
-
$this->add_control(
|
246 |
-
'eael_product_grid_product_rating_heading',
|
247 |
-
[
|
248 |
-
'label' => __('Star Rating', 'essential-addons-elementor'),
|
249 |
-
'type' => Controls_Manager::HEADING,
|
250 |
-
]
|
251 |
-
);
|
252 |
-
|
253 |
-
$this->add_control(
|
254 |
-
'eael_product_grid_product_rating_color',
|
255 |
-
[
|
256 |
-
'label' => esc_html__('Rating Color', 'essential-addons-elementor'),
|
257 |
-
'type' => Controls_Manager::COLOR,
|
258 |
-
'default' => '#f2b01e',
|
259 |
-
'selectors' => [
|
260 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce .star-rating::before' => 'color: {{VALUE}};',
|
261 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce .star-rating span::before' => 'color: {{VALUE}};',
|
262 |
-
],
|
263 |
-
]
|
264 |
-
);
|
265 |
-
|
266 |
-
$this->add_group_control(
|
267 |
-
Group_Control_Typography::get_type(),
|
268 |
-
[
|
269 |
-
'name' => 'eael_product_grid_product_rating_typography',
|
270 |
-
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating',
|
271 |
-
]
|
272 |
-
);
|
273 |
-
|
274 |
-
$this->add_control(
|
275 |
-
'eael_product_grid_sale_badge_heading',
|
276 |
-
[
|
277 |
-
'label' => __('Sale Badge', 'essential-addons-elementor'),
|
278 |
-
'type' => Controls_Manager::HEADING,
|
279 |
-
]
|
280 |
-
);
|
281 |
-
|
282 |
-
$this->add_control(
|
283 |
-
'eael_product_grid_sale_badge_color',
|
284 |
-
[
|
285 |
-
'label' => esc_html__('Sale Badge Color', 'essential-addons-elementor'),
|
286 |
-
'type' => Controls_Manager::COLOR,
|
287 |
-
'default' => '#fff',
|
288 |
-
'selectors' => [
|
289 |
-
'{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'color: {{VALUE}};',
|
290 |
-
],
|
291 |
-
]
|
292 |
-
);
|
293 |
-
|
294 |
-
$this->add_control(
|
295 |
-
'eael_product_grid_sale_badge_background',
|
296 |
-
[
|
297 |
-
'label' => esc_html__('Sale Badge Background', 'essential-addons-elementor'),
|
298 |
-
'type' => Controls_Manager::COLOR,
|
299 |
-
'default' => '#ff2a13',
|
300 |
-
'selectors' => [
|
301 |
-
'{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'background-color: {{VALUE}};',
|
302 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price ins' => 'color: {{VALUE}};',
|
303 |
-
],
|
304 |
-
]
|
305 |
-
);
|
306 |
-
|
307 |
-
$this->add_group_control(
|
308 |
-
Group_Control_Typography::get_type(),
|
309 |
-
[
|
310 |
-
'name' => 'eael_product_grid_sale_badge_typography',
|
311 |
-
'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .onsale',
|
312 |
-
]
|
313 |
-
);
|
314 |
-
|
315 |
-
$this->end_controls_section();
|
316 |
-
|
317 |
-
$this->start_controls_section(
|
318 |
-
'eael_section_product_grid_add_to_cart_styles',
|
319 |
-
[
|
320 |
-
'label' => esc_html__('Add to Cart Button Styles', 'essential-addons-elementor'),
|
321 |
-
'tab' => Controls_Manager::TAB_STYLE,
|
322 |
-
]
|
323 |
-
);
|
324 |
-
|
325 |
-
$this->start_controls_tabs('eael_product_grid_add_to_cart_style_tabs');
|
326 |
-
|
327 |
-
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-elementor')]);
|
328 |
-
|
329 |
-
$this->add_control(
|
330 |
-
'eael_product_grid_add_to_cart_color',
|
331 |
-
[
|
332 |
-
'label' => esc_html__('Button Color', 'essential-addons-elementor'),
|
333 |
-
'type' => Controls_Manager::COLOR,
|
334 |
-
'default' => '#fff',
|
335 |
-
'selectors' => [
|
336 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'color: {{VALUE}};',
|
337 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'color: {{VALUE}};',
|
338 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'color: {{VALUE}};',
|
339 |
-
],
|
340 |
-
]
|
341 |
-
);
|
342 |
-
|
343 |
-
$this->add_control(
|
344 |
-
'eael_product_grid_add_to_cart_background',
|
345 |
-
[
|
346 |
-
'label' => esc_html__('Button Background Color', 'essential-addons-elementor'),
|
347 |
-
'type' => Controls_Manager::COLOR,
|
348 |
-
'default' => '#333',
|
349 |
-
'selectors' => [
|
350 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'background-color: {{VALUE}};',
|
351 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'background-color: {{VALUE}};',
|
352 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'background-color: {{VALUE}};',
|
353 |
-
],
|
354 |
-
]
|
355 |
-
);
|
356 |
-
|
357 |
-
$this->add_group_control(
|
358 |
-
Group_Control_Border::get_type(),
|
359 |
-
[
|
360 |
-
'name' => 'eael_product_grid_add_to_cart_border',
|
361 |
-
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart',
|
362 |
-
]
|
363 |
-
);
|
364 |
-
|
365 |
-
$this->add_group_control(
|
366 |
-
Group_Control_Typography::get_type(),
|
367 |
-
[
|
368 |
-
'name' => 'eael_product_grid_add_to_cart_typography',
|
369 |
-
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button',
|
370 |
-
'condition' => [
|
371 |
-
'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple']
|
372 |
-
],
|
373 |
-
]
|
374 |
-
);
|
375 |
-
|
376 |
-
$this->end_controls_tab();
|
377 |
-
|
378 |
-
$this->start_controls_tab('eael_product_grid_add_to_cart_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-elementor')]);
|
379 |
-
|
380 |
-
$this->add_control(
|
381 |
-
'eael_product_grid_add_to_cart_hover_color',
|
382 |
-
[
|
383 |
-
'label' => esc_html__('Button Color', 'essential-addons-elementor'),
|
384 |
-
'type' => Controls_Manager::COLOR,
|
385 |
-
'default' => '#fff',
|
386 |
-
'selectors' => [
|
387 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'color: {{VALUE}};',
|
388 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'color: {{VALUE}};',
|
389 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'color: {{VALUE}};',
|
390 |
-
],
|
391 |
-
]
|
392 |
-
);
|
393 |
-
|
394 |
-
$this->add_control(
|
395 |
-
'eael_product_grid_add_to_cart_hover_background',
|
396 |
-
[
|
397 |
-
'label' => esc_html__('Button Background Color', 'essential-addons-elementor'),
|
398 |
-
'type' => Controls_Manager::COLOR,
|
399 |
-
'default' => '#333',
|
400 |
-
'selectors' => [
|
401 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'background-color: {{VALUE}};',
|
402 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'background-color: {{VALUE}};',
|
403 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'background-color: {{VALUE}};',
|
404 |
-
],
|
405 |
-
]
|
406 |
-
);
|
407 |
-
|
408 |
-
$this->add_control(
|
409 |
-
'eael_product_grid_add_to_cart_hover_border_color',
|
410 |
-
[
|
411 |
-
'label' => esc_html__('Border Color', 'essential-addons-elementor'),
|
412 |
-
'type' => Controls_Manager::COLOR,
|
413 |
-
'default' => '',
|
414 |
-
'selectors' => [
|
415 |
-
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'border-color: {{VALUE}};',
|
416 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'border-color: {{VALUE}};',
|
417 |
-
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'border-color: {{VALUE}};',
|
418 |
-
],
|
419 |
-
]
|
420 |
-
);
|
421 |
-
|
422 |
-
$this->end_controls_tab();
|
423 |
-
|
424 |
-
$this->end_controls_tabs();
|
425 |
-
|
426 |
-
$this->end_controls_section();
|
427 |
-
|
428 |
-
}
|
429 |
-
|
430 |
-
protected function render() {
|
431 |
-
$settings = $this->get_settings();
|
432 |
-
$show_rating = $settings['eael_product_grid_rating'];
|
433 |
-
|
434 |
-
if ($settings['eael_product_grid_style_preset'] == 'eael-product-simple') {
|
435 |
-
$grid_layout = 'eael-product-simple';
|
436 |
-
} else if ($settings['eael_product_grid_style_preset'] == 'eael-product-reveal') {
|
437 |
-
$grid_layout = 'eael-product-reveal';
|
438 |
-
} else if ($settings['eael_product_grid_style_preset'] == 'eael-product-overlay') {
|
439 |
-
$grid_layout = 'eael-product-overlay';
|
440 |
-
} else {
|
441 |
-
$grid_layout = 'eael-product-default';
|
442 |
-
}
|
443 |
-
|
444 |
-
$args = [
|
445 |
-
'post_type' => 'product',
|
446 |
-
'posts_per_page' => $settings['eael_product_grid_products_count'] ?: 4,
|
447 |
-
'order' => 'DESC',
|
448 |
-
];
|
449 |
-
|
450 |
-
if (!empty($settings['eael_product_grid_categories'])) {
|
451 |
-
$args['tax_query'] = [
|
452 |
-
[
|
453 |
-
'taxonomy' => 'product_cat',
|
454 |
-
'field' => 'slug',
|
455 |
-
'terms' => $settings['eael_product_grid_categories'],
|
456 |
-
'operator' => 'IN',
|
457 |
-
],
|
458 |
-
];
|
459 |
-
}
|
460 |
-
|
461 |
-
if ($settings['eael_product_grid_product_filter'] == 'featured-products') {
|
462 |
-
$args['tax_query'] = [
|
463 |
-
'taxonomy' => 'product_visibility',
|
464 |
-
'field' => 'name',
|
465 |
-
'terms' => 'featured',
|
466 |
-
];
|
467 |
-
} else if ($settings['eael_product_grid_product_filter'] == 'best-selling-products') {
|
468 |
-
$args['meta_key'] = 'total_sales';
|
469 |
-
$args['orderby'] = 'meta_value_num';
|
470 |
-
$args['order'] = 'DESC';
|
471 |
-
} else if ($settings['eael_product_grid_product_filter'] == 'sale-products') {
|
472 |
-
$args['meta_query'] = [
|
473 |
-
'relation' => 'OR',
|
474 |
-
[
|
475 |
-
'key' => '_sale_price',
|
476 |
-
'value' => 0,
|
477 |
-
'compare' => '>',
|
478 |
-
'type' => 'numeric',
|
479 |
-
], [
|
480 |
-
'key' => '_min_variation_sale_price',
|
481 |
-
'value' => 0,
|
482 |
-
'compare' => '>',
|
483 |
-
'type' => 'numeric',
|
484 |
-
],
|
485 |
-
];
|
486 |
-
} else if ($settings['eael_product_grid_product_filter'] == 'top-products') {
|
487 |
-
$args['meta_key'] = '_wc_average_rating';
|
488 |
-
$args['orderby'] = 'meta_value_num';
|
489 |
-
$args['order'] = 'DESC';
|
490 |
-
}
|
491 |
-
|
492 |
-
global $woocommerce_loop;
|
493 |
-
$woocommerce_loop['loop'] = $woocommerce_loop['columns'] = $settings['eael_product_grid_column'];
|
494 |
-
|
495 |
-
echo '<div class="eael-product-grid ' . $grid_layout . '">
|
496 |
<div class="woocommerce">
|
497 |
<ul class="products eael-product-columns-' . $settings['eael_product_grid_column'] . '">';
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
</div>
|
510 |
</div>';
|
511 |
-
|
512 |
|
513 |
-
|
|
|
514 |
|
515 |
-
|
516 |
}
|
517 |
|
518 |
-
Plugin::instance()->widgets_manager->register_widget_type(new Widget_Eael_Product_Grid());
|
2 |
namespace Elementor;
|
3 |
|
4 |
if (!defined('ABSPATH')) {
|
5 |
+
exit;
|
6 |
}
|
7 |
// If this file is called directly, abort.
|
8 |
|
9 |
+
class Widget_Eael_Product_Grid extends Widget_Base
|
10 |
+
{
|
11 |
+
|
12 |
+
public function get_name()
|
13 |
+
{
|
14 |
+
return 'eicon-woocommerce';
|
15 |
+
}
|
16 |
+
|
17 |
+
public function get_title()
|
18 |
+
{
|
19 |
+
return esc_html__('EA Product Grid', 'essential-addons-elementor');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function get_icon()
|
23 |
+
{
|
24 |
+
return 'eicon-woocommerce';
|
25 |
+
}
|
26 |
+
|
27 |
+
public function get_categories()
|
28 |
+
{
|
29 |
+
return ['essential-addons-elementor'];
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _register_controls()
|
33 |
+
{
|
34 |
+
|
35 |
+
// Content Controls
|
36 |
+
$this->start_controls_section(
|
37 |
+
'eael_section_product_grid_settings',
|
38 |
+
[
|
39 |
+
'label' => esc_html__('Product Settings', 'essential-addons-elementor'),
|
40 |
+
]
|
41 |
+
);
|
42 |
+
|
43 |
+
$this->add_control(
|
44 |
+
'eael_product_grid_product_filter',
|
45 |
+
[
|
46 |
+
'label' => esc_html__('Filter By', 'essential-addons-elementor'),
|
47 |
+
'type' => Controls_Manager::SELECT,
|
48 |
+
'default' => 'recent-products',
|
49 |
+
'options' => [
|
50 |
+
'recent-products' => esc_html__('Recent Products', 'essential-addons-elementor'),
|
51 |
+
'featured-products' => esc_html__('Featured Products', 'essential-addons-elementor'),
|
52 |
+
'best-selling-products' => esc_html__('Best Selling Products', 'essential-addons-elementor'),
|
53 |
+
'sale-products' => esc_html__('Sale Products', 'essential-addons-elementor'),
|
54 |
+
'top-products' => esc_html__('Top Rated Products', 'essential-addons-elementor'),
|
55 |
+
],
|
56 |
+
]
|
57 |
+
);
|
58 |
+
|
59 |
+
$this->add_control(
|
60 |
+
'eael_product_grid_column',
|
61 |
+
[
|
62 |
+
'label' => esc_html__('Columns', 'essential-addons-elementor'),
|
63 |
+
'type' => Controls_Manager::SELECT,
|
64 |
+
'default' => '4',
|
65 |
+
'options' => [
|
66 |
+
'1' => esc_html__('1', 'essential-addons-elementor'),
|
67 |
+
'2' => esc_html__('2', 'essential-addons-elementor'),
|
68 |
+
'3' => esc_html__('3', 'essential-addons-elementor'),
|
69 |
+
'4' => esc_html__('4', 'essential-addons-elementor'),
|
70 |
+
'5' => esc_html__('5', 'essential-addons-elementor'),
|
71 |
+
'6' => esc_html__('6', 'essential-addons-elementor'),
|
72 |
+
],
|
73 |
+
]
|
74 |
+
);
|
75 |
+
|
76 |
+
$this->add_control(
|
77 |
+
'eael_product_grid_products_count',
|
78 |
+
[
|
79 |
+
'label' => __('Products Count', 'essential-addons-elementor'),
|
80 |
+
'type' => Controls_Manager::NUMBER,
|
81 |
+
'default' => 4,
|
82 |
+
'min' => 1,
|
83 |
+
'max' => 1000,
|
84 |
+
'step' => 1,
|
85 |
+
]
|
86 |
+
);
|
87 |
+
|
88 |
+
$this->add_control(
|
89 |
+
'eael_product_grid_categories',
|
90 |
+
[
|
91 |
+
'label' => esc_html__('Product Categories', 'essential-addons-elementor'),
|
92 |
+
'type' => Controls_Manager::SELECT2,
|
93 |
+
'label_block' => true,
|
94 |
+
'multiple' => true,
|
95 |
+
'options' => eael_woocommerce_product_categories(),
|
96 |
+
]
|
97 |
+
);
|
98 |
+
|
99 |
+
$this->add_control(
|
100 |
+
'eael_product_grid_style_preset',
|
101 |
+
[
|
102 |
+
'label' => esc_html__('Style Preset', 'essential-addons-elementor'),
|
103 |
+
'type' => Controls_Manager::SELECT,
|
104 |
+
'default' => 'eael-product-simple',
|
105 |
+
'options' => [
|
106 |
+
'eael-product-default' => esc_html__('Default', 'essential-addons-elementor'),
|
107 |
+
'eael-product-simple' => esc_html__('Simple Style', 'essential-addons-elementor'),
|
108 |
+
'eael-product-reveal' => esc_html__('Reveal Style', 'essential-addons-elementor'),
|
109 |
+
'eael-product-overlay' => esc_html__('Overlay Style', 'essential-addons-elementor'),
|
110 |
+
],
|
111 |
+
]
|
112 |
+
);
|
113 |
+
|
114 |
+
$this->add_control(
|
115 |
+
'eael_product_grid_rating',
|
116 |
+
[
|
117 |
+
'label' => esc_html__('Show Product Rating?', 'essential-addons-elementor'),
|
118 |
+
'type' => Controls_Manager::SWITCHER,
|
119 |
+
'return_value' => 'yes',
|
120 |
+
'default' => 'yes',
|
121 |
+
]
|
122 |
+
);
|
123 |
+
|
124 |
+
$this->end_controls_section();
|
125 |
+
|
126 |
+
$this->start_controls_section(
|
127 |
+
'eael_product_grid_styles',
|
128 |
+
[
|
129 |
+
'label' => esc_html__('Products Styles', 'essential-addons-elementor'),
|
130 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
131 |
+
]
|
132 |
+
);
|
133 |
+
|
134 |
+
$this->add_control(
|
135 |
+
'eael_product_grid_background_color',
|
136 |
+
[
|
137 |
+
'label' => esc_html__('Content Background Color', 'essential-addons-elementor'),
|
138 |
+
'type' => Controls_Manager::COLOR,
|
139 |
+
'default' => '#fff',
|
140 |
+
'selectors' => [
|
141 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'background-color: {{VALUE}};',
|
142 |
+
],
|
143 |
+
]
|
144 |
+
);
|
145 |
+
|
146 |
+
$this->add_group_control(
|
147 |
+
Group_Control_Border::get_type(),
|
148 |
+
[
|
149 |
+
'name' => 'eael_peoduct_grid_border',
|
150 |
+
'fields_options' => [
|
151 |
+
'border' => [
|
152 |
+
'default' => 'solid',
|
153 |
+
],
|
154 |
+
'width' => [
|
155 |
+
'default' => [
|
156 |
+
'top' => '1',
|
157 |
+
'right' => '1',
|
158 |
+
'bottom' => '1',
|
159 |
+
'left' => '1',
|
160 |
+
'isLinked' => false,
|
161 |
+
],
|
162 |
+
],
|
163 |
+
'color' => [
|
164 |
+
'default' => '#eee',
|
165 |
+
],
|
166 |
+
],
|
167 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product',
|
168 |
+
'condition' => [
|
169 |
+
'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple', 'eael-product-overlay'],
|
170 |
+
],
|
171 |
+
]
|
172 |
+
);
|
173 |
+
|
174 |
+
$this->add_control(
|
175 |
+
'eael_peoduct_grid_border_radius',
|
176 |
+
[
|
177 |
+
'label' => esc_html__('Border Radius', 'essential-addons-elementor'),
|
178 |
+
'type' => Controls_Manager::DIMENSIONS,
|
179 |
+
'selectors' => [
|
180 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
|
181 |
+
],
|
182 |
+
]
|
183 |
+
);
|
184 |
+
|
185 |
+
$this->end_controls_section();
|
186 |
+
|
187 |
+
$this->start_controls_section(
|
188 |
+
'eael_section_product_grid_typography',
|
189 |
+
[
|
190 |
+
'label' => esc_html__('Color & Typography', 'essential-addons-elementor'),
|
191 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
192 |
+
]
|
193 |
+
);
|
194 |
+
|
195 |
+
$this->add_control(
|
196 |
+
'eael_product_grid_product_title_heading',
|
197 |
+
[
|
198 |
+
'label' => __('Product Title', 'essential-addons-elementor'),
|
199 |
+
'type' => Controls_Manager::HEADING,
|
200 |
+
]
|
201 |
+
);
|
202 |
+
|
203 |
+
$this->add_control(
|
204 |
+
'eael_product_grid_product_title_color',
|
205 |
+
[
|
206 |
+
'label' => esc_html__('Product Title Color', 'essential-addons-elementor'),
|
207 |
+
'type' => Controls_Manager::COLOR,
|
208 |
+
'default' => '#272727',
|
209 |
+
'selectors' => [
|
210 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title' => 'color: {{VALUE}};',
|
211 |
+
],
|
212 |
+
]
|
213 |
+
);
|
214 |
+
|
215 |
+
$this->add_group_control(
|
216 |
+
Group_Control_Typography::get_type(),
|
217 |
+
[
|
218 |
+
'name' => 'eael_product_grid_product_title_typography',
|
219 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title',
|
220 |
+
]
|
221 |
+
);
|
222 |
+
|
223 |
+
$this->add_control(
|
224 |
+
'eael_product_grid_product_price_heading',
|
225 |
+
[
|
226 |
+
'label' => __('Product Price', 'essential-addons-elementor'),
|
227 |
+
'type' => Controls_Manager::HEADING,
|
228 |
+
]
|
229 |
+
);
|
230 |
+
|
231 |
+
$this->add_control(
|
232 |
+
'eael_product_grid_product_price_color',
|
233 |
+
[
|
234 |
+
'label' => esc_html__('Product Price Color', 'essential-addons-elementor'),
|
235 |
+
'type' => Controls_Manager::COLOR,
|
236 |
+
'default' => '#272727',
|
237 |
+
'selectors' => [
|
238 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price' => 'color: {{VALUE}};',
|
239 |
+
],
|
240 |
+
]
|
241 |
+
);
|
242 |
+
|
243 |
+
$this->add_group_control(
|
244 |
+
Group_Control_Typography::get_type(),
|
245 |
+
[
|
246 |
+
'name' => 'eael_product_grid_product_price_typography',
|
247 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price',
|
248 |
+
]
|
249 |
+
);
|
250 |
+
|
251 |
+
$this->add_control(
|
252 |
+
'eael_product_grid_product_rating_heading',
|
253 |
+
[
|
254 |
+
'label' => __('Star Rating', 'essential-addons-elementor'),
|
255 |
+
'type' => Controls_Manager::HEADING,
|
256 |
+
]
|
257 |
+
);
|
258 |
+
|
259 |
+
$this->add_control(
|
260 |
+
'eael_product_grid_product_rating_color',
|
261 |
+
[
|
262 |
+
'label' => esc_html__('Rating Color', 'essential-addons-elementor'),
|
263 |
+
'type' => Controls_Manager::COLOR,
|
264 |
+
'default' => '#f2b01e',
|
265 |
+
'selectors' => [
|
266 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce .star-rating::before' => 'color: {{VALUE}};',
|
267 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce .star-rating span::before' => 'color: {{VALUE}};',
|
268 |
+
],
|
269 |
+
]
|
270 |
+
);
|
271 |
+
|
272 |
+
$this->add_group_control(
|
273 |
+
Group_Control_Typography::get_type(),
|
274 |
+
[
|
275 |
+
'name' => 'eael_product_grid_product_rating_typography',
|
276 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating',
|
277 |
+
]
|
278 |
+
);
|
279 |
+
|
280 |
+
$this->add_control(
|
281 |
+
'eael_product_grid_sale_badge_heading',
|
282 |
+
[
|
283 |
+
'label' => __('Sale Badge', 'essential-addons-elementor'),
|
284 |
+
'type' => Controls_Manager::HEADING,
|
285 |
+
]
|
286 |
+
);
|
287 |
+
|
288 |
+
$this->add_control(
|
289 |
+
'eael_product_grid_sale_badge_color',
|
290 |
+
[
|
291 |
+
'label' => esc_html__('Sale Badge Color', 'essential-addons-elementor'),
|
292 |
+
'type' => Controls_Manager::COLOR,
|
293 |
+
'default' => '#fff',
|
294 |
+
'selectors' => [
|
295 |
+
'{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'color: {{VALUE}};',
|
296 |
+
],
|
297 |
+
]
|
298 |
+
);
|
299 |
+
|
300 |
+
$this->add_control(
|
301 |
+
'eael_product_grid_sale_badge_background',
|
302 |
+
[
|
303 |
+
'label' => esc_html__('Sale Badge Background', 'essential-addons-elementor'),
|
304 |
+
'type' => Controls_Manager::COLOR,
|
305 |
+
'default' => '#ff2a13',
|
306 |
+
'selectors' => [
|
307 |
+
'{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'background-color: {{VALUE}};',
|
308 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price ins' => 'color: {{VALUE}};',
|
309 |
+
],
|
310 |
+
]
|
311 |
+
);
|
312 |
+
|
313 |
+
$this->add_group_control(
|
314 |
+
Group_Control_Typography::get_type(),
|
315 |
+
[
|
316 |
+
'name' => 'eael_product_grid_sale_badge_typography',
|
317 |
+
'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .onsale',
|
318 |
+
]
|
319 |
+
);
|
320 |
+
|
321 |
+
$this->end_controls_section();
|
322 |
+
|
323 |
+
$this->start_controls_section(
|
324 |
+
'eael_section_product_grid_add_to_cart_styles',
|
325 |
+
[
|
326 |
+
'label' => esc_html__('Add to Cart Button Styles', 'essential-addons-elementor'),
|
327 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
328 |
+
]
|
329 |
+
);
|
330 |
+
|
331 |
+
$this->start_controls_tabs('eael_product_grid_add_to_cart_style_tabs');
|
332 |
+
|
333 |
+
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-elementor')]);
|
334 |
+
|
335 |
+
$this->add_control(
|
336 |
+
'eael_product_grid_add_to_cart_color',
|
337 |
+
[
|
338 |
+
'label' => esc_html__('Button Color', 'essential-addons-elementor'),
|
339 |
+
'type' => Controls_Manager::COLOR,
|
340 |
+
'default' => '#fff',
|
341 |
+
'selectors' => [
|
342 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'color: {{VALUE}};',
|
343 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'color: {{VALUE}};',
|
344 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'color: {{VALUE}};',
|
345 |
+
],
|
346 |
+
]
|
347 |
+
);
|
348 |
+
|
349 |
+
$this->add_control(
|
350 |
+
'eael_product_grid_add_to_cart_background',
|
351 |
+
[
|
352 |
+
'label' => esc_html__('Button Background Color', 'essential-addons-elementor'),
|
353 |
+
'type' => Controls_Manager::COLOR,
|
354 |
+
'default' => '#333',
|
355 |
+
'selectors' => [
|
356 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'background-color: {{VALUE}};',
|
357 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'background-color: {{VALUE}};',
|
358 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'background-color: {{VALUE}};',
|
359 |
+
],
|
360 |
+
]
|
361 |
+
);
|
362 |
+
|
363 |
+
$this->add_group_control(
|
364 |
+
Group_Control_Border::get_type(),
|
365 |
+
[
|
366 |
+
'name' => 'eael_product_grid_add_to_cart_border',
|
367 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart',
|
368 |
+
]
|
369 |
+
);
|
370 |
+
|
371 |
+
$this->add_group_control(
|
372 |
+
Group_Control_Typography::get_type(),
|
373 |
+
[
|
374 |
+
'name' => 'eael_product_grid_add_to_cart_typography',
|
375 |
+
'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button',
|
376 |
+
'condition' => [
|
377 |
+
'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple'],
|
378 |
+
],
|
379 |
+
]
|
380 |
+
);
|
381 |
+
|
382 |
+
$this->end_controls_tab();
|
383 |
+
|
384 |
+
$this->start_controls_tab('eael_product_grid_add_to_cart_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-elementor')]);
|
385 |
+
|
386 |
+
$this->add_control(
|
387 |
+
'eael_product_grid_add_to_cart_hover_color',
|
388 |
+
[
|
389 |
+
'label' => esc_html__('Button Color', 'essential-addons-elementor'),
|
390 |
+
'type' => Controls_Manager::COLOR,
|
391 |
+
'default' => '#fff',
|
392 |
+
'selectors' => [
|
393 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'color: {{VALUE}};',
|
394 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'color: {{VALUE}};',
|
395 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'color: {{VALUE}};',
|
396 |
+
],
|
397 |
+
]
|
398 |
+
);
|
399 |
+
|
400 |
+
$this->add_control(
|
401 |
+
'eael_product_grid_add_to_cart_hover_background',
|
402 |
+
[
|
403 |
+
'label' => esc_html__('Button Background Color', 'essential-addons-elementor'),
|
404 |
+
'type' => Controls_Manager::COLOR,
|
405 |
+
'default' => '#333',
|
406 |
+
'selectors' => [
|
407 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'background-color: {{VALUE}};',
|
408 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'background-color: {{VALUE}};',
|
409 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'background-color: {{VALUE}};',
|
410 |
+
],
|
411 |
+
]
|
412 |
+
);
|
413 |
+
|
414 |
+
$this->add_control(
|
415 |
+
'eael_product_grid_add_to_cart_hover_border_color',
|
416 |
+
[
|
417 |
+
'label' => esc_html__('Border Color', 'essential-addons-elementor'),
|
418 |
+
'type' => Controls_Manager::COLOR,
|
419 |
+
'default' => '',
|
420 |
+
'selectors' => [
|
421 |
+
'{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'border-color: {{VALUE}};',
|
422 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'border-color: {{VALUE}};',
|
423 |
+
'{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'border-color: {{VALUE}};',
|
424 |
+
],
|
425 |
+
]
|
426 |
+
);
|
427 |
+
|
428 |
+
$this->end_controls_tab();
|
429 |
+
|
430 |
+
$this->end_controls_tabs();
|
431 |
+
|
432 |
+
$this->end_controls_section();
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
protected function render()
|
437 |
+
{
|
438 |
+
$settings = $this->get_settings();
|
439 |
+
$show_rating = $settings['eael_product_grid_rating'];
|
440 |
+
|
441 |
+
if ($settings['eael_product_grid_style_preset'] == 'eael-product-simple') {
|
442 |
+
$grid_layout = 'eael-product-simple';
|
443 |
+
} else if ($settings['eael_product_grid_style_preset'] == 'eael-product-reveal') {
|
444 |
+
$grid_layout = 'eael-product-reveal';
|
445 |
+
} else if ($settings['eael_product_grid_style_preset'] == 'eael-product-overlay') {
|
446 |
+
$grid_layout = 'eael-product-overlay';
|
447 |
+
} else {
|
448 |
+
$grid_layout = 'eael-product-default';
|
449 |
+
}
|
450 |
+
|
451 |
+
$args = [
|
452 |
+
'post_type' => 'product',
|
453 |
+
'posts_per_page' => $settings['eael_product_grid_products_count'] ?: 4,
|
454 |
+
'order' => 'DESC',
|
455 |
+
];
|
456 |
+
|
457 |
+
if (!empty($settings['eael_product_grid_categories'])) {
|
458 |
+
$args['tax_query'] = [
|
459 |
+
[
|
460 |
+
'taxonomy' => 'product_cat',
|
461 |
+
'field' => 'slug',
|
462 |
+
'terms' => $settings['eael_product_grid_categories'],
|
463 |
+
'operator' => 'IN',
|
464 |
+
],
|
465 |
+
];
|
466 |
+
}
|
467 |
+
|
468 |
+
if ($settings['eael_product_grid_product_filter'] == 'featured-products') {
|
469 |
+
$args['tax_query'] = [
|
470 |
+
[
|
471 |
+
'taxonomy' => 'product_visibility',
|
472 |
+
'field' => 'name',
|
473 |
+
'terms' => 'featured'
|
474 |
]
|
475 |
+
];
|
476 |
+
} else if ($settings['eael_product_grid_product_filter'] == 'best-selling-products') {
|
477 |
+
$args['meta_key'] = 'total_sales';
|
478 |
+
$args['orderby'] = 'meta_value_num';
|
479 |
+
$args['order'] = 'DESC';
|
480 |
+
} else if ($settings['eael_product_grid_product_filter'] == 'sale-products') {
|
481 |
+
$args['meta_query'] = [
|
482 |
+
'relation' => 'OR',
|
483 |
+
[
|
484 |
+
'key' => '_sale_price',
|
485 |
+
'value' => 0,
|
486 |
+
'compare' => '>',
|
487 |
+
'type' => 'numeric',
|
488 |
+
], [
|
489 |
+
'key' => '_min_variation_sale_price',
|
490 |
+
'value' => 0,
|
491 |
+
'compare' => '>',
|
492 |
+
'type' => 'numeric',
|
493 |
+
],
|
494 |
+
];
|
495 |
+
} else if ($settings['eael_product_grid_product_filter'] == 'top-products') {
|
496 |
+
$args['meta_key'] = '_wc_average_rating';
|
497 |
+
$args['orderby'] = 'meta_value_num';
|
498 |
+
$args['order'] = 'DESC';
|
499 |
+
}
|
500 |
+
|
501 |
+
global $woocommerce_loop;
|
502 |
+
$woocommerce_loop['loop'] = $woocommerce_loop['columns'] = $settings['eael_product_grid_column'];
|
503 |
+
|
504 |
+
echo '<div class="eael-product-grid ' . $grid_layout . '">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
<div class="woocommerce">
|
506 |
<ul class="products eael-product-columns-' . $settings['eael_product_grid_column'] . '">';
|
507 |
+
$query = new \WP_Query($args);
|
508 |
+
if ($query->have_posts()) {
|
509 |
+
while ($query->have_posts()): $query->the_post();
|
510 |
+
include ESSENTIAL_ADDONS_EL_PATH . 'includes/templates/product-loop.php';
|
511 |
+
endwhile;
|
512 |
+
} else {
|
513 |
+
echo __('No products found');
|
514 |
+
}
|
515 |
+
wp_reset_postdata();
|
516 |
+
unset($woocommerce_loop);
|
517 |
+
echo '</ul>
|
518 |
</div>
|
519 |
</div>';
|
520 |
+
}
|
521 |
|
522 |
+
protected function content_template()
|
523 |
+
{
|
524 |
|
525 |
+
}
|
526 |
}
|
527 |
|
528 |
+
Plugin::instance()->widgets_manager->register_widget_type(new Widget_Eael_Product_Grid());
|
essential_adons_elementor.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: The ultimate elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://essential-addons.com/elementor/
|
6 |
* Author: WPDeveloper
|
7 |
-
* Version: 2.9.
|
8 |
* Author URI: https://wpdeveloper.net/
|
9 |
*
|
10 |
* Text Domain: essential-addons-elementor
|
@@ -16,8 +16,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
16 |
define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
|
17 |
define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
|
18 |
define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ );
|
19 |
-
define( 'ESSENTIAL_ADDONS_VERSION', '2.9.
|
20 |
-
define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.
|
21 |
define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) );
|
22 |
|
23 |
|
@@ -37,7 +37,7 @@ require_once ESSENTIAL_ADDONS_EL_PATH.'includes/extensions.php';
|
|
37 |
*/
|
38 |
function eael_activated_modules() {
|
39 |
|
40 |
-
$eael_default_keys = [ 'contact-form-7', 'count-down', 'creative-btn', 'fancy-text', 'img-comparison', 'instagram-gallery', 'interactive-promo', 'lightbox', 'post-block', 'post-grid', 'post-timeline', 'product-grid', 'team-members', 'testimonial-slider', 'testimonials', 'testimonials', 'weforms', 'static-product', 'call-to-action', 'flip-box', 'info-box', 'dual-header', 'price-table', 'flip-carousel', 'interactive-cards', 'ninja-form', 'gravity-form', 'caldera-form', '
|
41 |
|
42 |
$eael_default_settings = array_fill_keys( $eael_default_keys, true );
|
43 |
$eael_get_settings = get_option( 'eael_save_settings', $eael_default_settings );
|
@@ -315,7 +315,7 @@ if( ! function_exists( 'essential_addons_elementor_lite_start_plugin_tracking' )
|
|
315 |
function essential_addons_elementor_lite_start_plugin_tracking() {
|
316 |
$wisdom = new Eael_Plugin_Usage_Tracker(
|
317 |
__FILE__,
|
318 |
-
'
|
319 |
array(),
|
320 |
true,
|
321 |
true,
|
4 |
* Description: The ultimate elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://essential-addons.com/elementor/
|
6 |
* Author: WPDeveloper
|
7 |
+
* Version: 2.9.5
|
8 |
* Author URI: https://wpdeveloper.net/
|
9 |
*
|
10 |
* Text Domain: essential-addons-elementor
|
16 |
define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) );
|
17 |
define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) );
|
18 |
define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ );
|
19 |
+
define( 'ESSENTIAL_ADDONS_VERSION', '2.9.5' );
|
20 |
+
define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.5' );
|
21 |
define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) );
|
22 |
|
23 |
|
37 |
*/
|
38 |
function eael_activated_modules() {
|
39 |
|
40 |
+
$eael_default_keys = [ 'contact-form-7', 'count-down', 'creative-btn', 'fancy-text', 'img-comparison', 'instagram-gallery', 'interactive-promo', 'lightbox', 'post-block', 'post-grid', 'post-timeline', 'product-grid', 'team-members', 'testimonial-slider', 'testimonials', 'testimonials', 'weforms', 'static-product', 'call-to-action', 'flip-box', 'info-box', 'dual-header', 'price-table', 'flip-carousel', 'interactive-cards', 'ninja-form', 'gravity-form', 'caldera-form', 'twitter-feed', 'facebook-feed', 'data-table', 'filter-gallery', 'image-accordion','content-ticker', 'tooltip', 'adv-accordion', 'adv-tabs', 'progress-bar', 'section-particles' ];
|
41 |
|
42 |
$eael_default_settings = array_fill_keys( $eael_default_keys, true );
|
43 |
$eael_get_settings = get_option( 'eael_save_settings', $eael_default_settings );
|
315 |
function essential_addons_elementor_lite_start_plugin_tracking() {
|
316 |
$wisdom = new Eael_Plugin_Usage_Tracker(
|
317 |
__FILE__,
|
318 |
+
'http://app.wpdeveloper.net',
|
319 |
array(),
|
320 |
true,
|
321 |
true,
|
extensions/eael-particle-section/eael-particle-section.php
CHANGED
File without changes
|
extensions/eael-particle-section/particle-themes.php
CHANGED
File without changes
|
includes/class-plugin-usage-tracker.php
CHANGED
@@ -14,7 +14,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
14 |
|
15 |
class Eael_Plugin_Usage_Tracker {
|
16 |
|
17 |
-
private $
|
18 |
private $home_url = '';
|
19 |
private $plugin_file = '';
|
20 |
private $plugin_name = '';
|
@@ -23,6 +23,13 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
23 |
private $include_goodbye_form = true;
|
24 |
private $marketing = false;
|
25 |
private $collect_email = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
/**
|
28 |
* Class constructor
|
@@ -62,13 +69,44 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
62 |
$this->init();
|
63 |
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
public function init() {
|
|
|
|
|
|
|
67 |
// Check marketing
|
68 |
if( $this->marketing == 3 ) {
|
69 |
$this->set_can_collect_email( true, $this->plugin_name );
|
70 |
}
|
71 |
-
|
72 |
// Check whether opt-in is required
|
73 |
// If not, then tracking is allowed
|
74 |
if( ! $this->require_optin ) {
|
@@ -77,12 +115,14 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
77 |
$this->update_block_notice();
|
78 |
$this->do_tracking( true );
|
79 |
}
|
80 |
-
|
81 |
// Hook our do_tracking function to the daily action
|
|
|
|
|
82 |
add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) );
|
83 |
|
84 |
-
// Use this action for local testing
|
85 |
-
|
|
|
86 |
|
87 |
// Display the admin notice on activation
|
88 |
add_action( 'wpdeveloper_optin_notice', array( $this, 'optin_notice' ) );
|
@@ -108,7 +148,16 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
108 |
wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
|
109 |
}
|
110 |
}
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
/**
|
113 |
* This is our function to get everything going
|
114 |
* Check that user has opted in
|
@@ -143,7 +192,6 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
143 |
|
144 |
// Send the data
|
145 |
$this->send_data( $body );
|
146 |
-
|
147 |
}
|
148 |
|
149 |
/**
|
@@ -192,7 +240,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
192 |
'site_version' => get_bloginfo( 'version' ),
|
193 |
'site_language' => get_bloginfo( 'language' ),
|
194 |
'charset' => get_bloginfo( 'charset' ),
|
195 |
-
'
|
196 |
'php_version' => phpversion(),
|
197 |
'multisite' => is_multisite(),
|
198 |
'file_location' => __FILE__
|
@@ -266,7 +314,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
266 |
foreach( $options as $option ) {
|
267 |
$fields = get_option( $option );
|
268 |
// Check for permission to send this option
|
269 |
-
if( isset( $fields['
|
270 |
foreach( $fields as $key=>$value ) {
|
271 |
$plugin_options[$key] = $value;
|
272 |
}
|
@@ -323,11 +371,11 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
323 |
$body['deactivated_date'] = time();
|
324 |
|
325 |
// Add deactivation form data
|
326 |
-
if( false !== get_option( '
|
327 |
-
$body['deactivation_reason'] = get_option( '
|
328 |
}
|
329 |
-
if( false !== get_option( '
|
330 |
-
$body['deactivation_details'] = get_option( '
|
331 |
}
|
332 |
|
333 |
$this->send_data( $body );
|
@@ -345,8 +393,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
345 |
$this->set_is_tracking_allowed( false, $this->plugin_name );
|
346 |
return false;
|
347 |
}
|
348 |
-
// The
|
349 |
-
$allow_tracking = get_option( '
|
350 |
// If this plugin is in the array, then tracking is allowed
|
351 |
if( isset( $allow_tracking[$this->plugin_name] ) ) {
|
352 |
return true;
|
@@ -365,8 +413,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
365 |
if( empty( $plugin ) ) {
|
366 |
$plugin = $this->plugin_name;
|
367 |
}
|
368 |
-
// The
|
369 |
-
$allow_tracking = get_option( '
|
370 |
|
371 |
// If the user has decided to opt out
|
372 |
if( $this->has_user_opted_out() ) {
|
@@ -387,7 +435,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
387 |
unset( $allow_tracking[$plugin] );
|
388 |
}
|
389 |
}
|
390 |
-
update_option( '
|
391 |
}
|
392 |
|
393 |
/**
|
@@ -396,13 +444,13 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
396 |
* @return Boolean
|
397 |
*/
|
398 |
public function has_user_opted_out() {
|
399 |
-
// Iterate through the options that are being tracked looking for
|
400 |
if( ! empty( $this->options ) ) {
|
401 |
foreach( $this->options as $option_name ) {
|
402 |
// Check each option
|
403 |
$options = get_option( $option_name );
|
404 |
// If we find the setting, return true
|
405 |
-
if( ! empty( $options['
|
406 |
return true;
|
407 |
}
|
408 |
}
|
@@ -416,7 +464,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
416 |
*/
|
417 |
public function get_is_time_to_track() {
|
418 |
// Let's see if we're due to track this plugin yet
|
419 |
-
$track_times = get_option( '
|
420 |
if( ! isset( $track_times[$this->plugin_name] ) ) {
|
421 |
// If we haven't set a time for this plugin yet, then we must track it
|
422 |
return true;
|
@@ -435,10 +483,10 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
435 |
*/
|
436 |
public function set_track_time() {
|
437 |
// We've tracked, so record the time
|
438 |
-
$track_times = get_option( '
|
439 |
// Set different times according to plugin, in case we are tracking multiple plugins
|
440 |
$track_times[$this->plugin_name] = time();
|
441 |
-
update_option( '
|
442 |
}
|
443 |
|
444 |
/**
|
@@ -450,7 +498,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
450 |
if( empty( $plugin ) ) {
|
451 |
$plugin = $this->plugin_name;
|
452 |
}
|
453 |
-
$block_notice = get_option( '
|
454 |
if( empty( $block_notice ) || ! is_array( $block_notice ) ) {
|
455 |
// If nothing exists in the option yet, start a new array with the plugin name
|
456 |
$block_notice = array( $plugin => $plugin );
|
@@ -458,7 +506,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
458 |
// Else add the plugin name to the array
|
459 |
$block_notice[$plugin] = $plugin;
|
460 |
}
|
461 |
-
update_option( '
|
462 |
}
|
463 |
|
464 |
/**
|
@@ -466,8 +514,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
466 |
* @since 1.0.0
|
467 |
*/
|
468 |
public function get_can_collect_email() {
|
469 |
-
// The
|
470 |
-
$collect_email = get_option( '
|
471 |
// If this plugin is in the array, then we can collect the email address
|
472 |
if( isset( $collect_email[$this->plugin_name] ) ) {
|
473 |
return true;
|
@@ -486,8 +534,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
486 |
if( empty( $plugin ) ) {
|
487 |
$plugin = $this->plugin_name;
|
488 |
}
|
489 |
-
// The
|
490 |
-
$collect_email = get_option( '
|
491 |
// If the user has agreed to allow tracking or if opt-in is not required
|
492 |
if( $can_collect ) {
|
493 |
if( empty( $collect_email ) || ! is_array( $collect_email ) ) {
|
@@ -502,7 +550,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
502 |
unset( $collect_email[$plugin] );
|
503 |
}
|
504 |
}
|
505 |
-
update_option( '
|
506 |
}
|
507 |
|
508 |
/**
|
@@ -511,8 +559,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
511 |
* @return Email address
|
512 |
*/
|
513 |
public function get_admin_email() {
|
514 |
-
// The
|
515 |
-
$email = get_option( '
|
516 |
// If this plugin is in the array, then we can collect the email address
|
517 |
if( isset( $email[$this->plugin_name] ) ) {
|
518 |
return $email[$this->plugin_name];
|
@@ -540,8 +588,8 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
540 |
$email = $current_user->user_email;
|
541 |
}
|
542 |
}
|
543 |
-
// The
|
544 |
-
$admin_emails = get_option( '
|
545 |
if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) {
|
546 |
// If nothing exists in the option yet, start a new array with the plugin name
|
547 |
$admin_emails = array( $plugin => sanitize_email( $email ) );
|
@@ -549,15 +597,10 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
549 |
// Else add the email address to the array, if not already set
|
550 |
$admin_emails[$plugin] = sanitize_email( $email );
|
551 |
}
|
552 |
-
update_option( '
|
553 |
}
|
554 |
-
|
555 |
-
|
556 |
-
* Display the admin notice to users to allow them to opt in
|
557 |
-
*
|
558 |
-
* @since 1.0.0
|
559 |
-
*/
|
560 |
-
public function optin_notice() {
|
561 |
// Check for plugin args
|
562 |
if( isset( $_GET['plugin'] ) && isset( $_GET['plugin_action'] ) ) {
|
563 |
$plugin = sanitize_text_field( $_GET['plugin'] );
|
@@ -570,10 +613,17 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
570 |
}
|
571 |
$this->update_block_notice( $plugin );
|
572 |
}
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
// Check whether to block the notice, e.g. because we're in a local environment
|
575 |
-
//
|
576 |
-
$block_notice = get_option( '
|
577 |
if( isset( $block_notice[$this->plugin_name] ) ) {
|
578 |
return;
|
579 |
}
|
@@ -584,7 +634,12 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
584 |
|
585 |
// @credit EDD
|
586 |
// Don't bother asking user to opt in if they're in local dev
|
587 |
-
|
|
|
|
|
|
|
|
|
|
|
588 |
$this->update_block_notice();
|
589 |
} else {
|
590 |
|
@@ -622,7 +677,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
622 |
$notice_text = __( 'Want to help make <strong>Essential Addons for Elementor</strong> even more awesome? You can get a <strong>25% discount coupon</strong> for Pro upgrade if you allow. <a class="insights-data-we-collect" href="#">What we collect.</a>', 'plugin-usage-tracker' );
|
623 |
}
|
624 |
// And we allow you to filter the text anyway
|
625 |
-
$notice_text = apply_filters( '
|
626 |
|
627 |
<div class="notice notice-info updated put-dismiss-notice">
|
628 |
<p><?php echo __( $notice_text ); ?></p>
|
@@ -671,7 +726,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
671 |
) );
|
672 |
|
673 |
$marketing_text = __( 'Thank you for opting in to tracking. Would you like to receive occasional news about this plugin, including details of new features and special offers?', 'plugin-usage-tracker' );
|
674 |
-
$marketing_text = apply_filters( '
|
675 |
|
676 |
<div class="notice notice-info updated put-dismiss-notice">
|
677 |
<p><?php echo '<strong>' . esc_html( $plugin_name ) . '</strong>'; ?></p>
|
@@ -695,8 +750,10 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
695 |
}
|
696 |
if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
|
697 |
$deactivation_link = $links['deactivate'];
|
|
|
|
|
698 |
// Insert an onClick action to allow form before deactivating
|
699 |
-
$deactivation_link = str_replace( '<a ', '<div class="put-goodbye-form-wrapper"><span class="put-goodbye-form" id="put-goodbye-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="put-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
700 |
$links['deactivate'] = $deactivation_link;
|
701 |
}
|
702 |
return $links;
|
@@ -711,16 +768,23 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
711 |
$form = array();
|
712 |
$form['heading'] = __( 'Sorry to see you go', 'plugin-usage-tracker' );
|
713 |
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'plugin-usage-tracker' );
|
|
|
714 |
$form['options'] = array(
|
715 |
-
__( '
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
__( '
|
721 |
-
__( '
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
);
|
723 |
-
|
724 |
return $form;
|
725 |
}
|
726 |
|
@@ -732,7 +796,7 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
732 |
*/
|
733 |
public function form_filterable_text() {
|
734 |
$form = $this->form_default_text();
|
735 |
-
return apply_filters( '
|
736 |
}
|
737 |
|
738 |
/**
|
@@ -748,59 +812,105 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
748 |
$form = $this->form_default_text();
|
749 |
}
|
750 |
// Build the HTML to go in the form
|
751 |
-
$html = '<div class="put-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
752 |
-
$html .= '<div class="put-goodbye-form-body"><p>' . esc_html( $form['body'] ) . '</p>';
|
753 |
if( is_array( $form['options'] ) ) {
|
754 |
-
$html .= '<div class="put-goodbye-options"><
|
755 |
foreach( $form['options'] as $option ) {
|
756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
757 |
}
|
758 |
-
$html .= '</
|
759 |
-
$html .= '</div><!-- .put-goodbye-options -->';
|
760 |
}
|
761 |
-
$html .= '</div><!-- .put-goodbye-form-body -->';
|
762 |
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'plugin-usage-tracker' ) . '</p>';
|
763 |
?>
|
764 |
-
<div class="put-goodbye-form-bg"></div>
|
765 |
<style type="text/css">
|
766 |
-
.put-form-active .put-goodbye-form-bg {
|
767 |
-
background: rgba( 0, 0, 0, .
|
768 |
position: fixed;
|
769 |
top: 0;
|
770 |
left: 0;
|
771 |
width: 100%;
|
772 |
height: 100%;
|
|
|
773 |
}
|
774 |
-
.put-goodbye-form-wrapper {
|
775 |
position: relative;
|
776 |
-
z-index: 999;
|
777 |
display: none;
|
778 |
}
|
779 |
-
.put-form-active .put-goodbye-form-wrapper {
|
780 |
-
display:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
}
|
782 |
-
.put-goodbye-form {
|
783 |
display: none;
|
784 |
}
|
785 |
-
.put-form-active .put-goodbye-form {
|
786 |
-
position:
|
787 |
-
|
788 |
-
|
789 |
-
max-width: 400px;
|
790 |
background: #fff;
|
|
|
|
|
791 |
white-space: normal;
|
|
|
|
|
|
|
792 |
}
|
793 |
-
.put-goodbye-form-head {
|
794 |
-
background: #
|
795 |
-
color: #
|
796 |
-
padding:
|
|
|
|
|
797 |
}
|
798 |
-
.put-goodbye-form-
|
|
|
|
|
|
|
799 |
padding: 8px 18px;
|
800 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
}
|
802 |
.deactivating-spinner {
|
803 |
-
|
|
|
804 |
}
|
805 |
.deactivating-spinner .spinner {
|
806 |
float: none;
|
@@ -808,37 +918,80 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
808 |
vertical-align: bottom;
|
809 |
visibility: visible;
|
810 |
}
|
811 |
-
.put-goodbye-form-footer {
|
812 |
padding: 8px 18px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
813 |
}
|
814 |
</style>
|
815 |
<script>
|
816 |
jQuery(document).ready(function($){
|
817 |
-
$("#put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>").on("click",function(){
|
818 |
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
819 |
-
var url = document.getElementById("put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>");
|
820 |
-
$('body').toggleClass('put-form-active');
|
821 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeIn();
|
822 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo $html; ?>' + '<div class="put-goodbye-form-footer"><
|
823 |
$('#put-submit-form').on('click', function(e){
|
824 |
// As soon as we click, the body of the form should disappear
|
825 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .put-goodbye-form-body").fadeOut();
|
826 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .put-goodbye-form-footer").fadeOut();
|
827 |
// Fade in spinner
|
828 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .deactivating-spinner").fadeIn();
|
829 |
e.preventDefault();
|
830 |
-
var
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
var data = {
|
836 |
'action': 'goodbye_form',
|
837 |
-
'values':
|
838 |
'details': details,
|
839 |
-
'security': "<?php echo wp_create_nonce ( '
|
840 |
'dataType': "json"
|
841 |
}
|
|
|
842 |
$.post(
|
843 |
ajaxurl,
|
844 |
data,
|
@@ -848,12 +1001,19 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
848 |
}
|
849 |
);
|
850 |
});
|
|
|
|
|
|
|
|
|
|
|
851 |
// If we click outside the form, the form will close
|
852 |
-
$('.put-goodbye-form-bg').on('click',function(){
|
853 |
-
$("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeOut();
|
854 |
-
$('body').removeClass('put-form-active');
|
855 |
});
|
856 |
});
|
|
|
|
|
857 |
});
|
858 |
</script>
|
859 |
<?php }
|
@@ -863,14 +1023,14 @@ if( ! class_exists( 'Eael_Plugin_Usage_Tracker') ) {
|
|
863 |
* @since 1.0.0
|
864 |
*/
|
865 |
public function goodbye_form_callback() {
|
866 |
-
check_ajax_referer( '
|
867 |
if( isset( $_POST['values'] ) ) {
|
868 |
-
$values =
|
869 |
-
update_option( '
|
870 |
}
|
871 |
if( isset( $_POST['details'] ) ) {
|
872 |
$details = sanitize_text_field( $_POST['details'] );
|
873 |
-
update_option( '
|
874 |
}
|
875 |
$this->do_tracking(); // Run this straightaway
|
876 |
echo 'success';
|
14 |
|
15 |
class Eael_Plugin_Usage_Tracker {
|
16 |
|
17 |
+
private $wpins_version = '1.1.3';
|
18 |
private $home_url = '';
|
19 |
private $plugin_file = '';
|
20 |
private $plugin_name = '';
|
23 |
private $include_goodbye_form = true;
|
24 |
private $marketing = false;
|
25 |
private $collect_email = false;
|
26 |
+
private $pro_plugin_name = 'Essential Addons for Elementor Pro';
|
27 |
+
/**
|
28 |
+
* for matching the deactivation form header color with plugins appearance.
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
private $header_bg = '#3A56FF';
|
32 |
+
private $text_color = '#FFFFFF';
|
33 |
|
34 |
/**
|
35 |
* Class constructor
|
69 |
$this->init();
|
70 |
|
71 |
}
|
72 |
+
/**
|
73 |
+
* Migrate to the new Insights
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
public function migrate_plan(){
|
77 |
+
$old_key = array_flip( [ 'wisdom_allow_tracking', 'wisdom_last_track_time', 'wisdom_block_notice', 'wisdom_collect_email', 'wisdom_admin_emails', 'wisdom_deactivation_reason_' . $this->plugin_name, 'wisdom_deactivation_details_' . $this->plugin_name ] );
|
78 |
+
$new_key = [ 'wpins_allow_tracking', 'wpins_last_track_time', 'wpins_block_notice', 'wpins_collect_email', 'wpins_admin_emails', 'wpins_deactivation_reason_' . $this->plugin_name, 'wpins_deactivation_details_' . $this->plugin_name ];
|
79 |
+
|
80 |
+
foreach( $old_key as $key => $value ) {
|
81 |
+
$old_data = get_option( $key );
|
82 |
+
if( ! $old_data ) {
|
83 |
+
continue;
|
84 |
+
}
|
85 |
+
update_option( $new_key[ $value ], $old_data );
|
86 |
+
delete_option( $key );
|
87 |
+
}
|
88 |
+
}
|
89 |
+
/**
|
90 |
+
* This function is fired for one time in a life time!
|
91 |
+
* if the data is not removed.
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function force_track_for_one_time(){
|
95 |
+
$is_tracked = get_option( 'wpins_'. $this->plugin_name .'_force_tracked' );
|
96 |
+
if( ! $is_tracked ) {
|
97 |
+
$this->do_tracking( true );
|
98 |
+
update_option( 'wpins_'. $this->plugin_name .'_force_tracked', true );
|
99 |
+
}
|
100 |
+
}
|
101 |
|
102 |
public function init() {
|
103 |
+
if( version_compare( $this->wpins_version, '1.1.2', '>' ) ) {
|
104 |
+
$this->migrate_plan();
|
105 |
+
}
|
106 |
// Check marketing
|
107 |
if( $this->marketing == 3 ) {
|
108 |
$this->set_can_collect_email( true, $this->plugin_name );
|
109 |
}
|
|
|
110 |
// Check whether opt-in is required
|
111 |
// If not, then tracking is allowed
|
112 |
if( ! $this->require_optin ) {
|
115 |
$this->update_block_notice();
|
116 |
$this->do_tracking( true );
|
117 |
}
|
|
|
118 |
// Hook our do_tracking function to the daily action
|
119 |
+
add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) );
|
120 |
+
|
121 |
add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) );
|
122 |
|
123 |
+
// Use this action for local testing and for one time force tracking in a life time.
|
124 |
+
add_action( 'admin_init', array( $this, 'force_track_for_one_time' ) );
|
125 |
+
add_action( 'admin_init', array( $this, 'force_tracking' ) );
|
126 |
|
127 |
// Display the admin notice on activation
|
128 |
add_action( 'wpdeveloper_optin_notice', array( $this, 'optin_notice' ) );
|
148 |
wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
|
149 |
}
|
150 |
}
|
151 |
+
/**
|
152 |
+
* This function is responsible for force tracking the plugin,
|
153 |
+
* if users are allowed to do!
|
154 |
+
*
|
155 |
+
* @return void
|
156 |
+
*/
|
157 |
+
public function force_tracking(){
|
158 |
+
$this->do_tracking( true );
|
159 |
+
}
|
160 |
+
|
161 |
/**
|
162 |
* This is our function to get everything going
|
163 |
* Check that user has opted in
|
192 |
|
193 |
// Send the data
|
194 |
$this->send_data( $body );
|
|
|
195 |
}
|
196 |
|
197 |
/**
|
240 |
'site_version' => get_bloginfo( 'version' ),
|
241 |
'site_language' => get_bloginfo( 'language' ),
|
242 |
'charset' => get_bloginfo( 'charset' ),
|
243 |
+
'wpins_version' => $this->wpins_version,
|
244 |
'php_version' => phpversion(),
|
245 |
'multisite' => is_multisite(),
|
246 |
'file_location' => __FILE__
|
314 |
foreach( $options as $option ) {
|
315 |
$fields = get_option( $option );
|
316 |
// Check for permission to send this option
|
317 |
+
if( isset( $fields['wpins_registered_setting'] ) ) {
|
318 |
foreach( $fields as $key=>$value ) {
|
319 |
$plugin_options[$key] = $value;
|
320 |
}
|
371 |
$body['deactivated_date'] = time();
|
372 |
|
373 |
// Add deactivation form data
|
374 |
+
if( false !== get_option( 'wpins_deactivation_reason_' . $this->plugin_name ) ) {
|
375 |
+
$body['deactivation_reason'] = get_option( 'wpins_deactivation_reason_' . $this->plugin_name );
|
376 |
}
|
377 |
+
if( false !== get_option( 'wpins_deactivation_details_' . $this->plugin_name ) ) {
|
378 |
+
$body['deactivation_details'] = get_option( 'wpins_deactivation_details_' . $this->plugin_name );
|
379 |
}
|
380 |
|
381 |
$this->send_data( $body );
|
393 |
$this->set_is_tracking_allowed( false, $this->plugin_name );
|
394 |
return false;
|
395 |
}
|
396 |
+
// The wpins_allow_tracking option is an array of plugins that are being tracked
|
397 |
+
$allow_tracking = get_option( 'wpins_allow_tracking' );
|
398 |
// If this plugin is in the array, then tracking is allowed
|
399 |
if( isset( $allow_tracking[$this->plugin_name] ) ) {
|
400 |
return true;
|
413 |
if( empty( $plugin ) ) {
|
414 |
$plugin = $this->plugin_name;
|
415 |
}
|
416 |
+
// The wpins_allow_tracking option is an array of plugins that are being tracked
|
417 |
+
$allow_tracking = get_option( 'wpins_allow_tracking' );
|
418 |
|
419 |
// If the user has decided to opt out
|
420 |
if( $this->has_user_opted_out() ) {
|
435 |
unset( $allow_tracking[$plugin] );
|
436 |
}
|
437 |
}
|
438 |
+
update_option( 'wpins_allow_tracking', $allow_tracking );
|
439 |
}
|
440 |
|
441 |
/**
|
444 |
* @return Boolean
|
445 |
*/
|
446 |
public function has_user_opted_out() {
|
447 |
+
// Iterate through the options that are being tracked looking for wpins_opt_out setting
|
448 |
if( ! empty( $this->options ) ) {
|
449 |
foreach( $this->options as $option_name ) {
|
450 |
// Check each option
|
451 |
$options = get_option( $option_name );
|
452 |
// If we find the setting, return true
|
453 |
+
if( ! empty( $options['wpins_opt_out'] ) ) {
|
454 |
return true;
|
455 |
}
|
456 |
}
|
464 |
*/
|
465 |
public function get_is_time_to_track() {
|
466 |
// Let's see if we're due to track this plugin yet
|
467 |
+
$track_times = get_option( 'wpins_last_track_time', array() );
|
468 |
if( ! isset( $track_times[$this->plugin_name] ) ) {
|
469 |
// If we haven't set a time for this plugin yet, then we must track it
|
470 |
return true;
|
483 |
*/
|
484 |
public function set_track_time() {
|
485 |
// We've tracked, so record the time
|
486 |
+
$track_times = get_option( 'wpins_last_track_time', array() );
|
487 |
// Set different times according to plugin, in case we are tracking multiple plugins
|
488 |
$track_times[$this->plugin_name] = time();
|
489 |
+
update_option( 'wpins_last_track_time', $track_times );
|
490 |
}
|
491 |
|
492 |
/**
|
498 |
if( empty( $plugin ) ) {
|
499 |
$plugin = $this->plugin_name;
|
500 |
}
|
501 |
+
$block_notice = get_option( 'wpins_block_notice' );
|
502 |
if( empty( $block_notice ) || ! is_array( $block_notice ) ) {
|
503 |
// If nothing exists in the option yet, start a new array with the plugin name
|
504 |
$block_notice = array( $plugin => $plugin );
|
506 |
// Else add the plugin name to the array
|
507 |
$block_notice[$plugin] = $plugin;
|
508 |
}
|
509 |
+
update_option( 'wpins_block_notice', $block_notice );
|
510 |
}
|
511 |
|
512 |
/**
|
514 |
* @since 1.0.0
|
515 |
*/
|
516 |
public function get_can_collect_email() {
|
517 |
+
// The wpins_collect_email option is an array of plugins that are being tracked
|
518 |
+
$collect_email = get_option( 'wpins_collect_email' );
|
519 |
// If this plugin is in the array, then we can collect the email address
|
520 |
if( isset( $collect_email[$this->plugin_name] ) ) {
|
521 |
return true;
|
534 |
if( empty( $plugin ) ) {
|
535 |
$plugin = $this->plugin_name;
|
536 |
}
|
537 |
+
// The wpins_collect_email option is an array of plugins that are being tracked
|
538 |
+
$collect_email = get_option( 'wpins_collect_email' );
|
539 |
// If the user has agreed to allow tracking or if opt-in is not required
|
540 |
if( $can_collect ) {
|
541 |
if( empty( $collect_email ) || ! is_array( $collect_email ) ) {
|
550 |
unset( $collect_email[$plugin] );
|
551 |
}
|
552 |
}
|
553 |
+
update_option( 'wpins_collect_email', $collect_email );
|
554 |
}
|
555 |
|
556 |
/**
|
559 |
* @return Email address
|
560 |
*/
|
561 |
public function get_admin_email() {
|
562 |
+
// The wpins_collect_email option is an array of plugins that are being tracked
|
563 |
+
$email = get_option( 'wpins_admin_emails' );
|
564 |
// If this plugin is in the array, then we can collect the email address
|
565 |
if( isset( $email[$this->plugin_name] ) ) {
|
566 |
return $email[$this->plugin_name];
|
588 |
$email = $current_user->user_email;
|
589 |
}
|
590 |
}
|
591 |
+
// The wpins_admin_emails option is an array of admin email addresses
|
592 |
+
$admin_emails = get_option( 'wpins_admin_emails' );
|
593 |
if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) {
|
594 |
// If nothing exists in the option yet, start a new array with the plugin name
|
595 |
$admin_emails = array( $plugin => sanitize_email( $email ) );
|
597 |
// Else add the email address to the array, if not already set
|
598 |
$admin_emails[$plugin] = sanitize_email( $email );
|
599 |
}
|
600 |
+
update_option( 'wpins_admin_emails', $admin_emails );
|
601 |
}
|
602 |
+
|
603 |
+
public function clicked(){
|
|
|
|
|
|
|
|
|
|
|
604 |
// Check for plugin args
|
605 |
if( isset( $_GET['plugin'] ) && isset( $_GET['plugin_action'] ) ) {
|
606 |
$plugin = sanitize_text_field( $_GET['plugin'] );
|
613 |
}
|
614 |
$this->update_block_notice( $plugin );
|
615 |
}
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Display the admin notice to users to allow them to opt in
|
620 |
+
*
|
621 |
+
* @since 1.0.0
|
622 |
+
*/
|
623 |
+
public function optin_notice() {
|
624 |
// Check whether to block the notice, e.g. because we're in a local environment
|
625 |
+
// wpins_block_notice works the same as wpins_allow_tracking, an array of plugin names
|
626 |
+
$block_notice = get_option( 'wpins_block_notice' );
|
627 |
if( isset( $block_notice[$this->plugin_name] ) ) {
|
628 |
return;
|
629 |
}
|
634 |
|
635 |
// @credit EDD
|
636 |
// Don't bother asking user to opt in if they're in local dev
|
637 |
+
$is_local = false;
|
638 |
+
if( stristr( network_site_url( '/' ), '.test' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) {
|
639 |
+
$is_local = true;
|
640 |
+
}
|
641 |
+
$is_local = apply_filters( 'wpins_is_local_' . $this->plugin_name, $is_local );
|
642 |
+
if ( $is_local ) {
|
643 |
$this->update_block_notice();
|
644 |
} else {
|
645 |
|
677 |
$notice_text = __( 'Want to help make <strong>Essential Addons for Elementor</strong> even more awesome? You can get a <strong>25% discount coupon</strong> for Pro upgrade if you allow. <a class="insights-data-we-collect" href="#">What we collect.</a>', 'plugin-usage-tracker' );
|
678 |
}
|
679 |
// And we allow you to filter the text anyway
|
680 |
+
$notice_text = apply_filters( 'wpins_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?>
|
681 |
|
682 |
<div class="notice notice-info updated put-dismiss-notice">
|
683 |
<p><?php echo __( $notice_text ); ?></p>
|
726 |
) );
|
727 |
|
728 |
$marketing_text = __( 'Thank you for opting in to tracking. Would you like to receive occasional news about this plugin, including details of new features and special offers?', 'plugin-usage-tracker' );
|
729 |
+
$marketing_text = apply_filters( 'wpins_marketing_text_' . esc_attr( $this->plugin_name ), $marketing_text ); ?>
|
730 |
|
731 |
<div class="notice notice-info updated put-dismiss-notice">
|
732 |
<p><?php echo '<strong>' . esc_html( $plugin_name ) . '</strong>'; ?></p>
|
750 |
}
|
751 |
if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
|
752 |
$deactivation_link = $links['deactivate'];
|
753 |
+
|
754 |
+
|
755 |
// Insert an onClick action to allow form before deactivating
|
756 |
+
$deactivation_link = str_replace( '<a ', '<div class="eael-put-goodbye-form-wrapper"><div class="eael-put-goodbye-form-bg"></div><span class="eael-put-goodbye-form" id="eael-put-goodbye-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="eael-put-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
757 |
$links['deactivate'] = $deactivation_link;
|
758 |
}
|
759 |
return $links;
|
768 |
$form = array();
|
769 |
$form['heading'] = __( 'Sorry to see you go', 'plugin-usage-tracker' );
|
770 |
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'plugin-usage-tracker' );
|
771 |
+
|
772 |
$form['options'] = array(
|
773 |
+
__( 'I no longer need the plugin', 'plugin-usage-tracker' ),
|
774 |
+
[
|
775 |
+
'label' => __( 'I found a better plugin', 'plugin-usage-tracker' ),
|
776 |
+
'extra_field' => __( 'Please share which plugin', 'plugin-usage-tracker' )
|
777 |
+
],
|
778 |
+
__( "I couldn't get the plugin to work", 'plugin-usage-tracker' ),
|
779 |
+
__( 'It\'s a temporary deactivation', 'plugin-usage-tracker' ),
|
780 |
+
__( 'I have '. $this->pro_plugin_name, 'plugin-usage-tracker' ),
|
781 |
+
[
|
782 |
+
'label' => __( 'Other', 'plugin-usage-tracker' ),
|
783 |
+
'extra_field' => __( 'Please share the reason', 'plugin-usage-tracker' ),
|
784 |
+
'type' => 'textarea'
|
785 |
+
]
|
786 |
);
|
787 |
+
|
788 |
return $form;
|
789 |
}
|
790 |
|
796 |
*/
|
797 |
public function form_filterable_text() {
|
798 |
$form = $this->form_default_text();
|
799 |
+
return apply_filters( 'wpins_form_text_' . esc_attr( $this->plugin_name ), $form );
|
800 |
}
|
801 |
|
802 |
/**
|
812 |
$form = $this->form_default_text();
|
813 |
}
|
814 |
// Build the HTML to go in the form
|
815 |
+
$html = '<div class="eael-put-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
816 |
+
$html .= '<div class="eael-put-goodbye-form-body"><p class="eael-put-goodbye-form-caption">' . esc_html( $form['body'] ) . '</p>';
|
817 |
if( is_array( $form['options'] ) ) {
|
818 |
+
$html .= '<div id="eael-put-goodbye-options" class="eael-put-goodbye-options"><ul>';
|
819 |
foreach( $form['options'] as $option ) {
|
820 |
+
if( is_array( $option ) ) {
|
821 |
+
$id = strtolower( str_replace( " ", "_", esc_attr( $option['label'] ) ) );
|
822 |
+
$html .= '<li class="has-goodbye-extra">';
|
823 |
+
$html .= '<input type="radio" name="eael-put-goodbye-options" id="' . $id . '" value="' . esc_attr( $option['label'] ) . '">';
|
824 |
+
$html .= '<div><label for="' . $id . '">' . esc_attr( $option['label'] ) . '</label>';
|
825 |
+
if( isset( $option[ 'extra_field' ] ) && ! isset( $option['type'] )) {
|
826 |
+
$html .= '<input type="text" style="display: none" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '">';
|
827 |
+
}
|
828 |
+
if( isset( $option[ 'extra_field' ] ) && isset( $option['type'] )) {
|
829 |
+
$html .= '<'. $option['type'] .' style="display: none" type="text" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '"></' . $option['type'] . '>';
|
830 |
+
}
|
831 |
+
$html .= '</div></li>';
|
832 |
+
} else {
|
833 |
+
$id = strtolower( str_replace( " ", "_", esc_attr( $option ) ) );
|
834 |
+
$html .= '<li><input type="radio" name="eael-put-goodbye-options" id="' . $id . '" value="' . esc_attr( $option ) . '"> <label for="' . $id . '">' . esc_attr( $option ) . '</label></li>';
|
835 |
+
}
|
836 |
}
|
837 |
+
$html .= '</ul></div><!-- .eael-put-goodbye-options -->';
|
|
|
838 |
}
|
839 |
+
$html .= '</div><!-- .eael-put-goodbye-form-body -->';
|
840 |
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'plugin-usage-tracker' ) . '</p>';
|
841 |
?>
|
|
|
842 |
<style type="text/css">
|
843 |
+
.eael-put-form-active .eael-put-goodbye-form-bg {
|
844 |
+
background: rgba( 0, 0, 0, .8 );
|
845 |
position: fixed;
|
846 |
top: 0;
|
847 |
left: 0;
|
848 |
width: 100%;
|
849 |
height: 100%;
|
850 |
+
z-index: 9;
|
851 |
}
|
852 |
+
.eael-put-goodbye-form-wrapper {
|
853 |
position: relative;
|
|
|
854 |
display: none;
|
855 |
}
|
856 |
+
.eael-put-form-active .eael-put-goodbye-form-wrapper {
|
857 |
+
display: flex !important;
|
858 |
+
align-items: center;
|
859 |
+
justify-content: center;
|
860 |
+
width: 100%;
|
861 |
+
height: 100%;
|
862 |
+
position: fixed;
|
863 |
+
left: 0px;
|
864 |
+
top: 0px;
|
865 |
}
|
866 |
+
.eael-put-goodbye-form {
|
867 |
display: none;
|
868 |
}
|
869 |
+
.eael-put-form-active .eael-put-goodbye-form {
|
870 |
+
position: relative !important;
|
871 |
+
width: 550px;
|
872 |
+
max-width: 80%;
|
|
|
873 |
background: #fff;
|
874 |
+
box-shadow: 2px 8px 23px 3px rgba(0,0,0,.2);
|
875 |
+
border-radius: 3px;
|
876 |
white-space: normal;
|
877 |
+
overflow: hidden;
|
878 |
+
display: block;
|
879 |
+
z-index: 999999;
|
880 |
}
|
881 |
+
.eael-put-goodbye-form-head {
|
882 |
+
background: #fff;
|
883 |
+
color: #495157;
|
884 |
+
padding: 18px;
|
885 |
+
box-shadow: 0 0 8px rgba(0,0,0,.1);
|
886 |
+
font-size: 15px;
|
887 |
}
|
888 |
+
.eael-put-goodbye-form .eael-put-goodbye-form-head strong {
|
889 |
+
font-size: 15px;
|
890 |
+
}
|
891 |
+
.eael-put-goodbye-form-body {
|
892 |
padding: 8px 18px;
|
893 |
+
color: #333;
|
894 |
+
}
|
895 |
+
.eael-put-goodbye-form-body label {
|
896 |
+
color: #6d7882;
|
897 |
+
padding-left: 5px;
|
898 |
+
}
|
899 |
+
.eael-put-goodbye-form-body .eael-put-goodbye-form-caption {
|
900 |
+
font-weight: 500;
|
901 |
+
font-size: 15px;
|
902 |
+
color: #495157;
|
903 |
+
line-height: 1.4;
|
904 |
+
}
|
905 |
+
.eael-put-goodbye-form-body #eael-put-goodbye-options {
|
906 |
+
padding-top: 5px;
|
907 |
+
}
|
908 |
+
.eael-put-goodbye-form-body #eael-put-goodbye-options ul > li {
|
909 |
+
margin-bottom: 15px;
|
910 |
}
|
911 |
.deactivating-spinner {
|
912 |
+
display: none;
|
913 |
+
padding-bottom: 20px !important;
|
914 |
}
|
915 |
.deactivating-spinner .spinner {
|
916 |
float: none;
|
918 |
vertical-align: bottom;
|
919 |
visibility: visible;
|
920 |
}
|
921 |
+
.eael-put-goodbye-form-footer {
|
922 |
padding: 8px 18px;
|
923 |
+
margin-bottom: 15px;
|
924 |
+
}
|
925 |
+
.eael-put-goodbye-form-footer > .eael-put-goodbye-form-buttons {
|
926 |
+
display: flex;
|
927 |
+
align-items: center;
|
928 |
+
justify-content: space-between;
|
929 |
+
}
|
930 |
+
.eael-put-goodbye-form-footer .eael-put-submit-btn {
|
931 |
+
background-color: #d30c5c;
|
932 |
+
-webkit-border-radius: 3px;
|
933 |
+
border-radius: 3px;
|
934 |
+
color: #fff;
|
935 |
+
line-height: 1;
|
936 |
+
padding: 15px 20px;
|
937 |
+
font-size: 13px;
|
938 |
+
}
|
939 |
+
.eael-put-goodbye-form-footer .eael-put-deactivate-btn {
|
940 |
+
font-size: 13px;
|
941 |
+
color: #a4afb7;
|
942 |
+
background: none;
|
943 |
+
float: right;
|
944 |
+
padding-right: 10px;
|
945 |
+
width: auto;
|
946 |
+
text-decoration: underline;
|
947 |
+
}
|
948 |
+
#eael-put-goodbye-options ul li > div {
|
949 |
+
display: inline;
|
950 |
+
padding-left: 3px;
|
951 |
+
}
|
952 |
+
#eael-put-goodbye-options ul li > div > input, #eael-put-goodbye-options ul li > div > textarea {
|
953 |
+
margin: 10px 18px;
|
954 |
+
padding: 8px;
|
955 |
+
width: 80%;
|
956 |
}
|
957 |
</style>
|
958 |
<script>
|
959 |
jQuery(document).ready(function($){
|
960 |
+
$("#eael-put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>").on("click",function(){
|
961 |
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
962 |
+
var url = document.getElementById("eael-put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>");
|
963 |
+
$('body').toggleClass('eael-put-form-active');
|
964 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeIn();
|
965 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo $html; ?>' + '<div class="eael-put-goodbye-form-footer"><div class="eael-put-goodbye-form-buttons"><a id="put-submit-form" class="eael-put-submit-btn" href="#"><?php _e( 'Submit and Deactivate', 'plugin-usage-tracker' ); ?></a> <a class="eael-put-deactivate-btn" href="'+url+'"><?php _e( 'Just Deactivate', 'plugin-usage-tracker' ); ?></a></div></div>');
|
966 |
$('#put-submit-form').on('click', function(e){
|
967 |
// As soon as we click, the body of the form should disappear
|
968 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .eael-put-goodbye-form-body").fadeOut();
|
969 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .eael-put-goodbye-form-footer").fadeOut();
|
970 |
// Fade in spinner
|
971 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .deactivating-spinner").fadeIn();
|
972 |
e.preventDefault();
|
973 |
+
var checkedInput = $("input[name='eael-put-goodbye-options']:checked"),
|
974 |
+
checkedInputVal, details;
|
975 |
+
if( checkedInput.length > 0 ) {
|
976 |
+
checkedInputVal = checkedInput.val();
|
977 |
+
details = $('input[name="'+ checkedInput[0].id +'"], textarea[name="'+ checkedInput[0].id +'"]').val();
|
978 |
+
}
|
979 |
+
|
980 |
+
if( typeof details === 'undefined' ) {
|
981 |
+
details = '';
|
982 |
+
}
|
983 |
+
if( typeof checkedInputVal === 'undefined' ) {
|
984 |
+
checkedInputVal = 'No Reason';
|
985 |
+
}
|
986 |
+
|
987 |
var data = {
|
988 |
'action': 'goodbye_form',
|
989 |
+
'values': checkedInputVal,
|
990 |
'details': details,
|
991 |
+
'security': "<?php echo wp_create_nonce ( 'wpins_goodbye_form' ); ?>",
|
992 |
'dataType': "json"
|
993 |
}
|
994 |
+
|
995 |
$.post(
|
996 |
ajaxurl,
|
997 |
data,
|
1001 |
}
|
1002 |
);
|
1003 |
});
|
1004 |
+
$('#eael-put-goodbye-options > ul ').on('click', 'li label, li > input', function( e ){
|
1005 |
+
var parent = $(this).parents('li');
|
1006 |
+
parent.siblings().find('label').next('input, textarea').css('display', 'none');
|
1007 |
+
parent.find('label').next('input, textarea').css('display', 'block');
|
1008 |
+
});
|
1009 |
// If we click outside the form, the form will close
|
1010 |
+
$('.eael-put-goodbye-form-bg').on('click',function(){
|
1011 |
+
$("#eael-put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeOut();
|
1012 |
+
$('body').removeClass('eael-put-form-active');
|
1013 |
});
|
1014 |
});
|
1015 |
+
|
1016 |
+
|
1017 |
});
|
1018 |
</script>
|
1019 |
<?php }
|
1023 |
* @since 1.0.0
|
1024 |
*/
|
1025 |
public function goodbye_form_callback() {
|
1026 |
+
check_ajax_referer( 'wpins_goodbye_form', 'security' );
|
1027 |
if( isset( $_POST['values'] ) ) {
|
1028 |
+
$values = $_POST['values'];
|
1029 |
+
update_option( 'wpins_deactivation_reason_' . $this->plugin_name, $values );
|
1030 |
}
|
1031 |
if( isset( $_POST['details'] ) ) {
|
1032 |
$details = sanitize_text_field( $_POST['details'] );
|
1033 |
+
update_option( 'wpins_deactivation_details_' . $this->plugin_name, $details );
|
1034 |
}
|
1035 |
$this->do_tracking(); // Run this straightaway
|
1036 |
echo 'success';
|
includes/class-wpdev-core-install.php
CHANGED
File without changes
|
includes/class-wpdev-notices.php
CHANGED
@@ -108,6 +108,7 @@ class WPDeveloper_Notice {
|
|
108 |
* @return void
|
109 |
*/
|
110 |
public function hooks(){
|
|
|
111 |
add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) );
|
112 |
add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) );
|
113 |
add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) );
|
@@ -115,8 +116,8 @@ class WPDeveloper_Notice {
|
|
115 |
add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) );
|
116 |
add_action( 'wpdeveloper_notices', array( $this, 'content' ) );
|
117 |
if( current_user_can( 'install_plugins' ) ) {
|
118 |
-
add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) );
|
119 |
if( isset( $_GET['plugin'] ) && $_GET['plugin'] == $this->plugin_name ) {
|
|
|
120 |
/**
|
121 |
* Redirect User To the Current URL, but without set query arguments.
|
122 |
*/
|
@@ -196,10 +197,7 @@ class WPDeveloper_Notice {
|
|
196 |
* When links are clicked, this function will invoked.
|
197 |
* @return void
|
198 |
*/
|
199 |
-
public function clicked(){
|
200 |
-
// if( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) {
|
201 |
-
// return;
|
202 |
-
// }
|
203 |
if( isset( $_GET['plugin'] ) && $_GET['plugin'] === $this->plugin_name ) {
|
204 |
$options_data = $this->get_options_data();
|
205 |
$clicked_from = current( $this->next_notice() );
|
@@ -456,7 +454,6 @@ class WPDeveloper_Notice {
|
|
456 |
*/
|
457 |
public function admin_notices(){
|
458 |
$current_notice = current( $this->next_notice() );
|
459 |
-
do_action( 'wpdeveloper_notice_clicked' );
|
460 |
if( $current_notice == 'opt_in' ) {
|
461 |
do_action( 'wpdeveloper_notices' );
|
462 |
return;
|
108 |
* @return void
|
109 |
*/
|
110 |
public function hooks(){
|
111 |
+
add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) );
|
112 |
add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) );
|
113 |
add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) );
|
114 |
add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) );
|
116 |
add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) );
|
117 |
add_action( 'wpdeveloper_notices', array( $this, 'content' ) );
|
118 |
if( current_user_can( 'install_plugins' ) ) {
|
|
|
119 |
if( isset( $_GET['plugin'] ) && $_GET['plugin'] == $this->plugin_name ) {
|
120 |
+
do_action( 'wpdeveloper_notice_clicked' );
|
121 |
/**
|
122 |
* Redirect User To the Current URL, but without set query arguments.
|
123 |
*/
|
197 |
* When links are clicked, this function will invoked.
|
198 |
* @return void
|
199 |
*/
|
200 |
+
public function clicked(){
|
|
|
|
|
|
|
201 |
if( isset( $_GET['plugin'] ) && $_GET['plugin'] === $this->plugin_name ) {
|
202 |
$options_data = $this->get_options_data();
|
203 |
$clicked_from = current( $this->next_notice() );
|
454 |
*/
|
455 |
public function admin_notices(){
|
456 |
$current_notice = current( $this->next_notice() );
|
|
|
457 |
if( $current_notice == 'opt_in' ) {
|
458 |
do_action( 'wpdeveloper_notices' );
|
459 |
return;
|
includes/eael-rollback.php
CHANGED
@@ -40,6 +40,8 @@ if( ! class_exists('EAEL_Rollback') ) {
|
|
40 |
* @var array
|
41 |
*/
|
42 |
public $versions = [
|
|
|
|
|
43 |
'2.9.2',
|
44 |
'2.9.1',
|
45 |
'2.9.0',
|
40 |
* @var array
|
41 |
*/
|
42 |
public $versions = [
|
43 |
+
'2.9.4',
|
44 |
+
'2.9.3',
|
45 |
'2.9.2',
|
46 |
'2.9.1',
|
47 |
'2.9.0',
|
includes/extensions.php
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: elementor, elements, addons, elementor addon, elementor widget, page build
|
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.0.3
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 2.9.
|
8 |
License: GPLv3
|
9 |
License URI: https://opensource.org/licenses/GPL-3.0
|
10 |
|
@@ -169,6 +169,11 @@ Your existing elements/content will work with premium version. So you won't lose
|
|
169 |
|
170 |
== Changelog ==
|
171 |
|
|
|
|
|
|
|
|
|
|
|
172 |
= 2.9.4 =
|
173 |
|
174 |
- Product Grid layout issue fixed
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.0.3
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 2.9.5
|
8 |
License: GPLv3
|
9 |
License URI: https://opensource.org/licenses/GPL-3.0
|
10 |
|
169 |
|
170 |
== Changelog ==
|
171 |
|
172 |
+
= 2.9.5 =
|
173 |
+
|
174 |
+
- Fixed: Product grid featured products loop not working
|
175 |
+
- Few minor bugfix and improvements
|
176 |
+
|
177 |
= 2.9.4 =
|
178 |
|
179 |
- Product Grid layout issue fixed
|