PowerPack Addons for Elementor (Instagram Feed, Pricing Table, Forms Stylers, Display Conditions, Free Elementor Widgets and Elementor Templates) - Version 2.0.0

Version Description

  • July 29, 2020 =
  • New: Template Library
  • Added: Team Member Carousel - border, radius and padding options for team member box
  • Added: Flipbox - Icon text option
  • Added: Flipbox - Title HTML tag option
Download this release

Release Info

Developer ideaboxcreations
Plugin Icon 128x128 PowerPack Addons for Elementor (Instagram Feed, Pricing Table, Forms Stylers, Display Conditions, Free Elementor Widgets and Elementor Templates)
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.3.0 to 2.0.0

assets/images/pp-logo-sm.png ADDED
Binary file
assets/js/pp-templates-lib.js ADDED
@@ -0,0 +1,855 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;( function( elementor, $, window ) {
2
+
3
+ var TemplateLibraryTemplateModel = Backbone.Model.extend({
4
+ defaults: {
5
+ template_id: 0,
6
+ title: '',
7
+ source: '',
8
+ type: '',
9
+ subtype: '',
10
+ author: '',
11
+ thumbnail: '',
12
+ url: '',
13
+ export_link: '',
14
+ tags: []
15
+ }
16
+ });
17
+
18
+ var TemplateLibraryCollection = Backbone.Collection.extend({
19
+ model: TemplateLibraryTemplateModel
20
+ });
21
+
22
+ var TemplateLibraryInsertTemplateBehavior = Marionette.Behavior.extend({
23
+ ui: {
24
+ insertButton: '.elementor-template-library-template-insert'
25
+ },
26
+ events: {
27
+ 'click @ui.insertButton': 'onInsertButtonClick'
28
+ },
29
+ onInsertButtonClick: function onInsertButtonClick() {
30
+ var args = {
31
+ model: this.view.model
32
+ };
33
+
34
+ $e.run('powerpack/insert-template', args);
35
+ }
36
+ });
37
+
38
+ var TemplateLibraryTemplateView = Marionette.ItemView.extend({
39
+ className: function className() {
40
+ var classes = 'elementor-template-library-template',
41
+ source = this.model.get('source');
42
+ classes += ' elementor-template-library-template-remote';
43
+ classes += ' elementor-template-library-template-' + source;
44
+
45
+ if ('powerpack' === source) {
46
+ classes += ' elementor-template-library-template-' + this.model.get('type');
47
+ }
48
+
49
+ if (this.model.get('isPro')) {
50
+ classes += ' elementor-template-library-pro-template';
51
+ }
52
+
53
+ return classes;
54
+ },
55
+ ui: function ui() {
56
+ return {
57
+ previewButton: '.elementor-template-library-template-preview'
58
+ };
59
+ },
60
+ events: function events() {
61
+ return {
62
+ 'click @ui.previewButton': 'onPreviewButtonClick'
63
+ };
64
+ },
65
+ behaviors: {
66
+ insertTemplate: {
67
+ behaviorClass: TemplateLibraryInsertTemplateBehavior
68
+ }
69
+ }
70
+ });
71
+
72
+ var TemplateLibraryTemplatePowerPackView = TemplateLibraryTemplateView.extend({
73
+ template: '#tmpl-elementor-template-library-template-pp',
74
+ ui: function ui() {
75
+ return jQuery.extend(TemplateLibraryTemplateView.prototype.ui.apply(this, arguments), {
76
+ favoriteCheckbox: '.elementor-template-library-template-favorite-input'
77
+ });
78
+ },
79
+ events: function events() {
80
+ return jQuery.extend(TemplateLibraryTemplateView.prototype.events.apply(this, arguments), {
81
+ 'change @ui.favoriteCheckbox': 'onFavoriteCheckboxChange'
82
+ });
83
+ },
84
+ onPreviewButtonClick: function onPreviewButtonClick() {
85
+ $e.route('powerpack/preview', {
86
+ model: this.model
87
+ });
88
+ },
89
+ onFavoriteCheckboxChange: function onFavoriteCheckboxChange() {
90
+ var isFavorite = this.ui.favoriteCheckbox[0].checked;
91
+ this.model.set('favorite', isFavorite);
92
+ pp_templates_lib.templates.markAsFavorite(this.model, isFavorite);
93
+
94
+ if (!isFavorite && pp_templates_lib.templates.getFilter('favorite')) {
95
+ elementor.channels.templates.trigger('filter:change');
96
+ }
97
+ }
98
+ });
99
+
100
+ var TemplateLibraryPreviewView = Marionette.ItemView.extend( {
101
+ template: '#tmpl-elementor-template-library-preview',
102
+
103
+ id: 'elementor-template-library-preview',
104
+
105
+ ui: {
106
+ iframe: '> iframe',
107
+ },
108
+
109
+ onRender: function() {
110
+ this.ui.iframe.attr( 'src', this.getOption( 'url' ) );
111
+ },
112
+ } );
113
+
114
+ var TemplateLibraryHeaderPreviewView = Marionette.ItemView.extend({
115
+ template: '#tmpl-elementor-template-library-header-preview-pp',
116
+ id: 'elementor-template-library-header-preview',
117
+ behaviors: {
118
+ insertTemplate: {
119
+ behaviorClass: TemplateLibraryInsertTemplateBehavior
120
+ }
121
+ }
122
+ });
123
+
124
+ var TemplateLibraryHeaderBackView = Marionette.ItemView.extend( {
125
+ template: '#tmpl-elementor-template-library-header-back',
126
+
127
+ id: 'elementor-template-library-header-preview-back',
128
+
129
+ events: {
130
+ click: 'onClick',
131
+ },
132
+
133
+ onClick: function() {
134
+ $e.routes.restoreState( 'powerpack' );
135
+ },
136
+ } );
137
+
138
+ var TemplateLibraryCollectionView = Marionette.CompositeView.extend({
139
+ template: '#tmpl-elementor-template-library-templates-pp',
140
+ id: 'elementor-template-library-templates',
141
+ childViewContainer: '#elementor-template-library-templates-container',
142
+ reorderOnSort: true,
143
+ ui: {
144
+ textFilter: '#elementor-template-library-filter-text',
145
+ selectFilter: '.elementor-template-library-filter-select',
146
+ myFavoritesFilter: '#elementor-template-library-filter-my-favorites',
147
+ orderInputs: '.elementor-template-library-order-input',
148
+ orderLabels: 'label.elementor-template-library-order-label'
149
+ },
150
+ events: {
151
+ 'input @ui.textFilter': 'onTextFilterInput',
152
+ 'change @ui.selectFilter': 'onSelectFilterChange',
153
+ 'change @ui.myFavoritesFilter': 'onMyFavoritesFilterChange',
154
+ 'mousedown @ui.orderLabels': 'onOrderLabelsClick'
155
+ },
156
+ comparators: {
157
+ title: function title(model) {
158
+ return model.get('title').toLowerCase();
159
+ },
160
+ },
161
+ getChildView: function getChildView(childModel) {
162
+ return TemplateLibraryTemplatePowerPackView;
163
+ },
164
+ initialize: function initialize() {
165
+ this.listenTo(elementor.channels.templates, 'filter:change', this._renderChildren);
166
+ },
167
+ filter: function filter(childModel) {
168
+ var filterTerms = pp_templates_lib.templates.getFilterTerms(),
169
+ passingFilter = true;
170
+ jQuery.each(filterTerms, function (filterTermName) {
171
+ var filterValue = pp_templates_lib.templates.getFilter(filterTermName);
172
+
173
+ if (!filterValue) {
174
+ return;
175
+ }
176
+
177
+ if (this.callback) {
178
+ var callbackResult = this.callback.call(childModel, filterValue);
179
+
180
+ if (!callbackResult) {
181
+ passingFilter = false;
182
+ }
183
+
184
+ return callbackResult;
185
+ }
186
+
187
+ var filterResult = filterValue === childModel.get(filterTermName);
188
+
189
+ if (!filterResult) {
190
+ passingFilter = false;
191
+ }
192
+
193
+ return filterResult;
194
+ });
195
+ return passingFilter;
196
+ },
197
+ order: function order(by, reverseOrder) {
198
+ var comparator = this.comparators[by] || by;
199
+
200
+ if (reverseOrder) {
201
+ comparator = this.reverseOrder(comparator);
202
+ }
203
+
204
+ this.collection.comparator = comparator;
205
+ this.collection.sort();
206
+ },
207
+ reverseOrder: function reverseOrder(comparator) {
208
+ if ('function' !== typeof comparator) {
209
+ var comparatorValue = comparator;
210
+
211
+ comparator = function comparator(model) {
212
+ return model.get(comparatorValue);
213
+ };
214
+ }
215
+
216
+ return function (left, right) {
217
+ var l = comparator(left),
218
+ r = comparator(right);
219
+
220
+ if (undefined === l) {
221
+ return -1;
222
+ }
223
+
224
+ if (undefined === r) {
225
+ return 1;
226
+ }
227
+
228
+ if (l < r) {
229
+ return 1;
230
+ }
231
+
232
+ if (l > r) {
233
+ return -1;
234
+ }
235
+
236
+ return 0;
237
+ };
238
+ },
239
+ addSourceData: function addSourceData() {
240
+ var isEmpty = this.children.isEmpty();
241
+ this.$el.attr('data-template-source', isEmpty ? 'empty' : pp_templates_lib.templates.getFilter('source'));
242
+ },
243
+ setFiltersUI: function setFiltersUI() {
244
+ var $filters = this.$(this.ui.selectFilter);
245
+ $filters.select2({
246
+ placeholder: elementor.translate('category'),
247
+ allowClear: true,
248
+ width: 150,
249
+ dropdownParent: this.$el
250
+ });
251
+ },
252
+ setMasonrySkin: function setMasonrySkin() {
253
+ var masonry = new elementorModules.utils.Masonry({
254
+ container: this.$childViewContainer,
255
+ items: this.$childViewContainer.children()
256
+ });
257
+ this.$childViewContainer.imagesLoaded(masonry.run.bind(masonry));
258
+ },
259
+ toggleFilterClass: function toggleFilterClass() {
260
+ this.$el.toggleClass('elementor-templates-filter-active', !!(pp_templates_lib.templates.getFilter('text') || pp_templates_lib.templates.getFilter('favorite')));
261
+ },
262
+ onRender: function onRender() {
263
+ if ('powerpack' === pp_templates_lib.templates.getFilter('source') && 'page' !== pp_templates_lib.templates.getFilter('type')) {
264
+ this.setFiltersUI();
265
+ }
266
+ },
267
+ onRenderCollection: function onRenderCollection() {
268
+ this.addSourceData();
269
+ this.toggleFilterClass();
270
+
271
+ if ('powerpack' === pp_templates_lib.templates.getFilter('source') && 'page' !== pp_templates_lib.templates.getFilter('type')) {
272
+ this.setMasonrySkin();
273
+ }
274
+ },
275
+ onBeforeRenderEmpty: function onBeforeRenderEmpty() {
276
+ this.addSourceData();
277
+ },
278
+ onTextFilterInput: function onTextFilterInput() {
279
+ pp_templates_lib.templates.setFilter('text', this.ui.textFilter.val());
280
+ },
281
+ onSelectFilterChange: function onSelectFilterChange(event) {
282
+ var $select = jQuery(event.currentTarget),
283
+ filterName = $select.data('elementor-filter');
284
+ pp_templates_lib.templates.setFilter(filterName, $select.val());
285
+ },
286
+ onMyFavoritesFilterChange: function onMyFavoritesFilterChange() {
287
+ pp_templates_lib.templates.setFilter('favorite', this.ui.myFavoritesFilter[0].checked);
288
+ },
289
+ onOrderLabelsClick: function onOrderLabelsClick(event) {
290
+ var $clickedInput = jQuery(event.currentTarget.control),
291
+ toggle;
292
+
293
+ if (!$clickedInput[0].checked) {
294
+ toggle = 'asc' !== $clickedInput.data('default-ordering-direction');
295
+ }
296
+
297
+ $clickedInput.toggleClass('elementor-template-library-order-reverse', toggle);
298
+ this.order($clickedInput.val(), $clickedInput.hasClass('elementor-template-library-order-reverse'));
299
+ }
300
+ });
301
+
302
+ var TemplateLibraryModalLogoView = Marionette.ItemView.extend({
303
+ template: '#tmpl-elementor-templates-modal__header__logo_pp',
304
+ className: function className() {
305
+ var classes = 'elementor-templates-modal__header__logo';
306
+ return classes;
307
+ },
308
+ events: function events() {
309
+ return {
310
+ click: 'onClick'
311
+ };
312
+ },
313
+ templateHelpers: function templateHelpers() {
314
+ return {
315
+ title: this.getOption('title')
316
+ };
317
+ },
318
+ onClick: function onClick() {
319
+ var clickCallback = this.getOption('click');
320
+
321
+ if (clickCallback) {
322
+ clickCallback();
323
+ }
324
+ },
325
+ });
326
+
327
+ var TemplateLibraryHeaderActionsView = Marionette.ItemView.extend({
328
+ template: '#tmpl-elementor-template-library-header-actions-pp',
329
+ id: 'elementor-template-library-header-actions',
330
+ ui: {
331
+ sync: '#elementor-template-library-header-sync i',
332
+ },
333
+ events: {
334
+ 'click @ui.sync': 'onSyncClick',
335
+ },
336
+ onSyncClick: function() {
337
+ var self = this;
338
+ self.ui.sync.addClass('eicon-animation-spin');
339
+ pp_templates_lib.templates.requestLibraryData({
340
+ onUpdate: function onUpdate() {
341
+ self.ui.sync.removeClass('eicon-animation-spin');
342
+ $e.routes.refreshContainer('powerpack');
343
+ },
344
+ forceUpdate: true,
345
+ forceSync: true
346
+ });
347
+ },
348
+ });
349
+
350
+ var TemplateLibraryLayoutView = elementorModules.common.views.modal.Layout.extend({
351
+ getModalOptions: function() {
352
+ return {
353
+ id: 'elementor-template-library-modal',
354
+ effects: {
355
+ show: 'show',
356
+ hide: 'hide'
357
+ },
358
+ };
359
+ },
360
+ getLogoOptions: function() {
361
+ return {
362
+ title: 'PowerPack Templates',
363
+ click: function click() {
364
+ $e.run('powerpack/open', {
365
+ toDefault: true
366
+ });
367
+ return false;
368
+ }
369
+ };
370
+ },
371
+ getTemplateActionButton: function(templateData) {
372
+ var viewId = '#tmpl-elementor-template-library-insert-button';
373
+ if ( templateData.isPro && 'inactive' === templateData.proStatus ) {
374
+ viewId = '#tmpl-elementor-template-library-get-pro-button-pp';
375
+ }
376
+ if ( templateData.isPro && 'license_inactive' === templateData.proStatus ) {
377
+ viewId = '#tmpl-elementor-pro-template-library-activate-license-button-pp';
378
+ }
379
+ //viewId = elementor.hooks.applyFilters('elementor/editor/pp-template-library/template/action-button', viewId, templateData);
380
+ var template = Marionette.TemplateCache.get(viewId);
381
+ return Marionette.Renderer.render(template);
382
+ },
383
+ setHeaderDefaultParts: function() {
384
+ var headerView = this.getHeaderView();
385
+ headerView.tools.show(new TemplateLibraryHeaderActionsView());
386
+ // headerView.menuArea.show(new TemplateLibraryHeaderMenuView());
387
+ headerView.menuArea.reset();
388
+ this.showLogo();
389
+ },
390
+ showLogo: function() {
391
+ this.getHeaderView().logoArea.show( new TemplateLibraryModalLogoView( this.getLogoOptions() ) );
392
+ },
393
+ showTemplatesView: function(templatesCollection) {
394
+ this.modalContent.show(new TemplateLibraryCollectionView({
395
+ collection: templatesCollection
396
+ }));
397
+ },
398
+ showPreviewView: function(templateModel) {
399
+ this.modalContent.show(new TemplateLibraryPreviewView({
400
+ url: templateModel.get('url')
401
+ }));
402
+ var headerView = this.getHeaderView();
403
+ headerView.menuArea.reset();
404
+ headerView.tools.show(new TemplateLibraryHeaderPreviewView({
405
+ model: templateModel
406
+ }));
407
+ headerView.logoArea.show(new TemplateLibraryHeaderBackView());
408
+ },
409
+ });
410
+
411
+ var Component = function(ComponentModal) {
412
+ Component.prototype = Object.create(ComponentModal && ComponentModal.prototype, {
413
+ constructor: {
414
+ value: Component,
415
+ writable: true,
416
+ configurable: true
417
+ }
418
+ });
419
+ Object.setPrototypeOf(Component, ComponentModal);
420
+ function Component() {
421
+ return Object.getPrototypeOf(Component).apply(this, arguments);
422
+ }
423
+ var parent = Object.getPrototypeOf( Component.prototype );
424
+ Component.prototype.__construct = function(args) {
425
+ parent.__construct.call( this, args );
426
+ elementor.on( 'document:loaded', this.onDocumentLoaded.bind( this ) );
427
+ };
428
+ Component.prototype.getNamespace = function() {
429
+ return 'powerpack';
430
+ };
431
+ Component.prototype.defaultTabs = function() {
432
+ return {
433
+ 'templates/blocks': {
434
+ title: 'Blocks',
435
+ getFilter: function() {
436
+ return {
437
+ source: 'powerpack',
438
+ type: 'block',
439
+ subtype: elementor.config.document.remoteLibrary.category,
440
+ }
441
+ }
442
+ }
443
+ };
444
+ };
445
+ Component.prototype.defaultRoutes = function() {
446
+ return {
447
+ preview: function(args) {
448
+ this.manager.layout.showPreviewView(args.model);
449
+ }
450
+ };
451
+ },
452
+ Component.prototype.defaultCommands = function() {
453
+ return Object.assign( parent.defaultCommands.call( this ), {
454
+ open: this.show,
455
+ 'insert-template': this.insertTemplate
456
+ } );
457
+ };
458
+ Component.prototype.defaultShortcuts = function() {
459
+ return {
460
+ open: {
461
+ keys: 'ctrl+shift+p',
462
+ }
463
+ };
464
+ };
465
+ Component.prototype.onDocumentLoaded = function( document ) {
466
+ this.setDefaultRoute( 'templates/blocks' );
467
+ this.maybeOpenLibrary();
468
+ };
469
+ Component.prototype.renderTab = function(tab) {
470
+ var currentTab = this.tabs[tab],
471
+ filter = currentTab.getFilter ? currentTab.getFilter() : currentTab.filter;
472
+ this.manager.setScreen(filter);
473
+ };
474
+ Component.prototype.activateTab = function(tab) {
475
+ $e.routes.saveState('powerpack');
476
+ parent.activateTab.call( this, tab );
477
+ };
478
+ Component.prototype.open = function() {
479
+ parent.open.call( this );
480
+
481
+ if ( ! this.manager.layout ) {
482
+ this.manager.layout = this.layout;
483
+ }
484
+
485
+ this.manager.layout.setHeaderDefaultParts();
486
+
487
+ return true;
488
+ };
489
+ Component.prototype.close = function() {
490
+ if ( ! parent.close.call( this ) ) {
491
+ return false;
492
+ }
493
+
494
+ this.manager.modalConfig = {};
495
+
496
+ return true;
497
+ };
498
+ Component.prototype.show = function( args ) {
499
+ this.manager.modalConfig = args;
500
+
501
+ if ( args.toDefault || ! $e.routes.restoreState( 'powerpack' ) ) {
502
+ $e.route( this.getDefaultRoute() );
503
+ }
504
+ };
505
+ Component.prototype.insertTemplate = function( args ) {
506
+ var autoImportSettings = false,
507
+ model = args.model,
508
+ self = this;
509
+
510
+ var withPageSettings = args.withPageSettings || null;
511
+
512
+ if ( autoImportSettings ) {
513
+ withPageSettings = true;
514
+ }
515
+
516
+ if ( null === withPageSettings && model.get( 'hasPageSettings' ) ) {
517
+ var insertTemplateHandler = this.getImportSettingsDialog();
518
+
519
+ insertTemplateHandler.showImportDialog( model );
520
+
521
+ return;
522
+ }
523
+
524
+ this.manager.layout.showLoadingView();
525
+
526
+ this.manager.requestTemplateContent( model.get( 'source' ), model.get( 'template_id' ), {
527
+ data: {
528
+ with_page_settings: withPageSettings,
529
+ },
530
+ success: function( data ) {
531
+ // Clone the `modalConfig.importOptions` because it deleted during the closing.
532
+ var importOptions = jQuery.extend( {}, self.manager.modalConfig.importOptions );
533
+
534
+ importOptions.withPageSettings = withPageSettings;
535
+
536
+ // Hide for next open.
537
+ self.manager.layout.hideLoadingView();
538
+
539
+ self.manager.layout.hideModal();
540
+
541
+ $e.run( 'document/elements/import', {
542
+ model,
543
+ data,
544
+ options: importOptions,
545
+ } );
546
+ },
547
+ error: function( data ) {
548
+ self.manager.showErrorDialog( data );
549
+ },
550
+ complete: function() {
551
+ self.manager.layout.hideLoadingView();
552
+ },
553
+ } );
554
+
555
+ Component.prototype.getImportSettingsDialog = function() {
556
+ var InsertTemplateHandler = {
557
+ dialog: null,
558
+
559
+ showImportDialog: function( model ) {
560
+ var dialog = InsertTemplateHandler.getDialog();
561
+
562
+ dialog.onConfirm = function() {
563
+ $e.run( 'library/insert-template', {
564
+ model,
565
+ withPageSettings: true,
566
+ } );
567
+ };
568
+
569
+ dialog.onCancel = function() {
570
+ $e.run( 'library/insert-template', {
571
+ model,
572
+ withPageSettings: false,
573
+ } );
574
+ };
575
+
576
+ dialog.show();
577
+ },
578
+
579
+ initDialog: function() {
580
+ InsertTemplateHandler.dialog = elementorCommon.dialogsManager.createWidget( 'confirm', {
581
+ id: 'elementor-insert-template-settings-dialog',
582
+ headerMessage: elementor.translate( 'import_template_dialog_header' ),
583
+ message: elementor.translate( 'import_template_dialog_message' ) + '<br>' + elementor.translate( 'import_template_dialog_message_attention' ),
584
+ strings: {
585
+ confirm: elementor.translate( 'yes' ),
586
+ cancel: elementor.translate( 'no' ),
587
+ },
588
+ } );
589
+ },
590
+
591
+ getDialog: function() {
592
+ if ( ! InsertTemplateHandler.dialog ) {
593
+ InsertTemplateHandler.initDialog();
594
+ }
595
+
596
+ return InsertTemplateHandler.dialog;
597
+ },
598
+ };
599
+
600
+ return InsertTemplateHandler;
601
+ };
602
+ };
603
+ Component.prototype.getTabsWrapperSelector = function() {
604
+ return '#elementor-template-library-header-menu';
605
+ };
606
+ Component.prototype.getModalLayout = function() {
607
+ return TemplateLibraryLayoutView;
608
+ };
609
+ Component.prototype.maybeOpenLibrary = function() {
610
+ if ('#powerpack' === location.hash) {
611
+ $e.run('powerpack/open');
612
+ location.hash = '';
613
+ }
614
+ };
615
+
616
+ return Component;
617
+ }(elementorModules.common.ComponentModal);
618
+
619
+
620
+ var TemplateLibraryManager = function TemplateLibraryManager() {
621
+ var self = this,
622
+ errorDialog,
623
+ config = {},
624
+ templateTypes = {},
625
+ filterTerms = {},
626
+ templatesCollection = false;
627
+
628
+ this.modalConfig = {};
629
+
630
+ var registerDefaultFilterTerms = function() {
631
+ filterTerms = {
632
+ text: {
633
+ callback: function callback(value) {
634
+ value = value.toLowerCase();
635
+
636
+ if (this.get('title').toLowerCase().indexOf(value) >= 0) {
637
+ return true;
638
+ }
639
+
640
+ return _.any(this.get('tags'), function (tag) {
641
+ return tag.toLowerCase().indexOf(value) >= 0;
642
+ });
643
+ }
644
+ },
645
+ type: {},
646
+ subtype: {},
647
+ favorite: {}
648
+ };
649
+ };
650
+
651
+ this.getFilter = function (name) {
652
+ return elementor.channels.templates.request('filter:' + name);
653
+ };
654
+
655
+ this.setFilter = function (name, value, silent) {
656
+ elementor.channels.templates.reply('filter:' + name, value);
657
+
658
+ if (!silent) {
659
+ elementor.channels.templates.trigger('filter:change');
660
+ }
661
+ };
662
+
663
+ this.setScreen = function (args) {
664
+ elementor.channels.templates.stopReplying();
665
+ self.setFilter('source', args.source, true);
666
+ self.setFilter('type', args.type, true);
667
+ self.setFilter('subtype', args.subtype, true);
668
+ self.showTemplates();
669
+ };
670
+
671
+ this.getTemplatesCollection = function () {
672
+ return templatesCollection;
673
+ };
674
+
675
+ this.getConfig = function (item) {
676
+ if (item) {
677
+ return config[item] ? config[item] : {};
678
+ }
679
+
680
+ return config;
681
+ };
682
+
683
+ this.getFilterTerms = function (termName) {
684
+ if (termName) {
685
+ return filterTerms[termName];
686
+ }
687
+
688
+ return filterTerms;
689
+ };
690
+
691
+ this.requestLibraryData = function (options) {
692
+ if (templatesCollection && !options.forceUpdate) {
693
+ if (options.onUpdate) {
694
+ options.onUpdate();
695
+ }
696
+
697
+ return;
698
+ }
699
+
700
+ if (options.onBeforeUpdate) {
701
+ options.onBeforeUpdate();
702
+ }
703
+
704
+ var ajaxOptions = {
705
+ data: {},
706
+ success: function success(data) {
707
+ templatesCollection = new TemplateLibraryCollection(data.templates);
708
+
709
+ if (data.config) {
710
+ config = data.config;
711
+ }
712
+
713
+ if (options.onUpdate) {
714
+ options.onUpdate();
715
+ }
716
+ }
717
+ };
718
+
719
+ if (options.forceSync) {
720
+ ajaxOptions.data.sync = true;
721
+ }
722
+
723
+ elementorCommon.ajax.addRequest('pp_get_library_data', ajaxOptions);
724
+ };
725
+
726
+ this.loadTemplates = function (_onUpdate) {
727
+ self.requestLibraryData({
728
+ onBeforeUpdate: self.layout.showLoadingView.bind(self.layout),
729
+ onUpdate: function onUpdate() {
730
+ self.layout.hideLoadingView();
731
+
732
+ if (_onUpdate) {
733
+ _onUpdate();
734
+ }
735
+ }
736
+ });
737
+ };
738
+
739
+ this.showTemplates = function () {
740
+ // The tabs should exist in DOM on loading.
741
+ self.layout.setHeaderDefaultParts();
742
+ self.layout.showModal();
743
+ //self.layout.modal.refreshPosition();
744
+ self.loadTemplates(function () {
745
+ var templatesToShow = self.filterTemplates();
746
+ self.layout.showTemplatesView(new TemplateLibraryCollection(templatesToShow));
747
+ });
748
+ };
749
+
750
+ this.filterTemplates = function () {
751
+ //var activeSource = 'powerpack';
752
+ return templatesCollection.filter(function (model) {
753
+ if ('powerpack' !== model.get('source')) {
754
+ return false;
755
+ }
756
+
757
+ return 'block' === model.get('type');
758
+ });
759
+ };
760
+
761
+ this.requestTemplateContent = function (source, id, ajaxOptions) {
762
+ var options = {
763
+ unique_id: id,
764
+ data: {
765
+ source: source,
766
+ edit_mode: true,
767
+ display: true,
768
+ template_id: id
769
+ }
770
+ };
771
+
772
+ if (ajaxOptions) {
773
+ jQuery.extend(true, options, ajaxOptions);
774
+ }
775
+
776
+ return elementorCommon.ajax.addRequest('get_template_data', options);
777
+ };
778
+
779
+ this.markAsFavorite = function (templateModel, favorite) {
780
+ var options = {
781
+ data: {
782
+ source: templateModel.get('source'),
783
+ template_id: templateModel.get('template_id'),
784
+ favorite: favorite
785
+ }
786
+ };
787
+ return elementorCommon.ajax.addRequest('mark_template_as_favorite', options);
788
+ };
789
+
790
+ this.getErrorDialog = function() {
791
+ if ( ! errorDialog ) {
792
+ errorDialog = elementorCommon.dialogsManager.createWidget( 'alert', {
793
+ id: 'elementor-template-library-error-dialog',
794
+ headerMessage: elementor.translate( 'an_error_occurred' ),
795
+ } );
796
+ }
797
+
798
+ return errorDialog;
799
+ };
800
+
801
+ this.showErrorDialog = function( errorMessage ) {
802
+ if ( 'object' === typeof errorMessage ) {
803
+ var message = '';
804
+
805
+ _.each( errorMessage, function( error ) {
806
+ message += '<div>' + error.message + '.</div>';
807
+ } );
808
+
809
+ errorMessage = message;
810
+ } else if ( errorMessage ) {
811
+ errorMessage += '.';
812
+ } else {
813
+ errorMessage = '<i>&#60;The error message is empty&#62;</i>';
814
+ }
815
+
816
+ self.getErrorDialog()
817
+ .setMessage( elementor.translate( 'templates_request_error' ) + '<div id="elementor-template-library-error-info">' + errorMessage + '</div>' )
818
+ .show();
819
+ };
820
+
821
+ this.init = function() {
822
+ registerDefaultFilterTerms();
823
+ this.component = $e.components.register(new Component({
824
+ manager: this
825
+ }));
826
+ };
827
+ };
828
+
829
+ pp_templates_lib.templates = new TemplateLibraryManager();
830
+ pp_templates_lib.templates.init();
831
+
832
+ elementor.on('document:loaded', function() {
833
+ var $previewContents = elementor.$previewContents;
834
+
835
+ var $templateLibBtnStyle = $( '<style />' ),
836
+ btnStyle = '';
837
+ btnStyle += '.elementor-add-section-area-button.pp-add-template-button { margin-left: 8px; vertical-align: bottom; }';
838
+ btnStyle += '.elementor-add-section-area-button.pp-add-template-button img { height: 40px; }';
839
+
840
+ $templateLibBtnStyle.html( btnStyle );
841
+
842
+ $previewContents.find('head').append( $templateLibBtnStyle );
843
+
844
+ var $templateLibBtn = $('<div />');
845
+
846
+ $templateLibBtn.addClass( 'elementor-add-section-area-button pp-add-template-button' );
847
+ $templateLibBtn.attr( 'title', 'Add PowerPack Template' );
848
+ $templateLibBtn.html( '<img src="' + pp_templates_lib.logoUrl + '" />' );
849
+ $templateLibBtn.insertAfter( $previewContents.find('.elementor-add-section-area-button.elementor-add-template-button') );
850
+ $templateLibBtn.on( 'click', function() {
851
+ $e.run('powerpack/open');
852
+ });
853
+ });
854
+
855
+ } )( elementor, jQuery, window );
assets/lib/instafeed/instafeed.js ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by CoffeeScript 1.9.3
2
+ (function() {
3
+ var Instafeed;
4
+
5
+ Instafeed = (function() {
6
+ function Instafeed(params, context) {
7
+ var option, value;
8
+ this.options = {
9
+ target: 'instafeed',
10
+ get: 'popular',
11
+ resolution: 'thumbnail',
12
+ sortBy: 'none',
13
+ links: true,
14
+ mock: false,
15
+ useHttp: false
16
+ };
17
+ if (typeof params === 'object') {
18
+ for (option in params) {
19
+ value = params[option];
20
+ this.options[option] = value;
21
+ }
22
+ }
23
+ this.context = context != null ? context : this;
24
+ this.unique = this._genKey();
25
+ }
26
+
27
+ Instafeed.prototype.hasNext = function() {
28
+ return typeof this.context.nextUrl === 'string' && this.context.nextUrl.length > 0;
29
+ };
30
+
31
+ Instafeed.prototype.next = function() {
32
+ if (!this.hasNext()) {
33
+ return false;
34
+ }
35
+ return this.run(this.context.nextUrl);
36
+ };
37
+
38
+ Instafeed.prototype.run = function(url) {
39
+ var header, instanceName, script;
40
+ if (typeof this.options.clientId !== 'string') {
41
+ if (typeof this.options.accessToken !== 'string') {
42
+ throw new Error("Missing clientId or accessToken.");
43
+ }
44
+ }
45
+ if (typeof this.options.accessToken !== 'string') {
46
+ if (typeof this.options.clientId !== 'string') {
47
+ throw new Error("Missing clientId or accessToken.");
48
+ }
49
+ }
50
+ if ((this.options.before != null) && typeof this.options.before === 'function') {
51
+ this.options.before.call(this);
52
+ }
53
+ if (typeof document !== "undefined" && document !== null) {
54
+ script = document.createElement('script');
55
+ script.id = 'instafeed-fetcher';
56
+ script.src = url || this._buildUrl();
57
+ header = document.getElementsByTagName('head');
58
+ header[0].appendChild(script);
59
+ instanceName = "instafeedCache" + this.unique;
60
+ window[instanceName] = new Instafeed(this.options, this);
61
+ window[instanceName].unique = this.unique;
62
+ }
63
+ return true;
64
+ };
65
+
66
+ Instafeed.prototype.parse = function(response) {
67
+ var anchor, childNodeCount, childNodeIndex, childNodesArr, e, eMsg, fragment, header, htmlString, httpProtocol, i, image, imageObj, imageString, imageUrl, images, img, imgHeight, imgOrient, imgUrl, imgWidth, instanceName, j, k, len, len1, len2, node, parsedLimit, reverse, sortSettings, targetEl, tmpEl;
68
+ if (typeof response !== 'object') {
69
+ if ((this.options.error != null) && typeof this.options.error === 'function') {
70
+ this.options.error.call(this, 'Invalid JSON data');
71
+ return false;
72
+ } else {
73
+ throw new Error('Invalid JSON response');
74
+ }
75
+ }
76
+ if (response.meta.code !== 200) {
77
+ if ((this.options.error != null) && typeof this.options.error === 'function') {
78
+ this.options.error.call(this, response.meta.error_message);
79
+ return false;
80
+ } else {
81
+ throw new Error("Error from Instagram: " + response.meta.error_message);
82
+ }
83
+ }
84
+ if (response.data.length === 0) {
85
+ if ((this.options.error != null) && typeof this.options.error === 'function') {
86
+ this.options.error.call(this, 'No images were returned from Instagram');
87
+ return false;
88
+ } else {
89
+ throw new Error('No images were returned from Instagram');
90
+ }
91
+ }
92
+ if ((this.options.success != null) && typeof this.options.success === 'function') {
93
+ this.options.success.call(this, response);
94
+ }
95
+ this.context.nextUrl = '';
96
+ if (response.pagination != null) {
97
+ this.context.nextUrl = response.pagination.next_url;
98
+ }
99
+ if (this.options.sortBy !== 'none') {
100
+ if (this.options.sortBy === 'random') {
101
+ sortSettings = ['', 'random'];
102
+ } else {
103
+ sortSettings = this.options.sortBy.split('-');
104
+ }
105
+ reverse = sortSettings[0] === 'least' ? true : false;
106
+ switch (sortSettings[1]) {
107
+ case 'random':
108
+ response.data.sort(function() {
109
+ return 0.5 - Math.random();
110
+ });
111
+ break;
112
+ case 'recent':
113
+ response.data = this._sortBy(response.data, 'created_time', reverse);
114
+ break;
115
+ case 'liked':
116
+ response.data = this._sortBy(response.data, 'likes.count', reverse);
117
+ break;
118
+ case 'commented':
119
+ response.data = this._sortBy(response.data, 'comments.count', reverse);
120
+ break;
121
+ default:
122
+ throw new Error("Invalid option for sortBy: '" + this.options.sortBy + "'.");
123
+ }
124
+ }
125
+ if ((typeof document !== "undefined" && document !== null) && this.options.mock === false) {
126
+ images = response.data;
127
+ parsedLimit = parseInt(this.options.limit, 10);
128
+ if ((this.options.limit != null) && images.length > parsedLimit) {
129
+ images = images.slice(0, parsedLimit);
130
+ }
131
+ fragment = document.createDocumentFragment();
132
+ if ((this.options.filter != null) && typeof this.options.filter === 'function') {
133
+ images = this._filter(images, this.options.filter);
134
+ }
135
+ if ((this.options.template != null) && typeof this.options.template === 'string') {
136
+ htmlString = '';
137
+ imageString = '';
138
+ imgUrl = '';
139
+ tmpEl = document.createElement('div');
140
+ for (i = 0, len = images.length; i < len; i++) {
141
+ image = images[i];
142
+ imageObj = image.images[this.options.resolution];
143
+ if (typeof imageObj !== 'object') {
144
+ eMsg = "No image found for resolution: " + this.options.resolution + ".";
145
+ throw new Error(eMsg);
146
+ }
147
+ imgWidth = imageObj.width;
148
+ imgHeight = imageObj.height;
149
+ imgOrient = "square";
150
+ if (imgWidth > imgHeight) {
151
+ imgOrient = "landscape";
152
+ }
153
+ if (imgWidth < imgHeight) {
154
+ imgOrient = "portrait";
155
+ }
156
+ imageUrl = imageObj.url;
157
+ httpProtocol = window.location.protocol.indexOf("http") >= 0;
158
+ if (httpProtocol && !this.options.useHttp) {
159
+ imageUrl = imageUrl.replace(/https?:\/\//, '//');
160
+ }
161
+ imageString = this._makeTemplate(this.options.template, {
162
+ model: image,
163
+ id: image.id,
164
+ link: image.link,
165
+ type: image.type,
166
+ image: imageUrl,
167
+ width: imgWidth,
168
+ height: imgHeight,
169
+ orientation: imgOrient,
170
+ caption: this._getObjectProperty(image, 'caption.text'),
171
+ likes: image.likes.count,
172
+ comments: image.comments.count,
173
+ location: this._getObjectProperty(image, 'location.name')
174
+ });
175
+ htmlString += imageString;
176
+ }
177
+ tmpEl.innerHTML = htmlString;
178
+ childNodesArr = [];
179
+ childNodeIndex = 0;
180
+ childNodeCount = tmpEl.childNodes.length;
181
+ while (childNodeIndex < childNodeCount) {
182
+ childNodesArr.push(tmpEl.childNodes[childNodeIndex]);
183
+ childNodeIndex += 1;
184
+ }
185
+ for (j = 0, len1 = childNodesArr.length; j < len1; j++) {
186
+ node = childNodesArr[j];
187
+ fragment.appendChild(node);
188
+ }
189
+ } else {
190
+ for (k = 0, len2 = images.length; k < len2; k++) {
191
+ image = images[k];
192
+ img = document.createElement('img');
193
+ imageObj = image.images[this.options.resolution];
194
+ if (typeof imageObj !== 'object') {
195
+ eMsg = "No image found for resolution: " + this.options.resolution + ".";
196
+ throw new Error(eMsg);
197
+ }
198
+ imageUrl = imageObj.url;
199
+ httpProtocol = window.location.protocol.indexOf("http") >= 0;
200
+ if (httpProtocol && !this.options.useHttp) {
201
+ imageUrl = imageUrl.replace(/https?:\/\//, '//');
202
+ }
203
+ img.src = imageUrl;
204
+ if (this.options.links === true) {
205
+ anchor = document.createElement('a');
206
+ anchor.href = image.link;
207
+ anchor.appendChild(img);
208
+ fragment.appendChild(anchor);
209
+ } else {
210
+ fragment.appendChild(img);
211
+ }
212
+ }
213
+ }
214
+ targetEl = this.options.target;
215
+ if (typeof targetEl === 'string') {
216
+ targetEl = document.getElementById(targetEl);
217
+ }
218
+ if (targetEl == null) {
219
+ eMsg = "No element with id=\"" + this.options.target + "\" on page.";
220
+ throw new Error(eMsg);
221
+ }
222
+ targetEl.appendChild(fragment);
223
+ header = document.getElementsByTagName('head')[0];
224
+ header.removeChild(document.getElementById('instafeed-fetcher'));
225
+ instanceName = "instafeedCache" + this.unique;
226
+ window[instanceName] = void 0;
227
+ try {
228
+ delete window[instanceName];
229
+ } catch (_error) {
230
+ e = _error;
231
+ }
232
+ }
233
+ if ((this.options.after != null) && typeof this.options.after === 'function') {
234
+ this.options.after.call(this);
235
+ }
236
+ return true;
237
+ };
238
+
239
+ Instafeed.prototype._buildUrl = function() {
240
+ var base, endpoint, final;
241
+ base = "https://api.instagram.com/v1";
242
+ switch (this.options.get) {
243
+ case "popular":
244
+ endpoint = "media/popular";
245
+ break;
246
+ case "tagged":
247
+ if (!this.options.tagName) {
248
+ throw new Error("No tag name specified. Use the 'tagName' option.");
249
+ }
250
+ endpoint = "tags/" + this.options.tagName + "/media/recent";
251
+ break;
252
+ case "location":
253
+ if (!this.options.locationId) {
254
+ throw new Error("No location specified. Use the 'locationId' option.");
255
+ }
256
+ endpoint = "locations/" + this.options.locationId + "/media/recent";
257
+ break;
258
+ case "user":
259
+ if (!this.options.userId) {
260
+ throw new Error("No user specified. Use the 'userId' option.");
261
+ }
262
+ endpoint = "users/" + this.options.userId + "/media/recent";
263
+ break;
264
+ default:
265
+ throw new Error("Invalid option for get: '" + this.options.get + "'.");
266
+ }
267
+ final = base + "/" + endpoint;
268
+ if (this.options.accessToken != null) {
269
+ final += "?access_token=" + this.options.accessToken;
270
+ } else {
271
+ final += "?client_id=" + this.options.clientId;
272
+ }
273
+ if (this.options.limit != null) {
274
+ final += "&count=" + this.options.limit;
275
+ }
276
+ final += "&callback=instafeedCache" + this.unique + ".parse";
277
+ return final;
278
+ };
279
+
280
+ Instafeed.prototype._genKey = function() {
281
+ var S4;
282
+ S4 = function() {
283
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
284
+ };
285
+ return "" + (S4()) + (S4()) + (S4()) + (S4());
286
+ };
287
+
288
+ Instafeed.prototype._makeTemplate = function(template, data) {
289
+ var output, pattern, ref, varName, varValue;
290
+ pattern = /(?:\{{2})([\w\[\]\.]+)(?:\}{2})/;
291
+ output = template;
292
+ while (pattern.test(output)) {
293
+ varName = output.match(pattern)[1];
294
+ varValue = (ref = this._getObjectProperty(data, varName)) != null ? ref : '';
295
+ output = output.replace(pattern, function() {
296
+ return "" + varValue;
297
+ });
298
+ }
299
+ return output;
300
+ };
301
+
302
+ Instafeed.prototype._getObjectProperty = function(object, property) {
303
+ var piece, pieces;
304
+ property = property.replace(/\[(\w+)\]/g, '.$1');
305
+ pieces = property.split('.');
306
+ while (pieces.length) {
307
+ piece = pieces.shift();
308
+ if ((object != null) && piece in object) {
309
+ object = object[piece];
310
+ } else {
311
+ return null;
312
+ }
313
+ }
314
+ return object;
315
+ };
316
+
317
+ Instafeed.prototype._sortBy = function(data, property, reverse) {
318
+ var sorter;
319
+ sorter = function(a, b) {
320
+ var valueA, valueB;
321
+ valueA = this._getObjectProperty(a, property);
322
+ valueB = this._getObjectProperty(b, property);
323
+ if (reverse) {
324
+ if (valueA > valueB) {
325
+ return 1;
326
+ } else {
327
+ return -1;
328
+ }
329
+ }
330
+ if (valueA < valueB) {
331
+ return 1;
332
+ } else {
333
+ return -1;
334
+ }
335
+ };
336
+ data.sort(sorter.bind(this));
337
+ return data;
338
+ };
339
+
340
+ Instafeed.prototype._filter = function(images, filter) {
341
+ var filteredImages, fn, i, image, len;
342
+ filteredImages = [];
343
+ fn = function(image) {
344
+ if (filter(image)) {
345
+ return filteredImages.push(image);
346
+ }
347
+ };
348
+ for (i = 0, len = images.length; i < len; i++) {
349
+ image = images[i];
350
+ fn(image);
351
+ }
352
+ return filteredImages;
353
+ };
354
+
355
+ return Instafeed;
356
+
357
+ })();
358
+
359
+ (function(root, factory) {
360
+ if (typeof define === 'function' && define.amd) {
361
+ return define([], factory);
362
+ } else if (typeof module === 'object' && module.exports) {
363
+ return module.exports = factory();
364
+ } else {
365
+ return root.Instafeed = factory();
366
+ }
367
+ })(this, function() {
368
+ return Instafeed;
369
+ });
370
+
371
+ }).call(this);
changelog.txt CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  == 1.3.0 ==
2
  Release date: July 20, 2020
3
  * Enhancement: Updated admin panel UI
1
+ == 2.0.0 ==
2
+ Release date: July 29, 2020
3
+ * New: Template Library
4
+ * Added: Team Member Carousel - border, radius and padding options for team member box
5
+ * Added: Flipbox - Icon text option
6
+ * Added: Flipbox - Title HTML tag option
7
+
8
  == 1.3.0 ==
9
  Release date: July 20, 2020
10
  * Enhancement: Updated admin panel UI
classes/class-pp-templates-lib.php ADDED
@@ -0,0 +1,739 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PowerPack Template Library.
4
+ *
5
+ * @package PowerPackElements
6
+ */
7
+
8
+ namespace PowerpackElementsLite\Classes;
9
+
10
+ use Elementor\Plugin;
11
+ use Elementor\TemplateLibrary\Source_Base;
12
+ use Elementor\TemplateLibrary\Source_Local;
13
+ use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
14
+ use Elementor\User;
15
+
16
+ /**
17
+ * PowerPack Template Library.
18
+ *
19
+ * @since 1.6.0
20
+ */
21
+ class PP_Templates_Lib {
22
+ /**
23
+ * PowerPack library option key.
24
+ */
25
+ const LIBRARY_OPTION_KEY = 'pp_templates_library';
26
+
27
+ /**
28
+ * API templates URL.
29
+ *
30
+ * Holds the URL of the templates API.
31
+ *
32
+ * @access public
33
+ * @static
34
+ *
35
+ * @var string API URL.
36
+ */
37
+ public static $api_url = 'https://demo.powerpackelements.com/api/powerpack/v1/templates';
38
+
39
+ /**
40
+ * Init.
41
+ *
42
+ * Initializes the hooks.
43
+ *
44
+ * @since 1.6.0
45
+ * @access public
46
+ *
47
+ * @return void
48
+ */
49
+ public static function init() {
50
+ add_action( 'elementor/init', [ __CLASS__, 'register_source' ] );
51
+ add_action( 'elementor/editor/after_enqueue_scripts', [ __CLASS__, 'enqueue_editor_scripts' ] );
52
+ add_action( 'elementor/ajax/register_actions', [ __CLASS__, 'register_ajax_actions' ] );
53
+ add_action( 'elementor/editor/footer', [ __CLASS__, 'render_template' ] );
54
+ // add_action( 'wp_ajax_elementor_reset_library', [ __CLASS__, 'ajax_reset_api_data' ] ); @codingStandardsIgnoreLine.
55
+ }
56
+
57
+ /**
58
+ * Register source.
59
+ *
60
+ * Registers the library source.
61
+ *
62
+ * @since 1.6.0
63
+ * @access public
64
+ *
65
+ * @return void
66
+ */
67
+ public static function register_source() {
68
+ Plugin::$instance->templates_manager->register_source( __NAMESPACE__ . '\PP_Source' );
69
+ }
70
+
71
+ /**
72
+ * Enqueue Editor Scripts.
73
+ *
74
+ * Enqueues required scripts in Elementor edit mode.
75
+ *
76
+ * @since 1.6.0
77
+ * @access public
78
+ *
79
+ * @return void
80
+ */
81
+ public static function enqueue_editor_scripts() {
82
+ wp_enqueue_script(
83
+ 'powerpack-templates-lib',
84
+ POWERPACK_ELEMENTS_LITE_URL . 'assets/js/pp-templates-lib.js',
85
+ [
86
+ 'jquery',
87
+ 'backbone-marionette',
88
+ 'backbone-radio',
89
+ 'elementor-common-modules',
90
+ 'elementor-dialog',
91
+ 'powerpack-editor',
92
+ ],
93
+ POWERPACK_ELEMENTS_LITE_VER,
94
+ true
95
+ );
96
+
97
+ wp_localize_script( 'powerpack-templates-lib', 'pp_templates_lib', array(
98
+ 'logoUrl' => POWERPACK_ELEMENTS_LITE_URL . 'assets/images/pp-logo-sm.png',
99
+ ) );
100
+ }
101
+
102
+ /**
103
+ * Init ajax calls.
104
+ *
105
+ * Initialize template library ajax calls for allowed ajax requests.
106
+ *
107
+ * @since 1.6.0
108
+ * @access public
109
+ *
110
+ * @param Ajax $ajax Elementor's Ajax object.
111
+ * @return void
112
+ */
113
+ public static function register_ajax_actions( Ajax $ajax ) {
114
+ $library_ajax_requests = [
115
+ 'pp_get_library_data',
116
+ ];
117
+
118
+ foreach ( $library_ajax_requests as $ajax_request ) {
119
+ $ajax->register_ajax_action( $ajax_request, function( $data ) use ( $ajax_request ) {
120
+ return self::handle_ajax_request( $ajax_request, $data );
121
+ } );
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Handle ajax request.
127
+ *
128
+ * Fire authenticated ajax actions for any given ajax request.
129
+ *
130
+ * @since 1.6.0
131
+ * @access private
132
+ *
133
+ * @param string $ajax_request Ajax request.
134
+ * @param array $data Elementor data.
135
+ *
136
+ * @return mixed
137
+ * @throws \Exception Throws error message.
138
+ */
139
+ private static function handle_ajax_request( $ajax_request, array $data ) {
140
+ if ( ! User::is_current_user_can_edit_post_type( Source_Local::CPT ) ) {
141
+ throw new \Exception( 'Access Denied' );
142
+ }
143
+
144
+ if ( ! empty( $data['editor_post_id'] ) ) {
145
+ $editor_post_id = absint( $data['editor_post_id'] );
146
+
147
+ if ( ! get_post( $editor_post_id ) ) {
148
+ throw new \Exception( __( 'Post not found.', 'powerpack' ) );
149
+ }
150
+
151
+ Plugin::$instance->db->switch_to_post( $editor_post_id );
152
+ }
153
+
154
+ $result = call_user_func( [ __CLASS__, $ajax_request ], $data );
155
+
156
+ if ( is_wp_error( $result ) ) {
157
+ throw new \Exception( $result->get_error_message() );
158
+ }
159
+
160
+ return $result;
161
+ }
162
+
163
+ /**
164
+ * Get library data.
165
+ *
166
+ * Get data for template library.
167
+ *
168
+ * @since 1.6.0
169
+ * @access public
170
+ *
171
+ * @param array $args Arguments.
172
+ *
173
+ * @return array Collection of templates data.
174
+ */
175
+ public static function pp_get_library_data( array $args ) {
176
+ $library_data = self::get_library_data( ! empty( $args['sync'] ) );
177
+
178
+ // Ensure all document are registered.
179
+ Plugin::$instance->documents->get_document_types();
180
+
181
+ return [
182
+ 'templates' => self::get_templates(),
183
+ 'config' => $library_data['types_data'],
184
+ ];
185
+ }
186
+
187
+ /**
188
+ * Get templates.
189
+ *
190
+ * Retrieve all the templates from all the registered sources.
191
+ *
192
+ * @since 1.16.0
193
+ * @access public
194
+ *
195
+ * @return array Templates array.
196
+ */
197
+ public static function get_templates() {
198
+ $source = Plugin::$instance->templates_manager->get_source( 'powerpack' );
199
+ return $source->get_items();
200
+ }
201
+
202
+ /**
203
+ * Ajax reset API data.
204
+ *
205
+ * Reset Elementor library API data using an ajax call.
206
+ *
207
+ * @since 1.6.0
208
+ * @access public
209
+ * @static
210
+ */
211
+ public static function ajax_reset_api_data() {
212
+ check_ajax_referer( 'elementor_reset_library', '_nonce' );
213
+
214
+ self::get_templates_data( true );
215
+
216
+ wp_send_json_success();
217
+ }
218
+
219
+ /**
220
+ * Get templates data.
221
+ *
222
+ * This function the templates data.
223
+ *
224
+ * @since 1.6.0
225
+ * @access private
226
+ * @static
227
+ *
228
+ * @param bool $force_update Optional. Whether to force the data retrieval or
229
+ * not. Default is false.
230
+ *
231
+ * @return array|false Templates data, or false.
232
+ */
233
+ private static function get_templates_data( $force_update = false ) {
234
+ $cache_key = 'pp_templates_data_' . POWERPACK_ELEMENTS_LITE_VER;
235
+
236
+ $templates_data = get_transient( $cache_key );
237
+
238
+ if ( $force_update || false === $templates_data ) {
239
+ $timeout = ( $force_update ) ? 25 : 8;
240
+
241
+ $response = wp_remote_get( self::$api_url, [
242
+ 'timeout' => $timeout,
243
+ 'body' => [
244
+ // Which API version is used.
245
+ 'api_version' => POWERPACK_ELEMENTS_LITE_VER,
246
+ // Which language to return.
247
+ 'site_lang' => get_bloginfo( 'language' ),
248
+ ],
249
+ ] );
250
+
251
+ if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
252
+ set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS );
253
+
254
+ return false;
255
+ }
256
+
257
+ $templates_data = json_decode( wp_remote_retrieve_body( $response ), true );
258
+
259
+ if ( empty( $templates_data ) || ! is_array( $templates_data ) ) {
260
+ set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS );
261
+
262
+ return false;
263
+ }
264
+
265
+ if ( isset( $templates_data['library'] ) ) {
266
+ update_option( self::LIBRARY_OPTION_KEY, $templates_data['library'], 'no' );
267
+
268
+ unset( $templates_data['library'] );
269
+ }
270
+
271
+ set_transient( $cache_key, $templates_data, 12 * HOUR_IN_SECONDS );
272
+ }
273
+
274
+ return $templates_data;
275
+ }
276
+
277
+ /**
278
+ * Get templates data.
279
+ *
280
+ * Retrieve the templates data from a remote server.
281
+ *
282
+ * @since 1.6.0
283
+ * @access public
284
+ * @static
285
+ *
286
+ * @param bool $force_update Optional. Whether to force the data update or
287
+ * not. Default is false.
288
+ *
289
+ * @return array The templates data.
290
+ */
291
+ public static function get_library_data( $force_update = false ) {
292
+ self::get_templates_data( $force_update );
293
+
294
+ $library_data = get_option( self::LIBRARY_OPTION_KEY );
295
+
296
+ if ( empty( $library_data ) ) {
297
+ return [];
298
+ }
299
+
300
+ return $library_data;
301
+ }
302
+
303
+ /**
304
+ * Get template content.
305
+ *
306
+ * Retrieve the templates content received from a remote server.
307
+ *
308
+ * @since 1.6.0
309
+ * @access public
310
+ * @static
311
+ *
312
+ * @param int $template_id The template ID.
313
+ *
314
+ * @return object|\WP_Error The template content.
315
+ */
316
+ public static function get_template_content( $template_id ) {
317
+ $url = self::$api_url . '/' . $template_id;
318
+ $license_key = null;
319
+
320
+ if ( function_exists( 'pp_get_license_key' ) ) {
321
+ $license_key = pp_get_license_key();
322
+ }
323
+ if ( ! defined( 'POWERPACK_ELEMENTS_VER' ) ) {
324
+ $license_key = 'lite';
325
+ }
326
+
327
+ if ( empty( $license_key ) ) {
328
+ return new \WP_Error( 'no_license', __( 'License is not active.', 'powerpack' ) );
329
+ }
330
+
331
+ $args = [
332
+ 'body' => [
333
+ // Which API version is used.
334
+ 'api_version' => POWERPACK_ELEMENTS_LITE_VER,
335
+ 'license_key' => $license_key,
336
+ 'home_url' => trailingslashit( home_url() ),
337
+ ],
338
+ 'timeout' => 25,
339
+ ];
340
+
341
+ $response = wp_remote_post( $url, $args );
342
+
343
+ if ( is_wp_error( $response ) ) {
344
+ // @codingStandardsIgnoreStart WordPress.XSS.EscapeOutput.
345
+ wp_die( $response, [
346
+ 'back_link' => true,
347
+ ] );
348
+ // @codingStandardsIgnoreEnd WordPress.XSS.EscapeOutput.
349
+ }
350
+
351
+ $body = wp_remote_retrieve_body( $response );
352
+ $response_code = (int) wp_remote_retrieve_response_code( $response );
353
+
354
+ if ( ! $response_code ) {
355
+ return new \WP_Error( 500, 'No Response' );
356
+ }
357
+
358
+ // Server sent a success message without content.
359
+ if ( 'null' === $body ) {
360
+ $body = true;
361
+ }
362
+
363
+ $as_array = true;
364
+ $body = json_decode( $body, $as_array );
365
+
366
+ if ( false === $body ) {
367
+ return new \WP_Error( 422, 'Wrong Server Response' );
368
+ }
369
+
370
+ if ( 200 !== $response_code ) {
371
+ // In case $as_array = true.
372
+ $body = (object) $body;
373
+
374
+ $message = isset( $body->message ) ? $body->message : wp_remote_retrieve_response_message( $response );
375
+ $code = isset( $body->code ) ? $body->code : $response_code;
376
+
377
+ return new \WP_Error( $code, $message );
378
+ }
379
+
380
+ return $body;
381
+ }
382
+
383
+ /**
384
+ * Render template.
385
+ *
386
+ * Library modal template.
387
+ *
388
+ * @since 1.6.0
389
+ * @access public
390
+ * @static
391
+ *
392
+ * @return void
393
+ */
394
+ public static function render_template() {
395
+ ?>
396
+ <script type="text/template" id="tmpl-elementor-template-library-header-actions-pp">
397
+ <div id="elementor-template-library-header-sync" class="elementor-templates-modal__header__item">
398
+ <i class="eicon-sync" aria-hidden="true" title="<?php esc_attr_e( 'Sync Templates', 'elementor' ); ?>"></i>
399
+ <span class="elementor-screen-only"><?php echo esc_html__( 'Sync Templates', 'powerpack' ); ?></span>
400
+ </div>
401
+ </script>
402
+ <script type="text/template" id="tmpl-elementor-templates-modal__header__logo_pp">
403
+ <span class="elementor-templates-modal__header__logo__icon-wrapper">
404
+ <img src="<?php echo esc_url( POWERPACK_ELEMENTS_LITE_URL . 'assets/images/pp-logo-sm.png' ); ?>" style="height: 30px;" />
405
+ </span>
406
+ <span class="elementor-templates-modal__header__logo__title">{{{ title }}}</span>
407
+ </script>
408
+ <script type="text/template" id="tmpl-elementor-template-library-header-preview-pp">
409
+ <div id="elementor-template-library-header-preview-insert-wrapper" class="elementor-templates-modal__header__item">
410
+ {{{ pp_templates_lib.templates.layout.getTemplateActionButton( obj ) }}}
411
+ </div>
412
+ </script>
413
+ <script type="text/template" id="tmpl-elementor-template-library-templates-pp">
414
+ <#
415
+ var activeSource = pp_templates_lib.templates.getFilter('source');
416
+ #>
417
+ <div id="elementor-template-library-toolbar">
418
+ <# if ( 'powerpack' === activeSource ) {
419
+ var activeType = pp_templates_lib.templates.getFilter('type');
420
+ #>
421
+ <div id="elementor-template-library-filter-toolbar-remote" class="elementor-template-library-filter-toolbar">
422
+ <# if ( 'page' === activeType ) { #>
423
+ <div id="elementor-template-library-order">
424
+ <input type="radio" id="elementor-template-library-order-new" class="elementor-template-library-order-input" name="elementor-template-library-order" value="date">
425
+ <label for="elementor-template-library-order-new" class="elementor-template-library-order-label"><?php echo esc_html__( 'New', 'powerpack' ); ?></label>
426
+ <input type="radio" id="elementor-template-library-order-trend" class="elementor-template-library-order-input" name="elementor-template-library-order" value="trendIndex">
427
+ <label for="elementor-template-library-order-trend" class="elementor-template-library-order-label"><?php echo esc_html__( 'Trend', 'powerpack' ); ?></label>
428
+ <input type="radio" id="elementor-template-library-order-popular" class="elementor-template-library-order-input" name="elementor-template-library-order" value="popularityIndex">
429
+ <label for="elementor-template-library-order-popular" class="elementor-template-library-order-label"><?php echo esc_html__( 'Popular', 'powerpack' ); ?></label>
430
+ </div>
431
+ <# } else {
432
+ var config = pp_templates_lib.templates.getConfig( activeType );
433
+ if ( config.categories ) { #>
434
+ <div id="elementor-template-library-filter">
435
+ <select id="elementor-template-library-filter-subtype" class="elementor-template-library-filter-select" data-elementor-filter="subtype">
436
+ <option></option>
437
+ <# config.categories.forEach( function( category ) {
438
+ var selected = category === pp_templates_lib.templates.getFilter( 'subtype' ) ? ' selected' : '';
439
+ #>
440
+ <option value="{{ category }}"{{{ selected }}}>{{{ category }}}</option>
441
+ <# } ); #>
442
+ </select>
443
+ </div>
444
+ <# }
445
+ } #>
446
+ <div id="elementor-template-library-my-favorites">
447
+ <# var checked = pp_templates_lib.templates.getFilter( 'favorite' ) ? ' checked' : ''; #>
448
+ <input id="elementor-template-library-filter-my-favorites" type="checkbox"{{{ checked }}}>
449
+ <label id="elementor-template-library-filter-my-favorites-label" for="elementor-template-library-filter-my-favorites">
450
+ <i class="eicon" aria-hidden="true"></i>
451
+ <?php echo esc_html__( 'My Favorites', 'powerpack' ); ?>
452
+ </label>
453
+ </div>
454
+ </div>
455
+ <# } #>
456
+ <div id="elementor-template-library-filter-text-wrapper">
457
+ <label for="elementor-template-library-filter-text" class="elementor-screen-only"><?php echo esc_html__( 'Search Templates:', 'powerpack' ); ?></label>
458
+ <input id="elementor-template-library-filter-text" placeholder="<?php echo esc_attr__( 'Search', 'powerpack' ); ?>">
459
+ <i class="eicon-search"></i>
460
+ </div>
461
+ </div>
462
+ <div id="elementor-template-library-templates-container"></div>
463
+ <# if ( 'powerpack' === activeSource ) { #>
464
+ <div id="elementor-template-library-footer-banner">
465
+ <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/information.svg' ); ?>" />
466
+ <div class="elementor-excerpt"><?php echo esc_html__( 'Stay tuned! More awesome templates coming real soon.', 'powerpack' ); ?></div>
467
+ </div>
468
+ <# } #>
469
+ </script>
470
+ <script type="text/template" id="tmpl-elementor-template-library-template-pp">
471
+ <div class="elementor-template-library-template-body">
472
+ <# if ( 'page' === type ) { #>
473
+ <div class="elementor-template-library-template-screenshot" style="background-image: url({{ thumbnail }});"></div>
474
+ <# } else { #>
475
+ <img src="{{ thumbnail }}">
476
+ <# } #>
477
+ <div class="elementor-template-library-template-preview">
478
+ <i class="eicon-zoom-in-bold" aria-hidden="true"></i>
479
+ </div>
480
+ </div>
481
+ <div class="elementor-template-library-template-footer">
482
+ {{{ pp_templates_lib.templates.layout.getTemplateActionButton( obj ) }}}
483
+ <div class="elementor-template-library-template-name">{{{ title }}} - {{{ type }}}</div>
484
+ <div class="elementor-template-library-favorite">
485
+ <input id="elementor-template-library-template-{{ template_id }}-favorite-input" class="elementor-template-library-template-favorite-input" type="checkbox"{{ favorite ? " checked" : "" }}>
486
+ <label for="elementor-template-library-template-{{ template_id }}-favorite-input" class="elementor-template-library-template-favorite-label">
487
+ <i class="eicon-heart-o" aria-hidden="true"></i>
488
+ <span class="elementor-screen-only"><?php echo esc_html__( 'Favorite', 'powerpack' ); ?></span>
489
+ </label>
490
+ </div>
491
+ </div>
492
+ </script>
493
+ <script type="text/template" id="tmpl-elementor-template-library-get-pro-button-pp">
494
+ <a class="elementor-template-library-template-action elementor-button elementor-go-pro" href="https://powerpackelements.com/pricing/?utm_source=panel-library&utm_campaign=gopro&utm_medium=wp-dash" target="_blank">
495
+ <i class="eicon-external-link-square" aria-hidden="true"></i>
496
+ <span class="elementor-button-title"><?php echo __( 'Go Pro', 'powerpack' ); ?></span>
497
+ </a>
498
+ </script>
499
+ <script type="text/template" id="tmpl-elementor-pro-template-library-activate-license-button-pp">
500
+ <a class="elementor-template-library-template-action elementor-button elementor-go-pro" href="<?php echo PP_Admin_Settings::get_form_action(); ?>" target="_blank">
501
+ <i class="eicon-external-link-square"></i>
502
+ <span class="elementor-button-title"><?php _e( 'Activate License', 'powerpack' ); ?></span>
503
+ </a>
504
+ </script>
505
+ <?php
506
+ }
507
+ }
508
+
509
+ PP_Templates_Lib::init();
510
+
511
+ /**
512
+ * Custom source.
513
+ */
514
+ class PP_Source extends Source_Base {
515
+ /**
516
+ * Get remote template ID.
517
+ *
518
+ * Retrieve the remote template ID.
519
+ *
520
+ * @since 1.14.5
521
+ * @access public
522
+ *
523
+ * @return string The remote template ID.
524
+ */
525
+ public function get_id() {
526
+ return 'powerpack';
527
+ }
528
+
529
+ /**
530
+ * Get remote template title.
531
+ *
532
+ * Retrieve the remote template title.
533
+ *
534
+ * @since 1.14.5
535
+ * @access public
536
+ *
537
+ * @return string The remote template title.
538
+ */
539
+ public function get_title() {
540
+ return 'PowerPack';
541
+ }
542
+
543
+ /**
544
+ * Register remote template data.
545
+ *
546
+ * Used to register custom template data like a post type, a taxonomy or any
547
+ * other data.
548
+ *
549
+ * @since 1.14.5
550
+ * @access public
551
+ */
552
+ public function register_data() {}
553
+
554
+ /**
555
+ * Get remote templates.
556
+ *
557
+ * Retrieve remote templates from PowerpackElements.com servers.
558
+ *
559
+ * @since 1.14.5
560
+ * @access public
561
+ *
562
+ * @param array $args Optional. Nou used in remote source.
563
+ *
564
+ * @return array Remote templates.
565
+ */
566
+ public function get_items( $args = [] ) {
567
+ $library_data = PP_Templates_Lib::get_library_data();
568
+ $is_pro_active = defined( 'POWERPACK_ELEMENTS_VER' );
569
+ $pro_status = 'active';
570
+
571
+ if ( ! $is_pro_active ) {
572
+ $pro_status = 'inactive';
573
+ } elseif ( 'valid' !== get_option( 'pp_license_status' ) ) {
574
+ $pro_status = 'license_inactive';
575
+ }
576
+
577
+ $templates = [];
578
+
579
+ if ( ! empty( $library_data['templates'] ) ) {
580
+ foreach ( $library_data['templates'] as $template_data ) {
581
+ $data = $this->prepare_template( $template_data );
582
+ $data['proStatus'] = $pro_status;
583
+ $templates[] = $data;
584
+ }
585
+ }
586
+
587
+ return $templates;
588
+ }
589
+
590
+ /**
591
+ * Get remote template.
592
+ *
593
+ * Retrieve a single remote template from PowerPackElements.com servers.
594
+ *
595
+ * @since 1.14.5
596
+ * @access public
597
+ *
598
+ * @param int $template_id The template ID.
599
+ *
600
+ * @return array Remote template.
601
+ */
602
+ public function get_item( $template_id ) {
603
+ $templates = $this->get_items();
604
+
605
+ return $templates[ $template_id ];
606
+ }
607
+
608
+ /**
609
+ * Save remote template.
610
+ *
611
+ * Remote template from PowerPackElements.com servers cannot be saved on the
612
+ * database as they are retrieved from remote servers.
613
+ *
614
+ * @since 1.14.5
615
+ * @access public
616
+ *
617
+ * @param array $template_data Remote template data.
618
+ *
619
+ * @return \WP_Error
620
+ */
621
+ public function save_item( $template_data ) {
622
+ return new \WP_Error( 'invalid_request', 'Cannot save template to a remote source' );
623
+ }
624
+
625
+ /**
626
+ * Update remote template.
627
+ *
628
+ * Remote template from PowerPackElements.com servers cannot be updated on the
629
+ * database as they are retrieved from remote servers.
630
+ *
631
+ * @since 1.14.5
632
+ * @access public
633
+ *
634
+ * @param array $new_data New template data.
635
+ *
636
+ * @return \WP_Error
637
+ */
638
+ public function update_item( $new_data ) {
639
+ return new \WP_Error( 'invalid_request', 'Cannot update template to a remote source' );
640
+ }
641
+
642
+ /**
643
+ * Delete remote template.
644
+ *
645
+ * Remote template from PowerPackElements.com servers cannot be deleted from the
646
+ * database as they are retrieved from remote servers.
647
+ *
648
+ * @since 1.14.5
649
+ * @access public
650
+ *
651
+ * @param int $template_id The template ID.
652
+ *
653
+ * @return \WP_Error
654
+ */
655
+ public function delete_template( $template_id ) {
656
+ return new \WP_Error( 'invalid_request', 'Cannot delete template from a remote source' );
657
+ }
658
+
659
+ /**
660
+ * Export remote template.
661
+ *
662
+ * Remote template from PowerPackElements.com servers cannot be exported from the
663
+ * database as they are retrieved from remote servers.
664
+ *
665
+ * @since 1.14.5
666
+ * @access public
667
+ *
668
+ * @param int $template_id The template ID.
669
+ *
670
+ * @return \WP_Error
671
+ */
672
+ public function export_template( $template_id ) {
673
+ return new \WP_Error( 'invalid_request', 'Cannot export template from a remote source' );
674
+ }
675
+
676
+ /**
677
+ * Get remote template data.
678
+ *
679
+ * Retrieve the data of a single remote template from PowerPackElements.com servers.
680
+ *
681
+ * @since 1.14.5
682
+ * @access public
683
+ *
684
+ * @param array $args Custom template arguments.
685
+ * @param string $context Optional. The context. Default is `display`.
686
+ *
687
+ * @return array|\WP_Error Remote Template data.
688
+ */
689
+ public function get_data( array $args, $context = 'display' ) {
690
+ $data = PP_Templates_Lib::get_template_content( $args['template_id'] );
691
+
692
+ if ( is_wp_error( $data ) ) {
693
+ return $data;
694
+ }
695
+
696
+ $data = (array) $data;
697
+
698
+ $data['content'] = $this->replace_elements_ids( $data['content'] );
699
+ $data['content'] = $this->process_export_import_content( $data['content'], 'on_import' );
700
+
701
+ $post_id = $args['editor_post_id'];
702
+ $document = Plugin::$instance->documents->get( $post_id );
703
+ if ( $document ) {
704
+ $data['content'] = $document->get_elements_raw_data( $data['content'], true );
705
+ }
706
+
707
+ return $data;
708
+ }
709
+
710
+ /**
711
+ * Prepare template.
712
+ *
713
+ * Prepare template data.
714
+ *
715
+ * @since 1.6.0
716
+ * @access private
717
+ *
718
+ * @param array $template_data Collection of template data.
719
+ * @return array Collection of template data.
720
+ */
721
+ private function prepare_template( array $template_data ) {
722
+ $favorite_templates = $this->get_user_meta( 'favorites' );
723
+
724
+ return [
725
+ 'template_id' => $template_data['id'],
726
+ 'source' => $this->get_id(),
727
+ 'type' => $template_data['type'],
728
+ 'subtype' => $template_data['subtype'],
729
+ 'title' => $template_data['title'],
730
+ 'thumbnail' => $template_data['thumbnail'],
731
+ 'date' => $template_data['tmpl_created'],
732
+ 'author' => $template_data['author'],
733
+ 'tags' => json_decode( $template_data['tags'] ),
734
+ 'isPro' => $template_data['is_pro'],
735
+ 'url' => $template_data['url'],
736
+ 'favorite' => ! empty( $favorite_templates[ $template_data['id'] ] ),
737
+ ];
738
+ }
739
+ }
modules/flipbox/widgets/flipbox.php CHANGED
@@ -2,6 +2,7 @@
2
  namespace PowerpackElementsLite\Modules\Flipbox\Widgets;
3
 
4
  use PowerpackElementsLite\Base\Powerpack_Widget;
 
5
 
6
  // Elementor Classes
7
  use Elementor\Controls_Manager;
@@ -95,409 +96,517 @@ class Flipbox extends Powerpack_Widget {
95
  */
96
  protected function _register_controls() {
97
 
98
- /*
99
- -----------------------------------------------------------------------------------*/
100
- /*
101
- CONTENT TAB
102
- /*-----------------------------------------------------------------------------------*/
 
 
 
 
 
 
 
 
 
 
 
103
 
 
104
  /**
105
  * Content Tab: Front
106
  */
107
  $this->start_controls_section(
108
  'section_front',
109
- array(
110
- 'label' => esc_html__( 'Front', 'powerpack' ),
111
- )
112
  );
113
 
114
  $this->add_control(
115
  'icon_type',
116
- array(
117
- 'label' => esc_html__( 'Icon Type', 'powerpack' ),
118
- 'type' => Controls_Manager::CHOOSE,
119
- 'label_block' => false,
120
- 'options' => array(
121
- 'none' => array(
122
- 'title' => __( 'None', 'powerpack' ),
123
- 'icon' => 'fa fa-ban',
124
- ),
125
- 'image' => array(
126
- 'title' => __( 'Image', 'powerpack' ),
127
- 'icon' => 'fa fa-picture-o',
128
- ),
129
- 'icon' => array(
130
- 'title' => __( 'Icon', 'powerpack' ),
131
- 'icon' => 'fa fa-star',
 
 
 
 
132
  ),
133
- ),
134
- 'default' => 'icon',
135
- )
136
  );
137
 
138
  $this->add_control(
139
  'icon_image',
140
- array(
141
- 'label' => esc_html__( 'Choose Image', 'powerpack' ),
142
- 'type' => Controls_Manager::MEDIA,
143
- 'default' => array(
144
  'url' => Utils::get_placeholder_image_src(),
145
- ),
146
- 'condition' => array(
147
  'icon_type' => 'image',
148
- ),
149
- )
150
  );
151
 
152
  $this->add_control(
153
  'select_icon',
154
- array(
155
- 'label' => __( 'Icon', 'powerpack' ),
156
- 'type' => Controls_Manager::ICONS,
157
- 'fa4compatibility' => 'icon',
158
- 'default' => array(
159
- 'value' => 'fas fa-star',
160
- 'library' => 'fa-solid',
161
- ),
162
- 'condition' => array(
163
- 'icon_type' => 'icon',
164
- ),
165
- )
166
  );
167
 
168
  $this->add_group_control(
169
  Group_Control_Image_Size::get_type(),
 
 
 
 
 
 
 
 
 
 
 
 
170
  array(
171
- 'name' => 'thumbnail',
172
- 'default' => 'full',
 
 
 
 
173
  'condition' => array(
174
- 'icon_type' => 'image',
175
- 'icon_image[url]!' => '',
176
  ),
177
  )
178
  );
179
 
180
  $this->add_control(
181
  'title_front',
182
- array(
183
- 'label' => esc_html__( 'Title', 'powerpack' ),
184
- 'type' => Controls_Manager::TEXT,
185
- 'label_block' => true,
186
- 'default' => esc_html__( 'This is the heading', 'powerpack' ),
187
- 'separator' => 'before',
188
- )
189
  );
190
  $this->add_control(
191
  'description_front',
 
 
 
 
 
 
 
 
 
 
192
  array(
193
- 'label' => esc_html__( 'Description', 'powerpack' ),
194
- 'type' => Controls_Manager::TEXTAREA,
195
- 'label_block' => true,
196
- 'default' => __( 'This is the front content. Click edit button to change this text. Lorem ipsum dolor sit amet consectetur adipiscing elit dolor', 'powerpack' ),
 
 
 
 
 
 
 
 
 
 
197
  )
198
  );
199
 
200
  $this->end_controls_section();
 
201
 
 
202
  /**
203
  * Content Tab: Back
204
  */
205
  $this->start_controls_section(
206
  'section_back',
207
- array(
208
- 'label' => esc_html__( 'Back', 'powerpack' ),
209
- )
210
  );
211
 
212
  $this->add_control(
213
  'icon_type_back',
214
- array(
215
- 'label' => esc_html__( 'Icon Type', 'powerpack' ),
216
- 'type' => Controls_Manager::CHOOSE,
217
- 'label_block' => false,
218
- 'options' => array(
219
- 'none' => array(
220
- 'title' => __( 'None', 'powerpack' ),
221
- 'icon' => 'fa fa-ban',
222
- ),
223
- 'image' => array(
224
- 'title' => __( 'Image', 'powerpack' ),
225
- 'icon' => 'fa fa-picture-o',
 
 
 
 
 
 
 
 
226
  ),
227
- 'icon' => array(
228
- 'title' => __( 'Icon', 'powerpack' ),
229
- 'icon' => 'fa fa-star',
230
- ),
231
- ),
232
- 'default' => 'icon',
233
- )
234
  );
235
 
236
  $this->add_control(
237
  'icon_image_back',
238
- array(
239
- 'label' => esc_html__( 'Flipbox Image', 'powerpack' ),
240
- 'type' => Controls_Manager::MEDIA,
241
- 'default' => array(
242
  'url' => Utils::get_placeholder_image_src(),
243
- ),
244
- 'condition' => array(
245
- 'icon_type_back' => 'image',
246
- ),
247
- )
248
  );
249
 
250
  $this->add_control(
251
  'select_icon_back',
252
- array(
253
- 'label' => __( 'Icon', 'powerpack' ),
254
- 'type' => Controls_Manager::ICONS,
255
- 'fa4compatibility' => 'icon_back',
256
- 'default' => array(
257
- 'value' => 'far fa-snowflake',
258
- 'library' => 'fa-regular',
259
- ),
260
- 'condition' => array(
261
- 'icon_type_back' => 'icon',
262
- ),
263
- )
264
  );
265
 
266
  $this->add_group_control(
267
  Group_Control_Image_Size::get_type(),
268
- array(
269
- 'name' => 'thumbnail_back',
270
- 'default' => 'full',
271
- 'condition' => array(
272
  'icon_type_back' => 'image',
273
  'icon_image_back[url]!' => '',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  ),
275
  )
276
  );
277
 
278
  $this->add_control(
279
  'title_back',
280
- array(
281
- 'label' => esc_html__( 'Title', 'powerpack' ),
282
- 'type' => Controls_Manager::TEXT,
283
- 'label_block' => true,
284
- 'default' => esc_html__( 'This is the heading', 'powerpack' ),
285
- 'separator' => 'before',
286
- )
287
  );
288
 
289
  $this->add_control(
290
  'description_back',
291
- array(
292
- 'label' => esc_html__( 'Description', 'powerpack' ),
293
- 'type' => Controls_Manager::TEXTAREA,
294
- 'label_block' => true,
295
- 'default' => __( 'This is the front content. Click edit button to change this text. Lorem ipsum dolor sit amet consectetur adipiscing elit dolor', 'powerpack' ),
296
- )
297
  );
298
 
299
  $this->add_control(
300
- 'link_type',
301
  array(
302
- 'label' => __( 'Link Type', 'powerpack' ),
303
  'type' => Controls_Manager::SELECT,
304
- 'default' => 'none',
305
  'options' => array(
306
- 'none' => __( 'None', 'powerpack' ),
307
- 'title' => __( 'Title', 'powerpack' ),
308
- 'button' => __( 'Button', 'powerpack' ),
309
- 'box' => __( 'Box', 'powerpack' ),
 
 
 
 
 
310
  ),
311
  )
312
  );
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  $this->add_control(
315
  'link',
316
- array(
317
- 'label' => __( 'Link', 'powerpack' ),
318
- 'type' => Controls_Manager::URL,
319
- 'dynamic' => array(
320
- 'active' => true,
321
- 'categories' => array(
322
  TagsModule::POST_META_CATEGORY,
323
  TagsModule::URL_CATEGORY,
324
- ),
325
- ),
326
- 'placeholder' => 'https://www.your-link.com',
327
- 'default' => array(
328
  'url' => '#',
329
- ),
330
- 'condition' => array(
331
- 'link_type!' => 'none',
332
- ),
333
- )
334
  );
335
 
336
  $this->add_control(
337
  'flipbox_button_text',
338
- array(
339
- 'label' => __( 'Button Text', 'powerpack' ),
340
- 'type' => Controls_Manager::TEXT,
341
- 'dynamic' => array(
342
- 'active' => true,
343
- ),
344
- 'default' => __( 'Get Started', 'powerpack' ),
345
- 'condition' => array(
346
- 'link_type' => 'button',
347
- ),
348
- )
349
  );
350
 
351
  $this->add_control(
352
  'select_button_icon',
353
- array(
354
- 'label' => __( 'Button Icon', 'powerpack' ),
355
- 'type' => Controls_Manager::ICONS,
356
- 'fa4compatibility' => 'button_icon',
357
- 'condition' => array(
358
- 'link_type' => 'button',
359
- ),
360
- )
361
  );
362
 
363
  $this->add_control(
364
  'button_icon_position',
365
- array(
366
- 'label' => __( 'Icon Position', 'powerpack' ),
367
- 'type' => Controls_Manager::SELECT,
368
- 'default' => 'after',
369
- 'options' => array(
370
- 'after' => __( 'After', 'powerpack' ),
371
- 'before' => __( 'Before', 'powerpack' ),
372
- ),
373
- 'condition' => array(
374
- 'link_type' => 'button',
375
- 'select_button_icon[value]!' => '',
376
- ),
377
- )
378
  );
379
 
380
  $this->end_controls_section();
 
381
 
 
382
  /**
383
  * Content Tab: Settings
384
  */
385
  $this->start_controls_section(
386
  'section_settings',
387
- array(
388
- 'label' => esc_html__( 'Settings', 'powerpack' ),
389
- )
390
  );
391
 
392
  $this->add_responsive_control(
393
  'height',
394
- array(
395
- 'label' => __( 'Height', 'powerpack' ),
396
- 'type' => Controls_Manager::SLIDER,
397
- 'size_units' => array( 'px', 'vh' ),
398
- 'range' => array(
399
- 'px' => array(
400
  'min' => 100,
401
  'max' => 1000,
402
- ),
403
- 'vh' => array(
404
  'min' => 10,
405
  'max' => 100,
406
- ),
407
- ),
408
- 'selectors' => array(
409
  '{{WRAPPER}} .pp-flipbox-container' => 'height: {{SIZE}}{{UNIT}};',
410
- ),
411
- )
412
  );
413
 
414
  $this->add_control(
415
  'border_radius',
416
- array(
417
- 'label' => __( 'Border Radius', 'powerpack' ),
418
- 'type' => Controls_Manager::SLIDER,
419
- 'size_units' => array( 'px', '%' ),
420
- 'range' => array(
421
- 'px' => array(
422
  'min' => 0,
423
  'max' => 200,
424
- ),
425
- ),
426
- 'selectors' => array(
427
  '{{WRAPPER}} .pp-flipbox-back, {{WRAPPER}} .pp-flipbox-front' => 'border-radius: {{SIZE}}{{UNIT}}',
428
- ),
429
- )
430
  );
431
 
432
  $this->add_control(
433
  'flip_effect',
434
- array(
435
- 'label' => esc_html__( 'Flip Effect', 'powerpack' ),
436
- 'type' => Controls_Manager::SELECT,
437
- 'default' => 'flip',
438
- 'label_block' => false,
439
- 'options' => array(
440
  'flip' => esc_html__( 'Flip', 'powerpack' ),
441
  'slide' => esc_html__( 'Slide', 'powerpack' ),
442
  'push' => esc_html__( 'Push', 'powerpack' ),
443
  'zoom-in' => esc_html__( 'Zoom In', 'powerpack' ),
444
  'zoom-out' => esc_html__( 'Zoom Out', 'powerpack' ),
445
  'fade' => esc_html__( 'Fade', 'powerpack' ),
446
- ),
447
- 'separator' => 'before',
448
- )
449
  );
450
 
451
  $this->add_control(
452
  'flip_direction',
453
- array(
454
- 'label' => esc_html__( 'Flip Direction', 'powerpack' ),
455
- 'type' => Controls_Manager::SELECT,
456
- 'default' => 'left',
457
- 'label_block' => false,
458
- 'options' => array(
459
- 'left' => esc_html__( 'Left', 'powerpack' ),
460
- 'right' => esc_html__( 'Right', 'powerpack' ),
461
- 'up' => esc_html__( 'Top', 'powerpack' ),
462
- 'down' => esc_html__( 'Bottom', 'powerpack' ),
463
- ),
464
- 'condition' => array(
465
- 'flip_effect!' => array(
466
  'fade',
467
  'zoom-in',
468
  'zoom-out',
469
- ),
470
- ),
471
- )
472
  );
473
 
474
  $this->end_controls_section();
 
475
 
476
- /**
477
- * Content Tab: Docs Links
478
- *
479
- * @since 1.4.8
480
- * @access protected
481
- */
482
- $this->start_controls_section(
483
- 'section_help_docs',
484
- array(
485
- 'label' => __( 'Help Docs', 'powerpack' ),
486
- )
487
- );
488
 
489
- $this->add_control(
490
- 'help_doc_1',
491
- array(
492
- 'type' => Controls_Manager::RAW_HTML,
493
- /* translators: %1$s doc link */
494
- 'raw' => sprintf( __( '%1$s Widget Overview %2$s', 'powerpack' ), '<a href="https://powerpackelements.com/docs/powerpack/widgets/flip-box/flip-box-widget-overview/?utm_source=widget&utm_medium=panel&utm_campaign=userkb" target="_blank" rel="noopener">', '</a>' ),
495
- 'content_classes' => 'pp-editor-doc-links',
496
- )
497
- );
498
 
499
- $this->end_controls_section();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
 
501
  if ( ! is_pp_elements_active() ) {
502
  $this->start_controls_section(
503
  'section_upgrade_powerpack',
@@ -519,902 +628,931 @@ class Flipbox extends Powerpack_Widget {
519
 
520
  $this->end_controls_section();
521
  }
 
522
 
523
- /*
524
- -----------------------------------------------------------------------------------*/
525
- /*
526
- STYLE TAB
527
- /*-----------------------------------------------------------------------------------*/
528
 
 
529
  /**
530
  * Style Tab: Front
531
  */
532
  $this->start_controls_section(
533
  'section_front_style',
534
- array(
535
- 'label' => esc_html__( 'Front', 'powerpack' ),
536
- 'tab' => Controls_Manager::TAB_STYLE,
537
- )
538
  );
539
 
540
  $this->add_responsive_control(
541
  'padding_front',
542
- array(
543
- 'label' => esc_html__( 'Padding', 'powerpack' ),
544
- 'type' => Controls_Manager::DIMENSIONS,
545
- 'size_units' => array( 'px', 'em', '%' ),
546
- 'selectors' => array(
547
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
548
- ),
549
- )
550
  );
551
 
552
  $this->add_responsive_control(
553
  'content_alignment_front',
554
- array(
555
- 'label' => esc_html__( 'Alignment', 'powerpack' ),
556
- 'type' => Controls_Manager::CHOOSE,
557
- 'label_block' => false,
558
- 'options' => array(
559
- 'left' => array(
560
- 'title' => esc_html__( 'Left', 'powerpack' ),
561
- 'icon' => 'fa fa-align-left',
562
- ),
563
- 'center' => array(
564
- 'title' => esc_html__( 'Center', 'powerpack' ),
565
- 'icon' => 'fa fa-align-center',
566
- ),
567
- 'right' => array(
568
- 'title' => esc_html__( 'Right', 'powerpack' ),
569
- 'icon' => 'fa fa-align-right',
570
- ),
571
- ),
572
- 'default' => 'center',
573
- 'selectors' => array(
574
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'text-align: {{VALUE}};',
575
- ),
576
- )
577
  );
578
 
579
  $this->add_responsive_control(
580
  'vertical_position_front',
581
- array(
582
- 'label' => __( 'Vertical Position', 'powerpack' ),
583
- 'type' => Controls_Manager::CHOOSE,
584
- 'label_block' => false,
585
- 'options' => array(
586
- 'top' => array(
587
  'title' => __( 'Top', 'powerpack' ),
588
- 'icon' => 'eicon-v-align-top',
589
- ),
590
- 'middle' => array(
591
  'title' => __( 'Middle', 'powerpack' ),
592
- 'icon' => 'eicon-v-align-middle',
593
- ),
594
- 'bottom' => array(
595
  'title' => __( 'Bottom', 'powerpack' ),
596
- 'icon' => 'eicon-v-align-bottom',
597
- ),
598
- ),
599
- 'selectors_dictionary' => array(
600
- 'top' => 'flex-start',
601
  'middle' => 'center',
602
  'bottom' => 'flex-end',
603
- ),
604
- 'selectors' => array(
605
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'justify-content: {{VALUE}}',
606
- ),
607
- )
608
  );
609
 
610
  $this->add_group_control(
611
  Group_Control_Background::get_type(),
612
- array(
613
- 'name' => 'background_front',
614
- 'types' => array( 'classic', 'gradient' ),
615
- 'selector' => '{{WRAPPER}} .pp-flipbox-front',
616
- 'separator' => 'before',
617
- )
618
  );
619
 
620
  $this->add_group_control(
621
  Group_Control_Border::get_type(),
622
- array(
623
- 'name' => 'border_front',
624
- 'label' => esc_html__( 'Border Style', 'powerpack' ),
625
- 'selector' => '{{WRAPPER}} .pp-flipbox-front',
626
- 'separator' => 'before',
627
- )
628
  );
629
 
630
  $this->add_control(
631
  'overlay_front',
632
- array(
633
- 'label' => esc_html__( 'Overlay', 'powerpack' ),
634
- 'type' => Controls_Manager::HEADING,
635
- 'separator' => 'before',
636
- )
637
  );
638
 
639
  $this->add_group_control(
640
  Group_Control_Background::get_type(),
641
- array(
642
- 'name' => 'overlay_front',
643
- 'types' => array( 'classic', 'gradient' ),
644
- 'exclude' => array( 'image' ),
645
- 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay',
646
- )
647
  );
648
 
649
  $this->add_control(
650
  'image_style_heading_front',
651
- array(
652
- 'label' => esc_html__( 'Image', 'powerpack' ),
653
- 'type' => Controls_Manager::HEADING,
654
- 'separator' => 'before',
655
- 'condition' => array(
656
  'icon_type' => 'image',
657
- ),
658
- )
659
  );
660
 
661
  $this->add_responsive_control(
662
  'image_spacing_front',
663
- array(
664
- 'label' => __( 'Spacing', 'powerpack' ),
665
- 'type' => Controls_Manager::SLIDER,
666
- 'range' => array(
667
- 'px' => array(
668
  'min' => 0,
669
  'max' => 100,
670
- ),
671
- ),
672
- 'selectors' => array(
673
  '{{WRAPPER}} .pp-flipbox-icon-image' => 'margin-bottom: {{SIZE}}{{UNIT}};',
674
- ),
675
- 'condition' => array(
676
  'icon_type' => 'image',
677
- ),
678
- )
679
  );
680
 
681
  $this->add_responsive_control(
682
  'image_size_front',
683
- array(
684
- 'label' => esc_html__( 'Size (%)', 'powerpack' ),
685
- 'type' => Controls_Manager::SLIDER,
686
- 'default' => array(
687
  'size' => '',
688
- ),
689
- 'selectors' => array(
690
  '{{WRAPPER}} .pp-flipbox-icon-image > img' => 'width: {{SIZE}}%;',
691
- ),
692
- 'condition' => array(
693
  'icon_type' => 'image',
694
- ),
695
- )
696
  );
697
 
698
  $this->add_control(
699
  'icon_style_heading_front',
700
- array(
701
- 'label' => esc_html__( 'Icon', 'powerpack' ),
702
- 'type' => Controls_Manager::HEADING,
703
- 'separator' => 'before',
704
- 'condition' => array(
705
- 'icon_type' => 'icon',
706
- ),
707
- )
708
  );
709
 
710
  $this->add_control(
711
  'icon_color_front',
712
- array(
713
- 'label' => esc_html__( 'Color', 'powerpack' ),
714
- 'type' => Controls_Manager::COLOR,
715
- 'default' => '#ffffff',
716
- 'selectors' => array(
717
- '{{WRAPPER}} .pp-flipbox-icon-image i' => 'color: {{VALUE}};',
718
  '{{WRAPPER}} .pp-flipbox-icon-image svg' => 'fill: {{VALUE}};',
719
- ),
720
- 'condition' => array(
721
- 'icon_type' => 'icon',
722
- ),
723
- )
724
  );
725
 
726
  $this->add_responsive_control(
727
  'icon_size_front',
728
- array(
729
- 'label' => __( 'Icon Size', 'powerpack' ),
730
- 'type' => Controls_Manager::SLIDER,
731
- 'default' => array(
732
  'size' => 40,
733
  'unit' => 'px',
734
- ),
735
- 'range' => array(
736
- 'px' => array(
737
  'min' => 6,
738
  'max' => 300,
739
- ),
740
- ),
741
- 'selectors' => array(
742
  '{{WRAPPER}} .pp-flipbox-icon-image, {{WRAPPER}} .pp-flipbox-icon-image i' => 'font-size: {{SIZE}}{{UNIT}};',
743
- ),
744
- 'condition' => array(
745
  'icon_type' => 'icon',
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  ),
747
  )
748
  );
749
 
750
  $this->add_responsive_control(
751
  'icon_spacing_front',
752
- array(
753
- 'label' => __( 'Spacing', 'powerpack' ),
754
- 'type' => Controls_Manager::SLIDER,
755
- 'range' => array(
756
- 'px' => array(
757
  'min' => 0,
758
  'max' => 100,
759
- ),
760
- ),
761
- 'selectors' => array(
762
  '{{WRAPPER}} .pp-flipbox-icon-image' => 'margin-bottom: {{SIZE}}{{UNIT}};',
763
- ),
764
- 'condition' => array(
765
- 'icon_type' => 'icon',
766
- ),
767
- )
768
  );
769
 
770
  $this->add_control(
771
  'title_heading_front',
772
- array(
773
- 'label' => esc_html__( 'Title', 'powerpack' ),
774
- 'type' => Controls_Manager::HEADING,
775
- 'separator' => 'before',
776
- )
777
  );
778
 
779
  $this->add_control(
780
  'title_color_front',
781
- array(
782
- 'label' => esc_html__( 'Color', 'powerpack' ),
783
- 'type' => Controls_Manager::COLOR,
784
- 'default' => '#fff',
785
- 'selectors' => array(
786
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-heading' => 'color: {{VALUE}};',
787
- ),
788
- )
789
  );
790
 
791
  $this->add_group_control(
792
  Group_Control_Typography::get_type(),
793
- array(
794
- 'name' => 'title_typography_front',
795
- 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-heading',
796
- )
797
  );
798
 
799
  $this->add_control(
800
  'description_heading_front',
801
- array(
802
- 'label' => esc_html__( 'Description', 'powerpack' ),
803
- 'type' => Controls_Manager::HEADING,
804
- 'separator' => 'before',
805
- )
806
  );
807
 
808
  $this->add_control(
809
  'description_color_front',
810
- array(
811
- 'label' => esc_html__( 'Color', 'powerpack' ),
812
- 'type' => Controls_Manager::COLOR,
813
- 'default' => '#fff',
814
- 'selectors' => array(
815
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-content' => 'color: {{VALUE}};',
816
- ),
817
- )
818
  );
819
 
820
  $this->add_group_control(
821
  Group_Control_Typography::get_type(),
822
- array(
823
- 'name' => 'description_typography_front',
824
- 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-content',
825
- )
826
  );
827
 
828
  $this->end_controls_section();
 
829
 
 
830
  /**
831
  * Style Tab: Back
832
  */
833
  $this->start_controls_section(
834
  'section_back_style',
835
- array(
836
- 'label' => esc_html__( 'Back', 'powerpack' ),
837
- 'tab' => Controls_Manager::TAB_STYLE,
838
- )
839
  );
840
 
841
  $this->add_responsive_control(
842
  'padding_back',
843
- array(
844
- 'label' => esc_html__( 'Padding', 'powerpack' ),
845
- 'type' => Controls_Manager::DIMENSIONS,
846
- 'size_units' => array( 'px', 'em', '%' ),
847
- 'selectors' => array(
848
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
849
- ),
850
- )
851
  );
852
 
853
  $this->add_responsive_control(
854
  'content_alignment_back',
855
- array(
856
- 'label' => esc_html__( 'Alignment', 'powerpack' ),
857
- 'type' => Controls_Manager::CHOOSE,
858
- 'label_block' => false,
859
- 'options' => array(
860
- 'left' => array(
861
- 'title' => esc_html__( 'Left', 'powerpack' ),
862
- 'icon' => 'fa fa-align-left',
863
- ),
864
- 'center' => array(
865
- 'title' => esc_html__( 'Center', 'powerpack' ),
866
- 'icon' => 'fa fa-align-center',
867
- ),
868
- 'right' => array(
869
- 'title' => esc_html__( 'Right', 'powerpack' ),
870
- 'icon' => 'fa fa-align-right',
871
- ),
872
- ),
873
- 'default' => 'center',
874
- 'selectors' => array(
875
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'text-align: {{VALUE}};',
876
- ),
877
- )
878
  );
879
 
880
  $this->add_responsive_control(
881
  'vertical_position_back',
882
- array(
883
- 'label' => __( 'Vertical Position', 'powerpack' ),
884
- 'type' => Controls_Manager::CHOOSE,
885
- 'label_block' => false,
886
- 'options' => array(
887
- 'top' => array(
888
  'title' => __( 'Top', 'powerpack' ),
889
- 'icon' => 'eicon-v-align-top',
890
- ),
891
- 'middle' => array(
892
  'title' => __( 'Middle', 'powerpack' ),
893
- 'icon' => 'eicon-v-align-middle',
894
- ),
895
- 'bottom' => array(
896
  'title' => __( 'Bottom', 'powerpack' ),
897
- 'icon' => 'eicon-v-align-bottom',
898
- ),
899
- ),
900
- 'selectors_dictionary' => array(
901
- 'top' => 'flex-start',
902
  'middle' => 'center',
903
  'bottom' => 'flex-end',
904
- ),
905
- 'selectors' => array(
906
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'justify-content: {{VALUE}}',
907
- ),
908
- )
909
  );
910
 
911
  $this->add_group_control(
912
  Group_Control_Background::get_type(),
913
- array(
914
- 'name' => 'background_back',
915
- 'types' => array( 'classic', 'gradient' ),
916
- 'selector' => '{{WRAPPER}} .pp-flipbox-back',
917
- 'separator' => 'before',
918
- )
919
  );
920
 
921
  $this->add_group_control(
922
  Group_Control_Border::get_type(),
923
- array(
924
- 'name' => 'border_back',
925
- 'label' => esc_html__( 'Border Style', 'powerpack' ),
926
- 'selector' => '{{WRAPPER}} .pp-flipbox-back',
927
- 'separator' => 'before',
928
- )
929
  );
930
 
931
  $this->add_control(
932
  'overlay_back',
933
- array(
934
- 'label' => esc_html__( 'Overlay', 'powerpack' ),
935
- 'type' => Controls_Manager::HEADING,
936
- 'separator' => 'before',
937
- )
938
  );
939
 
940
  $this->add_group_control(
941
  Group_Control_Background::get_type(),
942
- array(
943
- 'name' => 'overlay_back',
944
- 'types' => array( 'classic', 'gradient' ),
945
- 'exclude' => array( 'image' ),
946
- 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay',
947
- )
948
  );
949
 
950
  $this->add_control(
951
  'image_style_heading_back',
952
- array(
953
- 'label' => esc_html__( 'Image', 'powerpack' ),
954
- 'type' => Controls_Manager::HEADING,
955
- 'separator' => 'before',
956
- 'condition' => array(
957
- 'icon_type_back' => 'image',
958
- ),
959
- )
960
  );
961
 
962
  $this->add_responsive_control(
963
  'image_spacing_back',
964
- array(
965
- 'label' => __( 'Spacing', 'powerpack' ),
966
- 'type' => Controls_Manager::SLIDER,
967
- 'range' => array(
968
- 'px' => array(
969
  'min' => 0,
970
  'max' => 100,
971
- ),
972
- ),
973
- 'selectors' => array(
974
  '{{WRAPPER}} .pp-flipbox-icon-image-back' => 'margin-bottom: {{SIZE}}{{UNIT}};',
975
- ),
976
- 'condition' => array(
977
- 'icon_type_back' => 'image',
978
- ),
979
- )
980
  );
981
 
982
  $this->add_responsive_control(
983
  'image_size_back',
984
- array(
985
- 'label' => esc_html__( 'Size (%)', 'powerpack' ),
986
- 'type' => Controls_Manager::SLIDER,
987
- 'default' => array(
988
  'size' => '',
989
- ),
990
- 'selectors' => array(
991
  '{{WRAPPER}} .pp-flipbox-icon-image-back > img' => 'width: {{SIZE}}%;',
992
- ),
993
- 'condition' => array(
994
- 'icon_type_back' => 'image',
995
- ),
996
- )
997
  );
998
 
999
  $this->add_control(
1000
  'icon_style_heading_back',
1001
- array(
1002
- 'label' => esc_html__( 'Icon', 'powerpack' ),
1003
- 'type' => Controls_Manager::HEADING,
1004
- 'separator' => 'before',
1005
- 'condition' => array(
1006
- 'icon_type_back' => 'icon',
1007
- ),
1008
- )
1009
  );
1010
 
1011
  $this->add_control(
1012
  'icon_color_back',
1013
- array(
1014
- 'label' => esc_html__( 'Color', 'powerpack' ),
1015
- 'type' => Controls_Manager::COLOR,
1016
- 'default' => '#ffffff',
1017
- 'selectors' => array(
1018
- '{{WRAPPER}} .pp-flipbox-icon-image-back i' => 'color: {{VALUE}};',
1019
  '{{WRAPPER}} .pp-flipbox-icon-image-back svg' => 'fill: {{VALUE}};',
1020
- ),
1021
- 'condition' => array(
1022
- 'icon_type_back' => 'icon',
1023
- ),
1024
- )
1025
  );
1026
 
1027
  $this->add_responsive_control(
1028
  'icon_size_back',
1029
- array(
1030
- 'label' => __( 'Icon Size', 'powerpack' ),
1031
- 'type' => Controls_Manager::SLIDER,
1032
- 'default' => array(
1033
  'size' => 40,
1034
  'unit' => 'px',
1035
- ),
1036
- 'range' => array(
1037
- 'px' => array(
1038
  'min' => 6,
1039
  'max' => 300,
1040
- ),
1041
- ),
1042
- 'selectors' => array(
1043
  '{{WRAPPER}} .pp-flipbox-icon-image-back, {{WRAPPER}} .pp-flipbox-icon-image-back i' => 'font-size: {{SIZE}}{{UNIT}};',
1044
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
1045
  'condition' => array(
1046
- 'icon_type_back' => 'icon',
1047
  ),
1048
  )
1049
  );
1050
 
1051
  $this->add_responsive_control(
1052
  'icon_spacing_back',
1053
- array(
1054
- 'label' => __( 'Spacing', 'powerpack' ),
1055
- 'type' => Controls_Manager::SLIDER,
1056
- 'range' => array(
1057
- 'px' => array(
1058
  'min' => 0,
1059
  'max' => 100,
1060
- ),
1061
- ),
1062
- 'selectors' => array(
1063
  '{{WRAPPER}} .pp-flipbox-icon-image-back' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1064
- ),
1065
- 'condition' => array(
1066
- 'icon_type_back' => 'icon',
1067
- ),
1068
- )
1069
  );
1070
 
1071
  $this->add_control(
1072
  'title_heading_back',
1073
- array(
1074
- 'label' => esc_html__( 'Title', 'powerpack' ),
1075
- 'type' => Controls_Manager::HEADING,
1076
- 'separator' => 'before',
1077
- )
1078
  );
1079
 
1080
  $this->add_control(
1081
  'title_color_back',
1082
- array(
1083
- 'label' => esc_html__( 'Color', 'powerpack' ),
1084
- 'type' => Controls_Manager::COLOR,
1085
- 'default' => '#fff',
1086
- 'selectors' => array(
1087
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-heading' => 'color: {{VALUE}};',
1088
- ),
1089
- )
1090
  );
1091
 
1092
  $this->add_group_control(
1093
  Group_Control_Typography::get_type(),
1094
- array(
1095
- 'name' => 'title_typography_back',
1096
- 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-heading',
1097
- )
1098
  );
1099
 
1100
  $this->add_control(
1101
  'description_heading_back',
1102
- array(
1103
- 'label' => esc_html__( 'Description', 'powerpack' ),
1104
- 'type' => Controls_Manager::HEADING,
1105
- 'separator' => 'before',
1106
- )
1107
  );
1108
 
1109
  $this->add_control(
1110
  'description_color_back',
1111
- array(
1112
- 'label' => esc_html__( 'Color', 'powerpack' ),
1113
- 'type' => Controls_Manager::COLOR,
1114
- 'default' => '',
1115
- 'selectors' => array(
1116
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-content' => 'color: {{VALUE}};',
1117
- ),
1118
- )
1119
  );
1120
 
1121
  $this->add_group_control(
1122
  Group_Control_Typography::get_type(),
1123
- array(
1124
- 'name' => 'description_typography_back',
1125
- 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-content',
1126
- )
1127
  );
1128
 
1129
  $this->end_controls_section();
 
1130
 
 
1131
  /**
1132
  * Style Tab: Button
1133
- * -------------------------------------------------
1134
  */
1135
  $this->start_controls_section(
1136
  'section_info_box_button_style',
1137
- array(
1138
- 'label' => __( 'Button', 'powerpack' ),
1139
- 'tab' => Controls_Manager::TAB_STYLE,
1140
- 'condition' => array(
1141
- 'link_type' => 'button',
1142
- ),
1143
- )
1144
  );
1145
 
1146
  $this->add_control(
1147
  'button_size',
1148
- array(
1149
- 'label' => __( 'Size', 'powerpack' ),
1150
- 'type' => Controls_Manager::SELECT,
1151
- 'default' => 'md',
1152
- 'options' => array(
1153
  'xs' => __( 'Extra Small', 'powerpack' ),
1154
  'sm' => __( 'Small', 'powerpack' ),
1155
  'md' => __( 'Medium', 'powerpack' ),
1156
  'lg' => __( 'Large', 'powerpack' ),
1157
  'xl' => __( 'Extra Large', 'powerpack' ),
1158
- ),
1159
- 'condition' => array(
1160
- 'link_type' => 'button',
1161
- ),
1162
- )
1163
  );
1164
 
1165
  $this->add_responsive_control(
1166
  'button_spacing',
1167
- array(
1168
- 'label' => __( 'Spacing', 'powerpack' ),
1169
- 'type' => Controls_Manager::SLIDER,
1170
- 'default' => array(
1171
  'size' => 15,
1172
- ),
1173
- 'range' => array(
1174
- 'px' => array(
1175
  'min' => 0,
1176
  'max' => 100,
1177
- ),
1178
- ),
1179
- 'selectors' => array(
1180
  '{{WRAPPER}} .pp-flipbox-button' => 'margin-top: {{SIZE}}{{UNIT}};',
1181
- ),
1182
- 'condition' => array(
1183
- 'link_type' => 'button',
1184
- ),
1185
- )
1186
  );
1187
 
1188
  $this->start_controls_tabs( 'tabs_button_style' );
1189
 
1190
  $this->start_controls_tab(
1191
  'tab_button_normal',
1192
- array(
1193
- 'label' => __( 'Normal', 'powerpack' ),
1194
- 'condition' => array(
1195
- 'link_type' => 'button',
1196
- ),
1197
- )
1198
  );
1199
 
1200
  $this->add_control(
1201
  'button_bg_color_normal',
1202
- array(
1203
- 'label' => __( 'Background Color', 'powerpack' ),
1204
- 'type' => Controls_Manager::COLOR,
1205
- 'default' => '',
1206
- 'selectors' => array(
1207
  '{{WRAPPER}} .pp-flipbox-button' => 'background-color: {{VALUE}}',
1208
- ),
1209
- 'condition' => array(
1210
- 'link_type' => 'button',
1211
- ),
1212
- )
1213
  );
1214
 
1215
  $this->add_control(
1216
  'button_text_color_normal',
1217
- array(
1218
- 'label' => __( 'Text Color', 'powerpack' ),
1219
- 'type' => Controls_Manager::COLOR,
1220
- 'default' => '',
1221
- 'selectors' => array(
1222
  '{{WRAPPER}} .pp-flipbox-button' => 'color: {{VALUE}}',
1223
  '{{WRAPPER}} .pp-flipbox-button .pp-button-icon svg' => 'fill: {{VALUE}}',
1224
- ),
1225
- 'condition' => array(
1226
- 'link_type' => 'button',
1227
- ),
1228
- )
1229
  );
1230
 
1231
  $this->add_group_control(
1232
  Group_Control_Border::get_type(),
1233
- array(
1234
- 'name' => 'button_border_normal',
1235
- 'label' => __( 'Border', 'powerpack' ),
1236
- 'placeholder' => '1px',
1237
- 'default' => '1px',
1238
- 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1239
- 'condition' => array(
1240
- 'link_type' => 'button',
1241
- ),
1242
- )
1243
  );
1244
 
1245
  $this->add_control(
1246
  'button_border_radius',
1247
- array(
1248
- 'label' => __( 'Border Radius', 'powerpack' ),
1249
- 'type' => Controls_Manager::DIMENSIONS,
1250
- 'size_units' => array( 'px', '%' ),
1251
- 'selectors' => array(
1252
  '{{WRAPPER}} .pp-flipbox-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1253
- ),
1254
- 'condition' => array(
1255
- 'link_type' => 'button',
1256
- ),
1257
- )
1258
  );
1259
 
1260
  $this->add_group_control(
1261
  Group_Control_Typography::get_type(),
1262
- array(
1263
- 'name' => 'button_typography',
1264
- 'label' => __( 'Typography', 'powerpack' ),
1265
- 'scheme' => Scheme_Typography::TYPOGRAPHY_4,
1266
- 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1267
- 'condition' => array(
1268
- 'link_type' => 'button',
1269
- ),
1270
- )
1271
  );
1272
 
1273
  $this->add_responsive_control(
1274
  'button_padding',
1275
- array(
1276
- 'label' => __( 'Padding', 'powerpack' ),
1277
- 'type' => Controls_Manager::DIMENSIONS,
1278
- 'size_units' => array( 'px', 'em', '%' ),
1279
- 'selectors' => array(
1280
  '{{WRAPPER}} .pp-flipbox-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1281
- ),
1282
- 'condition' => array(
1283
- 'link_type' => 'button',
1284
- ),
1285
- )
1286
  );
1287
 
1288
  $this->add_group_control(
1289
  Group_Control_Box_Shadow::get_type(),
1290
- array(
1291
- 'name' => 'button_box_shadow',
1292
- 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1293
- 'condition' => array(
1294
- 'link_type' => 'button',
1295
- ),
1296
- )
1297
  );
1298
 
1299
  $this->add_control(
1300
  'info_box_button_icon_heading',
1301
- array(
1302
- 'label' => __( 'Button Icon', 'powerpack' ),
1303
- 'type' => Controls_Manager::HEADING,
1304
- 'separator' => 'before',
1305
- 'condition' => array(
1306
- 'link_type' => 'button',
1307
  'select_button_icon[value]!' => '',
1308
- ),
1309
- )
1310
  );
1311
 
1312
  $this->add_responsive_control(
1313
  'button_icon_margin',
1314
- array(
1315
- 'label' => __( 'Margin', 'powerpack' ),
1316
- 'type' => Controls_Manager::DIMENSIONS,
1317
- 'size_units' => array( 'px', '%' ),
1318
- 'placeholder' => array(
1319
- 'top' => '',
1320
- 'right' => '',
1321
- 'bottom' => '',
1322
- 'left' => '',
1323
- ),
1324
- 'condition' => array(
1325
- 'link_type' => 'button',
1326
  'select_button_icon[value]!' => '',
1327
- ),
1328
- 'selectors' => array(
1329
  '{{WRAPPER}} .pp-info-box .pp-button-icon' => 'margin-top: {{TOP}}{{UNIT}}; margin-left: {{LEFT}}{{UNIT}}; margin-right: {{RIGHT}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};',
1330
- ),
1331
- )
1332
  );
1333
 
1334
  $this->end_controls_tab();
1335
 
1336
  $this->start_controls_tab(
1337
  'tab_button_hover',
1338
- array(
1339
- 'label' => __( 'Hover', 'powerpack' ),
1340
- 'condition' => array(
1341
- 'link_type' => 'button',
1342
- ),
1343
- )
1344
  );
1345
 
1346
  $this->add_control(
1347
  'button_bg_color_hover',
1348
- array(
1349
- 'label' => __( 'Background Color', 'powerpack' ),
1350
- 'type' => Controls_Manager::COLOR,
1351
- 'default' => '',
1352
- 'selectors' => array(
1353
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'background-color: {{VALUE}}',
1354
- ),
1355
- 'condition' => array(
1356
- 'link_type' => 'button',
1357
- ),
1358
- )
1359
  );
1360
 
1361
  $this->add_control(
1362
  'button_text_color_hover',
1363
- array(
1364
- 'label' => __( 'Text Color', 'powerpack' ),
1365
- 'type' => Controls_Manager::COLOR,
1366
- 'default' => '',
1367
- 'selectors' => array(
1368
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'color: {{VALUE}}',
1369
- ),
1370
- 'condition' => array(
1371
- 'link_type' => 'button',
1372
- ),
1373
- )
1374
  );
1375
 
1376
  $this->add_control(
1377
  'button_border_color_hover',
1378
- array(
1379
- 'label' => __( 'Border Color', 'powerpack' ),
1380
- 'type' => Controls_Manager::COLOR,
1381
- 'default' => '',
1382
- 'selectors' => array(
1383
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'border-color: {{VALUE}}',
1384
- ),
1385
- 'condition' => array(
1386
- 'link_type' => 'button',
1387
- ),
1388
- )
1389
  );
1390
 
1391
  $this->add_control(
1392
  'button_animation',
1393
- array(
1394
- 'label' => __( 'Animation', 'powerpack' ),
1395
- 'type' => Controls_Manager::HOVER_ANIMATION,
1396
- 'condition' => array(
1397
- 'link_type' => 'button',
1398
- ),
1399
- )
1400
  );
1401
 
1402
  $this->add_group_control(
1403
  Group_Control_Box_Shadow::get_type(),
1404
- array(
1405
- 'name' => 'button_box_shadow_hover',
1406
- 'selector' => '{{WRAPPER}} .pp-flipbox-button:hover',
1407
- 'condition' => array(
1408
- 'link_type' => 'button',
1409
- ),
1410
- )
1411
  );
1412
 
1413
  $this->end_controls_tab();
1414
  $this->end_controls_tabs();
1415
 
1416
  $this->end_controls_section();
1417
-
1418
  }
1419
 
1420
  protected function render() {
@@ -1426,31 +1564,26 @@ class Flipbox extends Powerpack_Widget {
1426
 
1427
  $this->add_render_attribute(
1428
  'flipbox-container',
1429
- array(
1430
- 'class' => array(
1431
  'pp-flipbox-container',
1432
  'pp-animate-' . esc_attr( $settings['flip_effect'] ),
1433
  'pp-direction-' . esc_attr( $settings['flip_direction'] ),
1434
- ),
1435
- )
1436
  );
1437
-
1438
  ?>
 
 
 
 
 
1439
 
1440
- <div <?php echo $this->get_render_attribute_string( 'flipbox-container' ); ?>>
1441
-
1442
- <div <?php echo $this->get_render_attribute_string( 'flipbox-card' ); ?>>
1443
-
1444
- <?php
1445
- // Front
1446
- $this->render_front();
1447
-
1448
- // Back
1449
- $this->render_back();
1450
- ?>
1451
-
1452
  </div>
1453
- </div>
1454
  <?php
1455
  }
1456
 
@@ -1479,7 +1612,7 @@ class Flipbox extends Powerpack_Widget {
1479
  $has_icon = true;
1480
  }
1481
  $migrated = isset( $settings['__fa4_migrated']['select_icon'] );
1482
- $is_new = ! isset( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
1483
  ?>
1484
  <div class="pp-flipbox-front">
1485
  <div class="pp-flipbox-overlay">
@@ -1488,31 +1621,33 @@ class Flipbox extends Powerpack_Widget {
1488
  <?php if ( 'icon' === $settings['icon_type'] && $has_icon ) { ?>
1489
  <?php
1490
  if ( $is_new || $migrated ) {
1491
- Icons_Manager::render_icon( $settings['select_icon'], array( 'aria-hidden' => 'true' ) );
1492
  } elseif ( ! empty( $settings['icon'] ) ) {
1493
- ?>
1494
- <i <?php echo $this->get_render_attribute_string( 'front-i' ); ?>></i>
1495
- <?php
1496
  }
1497
  ?>
1498
  <?php } elseif ( 'image' === $settings['icon_type'] ) { ?>
1499
  <?php
1500
- $flipbox_image = $settings['icon_image'];
1501
  $flipbox_image_url = Group_Control_Image_Size::get_attachment_image_src( $flipbox_image['id'], 'thumbnail', $settings );
1502
  $flipbox_image_url = ( empty( $flipbox_image_url ) ) ? $flipbox_image['url'] : $flipbox_image_url;
1503
  ?>
1504
  <?php if ( $flipbox_image_url ) { ?>
1505
  <img src="<?php echo esc_url( $flipbox_image_url ); ?>" alt="">
1506
  <?php } ?>
 
 
 
 
1507
  <?php } ?>
1508
  </div>
1509
 
1510
- <h3 class="pp-flipbox-heading">
1511
- <?php echo esc_html__( $settings['title_front'], 'powerpack' ); ?>
1512
- </h3>
1513
 
1514
  <div class="pp-flipbox-content">
1515
- <?php echo __( $settings['description_front'], 'powerpack' ); ?>
1516
  </div>
1517
  </div>
1518
  </div>
@@ -1523,15 +1658,15 @@ class Flipbox extends Powerpack_Widget {
1523
  protected function render_back() {
1524
  $settings = $this->get_settings_for_display();
1525
 
1526
- $pp_title_html_tag = 'h3';
1527
 
1528
  $this->add_render_attribute( 'title-container', 'class', 'pp-flipbox-heading' );
1529
 
1530
- $flipbox_image_back = $settings['icon_image_back'];
1531
  $flipbox_back_image_url = Group_Control_Image_Size::get_attachment_image_src( $flipbox_image_back['id'], 'thumbnail_back', $settings );
1532
  $flipbox_back_image_url = ( empty( $flipbox_back_image_url ) ) ? $flipbox_image_back['url'] : $flipbox_back_image_url;
1533
 
1534
- if ( $settings['icon_type_back'] != 'none' ) {
1535
 
1536
  $this->add_render_attribute( 'icon-back', 'class', 'pp-flipbox-icon-image-back' );
1537
 
@@ -1551,24 +1686,24 @@ class Flipbox extends Powerpack_Widget {
1551
  $has_icon_back = true;
1552
  }
1553
  $migrated_icon_back = isset( $settings['__fa4_migrated']['select_icon_back'] );
1554
- $is_new_icon_back = ! isset( $settings['icon_back'] ) && Icons_Manager::is_migration_allowed();
1555
 
1556
- if ( 'image' == $settings['icon_type_back'] ) {
1557
  $this->add_render_attribute(
1558
  'icon-image-back',
1559
- array(
1560
- 'src' => $flipbox_back_image_url,
1561
- 'alt' => 'flipbox-image',
1562
- )
1563
  );
1564
- } elseif ( 'icon' == $settings['icon_type_back'] ) {
1565
  $this->add_render_attribute( 'icon-back', 'class', 'pp-icon' );
1566
  }
1567
  }
1568
 
1569
- if ( $settings['link_type'] != 'none' ) {
1570
  if ( ! empty( $settings['link']['url'] ) ) {
1571
- if ( $settings['link_type'] == 'title' ) {
1572
 
1573
  $pp_title_html_tag = 'a';
1574
 
@@ -1576,9 +1711,9 @@ class Flipbox extends Powerpack_Widget {
1576
 
1577
  $this->add_link_attributes( 'title-container', $settings['link'] );
1578
 
1579
- } elseif ( $settings['link_type'] == 'button' ) {
1580
 
1581
- $this->add_render_attribute( 'button', 'class', array( 'elementor-button', 'pp-flipbox-button', 'elementor-size-' . $settings['button_size'] ) );
1582
 
1583
  $this->add_link_attributes( 'button', $settings['link'] );
1584
 
@@ -1588,7 +1723,7 @@ class Flipbox extends Powerpack_Widget {
1588
  ?>
1589
  <div class="pp-flipbox-back">
1590
  <?php
1591
- if ( $settings['link_type'] == 'box' && $settings['link']['url'] != '' ) {
1592
  $this->add_render_attribute( 'box-link', 'class', 'pp-flipbox-box-link' );
1593
 
1594
  $this->add_link_attributes( 'box-link', $settings['link'] );
@@ -1597,41 +1732,43 @@ class Flipbox extends Powerpack_Widget {
1597
  <?php } ?>
1598
  <div class="pp-flipbox-overlay">
1599
  <div class="pp-flipbox-inner">
1600
- <?php if ( 'none' != $settings['icon_type_back'] ) { ?>
1601
  <div <?php echo $this->get_render_attribute_string( 'icon-back' ); ?>>
1602
- <?php if ( 'image' == $settings['icon_type_back'] ) { ?>
1603
  <img <?php echo $this->get_render_attribute_string( 'icon-image-back' ); ?>>
1604
- <?php } elseif ( 'icon' == $settings['icon_type_back'] && $has_icon_back ) { ?>
1605
  <?php
1606
  if ( $is_new_icon_back || $migrated_icon_back ) {
1607
- Icons_Manager::render_icon( $settings['select_icon_back'], array( 'aria-hidden' => 'true' ) );
1608
  } elseif ( ! empty( $settings['icon_back'] ) ) {
1609
- ?>
1610
- <i <?php echo $this->get_render_attribute_string( 'back-i' ); ?>></i>
1611
- <?php
1612
  }
1613
  ?>
 
 
 
 
1614
  <?php } ?>
1615
  </div>
1616
  <?php } ?>
1617
 
1618
  <?php if ( $settings['title_back'] ) { ?>
1619
  <<?php echo $pp_title_html_tag,' ', $this->get_render_attribute_string( 'title-container' ); ?>>
1620
- <?php echo esc_html__( $settings['title_back'], 'powerpack' ); ?>
1621
  </<?php echo $pp_title_html_tag; ?>>
1622
  <?php } ?>
1623
 
1624
  <div class="pp-flipbox-content">
1625
- <?php echo __( $settings['description_back'], 'powerpack' ); ?>
1626
  </div>
1627
 
1628
- <?php if ( $settings['link_type'] == 'button' && ! empty( $settings['flipbox_button_text'] ) ) : ?>
1629
  <a <?php echo $this->get_render_attribute_string( 'button' ); ?>>
1630
- <?php if ( 'before' == $settings['button_icon_position'] ) : ?>
1631
  <?php $this->render_button_icon(); ?>
1632
  <?php endif; ?>
1633
  <?php echo esc_attr( $settings['flipbox_button_text'] ); ?>
1634
- <?php if ( 'after' == $settings['button_icon_position'] ) : ?>
1635
  <?php $this->render_button_icon(); ?>
1636
  <?php endif; ?>
1637
  </a>
@@ -1653,40 +1790,25 @@ class Flipbox extends Powerpack_Widget {
1653
  $has_button_icon = ! empty( $settings['button_icon'] );
1654
 
1655
  if ( $has_button_icon ) {
1656
- $this->add_render_attribute( 'back-i', 'class', $settings['button_icon'] );
1657
- $this->add_render_attribute( 'back-i', 'aria-hidden', 'true' );
1658
  }
1659
 
1660
  if ( ! $has_button_icon && ! empty( $settings['select_button_icon']['value'] ) ) {
1661
  $has_button_icon = true;
1662
  }
1663
- $migrated_button_icon = isset( $settings['__fa4_migrated']['select_button_icon'] );
1664
- $is_new_button_icon = ! isset( $settings['button_icon'] ) && Icons_Manager::is_migration_allowed();
1665
 
1666
- if ( 'image' == $settings['icon_type_back'] ) {
1667
- $this->add_render_attribute(
1668
- 'icon-image-back',
1669
- array(
1670
- 'src' => $flipbox_back_image_url,
1671
- 'alt' => 'flipbox-image',
1672
- )
1673
- );
1674
- } elseif ( 'icon' == $settings['icon_type_back'] ) {
1675
- $this->add_render_attribute( 'icon-back', 'class', 'pp-icon' );
1676
- }
1677
 
1678
  if ( $has_button_icon ) {
1679
  echo '<span class="pp-button-icon">';
1680
  if ( $is_new_button_icon || $migrated_button_icon ) {
1681
- Icons_Manager::render_icon( $settings['select_button_icon'], array( 'aria-hidden' => 'true' ) );
1682
  } elseif ( ! empty( $settings['button_icon'] ) ) {
1683
- ?>
1684
- <i <?php echo $this->get_render_attribute_string( 'back-i' ); ?>></i>
1685
- <?php
1686
  }
1687
  echo '</span>';
1688
  }
1689
  }
1690
-
1691
- protected function content_template() { }
1692
  }
2
  namespace PowerpackElementsLite\Modules\Flipbox\Widgets;
3
 
4
  use PowerpackElementsLite\Base\Powerpack_Widget;
5
+ use PowerpackElementsLite\Classes\PP_Config;
6
 
7
  // Elementor Classes
8
  use Elementor\Controls_Manager;
96
  */
97
  protected function _register_controls() {
98
 
99
+ /* Content Tab */
100
+ $this->register_content_front_controls();
101
+ $this->register_content_back_controls();
102
+ $this->register_content_settings_controls();
103
+ $this->register_content_help_docs_controls();
104
+ $this->register_content_upgrade_pro_controls();
105
+
106
+ /* Style Tab */
107
+ $this->register_style_front_controls();
108
+ $this->register_style_back_controls();
109
+ $this->register_style_button_controls();
110
+ }
111
+
112
+ /*-----------------------------------------------------------------------------------*/
113
+ /* CONTENT TAB
114
+ /*-----------------------------------------------------------------------------------*/
115
 
116
+ protected function register_content_front_controls() {
117
  /**
118
  * Content Tab: Front
119
  */
120
  $this->start_controls_section(
121
  'section_front',
122
+ [
123
+ 'label' => esc_html__( 'Front', 'powerpack' ),
124
+ ]
125
  );
126
 
127
  $this->add_control(
128
  'icon_type',
129
+ [
130
+ 'label' => esc_html__( 'Icon Type', 'powerpack' ),
131
+ 'type' => Controls_Manager::CHOOSE,
132
+ 'label_block' => false,
133
+ 'options' => [
134
+ 'none' => [
135
+ 'title' => __( 'None', 'powerpack' ),
136
+ 'icon' => 'fa fa-ban',
137
+ ],
138
+ 'image' => [
139
+ 'title' => __( 'Image', 'powerpack' ),
140
+ 'icon' => 'fa fa-picture-o',
141
+ ],
142
+ 'icon' => [
143
+ 'title' => __( 'Icon', 'powerpack' ),
144
+ 'icon' => 'fa fa-star',
145
+ ],
146
+ 'text' => array(
147
+ 'title' => esc_html__( 'Text', 'powerpack' ),
148
+ 'icon' => 'fa fa-font',
149
  ),
150
+ ],
151
+ 'default' => 'icon',
152
+ ]
153
  );
154
 
155
  $this->add_control(
156
  'icon_image',
157
+ [
158
+ 'label' => esc_html__( 'Choose Image', 'powerpack' ),
159
+ 'type' => Controls_Manager::MEDIA,
160
+ 'default' => [
161
  'url' => Utils::get_placeholder_image_src(),
162
+ ],
163
+ 'condition' => [
164
  'icon_type' => 'image',
165
+ ],
166
+ ]
167
  );
168
 
169
  $this->add_control(
170
  'select_icon',
171
+ [
172
+ 'label' => __( 'Icon', 'powerpack' ),
173
+ 'type' => Controls_Manager::ICONS,
174
+ 'fa4compatibility' => 'icon',
175
+ 'default' => [
176
+ 'value' => 'fas fa-star',
177
+ 'library' => 'fa-solid',
178
+ ],
179
+ 'condition' => [
180
+ 'icon_type' => 'icon',
181
+ ],
182
+ ]
183
  );
184
 
185
  $this->add_group_control(
186
  Group_Control_Image_Size::get_type(),
187
+ [
188
+ 'name' => 'thumbnail',
189
+ 'default' => 'full',
190
+ 'condition' => [
191
+ 'icon_type' => 'image',
192
+ 'icon_image[url]!' => '',
193
+ ],
194
+ ]
195
+ );
196
+
197
+ $this->add_control(
198
+ 'icon_text',
199
  array(
200
+ 'label' => __( 'Icon Text', 'powerpack' ),
201
+ 'type' => Controls_Manager::TEXT,
202
+ 'dynamic' => array(
203
+ 'active' => true,
204
+ ),
205
+ 'default' => '1',
206
  'condition' => array(
207
+ 'icon_type' => 'text',
 
208
  ),
209
  )
210
  );
211
 
212
  $this->add_control(
213
  'title_front',
214
+ [
215
+ 'label' => esc_html__( 'Title', 'powerpack' ),
216
+ 'type' => Controls_Manager::TEXT,
217
+ 'label_block' => true,
218
+ 'default' => esc_html__( 'This is the heading', 'powerpack' ),
219
+ 'separator' => 'before',
220
+ ]
221
  );
222
  $this->add_control(
223
  'description_front',
224
+ [
225
+ 'label' => esc_html__( 'Description', 'powerpack' ),
226
+ 'type' => Controls_Manager::TEXTAREA,
227
+ 'label_block' => true,
228
+ 'default' => __( 'This is the front content. Click edit button to change this text. Lorem ipsum dolor sit amet consectetur adipiscing elit dolor', 'powerpack' ),
229
+ ]
230
+ );
231
+
232
+ $this->add_control(
233
+ 'title_html_tag_front',
234
  array(
235
+ 'label' => __( 'Title HTML Tag', 'powerpack' ),
236
+ 'type' => Controls_Manager::SELECT,
237
+ 'default' => 'h3',
238
+ 'options' => array(
239
+ 'h1' => __( 'H1', 'powerpack' ),
240
+ 'h2' => __( 'H2', 'powerpack' ),
241
+ 'h3' => __( 'H3', 'powerpack' ),
242
+ 'h4' => __( 'H4', 'powerpack' ),
243
+ 'h5' => __( 'H5', 'powerpack' ),
244
+ 'h6' => __( 'H6', 'powerpack' ),
245
+ 'div' => __( 'div', 'powerpack' ),
246
+ 'span' => __( 'span', 'powerpack' ),
247
+ 'p' => __( 'p', 'powerpack' ),
248
+ ),
249
  )
250
  );
251
 
252
  $this->end_controls_section();
253
+ }
254
 
255
+ protected function register_content_back_controls() {
256
  /**
257
  * Content Tab: Back
258
  */
259
  $this->start_controls_section(
260
  'section_back',
261
+ [
262
+ 'label' => esc_html__( 'Back', 'powerpack' ),
263
+ ]
264
  );
265
 
266
  $this->add_control(
267
  'icon_type_back',
268
+ [
269
+ 'label' => esc_html__( 'Icon Type', 'powerpack' ),
270
+ 'type' => Controls_Manager::CHOOSE,
271
+ 'label_block' => false,
272
+ 'options' => [
273
+ 'none' => [
274
+ 'title' => __( 'None', 'powerpack' ),
275
+ 'icon' => 'fa fa-ban',
276
+ ],
277
+ 'image' => [
278
+ 'title' => __( 'Image', 'powerpack' ),
279
+ 'icon' => 'fa fa-picture-o',
280
+ ],
281
+ 'icon' => [
282
+ 'title' => __( 'Icon', 'powerpack' ),
283
+ 'icon' => 'fa fa-star',
284
+ ],
285
+ 'text' => array(
286
+ 'title' => esc_html__( 'Text', 'powerpack' ),
287
+ 'icon' => 'fa fa-font',
288
  ),
289
+ ],
290
+ 'default' => 'icon',
291
+ ]
 
 
 
 
292
  );
293
 
294
  $this->add_control(
295
  'icon_image_back',
296
+ [
297
+ 'label' => esc_html__( 'Flipbox Image', 'powerpack' ),
298
+ 'type' => Controls_Manager::MEDIA,
299
+ 'default' => [
300
  'url' => Utils::get_placeholder_image_src(),
301
+ ],
302
+ 'condition' => [
303
+ 'icon_type_back' => 'image',
304
+ ],
305
+ ]
306
  );
307
 
308
  $this->add_control(
309
  'select_icon_back',
310
+ [
311
+ 'label' => __( 'Icon', 'powerpack' ),
312
+ 'type' => Controls_Manager::ICONS,
313
+ 'fa4compatibility' => 'icon_back',
314
+ 'default' => [
315
+ 'value' => 'far fa-snowflake',
316
+ 'library' => 'fa-regular',
317
+ ],
318
+ 'condition' => [
319
+ 'icon_type_back' => 'icon',
320
+ ],
321
+ ]
322
  );
323
 
324
  $this->add_group_control(
325
  Group_Control_Image_Size::get_type(),
326
+ [
327
+ 'name' => 'thumbnail_back',
328
+ 'default' => 'full',
329
+ 'condition' => [
330
  'icon_type_back' => 'image',
331
  'icon_image_back[url]!' => '',
332
+ ],
333
+ ]
334
+ );
335
+
336
+ $this->add_control(
337
+ 'icon_text_back',
338
+ array(
339
+ 'label' => __( 'Icon Text', 'powerpack' ),
340
+ 'type' => Controls_Manager::TEXT,
341
+ 'dynamic' => array(
342
+ 'active' => true,
343
+ ),
344
+ 'default' => '1',
345
+ 'condition' => array(
346
+ 'icon_type_back' => 'text',
347
  ),
348
  )
349
  );
350
 
351
  $this->add_control(
352
  'title_back',
353
+ [
354
+ 'label' => esc_html__( 'Title', 'powerpack' ),
355
+ 'type' => Controls_Manager::TEXT,
356
+ 'label_block' => true,
357
+ 'default' => esc_html__( 'This is the heading', 'powerpack' ),
358
+ 'separator' => 'before',
359
+ ]
360
  );
361
 
362
  $this->add_control(
363
  'description_back',
364
+ [
365
+ 'label' => esc_html__( 'Description', 'powerpack' ),
366
+ 'type' => Controls_Manager::TEXTAREA,
367
+ 'label_block' => true,
368
+ 'default' => __( 'This is the front content. Click edit button to change this text. Lorem ipsum dolor sit amet consectetur adipiscing elit dolor', 'powerpack' ),
369
+ ]
370
  );
371
 
372
  $this->add_control(
373
+ 'title_html_tag_back',
374
  array(
375
+ 'label' => __( 'Title HTML Tag', 'powerpack' ),
376
  'type' => Controls_Manager::SELECT,
377
+ 'default' => 'h3',
378
  'options' => array(
379
+ 'h1' => __( 'H1', 'powerpack' ),
380
+ 'h2' => __( 'H2', 'powerpack' ),
381
+ 'h3' => __( 'H3', 'powerpack' ),
382
+ 'h4' => __( 'H4', 'powerpack' ),
383
+ 'h5' => __( 'H5', 'powerpack' ),
384
+ 'h6' => __( 'H6', 'powerpack' ),
385
+ 'div' => __( 'div', 'powerpack' ),
386
+ 'span' => __( 'span', 'powerpack' ),
387
+ 'p' => __( 'p', 'powerpack' ),
388
  ),
389
  )
390
  );
391
 
392
+ $this->add_control(
393
+ 'link_type',
394
+ [
395
+ 'label' => __( 'Link Type', 'powerpack' ),
396
+ 'type' => Controls_Manager::SELECT,
397
+ 'default' => 'none',
398
+ 'options' => [
399
+ 'none' => __( 'None', 'powerpack' ),
400
+ 'title' => __( 'Title', 'powerpack' ),
401
+ 'button' => __( 'Button', 'powerpack' ),
402
+ 'box' => __( 'Box', 'powerpack' ),
403
+ ],
404
+ ]
405
+ );
406
+
407
  $this->add_control(
408
  'link',
409
+ [
410
+ 'label' => __( 'Link', 'powerpack' ),
411
+ 'type' => Controls_Manager::URL,
412
+ 'dynamic' => [
413
+ 'active' => true,
414
+ 'categories' => [
415
  TagsModule::POST_META_CATEGORY,
416
  TagsModule::URL_CATEGORY,
417
+ ],
418
+ ],
419
+ 'placeholder' => 'https://www.your-link.com',
420
+ 'default' => [
421
  'url' => '#',
422
+ ],
423
+ 'condition' => [
424
+ 'link_type!' => 'none',
425
+ ],
426
+ ]
427
  );
428
 
429
  $this->add_control(
430
  'flipbox_button_text',
431
+ [
432
+ 'label' => __( 'Button Text', 'powerpack' ),
433
+ 'type' => Controls_Manager::TEXT,
434
+ 'dynamic' => [
435
+ 'active' => true,
436
+ ],
437
+ 'default' => __( 'Get Started', 'powerpack' ),
438
+ 'condition' => [
439
+ 'link_type' => 'button',
440
+ ],
441
+ ]
442
  );
443
 
444
  $this->add_control(
445
  'select_button_icon',
446
+ [
447
+ 'label' => __( 'Button Icon', 'powerpack' ),
448
+ 'type' => Controls_Manager::ICONS,
449
+ 'fa4compatibility' => 'button_icon',
450
+ 'condition' => [
451
+ 'link_type' => 'button',
452
+ ],
453
+ ]
454
  );
455
 
456
  $this->add_control(
457
  'button_icon_position',
458
+ [
459
+ 'label' => __( 'Icon Position', 'powerpack' ),
460
+ 'type' => Controls_Manager::SELECT,
461
+ 'default' => 'after',
462
+ 'options' => [
463
+ 'after' => __( 'After', 'powerpack' ),
464
+ 'before' => __( 'Before', 'powerpack' ),
465
+ ],
466
+ 'condition' => [
467
+ 'link_type' => 'button',
468
+ 'select_button_icon[value]!' => '',
469
+ ],
470
+ ]
471
  );
472
 
473
  $this->end_controls_section();
474
+ }
475
 
476
+ protected function register_content_settings_controls() {
477
  /**
478
  * Content Tab: Settings
479
  */
480
  $this->start_controls_section(
481
  'section_settings',
482
+ [
483
+ 'label' => esc_html__( 'Settings', 'powerpack' ),
484
+ ]
485
  );
486
 
487
  $this->add_responsive_control(
488
  'height',
489
+ [
490
+ 'label' => __( 'Height', 'powerpack' ),
491
+ 'type' => Controls_Manager::SLIDER,
492
+ 'size_units' => [ 'px', 'vh' ],
493
+ 'range' => [
494
+ 'px' => [
495
  'min' => 100,
496
  'max' => 1000,
497
+ ],
498
+ 'vh' => [
499
  'min' => 10,
500
  'max' => 100,
501
+ ],
502
+ ],
503
+ 'selectors' => [
504
  '{{WRAPPER}} .pp-flipbox-container' => 'height: {{SIZE}}{{UNIT}};',
505
+ ],
506
+ ]
507
  );
508
 
509
  $this->add_control(
510
  'border_radius',
511
+ [
512
+ 'label' => __( 'Border Radius', 'powerpack' ),
513
+ 'type' => Controls_Manager::SLIDER,
514
+ 'size_units' => [ 'px', '%' ],
515
+ 'range' => [
516
+ 'px' => [
517
  'min' => 0,
518
  'max' => 200,
519
+ ],
520
+ ],
521
+ 'selectors' => [
522
  '{{WRAPPER}} .pp-flipbox-back, {{WRAPPER}} .pp-flipbox-front' => 'border-radius: {{SIZE}}{{UNIT}}',
523
+ ],
524
+ ]
525
  );
526
 
527
  $this->add_control(
528
  'flip_effect',
529
+ [
530
+ 'label' => esc_html__( 'Flip Effect', 'powerpack' ),
531
+ 'type' => Controls_Manager::SELECT,
532
+ 'default' => 'flip',
533
+ 'label_block' => false,
534
+ 'options' => [
535
  'flip' => esc_html__( 'Flip', 'powerpack' ),
536
  'slide' => esc_html__( 'Slide', 'powerpack' ),
537
  'push' => esc_html__( 'Push', 'powerpack' ),
538
  'zoom-in' => esc_html__( 'Zoom In', 'powerpack' ),
539
  'zoom-out' => esc_html__( 'Zoom Out', 'powerpack' ),
540
  'fade' => esc_html__( 'Fade', 'powerpack' ),
541
+ ],
542
+ 'separator' => 'before',
543
+ ]
544
  );
545
 
546
  $this->add_control(
547
  'flip_direction',
548
+ [
549
+ 'label' => esc_html__( 'Flip Direction', 'powerpack' ),
550
+ 'type' => Controls_Manager::SELECT,
551
+ 'default' => 'left',
552
+ 'label_block' => false,
553
+ 'options' => [
554
+ 'left' => esc_html__( 'Left', 'powerpack' ),
555
+ 'right' => esc_html__( 'Right', 'powerpack' ),
556
+ 'up' => esc_html__( 'Top', 'powerpack' ),
557
+ 'down' => esc_html__( 'Bottom', 'powerpack' ),
558
+ ],
559
+ 'condition' => [
560
+ 'flip_effect!' => [
561
  'fade',
562
  'zoom-in',
563
  'zoom-out',
564
+ ],
565
+ ],
566
+ ]
567
  );
568
 
569
  $this->end_controls_section();
570
+ }
571
 
572
+ protected function register_content_help_docs_controls() {
 
 
 
 
 
 
 
 
 
 
 
573
 
574
+ $help_docs = PP_Config::get_widget_help_links( 'Flipbox' );
 
 
 
 
 
 
 
 
575
 
576
+ if ( ! empty( $help_docs ) ) {
577
+
578
+ /**
579
+ * Content Tab: Help Docs
580
+ *
581
+ * @since 2.0.0
582
+ * @access protected
583
+ */
584
+ $this->start_controls_section(
585
+ 'section_help_docs',
586
+ [
587
+ 'label' => __( 'Help Docs', 'powerpack' ),
588
+ ]
589
+ );
590
+
591
+ $hd_counter = 1;
592
+ foreach ( $help_docs as $hd_title => $hd_link ) {
593
+ $this->add_control(
594
+ 'help_doc_' . $hd_counter,
595
+ [
596
+ 'type' => Controls_Manager::RAW_HTML,
597
+ 'raw' => sprintf( '%1$s ' . $hd_title . ' %2$s', '<a href="' . $hd_link . '" target="_blank" rel="noopener">', '</a>' ),
598
+ 'content_classes' => 'pp-editor-doc-links',
599
+ ]
600
+ );
601
+
602
+ $hd_counter++;
603
+ }
604
+
605
+ $this->end_controls_section();
606
+ }
607
+ }
608
 
609
+ protected function register_content_upgrade_pro_controls() {
610
  if ( ! is_pp_elements_active() ) {
611
  $this->start_controls_section(
612
  'section_upgrade_powerpack',
628
 
629
  $this->end_controls_section();
630
  }
631
+ }
632
 
633
+ /*-----------------------------------------------------------------------------------*/
634
+ /* STYLE TAB
635
+ /*-----------------------------------------------------------------------------------*/
 
 
636
 
637
+ protected function register_style_front_controls() {
638
  /**
639
  * Style Tab: Front
640
  */
641
  $this->start_controls_section(
642
  'section_front_style',
643
+ [
644
+ 'label' => esc_html__( 'Front', 'powerpack' ),
645
+ 'tab' => Controls_Manager::TAB_STYLE,
646
+ ]
647
  );
648
 
649
  $this->add_responsive_control(
650
  'padding_front',
651
+ [
652
+ 'label' => esc_html__( 'Padding', 'powerpack' ),
653
+ 'type' => Controls_Manager::DIMENSIONS,
654
+ 'size_units' => [ 'px', 'em', '%' ],
655
+ 'selectors' => [
656
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
657
+ ],
658
+ ]
659
  );
660
 
661
  $this->add_responsive_control(
662
  'content_alignment_front',
663
+ [
664
+ 'label' => esc_html__( 'Alignment', 'powerpack' ),
665
+ 'type' => Controls_Manager::CHOOSE,
666
+ 'label_block' => false,
667
+ 'options' => [
668
+ 'left' => [
669
+ 'title' => esc_html__( 'Left', 'powerpack' ),
670
+ 'icon' => 'fa fa-align-left',
671
+ ],
672
+ 'center' => [
673
+ 'title' => esc_html__( 'Center', 'powerpack' ),
674
+ 'icon' => 'fa fa-align-center',
675
+ ],
676
+ 'right' => [
677
+ 'title' => esc_html__( 'Right', 'powerpack' ),
678
+ 'icon' => 'fa fa-align-right',
679
+ ],
680
+ ],
681
+ 'default' => 'center',
682
+ 'selectors' => [
683
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'text-align: {{VALUE}};',
684
+ ],
685
+ ]
686
  );
687
 
688
  $this->add_responsive_control(
689
  'vertical_position_front',
690
+ [
691
+ 'label' => __( 'Vertical Position', 'powerpack' ),
692
+ 'type' => Controls_Manager::CHOOSE,
693
+ 'label_block' => false,
694
+ 'options' => [
695
+ 'top' => [
696
  'title' => __( 'Top', 'powerpack' ),
697
+ 'icon' => 'eicon-v-align-top',
698
+ ],
699
+ 'middle' => [
700
  'title' => __( 'Middle', 'powerpack' ),
701
+ 'icon' => 'eicon-v-align-middle',
702
+ ],
703
+ 'bottom' => [
704
  'title' => __( 'Bottom', 'powerpack' ),
705
+ 'icon' => 'eicon-v-align-bottom',
706
+ ],
707
+ ],
708
+ 'selectors_dictionary' => [
709
+ 'top' => 'flex-start',
710
  'middle' => 'center',
711
  'bottom' => 'flex-end',
712
+ ],
713
+ 'selectors' => [
714
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay' => 'justify-content: {{VALUE}}',
715
+ ],
716
+ ]
717
  );
718
 
719
  $this->add_group_control(
720
  Group_Control_Background::get_type(),
721
+ [
722
+ 'name' => 'background_front',
723
+ 'types' => [ 'classic', 'gradient' ],
724
+ 'selector' => '{{WRAPPER}} .pp-flipbox-front',
725
+ 'separator' => 'before',
726
+ ]
727
  );
728
 
729
  $this->add_group_control(
730
  Group_Control_Border::get_type(),
731
+ [
732
+ 'name' => 'border_front',
733
+ 'label' => esc_html__( 'Border Style', 'powerpack' ),
734
+ 'selector' => '{{WRAPPER}} .pp-flipbox-front',
735
+ 'separator' => 'before',
736
+ ]
737
  );
738
 
739
  $this->add_control(
740
  'overlay_front',
741
+ [
742
+ 'label' => esc_html__( 'Overlay', 'powerpack' ),
743
+ 'type' => Controls_Manager::HEADING,
744
+ 'separator' => 'before',
745
+ ]
746
  );
747
 
748
  $this->add_group_control(
749
  Group_Control_Background::get_type(),
750
+ [
751
+ 'name' => 'overlay_front',
752
+ 'types' => [ 'classic', 'gradient' ],
753
+ 'exclude' => [ 'image' ],
754
+ 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-overlay',
755
+ ]
756
  );
757
 
758
  $this->add_control(
759
  'image_style_heading_front',
760
+ [
761
+ 'label' => esc_html__( 'Image', 'powerpack' ),
762
+ 'type' => Controls_Manager::HEADING,
763
+ 'separator' => 'before',
764
+ 'condition' => [
765
  'icon_type' => 'image',
766
+ ],
767
+ ]
768
  );
769
 
770
  $this->add_responsive_control(
771
  'image_spacing_front',
772
+ [
773
+ 'label' => __( 'Spacing', 'powerpack' ),
774
+ 'type' => Controls_Manager::SLIDER,
775
+ 'range' => [
776
+ 'px' => [
777
  'min' => 0,
778
  'max' => 100,
779
+ ],
780
+ ],
781
+ 'selectors' => [
782
  '{{WRAPPER}} .pp-flipbox-icon-image' => 'margin-bottom: {{SIZE}}{{UNIT}};',
783
+ ],
784
+ 'condition' => [
785
  'icon_type' => 'image',
786
+ ],
787
+ ]
788
  );
789
 
790
  $this->add_responsive_control(
791
  'image_size_front',
792
+ [
793
+ 'label' => esc_html__( 'Size (%)', 'powerpack' ),
794
+ 'type' => Controls_Manager::SLIDER,
795
+ 'default' => [
796
  'size' => '',
797
+ ],
798
+ 'selectors' => [
799
  '{{WRAPPER}} .pp-flipbox-icon-image > img' => 'width: {{SIZE}}%;',
800
+ ],
801
+ 'condition' => [
802
  'icon_type' => 'image',
803
+ ],
804
+ ]
805
  );
806
 
807
  $this->add_control(
808
  'icon_style_heading_front',
809
+ [
810
+ 'label' => esc_html__( 'Icon', 'powerpack' ),
811
+ 'type' => Controls_Manager::HEADING,
812
+ 'separator' => 'before',
813
+ 'condition' => [
814
+ 'icon_type' => [ 'icon', 'text' ],
815
+ ],
816
+ ]
817
  );
818
 
819
  $this->add_control(
820
  'icon_color_front',
821
+ [
822
+ 'label' => esc_html__( 'Color', 'powerpack' ),
823
+ 'type' => Controls_Manager::COLOR,
824
+ 'default' => '#ffffff',
825
+ 'selectors' => [
826
+ '{{WRAPPER}} .pp-flipbox-icon-image, {{WRAPPER}} .pp-flipbox-icon-image i' => 'color: {{VALUE}};',
827
  '{{WRAPPER}} .pp-flipbox-icon-image svg' => 'fill: {{VALUE}};',
828
+ ],
829
+ 'condition' => [
830
+ 'icon_type' => [ 'icon', 'text' ],
831
+ ],
832
+ ]
833
  );
834
 
835
  $this->add_responsive_control(
836
  'icon_size_front',
837
+ [
838
+ 'label' => __( 'Icon Size', 'powerpack' ),
839
+ 'type' => Controls_Manager::SLIDER,
840
+ 'default' => [
841
  'size' => 40,
842
  'unit' => 'px',
843
+ ],
844
+ 'range' => [
845
+ 'px' => [
846
  'min' => 6,
847
  'max' => 300,
848
+ ],
849
+ ],
850
+ 'selectors' => [
851
  '{{WRAPPER}} .pp-flipbox-icon-image, {{WRAPPER}} .pp-flipbox-icon-image i' => 'font-size: {{SIZE}}{{UNIT}};',
852
+ ],
853
+ 'condition' => [
854
  'icon_type' => 'icon',
855
+ ],
856
+ ]
857
+ );
858
+
859
+ $this->add_group_control(
860
+ Group_Control_Typography::get_type(),
861
+ array(
862
+ 'name' => 'icon_typography_front',
863
+ 'label' => __( 'Typography', 'powerpack' ),
864
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4,
865
+ 'selector' => '{{WRAPPER}} .pp-flipbox-icon-image .pp-icon-text',
866
+ 'condition' => array(
867
+ 'icon_type' => 'text',
868
  ),
869
  )
870
  );
871
 
872
  $this->add_responsive_control(
873
  'icon_spacing_front',
874
+ [
875
+ 'label' => __( 'Spacing', 'powerpack' ),
876
+ 'type' => Controls_Manager::SLIDER,
877
+ 'range' => [
878
+ 'px' => [
879
  'min' => 0,
880
  'max' => 100,
881
+ ],
882
+ ],
883
+ 'selectors' => [
884
  '{{WRAPPER}} .pp-flipbox-icon-image' => 'margin-bottom: {{SIZE}}{{UNIT}};',
885
+ ],
886
+ 'condition' => [
887
+ 'icon_type' => [ 'icon', 'text' ],
888
+ ],
889
+ ]
890
  );
891
 
892
  $this->add_control(
893
  'title_heading_front',
894
+ [
895
+ 'label' => esc_html__( 'Title', 'powerpack' ),
896
+ 'type' => Controls_Manager::HEADING,
897
+ 'separator' => 'before',
898
+ ]
899
  );
900
 
901
  $this->add_control(
902
  'title_color_front',
903
+ [
904
+ 'label' => esc_html__( 'Color', 'powerpack' ),
905
+ 'type' => Controls_Manager::COLOR,
906
+ 'default' => '#fff',
907
+ 'selectors' => [
908
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-heading' => 'color: {{VALUE}};',
909
+ ],
910
+ ]
911
  );
912
 
913
  $this->add_group_control(
914
  Group_Control_Typography::get_type(),
915
+ [
916
+ 'name' => 'title_typography_front',
917
+ 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-heading',
918
+ ]
919
  );
920
 
921
  $this->add_control(
922
  'description_heading_front',
923
+ [
924
+ 'label' => esc_html__( 'Description', 'powerpack' ),
925
+ 'type' => Controls_Manager::HEADING,
926
+ 'separator' => 'before',
927
+ ]
928
  );
929
 
930
  $this->add_control(
931
  'description_color_front',
932
+ [
933
+ 'label' => esc_html__( 'Color', 'powerpack' ),
934
+ 'type' => Controls_Manager::COLOR,
935
+ 'default' => '#fff',
936
+ 'selectors' => [
937
  '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-content' => 'color: {{VALUE}};',
938
+ ],
939
+ ]
940
  );
941
 
942
  $this->add_group_control(
943
  Group_Control_Typography::get_type(),
944
+ [
945
+ 'name' => 'description_typography_front',
946
+ 'selector' => '{{WRAPPER}} .pp-flipbox-front .pp-flipbox-content',
947
+ ]
948
  );
949
 
950
  $this->end_controls_section();
951
+ }
952
 
953
+ protected function register_style_back_controls() {
954
  /**
955
  * Style Tab: Back
956
  */
957
  $this->start_controls_section(
958
  'section_back_style',
959
+ [
960
+ 'label' => esc_html__( 'Back', 'powerpack' ),
961
+ 'tab' => Controls_Manager::TAB_STYLE,
962
+ ]
963
  );
964
 
965
  $this->add_responsive_control(
966
  'padding_back',
967
+ [
968
+ 'label' => esc_html__( 'Padding', 'powerpack' ),
969
+ 'type' => Controls_Manager::DIMENSIONS,
970
+ 'size_units' => [ 'px', 'em', '%' ],
971
+ 'selectors' => [
972
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
973
+ ],
974
+ ]
975
  );
976
 
977
  $this->add_responsive_control(
978
  'content_alignment_back',
979
+ [
980
+ 'label' => esc_html__( 'Alignment', 'powerpack' ),
981
+ 'type' => Controls_Manager::CHOOSE,
982
+ 'label_block' => false,
983
+ 'options' => [
984
+ 'left' => [
985
+ 'title' => esc_html__( 'Left', 'powerpack' ),
986
+ 'icon' => 'fa fa-align-left',
987
+ ],
988
+ 'center' => [
989
+ 'title' => esc_html__( 'Center', 'powerpack' ),
990
+ 'icon' => 'fa fa-align-center',
991
+ ],
992
+ 'right' => [
993
+ 'title' => esc_html__( 'Right', 'powerpack' ),
994
+ 'icon' => 'fa fa-align-right',
995
+ ],
996
+ ],
997
+ 'default' => 'center',
998
+ 'selectors' => [
999
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'text-align: {{VALUE}};',
1000
+ ],
1001
+ ]
1002
  );
1003
 
1004
  $this->add_responsive_control(
1005
  'vertical_position_back',
1006
+ [
1007
+ 'label' => __( 'Vertical Position', 'powerpack' ),
1008
+ 'type' => Controls_Manager::CHOOSE,
1009
+ 'label_block' => false,
1010
+ 'options' => [
1011
+ 'top' => [
1012
  'title' => __( 'Top', 'powerpack' ),
1013
+ 'icon' => 'eicon-v-align-top',
1014
+ ],
1015
+ 'middle' => [
1016
  'title' => __( 'Middle', 'powerpack' ),
1017
+ 'icon' => 'eicon-v-align-middle',
1018
+ ],
1019
+ 'bottom' => [
1020
  'title' => __( 'Bottom', 'powerpack' ),
1021
+ 'icon' => 'eicon-v-align-bottom',
1022
+ ],
1023
+ ],
1024
+ 'selectors_dictionary' => [
1025
+ 'top' => 'flex-start',
1026
  'middle' => 'center',
1027
  'bottom' => 'flex-end',
1028
+ ],
1029
+ 'selectors' => [
1030
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay' => 'justify-content: {{VALUE}}',
1031
+ ],
1032
+ ]
1033
  );
1034
 
1035
  $this->add_group_control(
1036
  Group_Control_Background::get_type(),
1037
+ [
1038
+ 'name' => 'background_back',
1039
+ 'types' => [ 'classic', 'gradient' ],
1040
+ 'selector' => '{{WRAPPER}} .pp-flipbox-back',
1041
+ 'separator' => 'before',
1042
+ ]
1043
  );
1044
 
1045
  $this->add_group_control(
1046
  Group_Control_Border::get_type(),
1047
+ [
1048
+ 'name' => 'border_back',
1049
+ 'label' => esc_html__( 'Border Style', 'powerpack' ),
1050
+ 'selector' => '{{WRAPPER}} .pp-flipbox-back',
1051
+ 'separator' => 'before',
1052
+ ]
1053
  );
1054
 
1055
  $this->add_control(
1056
  'overlay_back',
1057
+ [
1058
+ 'label' => esc_html__( 'Overlay', 'powerpack' ),
1059
+ 'type' => Controls_Manager::HEADING,
1060
+ 'separator' => 'before',
1061
+ ]
1062
  );
1063
 
1064
  $this->add_group_control(
1065
  Group_Control_Background::get_type(),
1066
+ [
1067
+ 'name' => 'overlay_back',
1068
+ 'types' => [ 'classic', 'gradient' ],
1069
+ 'exclude' => [ 'image' ],
1070
+ 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-overlay',
1071
+ ]
1072
  );
1073
 
1074
  $this->add_control(
1075
  'image_style_heading_back',
1076
+ [
1077
+ 'label' => esc_html__( 'Image', 'powerpack' ),
1078
+ 'type' => Controls_Manager::HEADING,
1079
+ 'separator' => 'before',
1080
+ 'condition' => [
1081
+ 'icon_type_back' => 'image',
1082
+ ],
1083
+ ]
1084
  );
1085
 
1086
  $this->add_responsive_control(
1087
  'image_spacing_back',
1088
+ [
1089
+ 'label' => __( 'Spacing', 'powerpack' ),
1090
+ 'type' => Controls_Manager::SLIDER,
1091
+ 'range' => [
1092
+ 'px' => [
1093
  'min' => 0,
1094
  'max' => 100,
1095
+ ],
1096
+ ],
1097
+ 'selectors' => [
1098
  '{{WRAPPER}} .pp-flipbox-icon-image-back' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1099
+ ],
1100
+ 'condition' => [
1101
+ 'icon_type_back' => 'image',
1102
+ ],
1103
+ ]
1104
  );
1105
 
1106
  $this->add_responsive_control(
1107
  'image_size_back',
1108
+ [
1109
+ 'label' => esc_html__( 'Size (%)', 'powerpack' ),
1110
+ 'type' => Controls_Manager::SLIDER,
1111
+ 'default' => [
1112
  'size' => '',
1113
+ ],
1114
+ 'selectors' => [
1115
  '{{WRAPPER}} .pp-flipbox-icon-image-back > img' => 'width: {{SIZE}}%;',
1116
+ ],
1117
+ 'condition' => [
1118
+ 'icon_type_back' => 'image',
1119
+ ],
1120
+ ]
1121
  );
1122
 
1123
  $this->add_control(
1124
  'icon_style_heading_back',
1125
+ [
1126
+ 'label' => esc_html__( 'Icon', 'powerpack' ),
1127
+ 'type' => Controls_Manager::HEADING,
1128
+ 'separator' => 'before',
1129
+ 'condition' => [
1130
+ 'icon_type_back' => [ 'icon', 'text' ],
1131
+ ],
1132
+ ]
1133
  );
1134
 
1135
  $this->add_control(
1136
  'icon_color_back',
1137
+ [
1138
+ 'label' => esc_html__( 'Color', 'powerpack' ),
1139
+ 'type' => Controls_Manager::COLOR,
1140
+ 'default' => '#ffffff',
1141
+ 'selectors' => [
1142
+ '{{WRAPPER}} .pp-flipbox-icon-image-back, {{WRAPPER}} .pp-flipbox-icon-image-back i' => 'color: {{VALUE}};',
1143
  '{{WRAPPER}} .pp-flipbox-icon-image-back svg' => 'fill: {{VALUE}};',
1144
+ ],
1145
+ 'condition' => [
1146
+ 'icon_type_back' => [ 'icon', 'text' ],
1147
+ ],
1148
+ ]
1149
  );
1150
 
1151
  $this->add_responsive_control(
1152
  'icon_size_back',
1153
+ [
1154
+ 'label' => __( 'Icon Size', 'powerpack' ),
1155
+ 'type' => Controls_Manager::SLIDER,
1156
+ 'default' => [
1157
  'size' => 40,
1158
  'unit' => 'px',
1159
+ ],
1160
+ 'range' => [
1161
+ 'px' => [
1162
  'min' => 6,
1163
  'max' => 300,
1164
+ ],
1165
+ ],
1166
+ 'selectors' => [
1167
  '{{WRAPPER}} .pp-flipbox-icon-image-back, {{WRAPPER}} .pp-flipbox-icon-image-back i' => 'font-size: {{SIZE}}{{UNIT}};',
1168
+ ],
1169
+ 'condition' => [
1170
+ 'icon_type_back' => 'icon',
1171
+ ],
1172
+ ]
1173
+ );
1174
+
1175
+ $this->add_group_control(
1176
+ Group_Control_Typography::get_type(),
1177
+ array(
1178
+ 'name' => 'icon_typography_back',
1179
+ 'label' => __( 'Typography', 'powerpack' ),
1180
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4,
1181
+ 'selector' => '{{WRAPPER}} .pp-flipbox-icon-image-back .pp-icon-text',
1182
  'condition' => array(
1183
+ 'icon_type' => 'text',
1184
  ),
1185
  )
1186
  );
1187
 
1188
  $this->add_responsive_control(
1189
  'icon_spacing_back',
1190
+ [
1191
+ 'label' => __( 'Spacing', 'powerpack' ),
1192
+ 'type' => Controls_Manager::SLIDER,
1193
+ 'range' => [
1194
+ 'px' => [
1195
  'min' => 0,
1196
  'max' => 100,
1197
+ ],
1198
+ ],
1199
+ 'selectors' => [
1200
  '{{WRAPPER}} .pp-flipbox-icon-image-back' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1201
+ ],
1202
+ 'condition' => [
1203
+ 'icon_type_back' => [ 'icon', 'text' ],
1204
+ ],
1205
+ ]
1206
  );
1207
 
1208
  $this->add_control(
1209
  'title_heading_back',
1210
+ [
1211
+ 'label' => esc_html__( 'Title', 'powerpack' ),
1212
+ 'type' => Controls_Manager::HEADING,
1213
+ 'separator' => 'before',
1214
+ ]
1215
  );
1216
 
1217
  $this->add_control(
1218
  'title_color_back',
1219
+ [
1220
+ 'label' => esc_html__( 'Color', 'powerpack' ),
1221
+ 'type' => Controls_Manager::COLOR,
1222
+ 'default' => '#fff',
1223
+ 'selectors' => [
1224
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-heading' => 'color: {{VALUE}};',
1225
+ ],
1226
+ ]
1227
  );
1228
 
1229
  $this->add_group_control(
1230
  Group_Control_Typography::get_type(),
1231
+ [
1232
+ 'name' => 'title_typography_back',
1233
+ 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-heading',
1234
+ ]
1235
  );
1236
 
1237
  $this->add_control(
1238
  'description_heading_back',
1239
+ [
1240
+ 'label' => esc_html__( 'Description', 'powerpack' ),
1241
+ 'type' => Controls_Manager::HEADING,
1242
+ 'separator' => 'before',
1243
+ ]
1244
  );
1245
 
1246
  $this->add_control(
1247
  'description_color_back',
1248
+ [
1249
+ 'label' => esc_html__( 'Color', 'powerpack' ),
1250
+ 'type' => Controls_Manager::COLOR,
1251
+ 'default' => '',
1252
+ 'selectors' => [
1253
  '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-content' => 'color: {{VALUE}};',
1254
+ ],
1255
+ ]
1256
  );
1257
 
1258
  $this->add_group_control(
1259
  Group_Control_Typography::get_type(),
1260
+ [
1261
+ 'name' => 'description_typography_back',
1262
+ 'selector' => '{{WRAPPER}} .pp-flipbox-back .pp-flipbox-content',
1263
+ ]
1264
  );
1265
 
1266
  $this->end_controls_section();
1267
+ }
1268
 
1269
+ protected function register_style_button_controls() {
1270
  /**
1271
  * Style Tab: Button
1272
+ * ------------------
1273
  */
1274
  $this->start_controls_section(
1275
  'section_info_box_button_style',
1276
+ [
1277
+ 'label' => __( 'Button', 'powerpack' ),
1278
+ 'tab' => Controls_Manager::TAB_STYLE,
1279
+ 'condition' => [
1280
+ 'link_type' => 'button',
1281
+ ],
1282
+ ]
1283
  );
1284
 
1285
  $this->add_control(
1286
  'button_size',
1287
+ [
1288
+ 'label' => __( 'Size', 'powerpack' ),
1289
+ 'type' => Controls_Manager::SELECT,
1290
+ 'default' => 'md',
1291
+ 'options' => [
1292
  'xs' => __( 'Extra Small', 'powerpack' ),
1293
  'sm' => __( 'Small', 'powerpack' ),
1294
  'md' => __( 'Medium', 'powerpack' ),
1295
  'lg' => __( 'Large', 'powerpack' ),
1296
  'xl' => __( 'Extra Large', 'powerpack' ),
1297
+ ],
1298
+ 'condition' => [
1299
+ 'link_type' => 'button',
1300
+ ],
1301
+ ]
1302
  );
1303
 
1304
  $this->add_responsive_control(
1305
  'button_spacing',
1306
+ [
1307
+ 'label' => __( 'Spacing', 'powerpack' ),
1308
+ 'type' => Controls_Manager::SLIDER,
1309
+ 'default' => [
1310
  'size' => 15,
1311
+ ],
1312
+ 'range' => [
1313
+ 'px' => [
1314
  'min' => 0,
1315
  'max' => 100,
1316
+ ],
1317
+ ],
1318
+ 'selectors' => [
1319
  '{{WRAPPER}} .pp-flipbox-button' => 'margin-top: {{SIZE}}{{UNIT}};',
1320
+ ],
1321
+ 'condition' => [
1322
+ 'link_type' => 'button',
1323
+ ],
1324
+ ]
1325
  );
1326
 
1327
  $this->start_controls_tabs( 'tabs_button_style' );
1328
 
1329
  $this->start_controls_tab(
1330
  'tab_button_normal',
1331
+ [
1332
+ 'label' => __( 'Normal', 'powerpack' ),
1333
+ 'condition' => [
1334
+ 'link_type' => 'button',
1335
+ ],
1336
+ ]
1337
  );
1338
 
1339
  $this->add_control(
1340
  'button_bg_color_normal',
1341
+ [
1342
+ 'label' => __( 'Background Color', 'powerpack' ),
1343
+ 'type' => Controls_Manager::COLOR,
1344
+ 'default' => '',
1345
+ 'selectors' => [
1346
  '{{WRAPPER}} .pp-flipbox-button' => 'background-color: {{VALUE}}',
1347
+ ],
1348
+ 'condition' => [
1349
+ 'link_type' => 'button',
1350
+ ],
1351
+ ]
1352
  );
1353
 
1354
  $this->add_control(
1355
  'button_text_color_normal',
1356
+ [
1357
+ 'label' => __( 'Text Color', 'powerpack' ),
1358
+ 'type' => Controls_Manager::COLOR,
1359
+ 'default' => '',
1360
+ 'selectors' => [
1361
  '{{WRAPPER}} .pp-flipbox-button' => 'color: {{VALUE}}',
1362
  '{{WRAPPER}} .pp-flipbox-button .pp-button-icon svg' => 'fill: {{VALUE}}',
1363
+ ],
1364
+ 'condition' => [
1365
+ 'link_type' => 'button',
1366
+ ],
1367
+ ]
1368
  );
1369
 
1370
  $this->add_group_control(
1371
  Group_Control_Border::get_type(),
1372
+ [
1373
+ 'name' => 'button_border_normal',
1374
+ 'label' => __( 'Border', 'powerpack' ),
1375
+ 'placeholder' => '1px',
1376
+ 'default' => '1px',
1377
+ 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1378
+ 'condition' => [
1379
+ 'link_type' => 'button',
1380
+ ],
1381
+ ]
1382
  );
1383
 
1384
  $this->add_control(
1385
  'button_border_radius',
1386
+ [
1387
+ 'label' => __( 'Border Radius', 'powerpack' ),
1388
+ 'type' => Controls_Manager::DIMENSIONS,
1389
+ 'size_units' => [ 'px', '%' ],
1390
+ 'selectors' => [
1391
  '{{WRAPPER}} .pp-flipbox-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1392
+ ],
1393
+ 'condition' => [
1394
+ 'link_type' => 'button',
1395
+ ],
1396
+ ]
1397
  );
1398
 
1399
  $this->add_group_control(
1400
  Group_Control_Typography::get_type(),
1401
+ [
1402
+ 'name' => 'button_typography',
1403
+ 'label' => __( 'Typography', 'powerpack' ),
1404
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4,
1405
+ 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1406
+ 'condition' => [
1407
+ 'link_type' => 'button',
1408
+ ],
1409
+ ]
1410
  );
1411
 
1412
  $this->add_responsive_control(
1413
  'button_padding',
1414
+ [
1415
+ 'label' => __( 'Padding', 'powerpack' ),
1416
+ 'type' => Controls_Manager::DIMENSIONS,
1417
+ 'size_units' => [ 'px', 'em', '%' ],
1418
+ 'selectors' => [
1419
  '{{WRAPPER}} .pp-flipbox-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1420
+ ],
1421
+ 'condition' => [
1422
+ 'link_type' => 'button',
1423
+ ],
1424
+ ]
1425
  );
1426
 
1427
  $this->add_group_control(
1428
  Group_Control_Box_Shadow::get_type(),
1429
+ [
1430
+ 'name' => 'button_box_shadow',
1431
+ 'selector' => '{{WRAPPER}} .pp-flipbox-button',
1432
+ 'condition' => [
1433
+ 'link_type' => 'button',
1434
+ ],
1435
+ ]
1436
  );
1437
 
1438
  $this->add_control(
1439
  'info_box_button_icon_heading',
1440
+ [
1441
+ 'label' => __( 'Button Icon', 'powerpack' ),
1442
+ 'type' => Controls_Manager::HEADING,
1443
+ 'separator' => 'before',
1444
+ 'condition' => [
1445
+ 'link_type' => 'button',
1446
  'select_button_icon[value]!' => '',
1447
+ ],
1448
+ ]
1449
  );
1450
 
1451
  $this->add_responsive_control(
1452
  'button_icon_margin',
1453
+ [
1454
+ 'label' => __( 'Margin', 'powerpack' ),
1455
+ 'type' => Controls_Manager::DIMENSIONS,
1456
+ 'size_units' => [ 'px', '%' ],
1457
+ 'placeholder' => [
1458
+ 'top' => '',
1459
+ 'right' => '',
1460
+ 'bottom' => '',
1461
+ 'left' => '',
1462
+ ],
1463
+ 'condition' => [
1464
+ 'link_type' => 'button',
1465
  'select_button_icon[value]!' => '',
1466
+ ],
1467
+ 'selectors' => [
1468
  '{{WRAPPER}} .pp-info-box .pp-button-icon' => 'margin-top: {{TOP}}{{UNIT}}; margin-left: {{LEFT}}{{UNIT}}; margin-right: {{RIGHT}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};',
1469
+ ],
1470
+ ]
1471
  );
1472
 
1473
  $this->end_controls_tab();
1474
 
1475
  $this->start_controls_tab(
1476
  'tab_button_hover',
1477
+ [
1478
+ 'label' => __( 'Hover', 'powerpack' ),
1479
+ 'condition' => [
1480
+ 'link_type' => 'button',
1481
+ ],
1482
+ ]
1483
  );
1484
 
1485
  $this->add_control(
1486
  'button_bg_color_hover',
1487
+ [
1488
+ 'label' => __( 'Background Color', 'powerpack' ),
1489
+ 'type' => Controls_Manager::COLOR,
1490
+ 'default' => '',
1491
+ 'selectors' => [
1492
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'background-color: {{VALUE}}',
1493
+ ],
1494
+ 'condition' => [
1495
+ 'link_type' => 'button',
1496
+ ],
1497
+ ]
1498
  );
1499
 
1500
  $this->add_control(
1501
  'button_text_color_hover',
1502
+ [
1503
+ 'label' => __( 'Text Color', 'powerpack' ),
1504
+ 'type' => Controls_Manager::COLOR,
1505
+ 'default' => '',
1506
+ 'selectors' => [
1507
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'color: {{VALUE}}',
1508
+ ],
1509
+ 'condition' => [
1510
+ 'link_type' => 'button',
1511
+ ],
1512
+ ]
1513
  );
1514
 
1515
  $this->add_control(
1516
  'button_border_color_hover',
1517
+ [
1518
+ 'label' => __( 'Border Color', 'powerpack' ),
1519
+ 'type' => Controls_Manager::COLOR,
1520
+ 'default' => '',
1521
+ 'selectors' => [
1522
  '{{WRAPPER}} .pp-flipbox-button:hover' => 'border-color: {{VALUE}}',
1523
+ ],
1524
+ 'condition' => [
1525
+ 'link_type' => 'button',
1526
+ ],
1527
+ ]
1528
  );
1529
 
1530
  $this->add_control(
1531
  'button_animation',
1532
+ [
1533
+ 'label' => __( 'Animation', 'powerpack' ),
1534
+ 'type' => Controls_Manager::HOVER_ANIMATION,
1535
+ 'condition' => [
1536
+ 'link_type' => 'button',
1537
+ ],
1538
+ ]
1539
  );
1540
 
1541
  $this->add_group_control(
1542
  Group_Control_Box_Shadow::get_type(),
1543
+ [
1544
+ 'name' => 'button_box_shadow_hover',
1545
+ 'selector' => '{{WRAPPER}} .pp-flipbox-button:hover',
1546
+ 'condition' => [
1547
+ 'link_type' => 'button',
1548
+ ],
1549
+ ]
1550
  );
1551
 
1552
  $this->end_controls_tab();
1553
  $this->end_controls_tabs();
1554
 
1555
  $this->end_controls_section();
 
1556
  }
1557
 
1558
  protected function render() {
1564
 
1565
  $this->add_render_attribute(
1566
  'flipbox-container',
1567
+ [
1568
+ 'class' => [
1569
  'pp-flipbox-container',
1570
  'pp-animate-' . esc_attr( $settings['flip_effect'] ),
1571
  'pp-direction-' . esc_attr( $settings['flip_direction'] ),
1572
+ ],
1573
+ ]
1574
  );
 
1575
  ?>
1576
+ <div <?php echo $this->get_render_attribute_string( 'flipbox-container' ); ?>>
1577
+ <div <?php echo $this->get_render_attribute_string( 'flipbox-card' ); ?>>
1578
+ <?php
1579
+ // Front
1580
+ $this->render_front();
1581
 
1582
+ // Back
1583
+ $this->render_back();
1584
+ ?>
1585
+ </div>
 
 
 
 
 
 
 
 
1586
  </div>
 
1587
  <?php
1588
  }
1589
 
1612
  $has_icon = true;
1613
  }
1614
  $migrated = isset( $settings['__fa4_migrated']['select_icon'] );
1615
+ $is_new = ! isset( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
1616
  ?>
1617
  <div class="pp-flipbox-front">
1618
  <div class="pp-flipbox-overlay">
1621
  <?php if ( 'icon' === $settings['icon_type'] && $has_icon ) { ?>
1622
  <?php
1623
  if ( $is_new || $migrated ) {
1624
+ Icons_Manager::render_icon( $settings['select_icon'], [ 'aria-hidden' => 'true' ] );
1625
  } elseif ( ! empty( $settings['icon'] ) ) {
1626
+ ?><i <?php echo $this->get_render_attribute_string( 'front-i' ); ?>></i><?php
 
 
1627
  }
1628
  ?>
1629
  <?php } elseif ( 'image' === $settings['icon_type'] ) { ?>
1630
  <?php
1631
+ $flipbox_image = $settings['icon_image'];
1632
  $flipbox_image_url = Group_Control_Image_Size::get_attachment_image_src( $flipbox_image['id'], 'thumbnail', $settings );
1633
  $flipbox_image_url = ( empty( $flipbox_image_url ) ) ? $flipbox_image['url'] : $flipbox_image_url;
1634
  ?>
1635
  <?php if ( $flipbox_image_url ) { ?>
1636
  <img src="<?php echo esc_url( $flipbox_image_url ); ?>" alt="">
1637
  <?php } ?>
1638
+ <?php } elseif ( 'text' === $settings['icon_type'] ) { ?>
1639
+ <span class="pp-icon-text">
1640
+ <?php echo wp_kses_post( $settings['icon_text'] ); ?>
1641
+ </span>
1642
  <?php } ?>
1643
  </div>
1644
 
1645
+ <<?php echo $settings['title_html_tag_front']; ?> class="pp-flipbox-heading">
1646
+ <?php echo wp_kses_post( $settings['title_front'], 'powerpack' ); ?>
1647
+ </<?php echo $settings['title_html_tag_front']; ?>>
1648
 
1649
  <div class="pp-flipbox-content">
1650
+ <?php echo wp_kses_post( $settings['description_front'], 'powerpack' ); ?>
1651
  </div>
1652
  </div>
1653
  </div>
1658
  protected function render_back() {
1659
  $settings = $this->get_settings_for_display();
1660
 
1661
+ $pp_title_html_tag = $settings['title_html_tag_back'];
1662
 
1663
  $this->add_render_attribute( 'title-container', 'class', 'pp-flipbox-heading' );
1664
 
1665
+ $flipbox_image_back = $settings['icon_image_back'];
1666
  $flipbox_back_image_url = Group_Control_Image_Size::get_attachment_image_src( $flipbox_image_back['id'], 'thumbnail_back', $settings );
1667
  $flipbox_back_image_url = ( empty( $flipbox_back_image_url ) ) ? $flipbox_image_back['url'] : $flipbox_back_image_url;
1668
 
1669
+ if ( 'none' !== $settings['icon_type_back'] ) {
1670
 
1671
  $this->add_render_attribute( 'icon-back', 'class', 'pp-flipbox-icon-image-back' );
1672
 
1686
  $has_icon_back = true;
1687
  }
1688
  $migrated_icon_back = isset( $settings['__fa4_migrated']['select_icon_back'] );
1689
+ $is_new_icon_back = ! isset( $settings['icon_back'] ) && Icons_Manager::is_migration_allowed();
1690
 
1691
+ if ( 'image' === $settings['icon_type_back'] ) {
1692
  $this->add_render_attribute(
1693
  'icon-image-back',
1694
+ [
1695
+ 'src' => $flipbox_back_image_url,
1696
+ 'alt' => 'flipbox-image',
1697
+ ]
1698
  );
1699
+ } elseif ( 'icon' === $settings['icon_type_back'] ) {
1700
  $this->add_render_attribute( 'icon-back', 'class', 'pp-icon' );
1701
  }
1702
  }
1703
 
1704
+ if ( 'none' !== $settings['link_type'] ) {
1705
  if ( ! empty( $settings['link']['url'] ) ) {
1706
+ if ( 'title' === $settings['link_type'] ) {
1707
 
1708
  $pp_title_html_tag = 'a';
1709
 
1711
 
1712
  $this->add_link_attributes( 'title-container', $settings['link'] );
1713
 
1714
+ } elseif ( 'button' === $settings['link_type'] ) {
1715
 
1716
+ $this->add_render_attribute( 'button', 'class', [ 'elementor-button', 'pp-flipbox-button', 'elementor-size-' . $settings['button_size'] ] );
1717
 
1718
  $this->add_link_attributes( 'button', $settings['link'] );
1719
 
1723
  ?>
1724
  <div class="pp-flipbox-back">
1725
  <?php
1726
+ if ( 'box' === $settings['link_type'] && $settings['link']['url'] ) {
1727
  $this->add_render_attribute( 'box-link', 'class', 'pp-flipbox-box-link' );
1728
 
1729
  $this->add_link_attributes( 'box-link', $settings['link'] );
1732
  <?php } ?>
1733
  <div class="pp-flipbox-overlay">
1734
  <div class="pp-flipbox-inner">
1735
+ <?php if ( 'none' !== $settings['icon_type_back'] ) { ?>
1736
  <div <?php echo $this->get_render_attribute_string( 'icon-back' ); ?>>
1737
+ <?php if ( 'image' === $settings['icon_type_back'] ) { ?>
1738
  <img <?php echo $this->get_render_attribute_string( 'icon-image-back' ); ?>>
1739
+ <?php } elseif ( 'icon' === $settings['icon_type_back'] && $has_icon_back ) { ?>
1740
  <?php
1741
  if ( $is_new_icon_back || $migrated_icon_back ) {
1742
+ Icons_Manager::render_icon( $settings['select_icon_back'], [ 'aria-hidden' => 'true' ] );
1743
  } elseif ( ! empty( $settings['icon_back'] ) ) {
1744
+ ?><i <?php echo $this->get_render_attribute_string( 'back-i' ); ?>></i><?php
 
 
1745
  }
1746
  ?>
1747
+ <?php } elseif ( 'text' === $settings['icon_type_back'] ) { ?>
1748
+ <span class="pp-icon-text">
1749
+ <?php echo wp_kses_post( $settings['icon_text_back'] ); ?>
1750
+ </span>
1751
  <?php } ?>
1752
  </div>
1753
  <?php } ?>
1754
 
1755
  <?php if ( $settings['title_back'] ) { ?>
1756
  <<?php echo $pp_title_html_tag,' ', $this->get_render_attribute_string( 'title-container' ); ?>>
1757
+ <?php echo wp_kses_post( $settings['title_back'], 'powerpack' ); ?>
1758
  </<?php echo $pp_title_html_tag; ?>>
1759
  <?php } ?>
1760
 
1761
  <div class="pp-flipbox-content">
1762
+ <?php echo wp_kses_post( $settings['description_back'], 'powerpack' ); ?>
1763
  </div>
1764
 
1765
+ <?php if ( 'button' === $settings['link_type'] && ! empty( $settings['flipbox_button_text'] ) ) : ?>
1766
  <a <?php echo $this->get_render_attribute_string( 'button' ); ?>>
1767
+ <?php if ( 'before' === $settings['button_icon_position'] ) : ?>
1768
  <?php $this->render_button_icon(); ?>
1769
  <?php endif; ?>
1770
  <?php echo esc_attr( $settings['flipbox_button_text'] ); ?>
1771
+ <?php if ( 'after' === $settings['button_icon_position'] ) : ?>
1772
  <?php $this->render_button_icon(); ?>
1773
  <?php endif; ?>
1774
  </a>
1790
  $has_button_icon = ! empty( $settings['button_icon'] );
1791
 
1792
  if ( $has_button_icon ) {
1793
+ $this->add_render_attribute( 'button-i', 'class', $settings['button_icon'] );
1794
+ $this->add_render_attribute( 'button-i', 'aria-hidden', 'true' );
1795
  }
1796
 
1797
  if ( ! $has_button_icon && ! empty( $settings['select_button_icon']['value'] ) ) {
1798
  $has_button_icon = true;
1799
  }
 
 
1800
 
1801
+ $migrated_button_icon = isset( $settings['__fa4_migrated']['select_button_icon'] );
1802
+ $is_new_button_icon = ! isset( $settings['button_icon'] ) && Icons_Manager::is_migration_allowed();
 
 
 
 
 
 
 
 
 
1803
 
1804
  if ( $has_button_icon ) {
1805
  echo '<span class="pp-button-icon">';
1806
  if ( $is_new_button_icon || $migrated_button_icon ) {
1807
+ Icons_Manager::render_icon( $settings['select_button_icon'], [ 'aria-hidden' => 'true' ] );
1808
  } elseif ( ! empty( $settings['button_icon'] ) ) {
1809
+ ?><i <?php echo $this->get_render_attribute_string( 'button-i' ); ?>></i><?php
 
 
1810
  }
1811
  echo '</span>';
1812
  }
1813
  }
 
 
1814
  }
modules/team-member/widgets/team-member-carousel.php CHANGED
@@ -752,6 +752,75 @@ class Team_Member_Carousel extends Powerpack_Widget {
752
  )
753
  );
754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  $this->end_controls_section();
756
 
757
  /**
752
  )
753
  );
754
 
755
+ $this->start_controls_tabs( 'tabs_box_style' );
756
+
757
+ $this->start_controls_tab(
758
+ 'tab_box_normal',
759
+ array(
760
+ 'label' => __( 'Normal', 'powerpack' ),
761
+ )
762
+ );
763
+
764
+ $this->add_group_control(
765
+ Group_Control_Border::get_type(),
766
+ array(
767
+ 'name' => 'member_container_border',
768
+ 'label' => __( 'Border', 'powerpack' ),
769
+ 'placeholder' => '1px',
770
+ 'default' => '1px',
771
+ 'selector' => '{{WRAPPER}} .pp-tm',
772
+ )
773
+ );
774
+
775
+ $this->add_control(
776
+ 'member_container_border_radius',
777
+ array(
778
+ 'label' => __( 'Border Radius', 'powerpack' ),
779
+ 'type' => Controls_Manager::DIMENSIONS,
780
+ 'size_units' => array( 'px', '%' ),
781
+ 'selectors' => array(
782
+ '{{WRAPPER}} .pp-tm' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
783
+ ),
784
+ )
785
+ );
786
+
787
+ $this->add_responsive_control(
788
+ 'member_container_padding',
789
+ array(
790
+ 'label' => __( 'Padding', 'powerpack' ),
791
+ 'type' => Controls_Manager::DIMENSIONS,
792
+ 'size_units' => array( 'px', 'em', '%' ),
793
+ 'selectors' => array(
794
+ '{{WRAPPER}} .pp-tm' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
795
+ ),
796
+ )
797
+ );
798
+
799
+ $this->end_controls_tab();
800
+
801
+ $this->start_controls_tab(
802
+ 'tab_box_active',
803
+ array(
804
+ 'label' => __( 'Active', 'powerpack' ),
805
+ )
806
+ );
807
+
808
+ $this->add_control(
809
+ 'member_container_border_color_active',
810
+ array(
811
+ 'label' => __( 'Border Color', 'powerpack' ),
812
+ 'type' => Controls_Manager::COLOR,
813
+ 'default' => '',
814
+ 'selectors' => array(
815
+ '{{WRAPPER}} .swiper-slide-active .pp-tm' => 'border-color: {{VALUE}};',
816
+ ),
817
+ )
818
+ );
819
+
820
+ $this->end_controls_tab();
821
+
822
+ $this->end_controls_tabs();
823
+
824
  $this->end_controls_section();
825
 
826
  /**
powerpack-lite-elementor.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: PowerPack Lite for Elementor
4
  * Plugin URI: https://powerpackelements.com
5
  * Description: Custom addons for Elementor page builder.
6
- * Version: 1.3.0
7
  * Author: IdeaBox Creations
8
  * Author URI: http://ideabox.io/
9
  * License: GNU General Public License v2.0
@@ -14,7 +14,7 @@
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
 
17
- define( 'POWERPACK_ELEMENTS_LITE_VER', '1.3.0' );
18
  define( 'POWERPACK_ELEMENTS_LITE_PATH', plugin_dir_path( __FILE__ ) );
19
  define( 'POWERPACK_ELEMENTS_LITE_BASE', plugin_basename( __FILE__ ) );
20
  define( 'POWERPACK_ELEMENTS_LITE_URL', plugins_url( '/', __FILE__ ) );
@@ -27,6 +27,7 @@ require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-admin-settings.php
27
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-config.php';
28
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-helper.php';
29
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-posts-helper.php';
 
30
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-wpml.php';
31
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'plugin.php';
32
 
3
  * Plugin Name: PowerPack Lite for Elementor
4
  * Plugin URI: https://powerpackelements.com
5
  * Description: Custom addons for Elementor page builder.
6
+ * Version: 2.0.0
7
  * Author: IdeaBox Creations
8
  * Author URI: http://ideabox.io/
9
  * License: GNU General Public License v2.0
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
 
17
+ define( 'POWERPACK_ELEMENTS_LITE_VER', '2.0.0' );
18
  define( 'POWERPACK_ELEMENTS_LITE_PATH', plugin_dir_path( __FILE__ ) );
19
  define( 'POWERPACK_ELEMENTS_LITE_BASE', plugin_basename( __FILE__ ) );
20
  define( 'POWERPACK_ELEMENTS_LITE_URL', plugins_url( '/', __FILE__ ) );
27
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-config.php';
28
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-helper.php';
29
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-posts-helper.php';
30
+ require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-templates-lib.php';
31
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'classes/class-pp-wpml.php';
32
  require_once POWERPACK_ELEMENTS_LITE_PATH . 'plugin.php';
33
 
readme.txt CHANGED
@@ -179,6 +179,12 @@ Not at all! All the widgets and settings are easy to use with drag & drop interf
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
182
  = 1.3.0 - July 20, 2020 =
183
  * Enhancement: Updated admin panel UI
184
  * Added: Advanced Accordion - Toggle icon alignment and few other styling options
179
 
180
  == Changelog ==
181
 
182
+ = 2.0.0 - July 29, 2020 =
183
+ * New: Template Library
184
+ * Added: Team Member Carousel - border, radius and padding options for team member box
185
+ * Added: Flipbox - Icon text option
186
+ * Added: Flipbox - Title HTML tag option
187
+
188
  = 1.3.0 - July 20, 2020 =
189
  * Enhancement: Updated admin panel UI
190
  * Added: Advanced Accordion - Toggle icon alignment and few other styling options