Premium Addons for Elementor - Version 3.6.4

Version Description

  • Tweak: Grid widget code refactored for better performance.
  • Tweak: Added Lightbox Type option in Grid widget to switch between default, Elementor's or any other lightbox plugin.
  • Tweak: Added Shuffle Images After Filter Click option in Grid widget.
  • Tweak: Added Full Section Scroll on Touch Devices option in Grid widget.
Download this release

Release Info

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

Code changes from version 3.6.3 to 3.6.4

admin/includes/version-control.php CHANGED
@@ -91,7 +91,7 @@ class Version_Control {
91
<tr class="pa-roll-row">
92
<th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
<td>
94
- <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.6.2', 'premium-addons-for-elementor') ); ?></div>
95
<p class="pa-roll-desc">
96
<span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
</p>
91
<tr class="pa-roll-row">
92
<th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
<td>
94
+ <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.6.3', 'premium-addons-for-elementor') ); ?></div>
95
<p class="pa-roll-desc">
96
<span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
</p>
assets/frontend/css/premium-addons.css CHANGED
@@ -3251,22 +3251,22 @@ button.premium-modal-box-modal-close {
3251
-o-transition: all 0.3s ease-in-out;
3252
transition: all 0.3s ease-in-out;
3253
}
3254
- .pa-gallery-img .pa-gallery-img-container.gray img {
3255
filter: grayscale(100%);
3256
}
3257
- .pa-gallery-img-container.zoomout img,
3258
- .pa-gallery-img-container.scale img{
3259
transform: scale(1.2);
3260
}
3261
- .pa-gallery-img-container.sepia img{
3262
-webkit-filter: sepia(30%);
3263
filter: sepia(30%);
3264
}
3265
- .pa-gallery-img-container.bright img{
3266
-webkit-filter: brightness(1);
3267
filter: brightness(1);
3268
}
3269
- .pa-gallery-img-container.trans img{
3270
-webkit-transform: translateX(-15px) scale(1.1);
3271
transform: translateX(-15px) scale(1.1);
3272
}
@@ -3315,31 +3315,31 @@ button.premium-modal-box-modal-close {
3315
list-style: none;
3316
display: inline-flex;
3317
}
3318
- .pa-gallery-img:hover .pa-gallery-img-container.zoomin img {
3319
transform: scale(1.1);
3320
}
3321
- .pa-gallery-img:hover .pa-gallery-img-container.zoomout img {
3322
transform: scale(1);
3323
}
3324
- .pa-gallery-img:hover .pa-gallery-img-container.scale img {
3325
transform: scale(1.3) rotate(5deg);
3326
}
3327
- .pa-gallery-img:hover .pa-gallery-img-container.gray img {
3328
filter: grayscale(0%);
3329
}
3330
- .pa-gallery-img:hover .pa-gallery-img-container.blur img {
3331
filter: blur(3px);
3332
}
3333
- .pa-gallery-img:hover .pa-gallery-img-container.sepia img {
3334
-webkit-filter: sepia(0%);
3335
filter: sepia(0%);
3336
}
3337
- .pa-gallery-img:hover .pa-gallery-img-container.trans img {
3338
-webkit-transform: translateX(0px) scale(1.1);
3339
-moz-transform: translateX(0px) scale(1.1);
3340
transform: translateX(0px) scale(1.1);
3341
}
3342
- .pa-gallery-img:hover .pa-gallery-img-container.bright img {
3343
-webkit-filter: brightness(1.2);
3344
filter: brightness(1.2);
3345
}
@@ -3449,10 +3449,6 @@ button.premium-modal-box-modal-close {
3449
.premium-img-gallery-metro .premium-gallery-item {
3450
overflow: hidden
3451
}
3452
- /*.premium-img-gallery-metro .pa-gallery-img-container {
3453
- height: 100%;
3454
- object-fit: fill;
3455
- }*/
3456
.premium-img-gallery-metro .pa-gallery-img,
3457
.premium-img-gallery-metro .pa-gallery-img-container {
3458
height: 100%;
3251
-o-transition: all 0.3s ease-in-out;
3252
transition: all 0.3s ease-in-out;
3253
}
3254
+ .premium-img-gallery.gray img {
3255
filter: grayscale(100%);
3256
}
3257
+ .premium-img-gallery.zoomout img,
3258
+ .premium-img-gallery.scale img{
3259
transform: scale(1.2);
3260
}
3261
+ .premium-img-gallery.sepia img{
3262
-webkit-filter: sepia(30%);
3263
filter: sepia(30%);
3264
}
3265
+ .premium-img-gallery.bright img{
3266
-webkit-filter: brightness(1);
3267
filter: brightness(1);
3268
}
3269
+ .premium-img-gallery.trans img{
3270
-webkit-transform: translateX(-15px) scale(1.1);
3271
transform: translateX(-15px) scale(1.1);
3272
}
3315
list-style: none;
3316
display: inline-flex;
3317
}
3318
+ .premium-img-gallery.zoomin .pa-gallery-img:hover img {
3319
transform: scale(1.1);
3320
}
3321
+ .premium-img-gallery.zoomout .pa-gallery-img:hover img {
3322
transform: scale(1);
3323
}
3324
+ .premium-img-gallery.scale .pa-gallery-img:hover img {
3325
transform: scale(1.3) rotate(5deg);
3326
}
3327
+ .premium-img-gallery.gray .pa-gallery-img:hover img {
3328
filter: grayscale(0%);
3329
}
3330
+ .premium-img-gallery.blur .pa-gallery-img:hover img {
3331
filter: blur(3px);
3332
}
3333
+ .premium-img-gallery.sepia .pa-gallery-img:hover img {
3334
-webkit-filter: sepia(0%);
3335
filter: sepia(0%);
3336
}
3337
+ .premium-img-gallery.trans .pa-gallery-img:hover img {
3338
-webkit-transform: translateX(0px) scale(1.1);
3339
-moz-transform: translateX(0px) scale(1.1);
3340
transform: translateX(0px) scale(1.1);
3341
}
3342
+ .premium-img-gallery.bright .pa-gallery-img:hover img {
3343
-webkit-filter: brightness(1.2);
3344
filter: brightness(1.2);
3345
}
3449
.premium-img-gallery-metro .premium-gallery-item {
3450
overflow: hidden
3451
}
3452
.premium-img-gallery-metro .pa-gallery-img,
3453
.premium-img-gallery-metro .pa-gallery-img-container {
3454
height: 100%;
assets/frontend/js/premium-addons.js CHANGED
@@ -76,18 +76,20 @@
76
minimum = gridSettings["minimum"],
77
imageToShow = gridSettings["click_images"],
78
counter = minimum,
79
- rtlMode = gridSettings["rtl_mode"];
80
81
- if (layout === "metro") {
82
var suffix = "";
83
84
- if ("tablet" === deviceType) {
85
suffix = "_tablet";
86
} else if ("mobile" === deviceType) {
87
suffix = "_mobile";
88
}
89
var gridWidth = galleryElement.width(),
90
cellSize = Math.floor(gridWidth / 12);
91
galleryElement
92
.find(".premium-gallery-item")
93
.each(function (index, item) {
@@ -121,26 +123,27 @@
121
},
122
filter: gridSettings["active_cat"],
123
layoutMode: layout,
124
- originLeft: rtlMode,
125
masonry: {
126
columnWidth: columnWidth
127
}
128
});
129
});
130
131
- if (loadMore) {
132
133
galleryElement
134
.parent()
135
.find(".premium-gallery-load-more div")
136
.addClass("premium-gallery-item-hidden");
137
- if (galleryElement.find(".premium-gallery-item").length > minimum) {
138
galleryElement
139
.parent()
140
.find(".premium-gallery-load-more")
141
.removeClass("premium-gallery-item-hidden");
142
galleryElement
143
- .find(".premium-gallery-item:gt(" + (minimum - 1) + ")")
144
.addClass("premium-gallery-item-hidden");
145
146
function appendItems( imagesToShow ) {
@@ -172,35 +175,33 @@
172
173
}
174
175
- galleryElement
176
- .parent()
177
- .on("click", ".premium-gallery-load-more-btn", function () {
178
-
179
- if ( isFilterClicked ) {
180
- counter = minimum;
181
- isFilterClicked = false;
182
- } else {
183
- counter = counter;
184
- }
185
186
- counter = counter + imageToShow;
187
188
- $.ajax({
189
- url: appendItems( counter ),
190
- beforeSend: function () {
191
- galleryElement
192
- .parent()
193
- .find(".premium-gallery-load-more div")
194
- .removeClass("premium-gallery-item-hidden");
195
- },
196
- success: function () {
197
- galleryElement
198
- .parent()
199
- .find(".premium-gallery-load-more div")
200
- .addClass("premium-gallery-item-hidden");
201
- }
202
- });
203
});
204
}
205
}
206
@@ -221,26 +222,33 @@
221
222
galleryElement.isotope({ filter: filter });
223
224
- if (loadMore)
225
appendItems( minimum );
226
227
return false;
228
});
229
230
- $scope
231
- .find(".premium-img-gallery a[data-rel^='prettyPhoto']")
232
- .prettyPhoto({
233
- theme: gridSettings["theme"],
234
- hook: "data-rel",
235
- opacity: 0.7,
236
- show_title: false,
237
- deeplinking: false,
238
- overlay_gallery: gridSettings["overlay_gallery"],
239
- custom_markup: "",
240
- default_width: 900,
241
- default_height: 506,
242
- social_tools: ""
243
});
244
};
245
246
/****** Premium Counter Handler ******/
76
minimum = gridSettings["minimum"],
77
imageToShow = gridSettings["click_images"],
78
counter = minimum,
79
+ ltrMode = gridSettings["ltr_mode"],
80
+ shuffle = gridSettings["shuffle"];
81
82
+ if ( layout === "metro" ) {
83
var suffix = "";
84
85
+ if ( "tablet" === deviceType ) {
86
suffix = "_tablet";
87
} else if ("mobile" === deviceType) {
88
suffix = "_mobile";
89
}
90
var gridWidth = galleryElement.width(),
91
cellSize = Math.floor(gridWidth / 12);
92
+
93
galleryElement
94
.find(".premium-gallery-item")
95
.each(function (index, item) {
123
},
124
filter: gridSettings["active_cat"],
125
layoutMode: layout,
126
+ originLeft: ltrMode,
127
masonry: {
128
columnWidth: columnWidth
129
}
130
});
131
});
132
133
+ if ( loadMore ) {
134
135
galleryElement
136
.parent()
137
.find(".premium-gallery-load-more div")
138
.addClass("premium-gallery-item-hidden");
139
+
140
+ if ( galleryElement.find(".premium-gallery-item").length > minimum ) {
141
galleryElement
142
.parent()
143
.find(".premium-gallery-load-more")
144
.removeClass("premium-gallery-item-hidden");
145
galleryElement
146
+ .find(".premium-gallery-item:gt(" + ( minimum - 1 ) + ")")
147
.addClass("premium-gallery-item-hidden");
148
149
function appendItems( imagesToShow ) {
175
176
}
177
178
+ galleryElement.parent().on("click", ".premium-gallery-load-more-btn", function () {
179
180
+ if ( isFilterClicked ) {
181
+ counter = minimum;
182
+ isFilterClicked = false;
183
+ } else {
184
+ counter = counter;
185
+ }
186
+
187
+ counter = counter + imageToShow;
188
189
+ $.ajax({
190
+ url: appendItems( counter ),
191
+ beforeSend: function () {
192
+ galleryElement
193
+ .parent()
194
+ .find(".premium-gallery-load-more div")
195
+ .removeClass("premium-gallery-item-hidden");
196
+ },
197
+ success: function () {
198
+ galleryElement
199
+ .parent()
200
+ .find(".premium-gallery-load-more div")
201
+ .addClass("premium-gallery-item-hidden");
202
+ }
203
});
204
+ });
205
}
206
}
207
222
223
galleryElement.isotope({ filter: filter });
224
225
+ if ( shuffle ) {
226
+ galleryElement.isotope( 'shuffle' );
227
+ }
228
+
229
+ if ( loadMore )
230
appendItems( minimum );
231
232
return false;
233
});
234
235
+
236
+ if( 'default' === gridSettings['lightbox_type'] ) {
237
+ $scope
238
+ .find(".premium-img-gallery a[data-rel^='prettyPhoto']")
239
+ .prettyPhoto({
240
+ theme: gridSettings["theme"],
241
+ hook: "data-rel",
242
+ opacity: 0.7,
243
+ show_title: false,
244
+ deeplinking: false,
245
+ overlay_gallery: gridSettings["overlay"],
246
+ custom_markup: "",
247
+ default_width: 900,
248
+ default_height: 506,
249
+ social_tools: ""
250
});
251
+ }
252
};
253
254
/****** Premium Counter Handler ******/
assets/frontend/js/premium-vscroll.js CHANGED
@@ -2,7 +2,7 @@
2
3
(function($) {
4
/****** Premium Vertical Scroll Handler ******/
5
- var PremiumVerticalScrollHandler = function($scope, $) {
6
var vScrollElem = $scope.find(".premium-vscroll-wrap"),
7
instance = null,
8
vScrollSettings = vScrollElem.data("settings");
@@ -12,42 +12,52 @@
12
instance = new premiumVerticalScroll(vScrollElem, vScrollSettings);
13
instance.init();
14
15
- // var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
16
- // var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints));
17
- //
18
- //
19
- // if( touch ) {
20
- // instance = new premiumVerticalScroll2( vScrollElem, vScrollSettings );
21
- // instance.init();
22
- // } else {
23
- // if ( isTouchDevice || isTouch ) {
24
- // instance = new premiumVerticalScroll( vScrollElem, vScrollSettings );
25
- // instance.init();
26
- // } else {
27
- // instance = new premiumVerticalScroll2( vScrollElem, vScrollSettings );
28
- // instance.init();
29
- // }
30
- // }
31
};
32
33
- window.premiumVerticalScroll2 = function($selector, settings) {
34
- var self = this,
35
- $instance = $selector,
36
- $window = $(window),
37
- $htmlBody = $("html, body"),
38
- checkTemps = $selector.find(".premium-vscroll-sections-wrap")
39
.length,
40
- deviceType = $("body").data("elementor-device-mode"),
41
- $itemsList = $(".premium-vscroll-dot-item", $instance),
42
- $menuItems = $(".premium-vscroll-nav-item", $instance),
43
- animated = 0;
44
45
- var $lastItem = $itemsList.last(),
46
- lastSectionId = $lastItem.data("menuanchor"),
47
- lastOffset = Math.round($("#" + lastSectionId).offset().top);
48
49
self.init = function() {
50
self.setSectionsData();
51
52
$itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
53
$menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
@@ -62,185 +72,386 @@
62
self.onNavDotLeave
63
);
64
65
- $.scrollify({
66
- section: ".premium-vscroll-section",
67
- updateHash: false,
68
- standardScrollElements: "#" + lastSectionId,
69
- scrollSpeed: settings.speed,
70
- overflowScroll: settings.overflow,
71
- setHeights: settings.setHeight,
72
- before: function(index) {
73
- $menuItems.removeClass("active");
74
- $itemsList.removeClass("active");
75
76
- $($itemsList[index]).addClass("active");
77
- $($menuItems[index]).addClass("active");
78
- },
79
- after: function(index) {
80
- if (index === $lastItem.index()) {
81
- // $.scrollify.disable();
82
- }
83
- },
84
- afterRender: function() {
85
- $($itemsList[0]).addClass("active");
86
- $($menuItems[0]).addClass("active");
87
}
88
});
89
90
- if (deviceType === "desktop") {
91
- $window.on("scroll.premiumVerticalScroll2", self.onWheel);
92
- }
93
94
- if (settings.fullSection) {
95
- var vSection = document.getElementById($instance.attr("id"));
96
97
- if (checkTemps) {
98
document.addEventListener
99
- ? vSection.addEventListener("wheel", self.onWheel, !1)
100
- : vSection.attachEvent("onmousewheel", self.onWheel);
101
} else {
102
document.addEventListener
103
- ? document.addEventListener("wheel", self.onWheel, !1)
104
- : document.attachEvent("onmousewheel", self.onWheel);
105
}
106
}
107
};
108
109
- self.onWheel = function(event) {
110
- var $target = $(event.target),
111
- sectionSelector = checkTemps
112
- ? ".premium-vscroll-temp"
113
- : ".elementor-top-section",
114
- $section = $target.closest(sectionSelector),
115
- sectionId = $section.attr("id"),
116
- $currentSection = $.scrollify.current();
117
-
118
- //re-enable Scrollify
119
- if (
120
- sectionId !== lastSectionId &&
121
- $section.hasClass("premium-vscroll-section") &&
122
- $.scrollify.isDisabled()
123
- ) {
124
- $(
125
- ".premium-vscroll-dots, .premium-vscroll-nav-menu"
126
- ).removeClass("premium-vscroll-dots-hide");
127
128
- $.scrollify.enable();
129
- }
130
131
- if (
132
- !$section.hasClass("premium-vscroll-section") &&
133
- $.scrollify.isDisabled()
134
- ) {
135
- $(".premium-vscroll-tooltip").hide();
136
137
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
138
- "premium-vscroll-dots-hide"
139
);
140
- }
141
};
142
143
- self.moveSectionDown = function() {
144
- $.scrollify.next();
145
};
146
147
- self.moveSectionUp = function() {
148
- $.scrollify.previous();
149
};
150
151
- self.moveToSection = function(index) {
152
- $.scrollify.move(index);
153
};
154
155
- self.setSectionsData = function() {
156
- $itemsList.each(function() {
157
- var $this = $(this),
158
- sectionId = $this.data("menuanchor"),
159
- $section = $("#" + sectionId);
160
161
- $section.addClass("premium-vscroll-section");
162
- });
163
};
164
165
- self.onNavDotChange = function(event) {
166
- var $this = $(this),
167
- index = $this.index(),
168
- sectionId = $this.data("menuanchor");
169
170
- // if ( ! isScrolling ) {
171
172
- if ($.scrollify.isDisabled()) {
173
- $.scrollify.enable();
174
}
175
176
- $menuItems.removeClass("active");
177
- $itemsList.removeClass("active");
178
179
- if ($this.hasClass("premium-vscroll-nav-item")) {
180
- $($itemsList[index]).addClass("active");
181
- } else {
182
- $($menuItems[index]).addClass("active");
183
- }
184
185
- $this.addClass("active");
186
187
- self.moveToSection(index);
188
189
- // }
190
- };
191
192
- self.onNavDotEnter = function() {
193
- var $this = $(this),
194
- index = $this.data("index");
195
196
- if (settings.tooltips) {
197
- $(
198
- '<div class="premium-vscroll-tooltip"><span>' +
199
- settings.dotsText[index] +
200
- "</span></div>"
201
- )
202
- .hide()
203
- .appendTo($this)
204
- .fadeIn(200);
205
}
206
- };
207
208
- self.onNavDotLeave = function() {
209
- $(".premium-vscroll-tooltip").fadeOut(200, function() {
210
- $(this).remove();
211
- });
212
- };
213
- };
214
215
- window.premiumVerticalScroll = function($selector, settings) {
216
- var self = this,
217
- $window = $(window),
218
- $instance = $selector,
219
- checkTemps = $selector.find(".premium-vscroll-sections-wrap")
220
- .length,
221
- $htmlBody = $("html, body"),
222
- deviceType = $("body").data("elementor-device-mode"),
223
- $itemsList = $(".premium-vscroll-dot-item", $instance),
224
- $menuItems = $(".premium-vscroll-nav-item", $instance),
225
- defaultSettings = {
226
- speed: 700,
227
- offset: 1,
228
- fullSection: true
229
- },
230
- settings = $.extend({}, defaultSettings, settings),
231
- sections = {},
232
- timeStamp = 0,
233
- currentSection = null,
234
- platform = navigator.platform,
235
- isScrolling = false;
236
237
- jQuery.extend(jQuery.easing, {
238
- easeInOutCirc: function(x, t, b, c, d) {
239
- if ((t /= d / 2) < 1)
240
- return (-c / 2) * (Math.sqrt(1 - t * t) - 1) + b;
241
- return (c / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
242
- }
243
- });
244
245
self.checkNextSection = function(object, key) {
246
var keys = Object.keys(object),
@@ -286,6 +497,7 @@
286
timeout = setTimeout(delayed, threshold);
287
};
288
};
289
self.visible = function(selector, partial, hidden) {
290
var s = selector.get(0),
291
vpHeight = $window.outerHeight(),
@@ -314,131 +526,6 @@
314
}
315
};
316
317
- self.init = function() {
318
- self.setSectionsData();
319
-
320
- $itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
321
- $menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
322
-
323
- $itemsList.on(
324
- "mouseenter.premiumVerticalScroll",
325
- self.onNavDotEnter
326
- );
327
-
328
- $itemsList.on(
329
- "mouseleave.premiumVerticalScroll",
330
- self.onNavDotLeave
331
- );
332
-
333
- if (deviceType === "desktop") {
334
- $window.on("scroll.premiumVerticalScroll", self.onWheel);
335
- }
336
-
337
- $window.on(
338
- "resize.premiumVerticalScroll orientationchange.premiumVerticalScroll",
339
- self.debounce(50, self.onResize)
340
- );
341
- $window.on("load", function() {
342
- self.setSectionsData();
343
- });
344
-
345
- self.keyboardHandler();
346
-
347
- self.scrollHandler();
348
-
349
- for (var section in sections) {
350
- var $section = sections[section].selector;
351
- elementorFrontend.waypoint(
352
- $section,
353
- function(direction) {
354
- var $this = $(this),
355
- sectionId = $this.attr("id");
356
- if ("down" === direction && !isScrolling) {
357
- currentSection = sectionId;
358
- $itemsList.removeClass("active");
359
- $menuItems.removeClass("active");
360
- $(
361
- "[data-menuanchor=" + sectionId + "]",
362
- $instance
363
- ).addClass("active");
364
- }
365
- },
366
- {
367
- offset: "95%",
368
- triggerOnce: false
369
- }
370
- );
371
-
372
- elementorFrontend.waypoint(
373
- $section,
374
- function(direction) {
375
- var $this = $(this),
376
- sectionId = $this.attr("id");
377
- if ("up" === direction && !isScrolling) {
378
- currentSection = sectionId;
379
- $itemsList.removeClass("active");
380
- $menuItems.removeClass("active");
381
- $(
382
- "[data-menuanchor=" + sectionId + "]",
383
- $instance
384
- ).addClass("active");
385
- }
386
- },
387
- {
388
- offset: "0%",
389
- triggerOnce: false
390
- }
391
- );
392
- }
393
- };
394
-
395
- self.keyboardHandler = function() {
396
- $(document).keydown(function(event) {
397
- if (38 == event.keyCode) {
398
- self.onKeyUp(event, "up");
399
- }
400
-
401
- if (40 == event.keyCode) {
402
- self.onKeyUp(event, "down");
403
- }
404
- });
405
- };
406
-
407
- self.scrollHandler = function() {
408
- if (settings.fullSection) {
409
- var vSection = document.getElementById($instance.attr("id"));
410
-
411
- if (checkTemps) {
412
- document.addEventListener
413
- ? vSection.addEventListener("wheel", self.onWheel, {
414
- passive: false
415
- })
416
- : vSection.attachEvent("onmousewheel", self.onWheel);
417
- } else {
418
- document.addEventListener
419
- ? document.addEventListener("wheel", self.onWheel, {
420
- passive: false
421
- })
422
- : document.attachEvent("onmousewheel", self.onWheel);
423
- }
424
- }
425
- };
426
-
427
- self.setSectionsData = function() {
428
- $itemsList.each(function() {
429
- var $this = $(this),
430
- sectionId = $this.data("menuanchor"),
431
- $section = $("#" + sectionId);
432
- if ($section[0]) {
433
- sections[sectionId] = {
434
- selector: $section,
435
- offset: Math.round($section.offset().top),
436
- height: $section.outerHeight()
437
- };
438
- }
439
- });
440
- };
441
-
442
self.onNavDotEnter = function() {
443
var $this = $(this),
444
index = $this.data("index");
@@ -501,6 +588,21 @@
501
);
502
}
503
};
504
505
self.onAnchorChange = function( sectionId ) {
506
@@ -512,7 +614,7 @@
512
}
513
514
offset = sections[sectionId].offset - settings.offset;
515
-
516
if ( ! isScrolling ) {
517
isScrolling = true;
518
@@ -521,7 +623,7 @@
521
}
522
523
currentSection = sectionId;
524
-
525
$itemsList.removeClass("active");
526
$menuItems.removeClass("active");
527
@@ -598,6 +700,7 @@
598
}
599
600
self.onWheel = function(event) {
601
if (isScrolling) {
602
event.preventDefault();
603
return false;
@@ -610,7 +713,6 @@
610
$section = $target.closest(sectionSelector),
611
$vTarget = self.visible($instance, true, false),
612
sectionId = $section.attr("id"),
613
- offset = 0,
614
newSectionId = false,
615
prevSectionId = false,
616
nextSectionId = false,
@@ -755,9 +857,6 @@
755
self.setSectionsData();
756
};
757
758
- self.scrollStop = function() {
759
- $htmlBody.stop(true);
760
- };
761
};
762
763
$(window).on("elementor/frontend/init", function() {
2
3
(function($) {
4
/****** Premium Vertical Scroll Handler ******/
5
+ var PremiumVerticalScrollHandler = function( $scope, $ ) {
6
var vScrollElem = $scope.find(".premium-vscroll-wrap"),
7
instance = null,
8
vScrollSettings = vScrollElem.data("settings");
12
instance = new premiumVerticalScroll(vScrollElem, vScrollSettings);
13
instance.init();
14
15
};
16
17
+ window.premiumVerticalScroll = function( $selector, settings ) {
18
+ var self = this,
19
+ $window = $( window ),
20
+ isTouch = false,
21
+ $instance = $selector,
22
+ checkTemps = $selector.find(".premium-vscroll-sections-wrap")
23
.length,
24
+ $htmlBody = $("html, body"),
25
+ deviceType = $("body").data("elementor-device-mode"),
26
+ $itemsList = $(".premium-vscroll-dot-item", $instance),
27
+ $menuItems = $(".premium-vscroll-nav-item", $instance),
28
+ defaultSettings = {
29
+ speed: 700,
30
+ offset: 1,
31
+ fullSection: true
32
+ },
33
+ settings = $.extend({}, defaultSettings, settings),
34
+ sections = {},
35
+ timeStamp = 0,
36
+ currentSection = null,
37
+ platform = navigator.platform,
38
+ isScrolling = false,
39
+ sectionChanged = false,
40
+ inScope = true;
41
+
42
+
43
+ var interstitialIndex = 1;
44
+
45
+ var touchStartY = 0,
46
+ touchEndY = 0;
47
48
49
+ jQuery.extend(jQuery.easing, {
50
+ easeInOutCirc: function(x, t, b, c, d) {
51
+ if ((t /= d / 2) < 1)
52
+ return (-c / 2) * (Math.sqrt(1 - t * t) - 1) + b;
53
+ return (c / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
54
+ }
55
+ });
56
+
57
self.init = function() {
58
self.setSectionsData();
59
+
60
+ isTouch = self.isTouchDevice();
61
62
$itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
63
$menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
72
self.onNavDotLeave
73
);
74
75
+ if ( "desktop" === deviceType ) {
76
+ $window.on("scroll.premiumVerticalScroll", self.onWheel);
77
+ }
78
79
+ $window.on(
80
+ "resize.premiumVerticalScroll orientationchange.premiumVerticalScroll",
81
+ self.debounce(50, self.onResize)
82
+ );
83
+ $window.on("load", function() {
84
+ self.setSectionsData();
85
+ });
86
+
87
+ self.keyboardHandler();
88
+
89
+ self.scrollHandler();
90
+
91
+ self.fullSectionHandler();
92
+ };
93
+
94
+ self.setSectionsData = function() {
95
+ $itemsList.each(function() {
96
+ var $this = $(this),
97
+ sectionId = $this.data("menuanchor"),
98
+ $section = $("#" + sectionId);
99
+ if ($section[0]) {
100
+ sections[sectionId] = {
101
+ selector: $section,
102
+ offset: Math.round($section.offset().top),
103
+ height: $section.outerHeight()
104
+ };
105
}
106
});
107
+ };
108
+
109
+ self.fullSectionHandler = function() {
110
+
111
+ if ( settings.fullSection ) {
112
113
+ var vSection = document.getElementById( $instance.attr( "id" ) );
114
115
+ if ( ! isTouch || ! settings.fullTouch ) {
116
+
117
+ if ( checkTemps ) {
118
119
document.addEventListener
120
+ ? vSection.addEventListener( "wheel", self.onWheel, !1 )
121
+ : vSection.attachEvent( "onmousewheel", self.onWheel );
122
+
123
} else {
124
+
125
document.addEventListener
126
+ ? document.addEventListener( "wheel", self.onWheel, !1 )
127
+ : document.attachEvent( "onmousewheel", self.onWheel );
128
+
129
}
130
+
131
+ } else {
132
+ document.addEventListener( "touchstart", self.onTouchStart );
133
+ document.addEventListener( "touchmove", self.onTouchMove, { passive: false } );
134
+
135
}
136
+
137
+ }
138
+
139
};
140
+
141
+ self.scrollHandler = function() {
142
143
+ for ( var section in sections ) {
144
145
+ var $section = sections[ section ].selector;
146
147
+ elementorFrontend.waypoint(
148
+ $section,
149
+ function( direction ) {
150
+
151
+ var $this = $( this ),
152
+ sectionId = $this.attr( "id" );
153
+
154
+ if ( ! isScrolling ) {
155
+
156
+ currentSection = sectionId;
157
158
+ $itemsList.removeClass("active");
159
+ $menuItems.removeClass("active");
160
+
161
+ $( "[data-menuanchor=" + sectionId + "]", $instance ).addClass( "active" );
162
+
163
+ }
164
+ },
165
+ {
166
+ offset: "0%",
167
+ triggerOnce: false
168
+ }
169
);
170
+
171
+ }
172
+
173
};
174
+
175
+ self.keyboardHandler = function() {
176
+ $(document).keydown(function(event) {
177
+ if (38 == event.keyCode) {
178
+ self.onKeyUp(event, "up");
179
+ }
180
181
+ if (40 == event.keyCode) {
182
+ self.onKeyUp(event, "down");
183
+ }
184
+ });
185
+ };
186
+
187
+ self.scrolling = function ( sectionID ) {
188
+
189
+ if( self.atBottom( sectionID ) || sectionChanged ) {
190
+ self.onAnchorChange( sectionID );
191
+ sectionChanged = 0;
192
+ } else {
193
+
194
+ var ID = '#' + sectionID,
195
+ offset = $window.scrollTop() + $( ID ).outerHeight() / 4;
196
+
197
+ $htmlBody
198
+ .stop()
199
+ .clearQueue()
200
+ .animate(
201
+ { scrollTop: offset },
202
+ 700,
203
+ "easeInOutCirc",
204
+ function() {
205
+ isScrolling = false;
206
+ }
207
+ );
208
+
209
+ }
210
};
211
+
212
+ self.atBottom = function( sectionID ) {
213
+
214
+ var top = $window.scrollTop(),
215
+ portHeight = window.innerHeight,
216
+ ID = '#' + sectionID,
217
+ height = parseInt ( $( ID ).offset().top );
218
219
+ if( top < parseInt( height ) + ( $( ID ).outerHeight() - portHeight ) - 28 ) {
220
+ return false;
221
+ } else {
222
+ return true;
223
+ }
224
};
225
+
226
+ self.isTouchDevice = function() {
227
+
228
+ var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),
229
+ isTouch = ( ( 'ontouchstart' in window ) || ( navigator.msMaxTouchPoints > 0 ) || ( navigator.maxTouchPoints ) );
230
231
+ return isTouchDevice || isTouch;
232
+
233
+ };
234
+
235
+ self.getEventsPage = function( e ) {
236
+
237
+ var events = [];
238
+
239
+ events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY);
240
+ events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX);
241
+
242
+ if( isTouch && typeof e.touches !== 'undefined' ) {
243
+ events.y = e.touches[0].pageY;
244
+ events.x = e.touches[0].pageX;
245
+ }
246
+
247
+ return events;
248
+
249
};
250
251
+
252
+ self.onTouchStart = function( e ) {
253
254
+ var touchEvents = self.getEventsPage( e );
255
+ touchStartY = touchEvents.y;
256
+
257
};
258
259
+ self.onTouchMove = function( e ) {
260
+
261
+
262
+ if ( inScope ) {
263
+ self.preventDefault( e );
264
+ }
265
+
266
+ if ( isScrolling ) {
267
+ self.preventDefault( e );
268
+ return false;
269
+ }
270
+
271
+ var touchEvents = self.getEventsPage( e );
272
+
273
+ touchEndY = touchEvents.y;
274
+
275
+ var $target = $( e.target ),
276
+ sectionSelector = checkTemps ? ".premium-vscroll-temp" : ".elementor-top-section",
277
+ $section = $target.closest( sectionSelector ),
278
+ $vTarget = self.visible( $instance, true, false ),
279
+ sectionId = $section.attr( "id" ),
280
+ newSectionId = false,
281
+ prevSectionId = false,
282
+ nextSectionId = false,
283
+ direction = false,
284
+ windowScrollTop = $window.scrollTop(),
285
+ dotIndex = $( ".premium-vscroll-dot-item.active" ).index();
286
287
+ $( ".premium-vscroll-tooltip" ).hide();
288
+
289
+ // if ( dotIndex === $itemsList.length - 1 && ! $vTarget ) {
290
+ //
291
+ // $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).addClass( "premium-vscroll-dots-hide" );
292
+ //
293
+ // } else if ( dotIndex === 0 && ! $vTarget ) {
294
+ //
295
+ // if ( $instance.offset().top - $( document ).scrollTop() > 200 ) {
296
+ //
297
+ // $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).addClass( "premium-vscroll-dots-hide" );
298
+ //
299
+ // }
300
+ //
301
+ // } else {
302
+ //
303
+ // $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).removeClass( "premium-vscroll-dots-hide" );
304
+ //
305
+ // }
306
+
307
+ if ( beforeCheck() ) {
308
+
309
+ sectionId = self.getFirstSection( sections );
310
311
}
312
313
+ if ( afterCheck() ) {
314
315
+ sectionId = self.getLastSection( sections );
316
317
+ }
318
+
319
+ if ( touchStartY > touchEndY ) {
320
321
+ direction = 'down';
322
323
+ } else if ( touchEndY > touchStartY ) {
324
325
+ direction = 'up';
326
327
}
328
329
+ // if ( Math.abs( touchStartY - touchEndY ) > ( window.innerHeight / 100 * 100 ) ) {
330
+
331
+ // if ( sectionId && sections.hasOwnProperty( sectionId ) ) {
332
+ //
333
+ // prevSectionId = self.checkPrevSection( sections, sectionId );
334
+ // nextSectionId = self.checkNextSection( sections, sectionId );
335
+ //
336
+ // if ( "up" === direction ) {
337
+ //
338
+ // if ( ! nextSectionId && sections[ sectionId ].offset < windowScrollTop ) {
339
+ // newSectionId = sectionId;
340
+ // } else {
341
+ // newSectionId = prevSectionId;
342
+ // }
343
+ // }
344
+ //
345
+ // if ( "down" === direction ) {
346
+ //
347
+ // if ( ! prevSectionId && sections[ sectionId ].offset > windowScrollTop + 5 ) {
348
+ // newSectionId = sectionId;
349
+ // } else {
350
+ // newSectionId = nextSectionId;
351
+ // }
352
+ // }
353
+ //
354
+ // if ( newSectionId ) {
355
+ //
356
+ // inScope = true;
357
+ //
358
+ // $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).removeClass( "premium-vscroll-dots-hide" );
359
+ //
360
+ // self.scrolling( newSectionId );
361
+ //
362
+ // } else {
363
+ // inScope = false;
364
+ //
365
+ // var $lastselector = checkTemps ? $instance : $( "#" + sectionId );
366
+ //
367
+ // if ( "down" === direction ) {
368
+ //
369
+ // if ( $lastselector.offset().top + $lastselector.innerHeight() - $( document ).scrollTop() > 600 ) {
370
+ //
371
+ // $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).addClass( "premium-vscroll-dots-hide" );
372
+ //
373
+ // }
374
+ //
375
+ // } else if ( "up" === direction ) {
376
+ //
377
+ // if ( $lastselector.offset().top - $( document ).scrollTop() > 200 ) {
378
+ //
379
+ // $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass( "premium-vscroll-dots-hide" );
380
+ //
381
+ // }
382
+ //
383
+ // }
384
+ // }
385
+ //
386
+ // }
387
+
388
+ // } else {
389
+
390
+ if ( sectionId && sections.hasOwnProperty( sectionId ) ) {
391
+
392
+ prevSectionId = self.checkPrevSection( sections, sectionId );
393
+ nextSectionId = self.checkNextSection( sections, sectionId );
394
+
395
+ if ( "up" === direction ) {
396
+
397
+ if ( ! nextSectionId && sections[ sectionId ].offset < windowScrollTop ) {
398
+ newSectionId = sectionId;
399
+ } else {
400
+ newSectionId = prevSectionId;
401
+ }
402
+ }
403
404
+ if ( "down" === direction ) {
405
406
+ if ( ! prevSectionId && sections[ sectionId ].offset > windowScrollTop + 5 || ! self.atBottom( sectionId ) ) {
407
+ newSectionId = sectionId;
408
+ } else {
409
+ newSectionId = nextSectionId;
410
+ sectionChanged = 1;
411
+ }
412
+ }
413
+
414
+ if ( newSectionId ) {
415
+
416
+ inScope = true;
417
+
418
+ $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).removeClass( "premium-vscroll-dots-hide" );
419
+
420
+ self.scrolling( newSectionId );
421
+
422
+ } else {
423
+ inScope = false;
424
+
425
+ var $lastselector = checkTemps ? $instance : $( "#" + sectionId );
426
+
427
+ if ( "down" === direction ) {
428
+
429
+ if ( $lastselector.offset().top + $lastselector.innerHeight() - $( document ).scrollTop() > 600 ) {
430
+
431
+ $( ".premium-vscroll-dots, .premium-vscroll-nav-menu" ).addClass( "premium-vscroll-dots-hide" );
432
+
433
+ }
434
+
435
+ } else if ( "up" === direction ) {
436
+
437
+ if ( $lastselector.offset().top - $( document ).scrollTop() > 200 ) {
438
+
439
+ $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass( "premium-vscroll-dots-hide" );
440
+
441
+ }
442
+
443
+ }
444
+ }
445
+
446
+ }
447
+
448
+ // }
449
+
450
+ };
451
+
452
+ self.scrollStop = function() {
453
+ $htmlBody.stop(true);
454
+ };
455
456
self.checkNextSection = function(object, key) {
457
var keys = Object.keys(object),
497
timeout = setTimeout(delayed, threshold);
498
};
499
};
500
+
501
self.visible = function(selector, partial, hidden) {
502
var s = selector.get(0),
503
vpHeight = $window.outerHeight(),
526
}
527
};
528
529
self.onNavDotEnter = function() {
530
var $this = $(this),
531
index = $this.data("index");
588
);
589
}
590
};
591
+
592
+ self.preventDefault = function( event ) {
593
+
594
+ if( event.preventDefault ){
595
+
596
+ event.preventDefault();
597
+
598
+ } else {
599
+
600
+ event.returnValue = false;
601
+
602
+ }
603
+
604
+ };
605
+
606
607
self.onAnchorChange = function( sectionId ) {
608
614
}
615
616
offset = sections[sectionId].offset - settings.offset;
617
+
618
if ( ! isScrolling ) {
619
isScrolling = true;
620
623
}
624
625
currentSection = sectionId;
626
+
627
$itemsList.removeClass("active");
628
$menuItems.removeClass("active");
629
700
}
701
702
self.onWheel = function(event) {
703
+
704
if (isScrolling) {
705
event.preventDefault();
706
return false;
713
$section = $target.closest(sectionSelector),
714
$vTarget = self.visible($instance, true, false),
715
sectionId = $section.attr("id"),
716
newSectionId = false,
717
prevSectionId = false,
718
nextSectionId = false,
857
self.setSectionsData();
858
};
859
860
};
861
862
$(window).on("elementor/frontend/init", function() {
includes/class-addons-integration.php CHANGED
@@ -4,7 +4,6 @@ namespace PremiumAddons;
4
5
use PremiumAddons\Admin\Settings\Maps;
6
use PremiumAddons\Admin\Settings\Modules_Settings;
7
- use PremiumAddons\Includes\premium_Template_Tags;
8
9
if( ! defined( 'ABSPATH' ) ) exit();
10
4
5
use PremiumAddons\Admin\Settings\Maps;
6
use PremiumAddons\Admin\Settings\Modules_Settings;
7
8
if( ! defined( 'ABSPATH' ) ) exit();
9
premium-addons-for-elementor.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Premium Addons for Elementor
4
Description: Premium Addons Plugin Includes 22+ premium widgets for Elementor Page Builder.
5
Plugin URI: https://premiumaddons.com
6
- Version: 3.6.3
7
Author: Leap13
8
Author URI: https://leap13.com/
9
Text Domain: premium-addons-for-elementor
@@ -14,12 +14,12 @@ License: GNU General Public License v3.0
14
if ( ! defined('ABSPATH') ) exit; // No access of directly access
15
16
// Define Constants
17
- define('PREMIUM_ADDONS_VERSION', '3.6.3');
18
define('PREMIUM_ADDONS_URL', plugins_url('/', __FILE__));
19
define('PREMIUM_ADDONS_PATH', plugin_dir_path(__FILE__));
20
define('PREMIUM_ADDONS_FILE', __FILE__);
21
define('PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
22
- define('PREMIUM_ADDONS_STABLE_VERSION', '3.6.2');
23
24
if( ! class_exists('Premium_Addons_Elementor') ) {
25
3
Plugin Name: Premium Addons for Elementor
4
Description: Premium Addons Plugin Includes 22+ premium widgets for Elementor Page Builder.
5
Plugin URI: https://premiumaddons.com
6
+ Version: 3.6.4
7
Author: Leap13
8
Author URI: https://leap13.com/
9
Text Domain: premium-addons-for-elementor
14
if ( ! defined('ABSPATH') ) exit; // No access of directly access
15
16
// Define Constants
17
+ define('PREMIUM_ADDONS_VERSION', '3.6.4');
18
define('PREMIUM_ADDONS_URL', plugins_url('/', __FILE__));
19
define('PREMIUM_ADDONS_PATH', plugin_dir_path(__FILE__));
20
define('PREMIUM_ADDONS_FILE', __FILE__);
21
define('PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
22
+ define('PREMIUM_ADDONS_STABLE_VERSION', '3.6.3');
23
24
if( ! class_exists('Premium_Addons_Elementor') ) {
25
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: http://premiumaddons.com
5
Requires at least: 4.5
6
Tested up to: 5.2.2
7
Requires PHP: 5.4
8
- Stable tag: 3.6.3
9
License: GPL v3.0
10
License URI: https://opensource.org/licenses/GPL-3.0
11
@@ -142,6 +142,13 @@ Premium Addons for Elementor is 100% Ads Free, Ads can only be detected from You
142
143
== Changelog ==
144
145
= 3.6.3 =
146
147
- Fixed: Filter by Widget / Addon, Filter by Category inputs removed after `Back to Library` button is clicked.
5
Requires at least: 4.5
6
Tested up to: 5.2.2
7
Requires PHP: 5.4
8
+ Stable tag: 3.6.4
9
License: GPL v3.0
10
License URI: https://opensource.org/licenses/GPL-3.0
11
142
143
== Changelog ==
144
145
+ = 3.6.4 =
146
+
147
+ - Tweak: Grid widget code refactored for better performance.
148
+ - Tweak: Added `Lightbox Type` option in Grid widget to switch between default, Elementor's or any other lightbox plugin.
149
+ - Tweak: Added `Shuffle Images After Filter Click` option in Grid widget.
150
+ - Tweak: Added `Full Section Scroll on Touch Devices` option in Grid widget.
151
+
152
= 3.6.3 =
153
154
- Fixed: Filter by Widget / Addon, Filter by Category inputs removed after `Back to Library` button is clicked.
widgets/premium-grid.php CHANGED
@@ -70,7 +70,7 @@ class Premium_Grid extends Widget_Base {
70
71
$this->start_controls_section('premium_gallery_general',
72
[
73
- 'label' => __('Layout','premium-addons-for-elementor'),
74
75
]);
76
@@ -135,9 +135,9 @@ class Premium_Grid extends Widget_Base {
135
$this->add_group_control(
136
Group_Control_Image_Size::get_type(),
137
[
138
- 'name' => 'thumbnail', // Actually its `image_size`.
139
- 'default' => 'full',
140
- 'condition' => [
141
'premium_gallery_img_size_select' => 'fitRows'
142
]
143
]
@@ -145,13 +145,13 @@ class Premium_Grid extends Widget_Base {
145
146
$this->add_responsive_control('premium_gallery_column_number',
147
[
148
- 'label' => __( 'Columns', 'premium-addons-for-elementor' ),
149
- 'label_block' => true,
150
- 'type' => Controls_Manager::SELECT,
151
- 'desktop_default' => '50%',
152
- 'tablet_default' => '100%',
153
- 'mobile_default' => '100%',
154
- 'options' => [
155
'100%' => __( '1 Column', 'premium-addons-for-elementor' ),
156
'50%' => __( '2 Columns', 'premium-addons-for-elementor' ),
157
'33.330%' => __( '3 Columns', 'premium-addons-for-elementor' ),
@@ -160,31 +160,31 @@ class Premium_Grid extends Widget_Base {
160
'16.66%' => __( '6 Columns', 'premium-addons-for-elementor' ),
161
'8.33%' => __( '12 Columns', 'premium-addons-for-elementor' ),
162
],
163
- 'condition' => [
164
'premium_gallery_img_size_select!' => 'metro'
165
],
166
- 'selectors' => [
167
'{{WRAPPER}} .premium-img-gallery-masonry div.premium-gallery-item, {{WRAPPER}} .premium-img-gallery-fitRows div.premium-gallery-item' => 'width: {{VALUE}};',
168
],
169
- 'render_type' => 'template'
170
]
171
);
172
173
$this->add_control( 'premium_gallery_load_more',
174
[
175
- 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ),
176
- 'description' => __('Requires number of images larger than 6', 'premium-addons-for-elementor'),
177
- 'type' => Controls_Manager::SWITCHER
178
]
179
);
180
181
$this->add_control( 'premium_gallery_load_more_text',
182
[
183
- 'label' => __( 'Button Text', 'premium-addons-for-elementor' ),
184
- 'type' => Controls_Manager::TEXT,
185
- 'default' => __('Load More', 'premium-addons-for-elementor'),
186
- 'dynamic' => [ 'active' => true ],
187
- 'condition' => [
188
'premium_gallery_load_more' => 'yes'
189
]
190
]
@@ -192,11 +192,11 @@ class Premium_Grid extends Widget_Base {
192
193
$this->add_control( 'premium_gallery_load_minimum',
194
[
195
- 'label' => __('Minimum Number of Images', 'premium-addons-for-elementor'),
196
- 'type' => Controls_Manager::NUMBER,
197
- 'description' => __('Set the minimum number of images before showing load more button', 'premium-addons-for-elementor'),
198
- 'default' => 6,
199
- 'condition' => [
200
'premium_gallery_load_more' => 'yes'
201
]
202
]
@@ -204,10 +204,10 @@ class Premium_Grid extends Widget_Base {
204
205
$this->add_control( 'premium_gallery_load_click_number',
206
[
207
- 'label' => __('Images to Show', 'premium-addons-for-elementor'),
208
- 'type' => Controls_Manager::NUMBER,
209
- 'description' => __('Set the minimum number of images to show with each click', 'premium-addons-for-elementor'),
210
- 'default' => 6,
211
'condition' => [
212
'premium_gallery_load_more' => 'yes'
213
]
@@ -216,9 +216,9 @@ class Premium_Grid extends Widget_Base {
216
217
$this->add_responsive_control('premium_gallery_load_more_align',
218
[
219
- 'label' => __( 'Button Alignment', 'premium-addons-for-elementor' ),
220
- 'type' => Controls_Manager::CHOOSE,
221
- 'options' => [
222
'left' => [
223
'title'=> __( 'Left', 'premium-addons-for-elementor' ),
224
'icon' => 'fa fa-align-left',
@@ -232,11 +232,11 @@ class Premium_Grid extends Widget_Base {
232
'icon' => 'fa fa-align-right',
233
],
234
],
235
- 'default' => 'center',
236
- 'selectors' => [
237
'{{WRAPPER}} .premium-gallery-load-more' => 'text-align: {{VALUE}};',
238
],
239
- 'condition' => [
240
'premium_gallery_load_more' => 'yes'
241
]
242
]
@@ -246,26 +246,38 @@ class Premium_Grid extends Widget_Base {
246
247
$this->start_controls_section('premium_gallery_cats',
248
[
249
- 'label' => __('Categories','premium-addons-for-elementor'),
250
- ]);
251
252
$this->add_control( 'premium_gallery_first_cat_switcher',
253
[
254
- 'label' => __( 'First Category', 'premium-addons-for-elementor' ),
255
- 'type' => Controls_Manager::SWITCHER,
256
- 'default' => 'yes'
257
]
258
);
259
260
$this->add_control( 'premium_gallery_first_cat_label',
261
[
262
- 'label' => __( 'First Category Label', 'premium-addons-for-elementor' ),
263
- 'type' => Controls_Manager::TEXT,
264
- 'default' => __('All', 'premium-addons-for-elementor'),
265
- 'dynamic' => [ 'active' => true ],
266
- 'condition' => [
267
'premium_gallery_first_cat_switcher' => 'yes'
268
- ]
269
]
270
);
271
@@ -273,20 +285,20 @@ class Premium_Grid extends Widget_Base {
273
274
$repeater->add_control( 'premium_gallery_img_cat',
275
[
276
- 'label' => __( 'Category', 'premium-addons-for-elementor' ),
277
- 'type' => Controls_Manager::TEXT,
278
- 'dynamic' => [ 'active' => true ],
279
]
280
);
281
282
$repeater->add_control( 'premium_gallery_img_cat_rotation',
283
[
284
- 'label' => __('Rotation Degrees', 'premium-addons-for-elementor'),
285
- 'type' => Controls_Manager::NUMBER,
286
- 'description' => __('Set rotation value in degrees', 'premium-addons-for-elementor'),
287
- 'min' => -180,
288
- 'max' => 180,
289
- 'selectors' => [
290
'{{WRAPPER}} {{CURRENT_ITEM}}' => '-webkit-transform: rotate({{VALUE}}deg); -moz-transform: rotate({{VALUE}}deg); -o-transform: rotate({{VALUE}}deg); transform: rotate({{VALUE}}deg);'
291
],
292
]
@@ -294,9 +306,9 @@ class Premium_Grid extends Widget_Base {
294
295
$this->add_control('premium_gallery_cats_content',
296
[
297
- 'label' => __( 'Categories', 'premium-addons-for-elementor' ),
298
- 'type' => Controls_Manager::REPEATER,
299
- 'default' => [
300
[
301
'premium_gallery_img_cat' => 'Category 1',
302
],
@@ -304,25 +316,30 @@ class Premium_Grid extends Widget_Base {
304
'premium_gallery_img_cat' => 'Category 2',
305
],
306
],
307
- 'fields' => array_values( $repeater->get_controls() ) ,
308
- 'title_field' => '{{{ premium_gallery_img_cat }}}',
309
]
310
);
311
312
$this->add_control( 'premium_gallery_active_cat',
313
[
314
- 'label' => __('Active Category Index', 'premium-addons-for-elementor'),
315
- 'type' => Controls_Manager::NUMBER,
316
- 'description' => __('Put the index of the default active category, default is 1', 'premium-addons-for-elementor'),
317
- 'default' => 1,
318
]
319
);
320
321
- $this->add_control('premium_gallery_filter',
322
[
323
- 'label' => __( 'Filter', 'premium-addons-for-elementor' ),
324
'type' => Controls_Manager::SWITCHER,
325
- 'default' => 'yes'
326
]
327
);
328
@@ -570,6 +587,22 @@ class Premium_Grid extends Widget_Base {
570
]
571
);
572
573
$this->add_control('premium_gallery_lightbox_theme',
574
[
575
'label' => __('Lightbox Theme', 'premium-addons-pro'),
@@ -584,7 +617,8 @@ class Premium_Grid extends Widget_Base {
584
],
585
'default' => 'pp_default',
586
'condition' => [
587
- 'premium_gallery_light_box' => 'yes'
588
]
589
]
590
);
@@ -594,7 +628,8 @@ class Premium_Grid extends Widget_Base {
594
'label' => __( 'Overlay Gallery Images', 'premium-addons-for-elementor' ),
595
'type' => Controls_Manager::SWITCHER,
596
'condition' => [
597
- 'premium_gallery_light_box' => 'yes'
598
]
599
]
600
);
@@ -1523,7 +1558,6 @@ class Premium_Grid extends Widget_Base {
1523
]
1524
);
1525
1526
-
1527
$this->end_controls_tab();
1528
1529
$this->end_controls_tabs();
@@ -1532,41 +1566,312 @@ class Premium_Grid extends Widget_Base {
1532
1533
}
1534
1535
public function filter_cats( $string ) {
1536
1537
$cat_filtered = mb_strtolower( $string );
1538
1539
if( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
1540
$cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
1541
- $cat_filtered = strtok($cat_filtered, '"');
1542
- $cat_filtered = preg_replace('/[http:.]/','',$cat_filtered);
1543
- $cat_filtered = str_replace('/','',$cat_filtered);
1544
}
1545
1546
- $cat_filtered = str_replace(', ', ',', $cat_filtered);
1547
- $cat_filtered = preg_replace("/[\s_]/", "-", $cat_filtered);
1548
- $cat_filtered = str_replace(',', ' ', $cat_filtered);
1549
1550
return $cat_filtered;
1551
}
1552
1553
1554
- protected function render() {
1555
1556
- $settings = $this->get_settings_for_display();
1557
1558
- $filter = $settings['premium_gallery_filter'];
1559
1560
- $layout = $settings['premium_gallery_img_style'];
1561
- $min_size = $settings['premium_gallery_min_range'].'px';
1562
- $max_size = $settings['premium_gallery_max_range'].'px';
1563
1564
- $category_formatted = "*";
1565
1566
- if( 'yes' !== $settings['premium_gallery_first_cat_switcher'] && 'yes' === $settings['premium_gallery_filter'] ) {
1567
- $active_index = $settings['premium_gallery_active_cat'];
1568
- $active_category = $settings['premium_gallery_cats_content'][$active_index]['premium_gallery_img_cat'];
1569
- $category_formatted = "." . $this->filter_cats( $active_category );
1570
}
1571
1572
if ( 'original' === $settings['premium_gallery_img_size_select'] ) {
@@ -1575,94 +1880,72 @@ class Premium_Grid extends Widget_Base {
1575
$settings['premium_gallery_img_size_select'] = 'fitRows';
1576
}
1577
1578
- $load_more = 'yes' === $settings['premium_gallery_load_more'] ? true : false;
1579
- $minimum = ! empty ( $settings['premium_gallery_load_minimum'] ) ? $settings['premium_gallery_load_minimum'] : 6;
1580
- $click_number = ! empty ( $settings['premium_gallery_load_click_number'] ) ? $settings['premium_gallery_load_click_number'] : 6;
1581
1582
- $rtl_mode = 'yes' === $settings['premium_gallery_rtl_mode'] ? false : true;
1583
1584
$grid_settings = [
1585
'img_size' => $settings['premium_gallery_img_size_select'],
1586
- 'filter' => $settings['premium_gallery_filter'],
1587
- 'light_box' => $settings['premium_gallery_light_box'],
1588
- 'overlay_gallery'=> 'yes' === $settings['premium_gallery_overlay_gallery'] ? true : false,
1589
'theme' => $settings['premium_gallery_lightbox_theme'],
1590
- 'active_cat' => $category_formatted,
1591
- 'load_more' => $load_more,
1592
- 'minimum' => $minimum,
1593
- 'click_images' => $click_number,
1594
- 'rtl_mode' => $rtl_mode
1595
];
1596
-
1597
$this->add_render_attribute( 'grid', [
1598
'id' => 'premium-img-gallery-' . esc_attr( $this->get_id() ),
1599
'class' => [
1600
'premium-img-gallery',
1601
- 'premium-img-gallery-' . $settings['premium_gallery_img_size_select']
1602
]
1603
]
1604
- );
1605
-
1606
- if ( ! empty( $settings['premium_gallery_active_cat'] ) ) {
1607
- $active_category_index = 'yes' === $settings['premium_gallery_first_cat_switcher'] ? $settings['premium_gallery_active_cat'] - 1 : $settings['premium_gallery_active_cat'];
1608
- } else {
1609
- $active_category_index = -1;
1610
- }
1611
1612
- $is_all_active = ( 0 > $active_category_index ) ? "active" : "";
1613
1614
?>
1615
1616
- <div <?php echo $this->get_render_attribute_string('grid'); ?>>
1617
- <?php if( $filter == 'yes' ) : ?>
1618
- <div class="premium-img-gallery-filter">
1619
- <ul class="premium-gallery-cats-container">
1620
- <?php if( 'yes' == $settings['premium_gallery_first_cat_switcher'] ) : ?>
1621
- <li>
1622
- <a href="javascript:;" class="category <?php echo $is_all_active; ?>" data-filter="*">
1623
- <span><?php echo $settings['premium_gallery_first_cat_label']; ?></span>
1624
- </a>
1625
- </li>
1626
- <?php endif;
1627
- foreach( $settings['premium_gallery_cats_content'] as $index => $category ) {
1628
- if( ! empty( $category['premium_gallery_img_cat'] ) ) {
1629
- $cat_filtered = $this->filter_cats($category['premium_gallery_img_cat']);
1630
- $cat_list_key = 'premium_grid_category_' . $index;
1631
- if( $active_category_index == $index ) {
1632
- $this->add_render_attribute($cat_list_key,
1633
- 'class',
1634
- 'active'
1635
- );
1636
- }
1637
-
1638
- $this->add_render_attribute($cat_list_key,
1639
- 'class', [
1640
- 'category',
1641
- 'elementor-repeater-item-' . $category['_id']
1642
- ]
1643
- );
1644
- ?>
1645
- <li>
1646
- <a href="javascript:;" <?php echo $this->get_render_attribute_string($cat_list_key); ?> data-filter=".<?php echo esc_attr( $cat_filtered ); ?>"
1647
- ><span><?php echo $category['premium_gallery_img_cat']; ?></span>
1648
- </a>
1649
- </li>
1650
- <?php }
1651
- } ?>
1652
- </ul>
1653
- </div>
1654
- <?php endif; ?>
1655
1656
- <div class="premium-gallery-container js-isotope" data-settings='<?php echo wp_json_encode($grid_settings); ?>'>
1657
<?php if ( 'metro' === $settings['premium_gallery_img_size_select'] ) : ?>
1658
<div class="grid-sizer"></div>
1659
<?php endif;
1660
foreach( $settings['premium_gallery_img_content'] as $index => $image ) :
1661
- $alt = esc_attr( Control_Media::get_image_alt( $image['premium_gallery_img'] ) );
1662
1663
$key = 'gallery_item_' . $index;
1664
1665
- $this->add_render_attribute($key, [
1666
'class' => [
1667
'premium-gallery-item',
1668
'elementor-repeater-item-' . $image['_id'],
@@ -1675,117 +1958,120 @@ class Premium_Grid extends Widget_Base {
1675
1676
$cells = [
1677
'cells' => $image['premium_gallery_image_cell']['size'],
1678
- 'vcells' => $image['premium_gallery_image_vcell']['size'],
1679
'cells_tablet' => $image['premium_gallery_image_cell_tablet']['size'],
1680
- 'vcells_tablet' => $image['premium_gallery_image_vcell_tablet']['size'],
1681
'cells_mobile' => $image['premium_gallery_image_cell_mobile']['size'],
1682
- 'vcells_mobile' => $image['premium_gallery_image_vcell_mobile']['size'],
1683
];
1684
1685
$this->add_render_attribute( $key, 'data-metro', wp_json_encode( $cells ) );
1686
}
1687
-
1688
?>
1689
<div <?php echo $this->get_render_attribute_string( $key ); ?>>
1690
<div class="pa-gallery-img <?php echo esc_attr( $layout ); ?>" onclick="">
1691
- <div class="pa-gallery-img-container <?php echo esc_attr( $settings['premium_gallery_img_effect'] ); ?>">
1692
- <?php if( $settings['premium_gallery_img_size_select'] == 'fitRows' ) :
1693
- $image_src = $image['premium_gallery_img'];
1694
- $image_src_size = Group_Control_Image_Size::get_attachment_image_src( $image_src['id'], 'thumbnail', $settings );
1695
- if( empty( $image_src_size ) ) : $image_src_size = $image_src['url']; else: $image_src_size = $image_src_size; endif;
1696
- ?>
1697
- <img class="pa-gallery-image" src="<?php echo $image_src_size; ?>" alt="<?php echo $alt; ?>">
1698
- <?php else : ?>
1699
- <img class="pa-gallery-image" src="<?php echo esc_url($image['premium_gallery_img']['url']); ?>" alt="<?php echo $alt; ?>">
1700
- <?php endif; ?>
1701
</div>
1702
- <?php if( $layout == 'default' || $layout == 'style1' ) : ?>
1703
- <div class="pa-gallery-icons-wrapper">
1704
- <div class="pa-gallery-icons-inner-container">
1705
- <?php if( $image['premium_gallery_lightbox_whole'] != 'yes' && $settings['premium_gallery_light_box'] == 'yes' ) : ?>
1706
- <a href="<?php echo esc_attr( $image['premium_gallery_img']['url'] ); ?>" class="pa-gallery-magnific-image" data-rel="prettyPhoto[premium-grid-<?php echo esc_attr($this->get_id()); ?>]"><span><i class="fa fa-search-plus"></i></span></a>
1707
- <?php endif; ?>
1708
- <?php if( $image['premium_gallery_link_whole'] != 'yes' && $image['premium_gallery_img_link_type'] == 'url' && !empty($image['premium_gallery_img_link']['url']) ) :
1709
- $icon_link = $image['premium_gallery_img_link']['url'];
1710
- $external = $image['premium_gallery_img_link']['is_external'] ? 'target="_blank"' : '';
1711
- $no_follow = $image['premium_gallery_img_link']['nofollow'] ? 'rel="nofollow"' : ''; ?>
1712
- <a href="<?php echo esc_attr( $icon_link ); ?>" <?php echo $external; ?><?php echo $no_follow; ?> class="pa-gallery-img-link"><span><i class="fa fa-link"></i></span></a>
1713
- <?php elseif( $image['premium_gallery_link_whole'] != 'yes' && $image['premium_gallery_img_link_type'] == 'link') :
1714
- $icon_link = get_permalink($image['premium_gallery_img_existing']);
1715
- ?>
1716
- <a href="<?php echo esc_attr( $icon_link ); ?>" class="pa-gallery-img-link"><span><i class="fa fa-link"></i></span></a>
1717
- <?php endif; ?>
1718
</div>
1719
- </div>
1720
- <?php if( ! empty( $image['premium_gallery_img_name'] ) || ! empty( $image['premium_gallery_img_desc'] ) ) : ?>
1721
- <div class="premium-gallery-caption">
1722
- <?php if( ! empty( $image['premium_gallery_img_name'] ) ) : ?>
1723
- <span class="premium-gallery-img-name"><?php echo $image['premium_gallery_img_name']; ?></span>
1724
- <?php endif; ?>
1725
- <?php if( ! empty( $image['premium_gallery_img_desc'] ) ) : ?>
1726
- <p class="premium-gallery-img-desc"><?php echo $image['premium_gallery_img_desc']; ?></p>
1727
- <?php endif; ?>
1728
</div>
1729
- <?php endif; ?>
1730
- <?php else: ?>
1731
- <div class="pa-gallery-icons-caption-container">
1732
- <div class="pa-gallery-icons-caption-cell">
1733
- <?php if( $image['premium_gallery_lightbox_whole'] != 'yes' && $settings['premium_gallery_light_box'] == 'yes' ) : ?>
1734
- <a href="<?php echo esc_attr( $image['premium_gallery_img']['url'] ); ?>" class="pa-gallery-magnific-image" data-rel="prettyPhoto[premium-grid-<?php echo esc_attr($this->get_id()); ?>]"><span><i class="fa fa-search-plus"></i></span></a>
1735
- <?php endif; ?>
1736
- <?php if( $image['premium_gallery_link_whole'] != 'yes' && $image['premium_gallery_img_link_type'] == 'url' && !empty($image['premium_gallery_img_link']['url']) ) :
1737
- $icon_link = $image['premium_gallery_img_link']['url'];
1738
- $external = $image['premium_gallery_img_link']['is_external'] ? 'target="_blank"' : '';
1739
- $no_follow = $image['premium_gallery_img_link']['nofollow'] ? 'rel="nofollow"' : ''; ?>
1740
- <a href="<?php echo esc_attr( $icon_link ); ?>" <?php echo $external; ?><?php echo $no_follow; ?> class="pa-gallery-img-link"><span><i class="fa fa-link"></i></span></a>
1741
- <?php elseif( $image['premium_gallery_link_whole'] != 'yes' && $image['premium_gallery_img_link_type'] == 'link') :
1742
- $icon_link = get_permalink($image['premium_gallery_img_existing']);
1743
?>
1744
- <a href="<?php echo esc_attr( $icon_link ); ?>" class="pa-gallery-img-link"><span><i class="fa fa-link"></i></span></a>
1745
- <?php endif; ?>
1746
- <?php if( ! empty( $image['premium_gallery_img_name'] ) || ! empty( $image['premium_gallery_img_desc'] ) ) : ?>
1747
- <div class="premium-gallery-caption">
1748
- <?php if( ! empty( $image['premium_gallery_img_name'] ) ) : ?>
1749
- <span class="premium-gallery-img-name"><?php echo $image['premium_gallery_img_name']; ?></span>
1750
- <?php endif; ?>
1751
- <?php if( ! empty( $image['premium_gallery_img_desc'] ) ) : ?>
1752
- <p class="premium-gallery-img-desc"><?php echo $image['premium_gallery_img_desc']; ?></p>
1753
- <?php endif; ?>
1754
</div>
1755
- <?php endif; ?>
1756
</div>
1757
- </div>
1758
- <?php endif; ?>
1759
- <?php if( $image['premium_gallery_link_whole'] == 'yes' && $image['premium_gallery_img_link_type'] == 'url' && !empty($image['premium_gallery_img_link']['url']) ) :
1760
- $icon_link = $image['premium_gallery_img_link']['url'];
1761
- $external = $image['premium_gallery_img_link']['is_external'] ? 'target="_blank"' : '';
1762
- $no_follow = $image['premium_gallery_img_link']['nofollow'] ? 'rel="nofollow"' : ''; ?>
1763
- <a href="<?php echo esc_attr( $icon_link ); ?>" <?php echo $external; ?><?php echo $no_follow; ?> class="pa-gallery-whole-link"></a>
1764
- <?php elseif( $image['premium_gallery_link_whole'] == 'yes' && $image['premium_gallery_img_link_type'] == 'link' ) :
1765
- $icon_link = get_permalink($image['premium_gallery_img_existing']); ?>
1766
- <a href="<?php echo esc_attr( $icon_link ); ?>" <?php echo $external; ?><?php echo $no_follow; ?> class="pa-gallery-whole-link"></a>
1767
- <?php elseif( $image['premium_gallery_lightbox_whole'] == 'yes' && $settings['premium_gallery_light_box'] == 'yes' ) : ?>
1768
- <a href="<?php echo esc_attr( $image['premium_gallery_img']['url'] ); ?>" class="pa-gallery-whole-link" data-rel="prettyPhoto[premium-grid-<?php echo esc_attr($this->get_id()); ?>]"></a>
1769
- <?php endif; ?>
1770
1771
</div>
1772
</div>
1773
<?php endforeach; ?>
1774
</div>
1775
- <?php if ( $settings['premium_gallery_load_more'] === 'yes' ) : ?>
1776
- <div class="premium-gallery-load-more premium-gallery-btn-hidden">
1777
- <button class="premium-gallery-load-more-btn"><span><?php echo $settings['premium_gallery_load_more_text']; ?></span><div class="premium-loader"></div></button>
1778
- </div>
1779
<?php endif; ?>
1780
</div>
1781
- <?php if($settings['premium_gallery_responsive_switcher'] === 'yes') : ?>
1782
<style>
1783
- @media(min-width: <?php echo $min_size; ?> ) and (max-width:<?php echo $max_size; ?>){
1784
- #premium-img-gallery-<?php echo esc_attr($this->get_id()); ?> .premium-gallery-caption {
1785
display: none;
1786
- }
1787
}
1788
</style>
1789
- <?php endif; ?>
1790
<?php }
1791
}
70
71
$this->start_controls_section('premium_gallery_general',
72
[
73
+ 'label' => __('Layout','premium-addons-for-elementor'),
74
75
]);
76
135
$this->add_group_control(
136
Group_Control_Image_Size::get_type(),
137
[
138
+ 'name' => 'thumbnail', // Actually its `image_size`.
139
+ 'default' => 'full',
140
+ 'condition' => [
141
'premium_gallery_img_size_select' => 'fitRows'
142
]
143
]
145
146
$this->add_responsive_control('premium_gallery_column_number',
147
[
148
+ 'label' => __( 'Columns', 'premium-addons-for-elementor' ),
149
+ 'label_block' => true,
150
+ 'type' => Controls_Manager::SELECT,
151
+ 'desktop_default' => '50%',
152
+ 'tablet_default' => '100%',
153
+ 'mobile_default' => '100%',
154
+ 'options' => [
155
'100%' => __( '1 Column', 'premium-addons-for-elementor' ),
156
'50%' => __( '2 Columns', 'premium-addons-for-elementor' ),
157
'33.330%' => __( '3 Columns', 'premium-addons-for-elementor' ),
160
'16.66%' => __( '6 Columns', 'premium-addons-for-elementor' ),
161
'8.33%' => __( '12 Columns', 'premium-addons-for-elementor' ),
162
],
163
+ 'condition' => [
164
'premium_gallery_img_size_select!' => 'metro'
165
],
166
+ 'selectors' => [
167
'{{WRAPPER}} .premium-img-gallery-masonry div.premium-gallery-item, {{WRAPPER}} .premium-img-gallery-fitRows div.premium-gallery-item' => 'width: {{VALUE}};',
168
],
169
+ 'render_type' => 'template'
170
]
171
);
172
173
$this->add_control( 'premium_gallery_load_more',
174
[
175
+ 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ),
176
+ 'description' => __('Requires number of images larger than 6', 'premium-addons-for-elementor'),
177
+ 'type' => Controls_Manager::SWITCHER
178
]
179
);
180
181
$this->add_control( 'premium_gallery_load_more_text',
182
[
183
+ 'label' => __( 'Button Text', 'premium-addons-for-elementor' ),
184
+ 'type' => Controls_Manager::TEXT,
185
+ 'default' => __('Load More', 'premium-addons-for-elementor'),
186
+ 'dynamic' => [ 'active' => true ],
187
+ 'condition' => [
188
'premium_gallery_load_more' => 'yes'
189
]
190
]
192
193
$this->add_control( 'premium_gallery_load_minimum',
194
[
195
+ 'label' => __('Minimum Number of Images', 'premium-addons-for-elementor'),
196
+ 'type' => Controls_Manager::NUMBER,
197
+ 'description' => __('Set the minimum number of images before showing load more button', 'premium-addons-for-elementor'),
198
+ 'default' => 6,
199
+ 'condition' => [
200
'premium_gallery_load_more' => 'yes'
201
]
202
]
204
205
$this->add_control( 'premium_gallery_load_click_number',
206
[
207
+ 'label' => __('Images to Show', 'premium-addons-for-elementor'),
208
+ 'type' => Controls_Manager::NUMBER,
209
+ 'description' => __('Set the minimum number of images to show with each click', 'premium-addons-for-elementor'),
210
+ 'default' => 6,
211
'condition' => [
212
'premium_gallery_load_more' => 'yes'
213
]
216
217
$this->add_responsive_control('premium_gallery_load_more_align',
218
[
219
+ 'label' => __( 'Button Alignment', 'premium-addons-for-elementor' ),
220
+ 'type' => Controls_Manager::CHOOSE,
221
+ 'options' => [
222
'left' => [
223
'title'=> __( 'Left', 'premium-addons-for-elementor' ),
224
'icon' => 'fa fa-align-left',
232
'icon' => 'fa fa-align-right',
233
],
234
],
235
+ 'default' => 'center',
236
+ 'selectors' => [
237
'{{WRAPPER}} .premium-gallery-load-more' => 'text-align: {{VALUE}};',
238
],
239
+ 'condition' => [
240
'premium_gallery_load_more' => 'yes'
241
]
242
]
246
247
$this->start_controls_section('premium_gallery_cats',
248
[
249
+ 'label' => __('Categories','premium-addons-for-elementor'),
250
+ ]
251
+ );
252
+
253
+ $this->add_control('premium_gallery_filter',
254
+ [
255
+ 'label' => __( 'Filter Tabs', 'premium-addons-for-elementor' ),
256
+ 'type' => Controls_Manager::SWITCHER,
257
+ 'default' => 'yes'
258
+ ]
259
+ );
260
+
261
+ $condition = array( 'premium_gallery_filter' => 'yes' );
262
263
$this->add_control( 'premium_gallery_first_cat_switcher',
264
[
265
+ 'label' => __( 'First Category', 'premium-addons-for-elementor' ),
266
+ 'type' => Controls_Manager::SWITCHER,
267
+ 'default' => 'yes',
268
+ 'condition' => $condition
269
]
270
);
271
272
$this->add_control( 'premium_gallery_first_cat_label',
273
[
274
+ 'label' => __( 'First Category Label', 'premium-addons-for-elementor' ),
275
+ 'type' => Controls_Manager::TEXT,
276
+ 'default' => __('All', 'premium-addons-for-elementor'),
277
+ 'dynamic' => [ 'active' => true ],
278
+ 'condition' => array_merge( [
279
'premium_gallery_first_cat_switcher' => 'yes'
280
+ ], $condition )
281
]
282
);
283
285
286
$repeater->add_control( 'premium_gallery_img_cat',
287
[
288
+ 'label' => __( 'Category', 'premium-addons-for-elementor' ),
289
+ 'type' => Controls_Manager::TEXT,
290
+ 'dynamic' => [ 'active' => true ],
291
]
292
);
293
294
$repeater->add_control( 'premium_gallery_img_cat_rotation',
295
[
296
+ 'label' => __('Rotation Degrees', 'premium-addons-for-elementor'),
297
+ 'type' => Controls_Manager::NUMBER,
298
+ 'description' => __('Set rotation value in degrees', 'premium-addons-for-elementor'),
299
+ 'min' => -180,
300
+ 'max' => 180,
301
+ 'selectors' => [
302
'{{WRAPPER}} {{CURRENT_ITEM}}' => '-webkit-transform: rotate({{VALUE}}deg); -moz-transform: rotate({{VALUE}}deg); -o-transform: rotate({{VALUE}}deg); transform: rotate({{VALUE}}deg);'
303
],
304
]
306
307
$this->add_control('premium_gallery_cats_content',
308
[
309
+ 'label' => __( 'Categories', 'premium-addons-for-elementor' ),
310
+ 'type' => Controls_Manager::REPEATER,
311
+ 'default' => [
312
[
313
'premium_gallery_img_cat' => 'Category 1',
314
],
316
'premium_gallery_img_cat' => 'Category 2',
317
],
318
],
319
+ 'fields' => array_values( $repeater->get_controls() ) ,
320
+ 'title_field' => '{{{ premium_gallery_img_cat }}}',
321
+ 'condition' => $condition
322
]
323
);
324
325
$this->add_control( 'premium_gallery_active_cat',
326
[
327
+ 'label' => __('Active Category Index', 'premium-addons-for-elementor'),
328
+ 'type' => Controls_Manager::NUMBER,
329
+ 'description' => __('Put the index of the default active category, default is 1', 'premium-addons-for-elementor'),
330
+ 'default' => 1,
331
+ 'condition' => $condition
332
+
333
]
334
);
335
336
+ $this->add_control('premium_gallery_shuffle',
337
[
338
+ 'label' => __( 'Shuffle Images on Filter Click', 'premium-addons-for-elementor' ),
339
'type' => Controls_Manager::SWITCHER,
340
+ 'condition' => array_merge( [
341
+ 'premium_gallery_filter' => 'yes'
342
+ ], $condition )
343
]
344
);
345
587
]
588
);
589
590
+ $this->add_control('premium_gallery_lightbox_type',
591
+ [
592
+ 'label' => __( 'Lightbox Type', 'premium-addons-for-elementor' ),
593
+ 'type' => Controls_Manager::SELECT,
594
+ 'default' => 'default',
595
+ 'options' => [
596
+ 'default' => __( 'Default', 'premium-addons-for-elementor' ),
597
+ 'yes' => __( 'Elementor Lightbox', 'premium-addons-for-elementor' ),
598
+ 'no' => __( 'Other', 'premium-addons-for-elementor' ),
599
+ ],
600
+ 'condition' => [
601
+ 'premium_gallery_light_box' => 'yes',
602
+ ],
603
+ ]
604
+ );
605
+
606
$this->add_control('premium_gallery_lightbox_theme',
607
[
608
'label' => __('Lightbox Theme', 'premium-addons-pro'),
617
],
618
'default' => 'pp_default',
619
'condition' => [
620
+ 'premium_gallery_light_box' => 'yes',
621
+ 'premium_gallery_lightbox_type' => 'default'
622
]
623
]
624
);
628
'label' => __( 'Overlay Gallery Images', 'premium-addons-for-elementor' ),
629
'type' => Controls_Manager::SWITCHER,
630
'condition' => [
631
+ 'premium_gallery_light_box' => 'yes',
632
+ 'premium_gallery_lightbox_type' => 'default'
633
]
634
]
635
);
1558
]
1559
);
1560
1561
$this->end_controls_tab();
1562
1563
$this->end_controls_tabs();
1566
1567
}
1568
1569
+ /*
1570
+ * Filter Cats
1571
+ *
1572
+ * Formats Category to be inserted in class attribute.
1573
+ *
1574
+ * @since 2.1.0
1575
+ * @access public
1576
+ *
1577
+ * @return string category slug
1578
+ */
1579
public function filter_cats( $string ) {
1580
1581
$cat_filtered = mb_strtolower( $string );
1582
1583
if( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
1584
$cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
1585
+ $cat_filtered = strtok( $cat_filtered, '"' );
1586
+ $cat_filtered = preg_replace( '/[http:.]/', '', $cat_filtered );
1587
+ $cat_filtered = str_replace( '/', '', $cat_filtered );
1588
}
1589
1590
+ $cat_filtered = str_replace( ', ', ',', $cat_filtered );
1591
+ $cat_filtered = preg_replace( "/[\s_]/", "-", $cat_filtered );
1592
+ $cat_filtered = str_replace( ',', ' ', $cat_filtered );
1593
1594
return $cat_filtered;
1595
}
1596
1597
+ /*
1598
+ * Render Filter Tabs on the frontend
1599
+ *
1600
+ * @since 2.1.0
1601
+ * @access public
1602
+ *
1603
+ * @param string $first Class for the first category
1604
+ * @param number $active_index active category index
1605
+ */
1606
+ protected function render_filter_tabs( $first, $active_index ) {
1607
+
1608
+ $settings = $this->get_settings_for_display();
1609
+
1610
+ ?>
1611
+
1612
+ <div class="premium-img-gallery-filter">
1613
+ <ul class="premium-gallery-cats-container">
1614
+ <?php if( 'yes' == $settings['premium_gallery_first_cat_switcher'] ) : ?>
1615
+ <li>
1616
+ <a href="javascript:;" class="category <?php echo $first; ?>" data-filter="*">
1617
+ <span><?php echo $settings['premium_gallery_first_cat_label']; ?></span>
1618
+ </a>
1619
+ </li>
1620
+ <?php endif;
1621
+ foreach( $settings['premium_gallery_cats_content'] as $index => $category ) {
1622
+ if( ! empty( $category['premium_gallery_img_cat'] ) ) {
1623
+ $cat_filtered = $this->filter_cats( $category['premium_gallery_img_cat'] );
1624
+
1625
+ $key = 'premium_grid_category_' . $index;
1626
+
1627
+ if( $active_index === $index ) {
1628
+ $this->add_render_attribute( $key, 'class', 'active' );
1629
+ }
1630
+
1631
+ $this->add_render_attribute( $key,
1632
+ 'class', [
1633
+ 'category',
1634
+ 'elementor-repeater-item-' . $category['_id']
1635
+ ]
1636
+ );
1637
+
1638
+ $slug = sprintf( '.%s', $cat_filtered );
1639
+
1640
+ $this->add_render_attribute( $key, 'data-filter', $slug );
1641
+ ?>
1642
+ <li>
1643
+ <a href="javascript:;" <?php echo $this->get_render_attribute_string( $key ); ?>>
1644
+ <span><?php echo $category['premium_gallery_img_cat']; ?></span>
1645
+ </a>
1646
+ </li>
1647
+ <?php }
1648
+ } ?>
1649
+ </ul>
1650
+ </div>
1651
+
1652
+ <?php
1653
+ }
1654
1655
+ /*
1656
+ * Render Grid Image
1657
+ *
1658
+ * Written in PHP and used to generate the final HTML for image.
1659
+ *
1660
+ * @since 3.6.4
1661
+ * @access protected
1662
+ *
1663
+ * @param array $item grid image repeater item
1664
+ * @param number $index item index
1665
+ */
1666
+ protected function render_grid_image( $item, $index ) {
1667
+
1668
+ $settings = $this->get_settings();
1669
+
1670
+ $alt = Control_Media::get_image_alt( $item['premium_gallery_img'] );
1671
+
1672
+ $key = 'image_' . $index;
1673
+
1674
+ if( $settings['premium_gallery_img_size_select'] == 'fitRows' ) {
1675
+ $image_src = $item['premium_gallery_img'];
1676
+ $image_src_size = Group_Control_Image_Size::get_attachment_image_src( $image_src['id'], 'thumbnail', $settings );
1677
+
1678
+ if( empty( $image_src_size ) ) {
1679
+ $image_src = $image_src['url'];
1680
+ } else {
1681
+ $image_src = $image_src_size;
1682
+ }
1683
+ } else {
1684
+ $image_src = $item['premium_gallery_img']['url'];
1685
+ }
1686
+
1687
+ $this->add_render_attribute( $key, [
1688
+ 'class' => 'pa-gallery-image',
1689
+ 'src' => $image_src,
1690
+ 'alt' => $alt
1691
+ ]);
1692
+
1693
+ ?>
1694
+ <img <?php echo $this->get_render_attribute_string( $key ); ?>>
1695
+ <?php
1696
+
1697
+ }
1698
+
1699
+ /*
1700
+ * Render Icons
1701
+ *
1702
+ * Render Lightbox and URL Icons HTML
1703
+ *
1704
+ * @since 3.6.4
1705
+ * @access protected
1706
+ *
1707
+ * @param array $item grid image repeater item
1708
+ * @param number $index item index
1709
+ */
1710
+ protected function render_icons( $item, $index ) {
1711
+
1712
+ $settings = $this->get_settings_for_display();
1713
+
1714
+ $lightbox_key = 'image_lightbox_' . $index;
1715
+
1716
+ $link_key = 'image_link_' . $index;
1717
+
1718
+ $href = $item['premium_gallery_img']['url'];
1719
1720
+ $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
1721
1722
+ $lightbox = $settings['premium_gallery_light_box'];
1723
1724
+ $lightbox_type = $settings['premium_gallery_lightbox_type'];
1725
1726
+
1727
+ if( 'yes' === $lightbox ) {
1728
+
1729
+ if( 'yes' !== $item['premium_gallery_lightbox_whole'] ) {
1730
+
1731
+ $this->add_render_attribute( $lightbox_key, [
1732
+ 'class' => 'pa-gallery-magnific-image',
1733
+ 'href' => $href,
1734
+ ]);
1735
+
1736
+ if( 'default' !== $lightbox_type ) {
1737
+ $this->add_render_attribute( $lightbox_key, [
1738
+ 'data-elementor-open-lightbox' => $lightbox_type
1739
+ ]);
1740
+ } else {
1741
+ $this->add_render_attribute( $lightbox_key, [
1742
+ 'data-rel' => $rel
1743
+ ]);
1744
+
1745
+ }
1746
1747
+ ?>
1748
+ <a <?php echo $this->get_render_attribute_string( $lightbox_key ); ?>>
1749
+ <span><i class="fa fa-search-plus"></i></span>
1750
+ </a>
1751
+ <?php
1752
+ }
1753
+ }
1754
+
1755
+
1756
+ if( ! empty( $item['premium_gallery_img_link']['url'] ) || ! empty ( $item['premium_gallery_img_existing'] ) ) {
1757
+
1758
+ if( 'yes' !== $item['premium_gallery_link_whole'] ) {
1759
+
1760
+ $icon_link = '';
1761
+
1762
+ $this->add_render_attribute( $link_key, [
1763
+ 'class' => 'pa-gallery-img-link',
1764
+ ]);
1765
+
1766
+ if( 'url' === $item['premium_gallery_img_link_type'] && ! empty( $item['premium_gallery_img_link']['url'] ) ) {
1767
+
1768
+ $icon_link = $item['premium_gallery_img_link']['url'];
1769
+
1770
+ $external = $item['premium_gallery_img_link']['is_external'] ? '_blank' : '';
1771
+
1772
+ $no_follow = $item['premium_gallery_img_link']['nofollow'] ? 'nofollow' : '';
1773
+
1774
+ $this->add_render_attribute( $link_key, [
1775
+ 'href' => $icon_link,
1776
+ 'target' => $external,
1777
+ 'rel' => $no_follow
1778
+ ]);
1779
+
1780
+ } elseif( 'link' === $item['premium_gallery_img_link_type'] && ! empty( $item['premium_gallery_img_existing']['url'] ) ) {
1781
+
1782
+ $icon_link = get_permalink( $item['premium_gallery_img_existing'] );
1783
+
1784
+ $this->add_render_attribute( $link_key, [
1785
+ 'href' => $icon_link
1786
+ ]);
1787
+
1788
+ }
1789
+
1790
+ if ( ! empty ( $icon_link ) ) {
1791
+ ?>
1792
+ <a <?php echo $this->get_render_attribute_string( $link_key ); ?>>
1793
+ <span><i class="fa fa-link"></i></span>
1794
+ </a>
1795
+ <?php
1796
+ }
1797
+ }
1798
+ }
1799
+ }
1800
+
1801
+ /*
1802
+ * Render Image Caption
1803
+ *
1804
+ * Written in PHP to render the final HTML for image title and description
1805
+ *
1806
+ * @since 3.6.4
1807
+ * @access proteced
1808
+ *
1809
+ * @param array $item grid image repeater item
1810
+ */
1811
+ protected function render_image_caption( $item ) {
1812
+
1813
+ $title = $item['premium_gallery_img_name'];
1814
+
1815
+ $description = $item['premium_gallery_img_desc'];
1816
+
1817
+ if( ! empty( $title ) || ! empty( $description ) ) : ?>
1818
+ <div class="premium-gallery-caption">
1819
+
1820
+ <?php if( ! empty( $title ) ) : ?>
1821
+ <span class="premium-gallery-img-name"><?php echo $title; ?></span>
1822
+ <?php endif;
1823
+
1824
+ if( ! empty( $description ) ) : ?>
1825
+ <p class="premium-gallery-img-desc"><?php echo $description; ?></p>
1826
+ <?php endif; ?>
1827
+
1828
+ </div>
1829
+ <?php endif;
1830
+ }
1831
+
1832
+ /**
1833
+ * Render Grid output on the frontend.
1834
+ *
1835
+ * Written in PHP and used to generate the final HTML.
1836
+ *
1837
+ * @since 2.1.0
1838
+ * @access protected
1839
+ */
1840
+ protected function render() {
1841
+
1842
+ $settings = $this->get_settings_for_display();
1843
+
1844
+ $filter = $settings['premium_gallery_filter'];
1845
+
1846
+ $layout = $settings['premium_gallery_img_style'];
1847
+
1848
+ $lightbox = $settings['premium_gallery_light_box'];
1849
+
1850
+ $lightbox_type = $settings['premium_gallery_lightbox_type'];
1851
+
1852
+ if ( 'yes' === $settings['premium_gallery_responsive_switcher'] ) {
1853
+ $min_size = $settings['premium_gallery_min_range'] . 'px';
1854
+ $max_size = $settings['premium_gallery_max_range'] . 'px';
1855
+ }
1856
+
1857
+ $category = "*";
1858
+
1859
+ if ( 'yes' === $filter ) {
1860
+
1861
+ if( 'yes' !== $settings['premium_gallery_first_cat_switcher'] ) {
1862
+ $active_index = $settings['premium_gallery_active_cat'];
1863
+ $active_category = $settings['premium_gallery_cats_content'][$active_index]['premium_gallery_img_cat'];
1864
+ $category = "." . $this->filter_cats( $active_category );
1865
+ }
1866
+
1867
+ if ( ! empty( $settings['premium_gallery_active_cat'] ) ) {
1868
+ $active_category_index = 'yes' === $settings['premium_gallery_first_cat_switcher'] ? $settings['premium_gallery_active_cat'] - 1 : $settings['premium_gallery_active_cat'];
1869
+ } else {
1870
+ $active_category_index = -1;
1871
+ }
1872
+
1873
+ $is_all_active = ( 0 > $active_category_index ) ? "active" : "";
1874
+
1875
}
1876
1877
if ( 'original' === $settings['premium_gallery_img_size_select'] ) {
1880
$settings['premium_gallery_img_size_select'] = 'fitRows';
1881