Analytics
2 months ago
Database
1 month ago
DynamicFieldResolver.php
1 month ago
Elementor_Enhancer.php
6 months ago
EmbedPress_Core_Installer.php
6 years ago
EmbedPress_Notice.php
3 months ago
EmbedPress_Plugin_Usage_Tracker.php
2 months ago
Extend_CustomPlayer_Controls.php
1 month ago
Extend_Elementor_Controls.php
1 year ago
FeatureNoticeManager.php
8 months ago
FeatureNotices.php
8 months ago
Feature_Enhancer.php
1 month ago
Helper.php
1 month ago
Pdf_Thumbnail_Handler.php
2 months ago
PermalinkHelper.php
10 months ago
README_FEATURE_NOTICES.md
8 months ago
FeatureNotices.php
172 lines
| 1 | <?php |
| 2 | |
| 3 | namespace EmbedPress\Includes\Classes; |
| 4 | |
| 5 | /** |
| 6 | * Feature Notices Registration |
| 7 | * |
| 8 | * This file contains all feature notice registrations for EmbedPress. |
| 9 | * Add your feature notices here to keep them organized in one place. |
| 10 | * |
| 11 | * @package EmbedPress |
| 12 | * @since 4.1.0 |
| 13 | */ |
| 14 | |
| 15 | (defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed."); |
| 16 | |
| 17 | class FeatureNotices |
| 18 | { |
| 19 | |
| 20 | /** |
| 21 | * Singleton instance |
| 22 | * @var FeatureNotices |
| 23 | */ |
| 24 | private static $instance = null; |
| 25 | |
| 26 | /** |
| 27 | * Get singleton instance |
| 28 | * |
| 29 | * @return FeatureNotices |
| 30 | */ |
| 31 | public static function get_instance() |
| 32 | { |
| 33 | if (self::$instance === null) { |
| 34 | self::$instance = new self(); |
| 35 | } |
| 36 | return self::$instance; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Constructor |
| 41 | */ |
| 42 | private function __construct() |
| 43 | { |
| 44 | // Register all notices |
| 45 | add_action('init', [$this, 'register_all_notices']); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Register all feature notices |
| 50 | * |
| 51 | * Add your feature notices here. Each notice should have a unique ID. |
| 52 | * |
| 53 | * @return void |
| 54 | */ |
| 55 | public function register_all_notices() |
| 56 | { |
| 57 | $notice_manager = FeatureNoticeManager::get_instance(); |
| 58 | |
| 59 | // ======================================== |
| 60 | // ACTIVE NOTICES |
| 61 | // ======================================== |
| 62 | // Note: Notices only show on Dashboard page (/wp-admin/index.php) |
| 63 | // Any action (Skip, Close, or Click Button) = Permanently dismiss |
| 64 | |
| 65 | // Analytics Dashboard Feature Notice |
| 66 | $notice_manager->register_notice('analytics_dashboard_2024', [ |
| 67 | 'title' => 'New Features', |
| 68 | 'icon' => '<svg width="11" height="13" viewBox="0 0 11 13" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 69 | <path d="M0 1.61956C1.26645e-05 1.53091 0.0177073 1.44315 0.0520487 1.36142C0.0863901 1.27968 0.136689 1.20562 0.2 1.14356C0.926563 0.431321 1.89723 0.0227172 2.91444 0.000919081C3.93164 -0.0208791 4.91893 0.345767 5.67533 1.02623L5.90933 1.2449C6.39562 1.67096 7.02013 1.90585 7.66667 1.90585C8.3132 1.90585 8.93771 1.67096 9.424 1.2449L9.59 1.09356C9.99667 0.771563 10.608 1.0289 10.6633 1.54423L10.6667 1.61956V7.61956C10.6667 7.70822 10.649 7.79598 10.6146 7.87771C10.5803 7.95944 10.53 8.03351 10.4667 8.09556C9.7401 8.8078 8.76943 9.21641 7.75223 9.23821C6.73502 9.26 5.74774 8.89336 4.99133 8.2129L4.75733 7.99423C4.28636 7.58157 3.68518 7.3478 3.05915 7.33391C2.43311 7.32001 1.82216 7.52687 1.33333 7.91823V12.2862C1.33314 12.4561 1.26808 12.6196 1.15143 12.7431C1.03479 12.8667 0.875365 12.9411 0.705737 12.951C0.536109 12.961 0.36908 12.9058 0.238778 12.7967C0.108476 12.6877 0.0247357 12.533 0.00466665 12.3642L0 12.2862V1.61956Z" fill="#25396F"/> |
| 70 | </svg>', |
| 71 | 'message' => '🥳 New In EmbedPress: Introducing, Analytics dashboard to track every embed performance; see total counts, views, clicks, geo insights, etc.', |
| 72 | 'button_text' => 'View Analytics', |
| 73 | 'button_url' => admin_url('admin.php?page=embedpress-analytics'), |
| 74 | 'skip_text' => 'Skip', |
| 75 | 'screens' => [], // Empty = show on all admin pages |
| 76 | 'capability' => 'manage_options', |
| 77 | 'start_date' => '2024-01-01', |
| 78 | 'end_date' => '2025-10-31', |
| 79 | 'priority' => 10, |
| 80 | // 'dismissible' => false, |
| 81 | 'type' => 'info', // info, success, warning, error |
| 82 | ]); |
| 83 | |
| 84 | // ======================================== |
| 85 | // EXAMPLE NOTICES (Commented Out) |
| 86 | // ======================================== |
| 87 | |
| 88 | /* |
| 89 | // Example: New Feature Announcement |
| 90 | $notice_manager->register_notice('new_feature_example', [ |
| 91 | 'title' => 'New Features', |
| 92 | 'icon' => '🚀', |
| 93 | 'message' => '<strong>Exciting Update!</strong> We\'ve added amazing new features to EmbedPress.', |
| 94 | 'button_text' => 'Learn More', |
| 95 | 'button_url' => 'https://embedpress.com/features', |
| 96 | 'button_target' => '_blank', |
| 97 | 'skip_text' => 'Maybe Later', |
| 98 | 'screens' => ['toplevel_page_embedpress'], // Show only on EmbedPress pages |
| 99 | 'capability' => 'manage_options', |
| 100 | 'priority' => 5, |
| 101 | 'type' => 'success', |
| 102 | ]); |
| 103 | */ |
| 104 | |
| 105 | /* |
| 106 | // Example: Limited Time Offer |
| 107 | $notice_manager->register_notice('black_friday_2024', [ |
| 108 | 'title' => 'Limited Time Offer', |
| 109 | 'icon' => '🎁', |
| 110 | 'message' => '<strong>Black Friday Sale!</strong> Get 50% off on EmbedPress Pro. Offer ends soon!', |
| 111 | 'button_text' => 'Claim Discount', |
| 112 | 'button_url' => 'https://embedpress.com/pricing', |
| 113 | 'button_target' => '_blank', |
| 114 | 'skip_text' => 'Not Interested', |
| 115 | 'start_date' => '2024-11-25', |
| 116 | 'end_date' => '2024-12-02', |
| 117 | 'priority' => 1, // Higher priority (lower number = shown first) |
| 118 | 'type' => 'warning', |
| 119 | ]); |
| 120 | */ |
| 121 | |
| 122 | /* |
| 123 | // Example: Important Update Notice |
| 124 | $notice_manager->register_notice('important_update_2024', [ |
| 125 | 'title' => 'Important Update', |
| 126 | 'icon' => '⚠️', |
| 127 | 'message' => '<strong>Action Required:</strong> Please update your settings to ensure compatibility with the latest version.', |
| 128 | 'button_text' => 'Update Settings', |
| 129 | 'button_url' => admin_url('admin.php?page=embedpress#/settings'), |
| 130 | 'skip_text' => 'Remind Me Later', |
| 131 | 'priority' => 1, |
| 132 | 'type' => 'warning', |
| 133 | ]); |
| 134 | */ |
| 135 | |
| 136 | /* |
| 137 | // Example: Success/Milestone Notice |
| 138 | $notice_manager->register_notice('milestone_100k', [ |
| 139 | 'title' => 'Thank You!', |
| 140 | 'icon' => '🎊', |
| 141 | 'message' => '<strong>We did it!</strong> EmbedPress has reached 100,000+ active installations. Thank you for being part of our journey!', |
| 142 | 'button_text' => 'Share Your Feedback', |
| 143 | 'button_url' => 'https://wordpress.org/support/plugin/embedpress/reviews/', |
| 144 | 'button_target' => '_blank', |
| 145 | 'skip_text' => 'Close', |
| 146 | 'start_date' => '2024-01-01', |
| 147 | 'end_date' => '2024-12-31', |
| 148 | 'priority' => 15, |
| 149 | 'type' => 'success', |
| 150 | ]); |
| 151 | */ |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Helper method to get admin URL for EmbedPress pages |
| 156 | * |
| 157 | * @param string $page_type The page type (e.g., 'analytics', 'settings') |
| 158 | * @return string |
| 159 | */ |
| 160 | private function get_embedpress_url($page_type = '') |
| 161 | { |
| 162 | $url = admin_url('admin.php?page=embedpress'); |
| 163 | if (!empty($page_type)) { |
| 164 | $url .= '&page_type=' . $page_type; |
| 165 | } |
| 166 | return $url; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | // Initialize the class |
| 171 | FeatureNotices::get_instance(); |
| 172 |