Premium Addons for Elementor - Version 4.8.10

Version Description

  • Tweak: Show WooCommerce placeholder image if the current product has no thumbnail in WooCommerce Products Listing widget.
  • Fixed: Enable Beta Tester option is not working.
Download this release

Release Info

Developer leap13
Plugin Icon 128x128 Premium Addons for Elementor
Version 4.8.10
Comparing to
See all releases

Code changes from version 4.8.9 to 4.8.10

admin/assets/js/admin.js CHANGED
@@ -1,473 +1,473 @@
1
- (function ($) {
2
-
3
- "use strict";
4
-
5
- var redHadfontLink = document.createElement('link');
6
- redHadfontLink.rel = 'stylesheet';
7
- redHadfontLink.href = 'https://fonts.googleapis.com/css?family=Red Hat Display:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
8
- redHadfontLink.type = 'text/css';
9
- document.head.appendChild(redHadfontLink);
10
-
11
- var poppinsfontLink = document.createElement('link');
12
- poppinsfontLink.rel = 'stylesheet';
13
- poppinsfontLink.href = 'https://fonts.googleapis.com/css?family=Poppins:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
14
- poppinsfontLink.type = 'text/css';
15
- document.head.appendChild(poppinsfontLink);
16
-
17
- var settings = premiumAddonsSettings.settings;
18
-
19
- window.PremiumAddonsNavigation = function () {
20
-
21
- var self = this,
22
- $tabs = $(".pa-settings-tab"),
23
- $elementsTabs = $(".pa-elements-tab");
24
-
25
- self.init = function () {
26
-
27
- if (!$tabs.length) {
28
- return;
29
- }
30
-
31
- self.initNavTabs($tabs);
32
-
33
- self.initElementsTabs($elementsTabs);
34
-
35
- if ( settings.isTrackerAllowed ) {
36
- self.getUnusedWidget();
37
- }
38
-
39
- self.handleElementsActions();
40
-
41
- self.handleSettingsSave();
42
-
43
- self.handleRollBack();
44
-
45
- self.handleNewsLetterForm();
46
-
47
- self.handlePaproActions();
48
-
49
- };
50
-
51
- // Handle settings form submission
52
- self.handleSettingsSave = function () {
53
-
54
- $("#pa-features .pa-section-info-cta input, #pa-modules .pa-switcher input").on(
55
- 'change',
56
- function () {
57
- self.saveElementsSettings('elements');
58
- }
59
- )
60
-
61
- $("#pa-ver-control input, #pa-integrations input, #pa-ver-control input, #pa-integrations select").change(
62
- function () {
63
- self.saveElementsSettings('additional');
64
- }
65
- );
66
-
67
- $("#pa-integrations input[type=text]").on(
68
- 'keyup',
69
- function () {
70
- self.saveElementsSettings('additional');
71
- }
72
- )
73
-
74
- };
75
-
76
- //get unused widgets.
77
- self.getUnusedWidget = function () {
78
-
79
- if ( $(".pa-btn-group .pa-btn-disable").hasClass("active") ) {
80
- $(".pa-btn-group .pa-btn-unused").addClass("dimmed");
81
- }
82
-
83
- $.ajax(
84
- {
85
- url: settings.ajaxurl,
86
- type: 'POST',
87
- data: {
88
- action: 'pa_get_unused_widgets',
89
- security: settings.nonce,
90
- },
91
- success: function (response) {
92
- console.log('unused widgets retrieved');
93
- self.unusedElements = response.data;
94
- },
95
- error: function (err) {
96
- console.log(err);
97
- }
98
- }
99
- );
100
- };
101
-
102
- // Handle global enable/disable buttons
103
- self.handleElementsActions = function () {
104
-
105
- $(".pa-elements-filter select").on(
106
- 'change',
107
- function () {
108
- var filter = $(this).val(),
109
- $activeTab = $(".pa-switchers-container").not(".hidden");
110
-
111
- $activeTab.find(".pa-switcher").removeClass("hidden");
112
-
113
- if ('free' === filter) {
114
- $activeTab.find(".pro-element").addClass("hidden");
115
- } else if ('pro' === filter) {
116
- $activeTab.find(".pa-switcher").not(".pro-element").addClass("hidden");
117
- }
118
- }
119
- );
120
-
121
- // Enable/Disable all widgets
122
- $(".pa-btn-group").on(
123
- "click",
124
- '.pa-btn',
125
- function () {
126
-
127
- var $btn = $(this),
128
- isChecked = $btn.hasClass("pa-btn-enable");
129
-
130
- if (!$btn.hasClass("active")) {
131
- $(".pa-btn-group .pa-btn").removeClass("active");
132
- $btn.addClass("active");
133
-
134
- $.ajax(
135
- {
136
- url: settings.ajaxurl,
137
- type: 'POST',
138
- data: {
139
- action: 'pa_save_global_btn',
140
- security: settings.nonce,
141
- isGlobalOn: isChecked
142
- }
143
- }
144
- );
145
-
146
- }
147
-
148
- if (isChecked) {
149
- $(".pa-btn-group .pa-btn-unused").removeClass("dimmed");
150
- } else {
151
- $(".pa-btn-group .pa-btn-unused").addClass("dimmed");
152
- }
153
-
154
- $("#pa-modules .pa-switcher input").prop("checked", isChecked);
155
-
156
- self.saveElementsSettings('elements');
157
-
158
- }
159
- );
160
-
161
- //Disable unused widgets.
162
- $(".pa-btn-group").on(
163
- "click",
164
- '.pa-btn-unused',
165
- function () {
166
-
167
- $.each(self.unusedElements, function (index, selector) {
168
- $('#pa-modules .pa-switcher.' + selector).find('input').prop('checked', false);
169
- });
170
-
171
- $(this).addClass('dimmed');
172
-
173
- self.saveElementsSettings('elements');
174
- }
175
- );
176
-
177
- $("#pa-modules .pa-switcher input").on(
178
- 'change',
179
- function () {
180
- var $this = $(this),
181
- id = $this.attr('id'),
182
- isChecked = $this.prop('checked');
183
-
184
- $("input[name='" + id + "']").prop('checked', isChecked);
185
- }
186
- )
187
-
188
- };
189
-
190
- // Handle Tabs Elements
191
- self.initElementsTabs = function ($elem) {
192
-
193
- var $links = $elem.find('a'),
194
- $sections = $(".pa-switchers-container");
195
-
196
- $sections.eq(0).removeClass("hidden");
197
- $links.eq(0).addClass("active");
198
-
199
- $links.on(
200
- 'click',
201
- function (e) {
202
-
203
- e.preventDefault();
204
-
205
- var $link = $(this),
206
- href = $link.attr('href');
207
-
208
- // Set this tab to active
209
- $links.removeClass("active");
210
- $link.addClass("active");
211
-
212
- // Navigate to tab section
213
- $sections.addClass("hidden");
214
- $("#" + href).removeClass("hidden");
215
-
216
- }
217
- );
218
- };
219
-
220
- // Handle settings tabs
221
- self.initNavTabs = function ($elem) {
222
-
223
- var $links = $elem.find('a'),
224
- $lastSection = null;
225
-
226
- $(window).on(
227
- 'hashchange',
228
- function () {
229
-
230
- var hash = window.location.hash.match(new RegExp('tab=([^&]*)')),
231
- slug = hash ? hash[1] : $links.first().attr('href').replace('#tab=', ''),
232
- $link = $('#pa-tab-link-' + slug);
233
-
234
- if (!$link.length) {
235
- return
236
-
237
- }
238
- $links.removeClass('pa-section-active');
239
- $link.addClass('pa-section-active');
240
-
241
- // Hide the last active section
242
- if ($lastSection) {
243
- $lastSection.hide();
244
- }
245
-
246
- var $section = $('#pa-section-' + slug);
247
- $section.css(
248
- {
249
- display: 'block'
250
- }
251
- );
252
-
253
- $lastSection = $section;
254
-
255
- }
256
- ).trigger('hashchange');
257
-
258
- };
259
-
260
- self.handleRollBack = function () {
261
-
262
- // Rollback button
263
- $('.pa-rollback-button').on(
264
- 'click',
265
- function (event) {
266
-
267
- event.preventDefault();
268
-
269
- var $this = $(this),
270
- href = $this.attr('href');
271
-
272
- if (!href) {
273
- return;
274
- }
275
-
276
- // Show PAPRO stable version if PAPRO Rollback is clicked
277
- var isPAPRO = '';
278
- if (-1 !== href.indexOf('papro_rollback')) {
279
- isPAPRO = 'papro_';
280
- }
281
-
282
- var premiumRollBackConfirm = premiumAddonsSettings.premiumRollBackConfirm;
283
-
284
- var dialogsManager = new DialogsManager.Instance();
285
-
286
- dialogsManager.createWidget(
287
- 'confirm',
288
- {
289
- headerMessage: premiumRollBackConfirm.i18n.rollback_to_previous_version,
290
- message: premiumRollBackConfirm['i18n'][isPAPRO + 'rollback_confirm'],
291
- strings: {
292
- cancel: premiumRollBackConfirm.i18n.cancel,
293
- confirm: premiumRollBackConfirm.i18n.yes,
294
- },
295
- onConfirm: function () {
296
-
297
- $this.addClass('loading');
298
-
299
- location.href = $this.attr('href');
300
-
301
- }
302
- }
303
- ).show();
304
- }
305
- );
306
-
307
- };
308
-
309
- self.saveElementsSettings = function (action) { //save elements settings changes
310
-
311
- var $form = null;
312
-
313
- if ('elements' === action) {
314
- $form = $('form#pa-settings, form#pa-features');
315
- action = 'pa_elements_settings';
316
- } else {
317
- $form = $('formpa-ver-control, form#pa-integrations');
318
- action = 'pa_additional_settings';
319
- }
320
-
321
- $.ajax(
322
- {
323
- url: settings.ajaxurl,
324
- type: 'POST',
325
- data: {
326
- action: action,
327
- security: settings.nonce,
328
- fields: $form.serialize(),
329
- },
330
- success: function (response) {
331
-
332
- console.log("settings saved");
333
- },
334
- error: function (err) {
335
-
336
- console.log(err);
337
-
338
- }
339
- }
340
- );
341
-
342
- }
343
-
344
- self.handlePaproActions = function () {
345
-
346
- // Trigger SWAL for PRO elements
347
- $(".pro-slider").on(
348
- 'click',
349
- function () {
350
-
351
- var redirectionLink = " https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=";
352
-
353
- Swal.fire(
354
- {
355
- title: '<span class="pa-swal-head">Get PRO Widgets & Addons<span>',
356
- html: 'Supercharge your Elementor with PRO widgets and addons that you won’t find anywhere else.',
357
- type: 'warning',
358
- showCloseButton: true,
359
- showCancelButton: true,
360
- cancelButtonText: "More Info",
361
- focusConfirm: true,
362
- customClass: 'pa-swal',
363
- }
364
- ).then(
365
- function (res) {
366
- // Handle More Info button
367
- if (res.dismiss === 'cancel') {
368
- window.open(redirectionLink + settings.theme, '_blank');
369
- }
370
-
371
- }
372
- );
373
- }
374
- );
375
-
376
- // Trigger SWAL for White Labeling
377
- $(".premium-white-label-form.pro-inactive").on(
378
- 'submit',
379
- function (e) {
380
-
381
- e.preventDefault();
382
-
383
- var redirectionLink = " https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=";
384
-
385
- Swal.fire(
386
- {
387
- title: '<span class="pa-swal-head">Enable White Labeling Options<span>',
388
- html: 'Premium Addons can be completely re-branded with your own brand name and author details. Your clients will never know what tools you are using to build their website and will think that this is your own tool set. White-labeling works as long as your license is active.',
389
- type: 'warning',
390
- showCloseButton: true,
391
- showCancelButton: true,
392
- cancelButtonText: "More Info",
393
- focusConfirm: true
394
- }
395
- ).then(
396
- function (res) {
397
- // Handle More Info button
398
- if (res.dismiss === 'cancel') {
399
- window.open(redirectionLink + settings.theme, '_blank');
400
- }
401
-
402
- }
403
- );
404
- }
405
- );
406
-
407
- };
408
-
409
- self.handleNewsLetterForm = function () {
410
-
411
- $('.pa-newsletter-form').on('submit', function (e) {
412
- e.preventDefault();
413
-
414
- var email = $("#pa_news_email").val();
415
-
416
- if (checkEmail(email)) {
417
- $.ajax(
418
- {
419
- url: settings.ajaxurl,
420
- type: 'POST',
421
- data: {
422
- action: 'subscribe_newsletter',
423
- security: settings.nonce,
424
- email: email
425
- },
426
- beforeSend: function () {
427
- console.log("Adding user to subscribers list");
428
- },
429
- success: function (response) {
430
- if (response.data) {
431
- var status = response.data.status;
432
- if (status) {
433
- console.log("User added to subscribers list");
434
- swal.fire({
435
- title: 'Thanks for subscribing!',
436
- text: 'Click OK to continue',
437
- type: 'success',
438
- timer: 1000
439
- });
440
- }
441
-
442
- }
443
-
444
- },
445
- error: function (err) {
446
- console.log(err);
447
- }
448
- }
449
- );
450
- } else {
451
- Swal.fire({
452
- type: 'error',
453
- title: 'Invalid Email Address...',
454
- text: 'Please enter a valid email address!'
455
- });
456
- }
457
-
458
- })
459
-
460
- }
461
-
462
- function checkEmail(emailAddress) {
463
- var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
464
- return pattern.test(emailAddress);
465
- }
466
-
467
- };
468
-
469
- var instance = new PremiumAddonsNavigation();
470
-
471
- instance.init();
472
-
473
- })(jQuery);
1
+ (function ($) {
2
+
3
+ "use strict";
4
+
5
+ var redHadfontLink = document.createElement('link');
6
+ redHadfontLink.rel = 'stylesheet';
7
+ redHadfontLink.href = 'https://fonts.googleapis.com/css?family=Red Hat Display:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
8
+ redHadfontLink.type = 'text/css';
9
+ document.head.appendChild(redHadfontLink);
10
+
11
+ var poppinsfontLink = document.createElement('link');
12
+ poppinsfontLink.rel = 'stylesheet';
13
+ poppinsfontLink.href = 'https://fonts.googleapis.com/css?family=Poppins:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
14
+ poppinsfontLink.type = 'text/css';
15
+ document.head.appendChild(poppinsfontLink);
16
+
17
+ var settings = premiumAddonsSettings.settings;
18
+
19
+ window.PremiumAddonsNavigation = function () {
20
+
21
+ var self = this,
22
+ $tabs = $(".pa-settings-tab"),
23
+ $elementsTabs = $(".pa-elements-tab");
24
+
25
+ self.init = function () {
26
+
27
+ if (!$tabs.length) {
28
+ return;
29
+ }
30
+
31
+ self.initNavTabs($tabs);
32
+
33
+ self.initElementsTabs($elementsTabs);
34
+
35
+ if (settings.isTrackerAllowed) {
36
+ self.getUnusedWidget();
37
+ }
38
+
39
+ self.handleElementsActions();
40
+
41
+ self.handleSettingsSave();
42
+
43
+ self.handleRollBack();
44
+
45
+ self.handleNewsLetterForm();
46
+
47
+ self.handlePaproActions();
48
+
49
+ };
50
+
51
+ // Handle settings form submission
52
+ self.handleSettingsSave = function () {
53
+
54
+ $("#pa-features .pa-section-info-cta input, #pa-modules .pa-switcher input").on(
55
+ 'change',
56
+ function () {
57
+ self.saveElementsSettings('elements');
58
+ }
59
+ )
60
+
61
+ $("#pa-ver-control input, #pa-integrations input, #pa-ver-control input, #pa-integrations select").change(
62
+ function () {
63
+ self.saveElementsSettings('additional');
64
+ }
65
+ );
66
+
67
+ $("#pa-integrations input[type=text]").on(
68
+ 'keyup',
69
+ function () {
70
+ self.saveElementsSettings('additional');
71
+ }
72
+ )
73
+
74
+ };
75
+
76
+ //get unused widgets.
77
+ self.getUnusedWidget = function () {
78
+
79
+ if ($(".pa-btn-group .pa-btn-disable").hasClass("active")) {
80
+ $(".pa-btn-group .pa-btn-unused").addClass("dimmed");
81
+ }
82
+
83
+ $.ajax(
84
+ {
85
+ url: settings.ajaxurl,
86
+ type: 'POST',
87
+ data: {
88
+ action: 'pa_get_unused_widgets',
89
+ security: settings.nonce,
90
+ },
91
+ success: function (response) {
92
+ console.log('unused widgets retrieved');
93
+ self.unusedElements = response.data;
94
+ },
95
+ error: function (err) {
96
+ console.log(err);
97
+ }
98
+ }
99
+ );
100
+ };
101
+
102
+ // Handle global enable/disable buttons
103
+ self.handleElementsActions = function () {
104
+
105
+ $(".pa-elements-filter select").on(
106
+ 'change',
107
+ function () {
108
+ var filter = $(this).val(),
109
+ $activeTab = $(".pa-switchers-container").not(".hidden");
110
+
111
+ $activeTab.find(".pa-switcher").removeClass("hidden");
112
+
113
+ if ('free' === filter) {
114
+ $activeTab.find(".pro-element").addClass("hidden");
115
+ } else if ('pro' === filter) {
116
+ $activeTab.find(".pa-switcher").not(".pro-element").addClass("hidden");
117
+ }
118
+ }
119
+ );
120
+
121
+ // Enable/Disable all widgets
122
+ $(".pa-btn-group").on(
123
+ "click",
124
+ '.pa-btn',
125
+ function () {
126
+
127
+ var $btn = $(this),
128
+ isChecked = $btn.hasClass("pa-btn-enable");
129
+
130
+ if (!$btn.hasClass("active")) {
131
+ $(".pa-btn-group .pa-btn").removeClass("active");
132
+ $btn.addClass("active");
133
+
134
+ $.ajax(
135
+ {
136
+ url: settings.ajaxurl,
137
+ type: 'POST',
138
+ data: {
139
+ action: 'pa_save_global_btn',
140
+ security: settings.nonce,
141
+ isGlobalOn: isChecked
142
+ }
143
+ }
144
+ );
145
+
146
+ }
147
+
148
+ if (isChecked) {
149
+ $(".pa-btn-group .pa-btn-unused").removeClass("dimmed");
150
+ } else {
151
+ $(".pa-btn-group .pa-btn-unused").addClass("dimmed");
152
+ }
153
+
154
+ $("#pa-modules .pa-switcher input").prop("checked", isChecked);
155
+
156
+ self.saveElementsSettings('elements');
157
+
158
+ }
159
+ );
160
+
161
+ //Disable unused widgets.
162
+ $(".pa-btn-group").on(
163
+ "click",
164
+ '.pa-btn-unused',
165
+ function () {
166
+
167
+ $.each(self.unusedElements, function (index, selector) {
168
+ $('#pa-modules .pa-switcher.' + selector).find('input').prop('checked', false);
169
+ });
170
+
171
+ $(this).addClass('dimmed');
172
+
173
+ self.saveElementsSettings('elements');
174
+ }
175
+ );
176
+
177
+ $("#pa-modules .pa-switcher input").on(
178
+ 'change',
179
+ function () {
180
+ var $this = $(this),
181
+ id = $this.attr('id'),
182
+ isChecked = $this.prop('checked');
183
+
184
+ $("input[name='" + id + "']").prop('checked', isChecked);
185
+ }
186
+ )
187
+
188
+ };
189
+
190
+ // Handle Tabs Elements
191
+ self.initElementsTabs = function ($elem) {
192
+
193
+ var $links = $elem.find('a'),
194
+ $sections = $(".pa-switchers-container");
195
+
196
+ $sections.eq(0).removeClass("hidden");
197
+ $links.eq(0).addClass("active");
198
+
199
+ $links.on(
200
+ 'click',
201
+ function (e) {
202
+
203
+ e.preventDefault();
204
+
205
+ var $link = $(this),
206
+ href = $link.attr('href');
207
+
208
+ // Set this tab to active
209
+ $links.removeClass("active");
210
+ $link.addClass("active");
211
+
212
+ // Navigate to tab section
213
+ $sections.addClass("hidden");
214
+ $("#" + href).removeClass("hidden");
215
+
216
+ }
217
+ );
218
+ };
219
+
220
+ // Handle settings tabs
221
+ self.initNavTabs = function ($elem) {
222
+
223
+ var $links = $elem.find('a'),
224
+ $lastSection = null;
225
+
226
+ $(window).on(
227
+ 'hashchange',
228
+ function () {
229
+
230
+ var hash = window.location.hash.match(new RegExp('tab=([^&]*)')),
231
+ slug = hash ? hash[1] : $links.first().attr('href').replace('#tab=', ''),
232
+ $link = $('#pa-tab-link-' + slug);
233
+
234
+ if (!$link.length) {
235
+ return
236
+
237
+ }
238
+ $links.removeClass('pa-section-active');
239
+ $link.addClass('pa-section-active');
240
+
241
+ // Hide the last active section
242
+ if ($lastSection) {
243
+ $lastSection.hide();
244
+ }
245
+
246
+ var $section = $('#pa-section-' + slug);
247
+ $section.css(
248
+ {
249
+ display: 'block'
250
+ }
251
+ );
252
+
253
+ $lastSection = $section;
254
+
255
+ }
256
+ ).trigger('hashchange');
257
+
258
+ };
259
+
260
+ self.handleRollBack = function () {
261
+
262
+ // Rollback button
263
+ $('.pa-rollback-button').on(
264
+ 'click',
265
+ function (event) {
266
+
267
+ event.preventDefault();
268
+
269
+ var $this = $(this),
270
+ href = $this.attr('href');
271
+
272
+ if (!href) {
273
+ return;
274
+ }
275
+
276
+ // Show PAPRO stable version if PAPRO Rollback is clicked
277
+ var isPAPRO = '';
278
+ if (-1 !== href.indexOf('papro_rollback')) {
279
+ isPAPRO = 'papro_';
280
+ }
281
+
282
+ var premiumRollBackConfirm = premiumAddonsSettings.premiumRollBackConfirm;
283
+
284
+ var dialogsManager = new DialogsManager.Instance();
285
+
286
+ dialogsManager.createWidget(
287
+ 'confirm',
288
+ {
289
+ headerMessage: premiumRollBackConfirm.i18n.rollback_to_previous_version,
290
+ message: premiumRollBackConfirm['i18n'][isPAPRO + 'rollback_confirm'],
291
+ strings: {
292
+ cancel: premiumRollBackConfirm.i18n.cancel,
293
+ confirm: premiumRollBackConfirm.i18n.yes,
294
+ },
295
+ onConfirm: function () {
296
+
297
+ $this.addClass('loading');
298
+
299
+ location.href = $this.attr('href');
300
+
301
+ }
302
+ }
303
+ ).show();
304
+ }
305
+ );
306
+
307
+ };
308
+
309
+ self.saveElementsSettings = function (action) { //save elements settings changes
310
+
311
+ var $form = null;
312
+
313
+ if ('elements' === action) {
314
+ $form = $('form#pa-settings, form#pa-features');
315
+ action = 'pa_elements_settings';
316
+ } else {
317
+ $form = $('form#pa-ver-control, form#pa-integrations');
318
+ action = 'pa_additional_settings';
319
+ }
320
+
321
+ $.ajax(
322
+ {
323
+ url: settings.ajaxurl,
324
+ type: 'POST',
325
+ data: {
326
+ action: action,
327
+ security: settings.nonce,
328
+ fields: $form.serialize(),
329
+ },
330
+ success: function (response) {
331
+
332
+ console.log("settings saved");
333
+ },
334
+ error: function (err) {
335
+
336
+ console.log(err);
337
+
338
+ }
339
+ }
340
+ );
341
+
342
+ }
343
+
344
+ self.handlePaproActions = function () {
345
+
346
+ // Trigger SWAL for PRO elements
347
+ $(".pro-slider").on(
348
+ 'click',
349
+ function () {
350
+
351
+ var redirectionLink = " https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=";
352
+
353
+ Swal.fire(
354
+ {
355
+ title: '<span class="pa-swal-head">Get PRO Widgets & Addons<span>',
356
+ html: 'Supercharge your Elementor with PRO widgets and addons that you won’t find anywhere else.',
357
+ type: 'warning',
358
+ showCloseButton: true,
359
+ showCancelButton: true,
360
+ cancelButtonText: "More Info",
361
+ focusConfirm: true,
362
+ customClass: 'pa-swal',
363
+ }
364
+ ).then(
365
+ function (res) {
366
+ // Handle More Info button
367
+ if (res.dismiss === 'cancel') {
368
+ window.open(redirectionLink + settings.theme, '_blank');
369
+ }
370
+
371
+ }
372
+ );
373
+ }
374
+ );
375
+
376
+ // Trigger SWAL for White Labeling
377
+ $(".premium-white-label-form.pro-inactive").on(
378
+ 'submit',
379
+ function (e) {
380
+
381
+ e.preventDefault();
382
+
383
+ var redirectionLink = " https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=";
384
+
385
+ Swal.fire(
386
+ {
387
+ title: '<span class="pa-swal-head">Enable White Labeling Options<span>',
388
+ html: 'Premium Addons can be completely re-branded with your own brand name and author details. Your clients will never know what tools you are using to build their website and will think that this is your own tool set. White-labeling works as long as your license is active.',
389
+ type: 'warning',
390
+ showCloseButton: true,
391
+ showCancelButton: true,
392
+ cancelButtonText: "More Info",
393
+ focusConfirm: true
394
+ }
395
+ ).then(
396
+ function (res) {
397
+ // Handle More Info button
398
+ if (res.dismiss === 'cancel') {
399
+ window.open(redirectionLink + settings.theme, '_blank');
400
+ }
401
+
402
+ }
403
+ );
404
+ }
405
+ );
406
+
407
+ };
408
+
409
+ self.handleNewsLetterForm = function () {
410
+
411
+ $('.pa-newsletter-form').on('submit', function (e) {
412
+ e.preventDefault();
413
+
414
+ var email = $("#pa_news_email").val();
415
+
416
+ if (checkEmail(email)) {
417
+ $.ajax(
418
+ {
419
+ url: settings.ajaxurl,
420
+ type: 'POST',
421
+ data: {
422
+ action: 'subscribe_newsletter',
423
+ security: settings.nonce,
424
+ email: email
425
+ },
426
+ beforeSend: function () {
427
+ console.log("Adding user to subscribers list");
428
+ },
429
+ success: function (response) {
430
+ if (response.data) {
431
+ var status = response.data.status;
432
+ if (status) {
433
+ console.log("User added to subscribers list");
434
+ swal.fire({
435
+ title: 'Thanks for subscribing!',
436
+ text: 'Click OK to continue',
437
+ type: 'success',
438
+ timer: 1000
439
+ });
440
+ }
441
+
442
+ }
443
+
444
+ },
445
+ error: function (err) {
446
+ console.log(err);
447
+ }
448
+ }
449
+ );
450
+ } else {
451
+ Swal.fire({
452
+ type: 'error',
453
+ title: 'Invalid Email Address...',
454
+ text: 'Please enter a valid email address!'
455
+ });
456
+ }
457
+
458
+ })
459
+
460
+ }
461
+
462
+ function checkEmail(emailAddress) {
463
+ var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
464
+ return pattern.test(emailAddress);
465
+ }
466
+
467
+ };
468
+
469
+ var instance = new PremiumAddonsNavigation();
470
+
471
+ instance.init();
472
+
473
+ })(jQuery);
admin/includes/admin-helper.php CHANGED
@@ -1,1061 +1,1062 @@
1
- <?php
2
- /**
3
- * PA Admin Helper
4
- */
5
-
6
- namespace PremiumAddons\Admin\Includes;
7
-
8
- use PremiumAddons\Includes\Helper_Functions;
9
- use Elementor\Modules\Usage\Module;
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- }
14
-
15
- /**
16
- * Class Admin_Helper
17
- */
18
- class Admin_Helper {
19
-
20
- /**
21
- * Admin settings tabs
22
- *
23
- * @var tabs
24
- */
25
- private static $tabs = null;
26
-
27
- /**
28
- * Class instance
29
- *
30
- * @var instance
31
- */
32
- private static $instance = null;
33
-
34
- /**
35
- * Premium Addons Settings Page Slug
36
- *
37
- * @var page_slug
38
- */
39
- protected $page_slug = 'premium-addons';
40
-
41
- /**
42
- * Current Screen ID
43
- *
44
- * @var current_screen
45
- */
46
- public static $current_screen = null;
47
-
48
- /**
49
- * Elements List
50
- *
51
- * @var elements_list
52
- */
53
- public static $elements_list = null;
54
-
55
- /**
56
- * Elements Names
57
- *
58
- * @var elements_names
59
- */
60
- public static $elements_names = null;
61
-
62
- /**
63
- * Integrations List
64
- *
65
- * @var integrations_list
66
- */
67
- public static $integrations_list = null;
68
-
69
- /**
70
- * Constructor for the class
71
- */
72
- public function __construct() {
73
-
74
- // Get current screen ID.
75
- add_action( 'current_screen', array( $this, 'get_current_screen' ) );
76
-
77
- // Insert admin settings submenus.
78
- $this->set_admin_tabs();
79
- add_action( 'admin_menu', array( $this, 'add_menu_tabs' ), 100 );
80
-
81
- // Enqueue required admin scripts.
82
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
83
-
84
- // Plugin Action Links.
85
- add_filter( 'plugin_action_links_' . PREMIUM_ADDONS_BASENAME, array( $this, 'insert_action_links' ) );
86
- add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
87
-
88
- // Register AJAX HOOKS.
89
- add_action( 'wp_ajax_pa_save_global_btn', array( $this, 'save_global_btn_value' ) );
90
- add_action( 'wp_ajax_pa_elements_settings', array( $this, 'save_settings' ) );
91
- add_action( 'wp_ajax_pa_additional_settings', array( $this, 'save_additional_settings' ) );
92
- add_action( 'wp_ajax_pa_get_unused_widgets', array( $this, 'get_unused_widgets' ) );
93
-
94
- add_action( 'wp_ajax_subscribe_newsletter', array( $this, 'subscribe_newsletter' ) );
95
-
96
- add_action( 'pa_before_render_admin_tabs', array( $this, 'render_dashboard_header' ) );
97
-
98
- // Register Rollback hooks.
99
- add_action( 'admin_post_premium_addons_rollback', array( $this, 'run_pa_rollback' ) );
100
-
101
- // Beta_Testers::get_instance();
102
-
103
- if ( is_admin() ) {
104
- $current_page = $_SERVER['REQUEST_URI'];
105
- if ( false === strpos( $current_page, 'action=elementor' ) ) {
106
- Admin_Notices::get_instance();
107
-
108
- // PA Duplicator.
109
- if ( self::check_duplicator() ) {
110
- Duplicator::get_instance();
111
- }
112
- }
113
- }
114
-
115
- }
116
-
117
- /**
118
- * Checks user credentials for specific action
119
- *
120
- * @since 2.6.8
121
- *
122
- * @return boolean
123
- */
124
- public static function check_user_can( $action ) {
125
- return current_user_can( $action );
126
- }
127
-
128
- /**
129
- * Get Elements List
130
- *
131
- * Get a list of all the elements available in the plugin
132
- *
133
- * @since 3.20.9
134
- * @access private
135
- *
136
- * @return array widget_list
137
- */
138
- private static function get_elements_list() {
139
-
140
- if ( null === self::$elements_list ) {
141
-
142
- self::$elements_list = require_once PREMIUM_ADDONS_PATH . 'admin/includes/elements.php';
143
-
144
- }
145
-
146
- return self::$elements_list;
147
-
148
- }
149
-
150
- /**
151
- * Get Integrations List
152
- *
153
- * Get a list of all the integrations available in the plugin
154
- *
155
- * @since 3.20.9
156
- * @access private
157
- *
158
- * @return array integrations_list
159
- */
160
- private static function get_integrations_list() {
161
-
162
- if ( null === self::$integrations_list ) {
163
-
164
- self::$integrations_list = array(
165
- 'premium-map-api',
166
- 'premium-youtube-api',
167
- 'premium-map-disable-api',
168
- 'premium-map-cluster',
169
- 'premium-map-locale',
170
- 'is-beta-tester',
171
- );
172
-
173
- }
174
-
175
- return self::$integrations_list;
176
-
177
- }
178
-
179
- /**
180
- * Admin Enqueue Scripts
181
- *
182
- * Enqueue the required assets on our admin pages
183
- *
184
- * @since 1.0.0
185
- * @access public
186
- */
187
- public function admin_enqueue_scripts() {
188
-
189
- wp_enqueue_style(
190
- 'pa_admin_icon',
191
- PREMIUM_ADDONS_URL . 'admin/assets/fonts/style.css',
192
- array(),
193
- PREMIUM_ADDONS_VERSION,
194
- 'all'
195
- );
196
-
197
- $suffix = is_rtl() ? '-rtl' : '';
198
-
199
- $current_screen = self::get_current_screen();
200
-
201
- wp_enqueue_style(
202
- 'pa-notice-css',
203
- PREMIUM_ADDONS_URL . 'admin/assets/css/notice' . $suffix . '.css',
204
- array(),
205
- PREMIUM_ADDONS_VERSION,
206
- 'all'
207
- );
208
-
209
- if ( strpos( $current_screen, $this->page_slug ) !== false ) {
210
-
211
- wp_enqueue_style(
212
- 'pa-admin-css',
213
- PREMIUM_ADDONS_URL . 'admin/assets/css/admin' . $suffix . '.css',
214
- array(),
215
- PREMIUM_ADDONS_VERSION,
216
- 'all'
217
- );
218
-
219
- wp_enqueue_style(
220
- 'pa-sweetalert-style',
221
- PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/sweetalert2.min.css',
222
- array(),
223
- PREMIUM_ADDONS_VERSION,
224
- 'all'
225
- );
226
-
227
- wp_enqueue_script(
228
- 'pa-admin',
229
- PREMIUM_ADDONS_URL . 'admin/assets/js/admin.js',
230
- array( 'jquery' ),
231
- PREMIUM_ADDONS_VERSION,
232
- true
233
- );
234
-
235
- wp_enqueue_script(
236
- 'pa-sweetalert-core',
237
- PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/core.js',
238
- array( 'jquery' ),
239
- PREMIUM_ADDONS_VERSION,
240
- true
241
- );
242
-
243
- wp_enqueue_script(
244
- 'pa-sweetalert',
245
- PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/sweetalert2.min.js',
246
- array( 'jquery', 'pa-sweetalert-core' ),
247
- PREMIUM_ADDONS_VERSION,
248
- true
249
- );
250
-
251
- $theme_slug = Helper_Functions::get_installed_theme();
252
-
253
- $localized_data = array(
254
- 'settings' => array(
255
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
256
- 'nonce' => wp_create_nonce( 'pa-settings-tab' ),
257
- 'theme' => $theme_slug,
258
- 'isTrackerAllowed' => 'yes' === get_option( 'elementor_allow_tracking', 'no' ) ? true : false,
259
- ),
260
- 'premiumRollBackConfirm' => array(
261
- 'home_url' => home_url(),
262
- 'i18n' => array(
263
- 'rollback_to_previous_version' => __( 'Rollback to Previous Version', 'premium-addons-for-elementor' ),
264
- /* translators: %s: PA stable version */
265
- 'rollback_confirm' => sprintf( __( 'Are you sure you want to reinstall version %s?', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION ),
266
- 'yes' => __( 'Continue', 'premium-addons-for-elementor' ),
267
- 'cancel' => __( 'Cancel', 'premium-addons-for-elementor' ),
268
- ),
269
- ),
270
- );
271
-
272
- // Add PAPRO Rollback Confirm message if PAPRO installed.
273
- if ( Helper_Functions::check_papro_version() ) {
274
- /* translators: %s: PA stable version */
275
- $localized_data['premiumRollBackConfirm']['i18n']['papro_rollback_confirm'] = sprintf( __( 'Are you sure you want to reinstall version %s?', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION );
276
- }
277
-
278
- wp_localize_script( 'pa-admin', 'premiumAddonsSettings', $localized_data );
279
-
280
- }
281
- }
282
-
283
- /**
284
- * Insert action links.
285
- *
286
- * Adds action links to the plugin list table
287
- *
288
- * Fired by `plugin_action_links` filter.
289
- *
290
- * @param array $links plugin action links.
291
- *
292
- * @since 1.0.0
293
- * @access public
294
- */
295
- public function insert_action_links( $links ) {
296
-
297
- $papro_path = 'premium-addons-pro/premium-addons-pro-for-elementor.php';
298
-
299
- $is_papro_installed = Helper_Functions::is_plugin_installed( $papro_path );
300
-
301
- $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'admin.php?page=' . $this->page_slug . '#tab=elements' ), __( 'Settings', 'premium-addons-for-elementor' ) );
302
-
303
- $rollback_link = sprintf( '<a href="%1$s">%2$s %3$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __( 'Rollback to Version ', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION );
304
-
305
- $new_links = array( $settings_link, $rollback_link );
306
-
307
- if ( ! $is_papro_installed ) {
308
-
309
- $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'plugins-page', 'wp-dash', 'get-pro' );
310
-
311
- $pro_link = sprintf( '<a href="%s" target="_blank" style="color: #FF6000; font-weight: bold;">%s</a>', $link, __( 'Go Pro', 'premium-addons-for-elementor' ) );
312
- array_push( $new_links, $pro_link );
313
- }
314
-
315
- $new_links = array_merge( $links, $new_links );
316
-
317
- return $new_links;
318
- }
319
-
320
- /**
321
- * Plugin row meta.
322
- *
323
- * Extends plugin row meta links
324
- *
325
- * Fired by `plugin_row_meta` filter.
326
- *
327
- * @since 3.8.4
328
- * @access public
329
- *
330
- * @param array $meta array of the plugin's metadata.
331
- * @param string $file path to the plugin file.
332
- *
333
- * @return array An array of plugin row meta links.
334
- */
335
- public function plugin_row_meta( $meta, $file ) {
336
-
337
- if ( Helper_Functions::is_hide_row_meta() ) {
338
- return $meta;
339
- }
340
-
341
- if ( PREMIUM_ADDONS_BASENAME === $file ) {
342
-
343
- $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/support', 'plugins-page', 'wp-dash', 'get-support' );
344
-
345
- $row_meta = array(
346
- 'docs' => '<a href="' . esc_attr( $link ) . '" aria-label="' . esc_attr( __( 'View Premium Addons for Elementor Documentation', 'premium-addons-for-elementor' ) ) . '" target="_blank">' . __( 'Docs & FAQs', 'premium-addons-for-elementor' ) . '</a>',
347
- 'videos' => '<a href="https://www.youtube.com/watch?v=D3INxWw_jKI&list=PLLpZVOYpMtTArB4hrlpSnDJB36D2sdoTv" aria-label="' . esc_attr( __( 'View Premium Addons Video Tutorials', 'premium-addons-for-elementor' ) ) . '" target="_blank">' . __( 'Video Tutorials', 'premium-addons-for-elementor' ) . '</a>',
348
- );
349
-
350
- $meta = array_merge( $meta, $row_meta );
351
- }
352
-
353
- return $meta;
354
-
355
- }
356
-
357
- /**
358
- * Gets current screen slug
359
- *
360
- * @since 3.3.8
361
- * @access public
362
- *
363
- * @return string current screen slug
364
- */
365
- public static function get_current_screen() {
366
-
367
- self::$current_screen = get_current_screen()->id;
368
-
369
- return isset( self::$current_screen ) ? self::$current_screen : false;
370
-
371
- }
372
-
373
- /**
374
- * Set Admin Tabs
375
- *
376
- * @access private
377
- * @since 3.20.8
378
- */
379
- private function set_admin_tabs() {
380
-
381
- $slug = $this->page_slug;
382
-
383
- self::$tabs = array(
384
- 'general' => array(
385
- 'id' => 'general',
386
- 'slug' => $slug . '#tab=general',
387
- 'title' => __( 'General', 'premium-addons-for-elementor' ),
388
- 'href' => '#tab=general',
389
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/general',
390
- ),
391
- 'elements' => array(
392
- 'id' => 'elements',
393
- 'slug' => $slug . '#tab=elements',
394
- 'title' => __( 'Widgets & Add-ons', 'premium-addons-for-elementor' ),
395
- 'href' => '#tab=elements',
396
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/modules-settings',
397
- ),
398
- 'features' => array(
399
- 'id' => 'features',
400
- 'slug' => $slug . '#tab=features',
401
- 'title' => __( 'Global Features', 'premium-addons-for-elementor' ),
402
- 'href' => '#tab=features',
403
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/features',
404
- ),
405
- 'integrations' => array(
406
- 'id' => 'integrations',
407
- 'slug' => $slug . '#tab=integrations',
408
- 'title' => __( 'Integrations', 'premium-addons-for-elementor' ),
409
- 'href' => '#tab=integrations',
410
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/integrations',
411
- ),
412
- 'version-control' => array(
413
- 'id' => 'vcontrol',
414
- 'slug' => $slug . '#tab=vcontrol',
415
- 'title' => __( 'Version Control', 'premium-addons-for-elementor' ),
416
- 'href' => '#tab=vcontrol',
417
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/version-control',
418
- ),
419
- 'white-label' => array(
420
- 'id' => 'white-label',
421
- 'slug' => $slug . '#tab=white-label',
422
- 'title' => __( 'White Labeling', 'premium-addons-for-elementor' ),
423
- 'href' => '#tab=white-label',
424
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/white-label',
425
- ),
426
- 'info' => array(
427
- 'id' => 'system-info',
428
- 'slug' => $slug . '#tab=system-info',
429
- 'title' => __( 'System Info', 'premium-addons-for-elementor' ),
430
- 'href' => '#tab=system-info',
431
- 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/info',
432
- ),
433
- );
434
-
435
- self::$tabs = apply_filters( 'pa_admin_register_tabs', self::$tabs );
436
-
437
- }
438
-
439
- /**
440
- * Add Menu Tabs
441
- *
442
- * Create Submenu Page
443
- *
444
- * @since 3.20.9
445
- * @access public
446
- *
447
- * @return void
448
- */
449
- public function add_menu_tabs() {
450
-
451
- $plugin_name = Helper_Functions::name();
452
-
453
- call_user_func(
454
- 'add_menu_page',
455
- $plugin_name,
456
- $plugin_name,
457
- 'manage_options',
458
- $this->page_slug,
459
- array( $this, 'render_setting_tabs' ),
460
- '',
461
- 100
462
- );
463
-
464
- foreach ( self::$tabs as $tab ) {
465
-
466
- call_user_func(
467
- 'add_submenu_page',
468
- $this->page_slug,
469
- $tab['title'],
470
- $tab['title'],
471
- 'manage_options',
472
- $tab['slug'],
473
- '__return_null'
474
- );
475
- }
476
-
477
- remove_submenu_page( $this->page_slug, $this->page_slug );
478
- }
479
-
480
- /**
481
- * Render Setting Tabs
482
- *
483
- * Render the final HTML content for admin setting tabs
484
- *
485
- * @access public
486
- * @since 3.20.8
487
- */
488
- public function render_setting_tabs() {
489
-
490
- ?>
491
- <div class="pa-settings-wrap">
492
- <?php do_action( 'pa_before_render_admin_tabs' ); ?>
493
- <div class="pa-settings-tabs">
494
- <ul class="pa-settings-tabs-list">
495
- <?php
496
- foreach ( self::$tabs as $key => $tab ) {
497
- $link = '<li class="pa-settings-tab">';
498
- $link .= '<a id="pa-tab-link-' . esc_attr( $tab['id'] ) . '"';
499
- $link .= ' href="' . esc_url( $tab['href'] ) . '">';
500
- $link .= '<i class="pa-dash-' . esc_attr( $tab['id'] ) . '"></i>';
501
- $link .= '<span>' . esc_html( $tab['title'] ) . '</span>';
502
- $link .= '</a>';
503
- $link .= '</li>';
504
-
505
- echo $link;
506
- }
507
- ?>
508
- </ul>
509
- </div> <!-- Settings Tabs -->
510
-
511
- <div class="pa-settings-sections">
512
- <?php
513
- foreach ( self::$tabs as $key => $tab ) {
514
- echo wp_kses_post( '<div id="pa-section-' . $tab['id'] . '" class="pa-section pa-section-' . $key . '">' );
515
- include_once $tab['template'] . '.php';
516
- echo '</div>';
517
- }
518
- ?>
519
- </div> <!-- Settings Sections -->
520
- <?php do_action( 'pa_after_render_admin_tabs' ); ?>
521
- </div> <!-- Settings Wrap -->
522
- <?php
523
- }
524
-
525
- /**
526
- * Render Dashboard Header
527
- *
528
- * @since 4.0.0
529
- * @access public
530
- */
531
- public function render_dashboard_header() {
532
-
533
- $url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro/', 'settings-page', 'wp-dash', 'dashboard' );
534
-
535
- $show_logo = Helper_Functions::is_hide_logo();
536
-
537
- ?>
538
-
539
- <div class="papro-admin-notice">
540
- <?php if ( ! $show_logo ) : ?>
541
- <div class="papro-admin-notice-left">
542
- <div class="papro-admin-notice-logo">
543
- <img class="pa-notice-logo" src="<?php echo esc_attr( PREMIUM_ADDONS_URL . 'admin/images/papro-notice-logo.png' ); ?>">
544
- </div>
545
- <a href="https://premiumaddons.com" target="_blank"></a>
546
- </div>
547
- <?php endif; ?>
548
-
549
- <?php if ( ! Helper_Functions::check_papro_version() ) : ?>
550
- <div class="papro-admin-notice-right">
551
- <div class="papro-admin-notice-info">
552
- <h4>
553
- <?php echo esc_html( __( 'Get Premium Addons PRO', 'premium-addons-for-elementor' ) ); ?>
554
- </h4>
555
- <p>
556
- <?php
557
- /* translators: %s: html tags */
558
- echo wp_kses_post( sprintf( __( 'Supercharge your Elementor with %1$sPRO Widgets & Addons%2$s that you won\'t find anywhere else.', 'premium-addons-for-elementor' ), '<span>', '</span>' ) );
559
- ?>
560
- </p>
561
- </div>
562
- <div class="papro-admin-notice-cta">
563
- <a class="papro-notice-btn" href="<?php echo esc_url( $url ); ?>" target="_blank">
564
- <?php echo esc_html( __( 'Get PRO', 'premium-addons-for-elementor' ) ); ?>
565
- </a>
566
- </div>
567
- </div>
568
- <?php endif; ?>
569
- </div>
570
-
571
- <?php
572
- }
573
-
574
- /**
575
- * Save Settings
576
- *
577
- * Save elements settings using AJAX
578
- *
579
- * @access public
580
- * @since 3.20.8
581
- */
582
- public function save_settings() {
583
-
584
- check_ajax_referer( 'pa-settings-tab', 'security' );
585
-
586
- if ( ! isset( $_POST['fields'] ) ) {
587
- return;
588
- }
589
-
590
- parse_str( sanitize_text_field( $_POST['fields'] ), $settings );
591
-
592
- $defaults = self::get_default_elements();
593
-
594
- $elements = array_fill_keys( array_keys( array_intersect_key( $settings, $defaults ) ), true );
595
-
596
- update_option( 'pa_save_settings', $elements );
597
-
598
- wp_send_json_success();
599
- }
600
-
601
- /**
602
- * Save Integrations Control Settings
603
- *
604
- * Stores integration and version control settings
605
- *
606
- * @since 3.20.8
607
- * @access public
608
- */
609
- public function save_additional_settings() {
610
-
611
- check_ajax_referer( 'pa-settings-tab', 'security' );
612
-
613
- if ( ! isset( $_POST['fields'] ) ) {
614
- return;
615
- }
616
-
617
- parse_str( sanitize_text_field( $_POST['fields'] ), $settings );
618
-
619
- $new_settings = array(
620
- 'premium-map-api' => sanitize_text_field( $settings['premium-map-api'] ),
621
- 'premium-youtube-api' => sanitize_text_field( $settings['premium-youtube-api'] ),
622
- 'premium-map-disable-api' => intval( $settings['premium-map-disable-api'] ? 1 : 0 ),
623
- 'premium-map-cluster' => intval( $settings['premium-map-cluster'] ? 1 : 0 ),
624
- 'premium-map-locale' => sanitize_text_field( $settings['premium-map-locale'] ),
625
- 'is-beta-tester' => intval( $settings['is-beta-tester'] ? 1 : 0 ),
626
- );
627
-
628
- update_option( 'pa_maps_save_settings', $new_settings );
629
-
630
- wp_send_json_success( $settings );
631
-
632
- }
633
-
634
- /**
635
- * Save Global Button Value
636
- *
637
- * Saves value for elements global switcher
638
- *
639
- * @since 4.0.0
640
- * @access public
641
- */
642
- public function save_global_btn_value() {
643
-
644
- check_ajax_referer( 'pa-settings-tab', 'security' );
645
-
646
- if ( ! isset( $_POST['isGlobalOn'] ) ) {
647
- wp_send_json_error();
648
- }
649
-
650
- $global_btn_value = sanitize_text_field( $_POST['isGlobalOn'] );
651
-
652
- update_option( 'pa_global_btn_value', $global_btn_value );
653
-
654
- wp_send_json_success();
655
-
656
- }
657
-
658
- /**
659
- * Get default Elements
660
- *
661
- * @since 3.20.9
662
- * @access private
663
- *
664
- * @return $default_keys array keys defaults
665
- */
666
- private static function get_default_elements() {
667
-
668
- $elements = self::get_elements_list();
669
-
670
- $keys = array();
671
-
672
- // Now, we need to fill our array with elements keys.
673
- foreach ( $elements as $cat ) {
674
- if ( count( $cat['elements'] ) ) {
675
- foreach ( $cat['elements'] as $elem ) {
676
- array_push( $keys, $elem['key'] );
677
- }
678
- }
679
- }
680
-
681
- $default_keys = array_fill_keys( $keys, true );
682
-
683
- return $default_keys;
684
-
685
- }
686
-
687
- /**
688
- * Get Pro Elements
689
- *
690
- * @since 4.5.3
691
- * @access public
692
- */
693
- public static function get_pro_elements() {
694
-
695
- $elements = self::get_elements_list();
696
-
697
- $pro_elements = array();
698
-
699
- $all_elements = $elements['cat-1'];
700
-
701
- if ( count( $all_elements['elements'] ) ) {
702
- foreach ( $all_elements['elements'] as $elem ) {
703
- if ( isset( $elem['is_pro'] ) && ! isset( $elem['is_global'] ) ) {
704
- array_push( $pro_elements, $elem );
705
- }
706
- }
707
- }
708
-
709
- return $pro_elements;
710
-
711
- }
712
-
713
- /**
714
- * Get Default Interations
715
- *
716
- * @since 3.20.9
717
- * @access private
718
- *
719
- * @return $default_keys array default keys
720
- */
721
- private static function get_default_integrations() {
722
-
723
- $settings = self::get_integrations_list();
724
-
725
- $default_keys = array_fill_keys( $settings, true );
726
-
727
- // Beta Tester should NOT be enabled by default.
728
- $default_keys['is-beta-tester'] = false;
729
-
730
- return $default_keys;
731
-
732
- }
733
-
734
- /**
735
- * Get enabled widgets
736
- *
737
- * @since 3.20.9
738
- * @access public
739
- *
740
- * @return array $enabled_keys enabled elements
741
- */
742
- public static function get_enabled_elements() {
743
-
744
- $defaults = self::get_default_elements();
745
-
746
- $enabled_keys = get_option( 'pa_save_settings', $defaults );
747
-
748
- foreach ( $defaults as $key => $value ) {
749
- if ( ! isset( $enabled_keys[ $key ] ) ) {
750
- $defaults[ $key ] = 0;
751
- }
752
- }
753
-
754
- return $defaults;
755
-
756
- }
757
-
758
- /**
759
- * Check If Premium Templates is enabled
760
- *
761
- * @since 3.6.0
762
- * @access public
763
- *
764
- * @return boolean
765
- */
766
- public static function check_premium_templates() {
767
-
768
- $settings = self::get_enabled_elements();
769
-
770
- if ( ! isset( $settings['premium-templates'] ) ) {
771
- return true;
772
- }
773
-
774
- $is_enabled = $settings['premium-templates'];
775
-
776
- return $is_enabled;
777
- }
778
-
779
-
780
- /**
781
- * Check If Premium Duplicator is enabled
782
- *
783
- * @since 3.20.9
784
- * @access public
785
- *
786
- * @return boolean
787
- */
788
- public static function check_duplicator() {
789
-
790
- $settings = self::get_enabled_elements();
791
-
792
- if ( ! isset( $settings['premium-duplicator'] ) ) {
793
- return true;
794
- }
795
-
796
- $is_enabled = $settings['premium-duplicator'];
797
-
798
- return $is_enabled;
799
- }
800
-
801
- /**
802
- * Get Integrations Settings
803
- *
804
- * Get plugin integrations settings
805
- *
806
- * @since 3.20.9
807
- * @access public
808
- *
809
- * @return array $settings integrations settings
810
- */
811
- public static function get_integrations_settings() {
812
-
813
- $enabled_keys = get_option( 'pa_maps_save_settings', self::get_default_integrations() );
814
-
815
- return $enabled_keys;
816
-
817
- }
818
-
819
- /**
820
- * Run PA Rollback
821
- *
822
- * Trigger PA Rollback actions
823
- *
824
- * @since 4.2.5
825
- * @access public
826
- */
827
- public function run_pa_rollback() {
828
-
829
- check_admin_referer( 'premium_addons_rollback' );
830
-
831
- $plugin_slug = basename( PREMIUM_ADDONS_FILE, '.php' );
832
-
833
- $pa_rollback = new PA_Rollback(
834
- array(
835
- 'version' => PREMIUM_ADDONS_STABLE_VERSION,
836
- 'plugin_name' => PREMIUM_ADDONS_BASENAME,
837
- 'plugin_slug' => $plugin_slug,
838
- 'package_url' => sprintf( 'https://downloads.wordpress.org/plugin/%s.%s.zip', $plugin_slug, PREMIUM_ADDONS_STABLE_VERSION ),
839
- )
840
- );
841
-
842
- $pa_rollback->run();
843
-
844
- wp_die(
845
- '',
846
- esc_html( __( 'Rollback to Previous Version', 'premium-addons-for-elementor' ) ),
847
- array(
848
- 'response' => 200,
849
- )
850
- );
851
-
852
- }
853
-
854
- /**
855
- * Disable unused widgets.
856
- *
857
- * @access public
858
- * @since 4.5.8
859
- */
860
- public function get_unused_widgets() {
861
-
862
- check_ajax_referer( 'pa-settings-tab', 'security' );
863
-
864
- if ( ! current_user_can( 'install_plugins' ) ) {
865
- wp_send_json_error();
866
- }
867
-
868
- $pa_elements = self::get_pa_elements_names();
869
-
870
- $used_widgets = self::get_used_widgets();
871
-
872
- $unused_widgets = array_diff( $pa_elements, array_keys( $used_widgets ) );
873
-
874
- wp_send_json_success( $unused_widgets );
875
-
876
- }
877
-
878
- /**
879
- * Get PA widget names.
880
- *
881
- * @access public
882
- * @since 4.5.8
883
- *
884
- * @return array
885
- */
886
- public static function get_pa_elements_names() {
887
-
888
- $names = self::$elements_names;
889
-
890
- if ( null === $names ) {
891
-
892
- $names = array_map(
893
- function( $item ) {
894
- return isset( $item['name'] ) ? $item['name'] : 'global';
895
- },
896
- self::get_elements_list()['cat-1']['elements']
897
- );
898
-
899
- $names = array_filter(
900
- $names,
901
- function( $name ) {
902
- return 'global' !== $name;
903
- }
904
- );
905
-
906
- }
907
-
908
- return $names;
909
- }
910
-
911
- /**
912
- * Get used widgets.
913
- *
914
- * @access public
915
- * @since 4.5.8
916
- *
917
- * @return array
918
- */
919
- public static function get_used_widgets() {
920
-
921
- $used_widgets = array();
922
- $tracker_allowed = 'yes' === get_option( 'elementor_allow_tracking' ) ? true : false;
923
-
924
- if ( ! $tracker_allowed ) {
925
- return false;
926
- }
927
-
928
- if ( class_exists( 'Elementor\Modules\Usage\Module' ) ) {
929
-
930
- $module = Module::instance();
931
- $elements = $module->get_formatted_usage( 'raw' );
932
-
933
- $pa_elements = self::get_pa_elements_names();
934
-
935
- if ( is_array( $elements ) || is_object( $elements ) ) {
936
-
937
- foreach ( $elements as $post_type => $data ) {
938
-
939
- foreach ( $data['elements'] as $element => $count ) {
940
-
941
- if ( in_array( $element, $pa_elements, true ) ) {
942
-
943
- if ( isset( $used_widgets[ $element ] ) ) {
944
- $used_widgets[ $element ] += $count;
945
- } else {
946
- $used_widgets[ $element ] = $count;
947
- }
948
- }
949
- }
950
- }
951
- }
952
- }
953
-
954
- return $used_widgets;
955
- }
956
-
957
- /**
958
- * Subscribe Newsletter
959
- *
960
- * Adds an email to Premium Addons subscribers list
961
- *
962
- * @since 4.7.0
963
- *
964
- * @access public
965
- */
966
- public function subscribe_newsletter() {
967
-
968
- check_ajax_referer( 'pa-settings-tab', 'security' );
969
-
970
- if ( ! self::check_user_can( 'manage_options' ) ) {
971
- wp_send_json_error();
972
- }
973
-
974
- $email = isset( $_POST['email'] ) ? $_POST['email'] : '';
975
-
976
- $api_url = 'https://premiumaddons.com/wp-json/mailchimp/v2/add';
977
-
978
- $request = add_query_arg(
979
- array(
980
- 'email' => $email,
981
- ),
982
- $api_url
983
- );
984
-
985
- $response = wp_remote_get(
986
- $request,
987
- array(
988
- 'timeout' => 60,
989
- 'sslverify' => true,
990
- )
991
- );
992
-
993
- $body = wp_remote_retrieve_body( $response );
994
- $body = json_decode( $body, true );
995
-
996
- wp_send_json_success( $body );
997
-
998
- }
999
-
1000
- /**
1001
- * Get PA News
1002
- *
1003
- * Gets a list of the latest three blog posts
1004
- *
1005
- * @since 4.7.0
1006
- *
1007
- * @access public
1008
- */
1009
- public function get_pa_news() {
1010
-
1011
- $posts = get_transient( 'pa_news' );
1012
-
1013
- if ( empty( $posts ) ) {
1014
-
1015
- $api_url = 'https://premiumaddons.com/wp-json/wp/v2/posts';
1016
-
1017
- $request = add_query_arg(
1018
- array(
1019
- 'per_page' => 3,
1020
- ),
1021
- $api_url
1022
- );
1023
-
1024
- $response = wp_remote_get(
1025
- $request,
1026
- array(
1027
- 'timeout' => 60,
1028
- 'sslverify' => true,
1029
- )
1030
- );
1031
-
1032
- $body = wp_remote_retrieve_body( $response );
1033
- $posts = json_decode( $body, true );
1034
-
1035
- set_transient( 'pa_news', $posts, WEEK_IN_SECONDS );
1036
-
1037
- }
1038
-
1039
- return $posts;
1040
-
1041
- }
1042
-
1043
- /**
1044
- * Creates and returns an instance of the class
1045
- *
1046
- * @since 1.0.0
1047
- * @access public
1048
- *
1049
- * @return object
1050
- */
1051
- public static function get_instance() {
1052
-
1053
- if ( ! isset( self::$instance ) ) {
1054
-
1055
- self::$instance = new self();
1056
-
1057
- }
1058
-
1059
- return self::$instance;
1060
- }
1061
- }
 
1
+ <?php
2
+ /**
3
+ * PA Admin Helper
4
+ */
5
+
6
+ namespace PremiumAddons\Admin\Includes;
7
+
8
+ use PremiumAddons\Includes\Helper_Functions;
9
+ use Elementor\Modules\Usage\Module;
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Class Admin_Helper
17
+ */
18
+ class Admin_Helper {
19
+
20
+ /**
21
+ * Admin settings tabs
22
+ *
23
+ * @var tabs
24
+ */
25
+ private static $tabs = null;
26
+
27
+ /**
28
+ * Class instance
29
+ *
30
+ * @var instance
31
+ */
32
+ private static $instance = null;
33
+
34
+ /**
35
+ * Premium Addons Settings Page Slug
36
+ *
37
+ * @var page_slug
38
+ */
39
+ protected $page_slug = 'premium-addons';
40
+
41
+ /**
42
+ * Current Screen ID
43
+ *
44
+ * @var current_screen
45
+ */
46
+ public static $current_screen = null;
47
+
48
+ /**
49
+ * Elements List
50
+ *
51
+ * @var elements_list
52
+ */
53
+ public static $elements_list = null;
54
+
55
+ /**
56
+ * Elements Names
57
+ *
58
+ * @var elements_names
59
+ */
60
+ public static $elements_names = null;
61
+
62
+ /**
63
+ * Integrations List
64
+ *
65
+ * @var integrations_list
66
+ */
67
+ public static $integrations_list = null;
68
+
69
+ /**
70
+ * Constructor for the class
71
+ */
72
+ public function __construct() {
73
+
74
+ // Get current screen ID.
75
+ add_action( 'current_screen', array( $this, 'get_current_screen' ) );
76
+
77
+ // Insert admin settings submenus.
78
+ $this->set_admin_tabs();
79
+ add_action( 'admin_menu', array( $this, 'add_menu_tabs' ), 100 );
80
+
81
+ // Enqueue required admin scripts.
82
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
83
+
84
+ // Plugin Action Links.
85
+ add_filter( 'plugin_action_links_' . PREMIUM_ADDONS_BASENAME, array( $this, 'insert_action_links' ) );
86
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
87
+
88
+ // Register AJAX HOOKS.
89
+ add_action( 'wp_ajax_pa_save_global_btn', array( $this, 'save_global_btn_value' ) );
90
+ add_action( 'wp_ajax_pa_elements_settings', array( $this, 'save_settings' ) );
91
+ add_action( 'wp_ajax_pa_additional_settings', array( $this, 'save_additional_settings' ) );
92
+ add_action( 'wp_ajax_pa_get_unused_widgets', array( $this, 'get_unused_widgets' ) );
93
+
94
+ add_action( 'wp_ajax_subscribe_newsletter', array( $this, 'subscribe_newsletter' ) );
95
+
96
+ add_action( 'pa_before_render_admin_tabs', array( $this, 'render_dashboard_header' ) );
97
+
98
+ // Register Rollback hooks.
99
+ add_action( 'admin_post_premium_addons_rollback', array( $this, 'run_pa_rollback' ) );
100
+
101
+ if ( is_admin() ) {
102
+ $current_page = $_SERVER['REQUEST_URI'];
103
+ if ( false === strpos( $current_page, 'action=elementor' ) ) {
104
+ Admin_Notices::get_instance();
105
+
106
+ // Beta Tester.
107
+ Beta_Testers::get_instance();
108
+
109
+ // PA Duplicator.
110
+ if ( self::check_duplicator() ) {
111
+ Duplicator::get_instance();
112
+ }
113
+ }
114
+ }
115
+
116
+ }
117
+
118
+ /**
119
+ * Checks user credentials for specific action
120
+ *
121
+ * @since 2.6.8
122
+ *
123
+ * @return boolean
124
+ */
125
+ public static function check_user_can( $action ) {
126
+ return current_user_can( $action );
127
+ }
128
+
129
+ /**
130
+ * Get Elements List
131
+ *
132
+ * Get a list of all the elements available in the plugin
133
+ *
134
+ * @since 3.20.9
135
+ * @access private
136
+ *
137
+ * @return array widget_list
138
+ */
139
+ private static function get_elements_list() {
140
+
141
+ if ( null === self::$elements_list ) {
142
+
143
+ self::$elements_list = require_once PREMIUM_ADDONS_PATH . 'admin/includes/elements.php';
144
+
145
+ }
146
+
147
+ return self::$elements_list;
148
+
149
+ }
150
+
151
+ /**
152
+ * Get Integrations List
153
+ *
154
+ * Get a list of all the integrations available in the plugin
155
+ *
156
+ * @since 3.20.9
157
+ * @access private
158
+ *
159
+ * @return array integrations_list
160
+ */
161
+ private static function get_integrations_list() {
162
+
163
+ if ( null === self::$integrations_list ) {
164
+
165
+ self::$integrations_list = array(
166
+ 'premium-map-api',
167
+ 'premium-youtube-api',
168
+ 'premium-map-disable-api',
169
+ 'premium-map-cluster',
170
+ 'premium-map-locale',
171
+ 'is-beta-tester',
172
+ );
173
+
174
+ }
175
+
176
+ return self::$integrations_list;
177
+
178
+ }
179
+
180
+ /**
181
+ * Admin Enqueue Scripts
182
+ *
183
+ * Enqueue the required assets on our admin pages
184
+ *
185
+ * @since 1.0.0
186
+ * @access public
187
+ */
188
+ public function admin_enqueue_scripts() {
189
+
190
+ wp_enqueue_style(
191
+ 'pa_admin_icon',
192
+ PREMIUM_ADDONS_URL . 'admin/assets/fonts/style.css',
193
+ array(),
194
+ PREMIUM_ADDONS_VERSION,
195
+ 'all'
196
+ );
197
+
198
+ $suffix = is_rtl() ? '-rtl' : '';
199
+
200
+ $current_screen = self::get_current_screen();
201
+
202
+ wp_enqueue_style(
203
+ 'pa-notice-css',
204
+ PREMIUM_ADDONS_URL . 'admin/assets/css/notice' . $suffix . '.css',
205
+ array(),
206
+ PREMIUM_ADDONS_VERSION,
207
+ 'all'
208
+ );
209
+
210
+ if ( strpos( $current_screen, $this->page_slug ) !== false ) {
211
+
212
+ wp_enqueue_style(
213
+ 'pa-admin-css',
214
+ PREMIUM_ADDONS_URL . 'admin/assets/css/admin' . $suffix . '.css',
215
+ array(),
216
+ PREMIUM_ADDONS_VERSION,
217
+ 'all'
218
+ );
219
+
220
+ wp_enqueue_style(
221
+ 'pa-sweetalert-style',
222
+ PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/sweetalert2.min.css',
223
+ array(),
224
+ PREMIUM_ADDONS_VERSION,
225
+ 'all'
226
+ );
227
+
228
+ wp_enqueue_script(
229
+ 'pa-admin',
230
+ PREMIUM_ADDONS_URL . 'admin/assets/js/admin.js',
231
+ array( 'jquery' ),
232
+ PREMIUM_ADDONS_VERSION,
233
+ true
234
+ );
235
+
236
+ wp_enqueue_script(
237
+ 'pa-sweetalert-core',
238
+ PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/core.js',
239
+ array( 'jquery' ),
240
+ PREMIUM_ADDONS_VERSION,
241
+ true
242
+ );
243
+
244
+ wp_enqueue_script(
245
+ 'pa-sweetalert',
246
+ PREMIUM_ADDONS_URL . 'admin/assets/js/sweetalert2/sweetalert2.min.js',
247
+ array( 'jquery', 'pa-sweetalert-core' ),
248
+ PREMIUM_ADDONS_VERSION,
249
+ true
250
+ );
251
+
252
+ $theme_slug = Helper_Functions::get_installed_theme();
253
+
254
+ $localized_data = array(
255
+ 'settings' => array(
256
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
257
+ 'nonce' => wp_create_nonce( 'pa-settings-tab' ),
258
+ 'theme' => $theme_slug,
259
+ 'isTrackerAllowed' => 'yes' === get_option( 'elementor_allow_tracking', 'no' ) ? true : false,
260
+ ),
261
+ 'premiumRollBackConfirm' => array(
262
+ 'home_url' => home_url(),
263
+ 'i18n' => array(
264
+ 'rollback_to_previous_version' => __( 'Rollback to Previous Version', 'premium-addons-for-elementor' ),
265
+ /* translators: %s: PA stable version */
266
+ 'rollback_confirm' => sprintf( __( 'Are you sure you want to reinstall version %s?', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION ),
267
+ 'yes' => __( 'Continue', 'premium-addons-for-elementor' ),
268
+ 'cancel' => __( 'Cancel', 'premium-addons-for-elementor' ),
269
+ ),
270
+ ),
271
+ );
272
+
273
+ // Add PAPRO Rollback Confirm message if PAPRO installed.
274
+ if ( Helper_Functions::check_papro_version() ) {
275
+ /* translators: %s: PA stable version */
276
+ $localized_data['premiumRollBackConfirm']['i18n']['papro_rollback_confirm'] = sprintf( __( 'Are you sure you want to reinstall version %s?', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION );
277
+ }
278
+
279
+ wp_localize_script( 'pa-admin', 'premiumAddonsSettings', $localized_data );
280
+
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Insert action links.
286
+ *
287
+ * Adds action links to the plugin list table
288
+ *
289
+ * Fired by `plugin_action_links` filter.
290
+ *
291
+ * @param array $links plugin action links.
292
+ *
293
+ * @since 1.0.0
294
+ * @access public
295
+ */
296
+ public function insert_action_links( $links ) {
297
+
298
+ $papro_path = 'premium-addons-pro/premium-addons-pro-for-elementor.php';
299
+
300
+ $is_papro_installed = Helper_Functions::is_plugin_installed( $papro_path );
301
+
302
+ $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'admin.php?page=' . $this->page_slug . '#tab=elements' ), __( 'Settings', 'premium-addons-for-elementor' ) );
303
+
304
+ $rollback_link = sprintf( '<a href="%1$s">%2$s %3$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __( 'Rollback to Version ', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_STABLE_VERSION );
305
+
306
+ $new_links = array( $settings_link, $rollback_link );
307
+
308
+ if ( ! $is_papro_installed ) {
309
+
310
+ $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'plugins-page', 'wp-dash', 'get-pro' );
311
+
312
+ $pro_link = sprintf( '<a href="%s" target="_blank" style="color: #FF6000; font-weight: bold;">%s</a>', $link, __( 'Go Pro', 'premium-addons-for-elementor' ) );
313
+ array_push( $new_links, $pro_link );
314
+ }
315
+
316
+ $new_links = array_merge( $links, $new_links );
317
+
318
+ return $new_links;
319
+ }
320
+
321
+ /**
322
+ * Plugin row meta.
323
+ *
324
+ * Extends plugin row meta links
325
+ *
326
+ * Fired by `plugin_row_meta` filter.
327
+ *
328
+ * @since 3.8.4
329
+ * @access public
330
+ *
331
+ * @param array $meta array of the plugin's metadata.
332
+ * @param string $file path to the plugin file.
333
+ *
334
+ * @return array An array of plugin row meta links.
335
+ */
336
+ public function plugin_row_meta( $meta, $file ) {
337
+
338
+ if ( Helper_Functions::is_hide_row_meta() ) {
339
+ return $meta;
340
+ }
341
+
342
+ if ( PREMIUM_ADDONS_BASENAME === $file ) {
343
+
344
+ $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/support', 'plugins-page', 'wp-dash', 'get-support' );
345
+
346
+ $row_meta = array(
347
+ 'docs' => '<a href="' . esc_attr( $link ) . '" aria-label="' . esc_attr( __( 'View Premium Addons for Elementor Documentation', 'premium-addons-for-elementor' ) ) . '" target="_blank">' . __( 'Docs & FAQs', 'premium-addons-for-elementor' ) . '</a>',
348
+ 'videos' => '<a href="https://www.youtube.com/watch?v=D3INxWw_jKI&list=PLLpZVOYpMtTArB4hrlpSnDJB36D2sdoTv" aria-label="' . esc_attr( __( 'View Premium Addons Video Tutorials', 'premium-addons-for-elementor' ) ) . '" target="_blank">' . __( 'Video Tutorials', 'premium-addons-for-elementor' ) . '</a>',
349
+ );
350
+
351
+ $meta = array_merge( $meta, $row_meta );
352
+ }
353
+
354
+ return $meta;
355
+
356
+ }
357
+
358
+ /**
359
+ * Gets current screen slug
360
+ *
361
+ * @since 3.3.8
362
+ * @access public
363
+ *
364
+ * @return string current screen slug
365
+ */
366
+ public static function get_current_screen() {
367
+
368
+ self::$current_screen = get_current_screen()->id;
369
+
370
+ return isset( self::$current_screen ) ? self::$current_screen : false;
371
+
372
+ }
373
+
374
+ /**
375
+ * Set Admin Tabs
376
+ *
377
+ * @access private
378
+ * @since 3.20.8
379
+ */
380
+ private function set_admin_tabs() {
381
+
382
+ $slug = $this->page_slug;
383
+
384
+ self::$tabs = array(
385
+ 'general' => array(
386
+ 'id' => 'general',
387
+ 'slug' => $slug . '#tab=general',
388
+ 'title' => __( 'General', 'premium-addons-for-elementor' ),
389
+ 'href' => '#tab=general',
390
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/general',
391
+ ),
392
+ 'elements' => array(
393
+ 'id' => 'elements',
394
+ 'slug' => $slug . '#tab=elements',
395
+ 'title' => __( 'Widgets & Add-ons', 'premium-addons-for-elementor' ),
396
+ 'href' => '#tab=elements',
397
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/modules-settings',
398
+ ),
399
+ 'features' => array(
400
+ 'id' => 'features',
401
+ 'slug' => $slug . '#tab=features',
402
+ 'title' => __( 'Global Features', 'premium-addons-for-elementor' ),
403
+ 'href' => '#tab=features',
404
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/features',
405
+ ),
406
+ 'integrations' => array(
407
+ 'id' => 'integrations',
408
+ 'slug' => $slug . '#tab=integrations',
409
+ 'title' => __( 'Integrations', 'premium-addons-for-elementor' ),
410
+ 'href' => '#tab=integrations',
411
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/integrations',
412
+ ),
413
+ 'version-control' => array(
414
+ 'id' => 'vcontrol',
415
+ 'slug' => $slug . '#tab=vcontrol',
416
+ 'title' => __( 'Version Control', 'premium-addons-for-elementor' ),
417
+ 'href' => '#tab=vcontrol',
418
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/version-control',
419
+ ),
420
+ 'white-label' => array(
421
+ 'id' => 'white-label',
422
+ 'slug' => $slug . '#tab=white-label',
423
+ 'title' => __( 'White Labeling', 'premium-addons-for-elementor' ),
424
+ 'href' => '#tab=white-label',
425
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/white-label',
426
+ ),
427
+ 'info' => array(
428
+ 'id' => 'system-info',
429
+ 'slug' => $slug . '#tab=system-info',
430
+ 'title' => __( 'System Info', 'premium-addons-for-elementor' ),
431
+ 'href' => '#tab=system-info',
432
+ 'template' => PREMIUM_ADDONS_PATH . 'admin/includes/templates/info',
433
+ ),
434
+ );
435
+
436
+ self::$tabs = apply_filters( 'pa_admin_register_tabs', self::$tabs );
437
+
438
+ }
439
+
440
+ /**
441
+ * Add Menu Tabs
442
+ *
443
+ * Create Submenu Page
444
+ *
445
+ * @since 3.20.9
446
+ * @access public
447
+ *
448
+ * @return void
449
+ */
450
+ public function add_menu_tabs() {
451
+
452
+ $plugin_name = Helper_Functions::name();
453
+
454
+ call_user_func(
455
+ 'add_menu_page',
456
+ $plugin_name,
457
+ $plugin_name,
458
+ 'manage_options',
459
+ $this->page_slug,
460
+ array( $this, 'render_setting_tabs' ),
461
+ '',
462
+ 100
463
+ );
464
+
465
+ foreach ( self::$tabs as $tab ) {
466
+
467
+ call_user_func(
468
+ 'add_submenu_page',
469
+ $this->page_slug,
470
+ $tab['title'],
471
+ $tab['title'],
472
+ 'manage_options',
473
+ $tab['slug'],
474
+ '__return_null'
475
+ );
476
+ }
477
+
478
+ remove_submenu_page( $this->page_slug, $this->page_slug );
479
+ }
480
+
481
+ /**
482
+ * Render Setting Tabs
483
+ *
484
+ * Render the final HTML content for admin setting tabs
485
+ *
486
+ * @access public
487
+ * @since 3.20.8
488
+ */
489
+ public function render_setting_tabs() {
490
+
491
+ ?>
492
+ <div class="pa-settings-wrap">
493
+ <?php do_action( 'pa_before_render_admin_tabs' ); ?>
494
+ <div class="pa-settings-tabs">
495
+ <ul class="pa-settings-tabs-list">
496
+ <?php
497
+ foreach ( self::$tabs as $key => $tab ) {
498
+ $link = '<li class="pa-settings-tab">';
499
+ $link .= '<a id="pa-tab-link-' . esc_attr( $tab['id'] ) . '"';
500
+ $link .= ' href="' . esc_url( $tab['href'] ) . '">';
501
+ $link .= '<i class="pa-dash-' . esc_attr( $tab['id'] ) . '"></i>';
502
+ $link .= '<span>' . esc_html( $tab['title'] ) . '</span>';
503
+ $link .= '</a>';
504
+ $link .= '</li>';
505
+
506
+ echo $link;
507
+ }
508
+ ?>
509
+ </ul>
510
+ </div> <!-- Settings Tabs -->
511
+
512
+ <div class="pa-settings-sections">
513
+ <?php
514
+ foreach ( self::$tabs as $key => $tab ) {
515
+ echo wp_kses_post( '<div id="pa-section-' . $tab['id'] . '" class="pa-section pa-section-' . $key . '">' );
516
+ include_once $tab['template'] . '.php';
517
+ echo '</div>';
518
+ }
519
+ ?>
520
+ </div> <!-- Settings Sections -->
521
+ <?php do_action( 'pa_after_render_admin_tabs' ); ?>
522
+ </div> <!-- Settings Wrap -->
523
+ <?php
524
+ }
525
+
526
+ /**
527
+ * Render Dashboard Header
528
+ *
529
+ * @since 4.0.0
530
+ * @access public
531
+ */
532
+ public function render_dashboard_header() {
533
+
534
+ $url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro/', 'settings-page', 'wp-dash', 'dashboard' );
535
+
536
+ $show_logo = Helper_Functions::is_hide_logo();
537
+
538
+ ?>
539
+
540
+ <div class="papro-admin-notice">
541
+ <?php if ( ! $show_logo ) : ?>
542
+ <div class="papro-admin-notice-left">
543
+ <div class="papro-admin-notice-logo">
544
+ <img class="pa-notice-logo" src="<?php echo esc_attr( PREMIUM_ADDONS_URL . 'admin/images/papro-notice-logo.png' ); ?>">
545
+ </div>
546
+ <a href="https://premiumaddons.com" target="_blank"></a>
547
+ </div>
548
+ <?php endif; ?>
549
+
550
+ <?php if ( ! Helper_Functions::check_papro_version() ) : ?>
551
+ <div class="papro-admin-notice-right">
552
+ <div class="papro-admin-notice-info">
553
+ <h4>
554
+ <?php echo esc_html( __( 'Get Premium Addons PRO', 'premium-addons-for-elementor' ) ); ?>
555
+ </h4>
556
+ <p>
557
+ <?php
558
+ /* translators: %s: html tags */
559
+ echo wp_kses_post( sprintf( __( 'Supercharge your Elementor with %1$sPRO Widgets & Addons%2$s that you won\'t find anywhere else.', 'premium-addons-for-elementor' ), '<span>', '</span>' ) );
560
+ ?>
561
+ </p>
562
+ </div>
563
+ <div class="papro-admin-notice-cta">
564
+ <a class="papro-notice-btn" href="<?php echo esc_url( $url ); ?>" target="_blank">
565
+ <?php echo esc_html( __( 'Get PRO', 'premium-addons-for-elementor' ) ); ?>
566
+ </a>
567
+ </div>
568
+ </div>
569
+ <?php endif; ?>
570
+ </div>
571
+
572
+ <?php
573
+ }
574
+
575
+ /**
576
+ * Save Settings
577
+ *
578
+ * Save elements settings using AJAX
579
+ *
580
+ * @access public
581
+ * @since 3.20.8
582
+ */
583
+ public function save_settings() {
584
+
585
+ check_ajax_referer( 'pa-settings-tab', 'security' );
586
+
587
+ if ( ! isset( $_POST['fields'] ) ) {
588
+ return;
589
+ }
590
+
591
+ parse_str( sanitize_text_field( $_POST['fields'] ), $settings );
592
+
593
+ $defaults = self::get_default_elements();
594
+
595
+ $elements = array_fill_keys( array_keys( array_intersect_key( $settings, $defaults ) ), true );
596
+
597
+ update_option( 'pa_save_settings', $elements );
598
+
599
+ wp_send_json_success();
600
+ }
601
+
602
+ /**
603
+ * Save Integrations Control Settings
604
+ *
605
+ * Stores integration and version control settings
606
+ *
607
+ * @since 3.20.8
608
+ * @access public
609
+ */
610
+ public function save_additional_settings() {
611
+
612
+ check_ajax_referer( 'pa-settings-tab', 'security' );
613
+
614
+ if ( ! isset( $_POST['fields'] ) ) {
615
+ return;
616
+ }
617
+
618
+ parse_str( sanitize_text_field( $_POST['fields'] ), $settings );
619
+
620
+ $new_settings = array(
621
+ 'premium-map-api' => sanitize_text_field( $settings['premium-map-api'] ),
622
+ 'premium-youtube-api' => sanitize_text_field( $settings['premium-youtube-api'] ),
623
+ 'premium-map-disable-api' => intval( $settings['premium-map-disable-api'] ? 1 : 0 ),
624
+ 'premium-map-cluster' => intval( $settings['premium-map-cluster'] ? 1 : 0 ),
625
+ 'premium-map-locale' => sanitize_text_field( $settings['premium-map-locale'] ),
626
+ 'is-beta-tester' => intval( $settings['is-beta-tester'] ? 1 : 0 ),
627
+ );
628
+
629
+ update_option( 'pa_maps_save_settings', $new_settings );
630
+
631
+ wp_send_json_success( $settings );
632
+
633
+ }
634
+
635
+ /**
636
+ * Save Global Button Value
637
+ *
638
+ * Saves value for elements global switcher
639
+ *
640
+ * @since 4.0.0
641
+ * @access public
642
+ */
643
+ public function save_global_btn_value() {
644
+
645
+ check_ajax_referer( 'pa-settings-tab', 'security' );
646
+
647
+ if ( ! isset( $_POST['isGlobalOn'] ) ) {
648
+ wp_send_json_error();
649
+ }
650
+
651
+ $global_btn_value = sanitize_text_field( $_POST['isGlobalOn'] );
652
+
653
+ update_option( 'pa_global_btn_value', $global_btn_value );
654
+
655
+ wp_send_json_success();
656
+
657
+ }
658
+
659
+ /**
660
+ * Get default Elements
661
+ *
662
+ * @since 3.20.9
663
+ * @access private
664
+ *
665
+ * @return $default_keys array keys defaults
666
+ */
667
+ private static function get_default_elements() {
668
+
669
+ $elements = self::get_elements_list();
670
+
671
+ $keys = array();
672
+
673
+ // Now, we need to fill our array with elements keys.
674
+ foreach ( $elements as $cat ) {
675
+ if ( count( $cat['elements'] ) ) {
676
+ foreach ( $cat['elements'] as $elem ) {
677
+ array_push( $keys, $elem['key'] );
678
+ }
679
+ }
680
+ }
681
+
682
+ $default_keys = array_fill_keys( $keys, true );
683
+
684
+ return $default_keys;
685
+
686
+ }
687
+
688
+ /**
689
+ * Get Pro Elements
690
+ *
691
+ * @since 4.5.3
692
+ * @access public
693
+ */
694
+ public static function get_pro_elements() {
695
+
696
+ $elements = self::get_elements_list();
697
+
698
+ $pro_elements = array();
699
+
700
+ $all_elements = $elements['cat-1'];
701
+
702
+ if ( count( $all_elements['elements'] ) ) {
703
+ foreach ( $all_elements['elements'] as $elem ) {
704
+ if ( isset( $elem['is_pro'] ) && ! isset( $elem['is_global'] ) ) {
705
+ array_push( $pro_elements, $elem );
706
+ }
707
+ }
708
+ }
709
+
710
+ return $pro_elements;
711
+
712
+ }
713
+
714
+ /**
715
+ * Get Default Interations
716
+ *
717
+ * @since 3.20.9
718
+ * @access private
719
+ *
720
+ * @return $default_keys array default keys
721
+ */
722
+ private static function get_default_integrations() {
723
+
724
+ $settings = self::get_integrations_list();
725
+
726
+ $default_keys = array_fill_keys( $settings, true );
727
+
728
+ // Beta Tester should NOT be enabled by default.
729
+ $default_keys['is-beta-tester'] = false;
730
+
731
+ return $default_keys;
732
+
733
+ }
734
+
735
+ /**
736
+ * Get enabled widgets
737
+ *
738
+ * @since 3.20.9
739
+ * @access public
740
+ *
741
+ * @return array $enabled_keys enabled elements
742
+ */
743
+ public static function get_enabled_elements() {
744
+
745
+ $defaults = self::get_default_elements();
746
+
747
+ $enabled_keys = get_option( 'pa_save_settings', $defaults );
748
+
749
+ foreach ( $defaults as $key => $value ) {
750
+ if ( ! isset( $enabled_keys[ $key ] ) ) {
751
+ $defaults[ $key ] = 0;
752
+ }
753
+ }
754
+
755
+ return $defaults;
756
+
757
+ }
758
+
759
+ /**
760
+ * Check If Premium Templates is enabled
761
+ *
762
+ * @since 3.6.0
763
+ * @access public
764
+ *
765
+ * @return boolean
766
+ */
767
+ public static function check_premium_templates() {
768
+
769
+ $settings = self::get_enabled_elements();
770
+
771
+ if ( ! isset( $settings['premium-templates'] ) ) {
772
+ return true;
773
+ }
774
+
775
+ $is_enabled = $settings['premium-templates'];
776
+
777
+ return $is_enabled;
778
+ }
779
+
780
+
781
+ /**
782
+ * Check If Premium Duplicator is enabled
783
+ *
784
+ * @since 3.20.9
785
+ * @access public
786
+ *
787
+ * @return boolean
788
+ */
789
+ public static function check_duplicator() {
790
+
791
+ $settings = self::get_enabled_elements();
792
+
793
+ if ( ! isset( $settings['premium-duplicator'] ) ) {
794
+ return true;
795
+ }
796
+
797
+ $is_enabled = $settings['premium-duplicator'];
798
+
799
+ return $is_enabled;
800
+ }
801
+
802
+ /**
803
+ * Get Integrations Settings
804
+ *
805
+ * Get plugin integrations settings
806
+ *
807
+ * @since 3.20.9
808
+ * @access public
809
+ *
810
+ * @return array $settings integrations settings
811
+ */
812
+ public static function get_integrations_settings() {
813
+
814
+ $enabled_keys = get_option( 'pa_maps_save_settings', self::get_default_integrations() );
815
+
816
+ return $enabled_keys;
817
+
818
+ }
819
+
820
+ /**
821
+ * Run PA Rollback
822
+ *
823
+ * Trigger PA Rollback actions
824
+ *
825
+ * @since 4.2.5
826
+ * @access public
827
+ */
828
+ public function run_pa_rollback() {
829
+
830
+ check_admin_referer( 'premium_addons_rollback' );
831
+
832
+ $plugin_slug = basename( PREMIUM_ADDONS_FILE, '.php' );
833
+
834
+ $pa_rollback = new PA_Rollback(
835
+ array(
836
+ 'version' => PREMIUM_ADDONS_STABLE_VERSION,
837
+ 'plugin_name' => PREMIUM_ADDONS_BASENAME,
838
+ 'plugin_slug' => $plugin_slug,
839
+ 'package_url' => sprintf( 'https://downloads.wordpress.org/plugin/%s.%s.zip', $plugin_slug, PREMIUM_ADDONS_STABLE_VERSION ),
840
+ )
841
+ );
842
+
843
+ $pa_rollback->run();
844
+
845
+ wp_die(
846
+ '',
847
+ esc_html( __( 'Rollback to Previous Version', 'premium-addons-for-elementor' ) ),
848
+ array(
849
+ 'response' => 200,
850
+ )
851
+ );
852
+
853
+ }
854
+
855
+ /**
856
+ * Disable unused widgets.
857
+ *
858
+ * @access public
859
+ * @since 4.5.8
860
+ */
861
+ public function get_unused_widgets() {
862
+
863
+ check_ajax_referer( 'pa-settings-tab', 'security' );
864
+
865
+ if ( ! current_user_can( 'install_plugins' ) ) {
866
+ wp_send_json_error();
867
+ }
868
+
869
+ $pa_elements = self::get_pa_elements_names();
870
+
871
+ $used_widgets = self::get_used_widgets();
872
+
873
+ $unused_widgets = array_diff( $pa_elements, array_keys( $used_widgets ) );
874
+
875
+ wp_send_json_success( $unused_widgets );
876
+
877
+ }
878
+
879
+ /**
880
+ * Get PA widget names.
881
+ *
882
+ * @access public
883
+ * @since 4.5.8
884
+ *
885
+ * @return array
886
+ */
887
+ public static function get_pa_elements_names() {
888
+
889
+ $names = self::$elements_names;
890
+
891
+ if ( null === $names ) {
892
+
893
+ $names = array_map(
894
+ function( $item ) {
895
+ return isset( $item['name'] ) ? $item['name'] : 'global';
896
+ },
897
+ self::get_elements_list()['cat-1']['elements']
898
+ );
899
+
900
+ $names = array_filter(
901
+ $names,
902
+ function( $name ) {
903
+ return 'global' !== $name;
904
+ }
905
+ );
906
+
907
+ }
908
+
909
+ return $names;
910
+ }
911
+
912
+ /**
913
+ * Get used widgets.
914
+ *
915
+ * @access public
916
+ * @since 4.5.8
917
+ *
918
+ * @return array
919
+ */
920
+ public static function get_used_widgets() {
921
+
922
+ $used_widgets = array();
923
+ $tracker_allowed = 'yes' === get_option( 'elementor_allow_tracking' ) ? true : false;
924
+
925
+ if ( ! $tracker_allowed ) {
926
+ return false;
927
+ }
928
+
929
+ if ( class_exists( 'Elementor\Modules\Usage\Module' ) ) {
930
+
931
+ $module = Module::instance();
932
+ $elements = $module->get_formatted_usage( 'raw' );
933
+
934
+ $pa_elements = self::get_pa_elements_names();
935
+
936
+ if ( is_array( $elements ) || is_object( $elements ) ) {
937
+
938
+ foreach ( $elements as $post_type => $data ) {
939
+
940
+ foreach ( $data['elements'] as $element => $count ) {
941
+
942
+ if ( in_array( $element, $pa_elements, true ) ) {
943
+
944
+ if ( isset( $used_widgets[ $element ] ) ) {
945
+ $used_widgets[ $element ] += $count;
946
+ } else {
947
+ $used_widgets[ $element ] = $count;
948
+ }
949
+ }
950
+ }
951
+ }
952
+ }
953
+ }
954
+
955
+ return $used_widgets;
956
+ }
957
+
958
+ /**
959
+ * Subscribe Newsletter
960
+ *
961
+ * Adds an email to Premium Addons subscribers list
962
+ *
963
+ * @since 4.7.0
964
+ *
965
+ * @access public
966
+ */
967
+ public function subscribe_newsletter() {
968
+
969
+ check_ajax_referer( 'pa-settings-tab', 'security' );
970
+
971
+ if ( ! self::check_user_can( 'manage_options' ) ) {
972
+ wp_send_json_error();
973
+ }
974
+
975
+ $email = isset( $_POST['email'] ) ? $_POST['email'] : '';
976
+
977
+ $api_url = 'https://premiumaddons.com/wp-json/mailchimp/v2/add';
978
+
979
+ $request = add_query_arg(
980
+ array(
981
+ 'email' => $email,
982
+ ),
983
+ $api_url
984
+ );
985
+
986
+ $response = wp_remote_get(
987
+ $request,
988
+ array(
989
+ 'timeout' => 60,
990
+ 'sslverify' => true,
991
+ )
992
+ );
993
+
994
+ $body = wp_remote_retrieve_body( $response );
995
+ $body = json_decode( $body, true );
996
+
997
+ wp_send_json_success( $body );
998
+
999
+ }
1000
+
1001
+ /**
1002
+ * Get PA News
1003
+ *
1004
+ * Gets a list of the latest three blog posts
1005
+ *
1006
+ * @since 4.7.0
1007
+ *
1008
+ * @access public
1009
+ */
1010
+ public function get_pa_news() {
1011
+
1012
+ $posts = get_transient( 'pa_news' );
1013
+
1014
+ if ( empty( $posts ) ) {
1015
+
1016
+ $api_url = 'https://premiumaddons.com/wp-json/wp/v2/posts';
1017
+
1018
+ $request = add_query_arg(
1019
+ array(
1020
+ 'per_page' => 3,
1021
+ ),
1022
+ $api_url
1023
+ );
1024
+
1025
+ $response = wp_remote_get(
1026
+ $request,
1027
+ array(
1028
+ 'timeout' => 60,
1029
+ 'sslverify' => true,
1030
+ )
1031
+ );
1032
+
1033
+ $body = wp_remote_retrieve_body( $response );
1034
+ $posts = json_decode( $body, true );
1035
+
1036
+ set_transient( 'pa_news', $posts, WEEK_IN_SECONDS );
1037
+
1038
+ }
1039
+
1040
+ return $posts;
1041
+
1042
+ }
1043
+
1044
+ /**
1045
+ * Creates and returns an instance of the class
1046
+ *
1047
+ * @since 1.0.0
1048
+ * @access public
1049
+ *
1050
+ * @return object
1051
+ */
1052
+ public static function get_instance() {
1053
+
1054
+ if ( ! isset( self::$instance ) ) {
1055
+
1056
+ self::$instance = new self();
1057
+
1058
+ }
1059
+
1060
+ return self::$instance;
1061
+ }
1062
+ }
admin/includes/templates/features.php CHANGED
@@ -1,185 +1,185 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- }
6
-
7
- use PremiumAddons\Includes\Helper_Functions;
8
-
9
- $prefix = Helper_Functions::get_prefix();
10
-
11
- // Get elements settings
12
- $enabled_elements = self::get_enabled_elements();
13
-
14
- $elements = self::get_elements_list();
15
-
16
- $features = $elements['cat-11']['elements'];
17
-
18
- ?>
19
-
20
- <div class="pa-section-content">
21
- <div class="row">
22
- <div class="col-full">
23
- <form action="" method="POST" id="pa-features" name="pa-features" class="pa-settings-form">
24
- <div id="pa-features-settings" class="pa-settings-tab">
25
-
26
- <div class="pa-section-outer-wrap">
27
- <div class="pa-section-info-wrap">
28
- <div class="pa-section-info">
29
- <h4><?php echo sprintf( '%1$s %2$s', $prefix, __( 'Templates', 'premium-addons-for-elementor' ) ); ?></h4>
30
- <p><?php echo __( 'Build Professional Website in Minutes Using Our Pre-Made Premium Elementor Templates.', 'premium-addons-for-elementor' ); ?></p>
31
- </div>
32
-
33
- <div class="pa-section-info-cta">
34
- <label class="switch">
35
- <input type="checkbox" id="premium-templates" name="premium-templates" <?php echo checked( 1, $enabled_elements['premium-templates'], false ); ?>>
36
- <span class="slider round"></span>
37
- </label>
38
- </p>
39
- </div>
40
- </div>
41
- <a href="<?php echo esc_url( $features[0]['demo'] ); ?>" target="_blank"></a>
42
- </div>
43
-
44
- <div class="pa-section-outer-wrap">
45
- <div class="pa-section-info-wrap">
46
- <div class="pa-section-info">
47
- <h4><?php echo __( 'Equal Height', 'premium-addons-for-elementor' ); ?></h4>
48
- <p><?php echo __( 'Make your widgets the same height with just ONE click.', 'premium-addons-for-elementor' ); ?></p>
49
- </div>
50
-
51
- <div class="pa-section-info-cta">
52
- <label class="switch">
53
- <input type="checkbox" id="premium-equal-height" name="premium-equal-height" <?php echo checked( 1, $enabled_elements['premium-equal-height'], false ); ?>>
54
- <span class="slider round"></span>
55
- </label>
56
- </p>
57
- </div>
58
- </div>
59
- <a href="<?php echo esc_url( $features[1]['demo'] ); ?>" target="_blank"></a>
60
- </div>
61
-
62
- <div class="pa-section-outer-wrap">
63
- <div class="pa-section-info-wrap">
64
- <div class="pa-section-info">
65
- <h4><?php echo __( 'Custom Mouse Cursor', 'premium-addons-for-elementor' ); ?></h4>
66
- <p><?php echo __( 'Change the default mouse cursor with icon, image, or Lottie animation for any Elementor section, column, or widget.', 'premium-addons-for-elementor' ); ?></p>
67
- </div>
68
- <?php
69
-
70
- $status = ( isset( $features[3]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'disabled' : checked( 1, $enabled_elements['premium-global-cursor'], false );
71
- $class = ( isset( $features[3]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'pro-' : '';
72
- $switcher_class = $class . 'slider round';
73
-
74
- ?>
75
- <div class="pa-section-info-cta">
76
- <label class="switch">
77
- <input type="checkbox" id="premium-global-cursor" name="premium-global-cursor" <?php echo $status; ?>>
78
- <span class="<?php echo esc_attr( $switcher_class ); ?>"></span>
79
- </label>
80
- </p>
81
- </div>
82
- </div>
83
- <a href="<?php echo esc_url( $features[3]['demo'] ); ?>" target="_blank"></a>
84
- </div>
85
-
86
- <div class="pa-section-outer-wrap">
87
- <div class="pa-section-info-wrap">
88
- <div class="pa-section-info">
89
- <h4><?php echo __( 'Global Badge', 'premium-addons-for-elementor' ); ?></h4>
90
- <p><?php echo __( 'Add icon, image, Lottie, or SVG blob shape badge to any Elementor section, column, or widget.', 'premium-addons-for-elementor' ); ?></p>
91
- </div>
92
- <?php
93
-
94
- $status = ( isset( $features[4]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'disabled' : checked( 1, $enabled_elements['premium-global-badge'], false );
95
- $class = ( isset( $features[4]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'pro-' : '';
96
- $switcher_class = $class . 'slider round';
97
-
98
- ?>
99
- <div class="pa-section-info-cta">
100
- <label class="switch">
101
- <input type="checkbox" id="premium-global-badge" name="premium-global-badge" <?php echo $status; ?>>
102
- <span class="<?php echo esc_attr( $switcher_class ); ?>"></span>
103
- </label>
104
- </p>
105
- </div>
106
- </div>
107
- <a href="<?php echo esc_url( $features[4]['demo'] ); ?>" target="_blank"></a>
108
- </div>
109
-
110
- <div class="pa-section-outer-wrap">
111
- <div class="pa-section-info-wrap">
112
- <div class="pa-section-info">
113
- <h4><?php echo __( 'Display Conditions', 'premium-addons-for-elementor' ); ?></h4>
114
- <p><?php echo __( 'Show/hide content dynamically based on location, browser, operating system, user role, device type, Woocommerce, ACF, etc.', 'premium-addons-for-elementor' ); ?></p>
115
- </div>
116
-
117
- <div class="pa-section-info-cta">
118
- <label class="switch">
119
- <input type="checkbox" id="pa-display-conditions" name="pa-display-conditions" <?php echo checked( 1, $enabled_elements['pa-display-conditions'], false ); ?>>
120
- <span class="slider round"></span>
121
- </label>
122
- </p>
123
- </div>
124
- </div>
125
- <a href="<?php echo esc_url( $features[2]['demo'] ); ?>" target="_blank"></a>
126
- </div>
127
-
128
- <div class="pa-section-outer-wrap">
129
- <div class="pa-section-info-wrap">
130
- <div class="pa-section-info">
131
- <h4><?php echo __( 'Floating Effects', 'premium-addons-for-elementor' ); ?></h4>
132
- <p><?php echo __( 'Apply advanced floating effects on any Elementor element or a custom CSS selector.', 'premium-addons-for-elementor' ); ?></p>
133
- </div>
134
-
135
- <div class="pa-section-info-cta">
136
- <label class="switch">
137
- <input type="checkbox" id="premium-floating-effects" name="premium-floating-effects" <?php echo checked( 1, $enabled_elements['premium-floating-effects'], false ); ?>>
138
- <span class="slider round"></span>
139
- </label>
140
- </p>
141
- </div>
142
- </div>
143
- <a href="<?php echo esc_url( $features[5]['demo'] ); ?>" target="_blank"></a>
144
- </div>
145
-
146
- <div class="pa-section-outer-wrap">
147
- <div class="pa-section-info-wrap">
148
- <div class="pa-section-info">
149
- <h4><?php echo __( 'Cross-Domain Copy N’ Paste', 'premium-addons-for-elementor' ); ?></h4>
150
- <p><?php echo __( 'Copy any Elementor content from site to another in just ONE click.', 'premium-addons-for-elementor' ); ?></p>
151
- </div>
152
-
153
- <div class="pa-section-info-cta">
154
- <label class="switch">
155
- <input type="checkbox" id="premium-cross-domain" name="premium-cross-domain" <?php echo checked( 1, $enabled_elements['premium-cross-domain'], false ); ?>>
156
- <span class="slider round"></span>
157
- </label>
158
- </p>
159
- </div>
160
- </div>
161
- <a href="<?php echo esc_url( $features[6]['demo'] ); ?>" target="_blank"></a>
162
- </div>
163
-
164
- <div class="pa-section-outer-wrap">
165
- <div class="pa-section-info-wrap">
166
- <div class="pa-section-info">
167
- <h4><?php echo __( 'Duplicator', 'premium-addons-for-elementor' ); ?></h4>
168
- <p><?php echo __( 'Duplicate any post, page or template on your website.', 'premium-addons-for-elementor' ); ?></p>
169
- </div>
170
-
171
- <div class="pa-section-info-cta">
172
- <label class="switch">
173
- <input type="checkbox" id="premium-duplicator" name="premium-duplicator" <?php echo checked( 1, $enabled_elements['premium-duplicator'], false ); ?>>
174
- <span class="slider round"></span>
175
- </label>
176
- </p>
177
- </div>
178
- </div>
179
- </div>
180
-
181
- </div>
182
- </form> <!-- End Form -->
183
- </div>
184
- </div>
185
- </div> <!-- End Section Content -->
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ use PremiumAddons\Includes\Helper_Functions;
8
+
9
+ $prefix = Helper_Functions::get_prefix();
10
+
11
+ // Get elements settings
12
+ $enabled_elements = self::get_enabled_elements();
13
+
14
+ $elements = self::get_elements_list();
15
+
16
+ $features = $elements['cat-11']['elements'];
17
+
18
+ ?>
19
+
20
+ <div class="pa-section-content">
21
+ <div class="row">
22
+ <div class="col-full">
23
+ <form action="" method="POST" id="pa-features" name="pa-features" class="pa-settings-form">
24
+ <div id="pa-features-settings" class="pa-settings-tab">
25
+
26
+ <div class="pa-section-outer-wrap">
27
+ <div class="pa-section-info-wrap">
28
+ <div class="pa-section-info">
29
+ <h4><?php echo sprintf( '%1$s %2$s', $prefix, __( 'Templates', 'premium-addons-for-elementor' ) ); ?></h4>
30
+ <p><?php echo __( 'Build Professional Website in Minutes Using Our Pre-Made Premium Elementor Templates.', 'premium-addons-for-elementor' ); ?></p>
31
+ </div>
32
+
33
+ <div class="pa-section-info-cta">
34
+ <label class="switch">
35
+ <input type="checkbox" id="premium-templates" name="premium-templates" <?php echo checked( 1, $enabled_elements['premium-templates'], false ); ?>>
36
+ <span class="slider round"></span>
37
+ </label>
38
+ </p>
39
+ </div>
40
+ </div>
41
+ <a href="<?php echo esc_url( $features[0]['demo'] ); ?>" target="_blank"></a>
42
+ </div>
43
+
44
+ <div class="pa-section-outer-wrap">
45
+ <div class="pa-section-info-wrap">
46
+ <div class="pa-section-info">
47
+ <h4><?php echo __( 'Equal Height', 'premium-addons-for-elementor' ); ?></h4>
48
+ <p><?php echo __( 'Make your widgets the same height with just ONE click.', 'premium-addons-for-elementor' ); ?></p>
49
+ </div>
50
+
51
+ <div class="pa-section-info-cta">
52
+ <label class="switch">
53
+ <input type="checkbox" id="premium-equal-height" name="premium-equal-height" <?php echo checked( 1, $enabled_elements['premium-equal-height'], false ); ?>>
54
+ <span class="slider round"></span>
55
+ </label>
56
+ </p>
57
+ </div>
58
+ </div>
59
+ <a href="<?php echo esc_url( $features[1]['demo'] ); ?>" target="_blank"></a>
60
+ </div>
61
+
62
+ <div class="pa-section-outer-wrap">
63
+ <div class="pa-section-info-wrap">
64
+ <div class="pa-section-info">
65
+ <h4><?php echo __( 'Custom Mouse Cursor', 'premium-addons-for-elementor' ); ?></h4>
66
+ <p><?php echo __( 'Change the default mouse cursor with icon, image, or Lottie animation for any Elementor section, column, or widget.', 'premium-addons-for-elementor' ); ?></p>
67
+ </div>
68
+ <?php
69
+
70
+ $status = ( isset( $features[3]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'disabled' : checked( 1, $enabled_elements['premium-global-cursor'], false );
71
+ $class = ( isset( $features[3]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'pro-' : '';
72
+ $switcher_class = $class . 'slider round';
73
+
74
+ ?>
75
+ <div class="pa-section-info-cta">
76
+ <label class="switch">
77
+ <input type="checkbox" id="premium-global-cursor" name="premium-global-cursor" <?php echo $status; ?>>
78
+ <span class="<?php echo esc_attr( $switcher_class ); ?>"></span>
79
+ </label>
80
+ </p>
81
+ </div>
82
+ </div>
83
+ <a href="<?php echo esc_url( $features[3]['demo'] ); ?>" target="_blank"></a>
84
+ </div>
85
+
86
+ <div class="pa-section-outer-wrap">
87
+ <div class="pa-section-info-wrap">
88
+ <div class="pa-section-info">
89
+ <h4><?php echo __( 'Global Badge', 'premium-addons-for-elementor' ); ?></h4>
90
+ <p><?php echo __( 'Add icon, image, Lottie, or SVG blob shape badge to any Elementor section, column, or widget.', 'premium-addons-for-elementor' ); ?></p>
91
+ </div>
92
+ <?php
93
+
94
+ $status = ( isset( $features[4]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'disabled' : checked( 1, $enabled_elements['premium-global-badge'], false );
95
+ $class = ( isset( $features[4]['is_pro'] ) && ! Helper_Functions::check_papro_version() ) ? 'pro-' : '';
96
+ $switcher_class = $class . 'slider round';
97
+
98
+ ?>
99
+ <div class="pa-section-info-cta">
100
+ <label class="switch">
101
+ <input type="checkbox" id="premium-global-badge" name="premium-global-badge" <?php echo $status; ?>>
102
+ <span class="<?php echo esc_attr( $switcher_class ); ?>"></span>
103
+ </label>
104
+ </p>
105
+ </div>
106
+ </div>
107
+ <a href="<?php echo esc_url( $features[4]['demo'] ); ?>" target="_blank"></a>
108
+ </div>
109
+
110
+ <div class="pa-section-outer-wrap">
111
+ <div class="pa-section-info-wrap">
112
+ <div class="pa-section-info">
113
+ <h4><?php echo __( 'Display Conditions', 'premium-addons-for-elementor' ); ?></h4>
114
+ <p><?php echo __( 'Show/hide content dynamically based on location, browser, operating system, user role, device type, Woocommerce, ACF, etc.', 'premium-addons-for-elementor' ); ?></p>
115
+ </div>
116
+
117
+ <div class="pa-section-info-cta">
118
+ <label class="switch">
119
+ <input type="checkbox" id="pa-display-conditions" name="pa-display-conditions" <?php echo checked( 1, $enabled_elements['pa-display-conditions'], false ); ?>>
120
+ <span class="slider round"></span>
121
+ </label>
122
+ </p>
123
+ </div>
124
+ </div>
125
+ <a href="<?php echo esc_url( $features[2]['demo'] ); ?>" target="_blank"></a>
126
+ </div>
127
+
128
+ <div class="pa-section-outer-wrap">
129
+ <div class="pa-section-info-wrap">
130
+ <div class="pa-section-info">
131
+ <h4><?php echo __( 'Floating Effects', 'premium-addons-for-elementor' ); ?></h4>
132
+ <p><?php echo __( 'Apply advanced floating effects on any Elementor element or a custom CSS selector.', 'premium-addons-for-elementor' ); ?></p>
133
+ </div>
134
+
135
+ <div class="pa-section-info-cta">
136
+ <label class="switch">
137
+ <input type="checkbox" id="premium-floating-effects" name="premium-floating-effects" <?php echo checked( 1, $enabled_elements['premium-floating-effects'], false ); ?>>
138
+ <span class="slider round"></span>
139
+ </label>
140
+ </p>
141
+ </div>
142
+ </div>
143
+ <a href="<?php echo esc_url( $features[5]['demo'] ); ?>" target="_blank"></a>
144
+ </div>
145
+
146
+ <div class="pa-section-outer-wrap">
147
+ <div class="pa-section-info-wrap">
148
+ <div class="pa-section-info">
149
+ <h4><?php echo __( 'Cross-Domain Copy N’ Paste', 'premium-addons-for-elementor' ); ?></h4>
150
+ <p><?php echo __( 'Copy any Elementor content from site to another in just ONE click.', 'premium-addons-for-elementor' ); ?></p>
151
+ </div>
152
+
153
+ <div class="pa-section-info-cta">
154
+ <label class="switch">
155
+ <input type="checkbox" id="premium-cross-domain" name="premium-cross-domain" <?php echo checked( 1, $enabled_elements['premium-cross-domain'], false ); ?>>
156
+ <span class="slider round"></span>
157
+ </label>
158
+ </p>
159
+ </div>
160
+ </div>
161
+ <a href="<?php echo esc_url( $features[6]['demo'] ); ?>" target="_blank"></a>
162
+ </div>
163
+
164
+ <div class="pa-section-outer-wrap">
165
+ <div class="pa-section-info-wrap">
166
+ <div class="pa-section-info">
167
+ <h4><?php echo __( 'Duplicator', 'premium-addons-for-elementor' ); ?></h4>
168
+ <p><?php echo __( 'Duplicate any post, page or template on your website.', 'premium-addons-for-elementor' ); ?></p>
169
+ </div>
170
+
171
+ <div class="pa-section-info-cta">
172
+ <label class="switch">
173
+ <input type="checkbox" id="premium-duplicator" name="premium-duplicator" <?php echo checked( 1, $enabled_elements['premium-duplicator'], false ); ?>>
174
+ <span class="slider round"></span>
175
+ </label>
176
+ </p>
177
+ </div>
178
+ </div>
179
+ </div>
180
+
181
+ </div>
182
+ </form> <!-- End Form -->
183
+ </div>
184
+ </div>
185
+ </div> <!-- End Section Content -->
includes/templates/sources/base.php CHANGED
@@ -285,7 +285,7 @@ abstract class Premium_Templates_Source_Base {
285
  // wp_die();
286
  $element_data['settings'][ $control['name'] ] = $control_class->{$method}( $element->get_settings( $control['name'] ), $control );
287
  } elseif ( 'repeater' === $control['type'] ) {
288
- $element_data['settings'][ $control['name'] ] = $this->on_import_repeater( $element->get_settings( $control['name'] ), $control, $with_media );
289
  // $element_data['settings'][ $control['name'] ]['url'] = Utils::get_placeholder_image_src();
290
  } else {
291
  if ( ! empty( $element_data['settings'][ $control['name'] ]['url'] ) ) {
@@ -326,7 +326,7 @@ abstract class Premium_Templates_Source_Base {
326
  return $settings;
327
  }
328
 
329
- public function on_import_repeater( $settings, $control_data = array(), $media ) {
330
  if ( empty( $settings ) || empty( $control_data['fields'] ) ) {
331
  return $settings;
332
  }
285
  // wp_die();
286
  $element_data['settings'][ $control['name'] ] = $control_class->{$method}( $element->get_settings( $control['name'] ), $control );
287
  } elseif ( 'repeater' === $control['type'] ) {
288
+ $element_data['settings'][ $control['name'] ] = $this->on_import_repeater( $element->get_settings( $control['name'] ), $with_media, $control );
289
  // $element_data['settings'][ $control['name'] ]['url'] = Utils::get_placeholder_image_src();
290
  } else {
291
  if ( ! empty( $element_data['settings'][ $control['name'] ]['url'] ) ) {
326
  return $settings;
327
  }
328
 
329
+ public function on_import_repeater( $settings, $media, $control_data = array() ) {
330
  if ( empty( $settings ) || empty( $control_data['fields'] ) ) {
331
  return $settings;
332
  }
modules/woocommerce/templates/product-1.php CHANGED
@@ -66,7 +66,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
66
  woocommerce_template_loop_product_link_open();
67
 
68
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
69
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
70
  }
71
 
72
  if ( 'swap' === $settings['hover_style'] ) {
66
  woocommerce_template_loop_product_link_open();
67
 
68
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
69
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
70
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
71
  }
72
 
73
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-10.php CHANGED
@@ -91,7 +91,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', tr
91
  woocommerce_template_loop_product_link_open();
92
 
93
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
94
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
95
  }
96
 
97
  if ( 'swap' === $settings['hover_style'] ) {
91
  woocommerce_template_loop_product_link_open();
92
 
93
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
94
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
95
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
96
  }
97
 
98
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-11.php CHANGED
@@ -21,12 +21,12 @@ if ( empty( $product ) || ! $product->is_visible() ) {
21
 
22
  <?php
23
 
24
- $product_id = $product->get_id();
25
- $class = array();
26
- $classes = array();
27
- $classes[] = 'post-' . $product_id;
28
- $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id ) );
29
- $image_size = $settings['featured_image_size'];
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
@@ -59,11 +59,12 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
59
 
60
  echo '<div class="premium-woo-product-thumbnail">';
61
  woocommerce_template_loop_product_link_open();
62
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
63
 
64
- if ( 'swap' === $settings['hover_style'] ) {
65
- Premium_Template_Tags::get_current_product_swap_image( $image_size );
66
- }
67
 
68
  woocommerce_template_loop_product_link_close();
69
  Premium_Template_Tags::get_current_product_linked_images( $image_size );
@@ -74,7 +75,6 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
74
  echo '<i class="premium-woo-qv-icon fa fa-eye"></i>';
75
  echo '</div>';
76
  }
77
-
78
  }
79
 
80
  do_action( 'pa_woo_product_before_details_wrap_start', $product_id, $settings );
@@ -118,7 +118,7 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
118
  echo '</div>';
119
 
120
  // if ( 'yes' === $this->get_option_value( 'product_excerpt' ) ) {
121
- // Premium_Template_Tags::get_product_excerpt();
122
  // }
123
 
124
  echo '<div class="premium-woo-product-buttons">';
@@ -133,7 +133,7 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
133
 
134
  echo '</div>';
135
  do_action( 'pa_woo_product_before_details_wrap_end', $product_id, $settings );
136
- echo '</div>';
137
  do_action( 'pa_woo_product_after_details_wrap_end', $product_id, $settings );
138
 
139
  ?>
21
 
22
  <?php
23
 
24
+ $product_id = $product->get_id();
25
+ $class = array();
26
+ $classes = array();
27
+ $classes[] = 'post-' . $product_id;
28
+ $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id ) );
29
+ $image_size = $settings['featured_image_size'];
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
59
 
60
  echo '<div class="premium-woo-product-thumbnail">';
61
  woocommerce_template_loop_product_link_open();
62
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
63
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
64
 
65
+ if ( 'swap' === $settings['hover_style'] ) {
66
+ Premium_Template_Tags::get_current_product_swap_image( $image_size );
67
+ }
68
 
69
  woocommerce_template_loop_product_link_close();
70
  Premium_Template_Tags::get_current_product_linked_images( $image_size );
75
  echo '<i class="premium-woo-qv-icon fa fa-eye"></i>';
76
  echo '</div>';
77
  }
 
78
  }
79
 
80
  do_action( 'pa_woo_product_before_details_wrap_start', $product_id, $settings );
118
  echo '</div>';
119
 
120
  // if ( 'yes' === $this->get_option_value( 'product_excerpt' ) ) {
121
+ // Premium_Template_Tags::get_product_excerpt();
122
  // }
123
 
124
  echo '<div class="premium-woo-product-buttons">';
133
 
134
  echo '</div>';
135
  do_action( 'pa_woo_product_before_details_wrap_end', $product_id, $settings );
136
+ echo '</div>';
137
  do_action( 'pa_woo_product_after_details_wrap_end', $product_id, $settings );
138
 
139
  ?>
modules/woocommerce/templates/product-2.php CHANGED
@@ -30,8 +30,8 @@ $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
- $image_size = $settings['featured_image_size'];
34
- $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
35
 
36
  ?>
37
  <li class="<?php echo esc_attr( $wc_classes ); ?>">
@@ -62,7 +62,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', tr
62
  woocommerce_template_loop_product_link_open();
63
 
64
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
65
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
66
  }
67
 
68
  if ( 'swap' === $settings['hover_style'] ) {
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
+ $image_size = $settings['featured_image_size'];
34
+ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
35
 
36
  ?>
37
  <li class="<?php echo esc_attr( $wc_classes ); ?>">
62
  woocommerce_template_loop_product_link_open();
63
 
64
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
65
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
66
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
67
  }
68
 
69
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-3.php CHANGED
@@ -31,7 +31,7 @@ $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
34
- $image_size = $settings['featured_image_size'];
35
  ?>
36
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
37
  <div class="premium-woo-product-wrapper">
@@ -61,7 +61,8 @@ $image_size = $settings['featured_image_size'];
61
  woocommerce_template_loop_product_link_open();
62
 
63
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
64
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
65
  }
66
 
67
  if ( 'swap' === $settings['hover_style'] ) {
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
34
+ $image_size = $settings['featured_image_size'];
35
  ?>
36
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
37
  <div class="premium-woo-product-wrapper">
61
  woocommerce_template_loop_product_link_open();
62
 
63
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
64
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
65
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
66
  }
67
 
68
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-4.php CHANGED
@@ -34,7 +34,7 @@ $sale_ribbon = self::$settings['sale'];
34
  $featured_ribbon = self::$settings['featured'];
35
  $quick_view = $this->get_option_value( 'quick_view' );
36
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
37
- $image_size = $settings['featured_image_size'];
38
  ?>
39
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
40
  <div class="premium-woo-product-wrapper">
@@ -65,7 +65,8 @@ $image_size = $settings['featured_image_size'];
65
  woocommerce_template_loop_product_link_open();
66
 
67
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
68
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
69
  }
70
 
71
  if ( 'swap' === $settings['hover_style'] ) {
34
  $featured_ribbon = self::$settings['featured'];
35
  $quick_view = $this->get_option_value( 'quick_view' );
36
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
37
+ $image_size = $settings['featured_image_size'];
38
  ?>
39
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
40
  <div class="premium-woo-product-wrapper">
65
  woocommerce_template_loop_product_link_open();
66
 
67
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
68
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
69
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
70
  }
71
 
72
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-5.php CHANGED
@@ -31,7 +31,7 @@ $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id
31
  $sale_ribbon = self::$settings['sale'];
32
  $featured_ribbon = self::$settings['featured'];
33
  $quick_view = $this->get_option_value( 'quick_view' );
34
- $image_size = $settings['featured_image_size'];
35
 
36
  if ( 'yes' === $quick_view ) {
37
  $qv_type = $this->get_option_value( 'quick_view_type' );
@@ -66,7 +66,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', tr
66
  woocommerce_template_loop_product_link_open();
67
 
68
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
69
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
70
  }
71
 
72
  if ( 'swap' === $settings['hover_style'] ) {
31
  $sale_ribbon = self::$settings['sale'];
32
  $featured_ribbon = self::$settings['featured'];
33
  $quick_view = $this->get_option_value( 'quick_view' );
34
+ $image_size = $settings['featured_image_size'];
35
 
36
  if ( 'yes' === $quick_view ) {
37
  $qv_type = $this->get_option_value( 'quick_view_type' );
66
  woocommerce_template_loop_product_link_open();
67
 
68
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
69
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
70
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
71
  }
72
 
73
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-6.php CHANGED
@@ -31,7 +31,7 @@ $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
34
- $image_size = $settings['featured_image_size'];
35
  ?>
36
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
37
  <div class="premium-woo-product-wrapper">
@@ -60,7 +60,8 @@ $image_size = $settings['featured_image_size'];
60
  woocommerce_template_loop_product_link_open();
61
 
62
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
63
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
64
  }
65
 
66
  if ( 'swap' === $settings['hover_style'] ) {
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
33
  $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', true ) && 'yes' === self::$settings['sold_out'];
34
+ $image_size = $settings['featured_image_size'];
35
  ?>
36
  <li class=" <?php echo esc_attr( $wc_classes ); ?>">
37
  <div class="premium-woo-product-wrapper">
60
  woocommerce_template_loop_product_link_open();
61
 
62
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
63
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
64
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
65
  }
66
 
67
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-7.php CHANGED
@@ -21,12 +21,12 @@ if ( empty( $product ) || ! $product->is_visible() ) {
21
 
22
  <?php
23
 
24
- $product_id = $product->get_id();
25
- $class = array();
26
- $classes = array();
27
- $classes[] = 'post-' . $product_id;
28
- $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id ) );
29
- $image_size = $settings['featured_image_size'];
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
@@ -60,7 +60,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
60
 
61
  echo '<div class="premium-woo-product-thumbnail">';
62
  woocommerce_template_loop_product_link_open();
63
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
64
  if ( 'swap' === $settings['hover_style'] ) {
65
  Premium_Template_Tags::get_current_product_swap_image( $image_size = $settings['featured_image_size'] );
66
  }
21
 
22
  <?php
23
 
24
+ $product_id = $product->get_id();
25
+ $class = array();
26
+ $classes = array();
27
+ $classes[] = 'post-' . $product_id;
28
+ $wc_classes = implode( ' ', wc_product_post_class( $classes, $class, $product_id ) );
29
+ $image_size = $settings['featured_image_size'];
30
  $sale_ribbon = self::$settings['sale'];
31
  $featured_ribbon = self::$settings['featured'];
32
  $quick_view = $this->get_option_value( 'quick_view' );
60
 
61
  echo '<div class="premium-woo-product-thumbnail">';
62
  woocommerce_template_loop_product_link_open();
63
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
64
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
65
  if ( 'swap' === $settings['hover_style'] ) {
66
  Premium_Template_Tags::get_current_product_swap_image( $image_size = $settings['featured_image_size'] );
67
  }
modules/woocommerce/templates/product-8.php CHANGED
@@ -81,7 +81,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status',
81
  woocommerce_template_loop_product_link_open();
82
 
83
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
84
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
85
  }
86
 
87
  if ( 'swap' === $settings['hover_style'] ) {
81
  woocommerce_template_loop_product_link_open();
82
 
83
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
84
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
85
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
86
  }
87
 
88
  if ( 'swap' === $settings['hover_style'] ) {
modules/woocommerce/templates/product-9.php CHANGED
@@ -65,7 +65,8 @@ $out_of_stock = 'outofstock' === get_post_meta( $product_id, '_stock_status', tr
65
  woocommerce_template_loop_product_link_open();
66
 
67
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
68
- echo '<img src="' . esc_url( get_the_post_thumbnail_url( $product_id, $image_size ) ) . '">';
 
69
  }
70
 
71
  if ( 'swap' === $settings['hover_style'] ) {
65
  woocommerce_template_loop_product_link_open();
66
 
67
  if ( 'yes' === $this->get_option_value( 'product_image' ) ) {
68
+ $product_thumb = has_post_thumbnail( $product_id ) ? get_the_post_thumbnail_url( $product_id, $image_size ) : wc_placeholder_img_src( $image_size );
69
+ echo '<img src="' . esc_url( $product_thumb ) . '">';
70
  }
71
 
72
  if ( 'swap' === $settings['hover_style'] ) {
premium-addons-for-elementor.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
- /*
3
- Plugin Name: Premium Addons for Elementor
4
- Description: Premium Addons for Elementor plugin includes widgets and addons like Blog Post Grid, Gallery, WooCommerce Listing , Carousel, Modal Popup, Google Maps, Pricing Tables, Lottie Animations, Countdown, Testimonials.
5
- Plugin URI: https://premiumaddons.com
6
- Version: 4.8.9
7
- Elementor tested up to: 3.5.5
8
- Elementor Pro tested up to: 3.6.2
9
- Author: Leap13
10
- Author URI: https://leap13.com/
11
- Text Domain: premium-addons-for-elementor
12
- Domain Path: /languages
13
- License: GNU General Public License v3.0
14
- */
15
-
16
- if ( ! defined( 'ABSPATH' ) ) {
17
- exit; // No access of directly access.
18
- }
19
-
20
- // Define Constants.
21
- define( 'PREMIUM_ADDONS_VERSION', '4.8.9' );
22
- define( 'PREMIUM_ADDONS_URL', plugins_url( '/', __FILE__ ) );
23
- define( 'PREMIUM_ADDONS_PATH', plugin_dir_path( __FILE__ ) );
24
- define( 'PREMIUM_ADDONS_FILE', __FILE__ );
25
- define( 'PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
26
- define( 'PREMIUM_ADDONS_STABLE_VERSION', '4.8.8' );
27
-
28
- /*
29
- * Load plugin core file
30
- */
31
- require_once PREMIUM_ADDONS_PATH . 'includes/class-pa-core.php';
1
+ <?php
2
+ /*
3
+ Plugin Name: Premium Addons for Elementor
4
+ Description: Premium Addons for Elementor plugin includes widgets and addons like Blog Post Grid, Gallery, WooCommerce Listing , Carousel, Modal Popup, Google Maps, Pricing Tables, Lottie Animations, Countdown, Testimonials.
5
+ Plugin URI: https://premiumaddons.com
6
+ Version: 4.8.10
7
+ Elementor tested up to: 3.5.5
8
+ Elementor Pro tested up to: 3.6.2
9
+ Author: Leap13
10
+ Author URI: https://leap13.com/
11
+ Text Domain: premium-addons-for-elementor
12
+ Domain Path: /languages
13
+ License: GNU General Public License v3.0
14
+ */
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ exit; // No access of directly access.
18
+ }
19
+
20
+ // Define Constants.
21
+ define( 'PREMIUM_ADDONS_VERSION', '4.8.10' );
22
+ define( 'PREMIUM_ADDONS_URL', plugins_url( '/', __FILE__ ) );
23
+ define( 'PREMIUM_ADDONS_PATH', plugin_dir_path( __FILE__ ) );
24
+ define( 'PREMIUM_ADDONS_FILE', __FILE__ );
25
+ define( 'PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
26
+ define( 'PREMIUM_ADDONS_STABLE_VERSION', '4.8.9' );
27
+
28
+ /*
29
+ * Load plugin core file
30
+ */
31
+ require_once PREMIUM_ADDONS_PATH . 'includes/class-pa-core.php';
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate Link: https://premiumaddons.com/?utm_source=wp-repo&utm_medium=link&utm_c
5
  Requires at least: 5.0
6
  Tested Up To: 5.9.1
7
  Requires PHP: 5.4
8
- Stable Tag: 4.8.9
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
@@ -206,6 +206,11 @@ Premium Addons for Elementor is 100% Ads Free, Ads can only be detected from You
206
 
207
  == Changelog ==
208
 
 
 
 
 
 
209
  = 4.8.9 =
210
 
211
  - Tweak: Added Product Image Height option in WooCommerce Products Listing widget.
5
  Requires at least: 5.0
6
  Tested Up To: 5.9.1
7
  Requires PHP: 5.4
8
+ Stable Tag: 4.8.10
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
206
 
207
  == Changelog ==
208
 
209
+ = 4.8.10 =
210
+
211
+ - Tweak: Show WooCommerce placeholder image if the current product has no thumbnail in WooCommerce Products Listing widget.
212
+ - Fixed: Enable Beta Tester option is not working.
213
+
214
  = 4.8.9 =
215
 
216
  - Tweak: Added Product Image Height option in WooCommerce Products Listing widget.