Premium Addons for Elementor - Version 4.9.24

Version Description

  • Fixed: Comatibility issues with Elementor v3.7.0.
  • Fixed: Copy/Paste element styling not working after Elementor v3.7.0.
  • Fixed: Returning Visitor Display Condition causing issues with AJAX requests.
  • Fixed: ACF Text Display Condition not comparing empty values.
  • Fixed: Widgets` styling broken when Dynamic Assets Generate option is enabled on password-protected websites.
Download this release

Release Info

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

Code changes from version 4.9.23 to 4.9.24

assets/editor/templates/js/editor.js CHANGED
@@ -1,1062 +1,1062 @@
1
- (function ($) {
2
-
3
- 'use strict';
4
-
5
- var PremiumTempsData = window.PremiumTempsData || {},
6
- PremiumEditor,
7
- PremiumEditorViews,
8
- PremiumControlsViews,
9
- PremiumModules;
10
-
11
- PremiumEditorViews = {
12
-
13
- ModalLayoutView: null,
14
- ModalHeaderView: null,
15
- ModalHeaderInsertButton: null,
16
- ModalLoadingView: null,
17
- ModalBodyView: null,
18
- ModalErrorView: null,
19
- LibraryCollection: null,
20
- KeywordsModel: null,
21
- ModalCollectionView: null,
22
- ModalTabsCollection: null,
23
- ModalTabsCollectionView: null,
24
- FiltersCollectionView: null,
25
- FiltersItemView: null,
26
- ModalTabsItemView: null,
27
- ModalTemplateItemView: null,
28
- ModalInsertTemplateBehavior: null,
29
- ModalTemplateModel: null,
30
- CategoriesCollection: null,
31
- ModalPreviewView: null,
32
- ModalHeaderBack: null,
33
- ModalHeaderLogo: null,
34
- KeywordsView: null,
35
- TabModel: null,
36
- CategoryModel: null,
37
-
38
- init: function () {
39
- var self = this;
40
-
41
- self.ModalTemplateModel = Backbone.Model.extend({
42
- defaults: {
43
- template_id: 0,
44
- name: '',
45
- title: '',
46
- thumbnail: '',
47
- preview: '',
48
- source: '',
49
- categories: [],
50
- keywords: []
51
- }
52
- });
53
-
54
- self.ModalHeaderView = Marionette.LayoutView.extend({
55
-
56
- id: 'premium-template-modal-header',
57
- template: '#tmpl-premium-template-modal-header',
58
-
59
- ui: {
60
- closeModal: '#premium-template-modal-header-close-modal'
61
- },
62
-
63
- events: {
64
- 'click @ui.closeModal': 'onCloseModalClick'
65
- },
66
-
67
- regions: {
68
- headerLogo: '#premium-template-modal-header-logo-area',
69
- headerTabs: '#premium-template-modal-header-tabs',
70
- headerActions: '#premium-template-modal-header-actions'
71
- },
72
-
73
- onCloseModalClick: function () {
74
- PremiumEditor.closeModal();
75
- }
76
-
77
- });
78
-
79
- self.TabModel = Backbone.Model.extend({
80
- defaults: {
81
- slug: '',
82
- title: ''
83
- }
84
- });
85
-
86
- self.LibraryCollection = Backbone.Collection.extend({
87
- model: self.ModalTemplateModel
88
- });
89
-
90
- self.ModalTabsCollection = Backbone.Collection.extend({
91
- model: self.TabModel
92
- });
93
-
94
- self.CategoryModel = Backbone.Model.extend({
95
- defaults: {
96
- slug: '',
97
- title: ''
98
- }
99
- });
100
-
101
- self.KeywordsModel = Backbone.Model.extend({
102
- defaults: {
103
- keywords: {}
104
- }
105
- });
106
-
107
- self.CategoriesCollection = Backbone.Collection.extend({
108
- model: self.CategoryModel
109
- });
110
-
111
- self.KeywordsView = Marionette.ItemView.extend({
112
- id: 'elementor-template-library-filter',
113
- template: '#tmpl-premium-template-modal-keywords',
114
- ui: {
115
- keywords: '.premium-library-keywords'
116
- },
117
-
118
- events: {
119
- 'change @ui.keywords': 'onSelectKeyword'
120
- },
121
-
122
- onSelectKeyword: function (event) {
123
- var selected = event.currentTarget.selectedOptions[0].value;
124
- PremiumEditor.setFilter('keyword', selected);
125
- },
126
-
127
- onRender: function () {
128
- var $filters = this.$('.premium-library-keywords');
129
- $filters.select2({
130
- placeholder: 'Choose Widget',
131
- allowClear: true,
132
- width: 250,
133
- dropdownParent: this.$el
134
- });
135
- }
136
- });
137
-
138
- self.ModalPreviewView = Marionette.ItemView.extend({
139
-
140
- template: '#tmpl-premium-template-modal-preview',
141
-
142
- id: 'premium-templatate-item-preview-wrap',
143
-
144
- ui: {
145
- iframe: 'iframe',
146
- notice: '.premium-template-item-notice'
147
- },
148
-
149
-
150
- onRender: function () {
151
-
152
- if (null !== this.getOption('notice')) {
153
- if (this.getOption('notice').length) {
154
- var message = "";
155
- if (-1 !== this.getOption('notice').indexOf("facebook")) {
156
- message += "<p>Please login with your Facebook account in order to get your Facebook Reviews.</p>";
157
- } else if (-1 !== this.getOption('notice').indexOf("google")) {
158
- message += "<p>You need to add your Google API key from Dashboard -> Premium Add-ons for Elementor -> Google Maps</p>";
159
- } else if (-1 !== this.getOption('notice').indexOf("form")) {
160
- message += "<p>You need to have <a href='https://wordpress.org/plugins/contact-form-7/' target='_blank'>Contact Form 7 plugin</a> installed and active.</p>";
161
- }
162
-
163
- this.ui.notice.html('<div><p><strong>Important!</strong></p>' + message + '</div>');
164
- }
165
- }
166
-
167
- this.ui.iframe.attr('src', this.getOption('url'));
168
-
169
- }
170
- });
171
-
172
- self.ModalHeaderBack = Marionette.ItemView.extend({
173
-
174
- template: '#tmpl-premium-template-modal-header-back',
175
-
176
- id: 'premium-template-modal-header-back',
177
-
178
- ui: {
179
- button: 'button'
180
- },
181
-
182
- events: {
183
- 'click @ui.button': 'onBackClick',
184
- },
185
-
186
- onBackClick: function () {
187
- PremiumEditor.setPreview('back');
188
- }
189
-
190
- });
191
-
192
- self.ModalHeaderLogo = Marionette.ItemView.extend({
193
-
194
- template: '#tmpl-premium-template-modal-header-logo',
195
-
196
- id: 'premium-template-modal-header-logo'
197
-
198
- });
199
-
200
- self.ModalBodyView = Marionette.LayoutView.extend({
201
-
202
- id: 'premium-template-library-content',
203
-
204
- className: function () {
205
- return 'library-tab-' + PremiumEditor.getTab();
206
- },
207
-
208
- template: '#tmpl-premium-template-modal-content',
209
-
210
- regions: {
211
- contentTemplates: '.premium-templates-list',
212
- contentFilters: '.premium-filters-list',
213
- contentKeywords: '.premium-keywords-list'
214
- }
215
-
216
- });
217
-
218
- self.ModalInsertTemplateBehavior = Marionette.Behavior.extend({
219
- ui: {
220
- insertButtons: ['.premium-template-insert', '.premium-template-insert-no-media'],
221
- },
222
-
223
- events: {
224
- 'click @ui.insertButtons': 'onInsertButtonClick'
225
- },
226
-
227
- onInsertButtonClick: function (event) {
228
-
229
- var templateModel = this.view.model,
230
- innerTemplates = templateModel.attributes.dependencies,
231
- isPro = templateModel.attributes.pro,
232
- innerTemplatesLength = Object.keys(innerTemplates).length,
233
- options = {},
234
- insertMedia = !$(event.currentTarget).hasClass("premium-template-insert-no-media");
235
-
236
- // console.log(insertMedia);
237
-
238
- PremiumEditor.layout.showLoadingView();
239
- if (innerTemplatesLength > 0) {
240
- for (var key in innerTemplates) {
241
- $.ajax({
242
- url: ajaxurl,
243
- type: 'post',
244
- dataType: 'json',
245
- data: {
246
- action: 'premium_inner_template',
247
- template: innerTemplates[key],
248
- tab: PremiumEditor.getTab(),
249
- withMedia: insertMedia
250
- }
251
- });
252
- }
253
- }
254
-
255
- if ("valid" === PremiumTempsData.license.status || !isPro) {
256
-
257
- elementor.templates.requestTemplateContent(
258
- templateModel.get('source'),
259
- templateModel.get('template_id'), {
260
- data: {
261
- tab: PremiumEditor.getTab(),
262
- page_settings: false,
263
- withMedia: insertMedia
264
- },
265
- success: function (data) {
266
-
267
- if (!data.license) {
268
- PremiumEditor.layout.showLicenseError();
269
- return;
270
- }
271
-
272
- console.log("%c Template Inserted Successfully!!", "color: #7a7a7a; background-color: #eee;");
273
-
274
- PremiumEditor.closeModal();
275
-
276
- elementor.channels.data.trigger('template:before:insert', templateModel);
277
-
278
- if (null !== PremiumEditor.atIndex) {
279
- options.at = PremiumEditor.atIndex;
280
- }
281
-
282
- elementor.previewView.addChildModel(data.content, options);
283
-
284
- elementor.channels.data.trigger('template:after:insert', templateModel);
285
- jQuery("#elementor-panel-saver-button-save-options, #elementor-panel-saver-button-publish").removeClass("elementor-disabled");
286
- PremiumEditor.atIndex = null;
287
-
288
- },
289
- error: function (err) {
290
- console.log(err);
291
- }
292
- }
293
- );
294
- } else {
295
- PremiumEditor.layout.showLicenseError();
296
- }
297
- }
298
- });
299
-
300
- self.ModalHeaderInsertButton = Marionette.ItemView.extend({
301
-
302
- template: '#tmpl-premium-template-modal-insert-button',
303
-
304
- id: 'premium-template-modal-insert-button',
305
-
306
- behaviors: {
307
- insertTemplate: {
308
- behaviorClass: self.ModalInsertTemplateBehavior
309
- }
310
- }
311
-
312
- });
313
-
314
- self.FiltersItemView = Marionette.ItemView.extend({
315
-
316
- template: '#tmpl-premium-template-modal-filters-item',
317
-
318
- className: function () {
319
- return 'premium-template-filter-item';
320
- },
321
-
322
- ui: function () {
323
- return {
324
- filterLabels: '.premium-template-filter-label'
325
- };
326
- },
327
-
328
- events: function () {
329
- return {
330
- 'click @ui.filterLabels': 'onFilterClick'
331
- };
332
- },
333
-
334
- onFilterClick: function (event) {
335
-
336
- var $clickedInput = jQuery(event.target);
337
- jQuery('.premium-library-keywords').val('');
338
- PremiumEditor.setFilter('category', $clickedInput.val());
339
- PremiumEditor.setFilter('keyword', '');
340
- }
341
-
342
- });
343
-
344
- self.ModalTabsItemView = Marionette.ItemView.extend({
345
-
346
- template: '#tmpl-premium-template-modal-tabs-item',
347
-
348
- className: function () {
349
- return 'elementor-template-library-menu-item';
350
- },
351
-
352
- ui: function () {
353
- return {
354
- tabsLabels: 'label',
355
- tabsInput: 'input'
356
- };
357
- },
358
-
359
- events: function () {
360
- return {
361
- 'click @ui.tabsLabels': 'onTabClick'
362
- };
363
- },
364
-
365
- onRender: function () {
366
- if (this.model.get('slug') === PremiumEditor.getTab()) {
367
- this.ui.tabsInput.attr('checked', 'checked');
368
- }
369
- },
370
-
371
- onTabClick: function (event) {
372
-
373
- var $clickedInput = jQuery(event.target);
374
- PremiumEditor.setTab($clickedInput.val());
375
- PremiumEditor.setFilter('keyword', '');
376
- }
377
-
378
- });
379
-
380
- self.FiltersCollectionView = Marionette.CompositeView.extend({
381
-
382
- id: 'premium-template-library-filters',
383
-
384
- template: '#tmpl-premium-template-modal-filters',
385
-
386
- childViewContainer: '#premium-modal-filters-container',
387
-
388
- getChildView: function (childModel) {
389
- return self.FiltersItemView;
390
- }
391
-
392
- });
393
-
394
- self.ModalTabsCollectionView = Marionette.CompositeView.extend({
395
-
396
- template: '#tmpl-premium-template-modal-tabs',
397
-
398
- childViewContainer: '#premium-modal-tabs-items',
399
-
400
- initialize: function () {
401
- this.listenTo(PremiumEditor.channels.layout, 'tamplate:cloned', this._renderChildren);
402
- },
403
-
404
- getChildView: function (childModel) {
405
- return self.ModalTabsItemView;
406
- }
407
-
408
- });
409
-
410
- self.ModalTemplateItemView = Marionette.ItemView.extend({
411
-
412
- template: '#tmpl-premium-template-modal-item',
413
-
414
- className: function () {
415
-
416
- var urlClass = ' premium-template-has-url',
417
- sourceClass = ' elementor-template-library-template-',
418
- proTemplate = '';
419
-
420
- if ('' === this.model.get('preview')) {
421
- urlClass = ' premium-template-no-url';
422
- }
423
-
424
- sourceClass += 'remote';
425
-
426
- if (this.model.get('pro')) {
427
- proTemplate = ' premium-template-pro';
428
- }
429
-
430
- return 'elementor-template-library-template' + sourceClass + urlClass + proTemplate;
431
- },
432
-
433
- ui: function () {
434
- return {
435
- previewButton: '.elementor-template-library-template-preview',
436
- };
437
- },
438
-
439
- events: function () {
440
- return {
441
- 'click @ui.previewButton': 'onPreviewButtonClick',
442
- };
443
- },
444
-
445
- onPreviewButtonClick: function () {
446
-
447
- if ('' === this.model.get('url')) {
448
- return;
449
- }
450
-
451
- PremiumEditor.setPreview(this.model);
452
- },
453
-
454
- behaviors: {
455
- insertTemplate: {
456
- behaviorClass: self.ModalInsertTemplateBehavior
457
- }
458
- }
459
- });
460
-
461
- self.ModalCollectionView = Marionette.CompositeView.extend({
462
-
463
- template: '#tmpl-premium-template-modal-templates',
464
-
465
- id: 'premium-template-library-templates',
466
-
467
- childViewContainer: '#premium-modal-templates-container',
468
-
469
- initialize: function () {
470
-
471
- this.listenTo(PremiumEditor.channels.templates, 'filter:change', this._renderChildren);
472
- },
473
-
474
- filter: function (childModel) {
475
-
476
- var filter = PremiumEditor.getFilter('category'),
477
- keyword = PremiumEditor.getFilter('keyword');
478
-
479
- if (!filter && !keyword) {
480
- return true;
481
- }
482
-
483
- if (keyword && !filter) {
484
- return _.contains(childModel.get('keywords'), keyword);
485
- }
486
-
487
- if (filter && !keyword) {
488
- return _.contains(childModel.get('categories'), filter);
489
- }
490
-
491
- return _.contains(childModel.get('categories'), filter) && _.contains(childModel.get('keywords'), keyword);
492
-
493
- },
494
-
495
- getChildView: function (childModel) {
496
- return self.ModalTemplateItemView;
497
- },
498
-
499
- onRenderCollection: function () {
500
-
501
- var container = this.$childViewContainer,
502
- items = this.$childViewContainer.children(),
503
- tab = PremiumEditor.getTab();
504
-
505
- if ('premium_page' === tab || 'local' === tab) {
506
- return;
507
- }
508
-
509
- // Wait for thumbnails to be loaded
510
- container.imagesLoaded(function () { }).done(function () {
511
- self.masonry.init({
512
- container: container,
513
- items: items
514
- });
515
- });
516
- }
517
-
518
- });
519
-
520
- self.ModalLayoutView = Marionette.LayoutView.extend({
521
-
522
- el: '#premium-template-modal',
523
-
524
- regions: PremiumTempsData.modalRegions,
525
-
526
- initialize: function () {
527
-
528
- this.getRegion('modalHeader').show(new self.ModalHeaderView());
529
- this.listenTo(PremiumEditor.channels.tabs, 'filter:change', this.switchTabs);
530
- this.listenTo(PremiumEditor.channels.layout, 'preview:change', this.switchPreview);
531
-
532
- },
533
-
534
- switchTabs: function () {
535
- this.showLoadingView();
536
- PremiumEditor.setFilter('keyword', '');
537
- PremiumEditor.requestTemplates(PremiumEditor.getTab());
538
- },
539
-
540
- switchPreview: function () {
541
-
542
- var header = this.getHeaderView(),
543
- preview = PremiumEditor.getPreview();
544
-
545
- var filter = PremiumEditor.getFilter('category'),
546
- keyword = PremiumEditor.getFilter('keyword');
547
-
548
- if ('back' === preview) {
549
- header.headerLogo.show(new self.ModalHeaderLogo());
550
- header.headerTabs.show(new self.ModalTabsCollectionView({
551
- collection: PremiumEditor.collections.tabs
552
- }));
553
-
554
- header.headerActions.empty();
555
- PremiumEditor.setTab(PremiumEditor.getTab());
556
-
557
- if ('' != filter) {
558
- PremiumEditor.setFilter('category', filter);
559
- jQuery('#premium-modal-filters-container').find("input[value='" + filter + "']").prop('checked', true);
560
-
561
- }
562
-
563
- if ('' != keyword) {
564
- PremiumEditor.setFilter('keyword', keyword);
565
- }
566
-
567
- return;
568
- }
569
-
570
- if ('initial' === preview) {
571
- header.headerActions.empty();
572
- header.headerLogo.show(new self.ModalHeaderLogo());
573
- return;
574
- }
575
-
576
- this.getRegion('modalContent').show(new self.ModalPreviewView({
577
- 'preview': preview.get('preview'),
578
- 'url': preview.get('url'),
579
- 'notice': preview.get('notice')
580
- }));
581
-
582
- header.headerLogo.empty();
583
- header.headerTabs.show(new self.ModalHeaderBack());
584
- header.headerActions.show(new self.ModalHeaderInsertButton({
585
- model: preview
586
- }));
587
-
588
- },
589
-
590
- getHeaderView: function () {
591
- return this.getRegion('modalHeader').currentView;
592
- },
593
-
594
- getContentView: function () {
595
- return this.getRegion('modalContent').currentView;
596
- },
597
-
598
- showLoadingView: function () {
599
- this.modalContent.show(new self.ModalLoadingView());
600
- },
601
-
602
- showLicenseError: function () {
603
- this.modalContent.show(new self.ModalErrorView());
604
- },
605
-
606
- showTemplatesView: function (templatesCollection, categoriesCollection, keywords) {
607
-
608
- this.getRegion('modalContent').show(new self.ModalBodyView());
609
-
610
- var contentView = this.getContentView(),
611
- header = this.getHeaderView(),
612
- keywordsModel = new self.KeywordsModel({
613
- keywords: keywords
614
- });
615
-
616
- PremiumEditor.collections.tabs = new self.ModalTabsCollection(PremiumEditor.getTabs());
617
-
618
- header.headerTabs.show(new self.ModalTabsCollectionView({
619
- collection: PremiumEditor.collections.tabs
620
- }));
621
-
622
- contentView.contentTemplates.show(new self.ModalCollectionView({
623
- collection: templatesCollection
624
- }));
625
-
626
- contentView.contentFilters.show(new self.FiltersCollectionView({
627
- collection: categoriesCollection
628
- }));
629
-
630
- contentView.contentKeywords.show(new self.KeywordsView({
631
- model: keywordsModel
632
- }));
633
-
634
- }
635
-
636
- });
637
-
638
- self.ModalLoadingView = Marionette.ItemView.extend({
639
- id: 'premium-template-modal-loading',
640
- template: '#tmpl-premium-template-modal-loading'
641
- });
642
-
643
- self.ModalErrorView = Marionette.ItemView.extend({
644
- id: 'premium-template-modal-loading',
645
- template: '#tmpl-premium-template-modal-error'
646
- });
647
-
648
- },
649
-
650
- masonry: {
651
-
652
- self: {},
653
- elements: {},
654
-
655
- init: function (settings) {
656
-
657
- var self = this;
658
- self.settings = $.extend(self.getDefaultSettings(), settings);
659
- self.elements = self.getDefaultElements();
660
-
661
- self.run();
662
- },
663
-
664
- getSettings: function (key) {
665
- if (key) {
666
- return this.settings[key];
667
- } else {
668
- return this.settings;
669
- }
670
- },
671
-
672
- getDefaultSettings: function () {
673
- return {
674
- container: null,
675
- items: null,
676
- columnsCount: 3,
677
- verticalSpaceBetween: 30
678
- };
679
- },
680
-
681
- getDefaultElements: function () {
682
- return {
683
- $container: jQuery(this.getSettings('container')),
684
- $items: jQuery(this.getSettings('items'))
685
- };
686
- },
687
-
688
- run: function () {
689
- var heights = [],
690
- distanceFromTop = this.elements.$container.position().top,
691
- settings = this.getSettings(),
692
- columnsCount = settings.columnsCount;
693
-
694
- distanceFromTop += parseInt(this.elements.$container.css('margin-top'), 10);
695
-
696
- this.elements.$container.height('');
697
-
698
- this.elements.$items.each(function (index) {
699
- var row = Math.floor(index / columnsCount),
700
- indexAtRow = index % columnsCount,
701
- $item = jQuery(this),
702
- itemPosition = $item.position(),
703
- itemHeight = $item[0].getBoundingClientRect().height + settings.verticalSpaceBetween;
704
-
705
- if (row) {
706
- var pullHeight = itemPosition.top - distanceFromTop - heights[indexAtRow];
707
- pullHeight -= parseInt($item.css('margin-top'), 10);
708
- pullHeight *= -1;
709
- $item.css('margin-top', pullHeight + 'px');
710
- heights[indexAtRow] += itemHeight;
711
- } else {
712
- heights.push(itemHeight);
713
- }
714
- });
715
-
716
- this.elements.$container.height(Math.max.apply(Math, heights));
717
- }
718
- }
719
-
720
- };
721
-
722
- PremiumControlsViews = {
723
-
724
- PremiumSearchView: null,
725
-
726
- init: function () {
727
-
728
- var self = this;
729
-
730
- self.PremiumSearchView = window.elementor.modules.controls.BaseData.extend({
731
-
732
- onReady: function () {
733
-
734
- var action = this.model.attributes.action,
735
- queryParams = this.model.attributes.query_params;
736
-
737
- this.ui.select.find('option').each(function (index, el) {
738
- $(this).attr('selected', true);
739
- });
740
-
741
- this.ui.select.select2({
742
- ajax: {
743
- url: function () {
744
-
745
- var query = '';
746
-
747
- if (queryParams.length > 0) {
748
- $.each(queryParams, function (index, param) {
749
-
750
- if (window.elementor.settings.page.model.attributes[param]) {
751
- query += '&' + param + '=' + window.elementor.settings.page.model.attributes[param];
752
- }
753
- });
754
- }
755
-
756
- return ajaxurl + '?action=' + action + query;
757
- },
758
- dataType: 'json'
759
- },
760
- placeholder: 'Please enter 3 or more characters',
761
- minimumInputLength: 3
762
- });
763
-
764
- },
765
-
766
- onBeforeDestroy: function () {
767
-
768
- if (this.ui.select.data('select2')) {
769
- this.ui.select.select2('destroy');
770
- }
771
-
772
- this.$el.remove();
773
- }
774
-
775
- });
776
-
777
- window.elementor.addControlView('premium_search', self.PremiumSearchView);
778
-
779
- }
780
-
781
- };
782
-
783
-
784
- PremiumModules = {
785
-
786
- getDataToSave: function (data) {
787
- data.id = window.elementor.config.post_id;
788
- return data;
789
- },
790
-
791
- init: function () {
792
- if (window.elementor.settings.premium_template) {
793
- window.elementor.settings.premium_template.getDataToSave = this.getDataToSave;
794
- }
795
-
796
- if (window.elementor.settings.premium_page) {
797
- window.elementor.settings.premium_page.getDataToSave = this.getDataToSave;
798
- window.elementor.settings.premium_page.changeCallbacks = {
799
- custom_header: function () {
800
- this.save(function () {
801
- elementor.reloadPreview();
802
-
803
- elementor.once('preview:loaded', function () {
804
- elementor.getPanelView().setPage('premium_page_settings');
805
- });
806
- });
807
- },
808
- custom_footer: function () {
809
- this.save(function () {
810
- elementor.reloadPreview();
811
-
812
- elementor.once('preview:loaded', function () {
813
- elementor.getPanelView().setPage('premium_page_settings');
814
- });
815
- });
816
- }
817
- };
818
- }
819
-
820
- }
821
-
822
- };
823
-
824
- PremiumEditor = {
825
-
826
- modal: false,
827
- layout: false,
828
- collections: {},
829
- tabs: {},
830
- defaultTab: '',
831
- channels: {},
832
- atIndex: null,
833
-
834
- init: function () {
835
-
836
- $(document).ready(function () {
837
- PremiumEditor.initPremTempsButton();
838
- });
839
-
840
- window.elementor.on(
841
- 'document:loaded',
842
- window._.bind(PremiumEditor.onPreviewLoaded, PremiumEditor)
843
- );
844
-
845
- PremiumEditorViews.init();
846
- PremiumControlsViews.init();
847
- PremiumModules.init();
848
-
849
- },
850
-
851
- onPreviewLoaded: function () {
852
-
853
- window.elementor.$previewContents.on(
854
- 'click.addPremiumTemplate',
855
- '.pa-add-section-btn',
856
- _.bind(this.showTemplatesModal, this)
857
- );
858
-
859
- this.channels = {
860
- templates: Backbone.Radio.channel('PREMIUM_EDITOR:templates'),
861
- tabs: Backbone.Radio.channel('PREMIUM_EDITOR:tabs'),
862
- layout: Backbone.Radio.channel('PREMIUM_EDITOR:layout'),
863
- };
864
-
865
- this.tabs = PremiumTempsData.tabs;
866
- this.defaultTab = PremiumTempsData.defaultTab;
867
-
868
- },
869
-
870
- initPremTempsButton: function () {
871
-
872
- var addPremiumTemplate = '<div class="elementor-add-section-area-button pa-add-section-btn" title="Add Premium Template"><i class="eicon-star"></i></div>',
873
- addSectionTmpl = $("#tmpl-elementor-add-section");
874
-
875
- if (addSectionTmpl.length < 1)
876
- return;
877
-
878
- var addSectionTmplHTML = addSectionTmpl.html();
879
-
880
- addSectionTmplHTML = addSectionTmplHTML.replace('<div class="elementor-add-section-area-button', addPremiumTemplate + '<div class="elementor-add-section-area-button');
881
-
882
- addSectionTmpl.html(addSectionTmplHTML);
883
-
884
- // if ($addNewSection.length && PremiumTempsData.PremiumTemplatesBtn) {
885
- // $addPremiumTemplate = $(addPremiumTemplate).prependTo($addNewSection);
886
- // }
887
-
888
-
889
- // window.elementor.$previewContents.on(
890
- // 'click.addPremiumTemplate',
891
- // '.elementor-editor-section-settings .elementor-editor-element-add',
892
- // function () {
893
-
894
- // var $this = $(this),
895
- // $section = $this.closest('.elementor-top-section'),
896
- // modelID = $section.data('model-cid');
897
-
898
- // if (elementor.previewView.collection.length) {
899
- // $.each(elementor.previewView.collection.models, function (index, model) {
900
- // if (modelID === model.cid) {
901
- // PremiumEditor.atIndex = index;
902
- // }
903
- // });
904
- // }
905
-
906
- // if (PremiumTempsData.PremiumTemplatesBtn) {
907
- // setTimeout(function () {
908
- // var $addNew = $section.prev('.elementor-add-section').find('.elementor-add-new-section');
909
- // $addNew.prepend(addPremiumTemplate);
910
- // }, 100);
911
- // }
912
-
913
- // }
914
- // );
915
-
916
- },
917
-
918
- getFilter: function (name) {
919
-
920
- return this.channels.templates.request('filter:' + name);
921
- },
922
-
923
- setFilter: function (name, value) {
924
- this.channels.templates.reply('filter:' + name, value);
925
- this.channels.templates.trigger('filter:change');
926
- },
927
-
928
- getTab: function () {
929
- return this.channels.tabs.request('filter:tabs');
930
- },
931
-
932
- setTab: function (value, silent) {
933
-
934
- this.channels.tabs.reply('filter:tabs', value);
935
-
936
- if (!silent) {
937
- this.channels.tabs.trigger('filter:change');
938
- }
939
-
940
- },
941
-
942
- getTabs: function () {
943
-
944
- var tabs = [];
945
-
946
- _.each(this.tabs, function (item, slug) {
947
- tabs.push({
948
- slug: slug,
949
- title: item.title
950
- });
951
- });
952
-
953
- return tabs;
954
- },
955
-
956
- getPreview: function (name) {
957
- return this.channels.layout.request('preview');
958
- },
959
-
960
- setPreview: function (value, silent) {
961
-
962
- this.channels.layout.reply('preview', value);
963
-
964
- if (!silent) {
965
- this.channels.layout.trigger('preview:change');
966
- }
967
- },
968
-
969
- getKeywords: function () {
970
-
971
- var keywords = [];
972
-
973
- _.each(this.keywords, function (title, slug) {
974
- tabs.push({
975
- slug: slug,
976
- title: title
977
- });
978
- });
979
-
980
- return keywords;
981
- },
982
-
983
- showTemplatesModal: function () {
984
-
985
- this.getModal().show();
986
-
987
- if (!this.layout) {
988
- this.layout = new PremiumEditorViews.ModalLayoutView();
989
- this.layout.showLoadingView();
990
- }
991
-
992
- this.setTab(this.defaultTab, true);
993
- this.requestTemplates(this.defaultTab);
994
- this.setPreview('initial');
995
-
996
- },
997
-
998
- requestTemplates: function (tabName) {
999
-
1000
- var self = this,
1001
- tab = self.tabs[tabName];
1002
-
1003
- self.setFilter('category', false);
1004
-
1005
- if (tab.data.templates && tab.data.categories) {
1006
- self.layout.showTemplatesView(tab.data.templates, tab.data.categories, tab.data.keywords);
1007
- } else {
1008
- $.ajax({
1009
- url: ajaxurl,
1010
- type: 'get',
1011
- dataType: 'json',
1012
- data: {
1013
- action: 'premium_get_templates',
1014
- tab: tabName
1015
- },
1016
- success: function (response) {
1017
-
1018
- console.log("% cTemplates Retrieved Successfully!!", "color: #7a7a7a; background - color: #eee; ");
1019
-
1020
- var templates = new PremiumEditorViews.LibraryCollection(response.data.templates),
1021
- categories = new PremiumEditorViews.CategoriesCollection(response.data.categories);
1022
-
1023
- self.tabs[tabName].data = {
1024
- templates: templates,
1025
- categories: categories,
1026
- keywords: response.data.keywords
1027
- };
1028
-
1029
- self.layout.showTemplatesView(templates, categories, response.data.keywords);
1030
-
1031
- },
1032
- error: function (err) {
1033
- console.log(err);
1034
- }
1035
- });
1036
- }
1037
-
1038
- },
1039
-
1040
- closeModal: function () {
1041
- this.getModal().hide();
1042
- },
1043
-
1044
- getModal: function () {
1045
-
1046
- if (!this.modal) {
1047
- this.modal = elementor.dialogsManager.createWidget('lightbox', {
1048
- id: 'premium-template-modal',
1049
- className: 'elementor-templates-modal',
1050
- closeButton: false
1051
- });
1052
- }
1053
-
1054
- return this.modal;
1055
-
1056
- }
1057
-
1058
- };
1059
-
1060
- $(window).on('elementor:init', PremiumEditor.init);
1061
-
1062
  })(jQuery);
1
+ (function ($) {
2
+
3
+ 'use strict';
4
+
5
+ var PremiumTempsData = window.PremiumTempsData || {},
6
+ PremiumEditor,
7
+ PremiumEditorViews,
8
+ PremiumControlsViews,
9
+ PremiumModules;
10
+
11
+ PremiumEditorViews = {
12
+
13
+ ModalLayoutView: null,
14
+ ModalHeaderView: null,
15
+ ModalHeaderInsertButton: null,
16
+ ModalLoadingView: null,
17
+ ModalBodyView: null,
18
+ ModalErrorView: null,
19
+ LibraryCollection: null,
20
+ KeywordsModel: null,
21
+ ModalCollectionView: null,
22
+ ModalTabsCollection: null,
23
+ ModalTabsCollectionView: null,
24
+ FiltersCollectionView: null,
25
+ FiltersItemView: null,
26
+ ModalTabsItemView: null,
27
+ ModalTemplateItemView: null,
28
+ ModalInsertTemplateBehavior: null,
29
+ ModalTemplateModel: null,
30
+ CategoriesCollection: null,
31
+ ModalPreviewView: null,
32
+ ModalHeaderBack: null,
33
+ ModalHeaderLogo: null,
34
+ KeywordsView: null,
35
+ TabModel: null,
36
+ CategoryModel: null,
37
+
38
+ init: function () {
39
+ var self = this;
40
+
41
+ self.ModalTemplateModel = Backbone.Model.extend({
42
+ defaults: {
43
+ template_id: 0,
44
+ name: '',
45
+ title: '',
46
+ thumbnail: '',
47
+ preview: '',
48
+ source: '',
49
+ categories: [],
50
+ keywords: []
51
+ }
52
+ });
53
+
54
+ self.ModalHeaderView = Marionette.LayoutView.extend({
55
+
56
+ id: 'premium-template-modal-header',
57
+ template: '#tmpl-premium-template-modal-header',
58
+
59
+ ui: {
60
+ closeModal: '#premium-template-modal-header-close-modal'
61
+ },
62
+
63
+ events: {
64
+ 'click @ui.closeModal': 'onCloseModalClick'
65
+ },
66
+
67
+ regions: {
68
+ headerLogo: '#premium-template-modal-header-logo-area',
69
+ headerTabs: '#premium-template-modal-header-tabs',
70
+ headerActions: '#premium-template-modal-header-actions'
71
+ },
72
+
73
+ onCloseModalClick: function () {
74
+ PremiumEditor.closeModal();
75
+ }
76
+
77
+ });
78
+
79
+ self.TabModel = Backbone.Model.extend({
80
+ defaults: {
81
+ slug: '',
82
+ title: ''
83
+ }
84
+ });
85
+
86
+ self.LibraryCollection = Backbone.Collection.extend({
87
+ model: self.ModalTemplateModel
88
+ });
89
+
90
+ self.ModalTabsCollection = Backbone.Collection.extend({
91
+ model: self.TabModel
92
+ });
93
+
94
+ self.CategoryModel = Backbone.Model.extend({
95
+ defaults: {
96
+ slug: '',
97
+ title: ''
98
+ }
99
+ });
100
+
101
+ self.KeywordsModel = Backbone.Model.extend({
102
+ defaults: {
103
+ keywords: {}
104
+ }
105
+ });
106
+
107
+ self.CategoriesCollection = Backbone.Collection.extend({
108
+ model: self.CategoryModel
109
+ });
110
+
111
+ self.KeywordsView = Marionette.ItemView.extend({
112
+ id: 'elementor-template-library-filter',
113
+ template: '#tmpl-premium-template-modal-keywords',
114
+ ui: {
115
+ keywords: '.premium-library-keywords'
116
+ },
117
+
118
+ events: {
119
+ 'change @ui.keywords': 'onSelectKeyword'
120
+ },
121
+
122
+ onSelectKeyword: function (event) {
123
+ var selected = event.currentTarget.selectedOptions[0].value;
124
+ PremiumEditor.setFilter('keyword', selected);
125
+ },
126
+
127
+ onRender: function () {
128
+ var $filters = this.$('.premium-library-keywords');
129
+ $filters.select2({
130
+ placeholder: 'Choose Widget',
131
+ allowClear: true,
132
+ width: 250,
133
+ dropdownParent: this.$el
134
+ });
135
+ }
136
+ });
137
+
138
+ self.ModalPreviewView = Marionette.ItemView.extend({
139
+
140
+ template: '#tmpl-premium-template-modal-preview',
141
+
142
+ id: 'premium-templatate-item-preview-wrap',
143
+
144
+ ui: {
145
+ iframe: 'iframe',
146
+ notice: '.premium-template-item-notice'
147
+ },
148
+
149
+
150
+ onRender: function () {
151
+
152
+ if (null !== this.getOption('notice')) {
153
+ if (this.getOption('notice').length) {
154
+ var message = "";
155
+ if (-1 !== this.getOption('notice').indexOf("facebook")) {
156
+ message += "<p>Please login with your Facebook account in order to get your Facebook Reviews.</p>";
157
+ } else if (-1 !== this.getOption('notice').indexOf("google")) {
158
+ message += "<p>You need to add your Google API key from Dashboard -> Premium Add-ons for Elementor -> Google Maps</p>";
159
+ } else if (-1 !== this.getOption('notice').indexOf("form")) {
160
+ message += "<p>You need to have <a href='https://wordpress.org/plugins/contact-form-7/' target='_blank'>Contact Form 7 plugin</a> installed and active.</p>";
161
+ }
162
+
163
+ this.ui.notice.html('<div><p><strong>Important!</strong></p>' + message + '</div>');
164
+ }
165
+ }
166
+
167
+ this.ui.iframe.attr('src', this.getOption('url'));
168
+
169
+ }
170
+ });
171
+
172
+ self.ModalHeaderBack = Marionette.ItemView.extend({
173
+
174
+ template: '#tmpl-premium-template-modal-header-back',
175
+
176
+ id: 'premium-template-modal-header-back',
177
+
178
+ ui: {
179
+ button: 'button'
180
+ },
181
+
182
+ events: {
183
+ 'click @ui.button': 'onBackClick',
184
+ },
185
+
186
+ onBackClick: function () {
187
+ PremiumEditor.setPreview('back');
188
+ }
189
+
190
+ });
191
+
192
+ self.ModalHeaderLogo = Marionette.ItemView.extend({
193
+
194
+ template: '#tmpl-premium-template-modal-header-logo',
195
+
196
+ id: 'premium-template-modal-header-logo'
197
+
198
+ });
199
+
200
+ self.ModalBodyView = Marionette.LayoutView.extend({
201
+
202
+ id: 'premium-template-library-content',
203
+
204
+ className: function () {
205
+ return 'library-tab-' + PremiumEditor.getTab();
206
+ },
207
+
208
+ template: '#tmpl-premium-template-modal-content',
209
+
210
+ regions: {
211
+ contentTemplates: '.premium-templates-list',
212
+ contentFilters: '.premium-filters-list',
213
+ contentKeywords: '.premium-keywords-list'
214
+ }
215
+
216
+ });
217
+
218
+ self.ModalInsertTemplateBehavior = Marionette.Behavior.extend({
219
+ ui: {
220
+ insertButtons: ['.premium-template-insert', '.premium-template-insert-no-media'],
221
+ },
222
+
223
+ events: {
224
+ 'click @ui.insertButtons': 'onInsertButtonClick'
225
+ },
226
+
227
+ onInsertButtonClick: function (event) {
228
+
229
+ var templateModel = this.view.model,
230
+ innerTemplates = templateModel.attributes.dependencies,
231
+ isPro = templateModel.attributes.pro,
232
+ innerTemplatesLength = Object.keys(innerTemplates).length,
233
+ options = {},
234
+ insertMedia = !$(event.currentTarget).hasClass("premium-template-insert-no-media");
235
+
236
+ // console.log(insertMedia);
237
+
238
+ PremiumEditor.layout.showLoadingView();
239
+ if (innerTemplatesLength > 0) {
240
+ for (var key in innerTemplates) {
241
+ $.ajax({
242
+ url: ajaxurl,
243
+ type: 'post',
244
+ dataType: 'json',
245
+ data: {
246
+ action: 'premium_inner_template',
247
+ template: innerTemplates[key],
248
+ tab: PremiumEditor.getTab(),
249
+ withMedia: insertMedia
250
+ }
251
+ });
252
+ }
253
+ }
254
+
255
+ if ("valid" === PremiumTempsData.license.status || !isPro) {
256
+
257
+ elementor.templates.requestTemplateContent(
258
+ templateModel.get('source'),
259
+ templateModel.get('template_id'), {
260
+ data: {
261
+ tab: PremiumEditor.getTab(),
262
+ page_settings: false,
263
+ withMedia: insertMedia
264
+ },
265
+ success: function (data) {
266
+
267
+ if (!data.license) {
268
+ PremiumEditor.layout.showLicenseError();
269
+ return;
270
+ }
271
+
272
+ console.log("%c Template Inserted Successfully!!", "color: #7a7a7a; background-color: #eee;");
273
+
274
+ PremiumEditor.closeModal();
275
+
276
+ elementor.channels.data.trigger('template:before:insert', templateModel);
277
+
278
+ if (null !== PremiumEditor.atIndex) {
279
+ options.at = PremiumEditor.atIndex;
280
+ }
281
+
282
+ elementor.previewView.addChildModel(data.content, options);
283
+
284
+ elementor.channels.data.trigger('template:after:insert', templateModel);
285
+ jQuery("#elementor-panel-saver-button-save-options, #elementor-panel-saver-button-publish").removeClass("elementor-disabled");
286
+ PremiumEditor.atIndex = null;
287
+
288
+ },
289
+ error: function (err) {
290
+ console.log(err);
291
+ }
292
+ }
293
+ );
294
+ } else {
295
+ PremiumEditor.layout.showLicenseError();
296
+ }
297
+ }
298
+ });
299
+
300
+ self.ModalHeaderInsertButton = Marionette.ItemView.extend({
301
+
302
+ template: '#tmpl-premium-template-modal-insert-button',
303
+
304
+ id: 'premium-template-modal-insert-button',
305
+
306
+ behaviors: {
307
+ insertTemplate: {
308
+ behaviorClass: self.ModalInsertTemplateBehavior
309
+ }
310
+ }
311
+
312
+ });
313
+
314
+ self.FiltersItemView = Marionette.ItemView.extend({
315
+
316
+ template: '#tmpl-premium-template-modal-filters-item',
317
+
318
+ className: function () {
319
+ return 'premium-template-filter-item';
320
+ },
321
+
322
+ ui: function () {
323
+ return {
324
+ filterLabels: '.premium-template-filter-label'
325
+ };
326
+ },
327
+
328
+ events: function () {
329
+ return {
330
+ 'click @ui.filterLabels': 'onFilterClick'
331
+ };
332
+ },
333
+
334
+ onFilterClick: function (event) {
335
+
336
+ var $clickedInput = jQuery(event.target);
337
+ jQuery('.premium-library-keywords').val('');
338
+ PremiumEditor.setFilter('category', $clickedInput.val());
339
+ PremiumEditor.setFilter('keyword', '');
340
+ }
341
+
342
+ });
343
+
344
+ self.ModalTabsItemView = Marionette.ItemView.extend({
345
+
346
+ template: '#tmpl-premium-template-modal-tabs-item',
347
+
348
+ className: function () {
349
+ return 'elementor-template-library-menu-item';
350
+ },
351
+
352
+ ui: function () {
353
+ return {
354
+ tabsLabels: 'label',
355
+ tabsInput: 'input'
356
+ };
357
+ },
358
+
359
+ events: function () {
360
+ return {
361
+ 'click @ui.tabsLabels': 'onTabClick'
362
+ };
363
+ },
364
+
365
+ onRender: function () {
366
+ if (this.model.get('slug') === PremiumEditor.getTab()) {
367
+ this.ui.tabsInput.attr('checked', 'checked');
368
+ }
369
+ },
370
+
371
+ onTabClick: function (event) {
372
+
373
+ var $clickedInput = jQuery(event.target);
374
+ PremiumEditor.setTab($clickedInput.val());
375
+ PremiumEditor.setFilter('keyword', '');
376
+ }
377
+
378
+ });
379
+
380
+ self.FiltersCollectionView = Marionette.CompositeView.extend({
381
+
382
+ id: 'premium-template-library-filters',
383
+
384
+ template: '#tmpl-premium-template-modal-filters',
385
+
386
+ childViewContainer: '#premium-modal-filters-container',
387
+
388
+ getChildView: function (childModel) {
389
+ return self.FiltersItemView;
390
+ }
391
+
392
+ });
393
+
394
+ self.ModalTabsCollectionView = Marionette.CompositeView.extend({
395
+
396
+ template: '#tmpl-premium-template-modal-tabs',
397
+
398
+ childViewContainer: '#premium-modal-tabs-items',
399
+
400
+ initialize: function () {
401
+ this.listenTo(PremiumEditor.channels.layout, 'tamplate:cloned', this._renderChildren);
402
+ },
403
+
404
+ getChildView: function (childModel) {
405
+ return self.ModalTabsItemView;
406
+ }
407
+
408
+ });
409
+
410
+ self.ModalTemplateItemView = Marionette.ItemView.extend({
411
+
412
+ template: '#tmpl-premium-template-modal-item',
413
+
414
+ className: function () {
415
+
416
+ var urlClass = ' premium-template-has-url',
417
+ sourceClass = ' elementor-template-library-template-',
418
+ proTemplate = '';
419
+
420
+ if ('' === this.model.get('preview')) {
421
+ urlClass = ' premium-template-no-url';
422
+ }
423
+
424
+ sourceClass += 'remote';
425
+
426
+ if (this.model.get('pro')) {
427
+ proTemplate = ' premium-template-pro';
428
+ }
429
+
430
+ return 'elementor-template-library-template' + sourceClass + urlClass + proTemplate;
431
+ },
432
+
433
+ ui: function () {
434
+ return {
435
+ previewButton: '.elementor-template-library-template-preview',
436
+ };
437
+ },
438
+
439
+ events: function () {
440
+ return {
441
+ 'click @ui.previewButton': 'onPreviewButtonClick',
442
+ };
443
+ },
444
+
445
+ onPreviewButtonClick: function () {
446
+
447
+ if ('' === this.model.get('url')) {
448
+ return;
449
+ }
450
+
451
+ PremiumEditor.setPreview(this.model);
452
+ },
453
+
454
+ behaviors: {
455
+ insertTemplate: {
456
+ behaviorClass: self.ModalInsertTemplateBehavior
457
+ }
458
+ }
459
+ });
460
+
461
+ self.ModalCollectionView = Marionette.CompositeView.extend({
462
+
463
+ template: '#tmpl-premium-template-modal-templates',
464
+
465
+ id: 'premium-template-library-templates',
466
+
467
+ childViewContainer: '#premium-modal-templates-container',
468
+
469
+ initialize: function () {
470
+
471
+ this.listenTo(PremiumEditor.channels.templates, 'filter:change', this._renderChildren);
472
+ },
473
+
474
+ filter: function (childModel) {
475
+
476
+ var filter = PremiumEditor.getFilter('category'),
477
+ keyword = PremiumEditor.getFilter('keyword');
478
+
479
+ if (!filter && !keyword) {
480
+ return true;
481
+ }
482
+
483
+ if (keyword && !filter) {
484
+ return _.contains(childModel.get('keywords'), keyword);
485
+ }
486
+
487
+ if (filter && !keyword) {
488
+ return _.contains(childModel.get('categories'), filter);
489
+ }
490
+
491
+ return _.contains(childModel.get('categories'), filter) && _.contains(childModel.get('keywords'), keyword);
492
+
493
+ },
494
+
495
+ getChildView: function (childModel) {
496
+ return self.ModalTemplateItemView;
497
+ },
498
+
499
+ onRenderCollection: function () {
500
+
501
+ var container = this.$childViewContainer,
502
+ items = this.$childViewContainer.children(),
503
+ tab = PremiumEditor.getTab();
504
+
505
+ if ('premium_page' === tab || 'local' === tab) {
506
+ return;
507
+ }
508
+
509
+ // Wait for thumbnails to be loaded
510
+ container.imagesLoaded(function () { }).done(function () {
511
+ self.masonry.init({
512
+ container: container,
513
+ items: items
514
+ });
515
+ });
516
+ }
517
+
518
+ });
519
+
520
+ self.ModalLayoutView = Marionette.LayoutView.extend({
521
+
522
+ el: '#premium-template-modal',
523
+
524
+ regions: PremiumTempsData.modalRegions,
525
+
526
+ initialize: function () {
527
+
528
+ this.getRegion('modalHeader').show(new self.ModalHeaderView());
529
+ this.listenTo(PremiumEditor.channels.tabs, 'filter:change', this.switchTabs);
530
+ this.listenTo(PremiumEditor.channels.layout, 'preview:change', this.switchPreview);
531
+
532
+ },
533
+
534
+ switchTabs: function () {
535
+ this.showLoadingView();
536
+ PremiumEditor.setFilter('keyword', '');
537
+ PremiumEditor.requestTemplates(PremiumEditor.getTab());
538
+ },
539
+
540
+ switchPreview: function () {
541
+
542
+ var header = this.getHeaderView(),
543
+ preview = PremiumEditor.getPreview();
544
+
545
+ var filter = PremiumEditor.getFilter('category'),
546
+ keyword = PremiumEditor.getFilter('keyword');
547
+
548
+ if ('back' === preview) {
549
+ header.headerLogo.show(new self.ModalHeaderLogo());
550
+ header.headerTabs.show(new self.ModalTabsCollectionView({
551
+ collection: PremiumEditor.collections.tabs
552
+ }));
553
+
554
+ header.headerActions.empty();
555
+ PremiumEditor.setTab(PremiumEditor.getTab());
556
+
557
+ if ('' != filter) {
558
+ PremiumEditor.setFilter('category', filter);
559
+ jQuery('#premium-modal-filters-container').find("input[value='" + filter + "']").prop('checked', true);
560
+
561
+ }
562
+
563
+ if ('' != keyword) {
564
+ PremiumEditor.setFilter('keyword', keyword);
565
+ }
566
+
567
+ return;
568
+ }
569
+
570
+ if ('initial' === preview) {
571
+ header.headerActions.empty();
572
+ header.headerLogo.show(new self.ModalHeaderLogo());
573
+ return;
574
+ }
575
+
576
+ this.getRegion('modalContent').show(new self.ModalPreviewView({
577
+ 'preview': preview.get('preview'),
578
+ 'url': preview.get('url'),
579
+ 'notice': preview.get('notice')
580
+ }));
581
+
582
+ header.headerLogo.empty();
583
+ header.headerTabs.show(new self.ModalHeaderBack());
584
+ header.headerActions.show(new self.ModalHeaderInsertButton({
585
+ model: preview
586
+ }));
587
+
588
+ },
589
+
590
+ getHeaderView: function () {
591
+ return this.getRegion('modalHeader').currentView;
592
+ },
593
+
594
+ getContentView: function () {
595
+ return this.getRegion('modalContent').currentView;
596
+ },
597
+
598
+ showLoadingView: function () {
599
+ this.modalContent.show(new self.ModalLoadingView());
600
+ },
601
+
602
+ showLicenseError: function () {
603
+ this.modalContent.show(new self.ModalErrorView());
604
+ },
605
+
606
+ showTemplatesView: function (templatesCollection, categoriesCollection, keywords) {
607
+
608
+ this.getRegion('modalContent').show(new self.ModalBodyView());
609
+
610
+ var contentView = this.getContentView(),
611
+ header = this.getHeaderView(),
612
+ keywordsModel = new self.KeywordsModel({
613
+ keywords: keywords
614
+ });
615
+
616
+ PremiumEditor.collections.tabs = new self.ModalTabsCollection(PremiumEditor.getTabs());
617
+
618
+ header.headerTabs.show(new self.ModalTabsCollectionView({
619
+ collection: PremiumEditor.collections.tabs
620
+ }));
621
+
622
+ contentView.contentTemplates.show(new self.ModalCollectionView({
623
+ collection: templatesCollection
624
+ }));
625
+
626
+ contentView.contentFilters.show(new self.FiltersCollectionView({
627
+ collection: categoriesCollection
628
+ }));
629
+
630
+ contentView.contentKeywords.show(new self.KeywordsView({
631
+ model: keywordsModel
632
+ }));
633
+
634
+ }
635
+
636
+ });
637
+
638
+ self.ModalLoadingView = Marionette.ItemView.extend({
639
+ id: 'premium-template-modal-loading',
640
+ template: '#tmpl-premium-template-modal-loading'
641
+ });
642
+
643
+ self.ModalErrorView = Marionette.ItemView.extend({
644
+ id: 'premium-template-modal-loading',
645
+ template: '#tmpl-premium-template-modal-error'
646
+ });
647
+
648
+ },
649
+
650
+ masonry: {
651
+
652
+ self: {},
653
+ elements: {},
654
+
655
+ init: function (settings) {
656
+
657
+ var self = this;
658
+ self.settings = $.extend(self.getDefaultSettings(), settings);
659
+ self.elements = self.getDefaultElements();
660
+
661
+ self.run();
662
+ },
663
+
664
+ getSettings: function (key) {
665
+ if (key) {
666
+ return this.settings[key];
667
+ } else {
668
+ return this.settings;
669
+ }
670
+ },
671
+
672
+ getDefaultSettings: function () {
673
+ return {
674
+ container: null,
675
+ items: null,
676
+ columnsCount: 3,
677
+ verticalSpaceBetween: 30
678
+ };
679
+ },
680
+
681
+ getDefaultElements: function () {
682
+ return {
683
+ $container: jQuery(this.getSettings('container')),
684
+ $items: jQuery(this.getSettings('items'))
685
+ };
686
+ },
687
+
688
+ run: function () {
689
+ var heights = [],
690
+ distanceFromTop = this.elements.$container.position().top,
691
+ settings = this.getSettings(),
692
+ columnsCount = settings.columnsCount;
693
+
694
+ distanceFromTop += parseInt(this.elements.$container.css('margin-top'), 10);
695
+
696
+ this.elements.$container.height('');
697
+
698
+ this.elements.$items.each(function (index) {
699
+ var row = Math.floor(index / columnsCount),
700
+ indexAtRow = index % columnsCount,
701
+ $item = jQuery(this),
702
+ itemPosition = $item.position(),
703
+ itemHeight = $item[0].getBoundingClientRect().height + settings.verticalSpaceBetween;
704
+
705
+ if (row) {
706
+ var pullHeight = itemPosition.top - distanceFromTop - heights[indexAtRow];
707
+ pullHeight -= parseInt($item.css('margin-top'), 10);
708
+ pullHeight *= -1;
709
+ $item.css('margin-top', pullHeight + 'px');
710
+ heights[indexAtRow] += itemHeight;
711
+ } else {
712
+ heights.push(itemHeight);
713
+ }
714
+ });
715
+
716
+ this.elements.$container.height(Math.max.apply(Math, heights));
717
+ }
718
+ }
719
+
720
+ };
721
+
722
+ PremiumControlsViews = {
723
+
724
+ PremiumSearchView: null,
725
+
726
+ init: function () {
727
+
728
+ var self = this;
729
+
730
+ self.PremiumSearchView = window.elementor.modules.controls.BaseData.extend({
731
+
732
+ onReady: function () {
733
+
734
+ var action = this.model.attributes.action,
735
+ queryParams = this.model.attributes.query_params;
736
+
737
+ this.ui.select.find('option').each(function (index, el) {
738
+ $(this).attr('selected', true);
739
+ });
740
+
741
+ this.ui.select.select2({
742
+ ajax: {
743
+ url: function () {
744
+
745
+ var query = '';
746
+
747
+ if (queryParams.length > 0) {
748
+ $.each(queryParams, function (index, param) {
749
+
750
+ if (window.elementor.settings.page.model.attributes[param]) {
751
+ query += '&' + param + '=' + window.elementor.settings.page.model.attributes[param];
752
+ }
753
+ });
754
+ }
755
+
756
+ return ajaxurl + '?action=' + action + query;
757
+ },
758
+ dataType: 'json'
759
+ },
760
+ placeholder: 'Please enter 3 or more characters',
761
+ minimumInputLength: 3
762
+ });
763
+
764
+ },
765
+
766
+ onBeforeDestroy: function () {
767
+
768
+ if (this.ui.select.data('select2')) {
769
+ this.ui.select.select2('destroy');
770
+ }
771
+
772
+ this.$el.remove();
773
+ }
774
+
775
+ });
776
+
777
+ window.elementor.addControlView('premium_search', self.PremiumSearchView);
778
+
779
+ }
780
+
781
+ };
782
+
783
+
784
+ PremiumModules = {
785
+
786
+ getDataToSave: function (data) {
787
+ data.id = window.elementor.config.post_id;
788
+ return data;
789
+ },
790
+
791
+ init: function () {
792
+ if (window.elementor.settings.premium_template) {
793
+ window.elementor.settings.premium_template.getDataToSave = this.getDataToSave;
794
+ }
795
+
796
+ if (window.elementor.settings.premium_page) {
797
+ window.elementor.settings.premium_page.getDataToSave = this.getDataToSave;
798
+ window.elementor.settings.premium_page.changeCallbacks = {
799
+ custom_header: function () {
800
+ this.save(function () {
801
+ elementor.reloadPreview();
802
+
803
+ elementor.once('preview:loaded', function () {
804
+ elementor.getPanelView().setPage('premium_page_settings');
805
+ });
806
+ });
807
+ },
808
+ custom_footer: function () {
809
+ this.save(function () {
810
+ elementor.reloadPreview();
811
+
812
+ elementor.once('preview:loaded', function () {
813
+ elementor.getPanelView().setPage('premium_page_settings');
814
+ });
815
+ });
816
+ }
817
+ };
818
+ }
819
+
820
+ }
821
+
822
+ };
823
+
824
+ PremiumEditor = {
825
+
826
+ modal: false,
827
+ layout: false,
828
+ collections: {},
829
+ tabs: {},
830
+ defaultTab: '',
831
+ channels: {},
832
+ atIndex: null,
833
+
834
+ init: function () {
835
+
836
+ $(document).ready(function () {
837
+ PremiumEditor.initPremTempsButton();
838
+ });
839
+
840
+ window.elementor.on(
841
+ 'document:loaded',
842
+ window._.bind(PremiumEditor.onPreviewLoaded, PremiumEditor)
843
+ );
844
+
845
+ PremiumEditorViews.init();
846
+ PremiumControlsViews.init();
847
+ PremiumModules.init();
848
+
849
+ },
850
+
851
+ onPreviewLoaded: function () {
852
+
853
+ window.elementor.$previewContents.on(
854
+ 'click.addPremiumTemplate',
855
+ '.pa-add-section-btn',
856
+ _.bind(this.showTemplatesModal, this)
857
+ );
858
+
859
+ this.channels = {
860
+ templates: Backbone.Radio.channel('PREMIUM_EDITOR:templates'),
861
+ tabs: Backbone.Radio.channel('PREMIUM_EDITOR:tabs'),
862
+ layout: Backbone.Radio.channel('PREMIUM_EDITOR:layout'),
863
+ };
864
+
865
+ this.tabs = PremiumTempsData.tabs;
866
+ this.defaultTab = PremiumTempsData.defaultTab;
867
+
868
+ },
869
+
870
+ initPremTempsButton: function () {
871
+
872
+ var addPremiumTemplate = '<div class="elementor-add-section-area-button pa-add-section-btn" title="Add Premium Template"><i class="eicon-star"></i></div>',
873
+ addSectionTmpl = $("#tmpl-elementor-add-section");
874
+
875
+ if (addSectionTmpl.length < 1)
876
+ return;
877
+
878
+ var addSectionTmplHTML = addSectionTmpl.html();
879
+
880
+ addSectionTmplHTML = addSectionTmplHTML.replace('<div class="elementor-add-section-area-button', addPremiumTemplate + '<div class="elementor-add-section-area-button');
881
+
882
+ addSectionTmpl.html(addSectionTmplHTML);
883
+
884
+ // if ($addNewSection.length && PremiumTempsData.PremiumTemplatesBtn) {
885
+ // $addPremiumTemplate = $(addPremiumTemplate).prependTo($addNewSection);
886
+ // }
887
+
888
+
889
+ // window.elementor.$previewContents.on(
890
+ // 'click.addPremiumTemplate',
891
+ // '.elementor-editor-section-settings .elementor-editor-element-add',
892
+ // function () {
893
+
894
+ // var $this = $(this),
895
+ // $section = $this.closest('.elementor-top-section'),
896
+ // modelID = $section.data('model-cid');
897
+
898
+ // if (elementor.previewView.collection.length) {
899
+ // $.each(elementor.previewView.collection.models, function (index, model) {
900
+ // if (modelID === model.cid) {
901
+ // PremiumEditor.atIndex = index;
902
+ // }
903
+ // });
904
+ // }
905
+
906
+ // if (PremiumTempsData.PremiumTemplatesBtn) {
907
+ // setTimeout(function () {
908
+ // var $addNew = $section.prev('.elementor-add-section').find('.elementor-add-new-section');
909
+ // $addNew.prepend(addPremiumTemplate);
910
+ // }, 100);
911
+ // }
912
+
913
+ // }
914
+ // );
915
+
916
+ },
917
+
918
+ getFilter: function (name) {
919
+
920
+ return this.channels.templates.request('filter:' + name);
921
+ },
922
+
923
+ setFilter: function (name, value) {
924
+ this.channels.templates.reply('filter:' + name, value);
925
+ this.channels.templates.trigger('filter:change');
926
+ },
927
+
928
+ getTab: function () {
929
+ return this.channels.tabs.request('filter:tabs');
930
+ },
931
+
932
+ setTab: function (value, silent) {
933
+
934
+ this.channels.tabs.reply('filter:tabs', value);
935
+
936
+ if (!silent) {
937
+ this.channels.tabs.trigger('filter:change');
938
+ }
939
+
940
+ },
941
+
942
+ getTabs: function () {
943
+
944
+ var tabs = [];
945
+
946
+ _.each(this.tabs, function (item, slug) {
947
+ tabs.push({
948
+ slug: slug,
949
+ title: item.title
950
+ });
951
+ });
952
+
953
+ return tabs;
954
+ },
955
+
956
+ getPreview: function (name) {
957
+ return this.channels.layout.request('preview');
958
+ },
959
+
960
+ setPreview: function (value, silent) {
961
+
962
+ this.channels.layout.reply('preview', value);
963
+
964
+ if (!silent) {
965
+ this.channels.layout.trigger('preview:change');
966
+ }
967
+ },
968
+
969
+ getKeywords: function () {
970
+
971
+ var keywords = [];
972
+
973
+ _.each(this.keywords, function (title, slug) {
974
+ tabs.push({
975
+ slug: slug,
976
+ title: title
977
+ });
978
+ });
979
+
980
+ return keywords;
981
+ },
982
+
983
+ showTemplatesModal: function () {
984
+
985
+ this.getModal().show();
986
+
987
+ if (!this.layout) {
988
+ this.layout = new PremiumEditorViews.ModalLayoutView();
989
+ this.layout.showLoadingView();
990
+ }
991
+
992
+ this.setTab(this.defaultTab, true);
993
+ this.requestTemplates(this.defaultTab);
994
+ this.setPreview('initial');
995
+
996
+ },
997
+
998
+ requestTemplates: function (tabName) {
999
+
1000
+ var self = this,
1001
+ tab = self.tabs[tabName];
1002
+
1003
+ self.setFilter('category', false);
1004
+
1005
+ if (tab.data.templates && tab.data.categories) {
1006
+ self.layout.showTemplatesView(tab.data.templates, tab.data.categories, tab.data.keywords);
1007
+ } else {
1008
+ $.ajax({
1009
+ url: ajaxurl,
1010
+ type: 'get',
1011
+ dataType: 'json',
1012
+ data: {
1013
+ action: 'premium_get_templates',
1014
+ tab: tabName
1015
+ },
1016
+ success: function (response) {
1017
+
1018
+ console.log("%c Templates Retrieved Successfully!!", "color: #7a7a7a; background-color: #eee;");
1019
+
1020
+ var templates = new PremiumEditorViews.LibraryCollection(response.data.templates),
1021
+ categories = new PremiumEditorViews.CategoriesCollection(response.data.categories);
1022
+
1023
+ self.tabs[tabName].data = {
1024
+ templates: templates,
1025
+ categories: categories,
1026
+ keywords: response.data.keywords
1027
+ };
1028
+
1029
+ self.layout.showTemplatesView(templates, categories, response.data.keywords);
1030
+
1031
+ },
1032
+ error: function (err) {
1033
+ console.log(err);
1034
+ }
1035
+ });
1036
+ }
1037
+
1038
+ },
1039
+
1040
+ closeModal: function () {
1041
+ this.getModal().hide();
1042
+ },
1043
+
1044
+ getModal: function () {
1045
+
1046
+ if (!this.modal) {
1047
+ this.modal = elementor.dialogsManager.createWidget('lightbox', {
1048
+ id: 'premium-template-modal',
1049
+ className: 'elementor-templates-modal',
1050
+ closeButton: false
1051
+ });
1052
+ }
1053
+
1054
+ return this.modal;
1055
+
1056
+ }
1057
+
1058
+ };
1059
+
1060
+ $(window).on('elementor:init', PremiumEditor.init);
1061
+
1062
  })(jQuery);
assets/frontend/js/premium-addons.js CHANGED
@@ -2525,7 +2525,7 @@
2525
  */
2526
  function stretchDropdown($menu) {
2527
 
2528
- var $parentSec = $($scope).closest('.elementor-top-section'),
2529
  width = $($parentSec).outerWidth(),
2530
  widgetTop = $scope.offset().top,
2531
  parentBottom = $($parentSec).offset().top + $($parentSec).outerHeight(),
2525
  */
2526
  function stretchDropdown($menu) {
2527
 
2528
+ var $parentSec = $($scope).closest('.elementor-top-section, .e-container--row'),
2529
  width = $($parentSec).outerWidth(),
2530
  widgetTop = $scope.offset().top,
2531
  parentBottom = $($parentSec).offset().top + $($parentSec).outerHeight(),
assets/frontend/js/premium-dis-conditions.js CHANGED
@@ -1,17 +1,17 @@
1
- (function ($) {
2
-
3
- $(window).on('elementor/frontend/init', function () {
4
-
5
- //Time range condition cookie.
6
- var localTimeZone = new Date().toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1],
7
- isSecured = (document.location.protocol === 'https:') ? 'secure' : '';
8
-
9
- document.cookie = "localTimeZone=" + localTimeZone + ";SameSite=Strict;" + isSecured;
10
-
11
- //Returning User condition cookie.
12
- if (PremiumSettings)
13
- document.cookie = "isReturningVisitor" + PremiumSettings.pageID + "=true;SameSite=Strict;" + isSecured;
14
-
15
- });
16
-
17
- })(jQuery);
1
+ (function ($) {
2
+
3
+ $(window).on('elementor/frontend/init', function () {
4
+
5
+ //Time range condition cookie.
6
+ var localTimeZone = new Date().toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1],
7
+ isSecured = (document.location.protocol === 'https:') ? 'secure' : '';
8
+
9
+ document.cookie = "localTimeZone=" + localTimeZone + ";SameSite=Strict;" + isSecured;
10
+
11
+ //Returning User condition cookie.
12
+ if (elementorFrontend.config.post.id)
13
+ document.cookie = "isReturningVisitor" + elementorFrontend.config.post.id + "=true;SameSite=Strict;" + isSecured;
14
+
15
+ });
16
+
17
+ })(jQuery);
assets/frontend/js/premium-nav-menu.js CHANGED
@@ -18,8 +18,8 @@
18
  $centeredItems = $scope.find('.premium-mega-content-centered'),
19
  stickyProps = {},
20
  refreshPos = false,
21
- stickyIndex = 'stickyPos' + $scope.data('id'),
22
- stickyWidthIndex = 'stickyWidth' + $scope.data('id');
23
 
24
  /**
25
  * Save current device to use it later to determine if the device changed on resize.
@@ -50,7 +50,7 @@
50
  } else {
51
  // $menuContainer.toggleClass('premium-active-menu');
52
  if ($($menuContainer).hasClass('premium-active-menu')) {
53
- $scope.find('.premium-mobile-menu-container').slideUp('slow', function() {
54
  $menuContainer.removeClass('premium-active-menu');
55
  $scope.find('.premium-mobile-menu-container').show();
56
  });
@@ -91,11 +91,11 @@
91
  $scope.find('.premium-mobile-menu-outer-container, .premium-nav-slide-overlay').removeClass('premium-vertical-toggle-open');
92
  });
93
 
94
- $(document).on('click.PaCloseMegaMenu', function(event) {
95
  var isTabsItem = $(event.target).closest('.premium-tabs-nav-list-item').length,
96
  isWidgetContainer = $(event.target).closest('.premium-nav-widget-container').length;
97
 
98
- if ( !isWidgetContainer && !isTabsItem) {
99
  if ($($menuContainer).hasClass('premium-active-menu')) {
100
  $menuToggler.click();
101
  }
@@ -104,7 +104,7 @@
104
 
105
  $(window).on('resize', function () {
106
 
107
- if ( window.PaCurrStickyDevice !== elementorFrontend.getCurrentDeviceMode()) {
108
  refreshPos = true;
109
  window.PaCurrStickyDevice = elementorFrontend.getCurrentDeviceMode();
110
  }
@@ -115,7 +115,7 @@
115
 
116
  // vertical toggler.
117
  if ($scope.hasClass('premium-ver-toggle-yes') && $scope.hasClass('premium-ver-click')) {
118
- $scope.find('.premium-ver-toggler').on('click', function() {
119
  $scope.find('.premium-nav-widget-container').toggleClass('premium-ver-collapsed', 500);
120
  });
121
  }
@@ -125,7 +125,7 @@
125
  //Trigger small screen menu.
126
  if (settings.breakpoint >= $(window).width() && !isMobileMenu) {
127
  // remove the vertical toggler.
128
- $scope.find('.premium-ver-toggler').css('display','none');
129
  $scope.addClass('premium-hamburger-menu');
130
  $scope.find('.premium-active-menu').removeClass('premium-active-menu');
131
  stretchDropdown($scope.find('.premium-stretch-dropdown .premium-mobile-menu-container'));
@@ -138,7 +138,7 @@
138
 
139
  // show the vertical toggler if enabled.
140
  if ($scope.hasClass('premium-ver-toggle-yes')) {
141
- $scope.find('.premium-ver-toggler').css('display','flex');
142
  }
143
 
144
  $menuToggler.removeClass('premium-toggle-opened');
@@ -159,7 +159,7 @@
159
  */
160
  function stretchDropdown($menu) {
161
 
162
- var $parentSec = $($scope).closest('.elementor-top-section'),
163
  width = $($parentSec).outerWidth(),
164
  widgetTop = $scope.offset().top,
165
  parentBottom = $($parentSec).offset().top + $($parentSec).outerHeight(),
@@ -181,21 +181,21 @@
181
 
182
  var isSticky = $scope.hasClass('premium-nav-sticky-yes') &&
183
  // settings.stickyOptions &&
184
- $( '#' + settings.stickyOptions.targetId ).length &&
185
- ! settings.stickyOptions.disableOn.includes( elementorFrontend.getCurrentDeviceMode() );
186
 
187
- if ( isSticky ) {
188
  stickyProps = settings.stickyOptions;
189
 
190
- stickyProps.spacerClass = 'premium-sticky-spacer-' + $( '#' + stickyProps.targetId ).data('id');
191
 
192
- $( '#' + stickyProps.targetId ).addClass('premium-sticky-active');
193
 
194
- setStickyWidth( stickyProps );
195
 
196
  // Add spacer to save the sticky target space in the dom.
197
- if ( 0 === $('.' + stickyProps.spacerClass).length ) {
198
- $('<div class="'+ stickyProps.spacerClass + '"></div>').insertBefore( '#' + stickyProps.targetId );
199
  }
200
 
201
  $(window).on('load', applyStickyEffect);
@@ -204,8 +204,8 @@
204
  } else {
205
  $(window).off('scroll.PaStickyNav');
206
 
207
- $('<div class="'+ stickyProps.spacerClass + '"></div>').remove(); // remove spacer
208
- $( '#' + stickyProps.targetId ).removeClass('premium-sticky-parent premium-sticky-active premium-sticky-parent-'+ $scope.data('id')).css({ // unset style
209
  top: 'unset',
210
  width: 'inherit',
211
  position: 'relative'
@@ -217,23 +217,23 @@
217
  * we need to get the original width before setting
218
  * the position to fixed.
219
  */
220
- function setStickyWidth( stickyProps ) {
221
  // TODO: check if we can use the spacer's width directly instead.
222
  var currStickyWidth = stickyWidthIndex + elementorFrontend.getCurrentDeviceMode(),
223
- isSticky = $( '#' + stickyProps.targetId ).hasClass('premium-sticky-parent'); // ==> fixed position
224
 
225
  if (isSticky) {
226
- $( '#' + stickyProps.targetId ).css({
227
  position: 'relative',
228
  width: 'inherit'
229
  });
230
  }
231
 
232
- window[currStickyWidth] = $( '#' + stickyProps.targetId ).outerWidth() + 'px';
233
 
234
- if ( isSticky ) {
235
 
236
- $( '#' + stickyProps.targetId ).css({
237
  position: 'fixed',
238
  width: window[currStickyWidth]
239
  });
@@ -246,15 +246,15 @@
246
  scrollTop = $(window).scrollTop() + $adminBarHeight,
247
  currStickyWidth = stickyWidthIndex + elementorFrontend.getCurrentDeviceMode();
248
 
249
- if ( ! window[ stickyIndex ] || refreshPos ) { // save the offset
250
- window[ stickyIndex ] = $( '.' + stickyProps.spacerClass ).offset().top;
251
  refreshPos = false;
252
  }
253
 
254
- if ( scrollTop >= window[ stickyIndex ] ) {
255
 
256
- $('.' + stickyProps.spacerClass).css('height', $( '#' + stickyProps.targetId ).outerHeight() + 'px');
257
- $( '#' + stickyProps.targetId ).addClass('premium-sticky-parent premium-sticky-parent-'+ $scope.data('id')).css({
258
  width: window[currStickyWidth],
259
  top: $adminBarHeight,
260
  position: 'fixed'
@@ -262,7 +262,7 @@
262
 
263
  } else {
264
  $('.' + stickyProps.spacerClass).css('height', '0px');
265
- $( '#' + stickyProps.targetId ).removeClass('premium-sticky-parent premium-sticky-parent-'+ $scope.data('id')).css({
266
  top: 'unset',
267
  width: 'inherit',
268
  position: 'relative'
@@ -273,9 +273,9 @@
273
  if (stickyProps.onScroll) {
274
  var $element = document.querySelector('#' + stickyProps.targetId + '.premium-sticky-parent');
275
 
276
- if ( $element ) {
277
  $('#' + stickyProps.targetId + '.premium-sticky-parent').addClass('premium-sticky-scroll-yes');
278
- var headroom = new Headroom($element,
279
  {
280
  tolerance: 5,
281
  classes: {
@@ -283,7 +283,7 @@
283
  pinned: "slideDown",
284
  unpinned: "slideUp",
285
  offset: {
286
- up: $( '#' + stickyProps.targetId ).outerHeight() + 150, // first time only.
287
  },
288
  }
289
  });
18
  $centeredItems = $scope.find('.premium-mega-content-centered'),
19
  stickyProps = {},
20
  refreshPos = false,
21
+ stickyIndex = 'stickyPos' + $scope.data('id'),
22
+ stickyWidthIndex = 'stickyWidth' + $scope.data('id');
23
 
24
  /**
25
  * Save current device to use it later to determine if the device changed on resize.
50
  } else {
51
  // $menuContainer.toggleClass('premium-active-menu');
52
  if ($($menuContainer).hasClass('premium-active-menu')) {
53
+ $scope.find('.premium-mobile-menu-container').slideUp('slow', function () {
54
  $menuContainer.removeClass('premium-active-menu');
55
  $scope.find('.premium-mobile-menu-container').show();
56
  });
91
  $scope.find('.premium-mobile-menu-outer-container, .premium-nav-slide-overlay').removeClass('premium-vertical-toggle-open');
92
  });
93
 
94
+ $(document).on('click.PaCloseMegaMenu', function (event) {
95
  var isTabsItem = $(event.target).closest('.premium-tabs-nav-list-item').length,
96
  isWidgetContainer = $(event.target).closest('.premium-nav-widget-container').length;
97
 
98
+ if (!isWidgetContainer && !isTabsItem) {
99
  if ($($menuContainer).hasClass('premium-active-menu')) {
100
  $menuToggler.click();
101
  }
104
 
105
  $(window).on('resize', function () {
106
 
107
+ if (window.PaCurrStickyDevice !== elementorFrontend.getCurrentDeviceMode()) {
108
  refreshPos = true;
109
  window.PaCurrStickyDevice = elementorFrontend.getCurrentDeviceMode();
110
  }
115
 
116
  // vertical toggler.
117
  if ($scope.hasClass('premium-ver-toggle-yes') && $scope.hasClass('premium-ver-click')) {
118
+ $scope.find('.premium-ver-toggler').on('click', function () {
119
  $scope.find('.premium-nav-widget-container').toggleClass('premium-ver-collapsed', 500);
120
  });
121
  }
125
  //Trigger small screen menu.
126
  if (settings.breakpoint >= $(window).width() && !isMobileMenu) {
127
  // remove the vertical toggler.
128
+ $scope.find('.premium-ver-toggler').css('display', 'none');
129
  $scope.addClass('premium-hamburger-menu');
130
  $scope.find('.premium-active-menu').removeClass('premium-active-menu');
131
  stretchDropdown($scope.find('.premium-stretch-dropdown .premium-mobile-menu-container'));
138
 
139
  // show the vertical toggler if enabled.
140
  if ($scope.hasClass('premium-ver-toggle-yes')) {
141
+ $scope.find('.premium-ver-toggler').css('display', 'flex');
142
  }
143
 
144
  $menuToggler.removeClass('premium-toggle-opened');
159
  */
160
  function stretchDropdown($menu) {
161
 
162
+ var $parentSec = $($scope).closest('.elementor-top-section, .e-container--row'),
163
  width = $($parentSec).outerWidth(),
164
  widgetTop = $scope.offset().top,
165
  parentBottom = $($parentSec).offset().top + $($parentSec).outerHeight(),
181
 
182
  var isSticky = $scope.hasClass('premium-nav-sticky-yes') &&
183
  // settings.stickyOptions &&
184
+ $('#' + settings.stickyOptions.targetId).length &&
185
+ !settings.stickyOptions.disableOn.includes(elementorFrontend.getCurrentDeviceMode());
186
 
187
+ if (isSticky) {
188
  stickyProps = settings.stickyOptions;
189
 
190
+ stickyProps.spacerClass = 'premium-sticky-spacer-' + $('#' + stickyProps.targetId).data('id');
191
 
192
+ $('#' + stickyProps.targetId).addClass('premium-sticky-active');
193
 
194
+ setStickyWidth(stickyProps);
195
 
196
  // Add spacer to save the sticky target space in the dom.
197
+ if (0 === $('.' + stickyProps.spacerClass).length) {
198
+ $('<div class="' + stickyProps.spacerClass + '"></div>').insertBefore('#' + stickyProps.targetId);
199
  }
200
 
201
  $(window).on('load', applyStickyEffect);
204
  } else {
205
  $(window).off('scroll.PaStickyNav');
206
 
207
+ $('<div class="' + stickyProps.spacerClass + '"></div>').remove(); // remove spacer
208
+ $('#' + stickyProps.targetId).removeClass('premium-sticky-parent premium-sticky-active premium-sticky-parent-' + $scope.data('id')).css({ // unset style
209
  top: 'unset',
210
  width: 'inherit',
211
  position: 'relative'
217
  * we need to get the original width before setting
218
  * the position to fixed.
219
  */
220
+ function setStickyWidth(stickyProps) {
221
  // TODO: check if we can use the spacer's width directly instead.
222
  var currStickyWidth = stickyWidthIndex + elementorFrontend.getCurrentDeviceMode(),
223
+ isSticky = $('#' + stickyProps.targetId).hasClass('premium-sticky-parent'); // ==> fixed position
224
 
225
  if (isSticky) {
226
+ $('#' + stickyProps.targetId).css({
227
  position: 'relative',
228
  width: 'inherit'
229
  });
230
  }
231
 
232
+ window[currStickyWidth] = $('#' + stickyProps.targetId).outerWidth() + 'px';
233
 
234
+ if (isSticky) {
235
 
236
+ $('#' + stickyProps.targetId).css({
237
  position: 'fixed',
238
  width: window[currStickyWidth]
239
  });
246
  scrollTop = $(window).scrollTop() + $adminBarHeight,
247
  currStickyWidth = stickyWidthIndex + elementorFrontend.getCurrentDeviceMode();
248
 
249
+ if (!window[stickyIndex] || refreshPos) { // save the offset
250
+ window[stickyIndex] = $('.' + stickyProps.spacerClass).offset().top;
251
  refreshPos = false;
252
  }
253
 
254
+ if (scrollTop >= window[stickyIndex]) {
255
 
256
+ $('.' + stickyProps.spacerClass).css('height', $('#' + stickyProps.targetId).outerHeight() + 'px');
257
+ $('#' + stickyProps.targetId).addClass('premium-sticky-parent premium-sticky-parent-' + $scope.data('id')).css({
258
  width: window[currStickyWidth],
259
  top: $adminBarHeight,
260
  position: 'fixed'
262
 
263
  } else {
264
  $('.' + stickyProps.spacerClass).css('height', '0px');
265
+ $('#' + stickyProps.targetId).removeClass('premium-sticky-parent premium-sticky-parent-' + $scope.data('id')).css({
266
  top: 'unset',
267
  width: 'inherit',
268
  position: 'relative'
273
  if (stickyProps.onScroll) {
274
  var $element = document.querySelector('#' + stickyProps.targetId + '.premium-sticky-parent');
275
 
276
+ if ($element) {
277
  $('#' + stickyProps.targetId + '.premium-sticky-parent').addClass('premium-sticky-scroll-yes');
278
+ var headroom = new Headroom($element,
279
  {
280
  tolerance: 5,
281
  classes: {
283
  pinned: "slideDown",
284
  unpinned: "slideUp",
285
  offset: {
286
+ up: $('#' + stickyProps.targetId).outerHeight() + 150, // first time only.
287
  },
288
  }
289
  });
assets/frontend/min-js/premium-addons.min.js CHANGED
@@ -1 +1 @@
1
- !function(r){r(window).on("elementor/frontend/init",function(){function n(e,t){var i=e.find(".premium-progressbar-container"),n=(l=i.data("settings")).progress_length,a=l.speed,s=l.type;if("line"===s){var o=i.find(".premium-progressbar-bar");l.gradient&&o.css("background","linear-gradient(-45deg, "+l.gradient+")"),o.animate({width:n+"%"},a)}else if("circle"===s||"half-circle"===s){100<n&&(n=100);var r=1.8*(elementorFrontend.config.is_rtl?-1:1);i.find(".premium-progressbar-hf-circle-progress").css({transform:"rotate("+n*r+"deg)"}),i.prop({counter:0}).animate({counter:n},{duration:a,easing:"linear",step:function(e){var t=3.6*e;i.find(".premium-progressbar-right-label").text(Math.ceil(e)+"%"),i.find(".premium-progressbar-circle-left").css("transform","rotate("+t+"deg)"),"circle"===s&&180<t&&(i.find(".premium-progressbar-circle").css({"-webkit-clip-path":"inset(0)","clip-path":"inset(0)"}),i.find(".premium-progressbar-circle-right").css("visibility","visible"))}})}else{for(var o=i.find(".premium-progressbar-bar-wrap"),r=i.outerWidth(),a=l.dot||25,l=l.spacing||10,m=Math.ceil(r/(a+l)),r=m*(n/100),d=Math.floor(r),a=100*(r-d),u=(o.attr("data-circles",m),o.attr("data-total-fill",d),o.attr("data-partial-fill",a),0);u<m;u++){var c=u<d||u===d?"<div class='segment-inner'></div>":"";o.append("<div class='progress-segment'>"+c+"</div>")}"frontend"!==t&&p(e)}}function p(e){var t=e.find(".premium-progressbar-container").data("settings"),a=e.find(".premium-progressbar-bar-wrap"),e=a.data(),s=t.speed,o=0,r=e.totalFill,l=e.circles,m=e.partialFill;!function e(t){var i=a.find(".progress-segment").eq(t),n=100;t===r&&(n=m);i.find(".segment-inner").animate({width:n+"%"},s/l,function(){++o<=r&&e(o)})}(o)}function e(e,n){var a=e.find(".premium-button-style6-bg");0!==a.length&&e.hasClass("premium-mouse-detect-yes")&&e.on("mouseenter mouseleave",".premium-button-style6",function(e){var t=n(this).offset(),i=e.pageX-t.left,e=e.pageY-t.top;a.css({top:e,left:i})})}function t(e,n){var t;e.hasClass("premium-mask-yes")&&("premium-addon-title.default"===e.data("widget_type")?e.find(t=".premium-title-header").find(".premium-title-icon, .premium-title-img").addClass("premium-mask-span"):t=".premium-dual-header-first-header",e.find(t).find("span:not(.premium-title-style7-stripe-wrap):not(.premium-title-img)").each(function(e,t){var i="";n(this).text().split(" ").forEach(function(e){""!==e&&(i+=' <span class="premium-mask-span">'+e+"</span>")}),n(this).text("").append(i)}),elementorFrontend.waypoint(e,function(){n(e).addClass("premium-mask-active")}))}var i=elementorModules.frontend.handlers.Base,a=i.extend({settings:{},getDefaultSettings:function(){return{selectors:{galleryElement:".premium-gallery-container",filters:".premium-gallery-cats-container li",gradientLayer:".premium-gallery-gradient-layer",loadMore:".premium-gallery-load-more",loadMoreDiv:".premium-gallery-load-more div",vidWrap:".premium-gallery-video-wrap"}}},getDefaultElements:function(){var e=this.getSettings("selectors"),t={$galleryElement:this.$element.find(e.galleryElement),$filters:this.$element.find(e.filters),$gradientLayer:this.$element.find(e.gradientLayer),$vidWrap:this.$element.find(e.vidWrap)};return t.$loadMore=t.$galleryElement.parent().find(e.loadMore),t.$loadMoreDiv=t.$galleryElement.parent().find(e.loadMoreDiv),t},bindEvents:function(){this.getGlobalSettings(),this.run()},getGlobalSettings:function(){var e=this.elements.$galleryElement.data("settings");this.settings={layout:e.img_size,loadMore:e.load_more,columnWidth:null,filter:null,isFilterClicked:!1,minimum:e.minimum,imageToShow:e.click_images,counter:e.minimum,ltrMode:e.ltr_mode,shuffle:e.shuffle,active_cat:e.active_cat,theme:e.theme,overlay:e.overlay,sort_by:e.sort_by,light_box:e.light_box,flag:e.flag,lightbox_type:e.lightbox_type}},updateCounter:function(){this.settings.isFilterClicked?(this.settings.counter=this.settings.minimum,this.settings.isFilterClicked=!1):this.settings.counter=this.settings.counter,this.settings.counter=this.settings.counter+this.settings.imageToShow},updateGrid:function(e,t,i){r.ajax({url:this.appendItems(this.settings.counter,e,t),beforeSend:function(){i.removeClass("premium-gallery-item-hidden")},success:function(){i.addClass("premium-gallery-item-hidden")}})},loadMore:function(e,t){var i=this.elements.$galleryElement,n=this.elements.$loadMoreDiv,a=this.elements.$loadMore,s=this;n.addClass("premium-gallery-item-hidden"),i.find(".premium-gallery-item").length>this.settings.minimum&&(a.removeClass("premium-gallery-item-hidden"),i.parent().on("click",".premium-gallery-load-less",function(){s.settings.counter=s.settings.counter-s.settings.imageToShow}),i.parent().on("click",".premium-gallery-load-more-btn:not(.premium-gallery-load-less)",function(){s.updateCounter(),s.updateGrid(e,t,n)}))},getItemsToHide:function(e,t){return e.filteredItems.slice(t,e.filteredItems.length).map(function(e){return e.element})},appendItems:function(e,t,i){var n=this.elements.$galleryElement,a=this.elements.$gradientLayer,s=n.data("isotope"),s=this.getItemsToHide(s,e);a.outerHeight(t),n.find(".premium-gallery-item-hidden").removeClass("premium-gallery-item-hidden"),n.parent().find(".premium-gallery-load-more").removeClass("premium-gallery-item-hidden"),r(s).addClass("premium-gallery-item-hidden"),i.isotope("layout"),0==s&&(a.addClass("premium-gallery-item-hidden"),n.parent().find(".premium-gallery-load-more").addClass("premium-gallery-item-hidden"))},triggerFilerTabs:function(e){var e=e.searchParams.get(this.settings.flag),t=this.elements.$filters;e&&t.eq(e).find("a").trigger("click")},onReady:function(e){e.isotope("layout");e=new URL(window.location.href);e&&this.triggerFilerTabs(e),this.$element.find(".category.active").trigger("click"),this.$element.find(".elementor-invisible").removeClass("elementor-invisible")},onResize:function(e){this.setMetroLayout(),e.isotope({itemSelector:".premium-gallery-item",masonry:{columnWidth:this.settings.columnWidth}})},lightBoxDisabled:function(){var n=this;this.elements.$vidWrap.each(function(e,t){var i=r(t).data("type");r(t).closest(".premium-gallery-item").on("click",function(){var e=r(this);e.find(".pa-gallery-img-container").css("background","#000"),e.find("img, .pa-gallery-icons-caption-container, .pa-gallery-icons-wrapper").css("visibility","hidden"),"style3"!==n.settings.skin&&e.find(".premium-gallery-caption").css("visibility","hidden"),"hosted"!==i?n.playVid(e):n.playHostedVid(t)})})},playVid:function(e){var e=e.find(".premium-gallery-iframe-wrap"),t=(t=e.data("src")).replace("&mute","&autoplay=1&mute"),i=r("<iframe/>");i.attr({src:t,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),e.html(i),i.css("visibility","visible")},playHostedVid:function(e){e=r(e).find("video");e.get(0).play(),e.css("visibility","visible")},run:function(){var e,t,i=this.elements.$galleryElement,n=(this.elements.$vidWrap,this.elements.$filters),a=this,s=("metro"===this.settings.layout&&(this.setMetroLayout(),this.settings.layout="masonry",r(window).resize(function(){a.onResize(s)})),i.isotope(this.getIsoTopeSettings()));s.imagesLoaded().progress(function(){s.isotope("layout")}),r(document).ready(function(){a.onReady(s)}),this.settings.loadMore&&(e=this.elements.$gradientLayer,t=null,setTimeout(function(){t=e.outerHeight()},200),this.loadMore(t,s)),"yes"!==this.settings.light_box&&this.lightBoxDisabled(),n.find("a").click(function(e){return e.preventDefault(),a.isFilterClicked=!0,n.find(".active").removeClass("active"),r(this).addClass("active"),a.settings.filter=r(this).attr("data-filter"),s.isotope({filter:a.settings.filter}),a.settings.shuffle&&s.isotope("shuffle"),a.settings.loadMore&&a.appendItems(a.settings.minimum,t,s),!1}),"default"===this.settings.lightbox_type&&this.$element.find(".premium-img-gallery a[data-rel^='prettyPhoto']").prettyPhoto(this.getPrettyPhotoSettings())},getPrettyPhotoSettings:function(){return{theme:this.settings.theme,hook:"data-rel",opacity:.7,show_title:!1,deeplinking:!1,overlay_gallery:this.settings.overlay,custom_markup:"",default_width:900,default_height:506,social_tools:""}},getIsoTopeSettings:function(){return{itemSelector:".premium-gallery-item",percentPosition:!0,animationOptions:{duration:750,easing:"linear"},filter:this.settings.active_cat,layoutMode:this.settings.layout,originLeft:this.settings.ltrMode,masonry:{columnWidth:this.settings.columnWidth},sortBy:this.settings.sort_by}},getRepeaterSettings:function(){return this.getElementSettings("premium_gallery_img_content")},setMetroLayout:function(){var e=this.elements.$galleryElement,t=e.width(),a=Math.floor(t/12),t=elementorFrontend.getCurrentDeviceMode(),s="desktop"===t?"":"_"+t,o=this.getRepeaterSettings();e.find(".premium-gallery-item").each(function(e,t){var i=o[e]["premium_gallery_image_cell"+s].size,n=o[e]["premium_gallery_image_vcell"+s].size;""!==i&&null!=i||(i=o[e].premium_gallery_image_cell),""!==n&&null!=n||(n=o[e].premium_gallery_image_vcell),r(t).css({width:Math.ceil(i*a),height:Math.ceil(n*a)})}),this.settings.columnWidth=a}}),s=i.extend({getDefaultSettings:function(){return{selectors:{bannerImgWrap:".premium-banner-ib",bannerImg:"img"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$bannerImgWrap:this.$element.find(e.bannerImgWrap),$bannerImg:this.$element.find(e.bannerImg)}},bindEvents:function(){var e=this;e.elements.$bannerImgWrap.hover(function(){e.elements.$bannerImg.addClass("active")},function(){e.elements.$bannerImg.removeClass("active")}),this.run()},run:function(){var e,t=this.$element;t.hasClass("premium-banner-tilt-yes")&&(e=t.hasClass("premium-banner-tilt-rev-yes"),UniversalTilt.init({elements:t.closest(".elementor-widget"),settings:{reverse:e},callbacks:{onMouseLeave:function(e){e.style.boxShadow="0 45px 100px rgba(255, 255, 255, 0)"},onDeviceMove:function(e){e.style.boxShadow="0 45px 100px rgba(255, 255, 255, 0.3)"}}}))}}),o=i.extend({settings:{},getDefaultSettings:function(){return{selectors:{user:".fa-user",activeCat:".category.active",loading:".premium-loading-feed",blogElement:".premium-blog-wrap",blogFilterTabs:".premium-blog-filter",contentWrapper:".premium-blog-content-wrapper",blogPost:".premium-blog-post-outer-container",metaSeparators:".premium-blog-meta-separator",filterLinks:".premium-blog-filters-container li a",currentPage:".premium-blog-pagination-container .page-numbers.current",activeElememnt:".premium-blog-filters-container li .active"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$blogElement:this.$element.find(e.blogElement),$blogFilterTabs:this.$element.find(e.blogFilterTabs),$activeCat:this.$element.find(e.activeCat),$filterLinks:this.$element.find(e.filterLinks),$blogPost:this.$element.find(e.blogPost),$contentWrapper:this.$element.find(e.contentWrapper)}},bindEvents:function(){this.setLayoutSettings(),this.removeMetaSeparators(),this.run()},setLayoutSettings:function(){var e=this.getElementSettings(),t=this.elements.$blogPost,t={pageNumber:1,isLoaded:!0,count:2,equalHeight:e.force_height,layout:e.premium_blog_layout,carousel:"yes"===e.premium_blog_carousel,infinite:"yes"===e.premium_blog_infinite_scroll,scrollAfter:"yes"===e.scroll_to_offset,grid:"yes"===e.premium_blog_grid,total:t.data("total")};t.carousel&&(t.slidesToScroll=e.slides_to_scroll,t.spacing=parseInt(e.premium_blog_carousel_spacing),t.autoPlay="yes"===e.premium_blog_carousel_play,t.arrows="yes"===e.premium_blog_carousel_arrows,t.fade="yes"===e.premium_blog_carousel_fade,t.center="yes"===e.premium_blog_carousel_center,t.dots="yes"===e.premium_blog_carousel_dots,t.speed=""!==e.premium_blog_carousel_autoplay_speed?parseInt(e.premium_blog_carousel_autoplay_speed):5e3),this.settings=t},removeMetaSeparators:function(){var i=this.getSettings("selectors"),e=this.$element.find(i.blogPost),t=e.first().find(i.metaSeparators),n=e.find(i.user);1===t.length?n.length||e.find(i.metaSeparators).remove():n.length||e.each(function(e,t){r(t).find(i.metaSeparators).first().remove()})},run:function(){var e=this,t=this.elements.$blogElement,i=this.elements.$activeCat.data("filter"),n=this.elements.$blogFilterTabs.length,a=t.data("pagination");this.settings.activeCategory=i,this.settings.filterTabs=n,this.settings.filterTabs&&this.filterTabs(),this.settings.filterTabs&&"*"!==this.settings.activeCategory?this.getPostsByAjax(!1):"masonry"!==this.settings.layout||this.settings.carousel||t.imagesLoaded(function(){t.isotope(e.getIsoTopeSettings())}),this.settings.carousel&&(t.slick(this.getSlickSettings()),t.removeClass("premium-carousel-hidden")),"even"===this.settings.layout&&this.settings.equalHeight&&t.imagesLoaded(function(){e.forceEqualHeight()}),a&&this.paginate(),this.settings.infinite&&t.is(":visible")&&this.getInfiniteScrollPosts()},paginate:function(){var t=this,i=this.$element,n=this.getSettings("selectors");i.on("click",".premium-blog-pagination-container .page-numbers",function(e){e.preventDefault(),r(this).hasClass("current")||(e=parseInt(i.find(n.currentPage).html()),r(this).hasClass("next")?t.settings.pageNumber=e+1:r(this).hasClass("prev")?t.settings.pageNumber=e-1:t.settings.pageNumber=r(this).html(),t.getPostsByAjax(t.settings.scrollAfter))})},forceEqualHeight:function(){var i=new Array,e=this.getSettings("selectors").contentWrapper,e=this.$element.find(e),t=(e.each(function(e,t){t=r(t).outerHeight();i.push(t)}),Math.max.apply(null,i));e.css("height",t+"px")},getSlickSettings:function(){var e=this.settings,t=e.grid?this.getSlickCols():null,i=e.grid?t.cols:1,n=e.grid?t.colsTablet:1,t=e.grid?t.colsMobile:1,a=e.arrows?'<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Previous" role="button" style=""><i class="fas fa-angle-left" aria-hidden="true"></i></a>':"",s=e.arrows?'<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fas fa-angle-right" aria-hidden="true"></i></a>':"";return{infinite:!0,slidesToShow:i,slidesToScroll:e.slidesToScroll||i,responsive:[{breakpoint:1025,settings:{slidesToShow:n,slidesToScroll:1}},{breakpoint:768,settings:{slidesToShow:t,slidesToScroll:1}}],autoplay:e.autoPlay,rows:0,autoplaySpeed:e.speed,nextArrow:s,prevArrow:a,fade:e.fade,centerMode:e.center,centerPadding:e.spacing+"px",draggable:!0,dots:e.dots,customPaging:function(){return'<i class="fas fa-circle"></i>'}}},getSlickCols:function(){var e=this.getElementSettings(),t=e.premium_blog_columns_number,i=e.premium_blog_columns_number_tablet,e=e.premium_blog_columns_number_mobile;return{cols:parseInt(100/t.substr(0,t.indexOf("%"))),colsTablet:parseInt(100/i.substr(0,i.indexOf("%"))),colsMobile:parseInt(100/e.substr(0,e.indexOf("%")))}},getIsoTopeSettings:function(){return{itemSelector:".premium-blog-post-outer-container",percentPosition:!0,filter:this.settings.activeCategory,animationOptions:{duration:750,easing:"linear",queue:!1}}},filterTabs:function(){var t=this,i=this.getSettings("selectors");this.elements.$filterLinks.click(function(e){e.preventDefault(),t.$element.find(i.activeElememnt).removeClass("active"),r(this).addClass("active"),t.settings.activeCategory=r(this).attr("data-filter"),t.settings.pageNumber=1,t.settings.infinite?(t.getPostsByAjax(!1),t.settings.count=2,t.getInfiniteScrollPosts()):t.getPostsByAjax(t.settings.scrollAfter)})},getPostsByAjax:function(e){void 0===this.settings.activeCategory&&(this.settings.activeCategory="*");var i=this,n=this.elements.$blogElement,a=this.getSettings("selectors");r.ajax({url:PremiumSettings.ajaxurl,dataType:"json",type:"POST",data:{action:"pa_get_posts",page_id:n.data("page"),widget_id:i.$element.data("id"),page_number:i.settings.pageNumber,category:i.settings.activeCategory,nonce:PremiumSettings.nonce},beforeSend:function(){n.append('<div class="premium-loading-feed"><div class="premium-loader"></div></div>'),e&&r("html, body").animate({scrollTop:n.offset().top-50},"slow")},success:function(e){var t;e.data&&(n.find(a.loading).remove(),t=e.data.posts,e=e.data.paging,i.settings.infinite?(i.settings.isLoaded=!0,i.settings.filterTabs&&1===i.settings.pageNumber?n.html(t):n.append(t)):(n.html(t),i.$element.find(".premium-blog-footer").html(e)),i.removeMetaSeparators(),i.settings.layout&&("even"===i.settings.layout?i.settings.equalHeight&&i.forceEqualHeight():n.imagesLoaded(function(){n.isotope("reloadItems"),n.isotope({itemSelector:".premium-blog-post-outer-container",animate:!1})})))},error:function(e){console.log(e)}})},getInfiniteScrollPosts:function(){var e=jQuery(window).outerHeight()/1.25,t=this;r(window).scroll(function(){t.settings.filterTabs&&($blogPost=t.elements.$blogElement.find(".premium-blog-post-outer-container"),t.settings.total=$blogPost.data("total")),t.settings.count<=t.settings.total&&r(window).scrollTop()+e>=t.$element.find(".premium-blog-post-outer-container:last").offset().top&&1==t.settings.isLoaded&&(t.settings.pageNumber=t.settings.count,t.getPostsByAjax(!1),t.settings.count++,t.settings.isLoaded=!1)})}}),i={"premium-addon-person":i.extend({getDefaultSettings:function(){return{slick:{infinite:!0,rows:0,prevArrow:'<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Next" role="button" style=""><i class="fas fa-angle-left" aria-hidden="true"></i></a>',nextArrow:'<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fas fa-angle-right" aria-hidden="true"></i></a>',draggable:!0,pauseOnHover:!0},selectors:{multiplePersons:".multiple-persons",person:".premium-person-container",personCarousel:".premium-person-container.slick-active",personImg:".premium-person-image-container img"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$multiplePersons:this.$element.find(e.multiplePersons),$persons:this.$element.find(e.person),$personImg:this.$element.find(e.personImg)}},bindEvents:function(){this.run()},getSlickSettings:function(){var e=this.getElementSettings(),t=this.elements.$multiplePersons.data("rtl"),i=e.persons_per_row,n=e.persons_per_row_tablet,a=e.persons_per_row_mobile;return Object.assign(this.getSettings("slick"),{slidesToShow:parseInt(100/i.substr(0,i.indexOf("%"))),slidesToScroll:parseInt(100/i.substr(0,i.indexOf("%"))),responsive:[{breakpoint:1025,settings:{slidesToShow:parseInt(100/n.substr(0,n.indexOf("%"))),slidesToScroll:1}},{breakpoint:768,settings:{slidesToShow:parseInt(100/a.substr(0,a.indexOf("%"))),slidesToScroll:1}}],autoplay:e.carousel_play,rtl:!!t,autoplaySpeed:e.speed||5e3})},runEqualHeight:function(){var e=this.elements.$persons,t=this.elements.$personImg,i=this.getSettings("selectors"),n=this.getElementSettings("carousel"),a=new Array;(e=n?this.$element.find(i.personCarousel):e).each(function(e,t){r(t).imagesLoaded(function(){}).done(function(){var e=r(t).find(i.personImg).outerHeight();a.push(e)})}),e.imagesLoaded(function(){}).done(function(){var e=Math.max.apply(null,a);t.css("height",e+"px")})},run:function(){var e=this.elements.$multiplePersons;e.length&&("yes"===e.data("persons-equal")&&this.runEqualHeight(),this.getElementSettings("carousel")&&e.slick(this.getSlickSettings()))}}),"premium-addon-blog":o,"premium-img-gallery":a,"premium-addon-banner":s};r.each({"premium-addon-dual-header.default":t,"premium-addon-video-box.default":function(l,m){var t,i,d=l.find(".premium-video-box-container"),e=l.find(".premium-video-box-playlist-container"),n=d.find(".premium-video-box-video-container"),u=d.find(".premium-video-box-inner-wrap"),c=u.find(".premium-video-box-image-container"),a=d.data("type"),s=d.data("thumbnail"),o=d.data("sticky"),r=d.data("sticky-play"),p=d.data("hover"),g=e.length?e:d,f=!!g.data("lightbox")&&g.data("lightbox");if(f)"prettyphoto"===f.type&&g.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']").prettyPhoto({theme:f.theme,hook:"data-rel",opacity:.7,show_title:!1,deeplinking:!1,overlay_gallery:!0,custom_markup:"",default_width:900,default_height:506,social_tools:""}),g.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").on("click",function(e){var t;t=g,("elementor"===f.type?t.find(".premium-video-box-video-container"):t.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']")).click()});else{if(e.length)return n.length?void n.each(function(e,t){var i=m(t),n=i.closest(".premium-video-box-container"),t=i.closest(".premium-video-box-trigger"),a=i.data("src");a+="&autoplay=1",t.on("click",function(){var e=m("<iframe/>");e.attr({src:a,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),i.css("background","#000"),i.html(e),n.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").remove()})}):void 0;"self"===a?(t=n.find("video"),i=t.attr("src"),d.data("play-viewport")&&(elementorFrontend.waypoint(d,function(){h()},{offset:0,triggerOnce:!1}),d.data("play-reset")&&elementorFrontend.waypoint(d,function(e){"up"===e&&(d.removeClass("playing"),m(t).get(0).pause(),m(t).get(0).currentTime=0)},{offset:"100%",triggerOnce:!1}))):(i=n.data("src"),s&&-1===i.indexOf("autoplay=1")?i+="&autoplay=1":d.data("play-viewport")?elementorFrontend.waypoint(d,function(){h()},{offset:0}):h()),d.on("click",function(){h()}),"yes"===o&&"yes"!==r&&v()}function h(){var e;d.hasClass("playing")||(d.addClass("playing"),"yes"===r&&v(),"self"===a?(m(t).get(0).play(),n.css({opacity:"1",visibility:"visible"})):((e=m("<iframe/>")).attr({src:i,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),n.css("background","#000"),n.html(e)),d.find(".premium-video-box-image-container, .premium-video-box-play-icon-container, .premium-video-box-description-container").remove(),"vimeo"===a&&d.find(".premium-video-box-vimeo-wrap").remove())}function v(){var t,i=d.data("hide-desktop"),n=d.data("hide-tablet"),a=d.data("hide-mobile"),s=d.data("sticky-margin");function o(e){var t=elementorFrontend.getCurrentDeviceMode();""!==i&&t==i||""!==n&&t==n||""!==a&&t==a?r(e):e[0].enable()}function r(e){e[0].disable(),d.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide")}function e(){d.hasClass("premium-video-box-sticky-apply")&&u.draggable({start:function(){m(this).css({transform:"none",top:m(this).offset().top+"px",left:m(this).offset().left+"px"})},containment:"window"})}d.off("click").on("click",function(e){e=e.target.className;if(0<=e.toString().indexOf("premium-video-box-sticky-close")||0<=e.toString().indexOf("premium-video-box-sticky-close"))return!1;h()}),void 0!==elementorFrontend.waypoint&&(t=elementorFrontend.waypoint(d,function(e){"down"===e?(d.removeClass("premium-video-box-sticky-hide").addClass("premium-video-box-sticky-apply premium-video-box-filter-sticky"),l.hasClass("elementor-motion-effects-parent")&&l.removeClass("elementor-motion-effects-perspective").find(".elementor-widget-container").addClass("premium-video-box-transform"),d.data("mask")&&(l.find(".premium-video-box-mask-filter").removeClass("premium-video-box-mask-filter"),d.find(":first-child").removeClass("premium-video-box-mask-media"),c.removeClass(p).removeClass("premium-video-box-mask-media").css({transition:"width 0.2s, height 0.2s","-webkit-transition":"width 0.2s, height 0.2s"})),m(document).trigger("premium_after_sticky_applied",[l]),u.data("video-animation")&&" "!=u.data("video-animation")&&(u.css("opacity","0"),e=u.data("delay-animation"),setTimeout(function(){u.css("opacity","1").addClass("animated "+u.data("video-animation"))},1e3*e))):(d.removeClass("premium-video-box-sticky-apply premium-video-box-filter-sticky").addClass("premium-video-box-sticky-hide"),l.hasClass("elementor-motion-effects-parent")&&l.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),d.data("mask")&&(d.parent().addClass("premium-video-box-mask-filter"),d.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media")),c.addClass(p).css({transition:"all 0.2s","-webkit-transition":"all 0.2s"}),u.removeClass("animated "+u.data("video-animation")))},{offset:"0%",triggerOnce:!1})),l.find(".premium-video-box-sticky-close").off("click.closetrigger").on("click.closetrigger",function(e){e.stopPropagation(),t[0].disable(),d.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide"),l.hasClass("elementor-motion-effects-parent")&&l.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),d.data("mask")&&(d.parent().addClass("premium-video-box-mask-filter"),d.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media"))}),o(t),e(),window.addEventListener("scroll",e),m(window).resize(function(e){o(t)}),m(document).on("premium_after_sticky_applied",function(e,t){var i=t.find(".premium-video-box-sticky-infobar");0!==i.length&&(i=i.outerHeight(),(t.hasClass("premium-video-sticky-center-left")||t.hasClass("premium-video-sticky-center-right"))&&(i=Math.ceil(i/2),u.css("top","calc( 50% - "+i+"px )")),(t.hasClass("premium-video-sticky-bottom-left")||t.hasClass("premium-video-sticky-bottom-right"))&&""!==s&&(i=Math.ceil(i),u.css("bottom",i+s)))})}},"premium-addon-fancy-text.default":function(e,t){var i=e.find(".premium-fancy-text-wrapper"),n=i.data("settings"),a=n.delay||2500,s=i.find(".premium-fancy-list-items").length,s=""!==n.count||["typing","slide","autofade"].includes(n.effect)?n.count*s:"infinite";if("typing"===n.effect){var o=[],r=(n.strings.forEach(function(e){o.push(e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"))}),"#"+i.find(".premium-fancy-text").attr("id"));new Typed(r,{strings:o,typeSpeed:n.typeSpeed,backSpeed:n.backSpeed,startDelay:n.startDelay,backDelay:n.backDelay,showCursor:n.showCursor,cursorChar:n.cursorChar,loop:n.loop})}else if("slide"===n.effect)a=n.pause,i.find(".premium-fancy-text").vTicker({speed:n.speed,showItems:n.showItems,pause:n.pause,mousePause:n.mousePause,direction:"up"});else if("auto-fade"===n.effect){var r=i.find(".premium-fancy-list-items"),l=r.length;if(0===l)return;var m=n.duration/l,d=0,a=m;r.each(function(e,t){t.style.animationDelay=d+"ms",d+=m})}else var u,c,p=i.find(".premium-fancy-list-items"),g=1,l=n.delay||2500,f=n.count,h=(f&&(u=1,c=i.find(".premium-fancy-list-items").length),setInterval(function(){var e="";"custom"===n.effect&&(e="animated "+n.animation),p.eq(g).addClass("premium-fancy-item-visible "+e).removeClass("premium-fancy-item-hidden"),p.filter(function(e){return e!==g}).addClass("premium-fancy-item-hidden").removeClass("premium-fancy-item-visible "+e),g++,p.length===g&&(g=0),f&&c*f===++u&&clearInterval(h)},l));"typing"!==n.effect&&setTimeout(function(){i.find(".premium-fancy-text").css("opacity","1")},500),"loading"===n.loading&&"typing"!==n.effect&&(e.find(".premium-fancy-text").append('<span class="premium-loading-bar"></span>'),e.find(".premium-loading-bar").css({"animation-iteration-count":s,"animation-duration":a+"ms"}))},"premium-counter.default":function(e,t){var e=e.find(".premium-counter"),i=e.closest(".premium-hscroll-temp"),n=e.data(),a=e.find(".premium-counter-init"),s=e.find(".icon");i.length?t(window).on("scroll",function(){t(window).scrollTop()>=i.data("scroll-offset")&&(t(a).numerator(n),t(s).addClass("animated "+s.data("animation")))}):elementorFrontend.waypoint(e,function(){t(a).numerator(n),t(s).addClass("animated "+s.data("animation"))})},"premium-addon-title.default":[function(e,i){var t,n,a=e.find(".premium-title-container"),s=a.find(".premium-title-text");a.hasClass("style9")&&e.find(".premium-title-style9").each(function(){var e=i(this),t=1e3*e.attr("data-blur-delay");e.attr("data-animation-blur","process"),e.find(".premium-title-style9-letter").each(function(e,t){e+=1,e=i("body").hasClass("rtl")?.2/e+"s":e/20+"s",i(t).css({"-webkit-animation-delay":e,"animation-delay":e})}),setInterval(function(){e.attr("data-animation-blur","done"),setTimeout(function(){e.attr("data-animation-blur","process")},150)},t)}),a.hasClass("style8")&&(t=1e3*s.attr("data-shiny-delay"),n=1e3*s.attr("data-shiny-dur"),function e(){s.get(0).setAttribute("data-animation","shiny"),setTimeout(function(){s.removeAttr("data-animation")},n),setTimeout(e,t)}())},t],"premium-countdown-timer.default":function(e,o){var t=e.find(".premium-countdown"),n=t.data("settings"),r=e.data("id"),e=n.label1,i=n.label2,e=e.split(","),i=i.split(","),a="evergreen"===n.timerType?n.until.date.replace(/ /g,"T"):n.until,s="",l={y:{index:0,oldVal:""},o:{index:1,oldVal:""},w:{index:2,oldVal:""},d:{index:3,oldVal:""},h:{index:4,oldVal:""},m:{index:5,oldVal:""},s:{index:6,oldVal:""}};t.find("#countdown-"+r).hasClass("premium-countdown-flip")&&n.format.split("").forEach(function(e){e=e.toLowerCase();s+='<div class="premium-countdown-block premium-countdown-'+e+'"><div class="pre_time-mid"> <div class="premium-countdown-figure"><span class="top">{'+e+'nn}</span><span class="top-back"><span>{'+e+'nn}</span></span><span class="bottom">{'+e+'nn}</span><span class="bottom-back"><span>{'+e+'nn}</span></span></div><span class="premium-countdown-label">{'+e+'l}</span></div><span class="countdown_separator">{sep}</span></div>'}),t.find("#countdown-"+r).countdown({layout:s,labels:i,labels1:e,until:new Date(a),format:n.format,padZeroes:!0,timeSeparator:n.separator,onTick:function(e){var i,a,s;i=0,t.find("#countdown-"+r+" .countdown-amount").each(function(e,t){i<o(t).outerWidth()&&(i=o(t).outerWidth())}),t.find("#countdown-"+r+" .countdown-amount").css("width",i),t.find("#countdown-"+r).hasClass("premium-countdown-flip")&&(a=e,s=l,n.format.split("").forEach(function(e){var t,e=e.toLowerCase(),i=s[e].index,n=s[e].oldVal;a[i]!==n&&(s[e].oldVal=a[i],t=o("#countdown-"+r).find(".premium-countdown-"+e+" .top"),n=o("#countdown-"+r).find(".premium-countdown-"+e+" .top-back"),TweenMax.to(t,.8,{rotationX:"-180deg",transformPerspective:300,ease:Quart.easeOut,onComplete:function(){TweenMax.set(t,{rotationX:0})}}),TweenMax.to(n,.8,{rotationX:0,transformPerspective:300,ease:Quart.easeOut,clearProps:"all"}))}))},onExpiry:function(){"onExpiry"===n.event&&t.find("#countdown-"+r).html(n.text)},serverSync:function(){return new Date(n.serverSync)}}),n.reset&&t.find(".premium-countdown-init").countdown("option","until",new Date(a)),"expiryUrl"===n.event&&t.find("#countdown-"+r).countdown("option","expiryUrl",elementorFrontend.isEditMode()?"":n.text),(times=t.find("#countdown-"+r).countdown("getTimes")).every(function(e){return 0==e})&&("onExpiry"===n.event?t.find("#countdown-"+r).html(n.text):"expiryUrl"!==n.event||elementorFrontend.isEditMode()||(0<o("body").find("#elementor").length?t.find("#countdown-"+r).html("<h1>You can not redirect url from elementor Editor!!</h1>"):elementorFrontend.isEditMode()||(window.location.href=n.text)))},"premium-carousel-widget.default":function(e,l){var t,m=e.find(".premium-carousel-wrapper"),d=l(m).data("settings"),i=elementorFrontend.isEditMode();function n(e){var t=m.find(".slick-slide");(t="init"===e?t.not(".slick-current"):t).find(".animated").each(function(e,t){var i=l(t).data("settings");i&&(i._animation||i.animation)&&(i=i._animation||i.animation,l(t).removeClass("animated "+i).addClass("elementor-invisible"))})}m.find(".item-wrapper").length<1||(i&&m.find(".item-wrapper").each(function(e,t){var i=l(t).data("template");void 0!==i&&""!==i&&l.ajax({type:"GET",url:PremiumSettings.ajaxurl,dataType:"html",data:{action:"get_elementor_template_content",templateID:i}}).success(function(e){e=JSON.parse(e).data;void 0!==e.template_content&&(l(t).html(e.template_content),m.find(".premium-carousel-inner").slick("refresh"))})}),m.on("init",function(e){e.preventDefault(),setTimeout(function(){n("init")},500),l(this).find("item-wrapper.slick-active").each(function(){var e=l(this);e.addClass(e.data("animation"))}),l(".slick-track").addClass("translate")}),m.find(".premium-carousel-inner").slick({vertical:d.vertical,slidesToScroll:d.slidesToScroll,slidesToShow:d.slidesToShow,responsive:[{breakpoint:d.tabletBreak,settings:{slidesToShow:d.slidesTab,slidesToScroll:d.slidesTab,swipe:d.touchMove}},{breakpoint:d.mobileBreak,settings:{slidesToShow:d.slidesMob,slidesToScroll:d.slidesMob,swipe:d.touchMove}}],useTransform:!0,fade:d.fade,infinite:d.infinite,speed:d.speed,autoplay:d.autoplay,autoplaySpeed:d.autoplaySpeed,rows:0,draggable:d.draggable,rtl:d.rtl,adaptiveHeight:d.adaptiveHeight,pauseOnHover:d.pauseOnHover,centerMode:d.centerMode,centerPadding:d.centerPadding,arrows:d.arrows,prevArrow:m.find(".premium-carousel-nav-arrow-prev").html(),nextArrow:m.find(".premium-carousel-nav-arrow-next").html(),dots:d.dots,variableWidth:d.variableWidth,cssEase:d.cssEase,customPaging:function(){return m.find(".premium-carousel-nav-dot").html()}}),e.find(".premium-carousel-hidden").removeClass("premium-carousel-hidden"),m.find(".premium-carousel-nav-arrow-prev").remove(),m.find(".premium-carousel-nav-arrow-next").remove(),d.variableWidth&&m.find(".elementor-container").css("flex-wrap","nowrap"),m.on("afterChange",function(e,t,i){var n,a=t.options.slidesToScroll,s=(o=(o=t).options.slidesToShow,(s=l(window).width())>d.tabletBreak&&(o=d.slidesDesk),s<=d.tabletBreak&&(o=d.slidesTab),o=s<=d.mobileBreak?d.slidesMob:o),o=t.options.centerMode,s=i+s-1;if(m.find(".slick-active .elementor-invisible").each(function(e,t){var i,n,a=l(t).data("settings");a&&(a._animation||a.animation)&&(i=a._animation_delay||0,n=a._animation||a.animation,setTimeout(function(){l(t).removeClass("elementor-invisible").addClass(n+" animated")},i))}),1===a)!0==!o&&(n=l(this).find("[data-slick-index='"+s+"']"),"null"!=d.animation&&n.find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").addClass(d.animation).removeClass("premium-carousel-content-hidden"));else for(var r=a+i;0<=r;r--)n=l(this).find("[data-slick-index='"+r+"']"),"null"!=d.animation&&n.find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").addClass(d.animation).removeClass("premium-carousel-content-hidden");t.$slides.length-1!=i||d.infinite||m.find(".premium-carousel-inner").slick("slickSetOption","autoplay",!1,!0)}),m.on("beforeChange",function(e,t,i){n();i=l(this).find("[data-slick-index='"+i+"']");"null"!=d.animation&&i.siblings().find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").removeClass(d.animation).addClass("premium-carousel-content-hidden")}),d.vertical&&(t=-1,elementorFrontend.elements.$window.on("load",function(){m.find(".slick-slide").each(function(){l(this).height()>t&&(t=l(this).height())}),m.find(".slick-slide").each(function(){l(this).height()<t&&l(this).css("margin",Math.ceil((t-l(this).height())/2)+"px 0")})})),(i={element:l("a.ver-carousel-arrow"),getWidth:function(){return this.element.outerWidth()/2},setWidth:function(e){"vertical"==(e=e||"vertical")?this.element.css("margin-left","-"+this.getWidth()+"px"):this.element.css("margin-top","-"+this.getWidth()+"px")}}).setWidth(),i.element=l("a.carousel-arrow"),i.setWidth("horizontal"),l(document).ready(function(){d.navigation.map(function(e,t){e&&l(e).on("click",function(){var e=m.find(".premium-carousel-inner").slick("slickCurrentSlide");t!==e&&m.find(".premium-carousel-inner").slick("slickGoTo",t)})})}))},"premium-addon-modal-box.default":function(e,t){var i,n=e.find(".premium-modal-box-container"),a=n.data("settings"),s=n.find(".premium-modal-box-modal-dialog");a&&("pageload"===a.trigger&&t(document).ready(function(e){setTimeout(function(){n.find(".premium-modal-box-modal").modal()},1e3*a.delay)}),s.data("modal-animation")&&" "!=s.data("modal-animation")&&(i=s.data("delay-animation"),new Waypoint({element:s,handler:function(){setTimeout(function(){s.css("opacity","1").addClass("animated "+s.data("modal-animation"))},1e3*i),this.destroy()},offset:Waypoint.viewportHeight()-150})))},"premium-image-scroll.default":function(e,t){var i=e.find(".premium-image-scroll-container"),n=i.find(".premium-image-scroll-overlay"),e=i.find(".premium-image-scroll-vertical"),a=i.data("settings"),s=i.find("img"),o=a.direction,r=a.reverse,l=null;function m(){s.css("transform",("vertical"===o?"translateY":"translateX")+"( -"+l+"px)")}function d(){s.css("transform",("vertical"===o?"translateY":"translateX")+"(0px)")}function u(){l="vertical"===o?s.height()-i.height():s.width()-i.width()}"scroll"===a.trigger?(i.addClass("premium-container-scroll"),"vertical"===o?e.addClass("premium-image-scroll-ver"):i.imagesLoaded(function(){n.css({width:s.width(),height:s.height()})})):("yes"===r&&i.imagesLoaded(function(){i.addClass("premium-container-scroll-instant"),u(),m()}),"vertical"===o&&e.removeClass("premium-image-scroll-ver"),i.mouseenter(function(){i.removeClass("premium-container-scroll-instant"),u(),("yes"===r?d:m)()}),i.mouseleave(function(){("yes"===r?m:d)()}))},"premium-contact-form.default":function(e,t){e=e.find(".premium-cf7-container").find('input[type="text"], input[type="email"], textarea, input[type="password"], input[type="date"], input[type="number"], input[type="tel"], input[type="file"], input[type="url"]');e.wrap("<span class='wpcf7-span'>"),e.on("focus blur",function(){t(this).closest(".wpcf7-span").toggleClass("is-focused")})},"premium-icon-list.default":function(e,n){var a=e.find(".premium-bullet-list-box");a.find(".premium-bullet-list-content").each(function(e,i){a.data("list-animation")&&" "!=a.data("list-animation")&&elementorFrontend.waypoint(n(i),function(){var e=n(i),t=e.data("delay");setTimeout(function(){e.next(".premium-bullet-list-divider , .premium-bullet-list-divider-inline").css("opacity","1"),e.next(".premium-bullet-list-divider-inline , .premium-bullet-list-divider").addClass("animated "+a.data("list-animation")),e.css("opacity","1").addClass("animated "+a.data("list-animation"))},t)})})},"premium-addon-button.default":e,"premium-addon-image-button.default":e,"premium-nav-menu.default":function(s,o){s.find(".premium-nav-widget-container").removeClass("elementor-invisible");var i,r,e,t,n,a,l,m,d,u=s.find(".premium-nav-widget-container").data("settings");function c(e){var t,i,n,a;e.breakpoint>=o(window).width()&&!d?(s.find(".premium-ver-toggler").css("display","none"),s.addClass("premium-hamburger-menu"),s.find(".premium-active-menu").removeClass("premium-active-menu"),t=s.find(".premium-stretch-dropdown .premium-mobile-menu-container"),i=o(s).closest(".elementor-top-section"),n=o(i).outerWidth(),a=s.offset().top,a=o(i).offset().top+o(i).outerHeight()-a,i=s.offset().left-o(i).offset().left,o(t).css({width:n+"px",left:"-"+i+"px",top:a+"px"}),isDesktopMenu=!(d=!0)):e.breakpoint<o(window).width()&&!isDesktopMenu&&(s.hasClass("premium-ver-toggle-yes")&&s.find(".premium-ver-toggler").css("display","flex"),r.removeClass("premium-toggle-opened"),s.find(".premium-mobile-menu-container .premium-active-menu").removeClass("premium-active-menu"),s.removeClass("premium-hamburger-menu premium-ham-dropdown"),s.find(".premium-vertical-toggle-open").removeClass("premium-vertical-toggle-open"),s.find(".premium-nav-default").removeClass("premium-nav-default"),isDesktopMenu=!0,d=!1)}function p(){var e,t,i;s.hasClass("premium-nav-sticky-yes")&&o("#"+u.stickyOptions.targetId).length&&!u.stickyOptions.disableOn.includes(elementorFrontend.getCurrentDeviceMode())?((n=u.stickyOptions).spacerClass="premium-sticky-spacer-"+o("#"+n.targetId).data("id"),o("#"+n.targetId).addClass("premium-sticky-active"),e=n,t=m+elementorFrontend.getCurrentDeviceMode(),(i=o("#"+e.targetId).hasClass("premium-sticky-parent"))&&o("#"+e.targetId).css({position:"relative",width:"inherit"}),window[t]=o("#"+e.targetId).outerWidth()+"px",i&&o("#"+e.targetId).css({position:"fixed",width:window[t]}),0===o("."+n.spacerClass).length&&o('<div class="'+n.spacerClass+'"></div>').insertBefore("#"+n.targetId),o(window).on("load",g),o(window).on("scroll.PaStickyNav",g)):(o(window).off("scroll.PaStickyNav"),o('<div class="'+n.spacerClass+'"></div>').remove(),o("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-active premium-sticky-parent-"+s.data("id")).css({top:"unset",width:"inherit",position:"relative"}))}function g(){var e=elementorFrontend.elements.$wpAdminBar.height()?elementorFrontend.elements.$wpAdminBar.height():0,t=o(window).scrollTop()+e,i=m+elementorFrontend.getCurrentDeviceMode();window[l]&&!a||(window[l]=o("."+n.spacerClass).offset().top,a=!1),t>=window[l]?(o("."+n.spacerClass).css("height",o("#"+n.targetId).outerHeight()+"px"),o("#"+n.targetId).addClass("premium-sticky-parent premium-sticky-parent-"+s.data("id")).css({width:window[i],top:e,position:"fixed"})):(o("."+n.spacerClass).css("height","0px"),o("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-parent-"+s.data("id")).css({top:"unset",width:"inherit",position:"relative"})),n.onScroll?(t=document.querySelector("#"+n.targetId+".premium-sticky-parent"))&&(o("#"+n.targetId+".premium-sticky-parent").addClass("premium-sticky-scroll-yes"),new Headroom(t,{tolerance:5,classes:{initial:"animated",pinned:"slideDown",unpinned:"slideUp",offset:{up:o("#"+n.targetId).outerHeight()+150}}}).init()):o("#"+n.targetId+".premium-sticky-parent").removeClass("premium-sticky-scroll-yes")}u&&(i=s.find(".premium-mobile-menu"),r=s.find(".premium-hamburger-toggle"),e=s.find(".premium-mobile-menu-close"),t=s.find(".premium-mega-content-centered"),a=!(n={}),l="stickyPos"+s.data("id"),m="stickyWidth"+s.data("id"),window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode(),t.each(function(e,t){o(t).closest(".premium-nav-menu-item").addClass("premium-mega-item-static")}),"slide"!==u.mobileLayout&&"slide"!==u.mainLayout||s.addClass("premium-ver-hamburger-menu"),d=isDesktopMenu=null,c(u),p(),e.on("click",function(){s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),r.on("click",function(){"slide"===u.mobileLayout||"slide"===u.mainLayout?s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").addClass("premium-vertical-toggle-open"):o(i).hasClass("premium-active-menu")?s.find(".premium-mobile-menu-container").slideUp("slow",function(){i.removeClass("premium-active-menu"),s.find(".premium-mobile-menu-container").show()}):i.addClass("premium-active-menu"),r.toggleClass("premium-toggle-opened")}),i.find(".premium-nav-menu-item.menu-item-has-children a, .premium-mega-nav-item a").on("click",function(e){var t;o(this).find(".premium-dropdown-icon").length<1||(t=o(this).parent(".premium-nav-menu-item"),e.stopPropagation(),e.preventDefault(),t.hasClass("premium-active-menu")?t.toggleClass("premium-active-menu"):(i.find(".premium-active-menu").toggleClass("premium-active-menu"),t.toggleClass("premium-active-menu"),o(t).parents(".premium-nav-menu-item.menu-item-has-children").toggleClass("premium-active-menu")))}),o(document).on("click",".premium-nav-slide-overlay",function(){s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),o(document).on("click.PaCloseMegaMenu",function(e){var t=o(e.target).closest(".premium-tabs-nav-list-item").length;o(e.target).closest(".premium-nav-widget-container").length||t||o(i).hasClass("premium-active-menu")&&r.click()}),o(window).on("resize",function(){window.PaCurrStickyDevice!==elementorFrontend.getCurrentDeviceMode()&&(a=!0,window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode()),c(u),p()}),s.hasClass("premium-ver-toggle-yes")&&s.hasClass("premium-ver-click")&&s.find(".premium-ver-toggler").on("click",function(){s.find(".premium-nav-widget-container").toggleClass("premium-ver-collapsed",500)}))}},function(i,e){"object"==typeof e?r.each(e,function(e,t){elementorFrontend.hooks.addAction("frontend/element_ready/"+i,t)}):elementorFrontend.hooks.addAction("frontend/element_ready/"+i,e)}),r.each(i,function(e,t){elementorFrontend.elementsHandler.attachHandler(e,t)}),elementorFrontend.isEditMode()?elementorFrontend.hooks.addAction("frontend/element_ready/premium-addon-progressbar.default",n):elementorFrontend.hooks.addAction("frontend/element_ready/premium-addon-progressbar.default",function(e,t){var i=e.find(".premium-progressbar-container").data("settings").type;"dots"===i&&n(e,"frontend"),elementorFrontend.waypoint(e,function(){("dots"!==i?n:p)(t(this))})})})}(jQuery);
1
+ !function(r){r(window).on("elementor/frontend/init",function(){function n(e,t){var i=e.find(".premium-progressbar-container"),n=(l=i.data("settings")).progress_length,a=l.speed,s=l.type;if("line"===s){var o=i.find(".premium-progressbar-bar");l.gradient&&o.css("background","linear-gradient(-45deg, "+l.gradient+")"),o.animate({width:n+"%"},a)}else if("circle"===s||"half-circle"===s){100<n&&(n=100);var r=1.8*(elementorFrontend.config.is_rtl?-1:1);i.find(".premium-progressbar-hf-circle-progress").css({transform:"rotate("+n*r+"deg)"}),i.prop({counter:0}).animate({counter:n},{duration:a,easing:"linear",step:function(e){var t=3.6*e;i.find(".premium-progressbar-right-label").text(Math.ceil(e)+"%"),i.find(".premium-progressbar-circle-left").css("transform","rotate("+t+"deg)"),"circle"===s&&180<t&&(i.find(".premium-progressbar-circle").css({"-webkit-clip-path":"inset(0)","clip-path":"inset(0)"}),i.find(".premium-progressbar-circle-right").css("visibility","visible"))}})}else{for(var o=i.find(".premium-progressbar-bar-wrap"),r=i.outerWidth(),a=l.dot||25,l=l.spacing||10,m=Math.ceil(r/(a+l)),r=m*(n/100),d=Math.floor(r),a=100*(r-d),u=(o.attr("data-circles",m),o.attr("data-total-fill",d),o.attr("data-partial-fill",a),0);u<m;u++){var c=u<d||u===d?"<div class='segment-inner'></div>":"";o.append("<div class='progress-segment'>"+c+"</div>")}"frontend"!==t&&p(e)}}function p(e){var t=e.find(".premium-progressbar-container").data("settings"),a=e.find(".premium-progressbar-bar-wrap"),e=a.data(),s=t.speed,o=0,r=e.totalFill,l=e.circles,m=e.partialFill;!function e(t){var i=a.find(".progress-segment").eq(t),n=100;t===r&&(n=m);i.find(".segment-inner").animate({width:n+"%"},s/l,function(){++o<=r&&e(o)})}(o)}function e(e,n){var a=e.find(".premium-button-style6-bg");0!==a.length&&e.hasClass("premium-mouse-detect-yes")&&e.on("mouseenter mouseleave",".premium-button-style6",function(e){var t=n(this).offset(),i=e.pageX-t.left,e=e.pageY-t.top;a.css({top:e,left:i})})}function t(e,n){var t;e.hasClass("premium-mask-yes")&&("premium-addon-title.default"===e.data("widget_type")?e.find(t=".premium-title-header").find(".premium-title-icon, .premium-title-img").addClass("premium-mask-span"):t=".premium-dual-header-first-header",e.find(t).find("span:not(.premium-title-style7-stripe-wrap):not(.premium-title-img)").each(function(e,t){var i="";n(this).text().split(" ").forEach(function(e){""!==e&&(i+=' <span class="premium-mask-span">'+e+"</span>")}),n(this).text("").append(i)}),elementorFrontend.waypoint(e,function(){n(e).addClass("premium-mask-active")}))}var i=elementorModules.frontend.handlers.Base,a=i.extend({settings:{},getDefaultSettings:function(){return{selectors:{galleryElement:".premium-gallery-container",filters:".premium-gallery-cats-container li",gradientLayer:".premium-gallery-gradient-layer",loadMore:".premium-gallery-load-more",loadMoreDiv:".premium-gallery-load-more div",vidWrap:".premium-gallery-video-wrap"}}},getDefaultElements:function(){var e=this.getSettings("selectors"),t={$galleryElement:this.$element.find(e.galleryElement),$filters:this.$element.find(e.filters),$gradientLayer:this.$element.find(e.gradientLayer),$vidWrap:this.$element.find(e.vidWrap)};return t.$loadMore=t.$galleryElement.parent().find(e.loadMore),t.$loadMoreDiv=t.$galleryElement.parent().find(e.loadMoreDiv),t},bindEvents:function(){this.getGlobalSettings(),this.run()},getGlobalSettings:function(){var e=this.elements.$galleryElement.data("settings");this.settings={layout:e.img_size,loadMore:e.load_more,columnWidth:null,filter:null,isFilterClicked:!1,minimum:e.minimum,imageToShow:e.click_images,counter:e.minimum,ltrMode:e.ltr_mode,shuffle:e.shuffle,active_cat:e.active_cat,theme:e.theme,overlay:e.overlay,sort_by:e.sort_by,light_box:e.light_box,flag:e.flag,lightbox_type:e.lightbox_type}},updateCounter:function(){this.settings.isFilterClicked?(this.settings.counter=this.settings.minimum,this.settings.isFilterClicked=!1):this.settings.counter=this.settings.counter,this.settings.counter=this.settings.counter+this.settings.imageToShow},updateGrid:function(e,t,i){r.ajax({url:this.appendItems(this.settings.counter,e,t),beforeSend:function(){i.removeClass("premium-gallery-item-hidden")},success:function(){i.addClass("premium-gallery-item-hidden")}})},loadMore:function(e,t){var i=this.elements.$galleryElement,n=this.elements.$loadMoreDiv,a=this.elements.$loadMore,s=this;n.addClass("premium-gallery-item-hidden"),i.find(".premium-gallery-item").length>this.settings.minimum&&(a.removeClass("premium-gallery-item-hidden"),i.parent().on("click",".premium-gallery-load-less",function(){s.settings.counter=s.settings.counter-s.settings.imageToShow}),i.parent().on("click",".premium-gallery-load-more-btn:not(.premium-gallery-load-less)",function(){s.updateCounter(),s.updateGrid(e,t,n)}))},getItemsToHide:function(e,t){return e.filteredItems.slice(t,e.filteredItems.length).map(function(e){return e.element})},appendItems:function(e,t,i){var n=this.elements.$galleryElement,a=this.elements.$gradientLayer,s=n.data("isotope"),s=this.getItemsToHide(s,e);a.outerHeight(t),n.find(".premium-gallery-item-hidden").removeClass("premium-gallery-item-hidden"),n.parent().find(".premium-gallery-load-more").removeClass("premium-gallery-item-hidden"),r(s).addClass("premium-gallery-item-hidden"),i.isotope("layout"),0==s&&(a.addClass("premium-gallery-item-hidden"),n.parent().find(".premium-gallery-load-more").addClass("premium-gallery-item-hidden"))},triggerFilerTabs:function(e){var e=e.searchParams.get(this.settings.flag),t=this.elements.$filters;e&&t.eq(e).find("a").trigger("click")},onReady:function(e){e.isotope("layout");e=new URL(window.location.href);e&&this.triggerFilerTabs(e),this.$element.find(".category.active").trigger("click"),this.$element.find(".elementor-invisible").removeClass("elementor-invisible")},onResize:function(e){this.setMetroLayout(),e.isotope({itemSelector:".premium-gallery-item",masonry:{columnWidth:this.settings.columnWidth}})},lightBoxDisabled:function(){var n=this;this.elements.$vidWrap.each(function(e,t){var i=r(t).data("type");r(t).closest(".premium-gallery-item").on("click",function(){var e=r(this);e.find(".pa-gallery-img-container").css("background","#000"),e.find("img, .pa-gallery-icons-caption-container, .pa-gallery-icons-wrapper").css("visibility","hidden"),"style3"!==n.settings.skin&&e.find(".premium-gallery-caption").css("visibility","hidden"),"hosted"!==i?n.playVid(e):n.playHostedVid(t)})})},playVid:function(e){var e=e.find(".premium-gallery-iframe-wrap"),t=(t=e.data("src")).replace("&mute","&autoplay=1&mute"),i=r("<iframe/>");i.attr({src:t,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),e.html(i),i.css("visibility","visible")},playHostedVid:function(e){e=r(e).find("video");e.get(0).play(),e.css("visibility","visible")},run:function(){var e,t,i=this.elements.$galleryElement,n=(this.elements.$vidWrap,this.elements.$filters),a=this,s=("metro"===this.settings.layout&&(this.setMetroLayout(),this.settings.layout="masonry",r(window).resize(function(){a.onResize(s)})),i.isotope(this.getIsoTopeSettings()));s.imagesLoaded().progress(function(){s.isotope("layout")}),r(document).ready(function(){a.onReady(s)}),this.settings.loadMore&&(e=this.elements.$gradientLayer,t=null,setTimeout(function(){t=e.outerHeight()},200),this.loadMore(t,s)),"yes"!==this.settings.light_box&&this.lightBoxDisabled(),n.find("a").click(function(e){return e.preventDefault(),a.isFilterClicked=!0,n.find(".active").removeClass("active"),r(this).addClass("active"),a.settings.filter=r(this).attr("data-filter"),s.isotope({filter:a.settings.filter}),a.settings.shuffle&&s.isotope("shuffle"),a.settings.loadMore&&a.appendItems(a.settings.minimum,t,s),!1}),"default"===this.settings.lightbox_type&&this.$element.find(".premium-img-gallery a[data-rel^='prettyPhoto']").prettyPhoto(this.getPrettyPhotoSettings())},getPrettyPhotoSettings:function(){return{theme:this.settings.theme,hook:"data-rel",opacity:.7,show_title:!1,deeplinking:!1,overlay_gallery:this.settings.overlay,custom_markup:"",default_width:900,default_height:506,social_tools:""}},getIsoTopeSettings:function(){return{itemSelector:".premium-gallery-item",percentPosition:!0,animationOptions:{duration:750,easing:"linear"},filter:this.settings.active_cat,layoutMode:this.settings.layout,originLeft:this.settings.ltrMode,masonry:{columnWidth:this.settings.columnWidth},sortBy:this.settings.sort_by}},getRepeaterSettings:function(){return this.getElementSettings("premium_gallery_img_content")},setMetroLayout:function(){var e=this.elements.$galleryElement,t=e.width(),a=Math.floor(t/12),t=elementorFrontend.getCurrentDeviceMode(),s="desktop"===t?"":"_"+t,o=this.getRepeaterSettings();e.find(".premium-gallery-item").each(function(e,t){var i=o[e]["premium_gallery_image_cell"+s].size,n=o[e]["premium_gallery_image_vcell"+s].size;""!==i&&null!=i||(i=o[e].premium_gallery_image_cell),""!==n&&null!=n||(n=o[e].premium_gallery_image_vcell),r(t).css({width:Math.ceil(i*a),height:Math.ceil(n*a)})}),this.settings.columnWidth=a}}),s=i.extend({getDefaultSettings:function(){return{selectors:{bannerImgWrap:".premium-banner-ib",bannerImg:"img"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$bannerImgWrap:this.$element.find(e.bannerImgWrap),$bannerImg:this.$element.find(e.bannerImg)}},bindEvents:function(){var e=this;e.elements.$bannerImgWrap.hover(function(){e.elements.$bannerImg.addClass("active")},function(){e.elements.$bannerImg.removeClass("active")}),this.run()},run:function(){var e,t=this.$element;t.hasClass("premium-banner-tilt-yes")&&(e=t.hasClass("premium-banner-tilt-rev-yes"),UniversalTilt.init({elements:t.closest(".elementor-widget"),settings:{reverse:e},callbacks:{onMouseLeave:function(e){e.style.boxShadow="0 45px 100px rgba(255, 255, 255, 0)"},onDeviceMove:function(e){e.style.boxShadow="0 45px 100px rgba(255, 255, 255, 0.3)"}}}))}}),o=i.extend({settings:{},getDefaultSettings:function(){return{selectors:{user:".fa-user",activeCat:".category.active",loading:".premium-loading-feed",blogElement:".premium-blog-wrap",blogFilterTabs:".premium-blog-filter",contentWrapper:".premium-blog-content-wrapper",blogPost:".premium-blog-post-outer-container",metaSeparators:".premium-blog-meta-separator",filterLinks:".premium-blog-filters-container li a",currentPage:".premium-blog-pagination-container .page-numbers.current",activeElememnt:".premium-blog-filters-container li .active"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$blogElement:this.$element.find(e.blogElement),$blogFilterTabs:this.$element.find(e.blogFilterTabs),$activeCat:this.$element.find(e.activeCat),$filterLinks:this.$element.find(e.filterLinks),$blogPost:this.$element.find(e.blogPost),$contentWrapper:this.$element.find(e.contentWrapper)}},bindEvents:function(){this.setLayoutSettings(),this.removeMetaSeparators(),this.run()},setLayoutSettings:function(){var e=this.getElementSettings(),t=this.elements.$blogPost,t={pageNumber:1,isLoaded:!0,count:2,equalHeight:e.force_height,layout:e.premium_blog_layout,carousel:"yes"===e.premium_blog_carousel,infinite:"yes"===e.premium_blog_infinite_scroll,scrollAfter:"yes"===e.scroll_to_offset,grid:"yes"===e.premium_blog_grid,total:t.data("total")};t.carousel&&(t.slidesToScroll=e.slides_to_scroll,t.spacing=parseInt(e.premium_blog_carousel_spacing),t.autoPlay="yes"===e.premium_blog_carousel_play,t.arrows="yes"===e.premium_blog_carousel_arrows,t.fade="yes"===e.premium_blog_carousel_fade,t.center="yes"===e.premium_blog_carousel_center,t.dots="yes"===e.premium_blog_carousel_dots,t.speed=""!==e.premium_blog_carousel_autoplay_speed?parseInt(e.premium_blog_carousel_autoplay_speed):5e3),this.settings=t},removeMetaSeparators:function(){var i=this.getSettings("selectors"),e=this.$element.find(i.blogPost),t=e.first().find(i.metaSeparators),n=e.find(i.user);1===t.length?n.length||e.find(i.metaSeparators).remove():n.length||e.each(function(e,t){r(t).find(i.metaSeparators).first().remove()})},run:function(){var e=this,t=this.elements.$blogElement,i=this.elements.$activeCat.data("filter"),n=this.elements.$blogFilterTabs.length,a=t.data("pagination");this.settings.activeCategory=i,this.settings.filterTabs=n,this.settings.filterTabs&&this.filterTabs(),this.settings.filterTabs&&"*"!==this.settings.activeCategory?this.getPostsByAjax(!1):"masonry"!==this.settings.layout||this.settings.carousel||t.imagesLoaded(function(){t.isotope(e.getIsoTopeSettings())}),this.settings.carousel&&(t.slick(this.getSlickSettings()),t.removeClass("premium-carousel-hidden")),"even"===this.settings.layout&&this.settings.equalHeight&&t.imagesLoaded(function(){e.forceEqualHeight()}),a&&this.paginate(),this.settings.infinite&&t.is(":visible")&&this.getInfiniteScrollPosts()},paginate:function(){var t=this,i=this.$element,n=this.getSettings("selectors");i.on("click",".premium-blog-pagination-container .page-numbers",function(e){e.preventDefault(),r(this).hasClass("current")||(e=parseInt(i.find(n.currentPage).html()),r(this).hasClass("next")?t.settings.pageNumber=e+1:r(this).hasClass("prev")?t.settings.pageNumber=e-1:t.settings.pageNumber=r(this).html(),t.getPostsByAjax(t.settings.scrollAfter))})},forceEqualHeight:function(){var i=new Array,e=this.getSettings("selectors").contentWrapper,e=this.$element.find(e),t=(e.each(function(e,t){t=r(t).outerHeight();i.push(t)}),Math.max.apply(null,i));e.css("height",t+"px")},getSlickSettings:function(){var e=this.settings,t=e.grid?this.getSlickCols():null,i=e.grid?t.cols:1,n=e.grid?t.colsTablet:1,t=e.grid?t.colsMobile:1,a=e.arrows?'<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Previous" role="button" style=""><i class="fas fa-angle-left" aria-hidden="true"></i></a>':"",s=e.arrows?'<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fas fa-angle-right" aria-hidden="true"></i></a>':"";return{infinite:!0,slidesToShow:i,slidesToScroll:e.slidesToScroll||i,responsive:[{breakpoint:1025,settings:{slidesToShow:n,slidesToScroll:1}},{breakpoint:768,settings:{slidesToShow:t,slidesToScroll:1}}],autoplay:e.autoPlay,rows:0,autoplaySpeed:e.speed,nextArrow:s,prevArrow:a,fade:e.fade,centerMode:e.center,centerPadding:e.spacing+"px",draggable:!0,dots:e.dots,customPaging:function(){return'<i class="fas fa-circle"></i>'}}},getSlickCols:function(){var e=this.getElementSettings(),t=e.premium_blog_columns_number,i=e.premium_blog_columns_number_tablet,e=e.premium_blog_columns_number_mobile;return{cols:parseInt(100/t.substr(0,t.indexOf("%"))),colsTablet:parseInt(100/i.substr(0,i.indexOf("%"))),colsMobile:parseInt(100/e.substr(0,e.indexOf("%")))}},getIsoTopeSettings:function(){return{itemSelector:".premium-blog-post-outer-container",percentPosition:!0,filter:this.settings.activeCategory,animationOptions:{duration:750,easing:"linear",queue:!1}}},filterTabs:function(){var t=this,i=this.getSettings("selectors");this.elements.$filterLinks.click(function(e){e.preventDefault(),t.$element.find(i.activeElememnt).removeClass("active"),r(this).addClass("active"),t.settings.activeCategory=r(this).attr("data-filter"),t.settings.pageNumber=1,t.settings.infinite?(t.getPostsByAjax(!1),t.settings.count=2,t.getInfiniteScrollPosts()):t.getPostsByAjax(t.settings.scrollAfter)})},getPostsByAjax:function(e){void 0===this.settings.activeCategory&&(this.settings.activeCategory="*");var i=this,n=this.elements.$blogElement,a=this.getSettings("selectors");r.ajax({url:PremiumSettings.ajaxurl,dataType:"json",type:"POST",data:{action:"pa_get_posts",page_id:n.data("page"),widget_id:i.$element.data("id"),page_number:i.settings.pageNumber,category:i.settings.activeCategory,nonce:PremiumSettings.nonce},beforeSend:function(){n.append('<div class="premium-loading-feed"><div class="premium-loader"></div></div>'),e&&r("html, body").animate({scrollTop:n.offset().top-50},"slow")},success:function(e){var t;e.data&&(n.find(a.loading).remove(),t=e.data.posts,e=e.data.paging,i.settings.infinite?(i.settings.isLoaded=!0,i.settings.filterTabs&&1===i.settings.pageNumber?n.html(t):n.append(t)):(n.html(t),i.$element.find(".premium-blog-footer").html(e)),i.removeMetaSeparators(),i.settings.layout&&("even"===i.settings.layout?i.settings.equalHeight&&i.forceEqualHeight():n.imagesLoaded(function(){n.isotope("reloadItems"),n.isotope({itemSelector:".premium-blog-post-outer-container",animate:!1})})))},error:function(e){console.log(e)}})},getInfiniteScrollPosts:function(){var e=jQuery(window).outerHeight()/1.25,t=this;r(window).scroll(function(){t.settings.filterTabs&&($blogPost=t.elements.$blogElement.find(".premium-blog-post-outer-container"),t.settings.total=$blogPost.data("total")),t.settings.count<=t.settings.total&&r(window).scrollTop()+e>=t.$element.find(".premium-blog-post-outer-container:last").offset().top&&1==t.settings.isLoaded&&(t.settings.pageNumber=t.settings.count,t.getPostsByAjax(!1),t.settings.count++,t.settings.isLoaded=!1)})}}),i={"premium-addon-person":i.extend({getDefaultSettings:function(){return{slick:{infinite:!0,rows:0,prevArrow:'<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Next" role="button" style=""><i class="fas fa-angle-left" aria-hidden="true"></i></a>',nextArrow:'<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fas fa-angle-right" aria-hidden="true"></i></a>',draggable:!0,pauseOnHover:!0},selectors:{multiplePersons:".multiple-persons",person:".premium-person-container",personCarousel:".premium-person-container.slick-active",personImg:".premium-person-image-container img"}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$multiplePersons:this.$element.find(e.multiplePersons),$persons:this.$element.find(e.person),$personImg:this.$element.find(e.personImg)}},bindEvents:function(){this.run()},getSlickSettings:function(){var e=this.getElementSettings(),t=this.elements.$multiplePersons.data("rtl"),i=e.persons_per_row,n=e.persons_per_row_tablet,a=e.persons_per_row_mobile;return Object.assign(this.getSettings("slick"),{slidesToShow:parseInt(100/i.substr(0,i.indexOf("%"))),slidesToScroll:parseInt(100/i.substr(0,i.indexOf("%"))),responsive:[{breakpoint:1025,settings:{slidesToShow:parseInt(100/n.substr(0,n.indexOf("%"))),slidesToScroll:1}},{breakpoint:768,settings:{slidesToShow:parseInt(100/a.substr(0,a.indexOf("%"))),slidesToScroll:1}}],autoplay:e.carousel_play,rtl:!!t,autoplaySpeed:e.speed||5e3})},runEqualHeight:function(){var e=this.elements.$persons,t=this.elements.$personImg,i=this.getSettings("selectors"),n=this.getElementSettings("carousel"),a=new Array;(e=n?this.$element.find(i.personCarousel):e).each(function(e,t){r(t).imagesLoaded(function(){}).done(function(){var e=r(t).find(i.personImg).outerHeight();a.push(e)})}),e.imagesLoaded(function(){}).done(function(){var e=Math.max.apply(null,a);t.css("height",e+"px")})},run:function(){var e=this.elements.$multiplePersons;e.length&&("yes"===e.data("persons-equal")&&this.runEqualHeight(),this.getElementSettings("carousel")&&e.slick(this.getSlickSettings()))}}),"premium-addon-blog":o,"premium-img-gallery":a,"premium-addon-banner":s};r.each({"premium-addon-dual-header.default":t,"premium-addon-video-box.default":function(l,m){var t,i,d=l.find(".premium-video-box-container"),e=l.find(".premium-video-box-playlist-container"),n=d.find(".premium-video-box-video-container"),u=d.find(".premium-video-box-inner-wrap"),c=u.find(".premium-video-box-image-container"),a=d.data("type"),s=d.data("thumbnail"),o=d.data("sticky"),r=d.data("sticky-play"),p=d.data("hover"),g=e.length?e:d,f=!!g.data("lightbox")&&g.data("lightbox");if(f)"prettyphoto"===f.type&&g.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']").prettyPhoto({theme:f.theme,hook:"data-rel",opacity:.7,show_title:!1,deeplinking:!1,overlay_gallery:!0,custom_markup:"",default_width:900,default_height:506,social_tools:""}),g.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").on("click",function(e){var t;t=g,("elementor"===f.type?t.find(".premium-video-box-video-container"):t.find(".premium-vid-lightbox-container[data-rel^='prettyPhoto']")).click()});else{if(e.length)return n.length?void n.each(function(e,t){var i=m(t),n=i.closest(".premium-video-box-container"),t=i.closest(".premium-video-box-trigger"),a=i.data("src");a+="&autoplay=1",t.on("click",function(){var e=m("<iframe/>");e.attr({src:a,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),i.css("background","#000"),i.html(e),n.find(".premium-video-box-image-container, .premium-video-box-play-icon-container").remove()})}):void 0;"self"===a?(t=n.find("video"),i=t.attr("src"),d.data("play-viewport")&&(elementorFrontend.waypoint(d,function(){h()},{offset:0,triggerOnce:!1}),d.data("play-reset")&&elementorFrontend.waypoint(d,function(e){"up"===e&&(d.removeClass("playing"),m(t).get(0).pause(),m(t).get(0).currentTime=0)},{offset:"100%",triggerOnce:!1}))):(i=n.data("src"),s&&-1===i.indexOf("autoplay=1")?i+="&autoplay=1":d.data("play-viewport")?elementorFrontend.waypoint(d,function(){h()},{offset:0}):h()),d.on("click",function(){h()}),"yes"===o&&"yes"!==r&&v()}function h(){var e;d.hasClass("playing")||(d.addClass("playing"),"yes"===r&&v(),"self"===a?(m(t).get(0).play(),n.css({opacity:"1",visibility:"visible"})):((e=m("<iframe/>")).attr({src:i,frameborder:"0",allowfullscreen:"1",allow:"autoplay;encrypted-media;"}),n.css("background","#000"),n.html(e)),d.find(".premium-video-box-image-container, .premium-video-box-play-icon-container, .premium-video-box-description-container").remove(),"vimeo"===a&&d.find(".premium-video-box-vimeo-wrap").remove())}function v(){var t,i=d.data("hide-desktop"),n=d.data("hide-tablet"),a=d.data("hide-mobile"),s=d.data("sticky-margin");function o(e){var t=elementorFrontend.getCurrentDeviceMode();""!==i&&t==i||""!==n&&t==n||""!==a&&t==a?r(e):e[0].enable()}function r(e){e[0].disable(),d.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide")}function e(){d.hasClass("premium-video-box-sticky-apply")&&u.draggable({start:function(){m(this).css({transform:"none",top:m(this).offset().top+"px",left:m(this).offset().left+"px"})},containment:"window"})}d.off("click").on("click",function(e){e=e.target.className;if(0<=e.toString().indexOf("premium-video-box-sticky-close")||0<=e.toString().indexOf("premium-video-box-sticky-close"))return!1;h()}),void 0!==elementorFrontend.waypoint&&(t=elementorFrontend.waypoint(d,function(e){"down"===e?(d.removeClass("premium-video-box-sticky-hide").addClass("premium-video-box-sticky-apply premium-video-box-filter-sticky"),l.hasClass("elementor-motion-effects-parent")&&l.removeClass("elementor-motion-effects-perspective").find(".elementor-widget-container").addClass("premium-video-box-transform"),d.data("mask")&&(l.find(".premium-video-box-mask-filter").removeClass("premium-video-box-mask-filter"),d.find(":first-child").removeClass("premium-video-box-mask-media"),c.removeClass(p).removeClass("premium-video-box-mask-media").css({transition:"width 0.2s, height 0.2s","-webkit-transition":"width 0.2s, height 0.2s"})),m(document).trigger("premium_after_sticky_applied",[l]),u.data("video-animation")&&" "!=u.data("video-animation")&&(u.css("opacity","0"),e=u.data("delay-animation"),setTimeout(function(){u.css("opacity","1").addClass("animated "+u.data("video-animation"))},1e3*e))):(d.removeClass("premium-video-box-sticky-apply premium-video-box-filter-sticky").addClass("premium-video-box-sticky-hide"),l.hasClass("elementor-motion-effects-parent")&&l.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),d.data("mask")&&(d.parent().addClass("premium-video-box-mask-filter"),d.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media")),c.addClass(p).css({transition:"all 0.2s","-webkit-transition":"all 0.2s"}),u.removeClass("animated "+u.data("video-animation")))},{offset:"0%",triggerOnce:!1})),l.find(".premium-video-box-sticky-close").off("click.closetrigger").on("click.closetrigger",function(e){e.stopPropagation(),t[0].disable(),d.removeClass("premium-video-box-sticky-apply premium-video-box-sticky-hide"),l.hasClass("elementor-motion-effects-parent")&&l.addClass("elementor-motion-effects-perspective").find(".elementor-widget-container").removeClass("premium-video-box-transform"),d.data("mask")&&(d.parent().addClass("premium-video-box-mask-filter"),d.find(":first-child").eq(0).addClass("premium-video-box-mask-media"),c.addClass("premium-video-box-mask-media"))}),o(t),e(),window.addEventListener("scroll",e),m(window).resize(function(e){o(t)}),m(document).on("premium_after_sticky_applied",function(e,t){var i=t.find(".premium-video-box-sticky-infobar");0!==i.length&&(i=i.outerHeight(),(t.hasClass("premium-video-sticky-center-left")||t.hasClass("premium-video-sticky-center-right"))&&(i=Math.ceil(i/2),u.css("top","calc( 50% - "+i+"px )")),(t.hasClass("premium-video-sticky-bottom-left")||t.hasClass("premium-video-sticky-bottom-right"))&&""!==s&&(i=Math.ceil(i),u.css("bottom",i+s)))})}},"premium-addon-fancy-text.default":function(e,t){var i=e.find(".premium-fancy-text-wrapper"),n=i.data("settings"),a=n.delay||2500,s=i.find(".premium-fancy-list-items").length,s=""!==n.count||["typing","slide","autofade"].includes(n.effect)?n.count*s:"infinite";if("typing"===n.effect){var o=[],r=(n.strings.forEach(function(e){o.push(e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"))}),"#"+i.find(".premium-fancy-text").attr("id"));new Typed(r,{strings:o,typeSpeed:n.typeSpeed,backSpeed:n.backSpeed,startDelay:n.startDelay,backDelay:n.backDelay,showCursor:n.showCursor,cursorChar:n.cursorChar,loop:n.loop})}else if("slide"===n.effect)a=n.pause,i.find(".premium-fancy-text").vTicker({speed:n.speed,showItems:n.showItems,pause:n.pause,mousePause:n.mousePause,direction:"up"});else if("auto-fade"===n.effect){var r=i.find(".premium-fancy-list-items"),l=r.length;if(0===l)return;var m=n.duration/l,d=0,a=m;r.each(function(e,t){t.style.animationDelay=d+"ms",d+=m})}else var u,c,p=i.find(".premium-fancy-list-items"),g=1,l=n.delay||2500,f=n.count,h=(f&&(u=1,c=i.find(".premium-fancy-list-items").length),setInterval(function(){var e="";"custom"===n.effect&&(e="animated "+n.animation),p.eq(g).addClass("premium-fancy-item-visible "+e).removeClass("premium-fancy-item-hidden"),p.filter(function(e){return e!==g}).addClass("premium-fancy-item-hidden").removeClass("premium-fancy-item-visible "+e),g++,p.length===g&&(g=0),f&&c*f===++u&&clearInterval(h)},l));"typing"!==n.effect&&setTimeout(function(){i.find(".premium-fancy-text").css("opacity","1")},500),"loading"===n.loading&&"typing"!==n.effect&&(e.find(".premium-fancy-text").append('<span class="premium-loading-bar"></span>'),e.find(".premium-loading-bar").css({"animation-iteration-count":s,"animation-duration":a+"ms"}))},"premium-counter.default":function(e,t){var e=e.find(".premium-counter"),i=e.closest(".premium-hscroll-temp"),n=e.data(),a=e.find(".premium-counter-init"),s=e.find(".icon");i.length?t(window).on("scroll",function(){t(window).scrollTop()>=i.data("scroll-offset")&&(t(a).numerator(n),t(s).addClass("animated "+s.data("animation")))}):elementorFrontend.waypoint(e,function(){t(a).numerator(n),t(s).addClass("animated "+s.data("animation"))})},"premium-addon-title.default":[function(e,i){var t,n,a=e.find(".premium-title-container"),s=a.find(".premium-title-text");a.hasClass("style9")&&e.find(".premium-title-style9").each(function(){var e=i(this),t=1e3*e.attr("data-blur-delay");e.attr("data-animation-blur","process"),e.find(".premium-title-style9-letter").each(function(e,t){e+=1,e=i("body").hasClass("rtl")?.2/e+"s":e/20+"s",i(t).css({"-webkit-animation-delay":e,"animation-delay":e})}),setInterval(function(){e.attr("data-animation-blur","done"),setTimeout(function(){e.attr("data-animation-blur","process")},150)},t)}),a.hasClass("style8")&&(t=1e3*s.attr("data-shiny-delay"),n=1e3*s.attr("data-shiny-dur"),function e(){s.get(0).setAttribute("data-animation","shiny"),setTimeout(function(){s.removeAttr("data-animation")},n),setTimeout(e,t)}())},t],"premium-countdown-timer.default":function(e,o){var t=e.find(".premium-countdown"),n=t.data("settings"),r=e.data("id"),e=n.label1,i=n.label2,e=e.split(","),i=i.split(","),a="evergreen"===n.timerType?n.until.date.replace(/ /g,"T"):n.until,s="",l={y:{index:0,oldVal:""},o:{index:1,oldVal:""},w:{index:2,oldVal:""},d:{index:3,oldVal:""},h:{index:4,oldVal:""},m:{index:5,oldVal:""},s:{index:6,oldVal:""}};t.find("#countdown-"+r).hasClass("premium-countdown-flip")&&n.format.split("").forEach(function(e){e=e.toLowerCase();s+='<div class="premium-countdown-block premium-countdown-'+e+'"><div class="pre_time-mid"> <div class="premium-countdown-figure"><span class="top">{'+e+'nn}</span><span class="top-back"><span>{'+e+'nn}</span></span><span class="bottom">{'+e+'nn}</span><span class="bottom-back"><span>{'+e+'nn}</span></span></div><span class="premium-countdown-label">{'+e+'l}</span></div><span class="countdown_separator">{sep}</span></div>'}),t.find("#countdown-"+r).countdown({layout:s,labels:i,labels1:e,until:new Date(a),format:n.format,padZeroes:!0,timeSeparator:n.separator,onTick:function(e){var i,a,s;i=0,t.find("#countdown-"+r+" .countdown-amount").each(function(e,t){i<o(t).outerWidth()&&(i=o(t).outerWidth())}),t.find("#countdown-"+r+" .countdown-amount").css("width",i),t.find("#countdown-"+r).hasClass("premium-countdown-flip")&&(a=e,s=l,n.format.split("").forEach(function(e){var t,e=e.toLowerCase(),i=s[e].index,n=s[e].oldVal;a[i]!==n&&(s[e].oldVal=a[i],t=o("#countdown-"+r).find(".premium-countdown-"+e+" .top"),n=o("#countdown-"+r).find(".premium-countdown-"+e+" .top-back"),TweenMax.to(t,.8,{rotationX:"-180deg",transformPerspective:300,ease:Quart.easeOut,onComplete:function(){TweenMax.set(t,{rotationX:0})}}),TweenMax.to(n,.8,{rotationX:0,transformPerspective:300,ease:Quart.easeOut,clearProps:"all"}))}))},onExpiry:function(){"onExpiry"===n.event&&t.find("#countdown-"+r).html(n.text)},serverSync:function(){return new Date(n.serverSync)}}),n.reset&&t.find(".premium-countdown-init").countdown("option","until",new Date(a)),"expiryUrl"===n.event&&t.find("#countdown-"+r).countdown("option","expiryUrl",elementorFrontend.isEditMode()?"":n.text),(times=t.find("#countdown-"+r).countdown("getTimes")).every(function(e){return 0==e})&&("onExpiry"===n.event?t.find("#countdown-"+r).html(n.text):"expiryUrl"!==n.event||elementorFrontend.isEditMode()||(0<o("body").find("#elementor").length?t.find("#countdown-"+r).html("<h1>You can not redirect url from elementor Editor!!</h1>"):elementorFrontend.isEditMode()||(window.location.href=n.text)))},"premium-carousel-widget.default":function(e,l){var t,m=e.find(".premium-carousel-wrapper"),d=l(m).data("settings"),i=elementorFrontend.isEditMode();function n(e){var t=m.find(".slick-slide");(t="init"===e?t.not(".slick-current"):t).find(".animated").each(function(e,t){var i=l(t).data("settings");i&&(i._animation||i.animation)&&(i=i._animation||i.animation,l(t).removeClass("animated "+i).addClass("elementor-invisible"))})}m.find(".item-wrapper").length<1||(i&&m.find(".item-wrapper").each(function(e,t){var i=l(t).data("template");void 0!==i&&""!==i&&l.ajax({type:"GET",url:PremiumSettings.ajaxurl,dataType:"html",data:{action:"get_elementor_template_content",templateID:i}}).success(function(e){e=JSON.parse(e).data;void 0!==e.template_content&&(l(t).html(e.template_content),m.find(".premium-carousel-inner").slick("refresh"))})}),m.on("init",function(e){e.preventDefault(),setTimeout(function(){n("init")},500),l(this).find("item-wrapper.slick-active").each(function(){var e=l(this);e.addClass(e.data("animation"))}),l(".slick-track").addClass("translate")}),m.find(".premium-carousel-inner").slick({vertical:d.vertical,slidesToScroll:d.slidesToScroll,slidesToShow:d.slidesToShow,responsive:[{breakpoint:d.tabletBreak,settings:{slidesToShow:d.slidesTab,slidesToScroll:d.slidesTab,swipe:d.touchMove}},{breakpoint:d.mobileBreak,settings:{slidesToShow:d.slidesMob,slidesToScroll:d.slidesMob,swipe:d.touchMove}}],useTransform:!0,fade:d.fade,infinite:d.infinite,speed:d.speed,autoplay:d.autoplay,autoplaySpeed:d.autoplaySpeed,rows:0,draggable:d.draggable,rtl:d.rtl,adaptiveHeight:d.adaptiveHeight,pauseOnHover:d.pauseOnHover,centerMode:d.centerMode,centerPadding:d.centerPadding,arrows:d.arrows,prevArrow:m.find(".premium-carousel-nav-arrow-prev").html(),nextArrow:m.find(".premium-carousel-nav-arrow-next").html(),dots:d.dots,variableWidth:d.variableWidth,cssEase:d.cssEase,customPaging:function(){return m.find(".premium-carousel-nav-dot").html()}}),e.find(".premium-carousel-hidden").removeClass("premium-carousel-hidden"),m.find(".premium-carousel-nav-arrow-prev").remove(),m.find(".premium-carousel-nav-arrow-next").remove(),d.variableWidth&&m.find(".elementor-container").css("flex-wrap","nowrap"),m.on("afterChange",function(e,t,i){var n,a=t.options.slidesToScroll,s=(o=(o=t).options.slidesToShow,(s=l(window).width())>d.tabletBreak&&(o=d.slidesDesk),s<=d.tabletBreak&&(o=d.slidesTab),o=s<=d.mobileBreak?d.slidesMob:o),o=t.options.centerMode,s=i+s-1;if(m.find(".slick-active .elementor-invisible").each(function(e,t){var i,n,a=l(t).data("settings");a&&(a._animation||a.animation)&&(i=a._animation_delay||0,n=a._animation||a.animation,setTimeout(function(){l(t).removeClass("elementor-invisible").addClass(n+" animated")},i))}),1===a)!0==!o&&(n=l(this).find("[data-slick-index='"+s+"']"),"null"!=d.animation&&n.find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").addClass(d.animation).removeClass("premium-carousel-content-hidden"));else for(var r=a+i;0<=r;r--)n=l(this).find("[data-slick-index='"+r+"']"),"null"!=d.animation&&n.find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").addClass(d.animation).removeClass("premium-carousel-content-hidden");t.$slides.length-1!=i||d.infinite||m.find(".premium-carousel-inner").slick("slickSetOption","autoplay",!1,!0)}),m.on("beforeChange",function(e,t,i){n();i=l(this).find("[data-slick-index='"+i+"']");"null"!=d.animation&&i.siblings().find("p, h1, h2, h3, h4, h5, h6, span, a, img, i, button").removeClass(d.animation).addClass("premium-carousel-content-hidden")}),d.vertical&&(t=-1,elementorFrontend.elements.$window.on("load",function(){m.find(".slick-slide").each(function(){l(this).height()>t&&(t=l(this).height())}),m.find(".slick-slide").each(function(){l(this).height()<t&&l(this).css("margin",Math.ceil((t-l(this).height())/2)+"px 0")})})),(i={element:l("a.ver-carousel-arrow"),getWidth:function(){return this.element.outerWidth()/2},setWidth:function(e){"vertical"==(e=e||"vertical")?this.element.css("margin-left","-"+this.getWidth()+"px"):this.element.css("margin-top","-"+this.getWidth()+"px")}}).setWidth(),i.element=l("a.carousel-arrow"),i.setWidth("horizontal"),l(document).ready(function(){d.navigation.map(function(e,t){e&&l(e).on("click",function(){var e=m.find(".premium-carousel-inner").slick("slickCurrentSlide");t!==e&&m.find(".premium-carousel-inner").slick("slickGoTo",t)})})}))},"premium-addon-modal-box.default":function(e,t){var i,n=e.find(".premium-modal-box-container"),a=n.data("settings"),s=n.find(".premium-modal-box-modal-dialog");a&&("pageload"===a.trigger&&t(document).ready(function(e){setTimeout(function(){n.find(".premium-modal-box-modal").modal()},1e3*a.delay)}),s.data("modal-animation")&&" "!=s.data("modal-animation")&&(i=s.data("delay-animation"),new Waypoint({element:s,handler:function(){setTimeout(function(){s.css("opacity","1").addClass("animated "+s.data("modal-animation"))},1e3*i),this.destroy()},offset:Waypoint.viewportHeight()-150})))},"premium-image-scroll.default":function(e,t){var i=e.find(".premium-image-scroll-container"),n=i.find(".premium-image-scroll-overlay"),e=i.find(".premium-image-scroll-vertical"),a=i.data("settings"),s=i.find("img"),o=a.direction,r=a.reverse,l=null;function m(){s.css("transform",("vertical"===o?"translateY":"translateX")+"( -"+l+"px)")}function d(){s.css("transform",("vertical"===o?"translateY":"translateX")+"(0px)")}function u(){l="vertical"===o?s.height()-i.height():s.width()-i.width()}"scroll"===a.trigger?(i.addClass("premium-container-scroll"),"vertical"===o?e.addClass("premium-image-scroll-ver"):i.imagesLoaded(function(){n.css({width:s.width(),height:s.height()})})):("yes"===r&&i.imagesLoaded(function(){i.addClass("premium-container-scroll-instant"),u(),m()}),"vertical"===o&&e.removeClass("premium-image-scroll-ver"),i.mouseenter(function(){i.removeClass("premium-container-scroll-instant"),u(),("yes"===r?d:m)()}),i.mouseleave(function(){("yes"===r?m:d)()}))},"premium-contact-form.default":function(e,t){e=e.find(".premium-cf7-container").find('input[type="text"], input[type="email"], textarea, input[type="password"], input[type="date"], input[type="number"], input[type="tel"], input[type="file"], input[type="url"]');e.wrap("<span class='wpcf7-span'>"),e.on("focus blur",function(){t(this).closest(".wpcf7-span").toggleClass("is-focused")})},"premium-icon-list.default":function(e,n){var a=e.find(".premium-bullet-list-box");a.find(".premium-bullet-list-content").each(function(e,i){a.data("list-animation")&&" "!=a.data("list-animation")&&elementorFrontend.waypoint(n(i),function(){var e=n(i),t=e.data("delay");setTimeout(function(){e.next(".premium-bullet-list-divider , .premium-bullet-list-divider-inline").css("opacity","1"),e.next(".premium-bullet-list-divider-inline , .premium-bullet-list-divider").addClass("animated "+a.data("list-animation")),e.css("opacity","1").addClass("animated "+a.data("list-animation"))},t)})})},"premium-addon-button.default":e,"premium-addon-image-button.default":e,"premium-nav-menu.default":function(s,o){s.find(".premium-nav-widget-container").removeClass("elementor-invisible");var i,r,e,t,n,a,l,m,d,u=s.find(".premium-nav-widget-container").data("settings");function c(e){var t,i,n,a;e.breakpoint>=o(window).width()&&!d?(s.find(".premium-ver-toggler").css("display","none"),s.addClass("premium-hamburger-menu"),s.find(".premium-active-menu").removeClass("premium-active-menu"),t=s.find(".premium-stretch-dropdown .premium-mobile-menu-container"),i=o(s).closest(".elementor-top-section, .e-container--row"),n=o(i).outerWidth(),a=s.offset().top,a=o(i).offset().top+o(i).outerHeight()-a,i=s.offset().left-o(i).offset().left,o(t).css({width:n+"px",left:"-"+i+"px",top:a+"px"}),isDesktopMenu=!(d=!0)):e.breakpoint<o(window).width()&&!isDesktopMenu&&(s.hasClass("premium-ver-toggle-yes")&&s.find(".premium-ver-toggler").css("display","flex"),r.removeClass("premium-toggle-opened"),s.find(".premium-mobile-menu-container .premium-active-menu").removeClass("premium-active-menu"),s.removeClass("premium-hamburger-menu premium-ham-dropdown"),s.find(".premium-vertical-toggle-open").removeClass("premium-vertical-toggle-open"),s.find(".premium-nav-default").removeClass("premium-nav-default"),isDesktopMenu=!0,d=!1)}function p(){var e,t,i;s.hasClass("premium-nav-sticky-yes")&&o("#"+u.stickyOptions.targetId).length&&!u.stickyOptions.disableOn.includes(elementorFrontend.getCurrentDeviceMode())?((n=u.stickyOptions).spacerClass="premium-sticky-spacer-"+o("#"+n.targetId).data("id"),o("#"+n.targetId).addClass("premium-sticky-active"),e=n,t=m+elementorFrontend.getCurrentDeviceMode(),(i=o("#"+e.targetId).hasClass("premium-sticky-parent"))&&o("#"+e.targetId).css({position:"relative",width:"inherit"}),window[t]=o("#"+e.targetId).outerWidth()+"px",i&&o("#"+e.targetId).css({position:"fixed",width:window[t]}),0===o("."+n.spacerClass).length&&o('<div class="'+n.spacerClass+'"></div>').insertBefore("#"+n.targetId),o(window).on("load",g),o(window).on("scroll.PaStickyNav",g)):(o(window).off("scroll.PaStickyNav"),o('<div class="'+n.spacerClass+'"></div>').remove(),o("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-active premium-sticky-parent-"+s.data("id")).css({top:"unset",width:"inherit",position:"relative"}))}function g(){var e=elementorFrontend.elements.$wpAdminBar.height()?elementorFrontend.elements.$wpAdminBar.height():0,t=o(window).scrollTop()+e,i=m+elementorFrontend.getCurrentDeviceMode();window[l]&&!a||(window[l]=o("."+n.spacerClass).offset().top,a=!1),t>=window[l]?(o("."+n.spacerClass).css("height",o("#"+n.targetId).outerHeight()+"px"),o("#"+n.targetId).addClass("premium-sticky-parent premium-sticky-parent-"+s.data("id")).css({width:window[i],top:e,position:"fixed"})):(o("."+n.spacerClass).css("height","0px"),o("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-parent-"+s.data("id")).css({top:"unset",width:"inherit",position:"relative"})),n.onScroll?(t=document.querySelector("#"+n.targetId+".premium-sticky-parent"))&&(o("#"+n.targetId+".premium-sticky-parent").addClass("premium-sticky-scroll-yes"),new Headroom(t,{tolerance:5,classes:{initial:"animated",pinned:"slideDown",unpinned:"slideUp",offset:{up:o("#"+n.targetId).outerHeight()+150}}}).init()):o("#"+n.targetId+".premium-sticky-parent").removeClass("premium-sticky-scroll-yes")}u&&(i=s.find(".premium-mobile-menu"),r=s.find(".premium-hamburger-toggle"),e=s.find(".premium-mobile-menu-close"),t=s.find(".premium-mega-content-centered"),a=!(n={}),l="stickyPos"+s.data("id"),m="stickyWidth"+s.data("id"),window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode(),t.each(function(e,t){o(t).closest(".premium-nav-menu-item").addClass("premium-mega-item-static")}),"slide"!==u.mobileLayout&&"slide"!==u.mainLayout||s.addClass("premium-ver-hamburger-menu"),d=isDesktopMenu=null,c(u),p(),e.on("click",function(){s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),r.on("click",function(){"slide"===u.mobileLayout||"slide"===u.mainLayout?s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").addClass("premium-vertical-toggle-open"):o(i).hasClass("premium-active-menu")?s.find(".premium-mobile-menu-container").slideUp("slow",function(){i.removeClass("premium-active-menu"),s.find(".premium-mobile-menu-container").show()}):i.addClass("premium-active-menu"),r.toggleClass("premium-toggle-opened")}),i.find(".premium-nav-menu-item.menu-item-has-children a, .premium-mega-nav-item a").on("click",function(e){var t;o(this).find(".premium-dropdown-icon").length<1||(t=o(this).parent(".premium-nav-menu-item"),e.stopPropagation(),e.preventDefault(),t.hasClass("premium-active-menu")?t.toggleClass("premium-active-menu"):(i.find(".premium-active-menu").toggleClass("premium-active-menu"),t.toggleClass("premium-active-menu"),o(t).parents(".premium-nav-menu-item.menu-item-has-children").toggleClass("premium-active-menu")))}),o(document).on("click",".premium-nav-slide-overlay",function(){s.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),o(document).on("click.PaCloseMegaMenu",function(e){var t=o(e.target).closest(".premium-tabs-nav-list-item").length;o(e.target).closest(".premium-nav-widget-container").length||t||o(i).hasClass("premium-active-menu")&&r.click()}),o(window).on("resize",function(){window.PaCurrStickyDevice!==elementorFrontend.getCurrentDeviceMode()&&(a=!0,window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode()),c(u),p()}),s.hasClass("premium-ver-toggle-yes")&&s.hasClass("premium-ver-click")&&s.find(".premium-ver-toggler").on("click",function(){s.find(".premium-nav-widget-container").toggleClass("premium-ver-collapsed",500)}))}},function(i,e){"object"==typeof e?r.each(e,function(e,t){elementorFrontend.hooks.addAction("frontend/element_ready/"+i,t)}):elementorFrontend.hooks.addAction("frontend/element_ready/"+i,e)}),r.each(i,function(e,t){elementorFrontend.elementsHandler.attachHandler(e,t)}),elementorFrontend.isEditMode()?elementorFrontend.hooks.addAction("frontend/element_ready/premium-addon-progressbar.default",n):elementorFrontend.hooks.addAction("frontend/element_ready/premium-addon-progressbar.default",function(e,t){var i=e.find(".premium-progressbar-container").data("settings").type;"dots"===i&&n(e,"frontend"),elementorFrontend.waypoint(e,function(){("dots"!==i?n:p)(t(this))})})})}(jQuery);
assets/frontend/min-js/premium-dis-conditions.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(window).on("elementor/frontend/init",function(){var t=(new Date).toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1],e="https:"===document.location.protocol?"secure":"";document.cookie="localTimeZone="+t+";SameSite=Strict;"+e,PremiumSettings&&(document.cookie="isReturningVisitor"+PremiumSettings.pageID+"=true;SameSite=Strict;"+e)});
1
+ jQuery(window).on("elementor/frontend/init",function(){var e=(new Date).toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1],t="https:"===document.location.protocol?"secure":"";document.cookie="localTimeZone="+e+";SameSite=Strict;"+t,elementorFrontend.config.post.id&&(document.cookie="isReturningVisitor"+elementorFrontend.config.post.id+"=true;SameSite=Strict;"+t)});
assets/frontend/min-js/premium-nav-menu.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){function i(m,s){m.find(".premium-nav-widget-container").removeClass("elementor-invisible");var t,a,e,i,n,r,o,u,l,d=m.find(".premium-nav-widget-container").data("settings");function p(e){var i,t,n,r;e.breakpoint>=s(window).width()&&!l?(m.find(".premium-ver-toggler").css("display","none"),m.addClass("premium-hamburger-menu"),m.find(".premium-active-menu").removeClass("premium-active-menu"),i=m.find(".premium-stretch-dropdown .premium-mobile-menu-container"),t=s(m).closest(".elementor-top-section"),n=s(t).outerWidth(),r=m.offset().top,r=s(t).offset().top+s(t).outerHeight()-r,t=m.offset().left-s(t).offset().left,s(i).css({width:n+"px",left:"-"+t+"px",top:r+"px"}),isDesktopMenu=!(l=!0)):e.breakpoint<s(window).width()&&!isDesktopMenu&&(m.hasClass("premium-ver-toggle-yes")&&m.find(".premium-ver-toggler").css("display","flex"),a.removeClass("premium-toggle-opened"),m.find(".premium-mobile-menu-container .premium-active-menu").removeClass("premium-active-menu"),m.removeClass("premium-hamburger-menu premium-ham-dropdown"),m.find(".premium-vertical-toggle-open").removeClass("premium-vertical-toggle-open"),m.find(".premium-nav-default").removeClass("premium-nav-default"),isDesktopMenu=!0,l=!1)}function c(){var e,i,t;m.hasClass("premium-nav-sticky-yes")&&s("#"+d.stickyOptions.targetId).length&&!d.stickyOptions.disableOn.includes(elementorFrontend.getCurrentDeviceMode())?((n=d.stickyOptions).spacerClass="premium-sticky-spacer-"+s("#"+n.targetId).data("id"),s("#"+n.targetId).addClass("premium-sticky-active"),e=n,i=u+elementorFrontend.getCurrentDeviceMode(),(t=s("#"+e.targetId).hasClass("premium-sticky-parent"))&&s("#"+e.targetId).css({position:"relative",width:"inherit"}),window[i]=s("#"+e.targetId).outerWidth()+"px",t&&s("#"+e.targetId).css({position:"fixed",width:window[i]}),0===s("."+n.spacerClass).length&&s('<div class="'+n.spacerClass+'"></div>').insertBefore("#"+n.targetId),s(window).on("load",v),s(window).on("scroll.PaStickyNav",v)):(s(window).off("scroll.PaStickyNav"),s('<div class="'+n.spacerClass+'"></div>').remove(),s("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-active premium-sticky-parent-"+m.data("id")).css({top:"unset",width:"inherit",position:"relative"}))}function v(){var e=elementorFrontend.elements.$wpAdminBar.height()?elementorFrontend.elements.$wpAdminBar.height():0,i=s(window).scrollTop()+e,t=u+elementorFrontend.getCurrentDeviceMode();window[o]&&!r||(window[o]=s("."+n.spacerClass).offset().top,r=!1),i>=window[o]?(s("."+n.spacerClass).css("height",s("#"+n.targetId).outerHeight()+"px"),s("#"+n.targetId).addClass("premium-sticky-parent premium-sticky-parent-"+m.data("id")).css({width:window[t],top:e,position:"fixed"})):(s("."+n.spacerClass).css("height","0px"),s("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-parent-"+m.data("id")).css({top:"unset",width:"inherit",position:"relative"})),n.onScroll?(i=document.querySelector("#"+n.targetId+".premium-sticky-parent"))&&(s("#"+n.targetId+".premium-sticky-parent").addClass("premium-sticky-scroll-yes"),new Headroom(i,{tolerance:5,classes:{initial:"animated",pinned:"slideDown",unpinned:"slideUp",offset:{up:s("#"+n.targetId).outerHeight()+150}}}).init()):s("#"+n.targetId+".premium-sticky-parent").removeClass("premium-sticky-scroll-yes")}d&&(t=m.find(".premium-mobile-menu"),a=m.find(".premium-hamburger-toggle"),e=m.find(".premium-mobile-menu-close"),i=m.find(".premium-mega-content-centered"),r=!(n={}),o="stickyPos"+m.data("id"),u="stickyWidth"+m.data("id"),window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode(),i.each(function(e,i){s(i).closest(".premium-nav-menu-item").addClass("premium-mega-item-static")}),"slide"!==d.mobileLayout&&"slide"!==d.mainLayout||m.addClass("premium-ver-hamburger-menu"),l=isDesktopMenu=null,p(d),c(),e.on("click",function(){m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),a.on("click",function(){"slide"===d.mobileLayout||"slide"===d.mainLayout?m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").addClass("premium-vertical-toggle-open"):s(t).hasClass("premium-active-menu")?m.find(".premium-mobile-menu-container").slideUp("slow",function(){t.removeClass("premium-active-menu"),m.find(".premium-mobile-menu-container").show()}):t.addClass("premium-active-menu"),a.toggleClass("premium-toggle-opened")}),t.find(".premium-nav-menu-item.menu-item-has-children a, .premium-mega-nav-item a").on("click",function(e){var i;s(this).find(".premium-dropdown-icon").length<1||(i=s(this).parent(".premium-nav-menu-item"),e.stopPropagation(),e.preventDefault(),i.hasClass("premium-active-menu")?i.toggleClass("premium-active-menu"):(t.find(".premium-active-menu").toggleClass("premium-active-menu"),i.toggleClass("premium-active-menu"),s(i).parents(".premium-nav-menu-item.menu-item-has-children").toggleClass("premium-active-menu")))}),s(document).on("click",".premium-nav-slide-overlay",function(){m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),s(document).on("click.PaCloseMegaMenu",function(e){var i=s(e.target).closest(".premium-tabs-nav-list-item").length;s(e.target).closest(".premium-nav-widget-container").length||i||s(t).hasClass("premium-active-menu")&&a.click()}),s(window).on("resize",function(){window.PaCurrStickyDevice!==elementorFrontend.getCurrentDeviceMode()&&(r=!0,window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode()),p(d),c()}),m.hasClass("premium-ver-toggle-yes")&&m.hasClass("premium-ver-click")&&m.find(".premium-ver-toggler").on("click",function(){m.find(".premium-nav-widget-container").toggleClass("premium-ver-collapsed",500)}))}e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/premium-nav-menu.default",i)})}(jQuery);
1
+ !function(e){function i(m,s){m.find(".premium-nav-widget-container").removeClass("elementor-invisible");var t,a,e,i,n,r,o,u,l,d=m.find(".premium-nav-widget-container").data("settings");function p(e){var i,t,n,r;e.breakpoint>=s(window).width()&&!l?(m.find(".premium-ver-toggler").css("display","none"),m.addClass("premium-hamburger-menu"),m.find(".premium-active-menu").removeClass("premium-active-menu"),i=m.find(".premium-stretch-dropdown .premium-mobile-menu-container"),t=s(m).closest(".elementor-top-section, .e-container--row"),n=s(t).outerWidth(),r=m.offset().top,r=s(t).offset().top+s(t).outerHeight()-r,t=m.offset().left-s(t).offset().left,s(i).css({width:n+"px",left:"-"+t+"px",top:r+"px"}),isDesktopMenu=!(l=!0)):e.breakpoint<s(window).width()&&!isDesktopMenu&&(m.hasClass("premium-ver-toggle-yes")&&m.find(".premium-ver-toggler").css("display","flex"),a.removeClass("premium-toggle-opened"),m.find(".premium-mobile-menu-container .premium-active-menu").removeClass("premium-active-menu"),m.removeClass("premium-hamburger-menu premium-ham-dropdown"),m.find(".premium-vertical-toggle-open").removeClass("premium-vertical-toggle-open"),m.find(".premium-nav-default").removeClass("premium-nav-default"),isDesktopMenu=!0,l=!1)}function c(){var e,i,t;m.hasClass("premium-nav-sticky-yes")&&s("#"+d.stickyOptions.targetId).length&&!d.stickyOptions.disableOn.includes(elementorFrontend.getCurrentDeviceMode())?((n=d.stickyOptions).spacerClass="premium-sticky-spacer-"+s("#"+n.targetId).data("id"),s("#"+n.targetId).addClass("premium-sticky-active"),e=n,i=u+elementorFrontend.getCurrentDeviceMode(),(t=s("#"+e.targetId).hasClass("premium-sticky-parent"))&&s("#"+e.targetId).css({position:"relative",width:"inherit"}),window[i]=s("#"+e.targetId).outerWidth()+"px",t&&s("#"+e.targetId).css({position:"fixed",width:window[i]}),0===s("."+n.spacerClass).length&&s('<div class="'+n.spacerClass+'"></div>').insertBefore("#"+n.targetId),s(window).on("load",v),s(window).on("scroll.PaStickyNav",v)):(s(window).off("scroll.PaStickyNav"),s('<div class="'+n.spacerClass+'"></div>').remove(),s("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-active premium-sticky-parent-"+m.data("id")).css({top:"unset",width:"inherit",position:"relative"}))}function v(){var e=elementorFrontend.elements.$wpAdminBar.height()?elementorFrontend.elements.$wpAdminBar.height():0,i=s(window).scrollTop()+e,t=u+elementorFrontend.getCurrentDeviceMode();window[o]&&!r||(window[o]=s("."+n.spacerClass).offset().top,r=!1),i>=window[o]?(s("."+n.spacerClass).css("height",s("#"+n.targetId).outerHeight()+"px"),s("#"+n.targetId).addClass("premium-sticky-parent premium-sticky-parent-"+m.data("id")).css({width:window[t],top:e,position:"fixed"})):(s("."+n.spacerClass).css("height","0px"),s("#"+n.targetId).removeClass("premium-sticky-parent premium-sticky-parent-"+m.data("id")).css({top:"unset",width:"inherit",position:"relative"})),n.onScroll?(i=document.querySelector("#"+n.targetId+".premium-sticky-parent"))&&(s("#"+n.targetId+".premium-sticky-parent").addClass("premium-sticky-scroll-yes"),new Headroom(i,{tolerance:5,classes:{initial:"animated",pinned:"slideDown",unpinned:"slideUp",offset:{up:s("#"+n.targetId).outerHeight()+150}}}).init()):s("#"+n.targetId+".premium-sticky-parent").removeClass("premium-sticky-scroll-yes")}d&&(t=m.find(".premium-mobile-menu"),a=m.find(".premium-hamburger-toggle"),e=m.find(".premium-mobile-menu-close"),i=m.find(".premium-mega-content-centered"),r=!(n={}),o="stickyPos"+m.data("id"),u="stickyWidth"+m.data("id"),window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode(),i.each(function(e,i){s(i).closest(".premium-nav-menu-item").addClass("premium-mega-item-static")}),"slide"!==d.mobileLayout&&"slide"!==d.mainLayout||m.addClass("premium-ver-hamburger-menu"),l=isDesktopMenu=null,p(d),c(),e.on("click",function(){m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),a.on("click",function(){"slide"===d.mobileLayout||"slide"===d.mainLayout?m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").addClass("premium-vertical-toggle-open"):s(t).hasClass("premium-active-menu")?m.find(".premium-mobile-menu-container").slideUp("slow",function(){t.removeClass("premium-active-menu"),m.find(".premium-mobile-menu-container").show()}):t.addClass("premium-active-menu"),a.toggleClass("premium-toggle-opened")}),t.find(".premium-nav-menu-item.menu-item-has-children a, .premium-mega-nav-item a").on("click",function(e){var i;s(this).find(".premium-dropdown-icon").length<1||(i=s(this).parent(".premium-nav-menu-item"),e.stopPropagation(),e.preventDefault(),i.hasClass("premium-active-menu")?i.toggleClass("premium-active-menu"):(t.find(".premium-active-menu").toggleClass("premium-active-menu"),i.toggleClass("premium-active-menu"),s(i).parents(".premium-nav-menu-item.menu-item-has-children").toggleClass("premium-active-menu")))}),s(document).on("click",".premium-nav-slide-overlay",function(){m.find(".premium-mobile-menu-outer-container, .premium-nav-slide-overlay").removeClass("premium-vertical-toggle-open")}),s(document).on("click.PaCloseMegaMenu",function(e){var i=s(e.target).closest(".premium-tabs-nav-list-item").length;s(e.target).closest(".premium-nav-widget-container").length||i||s(t).hasClass("premium-active-menu")&&a.click()}),s(window).on("resize",function(){window.PaCurrStickyDevice!==elementorFrontend.getCurrentDeviceMode()&&(r=!0,window.PaCurrStickyDevice=elementorFrontend.getCurrentDeviceMode()),p(d),c()}),m.hasClass("premium-ver-toggle-yes")&&m.hasClass("premium-ver-click")&&m.find(".premium-ver-toggler").on("click",function(){m.find(".premium-nav-widget-container").toggleClass("premium-ver-collapsed",500)}))}e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/premium-nav-menu.default",i)})}(jQuery);
includes/addons-integration.php CHANGED
@@ -1,1116 +1,1126 @@
1
- <?php
2
- /**
3
- * Addons Integration.
4
- */
5
-
6
- namespace PremiumAddons\Includes;
7
-
8
- use PremiumAddons\Includes\Helper_Functions;
9
- use PremiumAddons\Admin\Includes\Admin_Helper;
10
- use PremiumAddons\Modules\Premium_Equal_Height\Module as Equal_Height;
11
- use PremiumAddons\Modules\PA_Display_Conditions\Module as Display_Conditions;
12
- use PremiumAddons\Modules\PremiumSectionFloatingEffects\Module as Floating_Effects;
13
- use PremiumAddons\Modules\Woocommerce\Module as Woocommerce;
14
- use PremiumAddons\Includes\Assets_Manager;
15
- use PremiumAddons\Includes\Premium_Template_Tags;
16
-
17
- if ( ! defined( 'ABSPATH' ) ) {
18
- exit();
19
- }
20
-
21
- /**
22
- * Class Addons_Integration.
23
- */
24
- class Addons_Integration {
25
-
26
- /**
27
- * Class instance
28
- *
29
- * @var instance
30
- */
31
- private static $instance = null;
32
-
33
- /**
34
- * Modules
35
- *
36
- * @var modules
37
- */
38
- private static $modules = null;
39
-
40
- /**
41
- * Maps Keys
42
- *
43
- * @var maps
44
- */
45
- private static $maps = null;
46
-
47
- /**
48
- * Template Instance
49
- *
50
- * @var template_instance
51
- */
52
- protected $template_instance;
53
-
54
- /**
55
- * Cross-Site CDN URL.
56
- *
57
- * @since 4.0.0
58
- * @var (String) URL
59
- */
60
- public $cdn_url;
61
-
62
- /**
63
- * Initialize integration hooks
64
- *
65
- * @return void
66
- */
67
- public function __construct() {
68
-
69
- self::$modules = Admin_Helper::get_enabled_elements();
70
-
71
- self::$maps = Admin_Helper::get_integrations_settings();
72
-
73
- $this->template_instance = Premium_Template_Tags::getInstance();
74
-
75
- add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'enqueue_editor_styles' ) );
76
-
77
- add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_area' ) );
78
-
79
- add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'load_live_editor_modal' ) );
80
-
81
- add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'live_editor_enqueue' ) );
82
-
83
- add_action( 'wp_ajax_handle_live_editor', array( $this, 'handle_live_editor' ) );
84
-
85
- add_action( 'wp_ajax_check_temp_validity', array( $this, 'check_temp_validity' ) );
86
-
87
- add_action( 'wp_ajax_update_template_title', array( $this, 'update_template_title' ) );
88
-
89
- add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'enqueue_editor_scripts' ) );
90
-
91
- add_action( 'elementor/preview/enqueue_styles', array( $this, 'enqueue_preview_styles' ) );
92
-
93
- add_action( 'elementor/frontend/after_register_styles', array( $this, 'register_frontend_styles' ) );
94
-
95
- add_action( 'elementor/frontend/after_register_scripts', array( $this, 'register_frontend_scripts' ) );
96
-
97
- add_action( 'wp_ajax_get_elementor_template_content', array( $this, 'get_template_content' ) );
98
-
99
- if ( self::$modules['premium-equal-height'] || self::$modules['premium-blog'] || self::$modules['pa-display-conditions'] ) {
100
-
101
- add_action( 'elementor/controls/controls_registered', array( $this, 'init_pa_controls' ) );
102
-
103
- add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'after_enqueue_scripts' ) );
104
-
105
- }
106
-
107
- $this->load_pa_extensions();
108
-
109
- $cross_enabled = isset( self::$modules['premium-cross-domain'] ) ? self::$modules['premium-cross-domain'] : 1;
110
-
111
- if ( $cross_enabled ) {
112
-
113
- add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'enqueue_editor_cp_scripts' ), 99 );
114
-
115
- Addons_Cross_CP::get_instance();
116
-
117
- }
118
-
119
- }
120
-
121
- /**
122
- * Live Editor Enqueue.
123
- *
124
- * @access public
125
- * @since 4.8.10
126
- */
127
- public function live_editor_enqueue() {
128
-
129
- wp_enqueue_script(
130
- 'live-editor-js',
131
- PREMIUM_ADDONS_URL . 'assets/editor/js/live-editor.js',
132
- array( 'elementor-editor', 'jquery' ),
133
- PREMIUM_ADDONS_VERSION,
134
- true
135
- );
136
-
137
- $live_editor_data = array(
138
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
139
- 'nonce' => wp_create_nonce( 'pa-live-editor' ),
140
- );
141
-
142
- wp_localize_script( 'live-editor-js', 'liveEditor', $live_editor_data );
143
-
144
- }
145
-
146
- /**
147
- * Update Template Title.
148
- *
149
- * @access public
150
- * @since 4.8.10
151
- */
152
- public function update_template_title() {
153
- check_ajax_referer( 'pa-live-editor', 'security' );
154
-
155
- if ( ! isset( $_POST['title'] ) || ! isset( $_POST['id'] ) ) {
156
- wp_send_json_error();
157
- }
158
-
159
- $res = wp_update_post(
160
- array(
161
- 'ID' => sanitize_text_field( wp_unslash( $_POST['id'] ) ),
162
- 'post_title' => sanitize_text_field( wp_unslash( $_POST['title'] ) ),
163
- )
164
- );
165
-
166
- wp_send_json_success( $res );
167
- }
168
-
169
- /**
170
- * Check Temp Validity.
171
- * Checks if the template is valid ( has content) or not,
172
- * And DELETE the post if it's invalid.
173
- *
174
- * @access public
175
- * @since 4.9.1
176
- */
177
- public function check_temp_validity() {
178
-
179
- check_ajax_referer( 'pa-live-editor', 'security' );
180
-
181
- if ( ! isset( $_POST['templateID'] ) ) {
182
- wp_send_json_error( 'template ID is not set' );
183
- }
184
-
185
- $temp_id = sanitize_text_field( wp_unslash( $_POST['templateID'] ) );
186
-
187
- $template_content = $this->template_instance->get_template_content( $temp_id, true );
188
-
189
- if ( empty( $template_content ) || ! isset( $template_content ) ) {
190
-
191
- $res = wp_delete_post( $temp_id, true );
192
-
193
- if ( ! is_wp_error( $res ) ) {
194
- $res = 'Template Deleted.';
195
- }
196
- } else {
197
- $res = 'Template Has Content.';
198
- }
199
-
200
- wp_send_json_success( $res );
201
- }
202
-
203
- /**
204
- * Handle Live Editor Modal.
205
- *
206
- * @access public
207
- * @since 4.8.10
208
- */
209
- public function handle_live_editor() {
210
-
211
- check_ajax_referer( 'pa-live-editor', 'security' );
212
-
213
- if ( ! isset( $_POST['key'] ) ) {
214
- wp_send_json_error();
215
- }
216
-
217
- $post_name = 'pa-dynamic-temp-' . sanitize_text_field( wp_unslash( $_POST['key'] ) );
218
- $post_title = '';
219
- $args = array(
220
- 'post_type' => 'elementor_library',
221
- 'name' => $post_name,
222
- 'post_status' => 'publish',
223
- 'update_post_term_cache' => false,
224
- 'update_post_meta_cache' => false,
225
- 'posts_per_page' => 1,
226
- );
227
-
228
- $post = get_posts( $args );
229
-
230
- if ( empty( $post ) ) { // create a new one.
231
-
232
- $key = sanitize_text_field( wp_unslash( $_POST['key'] ) );
233
- $post_title = 'PA Template | #' . substr( md5( $key ), 0, 4 );
234
-
235
- $params = array(
236
- 'post_content' => '',
237
- 'post_type' => 'elementor_library',
238
- 'post_title' => $post_title,
239
- 'post_name' => $post_name,
240
- 'post_status' => 'publish',
241
- 'meta_input' => array(
242
- '_elementor_edit_mode' => 'builder',
243
- '_elementor_template_type' => 'page',
244
- '_wp_page_template' => 'elementor_canvas',
245
- ),
246
- );
247
-
248
- $post_id = wp_insert_post( $params );
249
-
250
- } else { // edit post.
251
- $post_id = $post[0]->ID;
252
- $post_title = $post[0]->post_title;
253
- }
254
-
255
- $edit_url = get_admin_url() . '/post.php?post=' . $post_id . '&action=elementor';
256
-
257
- $result = array(
258
- 'url' => $edit_url,
259
- 'id' => $post_id,
260
- 'title' => $post_title,
261
- );
262
-
263
- wp_send_json_success( $result );
264
- }
265
-
266
- /**
267
- * Load Live Editor Modal.
268
- * Puts live editor popup html into the editor.
269
- *
270
- * @access public
271
- * @since 4.8.10
272
- */
273
- public function load_live_editor_modal() {
274
- ob_start();
275
- include_once PREMIUM_ADDONS_PATH . 'includes/live-editor-modal.php';
276
- $output = ob_get_contents();
277
- ob_end_clean();
278
- echo $output;
279
- }
280
-
281
-
282
- /**
283
- * After Enquque Scripts
284
- *
285
- * Loads editor scripts for our controls.
286
- *
287
- * @access public
288
- * @return void
289
- */
290
- public function after_enqueue_scripts() {
291
-
292
- wp_enqueue_script(
293
- 'pa-eq-editor',
294
- PREMIUM_ADDONS_URL . 'assets/editor/js/editor.js',
295
- array( 'elementor-editor', 'jquery' ),
296
- PREMIUM_ADDONS_VERSION,
297
- true
298
- );
299
-
300
- if ( self::$modules['premium-blog'] || self::$modules['pa-display-conditions'] ) {
301
- wp_localize_script(
302
- 'pa-eq-editor',
303
- 'PremiumSettings',
304
- array(
305
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
306
- 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
307
- )
308
- );
309
- }
310
-
311
- wp_localize_script(
312
- 'pa-eq-editor',
313
- 'PremiumPanelSettings',
314
- array(
315
- 'papro_installed' => Helper_Functions::check_papro_version(),
316
- 'papro_widgets' => Admin_Helper::get_pro_elements(),
317
- )
318
- );
319
-
320
- }
321
-
322
- /**
323
- * Loads plugin icons font
324
- *
325
- * @since 1.0.0
326
- * @access public
327
- * @return void
328
- */
329
- public function enqueue_editor_styles() {
330
-
331
- $theme = Helper_Functions::get_elementor_ui_theme();
332
-
333
- wp_enqueue_style(
334
- 'pa-editor',
335
- PREMIUM_ADDONS_URL . 'assets/editor/css/style.css',
336
- array(),
337
- PREMIUM_ADDONS_VERSION
338
- );
339
-
340
- // Enqueue required style for Elementor dark UI Theme.
341
- if ( 'dark' === $theme ) {
342
-
343
- wp_add_inline_style(
344
- 'pa-editor',
345
- '.elementor-panel .elementor-control-section_pa_docs .elementor-panel-heading-title.elementor-panel-heading-title,
346
- .elementor-control-raw-html.editor-pa-doc a {
347
- color: #e0e1e3 !important;
348
- }
349
- [class^="pa-"]::after,
350
- [class*=" pa-"]::after {
351
- color: #aaa;
352
- opacity: 1 !important;
353
- }
354
- .premium-promotion-dialog .premium-promotion-btn {
355
- background-color: #202124 !important
356
- }'
357
- );
358
-
359
- }
360
-
361
- $badge_text = Helper_Functions::get_badge();
362
-
363
- $dynamic_css = sprintf( '#elementor-panel [class^="pa-"]::after, #elementor-panel [class*=" pa-"]::after { content: "%s"; }', $badge_text );
364
-
365
- wp_add_inline_style( 'pa-editor', $dynamic_css );
366
-
367
- }
368
-
369
- /**
370
- * Register Frontend CSS files
371
- *
372
- * @since 2.9.0
373
- * @access public
374
- */
375
- public function register_frontend_styles() {
376
-
377
- $dir = Helper_Functions::get_styles_dir();
378
- $suffix = Helper_Functions::get_assets_suffix();
379
-
380
- $is_rtl = is_rtl() ? '-rtl' : '';
381
-
382
- wp_register_style(
383
- 'font-awesome-5-all',
384
- ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
385
- false,
386
- PREMIUM_ADDONS_VERSION
387
- );
388
-
389
- wp_register_style(
390
- 'pa-prettyphoto',
391
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/prettyphoto' . $is_rtl . $suffix . '.css',
392
- array(),
393
- PREMIUM_ADDONS_VERSION,
394
- 'all'
395
- );
396
-
397
- wp_register_style(
398
- 'pa-slick',
399
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/slick' . $is_rtl . $suffix . '.css',
400
- array(),
401
- PREMIUM_ADDONS_VERSION,
402
- 'all'
403
- );
404
-
405
- $assets_gen_enabled = self::$modules['premium-assets-generator'] ? true : false;
406
-
407
- $type = get_post_type();
408
-
409
- if ( $assets_gen_enabled && ( 'page' === $type || 'post' === $type ) ) {
410
-
411
- $css_path = '/pa-frontend' . $is_rtl . '-' . Assets_Manager::$post_id . $suffix . '.css';
412
-
413
- if ( Assets_Manager::$is_updated && file_exists( PREMIUM_ASSETS_PATH . $css_path ) ) {
414
- wp_enqueue_style(
415
- 'pa-frontend',
416
- PREMIUM_ASSETS_URL . $css_path,
417
- array(),
418
- time(),
419
- 'all'
420
- );
421
- }
422
- }
423
-
424
- // If the assets are not ready, or file does not exist for any reson.
425
- if ( ! wp_style_is( 'pa-frontend', 'enqueued' ) ) {
426
- $this->register_old_styles( $dir, $is_rtl, $suffix );
427
- }
428
-
429
- }
430
-
431
- /**
432
- * Register Old Styles
433
- *
434
- * @since 4.9.0
435
- * @access public
436
- *
437
- * @param string $directory style directory.
438
- * @param string $is_rtl page direction.
439
- * @param string $suffix file suffix.
440
- */
441
- public function register_old_styles( $directory, $is_rtl, $suffix ) {
442
-
443
- wp_register_style(
444
- 'premium-addons',
445
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-addons' . $is_rtl . $suffix . '.css',
446
- array(),
447
- PREMIUM_ADDONS_VERSION,
448
- 'all'
449
- );
450
-
451
- }
452
-
453
- /**
454
- * Registers required JS files
455
- *
456
- * @since 1.0.0
457
- * @access public
458
- */
459
- public function register_frontend_scripts() {
460
-
461
- $maps_settings = self::$maps;
462
-
463
- $dir = Helper_Functions::get_scripts_dir();
464
- $suffix = Helper_Functions::get_assets_suffix();
465
-
466
- $locale = isset( $maps_settings['premium-map-locale'] ) ? $maps_settings['premium-map-locale'] : 'en';
467
- $assets_gen_enabled = self::$modules['premium-assets-generator'] ? true : false;
468
-
469
- $type = get_post_type();
470
-
471
- if ( $assets_gen_enabled && ( 'page' === $type || 'post' === $type ) ) {
472
-
473
- // If the elemens are cached and ready to generate.
474
- if ( Assets_Manager::$is_updated ) {
475
- Assets_Manager::generate_asset_file( 'js' );
476
- Assets_Manager::generate_asset_file( 'css' );
477
- }
478
-
479
- $js_path = '/pa-frontend-' . Assets_Manager::$post_id . $suffix . '.js';
480
-
481
- if ( file_exists( PREMIUM_ASSETS_PATH . $js_path ) ) {
482
-
483
- wp_enqueue_script(
484
- 'pa-frontend',
485
- PREMIUM_ASSETS_URL . $js_path,
486
- array( 'jquery' ),
487
- time(),
488
- true
489
- );
490
-
491
- wp_localize_script(
492
- 'pa-frontend',
493
- 'PremiumSettings',
494
- array(
495
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
496
- 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
497
- )
498
- );
499
-
500
- if ( class_exists( 'woocommerce' ) ) {
501
- wp_localize_script(
502
- 'pa-frontend',
503
- 'PremiumWooSettings',
504
- array(
505
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
506
- 'products_nonce' => wp_create_nonce( 'pa-woo-products-nonce' ),
507
- 'qv_nonce' => wp_create_nonce( 'pa-woo-qv-nonce' ),
508
- 'cta_nonce' => wp_create_nonce( 'pa-woo-cta-nonce' ),
509
- 'woo_cart_url' => get_permalink( wc_get_page_id( 'cart' ) ),
510
- )
511
- );
512
- }
513
- }
514
- }
515
-
516
- // If the assets are not ready, or file does not exist for any reson.
517
- if ( ! wp_script_is( 'pa-frontend', 'enqueued' ) ) {
518
- $this->register_old_scripts( $dir, $suffix );
519
- }
520
-
521
- wp_register_script(
522
- 'prettyPhoto-js',
523
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/prettyPhoto' . $suffix . '.js',
524
- array( 'jquery' ),
525
- PREMIUM_ADDONS_VERSION,
526
- true
527
- );
528
-
529
- wp_register_script(
530
- 'pa-vticker',
531
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/vticker' . $suffix . '.js',
532
- array( 'jquery' ),
533
- PREMIUM_ADDONS_VERSION,
534
- true
535
- );
536
-
537
- wp_register_script(
538
- 'pa-typed',
539
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/typed' . $suffix . '.js',
540
- array( 'jquery' ),
541
- PREMIUM_ADDONS_VERSION,
542
- true
543
- );
544
-
545
- wp_register_script(
546
- 'pa-countdown',
547
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/jquery-countdown' . $suffix . '.js',
548
- array( 'jquery' ),
549
- PREMIUM_ADDONS_VERSION,
550
- true
551
- );
552
-
553
- wp_register_script(
554
- 'isotope-js',
555
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/isotope' . $suffix . '.js',
556
- array( 'jquery' ),
557
- PREMIUM_ADDONS_VERSION,
558
- true
559
- );
560
-
561
- wp_register_script(
562
- 'pa-modal',
563
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/modal' . $suffix . '.js',
564
- array( 'jquery' ),
565
- PREMIUM_ADDONS_VERSION,
566
- true
567
- );
568
-
569
- wp_register_script(
570
- 'pa-maps',
571
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-maps' . $suffix . '.js',
572
- array( 'jquery', 'pa-maps-api' ),
573
- PREMIUM_ADDONS_VERSION,
574
- true
575
- );
576
-
577
- wp_register_script(
578
- 'pa-vscroll',
579
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-vscroll' . $suffix . '.js',
580
- array( 'jquery' ),
581
- PREMIUM_ADDONS_VERSION,
582
- true
583
- );
584
-
585
- wp_register_script(
586
- 'pa-slimscroll',
587
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/jquery-slimscroll' . $suffix . '.js',
588
- array( 'jquery' ),
589
- PREMIUM_ADDONS_VERSION,
590
- true
591
- );
592
-
593
- wp_register_script(
594
- 'pa-iscroll',
595
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/iscroll' . $suffix . '.js',
596
- array( 'jquery' ),
597
- PREMIUM_ADDONS_VERSION,
598
- true
599
- );
600
-
601
- wp_register_script(
602
- 'tilt-js',
603
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/universal-tilt' . $suffix . '.js',
604
- array( 'jquery' ),
605
- PREMIUM_ADDONS_VERSION,
606
- true
607
- );
608
-
609
- wp_register_script(
610
- 'lottie-js',
611
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/lottie' . $suffix . '.js',
612
- array(
613
- 'jquery',
614
- 'elementor-waypoints',
615
- ),
616
- PREMIUM_ADDONS_VERSION,
617
- true
618
- );
619
-
620
- wp_register_script(
621
- 'pa-tweenmax',
622
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/TweenMax' . $suffix . '.js',
623
- array( 'jquery' ),
624
- PREMIUM_ADDONS_VERSION,
625
- true
626
- );
627
-
628
- wp_register_script(
629
- 'pa-headroom',
630
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/headroom' . $suffix . '.js',
631
- array( 'jquery' ),
632
- PREMIUM_ADDONS_VERSION
633
- // true
634
- );
635
-
636
- if ( $maps_settings['premium-map-cluster'] ) {
637
- wp_register_script(
638
- 'google-maps-cluster',
639
- 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js',
640
- array(),
641
- PREMIUM_ADDONS_VERSION,
642
- false
643
- );
644
- }
645
-
646
- if ( $maps_settings['premium-map-disable-api'] && '1' !== $maps_settings['premium-map-api'] ) {
647
- $api = sprintf( 'https://maps.googleapis.com/maps/api/js?key=%1$s&language=%2$s', $maps_settings['premium-map-api'], $locale );
648
- wp_register_script(
649
- 'pa-maps-api',
650
- $api,
651
- array(),
652
- PREMIUM_ADDONS_VERSION,
653
- false
654
- );
655
- }
656
-
657
- wp_register_script(
658
- 'pa-slick',
659
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/slick' . $suffix . '.js',
660
- array( 'jquery' ),
661
- PREMIUM_ADDONS_VERSION,
662
- true
663
- );
664
-
665
- wp_register_script(
666
- 'pa-anime',
667
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/anime' . $suffix . '.js',
668
- array( 'jquery' ),
669
- PREMIUM_ADDONS_VERSION,
670
- true
671
- );
672
-
673
- wp_register_script(
674
- 'pa-feffects',
675
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-floating-effects' . $suffix . '.js',
676
- array( 'jquery' ),
677
- PREMIUM_ADDONS_VERSION,
678
- true
679
- );
680
-
681
- wp_localize_script(
682
- 'premium-addons',
683
- 'PremiumSettings',
684
- array(
685
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
686
- 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
687
- )
688
- );
689
-
690
- wp_register_script(
691
- 'pa-eq-height',
692
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-eq-height' . $suffix . '.js',
693
- array( 'jquery' ),
694
- PREMIUM_ADDONS_VERSION,
695
- true
696
- );
697
-
698
- wp_register_script(
699
- 'pa-dis-conditions',
700
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-dis-conditions' . $suffix . '.js',
701
- array( 'jquery' ),
702
- PREMIUM_ADDONS_VERSION,
703
- true
704
- );
705
-
706
- // Localize jQuery with required data for Global Add-ons.
707
- if ( self::$modules['premium-floating-effects'] ) {
708
- wp_localize_script(
709
- 'pa-feffects',
710
- 'PremiumFESettings',
711
- array(
712
- 'papro_installed' => Helper_Functions::check_papro_version(),
713
- )
714
- );
715
- }
716
-
717
- }
718
-
719
- /**
720
- * Register Old Scripts
721
- *
722
- * @since 4.9.0
723
- * @access public
724
- *
725
- * @param string $directory script directory.
726
- * @param string $suffix file suffix.
727
- */
728
- public function register_old_scripts( $directory, $suffix ) {
729
-
730
- wp_register_script(
731
- 'premium-addons',
732
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-addons' . $suffix . '.js',
733
- array( 'jquery' ),
734
- PREMIUM_ADDONS_VERSION,
735
- true
736
- );
737
-
738
- // We need to make sure premium-woocommerce.js will not be loaded twice if assets are generated.
739
- if ( class_exists( 'woocommerce' ) ) {
740
- wp_register_script(
741
- 'premium-woocommerce',
742
- PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-woo-products' . $suffix . '.js',
743
- array( 'jquery' ),
744
- PREMIUM_ADDONS_VERSION,
745
- true
746
- );
747
-
748
- wp_localize_script(
749
- 'premium-woocommerce',
750
- 'PremiumWooSettings',
751
- array(
752
- 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
753
- 'products_nonce' => wp_create_nonce( 'pa-woo-products-nonce' ),
754
- 'qv_nonce' => wp_create_nonce( 'pa-woo-qv-nonce' ),
755
- 'cta_nonce' => wp_create_nonce( 'pa-woo-cta-nonce' ),
756
- 'woo_cart_url' => get_permalink( wc_get_page_id( 'cart' ) ),
757
- )
758
- );
759
- }
760
-
761
- }
762
-
763
- /**
764
- * Enqueue Preview CSS files
765
- *
766
- * @since 2.9.0
767
- * @access public
768
- */
769
- public function enqueue_preview_styles() {
770
-
771
- wp_enqueue_style( 'pa-prettyphoto' );
772
-
773
- wp_enqueue_style( 'premium-addons' );
774
-
775
- wp_enqueue_style( 'pa-slick' );
776
-
777
- }
778
-
779
- /**
780
- * Load widgets require function
781
- *
782
- * @since 1.0.0
783
- * @access public
784
- */
785
- public function widgets_area() {
786
- $this->widgets_register();
787
- }
788
-
789
- /**
790
- * Requires widgets files
791
- *
792
- * @since 1.0.0
793
- * @access private
794
- */
795
- private function widgets_register() {
796
-
797
- $enabled_elements = self::$modules;
798
-
799
- foreach ( glob( PREMIUM_ADDONS_PATH . 'widgets/*.php' ) as $file ) {
800
-
801
- $slug = basename( $file, '.php' );
802
-
803
- // Fixes the conflict between Lottie widget/addon keys.
804
- if ( 'premium-lottie' === $slug ) {
805
-
806
- // Check if Lottie widget switcher value was saved before.
807
- $saved_options = get_option( 'pa_save_settings' );
808
-
809
- $slug = 'premium-lottie-widget';
810
-
811
- }
812
-
813
- $enabled = isset( $enabled_elements[ $slug ] ) ? $enabled_elements[ $slug ] : '';
814
-
815
- if ( filter_var( $enabled, FILTER_VALIDATE_BOOLEAN ) || ! $enabled_elements ) {
816
- $this->register_addon( $file );
817
- }
818
- }
819
-
820
- }
821
-
822
- /**
823
- * Register Woocommerce Widgets.
824
- *
825
- * @since 4.0.0
826
- * @access private
827
- */
828
- private function woo_widgets_register() {
829
-
830
- $enabled_elements = self::$modules;
831
-
832
- foreach ( glob( PREMIUM_ADDONS_PATH . 'modules/woocommerce/widgets/*.php' ) as $file ) {
833
-
834
- $slug = basename( $file, '.php' );
835
-
836
- $enabled = isset( $enabled_elements[ $slug ] ) ? $enabled_elements[ $slug ] : '';
837
-
838
- if ( filter_var( $enabled, FILTER_VALIDATE_BOOLEAN ) || ! $enabled_elements ) {
839
-
840
- $this->register_addon( $file );
841
- }
842
- }
843
- }
844
-
845
- /**
846
- * Enqueue editor scripts
847
- *
848
- * @since 3.2.5
849
- * @access public
850
- */
851
- public function enqueue_editor_scripts() {
852
-
853
- $map_enabled = isset( self::$modules['premium-maps'] ) ? self::$modules['premium-maps'] : 1;
854
-
855
- if ( $map_enabled ) {
856
-
857
- $premium_maps_api = self::$maps['premium-map-api'];
858
-
859
- $locale = isset( self::$maps['premium-map-locale'] ) ? self::$maps['premium-map-locale'] : 'en';
860
-
861
- $disable_api = self::$maps['premium-map-disable-api'];
862
-
863
- if ( $disable_api && '1' !== $premium_maps_api ) {
864
-
865
- $api = sprintf( 'https://maps.googleapis.com/maps/api/js?key=%1$s&language=%2$s', $premium_maps_api, $locale );
866
- wp_enqueue_script(
867
- 'pa-maps-api',
868
- $api,
869
- array(),
870
- PREMIUM_ADDONS_VERSION,
871
- false
872
- );
873
-
874
- }
875
-
876
- wp_enqueue_script(
877
- 'pa-maps-finder',
878
- PREMIUM_ADDONS_URL . 'assets/editor/js/pa-maps-finder.js',
879
- array( 'jquery' ),
880
- PREMIUM_ADDONS_VERSION,
881
- true
882
- );
883
-
884
- }
885
-
886
- }
887
-
888
- /**
889
- * Load Cross Domain Copy Paste JS Files.
890
- *
891
- * @since 3.21.1
892
- */
893
- public function enqueue_editor_cp_scripts() {
894
-
895
- wp_enqueue_script(
896
- 'premium-xdlocalstorage-js',
897
- PREMIUM_ADDONS_URL . 'assets/editor/js/xdlocalstorage.js',
898
- null,
899
- PREMIUM_ADDONS_VERSION,
900
- true
901
- );
902
-
903
- wp_enqueue_script(
904
- 'premium-cross-cp',
905
- PREMIUM_ADDONS_URL . 'assets/editor/js/premium-cross-cp.js',
906
- array( 'jquery', 'elementor-editor', 'premium-xdlocalstorage-js' ),
907
- PREMIUM_ADDONS_VERSION,
908
- true
909
- );
910
-
911
- // Check for required Compatible Elementor version.
912
- if ( ! version_compare( ELEMENTOR_VERSION, '3.1.0', '>=' ) ) {
913
- $elementor_old = true;
914
- } else {
915
- $elementor_old = false;
916
- }
917
-
918
- wp_localize_script(
919
- 'jquery',
920
- 'premium_cross_cp',
921
- array(
922
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
923
- 'nonce' => wp_create_nonce( 'premium_cross_cp_import' ),
924
- 'elementorCompatible' => $elementor_old,
925
- )
926
- );
927
- }
928
-
929
- /**
930
- * Get Template Content
931
- *
932
- * Get Elementor template HTML content.
933
- *
934
- * @since 3.2.6
935
- * @access public
936
- */
937
- public function get_template_content() {
938
-
939
- $template = isset( $_GET['templateID'] ) ? sanitize_text_field( wp_unslash( $_GET['templateID'] ) ) : '';
940
-
941
- if ( empty( $template ) ) {
942
- wp_send_json_error( '' );
943
- }
944
-
945
- $template_content = $this->template_instance->get_template_content( $template );
946
-
947
- if ( empty( $template_content ) || ! isset( $template_content ) ) {
948
- wp_send_json_error( '' );
949
- }
950
-
951
- $data = array(
952
- 'template_content' => $template_content,
953
- );
954
-
955
- wp_send_json_success( $data );
956
- }
957
-
958
- /**
959
- *
960
- * Register addon by file name.
961
- *
962
- * @access public
963
- *
964
- * @param string $file File name.
965
- *
966
- * @return void
967
- */
968
- public function register_addon( $file ) {
969
-
970
- $widget_manager = \Elementor\Plugin::instance()->widgets_manager;
971
-
972
- $base = basename( str_replace( '.php', '', $file ) );
973
- $class = ucwords( str_replace( '-', ' ', $base ) );
974
- $class = str_replace( ' ', '_', $class );
975
- $class = sprintf( 'PremiumAddons\Widgets\%s', $class );
976
-
977
- if ( 'PremiumAddons\Widgets\Premium_Contactform' !== $class ) {
978
- require $file;
979
- } else {
980
- if ( function_exists( 'wpcf7' ) ) {
981
- require $file;
982
- }
983
- }
984
-
985
- if ( 'PremiumAddons\Widgets\Premium_Videobox' === $class ) {
986
- require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
987
- }
988
-
989
- if ( class_exists( $class, false ) ) {
990
- $widget_manager->register_widget_type( new $class() );
991
- }
992
- }
993
-
994
- /**
995
- * Registers Premium Addons Custom Controls.
996
- *
997
- * @since 4.2.5
998
- * @access public
999
- *
1000
- * @return void
1001
- */
1002
- public function init_pa_controls() {
1003
-
1004
- $control_manager = \Elementor\Plugin::instance();
1005
-
1006
- if ( version_compare( ELEMENTOR_VERSION, '3.6.0', '>=' ) ) {
1007
-
1008
- // TODO: NEEDS TO BE DYNAMIC.
1009
- if ( self::$modules['premium-equal-height'] ) {
1010
-
1011
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-select.php';
1012
- $premium_select = __NAMESPACE__ . '\Controls\Premium_Select';
1013
- $control_manager->controls_manager->register( new $premium_select() );
1014
-
1015
- }
1016
-
1017
- if ( self::$modules['premium-blog'] ) {
1018
-
1019
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-post-filter.php';
1020
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-tax-filter.php';
1021
-
1022
- $premium_post_filter = __NAMESPACE__ . '\Controls\Premium_Post_Filter';
1023
- $premium_tax_filter = __NAMESPACE__ . '\Controls\Premium_Tax_Filter';
1024
-
1025
- $control_manager->controls_manager->register( new $premium_post_filter() );
1026
- $control_manager->controls_manager->register( new $premium_tax_filter() );
1027
-
1028
- }
1029
-
1030
- if ( self::$modules['pa-display-conditions'] ) {
1031
-
1032
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-acf-selector.php';
1033
- $premium_acf_selector = __NAMESPACE__ . '\Controls\Premium_Acf_Selector';
1034
- $control_manager->controls_manager->register( new $premium_acf_selector() );
1035
-
1036
- }
1037
- } else {
1038
- if ( self::$modules['premium-equal-height'] ) {
1039
-
1040
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-select.php';
1041
- $premium_select = __NAMESPACE__ . '\Controls\Premium_Select';
1042
- $control_manager->controls_manager->register_control( $premium_select::TYPE, new $premium_select() );
1043
-
1044
- }
1045
-
1046
- if ( self::$modules['premium-blog'] ) {
1047
-
1048
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-post-filter.php';
1049
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-tax-filter.php';
1050
-
1051
- $premium_post_filter = __NAMESPACE__ . '\Controls\Premium_Post_Filter';
1052
- $premium_tax_filter = __NAMESPACE__ . '\Controls\Premium_Tax_Filter';
1053
-
1054
- $control_manager->controls_manager->register_control( $premium_post_filter::TYPE, new $premium_post_filter() );
1055
- $control_manager->controls_manager->register_control( $premium_tax_filter::TYPE, new $premium_tax_filter() );
1056
-
1057
- }
1058
-
1059
- if ( self::$modules['pa-display-conditions'] ) {
1060
-
1061
- require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-acf-selector.php';
1062
- $premium_acf_selector = __NAMESPACE__ . '\Controls\Premium_Acf_Selector';
1063
- $control_manager->controls_manager->register_control( $premium_acf_selector::TYPE, new $premium_acf_selector() );
1064
-
1065
- }
1066
- }
1067
-
1068
- }
1069
-
1070
- /**
1071
- * Load PA Extensions
1072
- *
1073
- * @since 4.7.0
1074
- * @access public
1075
- */
1076
- public function load_pa_extensions() {
1077
-
1078
- if ( self::$modules['premium-equal-height'] ) {
1079
- Equal_Height::get_instance();
1080
- }
1081
-
1082
- if ( self::$modules['pa-display-conditions'] ) {
1083
- require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
1084
- Display_Conditions::get_instance();
1085
- }
1086
-
1087
- if ( self::$modules['premium-floating-effects'] ) {
1088
- Floating_Effects::get_instance();
1089
- }
1090
-
1091
- if ( class_exists( 'woocommerce' ) && self::$modules['woo-products'] ) {
1092
- Woocommerce::get_instance();
1093
- }
1094
-
1095
- }
1096
-
1097
- /**
1098
- *
1099
- * Creates and returns an instance of the class
1100
- *
1101
- * @since 1.0.0
1102
- * @access public
1103
- *
1104
- * @return object
1105
- */
1106
- public static function get_instance() {
1107
-
1108
- if ( ! isset( self::$instance ) ) {
1109
-
1110
- self::$instance = new self();
1111
-
1112
- }
1113
-
1114
- return self::$instance;
1115
- }
1116
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Addons Integration.
4
+ */
5
+
6
+ namespace PremiumAddons\Includes;
7
+
8
+ use PremiumAddons\Includes\Helper_Functions;
9
+ use PremiumAddons\Admin\Includes\Admin_Helper;
10
+ use PremiumAddons\Modules\Premium_Equal_Height\Module as Equal_Height;
11
+ use PremiumAddons\Modules\PA_Display_Conditions\Module as Display_Conditions;
12
+ use PremiumAddons\Modules\PremiumSectionFloatingEffects\Module as Floating_Effects;
13
+ use PremiumAddons\Modules\Woocommerce\Module as Woocommerce;
14
+ use PremiumAddons\Includes\Assets_Manager;
15
+ use PremiumAddons\Includes\Premium_Template_Tags;
16
+
17
+ if ( ! defined( 'ABSPATH' ) ) {
18
+ exit();
19
+ }
20
+
21
+ /**
22
+ * Class Addons_Integration.
23
+ */
24
+ class Addons_Integration {
25
+
26
+ /**
27
+ * Class instance
28
+ *
29
+ * @var instance
30
+ */
31
+ private static $instance = null;
32
+
33
+ /**
34
+ * Modules
35
+ *
36
+ * @var modules
37
+ */
38
+ private static $modules = null;
39
+
40
+ /**
41
+ * Maps Keys
42
+ *
43
+ * @var maps
44
+ */
45
+ private static $maps = null;
46
+
47
+ /**
48
+ * Template Instance
49
+ *
50
+ * @var template_instance
51
+ */
52
+ protected $template_instance;
53
+
54
+ /**
55
+ * Cross-Site CDN URL.
56
+ *
57
+ * @since 4.0.0
58
+ * @var (String) URL
59
+ */
60
+ public $cdn_url;
61
+
62
+ /**
63
+ * Initialize integration hooks
64
+ *
65
+ * @return void
66
+ */
67
+ public function __construct() {
68
+
69
+ self::$modules = Admin_Helper::get_enabled_elements();
70
+
71
+ self::$maps = Admin_Helper::get_integrations_settings();
72
+
73
+ $this->template_instance = Premium_Template_Tags::getInstance();
74
+
75
+ add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'enqueue_editor_styles' ) );
76
+
77
+ add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'load_live_editor_modal' ) );
78
+
79
+ add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'live_editor_enqueue' ) );
80
+
81
+ add_action( 'wp_ajax_handle_live_editor', array( $this, 'handle_live_editor' ) );
82
+
83
+ add_action( 'wp_ajax_check_temp_validity', array( $this, 'check_temp_validity' ) );
84
+
85
+ add_action( 'wp_ajax_update_template_title', array( $this, 'update_template_title' ) );
86
+
87
+ add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'enqueue_editor_scripts' ) );
88
+
89
+ add_action( 'elementor/preview/enqueue_styles', array( $this, 'enqueue_preview_styles' ) );
90
+
91
+ add_action( 'elementor/frontend/after_register_styles', array( $this, 'register_frontend_styles' ) );
92
+
93
+ add_action( 'elementor/frontend/after_register_scripts', array( $this, 'register_frontend_scripts' ) );
94
+
95
+ add_action( 'wp_ajax_get_elementor_template_content', array( $this, 'get_template_content' ) );
96
+
97
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
98
+ if ( version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
99
+ add_action( 'elementor/controls/register', array( $this, 'init_pa_controls' ) );
100
+ add_action( 'elementor/widgets/register', array( $this, 'widgets_area' ) );
101
+ } else {
102
+ add_action( 'elementor/controls/controls_registered', array( $this, 'init_pa_controls' ) );
103
+ add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_area' ) );
104
+ }
105
+ }
106
+
107
+ add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'after_enqueue_scripts' ) );
108
+
109
+ $this->load_pa_extensions();
110
+
111
+ $cross_enabled = isset( self::$modules['premium-cross-domain'] ) ? self::$modules['premium-cross-domain'] : 1;
112
+
113
+ if ( $cross_enabled ) {
114
+
115
+ add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'enqueue_editor_cp_scripts' ), 99 );
116
+
117
+ Addons_Cross_CP::get_instance();
118
+
119
+ }
120
+
121
+ }
122
+
123
+ /**
124
+ * Live Editor Enqueue.
125
+ *
126
+ * @access public
127
+ * @since 4.8.10
128
+ */
129
+ public function live_editor_enqueue() {
130
+
131
+ wp_enqueue_script(
132
+ 'live-editor-js',
133
+ PREMIUM_ADDONS_URL . 'assets/editor/js/live-editor.js',
134
+ array( 'elementor-editor', 'jquery' ),
135
+ PREMIUM_ADDONS_VERSION,
136
+ true
137
+ );
138
+
139
+ $live_editor_data = array(
140
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
141
+ 'nonce' => wp_create_nonce( 'pa-live-editor' ),
142
+ );
143
+
144
+ wp_localize_script( 'live-editor-js', 'liveEditor', $live_editor_data );
145
+
146
+ }
147
+
148
+ /**
149
+ * Update Template Title.
150
+ *
151
+ * @access public
152
+ * @since 4.8.10
153
+ */
154
+ public function update_template_title() {
155
+ check_ajax_referer( 'pa-live-editor', 'security' );
156
+
157
+ if ( ! isset( $_POST['title'] ) || ! isset( $_POST['id'] ) ) {
158
+ wp_send_json_error();
159
+ }
160
+
161
+ $res = wp_update_post(
162
+ array(
163
+ 'ID' => sanitize_text_field( wp_unslash( $_POST['id'] ) ),
164
+ 'post_title' => sanitize_text_field( wp_unslash( $_POST['title'] ) ),
165
+ )
166
+ );
167
+
168
+ wp_send_json_success( $res );
169
+ }
170
+
171
+ /**
172
+ * Check Temp Validity.
173
+ * Checks if the template is valid ( has content) or not,
174
+ * And DELETE the post if it's invalid.
175
+ *
176
+ * @access public
177
+ * @since 4.9.1
178
+ */
179
+ public function check_temp_validity() {
180
+
181
+ check_ajax_referer( 'pa-live-editor', 'security' );
182
+
183
+ if ( ! isset( $_POST['templateID'] ) ) {
184
+ wp_send_json_error( 'template ID is not set' );
185
+ }
186
+
187
+ $temp_id = sanitize_text_field( wp_unslash( $_POST['templateID'] ) );
188
+
189
+ $template_content = $this->template_instance->get_template_content( $temp_id, true );
190
+
191
+ if ( empty( $template_content ) || ! isset( $template_content ) ) {
192
+
193
+ $res = wp_delete_post( $temp_id, true );
194
+
195
+ if ( ! is_wp_error( $res ) ) {
196
+ $res = 'Template Deleted.';
197
+ }
198
+ } else {
199
+ $res = 'Template Has Content.';
200
+ }
201
+
202
+ wp_send_json_success( $res );
203
+ }
204
+
205
+ /**
206
+ * Handle Live Editor Modal.
207
+ *
208
+ * @access public
209
+ * @since 4.8.10
210
+ */
211
+ public function handle_live_editor() {
212
+
213
+ check_ajax_referer( 'pa-live-editor', 'security' );
214
+
215
+ if ( ! isset( $_POST['key'] ) ) {
216
+ wp_send_json_error();
217
+ }
218
+
219
+ $post_name = 'pa-dynamic-temp-' . sanitize_text_field( wp_unslash( $_POST['key'] ) );
220
+ $post_title = '';
221
+ $args = array(
222
+ 'post_type' => 'elementor_library',
223
+ 'name' => $post_name,
224
+ 'post_status' => 'publish',
225
+ 'update_post_term_cache' => false,
226
+ 'update_post_meta_cache' => false,
227
+ 'posts_per_page' => 1,
228
+ );
229
+
230
+ $post = get_posts( $args );
231
+
232
+ if ( empty( $post ) ) { // create a new one.
233
+
234
+ $key = sanitize_text_field( wp_unslash( $_POST['key'] ) );
235
+ $post_title = 'PA Template | #' . substr( md5( $key ), 0, 4 );
236
+
237
+ $params = array(
238
+ 'post_content' => '',
239
+ 'post_type' => 'elementor_library',
240
+ 'post_title' => $post_title,
241
+ 'post_name' => $post_name,
242
+ 'post_status' => 'publish',
243
+ 'meta_input' => array(
244
+ '_elementor_edit_mode' => 'builder',
245
+ '_elementor_template_type' => 'page',
246
+ '_wp_page_template' => 'elementor_canvas',
247
+ ),
248
+ );
249
+
250
+ $post_id = wp_insert_post( $params );
251
+
252
+ } else { // edit post.
253
+ $post_id = $post[0]->ID;
254
+ $post_title = $post[0]->post_title;
255
+ }
256
+
257
+ $edit_url = get_admin_url() . '/post.php?post=' . $post_id . '&action=elementor';
258
+
259
+ $result = array(
260
+ 'url' => $edit_url,
261
+ 'id' => $post_id,
262
+ 'title' => $post_title,
263
+ );
264
+
265
+ wp_send_json_success( $result );
266
+ }
267
+
268
+ /**
269
+ * Load Live Editor Modal.
270
+ * Puts live editor popup html into the editor.
271
+ *
272
+ * @access public
273
+ * @since 4.8.10
274
+ */
275
+ public function load_live_editor_modal() {
276
+ ob_start();
277
+ include_once PREMIUM_ADDONS_PATH . 'includes/live-editor-modal.php';
278
+ $output = ob_get_contents();
279
+ ob_end_clean();
280
+ echo $output;
281
+ }
282
+
283
+
284
+ /**
285
+ * After Enquque Scripts
286
+ *
287
+ * Loads editor scripts for our controls.
288
+ *
289
+ * @access public
290
+ * @return void
291
+ */
292
+ public function after_enqueue_scripts() {
293
+
294
+ wp_enqueue_script(
295
+ 'pa-eq-editor',
296
+ PREMIUM_ADDONS_URL . 'assets/editor/js/editor.js',
297
+ array( 'elementor-editor', 'jquery' ),
298
+ PREMIUM_ADDONS_VERSION,
299
+ true
300
+ );
301
+
302
+ if ( self::$modules['premium-blog'] || self::$modules['pa-display-conditions'] ) {
303
+ wp_localize_script(
304
+ 'pa-eq-editor',
305
+ 'PremiumSettings',
306
+ array(
307
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
308
+ 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
309
+ )
310
+ );
311
+ }
312
+
313
+ wp_localize_script(
314
+ 'pa-eq-editor',
315
+ 'PremiumPanelSettings',
316
+ array(
317
+ 'papro_installed' => Helper_Functions::check_papro_version(),
318
+ 'papro_widgets' => Admin_Helper::get_pro_elements(),
319
+ )
320
+ );
321
+
322
+ }
323
+
324
+ /**
325
+ * Loads plugin icons font
326
+ *
327
+ * @since 1.0.0
328
+ * @access public
329
+ * @return void
330
+ */
331
+ public function enqueue_editor_styles() {
332
+
333
+ $theme = Helper_Functions::get_elementor_ui_theme();
334
+
335
+ wp_enqueue_style(
336
+ 'pa-editor',
337
+ PREMIUM_ADDONS_URL . 'assets/editor/css/style.css',
338
+ array(),
339
+ PREMIUM_ADDONS_VERSION
340
+ );
341
+
342
+ // Enqueue required style for Elementor dark UI Theme.
343
+ if ( 'dark' === $theme ) {
344
+
345
+ wp_add_inline_style(
346
+ 'pa-editor',
347
+ '.elementor-panel .elementor-control-section_pa_docs .elementor-panel-heading-title.elementor-panel-heading-title,
348
+ .elementor-control-raw-html.editor-pa-doc a {
349
+ color: #e0e1e3 !important;
350
+ }
351
+ [class^="pa-"]::after,
352
+ [class*=" pa-"]::after {
353
+ color: #aaa;
354
+ opacity: 1 !important;
355
+ }
356
+ .premium-promotion-dialog .premium-promotion-btn {
357
+ background-color: #202124 !important
358
+ }'
359
+ );
360
+
361
+ }
362
+
363
+ $badge_text = Helper_Functions::get_badge();
364
+
365
+ $dynamic_css = sprintf( '#elementor-panel [class^="pa-"]::after, #elementor-panel [class*=" pa-"]::after { content: "%s"; }', $badge_text );
366
+
367
+ wp_add_inline_style( 'pa-editor', $dynamic_css );
368
+
369
+ }
370
+
371
+ /**
372
+ * Register Frontend CSS files
373
+ *
374
+ * @since 2.9.0
375
+ * @access public
376
+ */
377
+ public function register_frontend_styles() {
378
+
379
+ $dir = Helper_Functions::get_styles_dir();
380
+ $suffix = Helper_Functions::get_assets_suffix();
381
+
382
+ $is_rtl = is_rtl() ? '-rtl' : '';
383
+
384
+ wp_register_style(
385
+ 'font-awesome-5-all',
386
+ ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
387
+ false,
388
+ PREMIUM_ADDONS_VERSION
389
+ );
390
+
391
+ wp_register_style(
392
+ 'pa-prettyphoto',
393
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/prettyphoto' . $is_rtl . $suffix . '.css',
394
+ array(),
395
+ PREMIUM_ADDONS_VERSION,
396
+ 'all'
397
+ );
398
+
399
+ wp_register_style(
400
+ 'pa-slick',
401
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/slick' . $is_rtl . $suffix . '.css',
402
+ array(),
403
+ PREMIUM_ADDONS_VERSION,
404
+ 'all'
405
+ );
406
+
407
+ $assets_gen_enabled = self::$modules['premium-assets-generator'] ? true : false;
408
+
409
+ $type = get_post_type();
410
+
411
+ if ( $assets_gen_enabled && ( 'page' === $type || 'post' === $type ) ) {
412
+
413
+ $css_path = '/pa-frontend' . $is_rtl . '-' . Assets_Manager::$post_id . $suffix . '.css';
414
+
415
+ if ( Assets_Manager::$is_updated && file_exists( PREMIUM_ASSETS_PATH . $css_path ) ) {
416
+ wp_enqueue_style(
417
+ 'pa-frontend',
418
+ PREMIUM_ASSETS_URL . $css_path,
419
+ array(),
420
+ time(),
421
+ 'all'
422
+ );
423
+ }
424
+ }
425
+
426
+ // If the assets are not ready, or file does not exist for any reson.
427
+ if ( ! wp_style_is( 'pa-frontend', 'enqueued' ) ) {
428
+ $this->register_old_styles( $dir, $is_rtl, $suffix );
429
+ }
430
+
431
+ }
432
+
433
+ /**
434
+ * Register Old Styles
435
+ *
436
+ * @since 4.9.0
437
+ * @access public
438
+ *
439
+ * @param string $directory style directory.
440
+ * @param string $is_rtl page direction.
441
+ * @param string $suffix file suffix.
442
+ */
443
+ public function register_old_styles( $directory, $is_rtl, $suffix ) {
444
+
445
+ wp_register_style(
446
+ 'premium-addons',
447
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-addons' . $is_rtl . $suffix . '.css',
448
+ array(),
449
+ PREMIUM_ADDONS_VERSION,
450
+ 'all'
451
+ );
452
+
453
+ }
454
+
455
+ /**
456
+ * Registers required JS files
457
+ *
458
+ * @since 1.0.0
459
+ * @access public
460
+ */
461
+ public function register_frontend_scripts() {
462
+
463
+ $maps_settings = self::$maps;
464
+
465
+ $dir = Helper_Functions::get_scripts_dir();
466
+ $suffix = Helper_Functions::get_assets_suffix();
467
+
468
+ $locale = isset( $maps_settings['premium-map-locale'] ) ? $maps_settings['premium-map-locale'] : 'en';
469
+ $assets_gen_enabled = self::$modules['premium-assets-generator'] ? true : false;
470
+
471
+ $type = get_post_type();
472
+
473
+ if ( $assets_gen_enabled && ( 'page' === $type || 'post' === $type ) ) {
474
+
475
+ // If the elemens are cached and ready to generate.
476
+ if ( Assets_Manager::$is_updated ) {
477
+ Assets_Manager::generate_asset_file( 'js' );
478
+ Assets_Manager::generate_asset_file( 'css' );
479
+ }
480
+
481
+ $js_path = '/pa-frontend-' . Assets_Manager::$post_id . $suffix . '.js';
482
+
483
+ if ( file_exists( PREMIUM_ASSETS_PATH . $js_path ) ) {
484
+
485
+ wp_enqueue_script(
486
+ 'pa-frontend',
487
+ PREMIUM_ASSETS_URL . $js_path,
488
+ array( 'jquery' ),
489
+ time(),
490
+ true
491
+ );
492
+
493
+ wp_localize_script(
494
+ 'pa-frontend',
495
+ 'PremiumSettings',
496
+ array(
497
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
498
+ 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
499
+ )
500
+ );
501
+
502
+ if ( class_exists( 'woocommerce' ) ) {
503
+ wp_localize_script(
504
+ 'pa-frontend',
505
+ 'PremiumWooSettings',
506
+ array(
507
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
508
+ 'products_nonce' => wp_create_nonce( 'pa-woo-products-nonce' ),
509
+ 'qv_nonce' => wp_create_nonce( 'pa-woo-qv-nonce' ),
510
+ 'cta_nonce' => wp_create_nonce( 'pa-woo-cta-nonce' ),
511
+ 'woo_cart_url' => get_permalink( wc_get_page_id( 'cart' ) ),
512
+ )
513
+ );
514
+ }
515
+ }
516
+ }
517
+
518
+ // If the assets are not ready, or file does not exist for any reson.
519
+ if ( ! wp_script_is( 'pa-frontend', 'enqueued' ) ) {
520
+ $this->register_old_scripts( $dir, $suffix );
521
+ }
522
+
523
+ wp_register_script(
524
+ 'prettyPhoto-js',
525
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/prettyPhoto' . $suffix . '.js',
526
+ array( 'jquery' ),
527
+ PREMIUM_ADDONS_VERSION,
528
+ true
529
+ );
530
+
531
+ wp_register_script(
532
+ 'pa-vticker',
533
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/vticker' . $suffix . '.js',
534
+ array( 'jquery' ),
535
+ PREMIUM_ADDONS_VERSION,
536
+ true
537
+ );
538
+
539
+ wp_register_script(
540
+ 'pa-typed',
541
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/typed' . $suffix . '.js',
542
+ array( 'jquery' ),
543
+ PREMIUM_ADDONS_VERSION,
544
+ true
545
+ );
546
+
547
+ wp_register_script(
548
+ 'pa-countdown',
549
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/jquery-countdown' . $suffix . '.js',
550
+ array( 'jquery' ),
551
+ PREMIUM_ADDONS_VERSION,
552
+ true
553
+ );
554
+
555
+ wp_register_script(
556
+ 'isotope-js',
557
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/isotope' . $suffix . '.js',
558
+ array( 'jquery' ),
559
+ PREMIUM_ADDONS_VERSION,
560
+ true
561
+ );
562
+
563
+ wp_register_script(
564
+ 'pa-modal',
565
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/modal' . $suffix . '.js',
566
+ array( 'jquery' ),
567
+ PREMIUM_ADDONS_VERSION,
568
+ true
569
+ );
570
+
571
+ wp_register_script(
572
+ 'pa-maps',
573
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-maps' . $suffix . '.js',
574
+ array( 'jquery', 'pa-maps-api' ),
575
+ PREMIUM_ADDONS_VERSION,
576
+ true
577
+ );
578
+
579
+ wp_register_script(
580
+ 'pa-vscroll',
581
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-vscroll' . $suffix . '.js',
582
+ array( 'jquery' ),
583
+ PREMIUM_ADDONS_VERSION,
584
+ true
585
+ );
586
+
587
+ wp_register_script(
588
+ 'pa-slimscroll',
589
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/jquery-slimscroll' . $suffix . '.js',
590
+ array( 'jquery' ),
591
+ PREMIUM_ADDONS_VERSION,
592
+ true
593
+ );
594
+
595
+ wp_register_script(
596
+ 'pa-iscroll',
597
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/iscroll' . $suffix . '.js',
598
+ array( 'jquery' ),
599
+ PREMIUM_ADDONS_VERSION,
600
+ true
601
+ );
602
+
603
+ wp_register_script(
604
+ 'tilt-js',
605
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/universal-tilt' . $suffix . '.js',
606
+ array( 'jquery' ),
607
+ PREMIUM_ADDONS_VERSION,
608
+ true
609
+ );
610
+
611
+ wp_register_script(
612
+ 'lottie-js',
613
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/lottie' . $suffix . '.js',
614
+ array(
615
+ 'jquery',
616
+ 'elementor-waypoints',
617
+ ),
618
+ PREMIUM_ADDONS_VERSION,
619
+ true
620
+ );
621
+
622
+ wp_register_script(
623
+ 'pa-tweenmax',
624
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/TweenMax' . $suffix . '.js',
625
+ array( 'jquery' ),
626
+ PREMIUM_ADDONS_VERSION,
627
+ true
628
+ );
629
+
630
+ wp_register_script(
631
+ 'pa-headroom',
632
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/headroom' . $suffix . '.js',
633
+ array( 'jquery' ),
634
+ PREMIUM_ADDONS_VERSION
635
+ // true
636
+ );
637
+
638
+ if ( $maps_settings['premium-map-cluster'] ) {
639
+ wp_register_script(
640
+ 'google-maps-cluster',
641
+ 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js',
642
+ array(),
643
+ PREMIUM_ADDONS_VERSION,
644
+ false
645
+ );
646
+ }
647
+
648
+ if ( $maps_settings['premium-map-disable-api'] && '1' !== $maps_settings['premium-map-api'] ) {
649
+ $api = sprintf( 'https://maps.googleapis.com/maps/api/js?key=%1$s&language=%2$s', $maps_settings['premium-map-api'], $locale );
650
+ wp_register_script(
651
+ 'pa-maps-api',
652
+ $api,
653
+ array(),
654
+ PREMIUM_ADDONS_VERSION,
655
+ false
656
+ );
657
+ }
658
+
659
+ wp_register_script(
660
+ 'pa-slick',
661
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/slick' . $suffix . '.js',
662
+ array( 'jquery' ),
663
+ PREMIUM_ADDONS_VERSION,
664
+ true
665
+ );
666
+
667
+ wp_register_script(
668
+ 'pa-anime',
669
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/anime' . $suffix . '.js',
670
+ array( 'jquery' ),
671
+ PREMIUM_ADDONS_VERSION,
672
+ true
673
+ );
674
+
675
+ wp_register_script(
676
+ 'pa-feffects',
677
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-floating-effects' . $suffix . '.js',
678
+ array( 'jquery' ),
679
+ PREMIUM_ADDONS_VERSION,
680
+ true
681
+ );
682
+
683
+ wp_localize_script(
684
+ 'premium-addons',
685
+ 'PremiumSettings',
686
+ array(
687
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
688
+ 'nonce' => wp_create_nonce( 'pa-blog-widget-nonce' ),
689
+ )
690
+ );
691
+
692
+ wp_register_script(
693
+ 'pa-eq-height',
694
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-eq-height' . $suffix . '.js',
695
+ array( 'jquery' ),
696
+ PREMIUM_ADDONS_VERSION,
697
+ true
698
+ );
699
+
700
+ wp_register_script(
701
+ 'pa-dis-conditions',
702
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $dir . '/premium-dis-conditions' . $suffix . '.js',
703
+ array( 'jquery' ),
704
+ PREMIUM_ADDONS_VERSION,
705
+ true
706
+ );
707
+
708
+ // Localize jQuery with required data for Global Add-ons.
709
+ if ( self::$modules['premium-floating-effects'] ) {
710
+ wp_localize_script(
711
+ 'pa-feffects',
712
+ 'PremiumFESettings',
713
+ array(
714
+ 'papro_installed' => Helper_Functions::check_papro_version(),
715
+ )
716
+ );
717
+ }
718
+
719
+ }
720
+
721
+ /**
722
+ * Register Old Scripts
723
+ *
724
+ * @since 4.9.0
725
+ * @access public
726
+ *
727
+ * @param string $directory script directory.
728
+ * @param string $suffix file suffix.
729
+ */
730
+ public function register_old_scripts( $directory, $suffix ) {
731
+
732
+ wp_register_script(
733
+ 'premium-addons',
734
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-addons' . $suffix . '.js',
735
+ array( 'jquery' ),
736
+ PREMIUM_ADDONS_VERSION,
737
+ true
738
+ );
739
+
740
+ // We need to make sure premium-woocommerce.js will not be loaded twice if assets are generated.
741
+ if ( class_exists( 'woocommerce' ) ) {
742
+ wp_register_script(
743
+ 'premium-woocommerce',
744
+ PREMIUM_ADDONS_URL . 'assets/frontend/' . $directory . '/premium-woo-products' . $suffix . '.js',
745
+ array( 'jquery' ),
746
+ PREMIUM_ADDONS_VERSION,
747
+ true
748
+ );
749
+
750
+ wp_localize_script(
751
+ 'premium-woocommerce',
752
+ 'PremiumWooSettings',
753
+ array(
754
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
755
+ 'products_nonce' => wp_create_nonce( 'pa-woo-products-nonce' ),
756
+ 'qv_nonce' => wp_create_nonce( 'pa-woo-qv-nonce' ),
757
+ 'cta_nonce' => wp_create_nonce( 'pa-woo-cta-nonce' ),
758
+ 'woo_cart_url' => get_permalink( wc_get_page_id( 'cart' ) ),
759
+ )
760
+ );
761
+ }
762
+
763
+ }
764
+
765
+ /**
766
+ * Enqueue Preview CSS files
767
+ *
768
+ * @since 2.9.0
769
+ * @access public
770
+ */
771
+ public function enqueue_preview_styles() {
772
+
773
+ wp_enqueue_style( 'pa-prettyphoto' );
774
+
775
+ wp_enqueue_style( 'premium-addons' );
776
+
777
+ wp_enqueue_style( 'pa-slick' );
778
+
779
+ }
780
+
781
+ /**
782
+ * Load widgets require function
783
+ *
784
+ * @since 1.0.0
785
+ * @access public
786
+ */
787
+ public function widgets_area() {
788
+ $this->widgets_register();
789
+ }
790
+
791
+ /**
792
+ * Requires widgets files
793
+ *
794
+ * @since 1.0.0
795
+ * @access private
796
+ */
797
+ private function widgets_register() {
798
+
799
+ $enabled_elements = self::$modules;
800
+
801
+ foreach ( glob( PREMIUM_ADDONS_PATH . 'widgets/*.php' ) as $file ) {
802
+
803
+ $slug = basename( $file, '.php' );
804
+
805
+ // Fixes the conflict between Lottie widget/addon keys.
806
+ if ( 'premium-lottie' === $slug ) {
807
+
808
+ // Check if Lottie widget switcher value was saved before.
809
+ $saved_options = get_option( 'pa_save_settings' );
810
+
811
+ $slug = 'premium-lottie-widget';
812
+
813
+ }
814
+
815
+ $enabled = isset( $enabled_elements[ $slug ] ) ? $enabled_elements[ $slug ] : '';
816
+
817
+ if ( filter_var( $enabled, FILTER_VALIDATE_BOOLEAN ) || ! $enabled_elements ) {
818
+ $this->register_addon( $file );
819
+ }
820
+ }
821
+
822
+ }
823
+
824
+ /**
825
+ * Register Woocommerce Widgets.
826
+ *
827
+ * @since 4.0.0
828
+ * @access private
829
+ */
830
+ private function woo_widgets_register() {
831
+
832
+ $enabled_elements = self::$modules;
833
+
834
+ foreach ( glob( PREMIUM_ADDONS_PATH . 'modules/woocommerce/widgets/*.php' ) as $file ) {
835
+
836
+ $slug = basename( $file, '.php' );
837
+
838
+ $enabled = isset( $enabled_elements[ $slug ] ) ? $enabled_elements[ $slug ] : '';
839
+
840
+ if ( filter_var( $enabled, FILTER_VALIDATE_BOOLEAN ) || ! $enabled_elements ) {
841
+
842
+ $this->register_addon( $file );
843
+ }
844
+ }
845
+ }
846
+
847
+ /**
848
+ * Enqueue editor scripts
849
+ *
850
+ * @since 3.2.5
851
+ * @access public
852
+ */
853
+ public function enqueue_editor_scripts() {
854
+
855
+ $map_enabled = isset( self::$modules['premium-maps'] ) ? self::$modules['premium-maps'] : 1;
856
+
857
+ if ( $map_enabled ) {
858
+
859
+ $premium_maps_api = self::$maps['premium-map-api'];
860
+
861
+ $locale = isset( self::$maps['premium-map-locale'] ) ? self::$maps['premium-map-locale'] : 'en';
862
+
863
+ $disable_api = self::$maps['premium-map-disable-api'];
864
+
865
+ if ( $disable_api && '1' !== $premium_maps_api ) {
866
+
867
+ $api = sprintf( 'https://maps.googleapis.com/maps/api/js?key=%1$s&language=%2$s', $premium_maps_api, $locale );
868
+ wp_enqueue_script(
869
+ 'pa-maps-api',
870
+ $api,
871
+ array(),
872
+ PREMIUM_ADDONS_VERSION,
873
+ false
874
+ );
875
+
876
+ }
877
+
878
+ wp_enqueue_script(
879
+ 'pa-maps-finder',
880
+ PREMIUM_ADDONS_URL . 'assets/editor/js/pa-maps-finder.js',
881
+ array( 'jquery' ),
882
+ PREMIUM_ADDONS_VERSION,
883
+ true
884
+ );
885
+
886
+ }
887
+
888
+ }
889
+
890
+ /**
891
+ * Load Cross Domain Copy Paste JS Files.
892
+ *
893
+ * @since 3.21.1
894
+ */
895
+ public function enqueue_editor_cp_scripts() {
896
+
897
+ wp_enqueue_script(
898
+ 'premium-xdlocalstorage-js',
899
+ PREMIUM_ADDONS_URL . 'assets/editor/js/xdlocalstorage.js',
900
+ null,
901
+ PREMIUM_ADDONS_VERSION,
902
+ true
903
+ );
904
+
905
+ wp_enqueue_script(
906
+ 'premium-cross-cp',
907
+ PREMIUM_ADDONS_URL . 'assets/editor/js/premium-cross-cp.js',
908
+ array( 'jquery', 'elementor-editor', 'premium-xdlocalstorage-js' ),
909
+ PREMIUM_ADDONS_VERSION,
910
+ true
911
+ );
912
+
913
+ // Check for required Compatible Elementor version.
914
+ if ( ! version_compare( ELEMENTOR_VERSION, '3.1.0', '>=' ) ) {
915
+ $elementor_old = true;
916
+ } else {
917
+ $elementor_old = false;
918
+ }
919
+
920
+ wp_localize_script(
921
+ 'jquery',
922
+ 'premium_cross_cp',
923
+ array(
924
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
925
+ 'nonce' => wp_create_nonce( 'premium_cross_cp_import' ),
926
+ 'elementorCompatible' => $elementor_old,
927
+ )
928
+ );
929
+ }
930
+
931
+ /**
932
+ * Get Template Content
933
+ *
934
+ * Get Elementor template HTML content.
935
+ *
936
+ * @since 3.2.6
937
+ * @access public
938
+ */
939
+ public function get_template_content() {
940
+
941
+ $template = isset( $_GET['templateID'] ) ? sanitize_text_field( wp_unslash( $_GET['templateID'] ) ) : '';
942
+
943
+ if ( empty( $template ) ) {
944
+ wp_send_json_error( '' );
945
+ }
946
+
947
+ $template_content = $this->template_instance->get_template_content( $template );
948
+
949
+ if ( empty( $template_content ) || ! isset( $template_content ) ) {
950
+ wp_send_json_error( '' );
951
+ }
952
+
953
+ $data = array(
954
+ 'template_content' => $template_content,
955
+ );
956
+
957
+ wp_send_json_success( $data );
958
+ }
959
+
960
+ /**
961
+ *
962
+ * Register addon by file name.
963
+ *
964
+ * @access public
965
+ *
966
+ * @param string $file File name.
967
+ *
968
+ * @return void
969
+ */
970
+ public function register_addon( $file ) {
971
+
972
+ $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
973
+
974
+ $base = basename( str_replace( '.php', '', $file ) );
975
+ $class = ucwords( str_replace( '-', ' ', $base ) );
976
+ $class = str_replace( ' ', '_', $class );
977
+ $class = sprintf( 'PremiumAddons\Widgets\%s', $class );
978
+
979
+ if ( 'PremiumAddons\Widgets\Premium_Contactform' !== $class ) {
980
+ require $file;
981
+ } else {
982
+ if ( function_exists( 'wpcf7' ) ) {
983
+ require $file;
984
+ }
985
+ }
986
+
987
+ if ( 'PremiumAddons\Widgets\Premium_Videobox' === $class ) {
988
+ require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
989
+ }
990
+
991
+ if ( class_exists( $class, false ) ) {
992
+ if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
993
+ $widgets_manager->register( new $class() );
994
+ } else {
995
+ $widgets_manager->register_widget_type( new $class() );
996
+ }
997
+ }
998
+
999
+ }
1000
+
1001
+ /**
1002
+ * Registers Premium Addons Custom Controls.
1003
+ *
1004
+ * @since 4.2.5
1005
+ * @access public
1006
+ *
1007
+ * @return void
1008
+ */
1009
+ public function init_pa_controls() {
1010
+
1011
+ if ( self::$modules['premium-equal-height'] || self::$modules['premium-blog'] || self::$modules['pa-display-conditions'] ) {
1012
+
1013
+ $control_manager = \Elementor\Plugin::instance();
1014
+
1015
+ if ( version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
1016
+
1017
+ // TODO: NEEDS TO BE DYNAMIC.
1018
+ if ( self::$modules['premium-equal-height'] ) {
1019
+
1020
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-select.php';
1021
+ $premium_select = __NAMESPACE__ . '\Controls\Premium_Select';
1022
+ $control_manager->controls_manager->register( new $premium_select() );
1023
+
1024
+ }
1025
+
1026
+ if ( self::$modules['premium-blog'] ) {
1027
+
1028
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-post-filter.php';
1029
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-tax-filter.php';
1030
+
1031
+ $premium_post_filter = __NAMESPACE__ . '\Controls\Premium_Post_Filter';
1032
+ $premium_tax_filter = __NAMESPACE__ . '\Controls\Premium_Tax_Filter';
1033
+
1034
+ $control_manager->controls_manager->register( new $premium_post_filter() );
1035
+ $control_manager->controls_manager->register( new $premium_tax_filter() );
1036
+
1037
+ }
1038
+
1039
+ if ( self::$modules['pa-display-conditions'] ) {
1040
+
1041
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-acf-selector.php';
1042
+ $premium_acf_selector = __NAMESPACE__ . '\Controls\Premium_Acf_Selector';
1043
+ $control_manager->controls_manager->register( new $premium_acf_selector() );
1044
+
1045
+ }
1046
+ } else {
1047
+ if ( self::$modules['premium-equal-height'] ) {
1048
+
1049
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-select.php';
1050
+ $premium_select = __NAMESPACE__ . '\Controls\Premium_Select';
1051
+ $control_manager->controls_manager->register_control( $premium_select::TYPE, new $premium_select() );
1052
+
1053
+ }
1054
+
1055
+ if ( self::$modules['premium-blog'] ) {
1056
+
1057
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-post-filter.php';
1058
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-tax-filter.php';
1059
+
1060
+ $premium_post_filter = __NAMESPACE__ . '\Controls\Premium_Post_Filter';
1061
+ $premium_tax_filter = __NAMESPACE__ . '\Controls\Premium_Tax_Filter';
1062
+
1063
+ $control_manager->controls_manager->register_control( $premium_post_filter::TYPE, new $premium_post_filter() );
1064
+ $control_manager->controls_manager->register_control( $premium_tax_filter::TYPE, new $premium_tax_filter() );
1065
+
1066
+ }
1067
+
1068
+ if ( self::$modules['pa-display-conditions'] ) {
1069
+
1070
+ require_once PREMIUM_ADDONS_PATH . 'includes/controls/premium-acf-selector.php';
1071
+ $premium_acf_selector = __NAMESPACE__ . '\Controls\Premium_Acf_Selector';
1072
+ $control_manager->controls_manager->register_control( $premium_acf_selector::TYPE, new $premium_acf_selector() );
1073
+
1074
+ }
1075
+ }
1076
+ }
1077
+
1078
+ }
1079
+
1080
+ /**
1081
+ * Load PA Extensions
1082
+ *
1083
+ * @since 4.7.0
1084
+ * @access public
1085
+ */
1086
+ public function load_pa_extensions() {
1087
+
1088
+ if ( self::$modules['premium-equal-height'] ) {
1089
+ Equal_Height::get_instance();
1090
+ }
1091
+
1092
+ if ( self::$modules['pa-display-conditions'] ) {
1093
+ require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
1094
+ Display_Conditions::get_instance();
1095
+ }
1096
+
1097
+ if ( self::$modules['premium-floating-effects'] ) {
1098
+ Floating_Effects::get_instance();
1099
+ }
1100
+
1101
+ if ( class_exists( 'woocommerce' ) && self::$modules['woo-products'] ) {
1102
+ Woocommerce::get_instance();
1103
+ }
1104
+
1105
+ }
1106
+
1107
+ /**
1108
+ *
1109
+ * Creates and returns an instance of the class
1110
+ *
1111
+ * @since 1.0.0
1112
+ * @access public
1113
+ *
1114
+ * @return object
1115
+ */
1116
+ public static function get_instance() {
1117
+
1118
+ if ( ! isset( self::$instance ) ) {
1119
+
1120
+ self::$instance = new self();
1121
+
1122
+ }
1123
+
1124
+ return self::$instance;
1125
+ }
1126
+ }
includes/assets-manager.php CHANGED
@@ -1,687 +1,687 @@
1
- <?php
2
- /**
3
- * PA Assets Manager.
4
- */
5
-
6
- namespace PremiumAddons\Includes;
7
-
8
- use Elementor\Plugin;
9
- use PremiumAddons\Includes\Helper_Functions;
10
- use PremiumAddons\Admin\Includes\Admin_Helper;
11
-
12
- require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
13
-
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * PA Assets Manager Class.
20
- */
21
- class Assets_Manager {
22
-
23
- /**
24
- * Class Instance.
25
- *
26
- * @var object|null instance.
27
- */
28
- private static $instance = null;
29
-
30
- /**
31
- * Post Id.
32
- * Option Id.
33
- *
34
- * @var string|null post_id.
35
- */
36
- public static $post_id = null;
37
-
38
- /**
39
- * Templates ids loaded in a post.
40
- *
41
- * @var array temp_ids.
42
- */
43
- public static $temp_ids = array();
44
-
45
- /**
46
- * All elements loaded in a post.
47
- *
48
- * @var array temp_elements.
49
- */
50
- public static $temp_elements = array();
51
-
52
- /**
53
- * Is page assets updated.
54
- *
55
- * @var boolean is_updated.
56
- */
57
- public static $is_updated = null;
58
-
59
- /**
60
- * Class Constructor.
61
- */
62
- public function __construct() {
63
-
64
- add_action( 'elementor/editor/after_save', array( $this, 'handle_post_save' ), 10, 2 );
65
-
66
- // Check if the elments are cached.
67
- add_action( 'wp', array( $this, 'set_assets_vars' ) );
68
-
69
- // Save the elements on the current page.
70
- add_filter( 'elementor/frontend/builder_content_data', array( $this, 'manage_post_data' ), 10, 2 );
71
-
72
- add_action( 'wp_footer', array( $this, 'cache_post_assets' ) );
73
-
74
- add_action( 'wp_trash_post', array( $this, 'delete_cached_options' ) );
75
-
76
- }
77
-
78
- /**
79
- * Sets Edit Time upon editor save.
80
- *
81
- * @access public
82
- * @since 4.6.1
83
- */
84
- public function handle_post_save( $post_id ) {
85
-
86
- if ( wp_doing_cron() ) {
87
- return;
88
- }
89
-
90
- // The post is saved, then we need to remove the assets related to it.
91
- $this->set_post_id( $post_id );
92
- self::remove_files();
93
-
94
- update_option( 'pa_edit_time', strtotime( 'now' ) );
95
- }
96
-
97
- /**
98
- * Mange Post Data.
99
- *
100
- * @access public
101
- * @since 4.6.1
102
- *
103
- * @param array $data post data.
104
- * @param int|string $post_id post id.
105
- *
106
- * @return array
107
- */
108
- public function manage_post_data( $data, $post_id ) {
109
-
110
- if ( ! self::$is_updated ) {
111
- $pa_elems = $this->extract_pa_elements( $data );
112
-
113
- self::$temp_ids[] = $post_id;
114
- self::$temp_elements = array_unique( array_merge( self::$temp_elements, $pa_elems ) );
115
- }
116
-
117
- return $data;
118
- }
119
-
120
- /**
121
- * Set post unique id.
122
- *
123
- * @access public
124
- * @since 4.6.1
125
- *
126
- * @param int|string $id post id.
127
- */
128
- public function set_post_id( $id = 'default' ) {
129
-
130
- $post_id = 'default' === $id ? 'pa_assets_' . get_queried_object_id() : 'pa_assets_' . $id;
131
-
132
- if ( null === self::$post_id ) {
133
- self::$post_id = Helper_Functions::generate_unique_id( $post_id );
134
- }
135
- }
136
-
137
- /**
138
- * Extracts PA Elements.
139
- *
140
- * @access public
141
- * @since 4.6.1
142
- *
143
- * @param array $data post data.
144
- *
145
- * @return array
146
- */
147
- public function extract_pa_elements( $data ) {
148
-
149
- if ( empty( $data ) ) {
150
- return array();
151
- }
152
-
153
- $pa_names = Admin_Helper::get_pa_elements_names();
154
-
155
- $social_revs = array(
156
- 'premium-yelp-reviews',
157
- 'premium-google-reviews',
158
- 'premium-facebook-reviews',
159
- );
160
-
161
- $pa_elems = array();
162
-
163
- Plugin::$instance->db->iterate_data(
164
- $data,
165
- function ( $element ) use ( &$pa_elems, $pa_names, $social_revs ) {
166
-
167
- if ( isset( $element['elType'] ) ) {
168
-
169
- if ( 'widget' === $element['elType'] && isset( $element['widgetType'] ) ) {
170
-
171
- $widget_type = ( 'global' === $element['widgetType'] && ! empty( $element['templateID'] ) ) ? $this->get_global_widget_type( $element['templateID'] ) : $element['widgetType'];
172
-
173
- if ( in_array( $widget_type, $pa_names, true ) && ! in_array( $widget_type, $pa_elems, true ) ) {
174
-
175
- $widget_type = in_array( $widget_type, $social_revs, true ) ? 'premium-reviews' : $widget_type;
176
-
177
- if ( in_array( $widget_type, array( 'premium-twitter-feed', 'premium-facebook-feed' ), true ) && ! in_array( 'social-common', $pa_elems, true ) ) {
178
- array_push( $pa_elems, 'social-common' );
179
- }
180
-
181
- array_push( $pa_elems, $widget_type );
182
-
183
- if ( 'premium-woo-products' === $widget_type ) {
184
- $papro_activated = apply_filters( 'papro_activated', false );
185
-
186
- if ( $papro_activated ) {
187
- array_push( $pa_elems, 'premium-woo-products-pro' );
188
- }
189
- }
190
- }
191
- }
192
- }
193
- }
194
- );
195
-
196
- return $pa_elems;
197
- }
198
-
199
- /**
200
- * Get Global Wiget Type.
201
- *
202
- * @access public
203
- * @since 4.6.1
204
- * @link https://code.elementor.com/methods/elementor-templatelibrary-manager-get_template_data/
205
- * @param int $temp_id template it.
206
- *
207
- * @return string|void
208
- */
209
- public function get_global_widget_type( $temp_id ) {
210
-
211
- $temp_data = Plugin::$instance->templates_manager->get_template_data(
212
- array(
213
- 'source' => 'local',
214
- 'template_id' => $temp_id,
215
- )
216
- );
217
-
218
- if ( is_wp_error( $temp_data ) || ! $temp_data || empty( $temp_data ) ) {
219
- return;
220
- }
221
-
222
- if ( ! isset( $temp_data['content'] ) || empty( $temp_data['content'] ) ) {
223
- return;
224
- }
225
-
226
- return $temp_data['content'][0]['widgetType'];
227
- }
228
-
229
- /**
230
- * Sets Assets Variables.
231
- * Sets Post ID & Is_updated Flag.
232
- *
233
- * @access public
234
- * @since 4.6.1
235
- */
236
- public function set_assets_vars() {
237
-
238
- $is_edit_mode = Helper_Functions::is_edit_mode();
239
-
240
- if ( ! $this->is_built_with_elementor() || $is_edit_mode ) {
241
- return;
242
- }
243
-
244
- $this->set_post_id();
245
-
246
- self::$is_updated = self::is_ready_for_generate();
247
- }
248
-
249
- /**
250
- * Is Built With Elementor.
251
- *
252
- * @access public
253
- * @since 4.6.1
254
- *
255
- * @return boolean
256
- */
257
- public function is_built_with_elementor() {
258
-
259
- if ( ! class_exists( 'Elementor\Plugin' ) ) {
260
- return false;
261
- }
262
-
263
- $current_id = get_the_ID();
264
-
265
- if ( ! $current_id || $current_id < 0 ) {
266
- return false;
267
- }
268
-
269
- return Plugin::$instance->documents->get( get_the_ID() )->is_built_with_elementor();
270
- }
271
-
272
- /**
273
- * Check if assets is updated.
274
- *
275
- * @access public
276
- * @since 4.6.1
277
- *
278
- * @return boolean
279
- */
280
- public static function is_ready_for_generate() {
281
-
282
- $editor_time = get_option( 'pa_edit_time', false );
283
-
284
- // If no post/page was saved after the feature is enabled.
285
- if ( ! $editor_time ) {
286
- update_option( 'pa_edit_time', strtotime( 'now' ) );
287
- }
288
-
289
- $post_edit_time = get_option( 'pa_edit_' . self::$post_id, false );
290
-
291
- // If the time of the last update is not equal to the time the current post was last changed. This means another post was saved, then load the default assets.
292
- // In this case, we need to load the default assets until the elements in the page needs to be cached first.
293
- if ( ! $post_edit_time || (int) $editor_time !== (int) $post_edit_time ) {
294
- // A change was made in the page elements, then we need to force the assets to be regenerated
295
- self::remove_files();
296
- return false;
297
- }
298
-
299
- return true;
300
- }
301
-
302
- /**
303
- * Cached post assets.
304
- *
305
- * Update post options in db on page load.
306
- *
307
- * @access public
308
- * @since 4.6.1
309
- */
310
- public function cache_post_assets() {
311
-
312
- $is_edit_mode = Helper_Functions::is_edit_mode();
313
- $cond = $this->is_built_with_elementor() && ! $is_edit_mode;
314
-
315
- if ( ! self::$is_updated && $cond ) {
316
- update_option( 'pa_elements_' . self::$post_id, self::$temp_elements, false );
317
- update_option( 'pa_edit_' . self::$post_id, get_option( 'pa_edit_time' ), false );
318
- }
319
- }
320
-
321
- /**
322
- * Delete Cached Options.
323
- * Delete post options from db on post delete.
324
- *
325
- * @access public
326
- * @since 4.6.1
327
- *
328
- * @param int $post_id post id.
329
- */
330
- public function delete_cached_options( $post_id ) {
331
-
332
- $id = substr( md5( 'pa_assets_' . $post_id ), 0, 9 );
333
-
334
- delete_option( 'pa_elements_' . $id );
335
- delete_option( 'pa_edit_' . $id );
336
-
337
- }
338
-
339
- /**
340
- * Generate Assets files.
341
- * Adds assets into pa-frontend(|-rtl).min.(js|css).
342
- *
343
- * @access public
344
- * @since 4.6.1
345
- *
346
- * @param string $ext assets extensions (js|css).
347
- */
348
- public static function generate_asset_file( $ext ) {
349
-
350
- $direction = is_rtl() && 'css' === $ext ? 'rtl-' : '';
351
- $main_file_name = Helper_Functions::get_safe_path( PREMIUM_ASSETS_PATH . '/pa-frontend-' . $direction . self::$post_id . '.min.' . $ext );
352
-
353
- // If the file already exists, then there is no need to regenerate a new one.
354
- if ( file_exists( $main_file_name ) ) {
355
- return;
356
- }
357
-
358
- $content = self::get_asset_file_content( $ext );
359
-
360
- // If no premium elements exist on the page, then don't generate files
361
- if ( empty( $content ) ) {
362
- return;
363
- }
364
-
365
- if ( 'css' === $ext && is_rtl() ) {
366
- $rtl_file_name = Helper_Functions::get_safe_path( PREMIUM_ASSETS_PATH . '/pa-frontend-rtl-' . self::$post_id . '.min.css' );
367
- }
368
-
369
- if ( ! file_exists( PREMIUM_ASSETS_PATH ) ) {
370
- wp_mkdir_p( PREMIUM_ASSETS_PATH );
371
- }
372
-
373
- if ( 'css' === $ext ) {
374
-
375
- if ( is_rtl() ) {
376
- // Make sure to delete the file before creating the new one.
377
- file_put_contents( $rtl_file_name, '@charset "UTF-8";' . $content['rtl'] ); // phpcs:ignore
378
- } else {
379
- file_put_contents( $main_file_name, '@charset "UTF-8";' . $content['main'] ); // phpcs:ignore
380
- }
381
- } else {
382
- file_put_contents( $main_file_name, $content ); // phpcs:ignore
383
- }
384
- }
385
-
386
-
387
- /**
388
- * Clear cached file.
389
- * Delete file if it exists.
390
- *
391
- * @access public
392
- * @since 4.6.1
393
- *
394
- * @param string $file_name file name.
395
- */
396
- public static function clear_cached_file( $file_name ) {
397
-
398
- if ( file_exists( $file_name ) ) {
399
- unlink( $file_name );
400
- }
401
- }
402
-
403
- /**
404
- * Remove files
405
- *
406
- * @since 4.6.1
407
- */
408
- public static function remove_files() {
409
-
410
- $ext = array( 'css', 'js' );
411
-
412
- foreach ( $ext as $e ) {
413
-
414
- $path = PREMIUM_ASSETS_PATH . '/pa-frontend-' . self::$post_id . '.min.' . $e;
415
-
416
- if ( 'css' === $e ) {
417
- $rtl_path = PREMIUM_ASSETS_PATH . '/pa-frontend-rtl-' . self::$post_id . '.min.' . $e;
418
- self::clear_cached_file( $rtl_path );
419
- }
420
-
421
- self::clear_cached_file( $path );
422
- }
423
-
424
- }
425
-
426
- /**
427
- * Get Asset File Content.
428
- *
429
- * Collects pa/papro widgets assets.
430
- *
431
- * @access public
432
- * @since 4.6.1
433
- *
434
- * @param string $ext js|css.
435
- *
436
- * @return string|array $content
437
- */
438
- public static function get_asset_file_content( $ext ) {
439
-
440
- // Get the cached elements of the current post/page.
441
- $pa_elements = get_option( 'pa_elements_' . self::$post_id, array() );
442
-
443
- if ( empty( $pa_elements ) ) {
444
- return '';
445
- }
446
-
447
- $content = '';
448
-
449
- if ( 'css' === $ext ) {
450
- $rtl_content = '';
451
- }
452
-
453
- $pa_elements = self::prepare_pa_elements( $pa_elements, $ext );
454
-
455
- foreach ( $pa_elements as $element ) {
456
-
457
- $path = self::get_file_path( $element, $ext );
458
-
459
- if ( ! $path ) {
460
- continue;
461
- }
462
-
463
- $content .= self::get_file_content( $path );
464
-
465
- if ( 'css' === $ext && is_rtl() ) {
466
- $rtl_path = self::get_file_path( $element, $ext, '-rtl' );
467
- $rtl_content .= self::get_file_content( $rtl_path );
468
- }
469
- }
470
-
471
- if ( 'css' === $ext ) {
472
-
473
- $content = array(
474
- 'main' => $content,
475
- 'rtl' => $rtl_content,
476
- );
477
-
478
- // Fix: at-rule or selector expected css error.
479
- $content = str_replace( '@charset "UTF-8";', '', $content );
480
- }
481
-
482
- return $content;
483
- }
484
-
485
- /**
486
- * Prepare PA Elements.
487
- *
488
- * @access public
489
- * @since 4.6.1
490
- *
491
- * @param array $elements post elements.
492
- * @param string $ext js|css.
493
- *
494
- * @return array
495
- */
496
- public static function prepare_pa_elements( $elements, $ext ) {
497
-
498
- if ( 'css' === $ext ) {
499
- $common_assets = self::has_free_elements( $elements ) ? array( 'common' ) : array();
500
- $common_assets = self::has_pro_elements( $elements ) ? array_merge( $common_assets, array( 'common-pro' ) ) : $common_assets;
501
-
502
- $elements = array_merge( $elements, $common_assets );
503
-
504
- } else {
505
- $indep_elements = array(
506
- 'social-common',
507
- 'premium-hscroll',
508
- 'premium-lottie',
509
- 'premium-vscroll',
510
- 'premium-addon-maps',
511
- 'premium-woo-products-pro',
512
- 'premium-addon-testimonials',
513
- 'premium-addon-pricing-table',
514
- 'premium-addon-image-separator',
515
- );
516
-
517
- $elements = array_diff( $elements, $indep_elements );
518
- }
519
-
520
- return $elements;
521
- }
522
-
523
- /**
524
- * Get File Content.
525
- *
526
- * @param string $path file path.
527
- *
528
- * @return string
529
- */
530
- public static function get_file_content( $path ) {
531
-
532
- $file_content = rplg_urlopen( $path );
533
-
534
- if ( isset( $file_content['code'] ) ) {
535
- if ( 404 === $file_content['code'] ) {
536
- return '';
537
- }
538
- }
539
-
540
- return self::clean_content( $file_content['data'] );
541
- }
542
-
543
- /**
544
- * Clean Content
545
- * Removes Page Html if it's returned as result.
546
- *
547
- * @param string $content file content.
548
- *
549
- * @return string
550
- */
551
- public static function clean_content( $content ) {
552
-
553
- if ( strpos( $content, '<!DOCTYPE html>' ) ) {
554
- $content = explode( '<!DOCTYPE html>', $content )[0];
555
- }
556
-
557
- if ( strpos( $content, '<!doctype html>' ) ) {
558
- $content = explode( '<!doctype html>', $content )[0];
559
- }
560
-
561
- return $content;
562
- }
563
-
564
- /**
565
- * Get File Path.
566
- * Construct file path.
567
- *
568
- * @param string $element pa element name.
569
- * @param string $ext file extension ( js|css).
570
- * @param string $dir post dir (-rtl|'').
571
- *
572
- * @return string file path.
573
- */
574
- public static function get_file_path( $element, $ext, $dir = '' ) {
575
-
576
- $is_pro = self::is_pro_widget( $element );
577
-
578
- $papro_activated = apply_filters( 'papro_activated', false ) && version_compare( PREMIUM_PRO_ADDONS_VERSION, '2.7.1', '>' );
579
-
580
- if ( ! $papro_activated && $is_pro ) {
581
- return false;
582
- }
583
-
584
- $element = str_replace( '-addon', '', $element );
585
-
586
- $path = $is_pro ? PREMIUM_PRO_ADDONS_URL : PREMIUM_ADDONS_URL;
587
-
588
- return $path . 'assets/frontend/min-' . $ext . '/' . $element . $dir . '.min.' . $ext;
589
- }
590
-
591
- /**
592
- * Is Pro Widget.
593
- * Checks if the widget is pro.
594
- *
595
- * @access public
596
- * @since 4.6.1
597
- *
598
- * @param string $widget widget name.
599
- *
600
- * @return bool
601
- */
602
- public static function is_pro_widget( $widget ) {
603
-
604
- $pro_names = array_merge( array( 'common-pro', 'premium-reviews', 'premium-woo-products-pro', 'social-common' ), self::get_pro_widgets_names() );
605
-
606
- return in_array( $widget, $pro_names, true );
607
- }
608
-
609
- /**
610
- * Has Pro Elements.
611
- * Check if the post has pa pro elements.
612
- *
613
- * @access public
614
- * @since 4.6.1
615
- *
616
- * @param array $post_elems post elements.
617
- *
618
- * @return boolean
619
- */
620
- public static function has_pro_elements( $post_elems ) {
621
-
622
- $papro_elems = self::get_pro_widgets_names();
623
- $has_pro = array_intersect( $post_elems, $papro_elems ) ? true : false;
624
-
625
- return $has_pro;
626
- }
627
-
628
- /**
629
- * Has Free Elements.
630
- * Check if the post has pa elements.
631
- *
632
- * @access public
633
- * @since 4.6.1
634
- *
635
- * @param array $post_elems post elements.
636
- *
637
- * @return boolean
638
- */
639
- public static function has_free_elements( $post_elems ) {
640
-
641
- $pa_elems = Admin_Helper::get_free_widgets_names();
642
- $has_free = array_intersect( $post_elems, $pa_elems ) ? true : false;
643
-
644
- return $has_free;
645
- }
646
-
647
- /**
648
- * Get Pro Widgets Names.
649
- *
650
- * @access public
651
- * @since 4.6.1
652
- *
653
- * @return array
654
- */
655
- public static function get_pro_widgets_names() {
656
-
657
- $pro_elems = Admin_Helper::get_pro_elements();
658
- $pro_names = array();
659
-
660
- foreach ( $pro_elems as $element ) {
661
- if ( isset( $element['name'] ) ) {
662
- array_push( $pro_names, $element['name'] );
663
- }
664
- }
665
-
666
- return $pro_names;
667
- }
668
-
669
- /**
670
- * Creates and returns an instance of the class.
671
- *
672
- * @since 4.6.1
673
- * @access public
674
- *
675
- * @return object
676
- */
677
- public static function get_instance() {
678
-
679
- if ( ! isset( self::$instance ) ) {
680
-
681
- self::$instance = new self();
682
-
683
- }
684
-
685
- return self::$instance;
686
- }
687
- }
1
+ <?php
2
+ /**
3
+ * PA Assets Manager.
4
+ */
5
+
6
+ namespace PremiumAddons\Includes;
7
+
8
+ use Elementor\Plugin;
9
+ use PremiumAddons\Includes\Helper_Functions;
10
+ use PremiumAddons\Admin\Includes\Admin_Helper;
11
+
12
+ require_once PREMIUM_ADDONS_PATH . 'widgets/dep/urlopen.php';
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
+ }
17
+
18
+ /**
19
+ * PA Assets Manager Class.
20
+ */
21
+ class Assets_Manager {
22
+
23
+ /**
24
+ * Class Instance.
25
+ *
26
+ * @var object|null instance.
27
+ */
28
+ private static $instance = null;
29
+
30
+ /**
31
+ * Post Id.
32
+ * Option Id.
33
+ *
34
+ * @var string|null post_id.
35
+ */
36
+ public static $post_id = null;
37
+
38
+ /**
39
+ * Templates ids loaded in a post.
40
+ *
41
+ * @var array temp_ids.
42
+ */
43
+ public static $temp_ids = array();
44
+
45
+ /**
46
+ * All elements loaded in a post.
47
+ *
48
+ * @var array temp_elements.
49
+ */
50
+ public static $temp_elements = array();
51
+
52
+ /**
53
+ * Is page assets updated.
54
+ *
55
+ * @var boolean is_updated.
56
+ */
57
+ public static $is_updated = null;
58
+
59
+ /**
60
+ * Class Constructor.
61
+ */
62
+ public function __construct() {
63
+
64
+ add_action( 'elementor/editor/after_save', array( $this, 'handle_post_save' ), 10, 2 );
65
+
66
+ // Check if the elments are cached.
67
+ add_action( 'wp', array( $this, 'set_assets_vars' ) );
68
+
69
+ // Save the elements on the current page.
70
+ add_filter( 'elementor/frontend/builder_content_data', array( $this, 'manage_post_data' ), 10, 2 );
71
+
72
+ add_action( 'wp_footer', array( $this, 'cache_post_assets' ) );
73
+
74
+ add_action( 'wp_trash_post', array( $this, 'delete_cached_options' ) );
75
+
76
+ }
77
+
78
+ /**
79
+ * Sets Edit Time upon editor save.
80
+ *
81
+ * @access public
82
+ * @since 4.6.1
83
+ */
84
+ public function handle_post_save( $post_id ) {
85
+
86
+ if ( wp_doing_cron() ) {
87
+ return;
88
+ }
89
+
90
+ // The post is saved, then we need to remove the assets related to it.
91
+ $this->set_post_id( $post_id );
92
+ self::remove_files();
93
+
94
+ update_option( 'pa_edit_time', strtotime( 'now' ) );
95
+ }
96
+
97
+ /**
98
+ * Mange Post Data.
99
+ *
100
+ * @access public
101
+ * @since 4.6.1
102
+ *
103
+ * @param array $data post data.
104
+ * @param int|string $post_id post id.
105
+ *
106
+ * @return array
107
+ */
108
+ public function manage_post_data( $data, $post_id ) {
109
+
110
+ if ( ! self::$is_updated ) {
111
+ $pa_elems = $this->extract_pa_elements( $data );
112
+
113
+ self::$temp_ids[] = $post_id;
114
+ self::$temp_elements = array_unique( array_merge( self::$temp_elements, $pa_elems ) );
115
+ }
116
+
117
+ return $data;
118
+ }
119
+
120
+ /**
121
+ * Set post unique id.
122
+ *
123
+ * @access public
124
+ * @since 4.6.1
125
+ *
126
+ * @param int|string $id post id.
127
+ */
128
+ public function set_post_id( $id = 'default' ) {
129
+
130
+ $post_id = 'default' === $id ? 'pa_assets_' . get_queried_object_id() : 'pa_assets_' . $id;
131
+
132
+ if ( null === self::$post_id ) {
133
+ self::$post_id = Helper_Functions::generate_unique_id( $post_id );
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Extracts PA Elements.
139
+ *
140
+ * @access public
141
+ * @since 4.6.1
142
+ *
143
+ * @param array $data post data.
144
+ *
145
+ * @return array
146
+ */
147
+ public function extract_pa_elements( $data ) {
148
+
149
+ if ( empty( $data ) ) {
150
+ return array();
151
+ }
152
+
153
+ $pa_names = Admin_Helper::get_pa_elements_names();
154
+
155
+ $social_revs = array(
156
+ 'premium-yelp-reviews',
157
+ 'premium-google-reviews',
158
+ 'premium-facebook-reviews',
159
+ );
160
+
161
+ $pa_elems = array();
162
+
163
+ Plugin::$instance->db->iterate_data(
164
+ $data,
165
+ function ( $element ) use ( &$pa_elems, $pa_names, $social_revs ) {
166
+
167
+ if ( isset( $element['elType'] ) ) {
168
+
169
+ if ( 'widget' === $element['elType'] && isset( $element['widgetType'] ) ) {
170
+
171
+ $widget_type = ( 'global' === $element['widgetType'] && ! empty( $element['templateID'] ) ) ? $this->get_global_widget_type( $element['templateID'] ) : $element['widgetType'];
172
+
173
+ if ( in_array( $widget_type, $pa_names, true ) && ! in_array( $widget_type, $pa_elems, true ) ) {
174
+
175
+ $widget_type = in_array( $widget_type, $social_revs, true ) ? 'premium-reviews' : $widget_type;
176
+
177
+ if ( in_array( $widget_type, array( 'premium-twitter-feed', 'premium-facebook-feed' ), true ) && ! in_array( 'social-common', $pa_elems, true ) ) {
178
+ array_push( $pa_elems, 'social-common' );
179
+ }
180
+
181
+ array_push( $pa_elems, $widget_type );
182
+
183
+ if ( 'premium-woo-products' === $widget_type ) {
184
+ $papro_activated = apply_filters( 'papro_activated', false );
185
+
186
+ if ( $papro_activated ) {
187
+ array_push( $pa_elems, 'premium-woo-products-pro' );
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ );
195
+
196
+ return $pa_elems;
197
+ }
198
+
199
+ /**
200
+ * Get Global Wiget Type.
201
+ *
202
+ * @access public
203
+ * @since 4.6.1
204
+ * @link https://code.elementor.com/methods/elementor-templatelibrary-manager-get_template_data/
205
+ * @param int $temp_id template it.
206
+ *
207
+ * @return string|void
208
+ */
209
+ public function get_global_widget_type( $temp_id ) {
210
+
211
+ $temp_data = Plugin::$instance->templates_manager->get_template_data(
212
+ array(
213
+ 'source' => 'local',
214
+ 'template_id' => $temp_id,
215
+ )
216
+ );
217
+
218
+ if ( is_wp_error( $temp_data ) || ! $temp_data || empty( $temp_data ) ) {
219
+ return;
220
+ }
221
+
222
+ if ( ! isset( $temp_data['content'] ) || empty( $temp_data['content'] ) ) {
223
+ return;
224
+ }
225
+
226
+ return $temp_data['content'][0]['widgetType'];
227
+ }
228
+
229
+ /**
230
+ * Sets Assets Variables.
231
+ * Sets Post ID & Is_updated Flag.
232
+ *
233
+ * @access public
234
+ * @since 4.6.1
235
+ */
236
+ public function set_assets_vars() {
237
+
238
+ $is_edit_mode = Helper_Functions::is_edit_mode();
239
+
240
+ if ( ! $this->is_built_with_elementor() || $is_edit_mode ) {
241
+ return;
242
+ }
243
+
244
+ $this->set_post_id();
245
+
246
+ self::$is_updated = self::is_ready_for_generate();
247
+ }
248
+
249
+ /**
250
+ * Is Built With Elementor.
251
+ *
252
+ * @access public
253
+ * @since 4.6.1
254
+ *
255
+ * @return boolean
256
+ */
257
+ public function is_built_with_elementor() {
258
+
259
+ if ( ! class_exists( 'Elementor\Plugin' ) ) {
260
+ return false;
261
+ }
262
+
263
+ $current_id = get_the_ID();
264
+
265
+ if ( ! $current_id || $current_id < 0 ) {
266
+ return false;
267
+ }
268
+
269
+ return Plugin::$instance->documents->get( get_the_ID() )->is_built_with_elementor();
270
+ }
271
+
272
+ /**
273
+ * Check if assets is updated.
274
+ *
275
+ * @access public
276
+ * @since 4.6.1
277
+ *
278
+ * @return boolean
279
+ */
280
+ public static function is_ready_for_generate() {
281
+
282
+ $editor_time = get_option( 'pa_edit_time', false );
283
+
284
+ // If no post/page was saved after the feature is enabled.
285
+ if ( ! $editor_time ) {
286
+ update_option( 'pa_edit_time', strtotime( 'now' ) );
287
+ }
288
+
289
+ $post_edit_time = get_option( 'pa_edit_' . self::$post_id, false );
290
+
291
+ // If the time of the last update is not equal to the time the current post was last changed. This means another post was saved, then load the default assets.
292
+ // In this case, we need to load the default assets until the elements in the page needs to be cached first.
293
+ if ( ! $post_edit_time || (int) $editor_time !== (int) $post_edit_time ) {
294
+ // A change was made in the page elements, then we need to force the assets to be regenerated
295
+ self::remove_files();
296
+ return false;
297
+ }
298
+
299
+ return true;
300
+ }
301
+
302
+ /**
303
+ * Cached post assets.
304
+ *
305
+ * Update post options in db on page load.
306
+ *
307
+ * @access public
308
+ * @since 4.6.1
309
+ */
310
+ public function cache_post_assets() {
311
+
312
+ $is_edit_mode = Helper_Functions::is_edit_mode();
313
+ $cond = $this->is_built_with_elementor() && ! $is_edit_mode;
314
+
315
+ if ( ! self::$is_updated && $cond ) {
316
+ update_option( 'pa_elements_' . self::$post_id, self::$temp_elements, false );
317
+ update_option( 'pa_edit_' . self::$post_id, get_option( 'pa_edit_time' ), false );
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Delete Cached Options.
323
+ * Delete post options from db on post delete.
324
+ *
325
+ * @access public
326
+ * @since 4.6.1
327
+ *
328
+ * @param int $post_id post id.
329
+ */
330
+ public function delete_cached_options( $post_id ) {
331
+
332
+ $id = substr( md5( 'pa_assets_' . $post_id ), 0, 9 );
333
+
334
+ delete_option( 'pa_elements_' . $id );
335
+ delete_option( 'pa_edit_' . $id );
336
+
337
+ }
338
+
339
+ /**
340
+ * Generate Assets files.
341
+ * Adds assets into pa-frontend(|-rtl).min.(js|css).
342
+ *
343
+ * @access public
344
+ * @since 4.6.1
345
+ *
346
+ * @param string $ext assets extensions (js|css).
347
+ */
348
+ public static function generate_asset_file( $ext ) {
349
+
350
+ $direction = is_rtl() && 'css' === $ext ? 'rtl-' : '';
351
+ $main_file_name = Helper_Functions::get_safe_path( PREMIUM_ASSETS_PATH . '/pa-frontend-' . $direction . self::$post_id . '.min.' . $ext );
352
+
353
+ // If the file already exists, then there is no need to regenerate a new one.
354
+ if ( file_exists( $main_file_name ) ) {
355
+ return;
356
+ }
357
+
358
+ $content = self::get_asset_file_content( $ext );
359
+
360
+ // If no premium elements exist on the page, then don't generate files
361
+ if ( empty( $content ) ) {
362
+ return;
363
+ }
364
+
365
+ if ( 'css' === $ext && is_rtl() ) {
366
+ $rtl_file_name = Helper_Functions::get_safe_path( PREMIUM_ASSETS_PATH . '/pa-frontend-rtl-' . self::$post_id . '.min.css' );
367
+ }
368
+
369
+ if ( ! file_exists( PREMIUM_ASSETS_PATH ) ) {
370
+ wp_mkdir_p( PREMIUM_ASSETS_PATH );
371
+ }
372
+
373
+ if ( 'css' === $ext ) {
374
+
375
+ if ( is_rtl() ) {
376
+ // Make sure to delete the file before creating the new one.
377
+ file_put_contents( $rtl_file_name, '@charset "UTF-8";' . $content['rtl'] ); // phpcs:ignore
378
+ } else {
379
+ file_put_contents( $main_file_name, '@charset "UTF-8";' . $content['main'] ); // phpcs:ignore
380
+ }
381
+ } else {
382
+ file_put_contents( $main_file_name, $content ); // phpcs:ignore
383
+ }
384
+ }
385
+
386
+
387
+ /**
388
+ * Clear cached file.
389
+ * Delete file if it exists.
390
+ *
391
+ * @access public
392
+ * @since 4.6.1
393
+ *
394
+ * @param string $file_name file name.
395
+ */
396
+ public static function clear_cached_file( $file_name ) {
397
+
398
+ if ( file_exists( $file_name ) ) {
399
+ unlink( $file_name );
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Remove files
405
+ *
406
+ * @since 4.6.1
407
+ */
408
+ public static function remove_files() {
409
+
410
+ $ext = array( 'css', 'js' );
411
+
412
+ foreach ( $ext as $e ) {
413
+
414
+ $path = PREMIUM_ASSETS_PATH . '/pa-frontend-' . self::$post_id . '.min.' . $e;
415
+
416
+ if ( 'css' === $e ) {
417
+ $rtl_path = PREMIUM_ASSETS_PATH . '/pa-frontend-rtl-' . self::$post_id . '.min.' . $e;
418
+ self::clear_cached_file( $rtl_path );
419
+ }
420
+
421
+ self::clear_cached_file( $path );
422
+ }
423
+
424
+ }
425
+
426
+ /**
427
+ * Get Asset File Content.
428
+ *
429
+ * Collects pa/papro widgets assets.
430
+ *
431
+ * @access public
432
+ * @since 4.6.1
433
+ *
434
+ * @param string $ext js|css.
435
+ *
436
+ * @return string|array $content
437
+ */
438
+ public static function get_asset_file_content( $ext ) {
439
+
440
+ // Get the cached elements of the current post/page.
441
+ $pa_elements = get_option( 'pa_elements_' . self::$post_id, array() );
442
+
443
+ if ( empty( $pa_elements ) ) {
444
+ return '';
445
+ }
446
+
447
+ $content = '';
448
+
449
+ if ( 'css' === $ext ) {
450
+ $rtl_content = '';
451
+ }
452
+
453
+ $pa_elements = self::prepare_pa_elements( $pa_elements, $ext );
454
+
455
+ foreach ( $pa_elements as $element ) {
456
+
457
+ $path = self::get_file_path( $element, $ext );
458
+
459
+ if ( ! $path ) {
460
+ continue;
461
+ }
462
+
463
+ $content .= self::get_file_content( $path );
464
+
465
+ if ( 'css' === $ext && is_rtl() ) {
466
+ $rtl_path = self::get_file_path( $element, $ext, '-rtl' );
467
+ $rtl_content .= self::get_file_content( $rtl_path );
468
+ }
469
+ }
470
+
471
+ if ( 'css' === $ext ) {
472
+
473
+ $content = array(
474
+ 'main' => $content,
475
+ 'rtl' => $rtl_content,
476
+ );
477
+
478
+ // Fix: at-rule or selector expected css error.
479
+ $content = str_replace( '@charset "UTF-8";', '', $content );
480
+ }
481
+
482
+ return $content;
483
+ }
484
+
485
+ /**
486
+ * Prepare PA Elements.
487
+ *
488
+ * @access public
489
+ * @since 4.6.1
490
+ *
491
+ * @param array $elements post elements.
492
+ * @param string $ext js|css.
493
+ *
494
+ * @return array
495
+ */
496
+ public static function prepare_pa_elements( $elements, $ext ) {
497
+
498
+ if ( 'css' === $ext ) {
499
+ $common_assets = self::has_free_elements( $elements ) ? array( 'common' ) : array();
500
+ $common_assets = self::has_pro_elements( $elements ) ? array_merge( $common_assets, array( 'common-pro' ) ) : $common_assets;
501
+
502
+ $elements = array_merge( $elements, $common_assets );
503
+
504
+ } else {
505
+ $indep_elements = array(
506
+ 'social-common',
507
+ 'premium-hscroll',
508
+ 'premium-lottie',
509
+ 'premium-vscroll',
510
+ 'premium-addon-maps',
511
+ 'premium-woo-products-pro',
512
+ 'premium-addon-testimonials',
513
+ 'premium-addon-pricing-table',
514
+ 'premium-addon-image-separator',
515
+ );
516
+
517
+ $elements = array_diff( $elements, $indep_elements );
518
+ }
519
+
520
+ return $elements;
521
+ }
522
+
523
+ /**
524
+ * Get File Content.
525
+ *
526
+ * @param string $path file path.
527
+ *
528
+ * @return string
529
+ */
530
+ public static function get_file_content( $path ) {
531
+
532
+ $file_content = rplg_urlopen( $path );
533
+
534
+ if ( isset( $file_content['code'] ) ) {
535
+ if ( in_array( $file_content['code'], array( 404, 401 ), true ) ) {
536
+ return '';
537
+ }
538
+ }
539
+
540
+ return self::clean_content( $file_content['data'] );
541
+ }
542
+
543
+ /**
544
+ * Clean Content
545
+ * Removes Page Html if it's returned as result.
546
+ *
547
+ * @param string $content file content.
548
+ *
549
+ * @return string
550
+ */
551
+ public static function clean_content( $content ) {
552
+
553
+ if ( strpos( $content, '<!DOCTYPE html>' ) ) {
554
+ $content = explode( '<!DOCTYPE html>', $content )[0];
555
+ }
556
+
557
+ if ( strpos( $content, '<!doctype html>' ) ) {
558
+ $content = explode( '<!doctype html>', $content )[0];
559
+ }
560
+
561
+ return $content;
562
+ }
563
+
564
+ /**
565
+ * Get File Path.
566
+ * Construct file path.
567
+ *
568
+ * @param string $element pa element name.
569
+ * @param string $ext file extension ( js|css).
570
+ * @param string $dir post dir (-rtl|'').
571
+ *
572
+ * @return string file path.
573
+ */
574
+ public static function get_file_path( $element, $ext, $dir = '' ) {
575
+
576
+ $is_pro = self::is_pro_widget( $element );
577
+
578
+ $papro_activated = apply_filters( 'papro_activated', false ) && version_compare( PREMIUM_PRO_ADDONS_VERSION, '2.7.1', '>' );
579
+
580
+ if ( ! $papro_activated && $is_pro ) {
581
+ return false;
582
+ }
583
+
584
+ $element = str_replace( '-addon', '', $element );
585
+
586
+ $path = $is_pro ? PREMIUM_PRO_ADDONS_URL : PREMIUM_ADDONS_URL;
587
+
588
+ return $path . 'assets/frontend/min-' . $ext . '/' . $element . $dir . '.min.' . $ext;
589
+ }
590
+
591
+ /**
592
+ * Is Pro Widget.
593
+ * Checks if the widget is pro.
594
+ *
595
+ * @access public
596
+ * @since 4.6.1
597
+ *
598
+ * @param string $widget widget name.
599
+ *
600
+ * @return bool
601
+ */
602
+ public static function is_pro_widget( $widget ) {
603
+
604
+ $pro_names = array_merge( array( 'common-pro', 'premium-reviews', 'premium-woo-products-pro', 'social-common' ), self::get_pro_widgets_names() );
605
+
606
+ return in_array( $widget, $pro_names, true );
607
+ }
608
+
609
+ /**
610
+ * Has Pro Elements.
611
+ * Check if the post has pa pro elements.
612
+ *
613
+ * @access public
614
+ * @since 4.6.1
615
+ *
616
+ * @param array $post_elems post elements.
617
+ *
618
+ * @return boolean
619
+ */
620
+ public static function has_pro_elements( $post_elems ) {
621
+
622
+ $papro_elems = self::get_pro_widgets_names();
623
+ $has_pro = array_intersect( $post_elems, $papro_elems ) ? true : false;
624
+
625
+ return $has_pro;
626
+ }
627
+
628
+ /**
629
+ * Has Free Elements.
630
+ * Check if the post has pa elements.
631
+ *
632
+ * @access public
633
+ * @since 4.6.1
634
+ *
635
+ * @param array $post_elems post elements.
636
+ *
637
+ * @return boolean
638
+ */
639
+ public static function has_free_elements( $post_elems ) {
640
+
641
+ $pa_elems = Admin_Helper::get_free_widgets_names();
642
+ $has_free = array_intersect( $post_elems, $pa_elems ) ? true : false;
643
+
644
+ return $has_free;
645
+ }
646
+
647
+ /**
648
+ * Get Pro Widgets Names.
649
+ *
650
+ * @access public
651
+ * @since 4.6.1
652
+ *
653
+ * @return array
654
+ */
655
+ public static function get_pro_widgets_names() {
656
+
657
+ $pro_elems = Admin_Helper::get_pro_elements();
658
+ $pro_names = array();
659
+
660
+ foreach ( $pro_elems as $element ) {
661
+ if ( isset( $element['name'] ) ) {
662
+ array_push( $pro_names, $element['name'] );
663
+ }
664
+ }
665
+
666
+ return $pro_names;
667
+ }
668
+
669
+ /**
670
+ * Creates and returns an instance of the class.
671
+ *
672
+ * @since 4.6.1
673
+ * @access public
674
+ *
675
+ * @return object
676
+ */
677
+ public static function get_instance() {
678
+
679
+ if ( ! isset( self::$instance ) ) {
680
+
681
+ self::$instance = new self();
682
+
683
+ }
684
+
685
+ return self::$instance;
686
+ }
687
+ }
includes/pa-display-conditions/conditions/acf-text.php CHANGED
@@ -119,7 +119,7 @@ class Acf_Text extends Condition {
119
 
120
  $input_val = sanitize_text_field( $compare_val );
121
 
122
- $condition_result = ( ! empty( $input_val ) && $value === $input_val ) ? true : false;
123
 
124
  return Helper_Functions::get_final_result( $condition_result, $operator );
125
  }
119
 
120
  $input_val = sanitize_text_field( $compare_val );
121
 
122
+ $condition_result = ( $value === $input_val ) ? true : false;
123
 
124
  return Helper_Functions::get_final_result( $condition_result, $operator );
125
  }
includes/pa-display-conditions/pa-controls-handler.php CHANGED
@@ -322,7 +322,7 @@ class PA_Controls_Handler {
322
  $id = $item_key . '_' . $list['_id'];
323
  $time_zone = in_array( $list['pa_condition_key'], array( 'date_range', 'time_range', 'date', 'day' ), true ) ? $list['pa_condition_timezone'] : false;
324
 
325
- $check = '' !== $value ? $class->compare_value( $settings, $operator, $value, $compare_val, $time_zone ) : true;
326
 
327
  $this->conditions_results_holder[ $element_id ][ $id ] = $check;
328
  }
322
  $id = $item_key . '_' . $list['_id'];
323
  $time_zone = in_array( $list['pa_condition_key'], array( 'date_range', 'time_range', 'date', 'day' ), true ) ? $list['pa_condition_timezone'] : false;
324
 
325
+ $check = ( 'acf_text' === $list['pa_condition_key'] || '' !== $value ) ? $class->compare_value( $settings, $operator, $value, $compare_val, $time_zone ) : true;
326
 
327
  $this->conditions_results_holder[ $element_id ][ $id ] = $check;
328
  }
modules/pa-display-conditions/module.php CHANGED
@@ -77,18 +77,6 @@ class Module {
77
  wp_enqueue_script( 'pa-dis-conditions' );
78
  }
79
 
80
- $page_id = get_the_ID();
81
-
82
- if ( $page_id ) {
83
- wp_localize_script(
84
- 'pa-dis-conditions',
85
- 'PremiumSettings',
86
- array(
87
- 'pageID' => $page_id,
88
- )
89
- );
90
- }
91
-
92
  }
93
 
94
  /**
@@ -301,13 +289,6 @@ class Module {
301
  'type' => Controls_Manager::REPEATER,
302
  'label_block' => true,
303
  'fields' => $repeater->get_controls(),
304
- 'default' => array(
305
- array(
306
- 'pa_condition_key' => 'browser',
307
- 'pa_condition_operator' => 'is',
308
- 'pa_condition_browser' => 'chrome',
309
- ),
310
- ),
311
  'title_field' => '<# print( pa_condition_key.replace(/_/g, " ").split(" ").map((s) => s.charAt(0).toUpperCase() + s.substring(1)).join(" ")) #>',
312
  'condition' => array(
313
  'pa_display_conditions_switcher' => 'yes',
77
  wp_enqueue_script( 'pa-dis-conditions' );
78
  }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
  /**
289
  'type' => Controls_Manager::REPEATER,
290
  'label_block' => true,
291
  'fields' => $repeater->get_controls(),
 
 
 
 
 
 
 
292
  'title_field' => '<# print( pa_condition_key.replace(/_/g, " ").split(" ").map((s) => s.charAt(0).toUpperCase() + s.substring(1)).join(" ")) #>',
293
  'condition' => array(
294
  'pa_display_conditions_switcher' => 'yes',
premium-addons-for-elementor.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: Premium Addons for Elementor
4
  Description: Premium Addons for Elementor plugin includes widgets and addons like Blog Post Grid, Gallery, Post Carousel, Advanced Slider, Modal Popup, Google Maps, Pricing Tables, Lottie Animations, Countdown, Testimonials.
5
  Plugin URI: https://premiumaddons.com
6
- Version: 4.9.23
7
- Elementor tested up to: 3.6.8
8
  Elementor Pro tested up to: 3.7.3
9
  Author: Leap13
10
  Author URI: https://leap13.com/
@@ -18,14 +18,14 @@ if ( ! defined( 'ABSPATH' ) ) {
18
  }
19
 
20
  // Define Constants.
21
- define( 'PREMIUM_ADDONS_VERSION', '4.9.23' );
22
  define( 'PREMIUM_ADDONS_URL', plugins_url( '/', __FILE__ ) );
23
  define( 'PREMIUM_ADDONS_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'PREMIUM_ASSETS_PATH', set_url_scheme( wp_upload_dir()['basedir'] . '/premium-addons-elementor' ) );
25
  define( 'PREMIUM_ASSETS_URL', set_url_scheme( wp_upload_dir()['baseurl'] . '/premium-addons-elementor' ) );
26
  define( 'PREMIUM_ADDONS_FILE', __FILE__ );
27
  define( 'PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
28
- define( 'PREMIUM_ADDONS_STABLE_VERSION', '4.9.22' );
29
 
30
  /*
31
  * Load plugin core file
3
  Plugin Name: Premium Addons for Elementor
4
  Description: Premium Addons for Elementor plugin includes widgets and addons like Blog Post Grid, Gallery, Post Carousel, Advanced Slider, Modal Popup, Google Maps, Pricing Tables, Lottie Animations, Countdown, Testimonials.
5
  Plugin URI: https://premiumaddons.com
6
+ Version: 4.9.24
7
+ Elementor tested up to: 3.7.0
8
  Elementor Pro tested up to: 3.7.3
9
  Author: Leap13
10
  Author URI: https://leap13.com/
18
  }
19
 
20
  // Define Constants.
21
+ define( 'PREMIUM_ADDONS_VERSION', '4.9.24' );
22
  define( 'PREMIUM_ADDONS_URL', plugins_url( '/', __FILE__ ) );
23
  define( 'PREMIUM_ADDONS_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'PREMIUM_ASSETS_PATH', set_url_scheme( wp_upload_dir()['basedir'] . '/premium-addons-elementor' ) );
25
  define( 'PREMIUM_ASSETS_URL', set_url_scheme( wp_upload_dir()['baseurl'] . '/premium-addons-elementor' ) );
26
  define( 'PREMIUM_ADDONS_FILE', __FILE__ );
27
  define( 'PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
28
+ define( 'PREMIUM_ADDONS_STABLE_VERSION', '4.9.23' );
29
 
30
  /*
31
  * Load plugin core file
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: 6.0.1
7
  Requires PHP: 5.4
8
- Stable Tag: 4.9.23
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
@@ -215,6 +215,14 @@ Premium Addons for Elementor is 100% Ads Free, Ads can only be detected from You
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
 
 
 
218
  = 4.9.23 =
219
 
220
  - Tweak: Added `Search by Name` input field in plugin settings tab.
5
  Requires at least: 5.0
6
  Tested Up To: 6.0.1
7
  Requires PHP: 5.4
8
+ Stable Tag: 4.9.24
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
215
 
216
  == Changelog ==
217
 
218
+ = 4.9.24 =
219
+
220
+ - Fixed: Comatibility issues with Elementor v3.7.0.
221
+ - Fixed: Copy/Paste element styling not working after Elementor v3.7.0.
222
+ - Fixed: Returning Visitor Display Condition causing issues with AJAX requests.
223
+ - Fixed: ACF Text Display Condition not comparing empty values.
224
+ - Fixed: Widgets` styling broken when Dynamic Assets Generate option is enabled on password-protected websites.
225
+
226
  = 4.9.23 =
227
 
228
  - Tweak: Added `Search by Name` input field in plugin settings tab.