PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / admin / popup-builder / class-popup-document.php

class-popup-document.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at inc/admin/popup-builder/class-popup-document.php

1,220 lines 46.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Master Addons Popup Document Type for Elementor
5 *
6 * @package MasterAddons
7 * @subpackage PopupBuilder
8 */
9
10 namespace MasterAddons\Inc\Admin\PopupBuilder;
11
12 use MasterAddons\Inc\Classes\Helper;
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 if (!class_exists('\Elementor\Core\Base\Document')) {
19 return;
20 }
21
22 class Popup_Document extends \Elementor\Core\Base\Document
23 {
24
25 public function get_name()
26 {
27 return 'jltma_popup';
28 }
29
30 public static function get_title()
31 {
32 return __('MA Popup', 'master-addons');
33 }
34
35 public static function get_type()
36 {
37 return 'jltma_popup';
38 }
39
40 public function get_css_wrapper_selector()
41 {
42 if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
43 return '.jltma-template-popup';
44 } else {
45 return '#jltma-popup-id-' . $this->get_main_id();
46 }
47 }
48
49 public static function get_properties()
50 {
51 $properties = parent::get_properties();
52
53 $properties['support_kit'] = true;
54 $properties['show_in_finder'] = true;
55 $properties['show_on_admin_bar'] = false;
56
57 return $properties;
58 }
59
60 public static function get_editor_panel_config()
61 {
62 $config = parent::get_editor_panel_config();
63
64 $config['has_elements'] = true;
65 $config['support_kit'] = true;
66 $config['widgets_settings']['theme_builder_promotion'] = [
67 'show' => false,
68 ];
69
70 return $config;
71 }
72
73 protected function get_remote_library_config()
74 {
75 $config = parent::get_remote_library_config();
76 $config['type'] = 'popup';
77 $config['default_route'] = 'templates/popups';
78 return $config;
79 }
80
81
82
83
84 protected function register_controls()
85 {
86 // Settings Section
87 $this->start_controls_section(
88 'popup_trigger_settings',
89 [
90 'label' => __('Settings', 'master-addons'),
91 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
92 ]
93 );
94
95 // Free: all options visible with "(Pro)" labels. Pro filter removes the labels.
96 $trigger_options = apply_filters('master_addons/popup_builder/trigger_options', [
97 'page-load' => __('On Page Load', 'master-addons'),
98 'on-click' => __('On Click (Pro)', 'master-addons'),
99 'on-scroll' => __('On Scroll (Pro)', 'master-addons'),
100 'on-scroll-to-element' => __('On Scroll to Element (Pro)', 'master-addons'),
101 'on-exit-intent' => __('On Exit Intent (Pro)', 'master-addons'),
102 'after-inactivity' => __('After Inactivity (Pro)', 'master-addons'),
103 'custom' => __('Custom (Pro)', 'master-addons'),
104 ]);
105
106 $this->add_control(
107 'popup_trigger',
108 [
109 'label' => __('Open Popup', 'master-addons'),
110 'type' => \Elementor\Controls_Manager::SELECT,
111 'default' => 'page-load',
112 'options' => $trigger_options,
113 ]
114 );
115
116 $this->add_control(
117 'popup_load_delay',
118 [
119 'label' => __('Delay after Page Load (sec)', 'master-addons'),
120 'type' => \Elementor\Controls_Manager::NUMBER,
121 'default' => 1,
122 'min' => 0,
123 'max' => 60,
124 'step' => 0.1,
125 'condition' => [
126 'popup_trigger' => 'page-load',
127 ],
128 ]
129 );
130
131 // Pro trigger controls (scroll amount, element selector, click selector, inactivity time)
132 do_action('master_addons/popup_builder/after_trigger_controls', $this);
133
134 // Free: all options visible. Original free options + pro extras with "(Pro)" labels.
135 $delay_options = apply_filters('master_addons/popup_builder/delay_options', [
136 'no-delay' => __('No Delay', 'master-addons'),
137 'do-not-show' => __('Do Not Show Again (Pro)', 'master-addons'),
138 '1-minute' => __('1 Minute', 'master-addons'),
139 '3-minutes' => __('3 Minutes', 'master-addons'),
140 '5-minutes' => __('5 Minutes', 'master-addons'),
141 '10-minutes' => __('10 Minutes (Pro)', 'master-addons'),
142 '30-minutes' => __('30 Minutes (Pro)', 'master-addons'),
143 '1-hour' => __('1 Hour (Pro)', 'master-addons'),
144 '3-hours' => __('3 Hours (Pro)', 'master-addons'),
145 '6-hours' => __('6 Hours (Pro)', 'master-addons'),
146 '12-hours' => __('12 Hours (Pro)', 'master-addons'),
147 '1-day' => __('1 Day (Pro)', 'master-addons'),
148 '3-days' => __('3 Days (Pro)', 'master-addons'),
149 '5-days' => __('5 Days (Pro)', 'master-addons'),
150 '1-week' => __('1 Week (Pro)', 'master-addons'),
151 '7-days' => __('7 Days (Pro)', 'master-addons'),
152 '10-days' => __('10 Days (Pro)', 'master-addons'),
153 '15-days' => __('15 Days (Pro)', 'master-addons'),
154 '20-days' => __('20 Days (Pro)', 'master-addons'),
155 '1-month' => __('1 Month (Pro)', 'master-addons'),
156 ]);
157
158 $this->add_control(
159 'popup_show_again_delay',
160 [
161 'label' => __('Show Again Delay', 'master-addons'),
162 'type' => \Elementor\Controls_Manager::SELECT,
163 'default' => 'no-delay',
164 'options' => $delay_options,
165 'description' => __('This option determines when to show popup again to a visitor after it is closed.', 'master-addons'),
166 ]
167 );
168
169 $this->add_control(
170 'popup_disable_page_scroll',
171 [
172 'label' => __('Disable Page Scroll', 'master-addons'),
173 'type' => \Elementor\Controls_Manager::SWITCHER,
174 'default' => 'yes',
175 'label_on' => __('Yes', 'master-addons'),
176 'label_off' => __('No', 'master-addons'),
177 ]
178 );
179
180 // Disable popup automatically (Pro feature — lock icon + upgrade link in free)
181 $disable_auto_control = apply_filters('master_addons/popup_builder/disable_automatic_control', [
182 'label' => esc_html__('Disable popup automatically (Pro)', 'master-addons'),
183 'type' => \Elementor\Controls_Manager::CHOOSE,
184 'options' => [
185 '1' => [
186 'title' => '',
187 'icon' => 'eicon-lock',
188 ],
189 ],
190 'default' => '1',
191 'description' => Helper::upgrade_to_pro('Disable popup automatically available on'),
192 ]);
193
194 $this->add_control('popup_disable_automatic', $disable_auto_control);
195
196 $disable_after_control = apply_filters('master_addons/popup_builder/disable_after_control', [
197 'label' => esc_html__('Disable After (Pro)', 'master-addons'),
198 'type' => \Elementor\Controls_Manager::CHOOSE,
199 'options' => [
200 '1' => [
201 'title' => '',
202 'icon' => 'eicon-lock',
203 ],
204 ],
205 'default' => '1',
206 'description' => Helper::upgrade_to_pro('Disable after date available on'),
207 ]);
208
209
210 if (apply_filters('master_addons/popup_builder/show_pro_notices', true)) {
211 $this->add_control(
212 'popup_disable_automatic_notice',
213 [
214 'label' => '',
215 'type' => \Elementor\Controls_Manager::RAW_HTML,
216 'raw' => Helper::jltma_pro_upgrade_message(),
217 ]
218 );
219 }
220
221
222 $this->add_control('popup_disable_after', $disable_after_control);
223
224 // Hook point for additional pro settings controls
225 do_action('master_addons/popup_builder/after_settings_controls', $this);
226
227 $this->end_controls_section();
228
229 // Layout Section
230 $this->start_controls_section(
231 'popup_layout_settings',
232 [
233 'label' => __('Layout', 'master-addons'),
234 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
235 ]
236 );
237
238 $this->add_control(
239 'popup_display_as',
240 [
241 'label' => __('Display As', 'master-addons'),
242 'type' => \Elementor\Controls_Manager::SELECT,
243 'default' => 'modal',
244 'options' => [
245 'modal' => __('Popup Modal', 'master-addons'),
246 'notification' => __('Notification Bar', 'master-addons'),
247 'fullscreen' => __('Fullscreen', 'master-addons'),
248 ],
249 'prefix_class' => 'jltma-popup-',
250 ]
251 );
252
253 $this->add_control(
254 'popup_position',
255 [
256 'label' => __('Position', 'master-addons'),
257 'type' => \Elementor\Controls_Manager::SELECT,
258 'default' => 'center-center',
259 'options' => [
260 'center-center' => __('Center Center', 'master-addons'),
261 'center-left' => __('Center Left', 'master-addons'),
262 'center-right' => __('Center Right', 'master-addons'),
263 'top-left' => __('Top Left', 'master-addons'),
264 'top-center' => __('Top Center', 'master-addons'),
265 'top-right' => __('Top Right', 'master-addons'),
266 'bottom-left' => __('Bottom Left', 'master-addons'),
267 'bottom-center' => __('Bottom Center', 'master-addons'),
268 'bottom-right' => __('Bottom Right', 'master-addons'),
269 ],
270 'condition' => [
271 'popup_display_as' => 'modal',
272 ],
273 ]
274 );
275
276 $this->add_control(
277 'popup_animation',
278 [
279 'label' => __('Animation', 'master-addons'),
280 'type' => \Elementor\Controls_Manager::SELECT,
281 'default' => 'jltma-anim-fade-in',
282 'options' => [
283 // Fade
284 'jltma-anim-fade-in' => __('Fade In', 'master-addons'),
285 'jltma-anim-fade-in-down' => __('Fade In Down', 'master-addons'),
286 'jltma-anim-fade-in-down-1' => __('Fade In Down 1', 'master-addons'),
287 'jltma-anim-fade-in-down-2' => __('Fade In Down 2', 'master-addons'),
288 'jltma-anim-fade-in-up' => __('Fade In Up', 'master-addons'),
289 'jltma-anim-fade-in-up-1' => __('Fade In Up 1', 'master-addons'),
290 'jltma-anim-fade-in-up-2' => __('Fade In Up 2', 'master-addons'),
291 'jltma-anim-fade-in-left' => __('Fade In Left', 'master-addons'),
292 'jltma-anim-fade-in-left-1' => __('Fade In Left 1', 'master-addons'),
293 'jltma-anim-fade-in-left-2' => __('Fade In Left 2', 'master-addons'),
294 'jltma-anim-fade-in-right' => __('Fade In Right', 'master-addons'),
295 'jltma-anim-fade-in-right-1' => __('Fade In Right 1', 'master-addons'),
296 'jltma-anim-fade-in-right-2' => __('Fade In Right 2', 'master-addons'),
297 // Slide
298 'jltma-anim-slide-from-right' => __('Slide From Right', 'master-addons'),
299 'jltma-anim-slide-from-left' => __('Slide From Left', 'master-addons'),
300 'jltma-anim-slide-from-top' => __('Slide From Top', 'master-addons'),
301 'jltma-anim-slide-from-bot' => __('Slide From Bottom', 'master-addons'),
302 // Mask
303 'jltma-anim-mask-from-top' => __('Mask From Top', 'master-addons'),
304 'jltma-anim-mask-from-bot' => __('Mask From Bottom', 'master-addons'),
305 'jltma-anim-mask-from-left' => __('Mask From Left', 'master-addons'),
306 'jltma-anim-mask-from-right' => __('Mask From Right', 'master-addons'),
307 // Rotate
308 'jltma-anim-rotate-in' => __('Rotate In', 'master-addons'),
309 'jltma-anim-rotate-in-down-left' => __('Rotate In Down Left', 'master-addons'),
310 'jltma-anim-rotate-in-down-left-1' => __('Rotate In Down Left 1', 'master-addons'),
311 'jltma-anim-rotate-in-down-left-2' => __('Rotate In Down Left 2', 'master-addons'),
312 'jltma-anim-rotate-in-down-right' => __('Rotate In Down Right', 'master-addons'),
313 'jltma-anim-rotate-in-down-right-1' => __('Rotate In Down Right 1', 'master-addons'),
314 'jltma-anim-rotate-in-down-right-2' => __('Rotate In Down Right 2', 'master-addons'),
315 'jltma-anim-rotate-in-up-left' => __('Rotate In Up Left', 'master-addons'),
316 'jltma-anim-rotate-in-up-left-1' => __('Rotate In Up Left 1', 'master-addons'),
317 'jltma-anim-rotate-in-up-left-2' => __('Rotate In Up Left 2', 'master-addons'),
318 'jltma-anim-rotate-in-up-right' => __('Rotate In Up Right', 'master-addons'),
319 'jltma-anim-rotate-in-up-right-1' => __('Rotate In Up Right 1', 'master-addons'),
320 'jltma-anim-rotate-in-up-right-2' => __('Rotate In Up Right 2', 'master-addons'),
321 // Zoom
322 'jltma-anim-zoom-in' => __('Zoom In', 'master-addons'),
323 'jltma-anim-zoom-in-1' => __('Zoom In 1', 'master-addons'),
324 'jltma-anim-zoom-in-2' => __('Zoom In 2', 'master-addons'),
325 'jltma-anim-zoom-in-3' => __('Zoom In 3', 'master-addons'),
326 // Scale
327 'jltma-anim-scale-up' => __('Scale Up', 'master-addons'),
328 'jltma-anim-scale-up-1' => __('Scale Up 1', 'master-addons'),
329 'jltma-anim-scale-up-2' => __('Scale Up 2', 'master-addons'),
330 'jltma-anim-scale-down' => __('Scale Down', 'master-addons'),
331 'jltma-anim-scale-down-1' => __('Scale Down 1', 'master-addons'),
332 'jltma-anim-scale-down-2' => __('Scale Down 2', 'master-addons'),
333 // Flip
334 'jltma-anim-flip-in-down' => __('Flip In Down', 'master-addons'),
335 'jltma-anim-flip-in-down-1' => __('Flip In Down 1', 'master-addons'),
336 'jltma-anim-flip-in-down-2' => __('Flip In Down 2', 'master-addons'),
337 'jltma-anim-flip-in-up' => __('Flip In Up', 'master-addons'),
338 'jltma-anim-flip-in-up-1' => __('Flip In Up 1', 'master-addons'),
339 'jltma-anim-flip-in-up-2' => __('Flip In Up 2', 'master-addons'),
340 'jltma-anim-flip-in-left' => __('Flip In Left', 'master-addons'),
341 'jltma-anim-flip-in-left-1' => __('Flip In Left 1', 'master-addons'),
342 'jltma-anim-flip-in-left-2' => __('Flip In Left 2', 'master-addons'),
343 'jltma-anim-flip-in-left-3' => __('Flip In Left 3', 'master-addons'),
344 'jltma-anim-flip-in-right' => __('Flip In Right', 'master-addons'),
345 'jltma-anim-flip-in-right-1' => __('Flip In Right 1', 'master-addons'),
346 'jltma-anim-flip-in-right-2' => __('Flip In Right 2', 'master-addons'),
347 'jltma-anim-flip-in-right-3' => __('Flip In Right 3', 'master-addons'),
348 // Pulse
349 'jltma-anim-pulse-in' => __('Pulse In 1', 'master-addons'),
350 'jltma-anim-pulse-in-1' => __('Pulse In 2', 'master-addons'),
351 'jltma-anim-pulse-in-2' => __('Pulse In 3', 'master-addons'),
352 'jltma-anim-pulse-in-3' => __('Pulse In 4', 'master-addons'),
353 'jltma-anim-pulse-in-4' => __('Pulse In 5', 'master-addons'),
354 'jltma-anim-pulse-out-1' => __('Pulse Out 1', 'master-addons'),
355 'jltma-anim-pulse-out-2' => __('Pulse Out 2', 'master-addons'),
356 'jltma-anim-pulse-out-3' => __('Pulse Out 3', 'master-addons'),
357 'jltma-anim-pulse-out-4' => __('Pulse Out 4', 'master-addons'),
358 // Specials
359 'jltma-anim-shake' => __('Shake', 'master-addons'),
360 'jltma-anim-bounce-in' => __('Bounce In', 'master-addons'),
361 'jltma-anim-jack-in-box' => __('Jack In the Box', 'master-addons'),
362 ],
363 ]
364 );
365
366 $this->add_control(
367 'popup_animation_duration',
368 [
369 'label' => __('Animation Duration (ms)', 'master-addons'),
370 'type' => \Elementor\Controls_Manager::NUMBER,
371 'default' => 400,
372 'min' => 0,
373 'max' => 5000,
374 'step' => 50,
375 ]
376 );
377
378 $this->add_responsive_control(
379 'popup_width',
380 [
381 'label' => __('Width', 'master-addons'),
382 'type' => \Elementor\Controls_Manager::SLIDER,
383 'size_units' => ['px', '%', 'vw'],
384 'range' => [
385 'px' => [
386 'min' => 200,
387 'max' => 1920,
388 ],
389 '%' => [
390 'min' => 10,
391 'max' => 100,
392 ],
393 'vw' => [
394 'min' => 10,
395 'max' => 100,
396 ],
397 ],
398 'default' => [
399 'unit' => 'px',
400 'size' => 640,
401 ],
402 'selectors' => [
403 '{{WRAPPER}} .jltma-popup-container' => 'width: {{SIZE}}{{UNIT}};',
404 ],
405 ]
406 );
407
408 $this->add_responsive_control(
409 'popup_height',
410 [
411 'label' => __('Height', 'master-addons'),
412 'type' => \Elementor\Controls_Manager::SLIDER,
413 'size_units' => ['px', '%', 'vh'],
414 'range' => [
415 'px' => [
416 'min' => 100,
417 'max' => 1920,
418 ],
419 '%' => [
420 'min' => 10,
421 'max' => 100,
422 ],
423 'vh' => [
424 'min' => 10,
425 'max' => 100,
426 ],
427 ],
428 'selectors' => [
429 '{{WRAPPER}}' => 'height: {{SIZE}}{{UNIT}};',
430 ],
431 ]
432 );
433
434 $this->add_control(
435 'popup_custom_positioning',
436 [
437 'label' => __('Custom Positioning', 'master-addons'),
438 'type' => \Elementor\Controls_Manager::SWITCHER,
439 'default' => '',
440 'label_on' => __('Yes', 'master-addons'),
441 'label_off' => __('No', 'master-addons'),
442 ]
443 );
444
445 $this->add_responsive_control(
446 'popup_top_distance',
447 [
448 'label' => __('Top Distance', 'master-addons'),
449 'type' => \Elementor\Controls_Manager::SLIDER,
450 'size_units' => ['px', '%'],
451 'range' => [
452 'px' => [
453 'min' => 0,
454 'max' => 1000,
455 ],
456 '%' => [
457 'min' => 0,
458 'max' => 100,
459 ],
460 ],
461 'condition' => [
462 'popup_custom_positioning' => 'yes',
463 ],
464 'selectors' => [
465 '.jltma-popup-container' => 'top: {{SIZE}}{{UNIT}} !important; position: fixed !important; transform: none !important;',
466 ],
467 ]
468 );
469
470 $this->add_responsive_control(
471 'popup_left_distance',
472 [
473 'label' => __('Left Distance', 'master-addons'),
474 'type' => \Elementor\Controls_Manager::SLIDER,
475 'size_units' => ['px', '%'],
476 'range' => [
477 'px' => [
478 'min' => 0,
479 'max' => 1000,
480 ],
481 '%' => [
482 'min' => 0,
483 'max' => 100,
484 ],
485 ],
486 'condition' => [
487 'popup_custom_positioning' => 'yes',
488 ],
489 'selectors' => [
490 '.jltma-popup-container' => 'left: {{SIZE}}{{UNIT}} !important;',
491 ],
492 ]
493 );
494
495 $this->add_responsive_control(
496 'popup_bottom_distance',
497 [
498 'label' => __('Bottom Distance', 'master-addons'),
499 'type' => \Elementor\Controls_Manager::SLIDER,
500 'size_units' => ['px', '%'],
501 'range' => [
502 'px' => [
503 'min' => 0,
504 'max' => 1000,
505 ],
506 '%' => [
507 'min' => 0,
508 'max' => 100,
509 ],
510 ],
511 'condition' => [
512 'popup_custom_positioning' => 'yes',
513 ],
514 'selectors' => [
515 '.jltma-popup-container' => 'bottom: {{SIZE}}{{UNIT}} !important; top: auto !important;',
516 ],
517 ]
518 );
519
520 $this->add_responsive_control(
521 'popup_right_distance',
522 [
523 'label' => __('Right Distance', 'master-addons'),
524 'type' => \Elementor\Controls_Manager::SLIDER,
525 'size_units' => ['px', '%'],
526 'range' => [
527 'px' => [
528 'min' => 0,
529 'max' => 1000,
530 ],
531 '%' => [
532 'min' => 0,
533 'max' => 100,
534 ],
535 ],
536 'condition' => [
537 'popup_custom_positioning' => 'yes',
538 ],
539 'selectors' => [
540 '.jltma-popup-container' => 'right: {{SIZE}}{{UNIT}} !important; left: auto !important;',
541 ],
542 ]
543 );
544
545 $this->add_control(
546 'popup_custom_width',
547 [
548 'label' => __('Custom Width', 'master-addons'),
549 'type' => \Elementor\Controls_Manager::SLIDER,
550 'size_units' => ['px', '%', 'vw'],
551 'range' => [
552 'px' => [
553 'min' => 100,
554 'max' => 2000,
555 ],
556 '%' => [
557 'min' => 10,
558 'max' => 100,
559 ],
560 'vw' => [
561 'min' => 10,
562 'max' => 100,
563 ],
564 ],
565 'condition' => [
566 'popup_custom_positioning' => 'yes',
567 ],
568 'selectors' => [
569 '.jltma-popup-container' => 'width: {{SIZE}}{{UNIT}} !important; max-width: {{SIZE}}{{UNIT}} !important;',
570 ],
571 ]
572 );
573
574 $this->add_control(
575 'popup_custom_height',
576 [
577 'label' => __('Custom Height', 'master-addons'),
578 'type' => \Elementor\Controls_Manager::SLIDER,
579 'size_units' => ['px', '%', 'vh'],
580 'range' => [
581 'px' => [
582 'min' => 100,
583 'max' => 2000,
584 ],
585 '%' => [
586 'min' => 10,
587 'max' => 100,
588 ],
589 'vh' => [
590 'min' => 10,
591 'max' => 100,
592 ],
593 ],
594 'condition' => [
595 'popup_custom_positioning' => 'yes',
596 ],
597 'selectors' => [
598 '.jltma-popup-container' => 'height: {{SIZE}}{{UNIT}} !important; max-height: {{SIZE}}{{UNIT}} !important;',
599 ],
600 ]
601 );
602
603 $this->end_controls_section();
604
605 // Overlay Section
606 $this->start_controls_section(
607 'popup_overlay_settings',
608 [
609 'label' => __('Overlay', 'master-addons'),
610 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
611 'condition' => [
612 'popup_display_as' => 'modal',
613 ],
614 ]
615 );
616
617 $this->add_control(
618 'popup_show_overlay',
619 [
620 'label' => __('Show Overlay', 'master-addons'),
621 'type' => \Elementor\Controls_Manager::SWITCHER,
622 'default' => 'yes',
623 'label_on' => __('Yes', 'master-addons'),
624 'label_off' => __('No', 'master-addons'),
625 ]
626 );
627
628 $this->add_group_control(
629 \Elementor\Group_Control_Background::get_type(),
630 [
631 'name' => 'popup_overlay_bg',
632 'label' => __('Background', 'master-addons'),
633 'types' => ['classic', 'gradient'],
634 'fields_options' => [
635 'color' => [
636 'default' => 'rgba(0,0,0,0.75)',
637 ],
638 ],
639 'selector' => '{{WRAPPER}} .jltma-popup-overlay',
640 'condition' => [
641 'popup_show_overlay' => 'yes',
642 ],
643 ]
644 );
645
646 $this->add_control(
647 'popup_close_on_overlay',
648 [
649 'label' => __('Close on Overlay Click', 'master-addons'),
650 'type' => \Elementor\Controls_Manager::SWITCHER,
651 'default' => 'yes',
652 'label_on' => __('Yes', 'master-addons'),
653 'label_off' => __('No', 'master-addons'),
654 'condition' => [
655 'popup_show_overlay' => 'yes',
656 ],
657 ]
658 );
659
660 $this->end_controls_section();
661
662 // Close Button Section
663 $this->start_controls_section(
664 'popup_close_button_settings',
665 [
666 'label' => __('Close Button', 'master-addons'),
667 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
668 ]
669 );
670
671 $this->add_control(
672 'popup_show_close_button',
673 [
674 'label' => __('Show Close Button', 'master-addons'),
675 'type' => \Elementor\Controls_Manager::SWITCHER,
676 'default' => 'yes',
677 'label_on' => __('Yes', 'master-addons'),
678 'label_off' => __('No', 'master-addons'),
679 ]
680 );
681
682 $this->add_control(
683 'popup_close_button_position',
684 [
685 'label' => __('Position', 'master-addons'),
686 'type' => \Elementor\Controls_Manager::SELECT,
687 'default' => 'top-right',
688 'options' => [
689 'top-left' => __('Top Left', 'master-addons'),
690 'top-right' => __('Top Right', 'master-addons'),
691 'inside-top-left' => __('Inside Top Left', 'master-addons'),
692 'inside-top-right' => __('Inside Top Right', 'master-addons'),
693 ],
694 'condition' => [
695 'popup_show_close_button' => 'yes',
696 ],
697 ]
698 );
699
700 $close_esc_control = apply_filters('master_addons/popup_builder/close_esc_key_control', [
701 'label' => esc_html__('Close on ESC Key (Pro)', 'master-addons'),
702 'type' => \Elementor\Controls_Manager::CHOOSE,
703 'options' => [
704 '1' => [
705 'title' => '',
706 'icon' => 'eicon-lock',
707 ],
708 ],
709 'default' => '1',
710 'description' => Helper::upgrade_to_pro('Close on ESC Key available on'),
711 ]);
712
713 $this->add_control('popup_close_esc_key', $close_esc_control);
714
715 // Pro close button controls hook point
716 do_action('master_addons/popup_builder/after_close_button_controls', $this);
717
718 $this->end_controls_section();
719
720 // Style Tab Sections (registered before parent to appear before Advanced tab)
721 $this->start_controls_section(
722 'popup_container_styles',
723 [
724 'label' => __('Popup', 'master-addons'),
725 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
726 ]
727 );
728
729 $this->add_group_control(
730 \Elementor\Group_Control_Background::get_type(),
731 [
732 'name' => 'popup_container_bg',
733 'label' => __('Background', 'master-addons'),
734 'types' => ['classic', 'gradient'],
735 'fields_options' => [
736 'color' => [
737 'default' => '#ffffff',
738 ],
739 ],
740 'selector' => '{{WRAPPER}} .jltma-popup-container-inner'
741 ]
742 );
743
744 $this->add_control(
745 'popup_scrollbar_color',
746 [
747 'label' => __('ScrollBar Color', 'master-addons'),
748 'type' => \Elementor\Controls_Manager::COLOR,
749 'default' => '#333333',
750 'selectors' => [
751 '{{WRAPPER}} .jltma-popup-container-inner::-webkit-scrollbar-thumb' => 'background-color: {{VALUE}}',
752 ],
753 ]
754 );
755
756 $this->add_responsive_control(
757 'popup_container_padding',
758 [
759 'label' => __('Padding', 'master-addons'),
760 'type' => \Elementor\Controls_Manager::DIMENSIONS,
761 'size_units' => ['px', '%'],
762 'default' => [
763 'top' => 20,
764 'right' => 20,
765 'bottom' => 20,
766 'left' => 20,
767 ],
768 'selectors' => [
769 '{{WRAPPER}} .jltma-popup-container-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
770 ],
771 'separator' => 'before'
772 ]
773 );
774
775 $this->add_control(
776 'popup_container_radius',
777 [
778 'label' => __('Border Radius', 'master-addons'),
779 'type' => \Elementor\Controls_Manager::DIMENSIONS,
780 'size_units' => ['px', '%'],
781 'default' => [
782 'top' => 0,
783 'right' => 0,
784 'bottom' => 0,
785 'left' => 0,
786 ],
787 'selectors' => [
788 '{{WRAPPER}} .jltma-popup-container-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
789 ],
790 'separator' => 'before',
791 ]
792 );
793
794 $this->add_group_control(
795 \Elementor\Group_Control_Border::get_type(),
796 [
797 'name' => 'popup_container_border',
798 'label' => __('Border', 'master-addons'),
799 'selector' => '{{WRAPPER}} .jltma-popup-container-inner',
800 'separator' => 'before'
801 ]
802 );
803
804 $this->add_group_control(
805 \Elementor\Group_Control_Box_Shadow::get_type(),
806 [
807 'name' => 'popup_container_shadow',
808 'selector' => '{{WRAPPER}} .jltma-popup-container-inner'
809 ]
810 );
811
812 $this->end_controls_section();
813
814 // Close Button Styles
815 $this->start_controls_section(
816 'popup_close_btn_styles',
817 [
818 'label' => __('Close Button', 'master-addons'),
819 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
820 ]
821 );
822
823 $this->start_controls_tabs('tabs_popup_close_btn_style');
824
825 $this->start_controls_tab(
826 'tab_popup_close_btn_normal',
827 [
828 'label' => __('Normal', 'master-addons'),
829 ]
830 );
831
832 $this->add_control(
833 'popup_close_btn_color',
834 [
835 'label' => __('Color', 'master-addons'),
836 'type' => \Elementor\Controls_Manager::COLOR,
837 'default' => '#6b7280',
838 'selectors' => [
839 '{{WRAPPER}} .jltma-popup-close-btn' => 'color: {{VALUE}}',
840 ],
841 ]
842 );
843
844 $this->add_control(
845 'popup_close_btn_bg_color',
846 [
847 'label' => __('Background Color', 'master-addons'),
848 'type' => \Elementor\Controls_Manager::COLOR,
849 'selectors' => [
850 '{{WRAPPER}} .jltma-popup-close-btn' => 'background-color: {{VALUE}}',
851 ]
852 ]
853 );
854
855 $this->add_control(
856 'popup_close_btn_border_color',
857 [
858 'label' => __('Border Color', 'master-addons'),
859 'type' => \Elementor\Controls_Manager::COLOR,
860 'default' => '#e0e0e0',
861 'selectors' => [
862 '{{WRAPPER}} .jltma-popup-close-btn' => 'border-color: {{VALUE}}',
863 ],
864 ]
865 );
866
867 $this->add_group_control(
868 \Elementor\Group_Control_Box_Shadow::get_type(),
869 [
870 'name' => 'popup_close_btn_box_shadow',
871 'selector' => '{{WRAPPER}} .jltma-popup-close-btn',
872 ]
873 );
874
875 $this->end_controls_tab();
876
877 $this->start_controls_tab(
878 'tab_popup_close_btn_hover',
879 [
880 'label' => __('Hover', 'master-addons'),
881 ]
882 );
883
884 $this->add_control(
885 'popup_close_btn_color_hr',
886 [
887 'label' => __('Color', 'master-addons'),
888 'type' => \Elementor\Controls_Manager::COLOR,
889 'default' => '#54595f',
890 'selectors' => [
891 '{{WRAPPER}} .jltma-popup-close-btn:hover' => 'color: {{VALUE}}',
892 ],
893 ]
894 );
895
896 $this->add_control(
897 'popup_close_btn_bg_color_hr',
898 [
899 'label' => __('Background Color', 'master-addons'),
900 'type' => \Elementor\Controls_Manager::COLOR,
901 'selectors' => [
902 '{{WRAPPER}} .jltma-popup-close-btn:hover' => 'background-color: {{VALUE}}',
903 ]
904 ]
905 );
906
907 $this->add_control(
908 'popup_close_btn_border_color_hr',
909 [
910 'label' => __('Border Color', 'master-addons'),
911 'type' => \Elementor\Controls_Manager::COLOR,
912 'selectors' => [
913 '{{WRAPPER}} .jltma-popup-close-btn:hover' => 'border-color: {{VALUE}}',
914 ]
915 ]
916 );
917
918 $this->end_controls_tab();
919
920 $this->end_controls_tabs();
921
922 $this->add_control(
923 'popup_close_btn_size',
924 [
925 'label' => __('Size', 'master-addons'),
926 'type' => \Elementor\Controls_Manager::SLIDER,
927 'size_units' => ['px'],
928 'range' => [
929 'px' => [
930 'min' => 10,
931 'max' => 100,
932 ],
933 ],
934 'default' => [
935 'unit' => 'px',
936 'size' => 16,
937 ],
938 'selectors' => [
939 '{{WRAPPER}} .jltma-popup-close-btn svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
940 ],
941 ]
942 );
943
944 $this->add_control(
945 'popup_close_btn_box_size',
946 [
947 'label' => __('Box Size', 'master-addons'),
948 'type' => \Elementor\Controls_Manager::SLIDER,
949 'size_units' => ['px'],
950 'range' => [
951 'px' => [
952 'min' => 10,
953 'max' => 100,
954 ],
955 ],
956 'default' => [
957 'unit' => 'px',
958 'size' => 36,
959 ],
960 'selectors' => [
961 '{{WRAPPER}} .jltma-popup-close-btn' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
962 ],
963 'separator' => 'after',
964 ]
965 );
966
967 $this->add_control(
968 'popup_close_btn_vr_position',
969 [
970 'label' => __('Vertical Position', 'master-addons'),
971 'type' => \Elementor\Controls_Manager::SLIDER,
972 'size_units' => ['px'],
973 'range' => [
974 'px' => [
975 'min' => -100,
976 'max' => 100,
977 ],
978 ],
979 'default' => [
980 'unit' => 'px',
981 'size' => 10,
982 ],
983 'selectors' => [
984 '{{WRAPPER}} .jltma-popup-close-btn' => 'top: {{SIZE}}{{UNIT}};',
985 ],
986 'condition' => [
987 'popup_show_close_button' => 'yes',
988 ],
989 ]
990 );
991
992 $this->add_control(
993 'popup_close_btn_hr_position',
994 [
995 'label' => __('Horizontal Position', 'master-addons'),
996 'type' => \Elementor\Controls_Manager::SLIDER,
997 'size_units' => ['px'],
998 'range' => [
999 'px' => [
1000 'min' => -100,
1001 'max' => 100,
1002 ],
1003 ],
1004 'default' => [
1005 'unit' => 'px',
1006 'size' => 10,
1007 ],
1008 'selectors' => [
1009 '{{WRAPPER}} .jltma-popup-close-btn' => 'right: {{SIZE}}{{UNIT}};',
1010 ],
1011 'condition' => [
1012 'popup_show_close_button' => 'yes',
1013 ],
1014 ]
1015 );
1016
1017 $this->add_control(
1018 'popup_close_btn_border_type',
1019 [
1020 'label' => __('Border Type', 'master-addons'),
1021 'type' => \Elementor\Controls_Manager::SELECT,
1022 'options' => [
1023 'none' => __('None', 'master-addons'),
1024 'solid' => __('Solid', 'master-addons'),
1025 'double' => __('Double', 'master-addons'),
1026 'dotted' => __('Dotted', 'master-addons'),
1027 'dashed' => __('Dashed', 'master-addons'),
1028 'groove' => __('Groove', 'master-addons'),
1029 ],
1030 'default' => 'solid',
1031 'selectors' => [
1032 '{{WRAPPER}} .jltma-popup-close-btn' => 'border-style: {{VALUE}};',
1033 ],
1034 'separator' => 'before',
1035 ]
1036 );
1037
1038 $this->add_control(
1039 'popup_close_btn_border_width',
1040 [
1041 'label' => __('Border Width', 'master-addons'),
1042 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1043 'size_units' => ['px'],
1044 'default' => [
1045 'top' => 1,
1046 'right' => 1,
1047 'bottom' => 1,
1048 'left' => 1,
1049 ],
1050 'selectors' => [
1051 '{{WRAPPER}} .jltma-popup-close-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1052 ],
1053 'condition' => [
1054 'popup_close_btn_border_type!' => 'none',
1055 ],
1056 ]
1057 );
1058
1059 $this->add_control(
1060 'popup_close_btn_radius',
1061 [
1062 'label' => __('Border Radius', 'master-addons'),
1063 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1064 'size_units' => ['px', '%'],
1065 'default' => [
1066 'top' => 50,
1067 'right' => 50,
1068 'bottom' => 50,
1069 'left' => 50,
1070 'unit' => '%',
1071 ],
1072 'selectors' => [
1073 '{{WRAPPER}} .jltma-popup-close-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1074 ],
1075 'separator' => 'before',
1076 ]
1077 );
1078
1079 $this->add_responsive_control(
1080 'popup_close_btn_position_vr',
1081 [
1082 'label' => __('Vertical Position', 'master-addons'),
1083 'type' => \Elementor\Controls_Manager::SLIDER,
1084 'size_units' => ['px'],
1085 'range' => [
1086 'px' => [
1087 'min' => -100,
1088 'max' => 100,
1089 ],
1090 ],
1091 'default' => [
1092 'unit' => 'px',
1093 'size' => 10,
1094 ],
1095 'selectors' => [
1096 '{{WRAPPER}} .jltma-popup-close-btn' => 'top: {{SIZE}}{{UNIT}};',
1097 ],
1098 'separator' => 'before',
1099 ]
1100 );
1101
1102 $this->add_responsive_control(
1103 'popup_close_btn_position_hr',
1104 [
1105 'label' => __('Horizontal Position', 'master-addons'),
1106 'type' => \Elementor\Controls_Manager::SLIDER,
1107 'size_units' => ['px'],
1108 'range' => [
1109 'px' => [
1110 'min' => -100,
1111 'max' => 100,
1112 ],
1113 ],
1114 'default' => [
1115 'unit' => 'px',
1116 'size' => 10,
1117 ],
1118 'selectors' => [
1119 '{{WRAPPER}} .jltma-popup-close-btn' => 'right: {{SIZE}}{{UNIT}};',
1120 ],
1121 ]
1122 );
1123
1124 $this->end_controls_section();
1125
1126 // Upgrade to Pro notice section (banner approach - jltma_pro_notice_html)
1127 if (apply_filters('master_addons/popup_builder/show_pro_notices', true)) {
1128 $this->start_controls_section(
1129 'popup_upgrade_to_pro',
1130 [
1131 'label' => __('Unlock More Features', 'master-addons') . ' &#11088;',
1132 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1133 ]
1134 );
1135
1136 $this->add_control(
1137 'popup_upgrade_notice',
1138 [
1139 'label' => '',
1140 'type' => \Elementor\Controls_Manager::RAW_HTML,
1141 'raw' => Helper::jltma_pro_notice_html(),
1142 ]
1143 );
1144
1145 $this->end_controls_section();
1146 }
1147
1148 // Default Document Settings (General Settings, Title, Status, etc.)
1149 parent::register_controls();
1150
1151 // Unlock Pro Features section — last section, auto-open on load
1152 if (apply_filters('master_addons/popup_builder/show_pro_notices', true)) {
1153 $this->start_controls_section(
1154 'popup_pro_features',
1155 [
1156 'label' => __('Unlock Pro Features', 'master-addons') . ' &#11088;',
1157 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
1158 ]
1159 );
1160
1161 $features = [
1162 __('Open Popup: On Page Scroll', 'master-addons'),
1163 __('Open Popup: On Scroll to Element', 'master-addons'),
1164 __('Open Popup: After Specific Date', 'master-addons'),
1165 __('Open Popup: After User Inactivity', 'master-addons'),
1166 __('Open Popup: After User Exit Intent', 'master-addons'),
1167 __('Open Popup: Custom Trigger (Button Click or Selector)', 'master-addons'),
1168 __('Show Again Delay: Set any time (hours, days, weeks) - This option determines when to show popup again to a visitor after it is closed.', 'master-addons'),
1169 __('Stop showing after Specific Date', 'master-addons'),
1170 __('Automatic Closing Delay', 'master-addons'),
1171 __('Show Popup for Specific Roles', 'master-addons'),
1172 __('Show according to URL Keyword - Popup will show up if URL(referral) contains chosen keyword', 'master-addons'),
1173 __('Show/Hide Popup on any Device', 'master-addons'),
1174 __('Prevent Popup closing on "ESC" key', 'master-addons'),
1175 ];
1176
1177 $features_html = '<ul style="list-style:none; padding-left:0; margin:10px 0 20px; color:#fff;">';
1178 foreach ($features as $feature) {
1179 $features_html .= '<li style="margin-bottom:8px; line-height:1.5; padding-left:20px; position:relative;">'
1180 . '<span style="position:absolute; left:0; top:0; color:#ff6441;">&#8226;</span>'
1181 . esc_html($feature) . '</li>';
1182 }
1183 $features_html .= '</ul>';
1184 $features_html .= '<div style="text-align:center; margin-top:15px;">'
1185 . '<a href="https://master-addons.com/pricing/" target="_blank" style="display:inline-block; background:#ff6441; color:#fff; padding:10px 24px; border-radius:4px; text-decoration:none; font-weight:600; font-size:14px;">'
1186 . esc_html__('Get Pro version', 'master-addons') . '</a></div>';
1187
1188 // Auto-open this section on panel load
1189 $features_html .= '<script>
1190 (function(){
1191 if (window.jltmaProFeaturesAutoOpen) return;
1192 window.jltmaProFeaturesAutoOpen = true;
1193 var panel = document.getElementById("elementor-panel-content-wrapper");
1194 if (!panel) return;
1195 function openSection() {
1196 var section = panel.querySelector(".elementor-control-popup_pro_features");
1197 if (section && !section.classList.contains("elementor-open")) {
1198 section.classList.add("elementor-open");
1199 }
1200 }
1201 var observer = new MutationObserver(openSection);
1202 observer.observe(panel, {childList: true, subtree: true});
1203 openSection();
1204 })();
1205 </script>';
1206
1207 $this->add_control(
1208 'popup_pro_features_list',
1209 [
1210 'label' => '',
1211 'type' => \Elementor\Controls_Manager::RAW_HTML,
1212 'raw' => $features_html,
1213 ]
1214 );
1215
1216 $this->end_controls_section();
1217 }
1218 }
1219 }
1220