| 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('New_Features_Notice')) { |
| 12 |
/** |
| 13 |
* New Features Notice with Confetti Animation |
| 14 |
* |
| 15 |
* Jewel Theme <[email protected]> |
| 16 |
*/ |
| 17 |
class New_Features_Notice extends Notice |
| 18 |
{ |
| 19 |
|
| 20 |
public $color = 'info'; |
| 21 |
|
| 22 |
/** |
| 23 |
* New Features 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-update-notice is-dismissible"> |
| 40 |
<div class="jltma-plugin-update-notice-logo"> |
| 41 |
<img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'logo.svg'); ?>" alt="Master Addons Logo"> |
| 42 |
</div> |
| 43 |
<div class="jltma-notice-content"> |
| 44 |
<?php |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Notice Content |
| 49 |
* |
| 50 |
* @author Jewel Theme <[email protected]> |
| 51 |
*/ |
| 52 |
public function notice_content() |
| 53 |
{ |
| 54 |
?> |
| 55 |
<h3><span>New Features</span><br> Introducing New Widgets</h3> |
| 56 |
<p>We are excited to announce that we have added new Widgets, Template Kits, and other Elementor<br> features to enhance your website building experience. Stay tuned for the weekly updates!</p> |
| 57 |
<ul class="jltma-new-widgets-list"> |
| 58 |
<li><a target="_blank" href="https://master-addons.com/elementor-widgets/image-hover-effects/?ref=ma-plugin-backend-update-notice">Image Hover Effects</a></li> |
| 59 |
<li><a target="_blank" href="https://master-addons.com/elementor-widgets/mega-menu/?ref=ma-plugin-backend-update-notice">Mega Menu</a></li> |
| 60 |
<li><a target="_blank" href="https://master-addons.com/elementor-widgets/creative-buttons/?ref=ma-plugin-backend-update-notice">Creative Buttons</a></li> |
| 61 |
<li><a target="_blank" href="https://master-addons.com/elementor-widgets/timeline/?ref=ma-plugin-backend-update-notice">Timeline Widget</a></li> |
| 62 |
<li><a target="_blank" href="https://master-addons.com/elementor-widgets/blog-element/?ref=ma-plugin-backend-update-notice">Blog Element</a></li> |
| 63 |
</ul> |
| 64 |
<?php |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Notice Footer with Custom Structure |
| 69 |
* |
| 70 |
* @return void |
| 71 |
* @author Jewel Theme <[email protected]> |
| 72 |
*/ |
| 73 |
public function notice_footer() |
| 74 |
{ |
| 75 |
?> |
| 76 |
</div> |
| 77 |
<div class="jltma-notice-image-wrap"> |
| 78 |
<img src="<?php echo esc_url(JLTMA_IMAGE_DIR . 'banner.png'); ?>" alt="New Features"> |
| 79 |
</div> |
| 80 |
<canvas id="jltma-notice-confetti" width="1478" height="312"></canvas> |
| 81 |
<button type="button" class="notice-dismiss jltma-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button> |
| 82 |
</div> |
| 83 |
<?php |
| 84 |
} |
| 85 |
|
| 86 |
/** |
| 87 |
* Core Script with Confetti Animation |
| 88 |
* |
| 89 |
* @param [type] $trigger_time . |
| 90 |
* |
| 91 |
* @return void |
| 92 |
* @author Jewel Theme <[email protected]> |
| 93 |
*/ |
| 94 |
public function core_script($trigger_time) |
| 95 |
{ |
| 96 |
?> |
| 97 |
<script> |
| 98 |
function jltma_notice_action(evt, $this, action_type) { |
| 99 |
if (evt) evt.preventDefault(); |
| 100 |
$this.closest('.jltma-plugin-update-notice').slideUp(200); |
| 101 |
|
| 102 |
jQuery.post('<?php echo esc_url(admin_url('admin-ajax.php')); ?>', { |
| 103 |
action: 'jltma_notification_action', |
| 104 |
_wpnonce: '<?php echo esc_js(wp_create_nonce('jltma_notification_nonce')); ?>', |
| 105 |
action_type: action_type, |
| 106 |
notification_type: 'notice', |
| 107 |
trigger_time: '<?php echo esc_attr($trigger_time); ?>' |
| 108 |
}); |
| 109 |
} |
| 110 |
|
| 111 |
// Notice Dismiss |
| 112 |
jQuery('body').on('click', '.jltma-plugin-update-notice .jltma-notice-dismiss', function(evt) { |
| 113 |
jltma_notice_action(evt, jQuery(this), 'dismiss'); |
| 114 |
}); |
| 115 |
|
| 116 |
// Confetti Animation |
| 117 |
function initJltmaConfetti() { |
| 118 |
const canvas = document.getElementById('jltma-notice-confetti'); |
| 119 |
if (!canvas) return; |
| 120 |
|
| 121 |
const ctx = canvas.getContext('2d'); |
| 122 |
const confetti = []; |
| 123 |
const colors = ['#ff6b6b', '#4ecdc4', '#45b7d1', '#96ceb4', '#feca57']; |
| 124 |
|
| 125 |
// Set canvas size |
| 126 |
canvas.width = canvas.offsetWidth; |
| 127 |
canvas.height = canvas.offsetHeight; |
| 128 |
|
| 129 |
// Confetti particle class |
| 130 |
class ConfettiPiece { |
| 131 |
constructor() { |
| 132 |
this.x = Math.random() * canvas.width; |
| 133 |
this.y = -10; |
| 134 |
this.vx = (Math.random() - 0.5) * 3; |
| 135 |
this.vy = Math.random() * 3 + 2; |
| 136 |
this.color = colors[Math.floor(Math.random() * colors.length)]; |
| 137 |
this.size = Math.random() * 5 + 2; |
| 138 |
this.rotation = Math.random() * 360; |
| 139 |
this.rotationSpeed = (Math.random() - 0.5) * 5; |
| 140 |
} |
| 141 |
|
| 142 |
update() { |
| 143 |
this.x += this.vx; |
| 144 |
this.y += this.vy; |
| 145 |
this.rotation += this.rotationSpeed; |
| 146 |
|
| 147 |
if (this.y > canvas.height + 10) { |
| 148 |
this.y = -10; |
| 149 |
this.x = Math.random() * canvas.width; |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
draw() { |
| 154 |
ctx.save(); |
| 155 |
ctx.translate(this.x, this.y); |
| 156 |
ctx.rotate(this.rotation * Math.PI / 180); |
| 157 |
ctx.fillStyle = this.color; |
| 158 |
ctx.fillRect(-this.size / 2, -this.size / 2, this.size, this.size); |
| 159 |
ctx.restore(); |
| 160 |
} |
| 161 |
} |
| 162 |
|
| 163 |
// Create confetti pieces |
| 164 |
for (let i = 0; i < 50; i++) { |
| 165 |
confetti.push(new ConfettiPiece()); |
| 166 |
} |
| 167 |
|
| 168 |
// Animation loop |
| 169 |
function animate() { |
| 170 |
ctx.clearRect(0, 0, canvas.width, canvas.height); |
| 171 |
|
| 172 |
confetti.forEach(piece => { |
| 173 |
piece.update(); |
| 174 |
piece.draw(); |
| 175 |
}); |
| 176 |
|
| 177 |
requestAnimationFrame(animate); |
| 178 |
} |
| 179 |
|
| 180 |
animate(); |
| 181 |
} |
| 182 |
|
| 183 |
// Initialize confetti when document is ready |
| 184 |
jQuery(document).ready(function() { |
| 185 |
setTimeout(initJltmaConfetti, 500); |
| 186 |
}); |
| 187 |
</script> |
| 188 |
|
| 189 |
<style> |
| 190 |
.jltma-plugin-update-notice { |
| 191 |
position: relative; |
| 192 |
display: flex; |
| 193 |
align-items: center; |
| 194 |
padding: 20px; |
| 195 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| 196 |
color: white; |
| 197 |
border: none; |
| 198 |
border-radius: 8px; |
| 199 |
margin: 15px 0; |
| 200 |
overflow: hidden; |
| 201 |
} |
| 202 |
|
| 203 |
.jltma-plugin-update-notice-logo { |
| 204 |
margin-right: 20px; |
| 205 |
flex-shrink: 0; |
| 206 |
} |
| 207 |
|
| 208 |
.jltma-plugin-update-notice-logo img { |
| 209 |
width: 80px; |
| 210 |
height: 80px; |
| 211 |
border-radius: 50%; |
| 212 |
} |
| 213 |
|
| 214 |
.jltma-notice-content { |
| 215 |
flex: 1; |
| 216 |
z-index: 2; |
| 217 |
} |
| 218 |
|
| 219 |
.jltma-notice-content h3 { |
| 220 |
font-size: 24px; |
| 221 |
margin: 0 0 15px; |
| 222 |
color: white; |
| 223 |
} |
| 224 |
|
| 225 |
.jltma-notice-content h3 span { |
| 226 |
background: rgba(255, 255, 255, 0.2); |
| 227 |
padding: 4px 12px; |
| 228 |
border-radius: 20px; |
| 229 |
font-size: 12px; |
| 230 |
text-transform: uppercase; |
| 231 |
letter-spacing: 1px; |
| 232 |
} |
| 233 |
|
| 234 |
.jltma-notice-content p { |
| 235 |
margin: 15px 0; |
| 236 |
line-height: 1.6; |
| 237 |
color: rgba(255, 255, 255, 0.9); |
| 238 |
} |
| 239 |
|
| 240 |
.jltma-new-widgets-list { |
| 241 |
list-style: none; |
| 242 |
margin: 0; |
| 243 |
padding: 0; |
| 244 |
display: flex; |
| 245 |
flex-wrap: wrap; |
| 246 |
gap: 15px; |
| 247 |
} |
| 248 |
|
| 249 |
.jltma-new-widgets-list li { |
| 250 |
margin: 0; |
| 251 |
} |
| 252 |
|
| 253 |
.jltma-new-widgets-list a { |
| 254 |
color: white; |
| 255 |
text-decoration: none; |
| 256 |
background: rgba(255, 255, 255, 0.2); |
| 257 |
padding: 8px 15px; |
| 258 |
border-radius: 20px; |
| 259 |
font-size: 13px; |
| 260 |
transition: all 0.3s ease; |
| 261 |
display: inline-block; |
| 262 |
} |
| 263 |
|
| 264 |
.jltma-new-widgets-list a:hover { |
| 265 |
background: rgba(255, 255, 255, 0.3); |
| 266 |
transform: translateY(-2px); |
| 267 |
} |
| 268 |
|
| 269 |
.jltma-notice-image-wrap { |
| 270 |
margin-left: 20px; |
| 271 |
flex-shrink: 0; |
| 272 |
z-index: 2; |
| 273 |
} |
| 274 |
|
| 275 |
.jltma-notice-image-wrap img { |
| 276 |
max-width: 200px; |
| 277 |
height: auto; |
| 278 |
border-radius: 8px; |
| 279 |
} |
| 280 |
|
| 281 |
#jltma-notice-confetti { |
| 282 |
position: absolute; |
| 283 |
top: 0; |
| 284 |
left: 0; |
| 285 |
pointer-events: none; |
| 286 |
z-index: 1; |
| 287 |
} |
| 288 |
|
| 289 |
.jltma-plugin-update-notice .notice-dismiss { |
| 290 |
position: absolute; |
| 291 |
top: 10px; |
| 292 |
right: 10px; |
| 293 |
color: white; |
| 294 |
z-index: 3; |
| 295 |
} |
| 296 |
|
| 297 |
.jltma-plugin-update-notice .notice-dismiss:before { |
| 298 |
color: white; |
| 299 |
} |
| 300 |
|
| 301 |
.jltma-plugin-update-notice .notice-dismiss:hover:before { |
| 302 |
color: rgba(255, 255, 255, 0.7); |
| 303 |
} |
| 304 |
|
| 305 |
@media (max-width: 768px) { |
| 306 |
.jltma-plugin-update-notice { |
| 307 |
flex-direction: column; |
| 308 |
text-align: center; |
| 309 |
} |
| 310 |
|
| 311 |
.jltma-plugin-update-notice-logo { |
| 312 |
margin-right: 0; |
| 313 |
margin-bottom: 20px; |
| 314 |
} |
| 315 |
|
| 316 |
.jltma-notice-image-wrap { |
| 317 |
margin-left: 0; |
| 318 |
margin-top: 20px; |
| 319 |
} |
| 320 |
|
| 321 |
.jltma-new-widgets-list { |
| 322 |
justify-content: center; |
| 323 |
} |
| 324 |
} |
| 325 |
</style> |
| 326 |
<?php |
| 327 |
} |
| 328 |
|
| 329 |
/** |
| 330 |
* Intervals |
| 331 |
* |
| 332 |
* @author Jewel Theme <[email protected]> |
| 333 |
*/ |
| 334 |
public function intervals() |
| 335 |
{ |
| 336 |
return array(0); |
| 337 |
} |
| 338 |
} |
| 339 |
} |
| 340 |
|