| @@ -48,12 +48,19 @@ | ||
| 48 | 48 | /** |
| 49 | 49 | * Initialize the promotion service |
| 50 | 50 | */ |
| 51 | 51 | public static function init() { |
| 52 | + // Gate every promotion surface behind `easy_invoice_show_upgrade_prompts`. | |
| 53 | + // White-label addon (Agency tier) flips this off so end-clients never see upsells. | |
| 54 | + if (!apply_filters('easy_invoice_show_upgrade_prompts', true)) { | |
| 55 | + return; | |
| 56 | + } | |
| 57 | + | |
| 52 | 58 | add_action('admin_notices', [__CLASS__, 'maybeShowPromotionBanner']); |
| 53 | 59 | add_action('wp_ajax_easy_invoice_dismiss_promotion', [__CLASS__, 'handleDismissPromotion']); |
| 54 | 60 | add_action('admin_enqueue_scripts', [__CLASS__, 'enqueueScripts']); |
| 55 | - | |
| 61 | + add_action('admin_menu', [__CLASS__, 'addUpgradeToProMenu']); | |
| 62 | + | |
| 56 | 63 | // Add plugin row action |
| 57 | 64 | add_filter('plugin_action_links_' . plugin_basename(EASY_INVOICE_PLUGIN_FILE), [__CLASS__, 'addPluginRowAction']); |
| 58 | 65 | } |
| 59 | 66 | |
| @@ -169,13 +176,13 @@ | ||
| 169 | 176 | 🚀 Upgrade to Easy Invoice Pro - Save 20%! |
| 170 | 177 | </h3> |
| 171 | 178 | <p style="margin: 0 0 12px 0; font-size: 14px; line-height: 1.5; color: #495057;"> |
| 172 | 179 | You've created <strong style="color: #ff9500;"><?php echo esc_html($invoice_count); ?></strong> invoice(s)! |
| 173 | - Get <strong style="color: #ff9500;">20% OFF</strong> today before prices increase very soon. Unlock recurring invoices, advanced reporting, multiple payment gateways, and priority support. | |
| 180 | + Get <strong style="color: #ff9500;">20% OFF</strong> on Easy Invoice Pro. Unlock recurring invoices, advanced reporting, multiple payment gateways, and priority support. | |
| 174 | 181 | </p> |
| 175 | 182 | <div style="background: rgba(255, 149, 0, 0.08); padding: 10px; border-radius: 4px; margin-bottom: 15px; border-left: 3px solid #ff9500;"> |
| 176 | 183 | <p style="margin: 0; font-size: 13px; color: #495057; font-weight: 600;"> |
| 177 | - ⚠️ <strong>Price Increase Alert:</strong> Subscription prices will be increasing soon. Lock in current pricing with 20% discount! | |
| 184 | + 🎉 <strong>Special Offer:</strong> Save 20% on your Pro upgrade with advanced features and priority support! | |
| 178 | 185 | </p> |
| 179 | 186 | </div> |
| 180 | 187 | <div style="display: flex; align-items: center; gap: 12px;"> |
| 181 | 188 | <a href="<?php echo esc_url(self::PRO_PRICING_URL); ?>" |
| @@ -181,9 +188,9 @@ | ||
| 181 | 188 | <a href="<?php echo esc_url(self::PRO_PRICING_URL); ?>" |
| 182 | 189 | target="_blank" |
| 183 | 190 | class="button button-primary" |
| 184 | 191 | style="background-color: #ff9500; border-color: #ff9500; color: white; padding: 8px 20px; font-weight: 600; font-size: 14px; border-radius: 4px; text-decoration: none; box-shadow: 0 2px 6px rgba(255, 149, 0, 0.3); transition: all 0.3s ease;"> |
| 185 | - ⚡ Get 20% Off - Upgrade Now | |
| 192 | + ⚡ Save 20% - Upgrade to Pro | |
| 186 | 193 | </a> |
| 187 | 194 | <a href="#" |
| 188 | 195 | id="easy-invoice-promotion-dismiss" |
| 189 | 196 | style="color: #6c757d; text-decoration: none; font-size: 13px; transition: color 0.3s ease;"> |
| @@ -230,9 +237,9 @@ | ||
| 230 | 237 | public static function handleDismissPromotion() { |
| 231 | 238 | check_ajax_referer('easy_invoice_promotion_nonce', 'nonce'); |
| 232 | 239 | |
| 233 | 240 | if (!current_user_can('manage_options')) { |
| 234 | - wp_die(__('You do not have sufficient permissions to access this page.', 'easy-invoice')); | |
| 241 | + wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'easy-invoice')); | |
| 235 | 242 | } |
| 236 | 243 | |
| 237 | 244 | $dismiss_count = get_option('easy_invoice_promotion_dismiss_count', 0); |
| 238 | 245 | $dismiss_count++; |
| @@ -266,6 +273,114 @@ | ||
| 266 | 273 | // Add to the beginning of the links array |
| 267 | 274 | array_unshift($links, $upgrade_link); |
| 268 | 275 | |
| 269 | 276 | return $links; |
| 277 | + } | |
| 278 | + | |
| 279 | + /** | |
| 280 | + * Add "Upgrade to Pro" menu item to main admin menu | |
| 281 | + */ | |
| 282 | + public static function addUpgradeToProMenu() { | |
| 283 | + // Only show if Pro is not active | |
| 284 | + if (self::isProActive()) { | |
| 285 | + return; | |
| 286 | + } | |
| 287 | + | |
| 288 | + global $submenu; | |
| 289 | + | |
| 290 | + // Add the submenu item directly to the submenu array | |
| 291 | + $submenu['easy-invoice'][] = array( | |
| 292 | + __('Upgrade to Pro', 'easy-invoice'), | |
| 293 | + 'manage_options', | |
| 294 | + self::PRO_PRICING_URL, | |
| 295 | + __('Upgrade to Pro', 'easy-invoice'), | |
| 296 | + 999 | |
| 297 | + ); | |
| 298 | + | |
| 299 | + // Add inline style to the submenu | |
| 300 | + add_action('admin_head', function() { | |
| 301 | + ?> | |
| 302 | + <style> | |
| 303 | + .wp-submenu a[href*="matrixaddons.com"] { | |
| 304 | + color: #fff !important; | |
| 305 | + font-weight: 700 !important; | |
| 306 | + background: linear-gradient(45deg, #ff6b35, #ff9500) !important; | |
| 307 | + border-radius: 4px !important; | |
| 308 | + margin: 2px 8px 2px 0 !important; | |
| 309 | + transition: all 0.3s ease !important; | |
| 310 | + text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important; | |
| 311 | + box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3) !important; | |
| 312 | + display: inline-block !important; | |
| 313 | + padding: 6px 12px !important; | |
| 314 | + } | |
| 315 | + | |
| 316 | + .wp-submenu a[href*="matrixaddons.com"]:hover { | |
| 317 | + background: linear-gradient(45deg, #e55a2b, #e67e00) !important; | |
| 318 | + transform: translateX(2px) !important; | |
| 319 | + box-shadow: 0 4px 12px rgba(255, 107, 53, 0.5) !important; | |
| 320 | + } | |
| 321 | + </style> | |
| 322 | + <?php | |
| 323 | + }); | |
| 324 | + } | |
| 325 | + | |
| 326 | + /** | |
| 327 | + * Display the Upgrade to Pro page | |
| 328 | + */ | |
| 329 | + public static function displayUpgradeToProPage() { | |
| 330 | + ?> | |
| 331 | + <div class="wrap"> | |
| 332 | + <h1 style="color: #ff9500; margin-bottom: 20px;"> | |
| 333 | + 🚀 Upgrade to Easy Invoice Pro | |
| 334 | + </h1> | |
| 335 | + | |
| 336 | + <div style="background: linear-gradient(135deg, #fdf6f0 0%, #f8f9fa 50%, #fff5ee 100%); border: 1px solid #f0e6d8; border-left: 4px solid #ff9500; border-radius: 6px; padding: 25px; margin-bottom: 25px; box-shadow: 0 2px 8px rgba(255, 149, 0, 0.15);"> | |
| 337 | + <h2 style="color: #2c3e50; margin-bottom: 15px;">Get 20% OFF Your Pro Upgrade!</h2> | |
| 338 | + <p style="font-size: 16px; line-height: 1.6; color: #495057; margin-bottom: 20px;"> | |
| 339 | + Unlock powerful features including recurring invoices, advanced reporting, multiple payment gateways, and priority support. | |
| 340 | + </p> | |
| 341 | + | |
| 342 | + <div style="background: rgba(255, 149, 0, 0.08); padding: 15px; border-radius: 4px; margin-bottom: 20px; border-left: 3px solid #ff9500;"> | |
| 343 | + <p style="margin: 0; font-size: 14px; color: #495057; font-weight: 600;"> | |
| 344 | + 🎉 <strong>Special Offer:</strong> Save 20% on your Pro upgrade with advanced features and priority support! | |
| 345 | + </p> | |
| 346 | + </div> | |
| 347 | + | |
| 348 | + <div style="text-align: center; margin: 30px 0;"> | |
| 349 | + <a href="<?php echo esc_url(self::PRO_PRICING_URL); ?>" | |
| 350 | + target="_blank" | |
| 351 | + class="button button-primary" | |
| 352 | + style="background: linear-gradient(45deg, #ff9500, #ffaa00); border: none; color: white; padding: 12px 30px; font-weight: 700; font-size: 16px; border-radius: 6px; text-decoration: none; box-shadow: 0 3px 10px rgba(255, 149, 0, 0.4); transition: all 0.3s ease;"> | |
| 353 | + ⚡ Save 20% - Upgrade to Pro Now | |
| 354 | + </a> | |
| 355 | + </div> | |
| 356 | + </div> | |
| 357 | + | |
| 358 | + <div style="background: white; border: 1px solid #e1e5e9; border-radius: 6px; padding: 25px;"> | |
| 359 | + <h3 style="color: #2c3e50; margin-bottom: 15px;">Why Upgrade to Pro?</h3> | |
| 360 | + <ul style="list-style: none; padding: 0;"> | |
| 361 | + <li style="margin-bottom: 12px; padding-left: 25px; position: relative;"> | |
| 362 | + <span style="position: absolute; left: 0; color: #28a745;">✓</span> | |
| 363 | + <strong>Recurring Invoices</strong> - Set up automatic recurring billing | |
| 364 | + </li> | |
| 365 | + <li style="margin-bottom: 12px; padding-left: 25px; position: relative;"> | |
| 366 | + <span style="position: absolute; left: 0; color: #28a745;">✓</span> | |
| 367 | + <strong>Advanced Reporting</strong> - Detailed financial reports and analytics | |
| 368 | + </li> | |
| 369 | + <li style="margin-bottom: 12px; padding-left: 25px; position: relative;"> | |
| 370 | + <span style="position: absolute; left: 0; color: #28a745;">✓</span> | |
| 371 | + <strong>Multiple Payment Gateways</strong> - Stripe, PayPal, and more | |
| 372 | + </li> | |
| 373 | + <li style="margin-bottom: 12px; padding-left: 25px; position: relative;"> | |
| 374 | + <span style="position: absolute; left: 0; color: #28a745;">✓</span> | |
| 375 | + <strong>Invoice & Quote Builder</strong> - Advanced drag-and-drop builder | |
| 376 | + </li> | |
| 377 | + <li style="margin-bottom: 12px; padding-left: 25px; position: relative;"> | |
| 378 | + <span style="position: absolute; left: 0; color: #28a745;">✓</span> | |
| 379 | + <strong>Priority Support</strong> - Faster response times for help | |
| 380 | + </li> | |
| 381 | + </ul> | |
| 382 | + </div> | |
| 383 | + </div> | |
| 384 | + <?php | |
| 270 | 385 | } |
| 271 | 386 | } |