PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.9
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.9
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 / classes / notifications / pro-sale-notice.php

pro-sale-notice.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.9, at inc/classes/notifications/pro-sale-notice.php

454 lines 16.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Inc\Classes\Notifications;
4
5 if (!defined('ABSPATH')) {
6 exit; // Exit if accessed directly
7 }
8
9 use MasterAddons\Inc\Classes\Notifications\Model\Notice;
10
11 if (!class_exists('Pro_Sale_Notice')) {
12 /**
13 * Pro Sale Notice with Confetti Animation
14 *
15 * Jewel Theme <[email protected]>
16 */
17 class Pro_Sale_Notice extends Notice
18 {
19
20 public $color = 'success';
21
22 /**
23 * Pro Sale Notice Constructor
24 *
25 * @return void
26 */
27 public function __construct()
28 {
29 parent::__construct();
30 }
31
32 /**
33 * Notice Header with Custom Structure
34 *
35 * @author Jewel Theme <[email protected]>
36 */
37 public function notice_header()
38 { ?>
39 <div class="notice jltma-plugin-sale-notice is-dismissible">
40 <div class="jltma-sale-notice-content">
41 <?php
42 }
43
44 /**
45 * Notice Content
46 *
47 * @author Jewel Theme <[email protected]>
48 */
49 public function notice_content()
50 {
51 ?>
52 <h3><span>Flash Sale</span><br> Master Addons Pro</h3>
53 <ul>
54 <li>
55 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
56 100+ Premium Elementor Widgets
57 </li>
58 <li>
59 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
60 50+ Designer Made Templates
61 </li>
62 <li>
63 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
64 Advanced Header Footer Builder <a class="jltma-demo-tutorial" href="https://www.youtube.com/watch?v=kE1zmi3fxh8" target="_blank">View Demo</a>
65 </li>
66 <li>
67 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
68 Advanced WooCommerce Elements
69 </li>
70 <li>
71 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
72 Creative Button & Effects
73 </li>
74 <li>
75 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
76 Premium Support & Updates
77 </li>
78 <li>
79 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
80 Advanced Extensions & Addons
81 </li>
82 <li>
83 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'check-mark.png'); ?>" alt="Check">
84 Mega Menu Builder and much more...
85 </li>
86 </ul>
87 <p>
88 Hurry up! Upgrade within the <strong>next 24 hours</strong> and get a
89 <strong>25% Discount</strong>.<br><br>
90 Use Promo Code: &nbsp;&nbsp;&nbsp;<strong style="border: 1px dashed #C3C4C7;padding: 2px 10px;">MASALE25</strong>
91 </p>
92 <br>
93 <div class="jltma-sale-buttons">
94 <a href="https://master-addons.com/?ref=ma-plugin-backend-salebanner-upgrade-pro#purchasepro" target="_blank" class="jltma-upgrade-to-pro-button button button-secondary">
95 Upgrade to Pro <span class="dashicons dashicons-arrow-right-alt"></span>
96 </a>
97 <a href="#" class="jltma-upgrade-to-pro-button button button-secondary jltma-remind-later">Remind Me Later</a>
98 </div>
99 <?php
100 }
101
102 /**
103 * Notice Footer with Custom Structure
104 *
105 * @return void
106 * @author Jewel Theme <[email protected]>
107 */
108 public function notice_footer()
109 {
110 ?>
111 </div>
112 <div class="jltma-sale-image-wrap">
113 <img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'sale-banner-25.png'); ?>" alt="Sale Banner">
114 </div>
115 <canvas id="jltma-sale-confetti"></canvas>
116 <button type="button" class="notice-dismiss jltma-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
117 </div>
118 <?php
119 }
120
121 /**
122 * Core Script with Confetti Animation
123 *
124 * @param [type] $trigger_time .
125 *
126 * @return void
127 * @author Jewel Theme <[email protected]>
128 */
129 public function core_script($trigger_time)
130 {
131 ?>
132 <script>
133 function jltma_sale_notice_action(evt, $this, action_type) {
134 if (evt) evt.preventDefault();
135 $this.closest('.jltma-plugin-sale-notice').slideUp(200);
136
137 jQuery.post('<?php echo esc_url(admin_url('admin-ajax.php')); ?>', {
138 action: 'jltma_notification_action',
139 _wpnonce: '<?php echo esc_js(wp_create_nonce('jltma_notification_nonce')); ?>',
140 action_type: action_type,
141 notification_type: 'notice',
142 trigger_time: '<?php echo esc_attr($trigger_time); ?>'
143 });
144 }
145
146 // Notice Dismiss
147 jQuery('body').on('click', '.jltma-plugin-sale-notice .jltma-notice-dismiss', function(evt) {
148 jltma_sale_notice_action(evt, jQuery(this), 'dismiss');
149 });
150
151 // Remind Later
152 jQuery('body').on('click', '.jltma-plugin-sale-notice .jltma-remind-later', function(evt) {
153 jltma_sale_notice_action(evt, jQuery(this), 'remind_later');
154 });
155
156 // Sale Confetti Animation
157 function initJltmaSaleConfetti() {
158 const canvas = document.getElementById('jltma-sale-confetti');
159 if (!canvas) return;
160
161 const ctx = canvas.getContext('2d');
162 const confetti = [];
163 const colors = ['#ffd700', '#ff6b6b', '#4ecdc4', '#45b7d1', '#96ceb4', '#feca57'];
164
165 // Set canvas size to match notice
166 canvas.width = canvas.parentElement.offsetWidth;
167 canvas.height = canvas.parentElement.offsetHeight;
168
169 // Enhanced confetti particle class
170 class SaleConfettiPiece {
171 constructor() {
172 this.x = Math.random() * canvas.width;
173 this.y = -10;
174 this.vx = (Math.random() - 0.5) * 4;
175 this.vy = Math.random() * 4 + 2;
176 this.color = colors[Math.floor(Math.random() * colors.length)];
177 this.size = Math.random() * 6 + 3;
178 this.rotation = Math.random() * 360;
179 this.rotationSpeed = (Math.random() - 0.5) * 8;
180 this.opacity = 0.8 + Math.random() * 0.2;
181 this.shape = Math.random() > 0.5 ? 'rect' : 'circle';
182 }
183
184 update() {
185 this.x += this.vx;
186 this.y += this.vy;
187 this.rotation += this.rotationSpeed;
188
189 // Fade out as it falls
190 this.opacity -= 0.002;
191
192 if (this.y > canvas.height + 20 || this.opacity <= 0) {
193 this.y = -10;
194 this.x = Math.random() * canvas.width;
195 this.opacity = 0.8 + Math.random() * 0.2;
196 }
197 }
198
199 draw() {
200 ctx.save();
201 ctx.globalAlpha = this.opacity;
202 ctx.translate(this.x, this.y);
203 ctx.rotate(this.rotation * Math.PI / 180);
204 ctx.fillStyle = this.color;
205
206 if (this.shape === 'circle') {
207 ctx.beginPath();
208 ctx.arc(0, 0, this.size / 2, 0, Math.PI * 2);
209 ctx.fill();
210 } else {
211 ctx.fillRect(-this.size / 2, -this.size / 2, this.size, this.size);
212 }
213
214 ctx.restore();
215 }
216 }
217
218 // Create more confetti for sale notice
219 for (let i = 0; i < 80; i++) {
220 confetti.push(new SaleConfettiPiece());
221 }
222
223 // Animation loop
224 function animateSale() {
225 ctx.clearRect(0, 0, canvas.width, canvas.height);
226
227 confetti.forEach(piece => {
228 piece.update();
229 piece.draw();
230 });
231
232 requestAnimationFrame(animateSale);
233 }
234
235 animateSale();
236 }
237
238 // Initialize sale confetti
239 jQuery(document).ready(function() {
240 setTimeout(initJltmaSaleConfetti, 800);
241 });
242 </script>
243
244 <style>
245 .jltma-plugin-sale-notice {
246 position: relative;
247 display: flex;
248 align-items: stretch;
249 padding: 25px;
250 background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
251 color: white;
252 border: none;
253 border-radius: 12px;
254 margin: 15px 0;
255 overflow: hidden;
256 box-shadow: 0 10px 30px rgba(238, 90, 36, 0.3);
257 }
258
259 .jltma-sale-notice-content {
260 flex: 1;
261 z-index: 2;
262 }
263
264 .jltma-sale-notice-content h3 {
265 font-size: 28px;
266 margin: 0 0 20px;
267 color: white;
268 font-weight: 700;
269 }
270
271 .jltma-sale-notice-content h3 span {
272 background: rgba(255, 255, 255, 0.25);
273 padding: 6px 16px;
274 border-radius: 25px;
275 font-size: 14px;
276 text-transform: uppercase;
277 letter-spacing: 1px;
278 animation: pulse 2s infinite;
279 }
280
281 @keyframes pulse {
282 0%, 100% { transform: scale(1); }
283 50% { transform: scale(1.05); }
284 }
285
286 .jltma-sale-notice-content ul {
287 list-style: none;
288 margin: 20px 0;
289 padding: 0;
290 display: grid;
291 grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
292 gap: 10px;
293 }
294
295 .jltma-sale-notice-content ul li {
296 display: flex;
297 align-items: center;
298 margin: 8px 0;
299 font-size: 14px;
300 line-height: 1.4;
301 }
302
303 .jltma-sale-notice-content ul li img {
304 width: 16px;
305 height: 16px;
306 margin-right: 10px;
307 flex-shrink: 0;
308 }
309
310 .jltma-demo-tutorial {
311 color: #ffd700;
312 text-decoration: none;
313 font-weight: 600;
314 margin-left: 5px;
315 }
316
317 .jltma-demo-tutorial:hover {
318 color: white;
319 }
320
321 .jltma-sale-notice-content p {
322 margin: 20px 0;
323 line-height: 1.6;
324 color: rgba(255, 255, 255, 0.95);
325 font-size: 16px;
326 }
327
328 .jltma-sale-buttons {
329 display: flex;
330 gap: 15px;
331 flex-wrap: wrap;
332 }
333
334 .jltma-upgrade-to-pro-button {
335 background: white !important;
336 color: #ee5a24 !important;
337 border: none !important;
338 padding: 12px 20px !important;
339 border-radius: 25px !important;
340 font-weight: 600 !important;
341 text-decoration: none !important;
342 transition: all 0.3s ease !important;
343 display: inline-flex !important;
344 align-items: center !important;
345 gap: 5px !important;
346 }
347
348 .jltma-upgrade-to-pro-button:hover {
349 background: #ffd700 !important;
350 transform: translateY(-2px) !important;
351 box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
352 }
353
354 .jltma-remind-later {
355 background: rgba(255, 255, 255, 0.2) !important;
356 color: white !important;
357 }
358
359 .jltma-remind-later:hover {
360 background: rgba(255, 255, 255, 0.3) !important;
361 color: white !important;
362 }
363
364 .jltma-sale-image-wrap {
365 margin-left: 30px;
366 flex-shrink: 0;
367 z-index: 2;
368 display: flex;
369 align-items: center;
370 }
371
372 .jltma-sale-image-wrap img {
373 max-width: 250px;
374 height: auto;
375 border-radius: 12px;
376 box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
377 }
378
379 #jltma-sale-confetti {
380 position: absolute;
381 top: 0;
382 left: 0;
383 pointer-events: none;
384 z-index: 1;
385 }
386
387 .jltma-plugin-sale-notice .notice-dismiss {
388 position: absolute;
389 top: 15px;
390 right: 15px;
391 color: white;
392 z-index: 3;
393 background: rgba(255, 255, 255, 0.2);
394 border-radius: 50%;
395 }
396
397 .jltma-plugin-sale-notice .notice-dismiss:before {
398 color: white;
399 font-size: 16px;
400 }
401
402 .jltma-plugin-sale-notice .notice-dismiss:hover {
403 background: rgba(255, 255, 255, 0.3);
404 }
405
406 .jltma-plugin-sale-notice .notice-dismiss:hover:before {
407 color: white;
408 }
409
410 @media (max-width: 1024px) {
411 .jltma-plugin-sale-notice {
412 flex-direction: column;
413 }
414
415 .jltma-sale-image-wrap {
416 margin-left: 0;
417 margin-top: 25px;
418 text-align: center;
419 }
420
421 .jltma-sale-notice-content ul {
422 grid-template-columns: 1fr;
423 }
424 }
425
426 @media (max-width: 768px) {
427 .jltma-sale-notice-content h3 {
428 font-size: 24px;
429 }
430
431 .jltma-sale-buttons {
432 justify-content: center;
433 }
434
435 .jltma-upgrade-to-pro-button {
436 padding: 10px 16px !important;
437 font-size: 14px !important;
438 }
439 }
440 </style>
441 <?php
442 }
443
444 /**
445 * Intervals
446 *
447 * @author Jewel Theme <[email protected]>
448 */
449 public function intervals()
450 {
451 return array(0);
452 }
453 }
454 }