| @@ -1,12 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Better_Payment\Lite; |
| 4 | 4 | |
| 5 | -use Better_Payment\Lite\Admin\Settings; | |
| 6 | 5 | use Better_Payment\Lite\Admin\ReactAdmin; |
| 7 | 6 | use Better_Payment\Lite\Admin\Elementor\Widget; |
| 8 | -use Better_Payment\Lite\Admin\Menu; | |
| 9 | 7 | use Better_Payment\Lite\Classes\Helper; |
| 10 | 8 | use Better_Payment\Lite\Classes\Export; |
| 11 | 9 | use Better_Payment\Lite\Classes\Import; |
| 12 | 10 | use PriyoMukul\WPNotice\Notices; |
| @@ -44,9 +42,8 @@ | ||
| 44 | 42 | public function init(){ |
| 45 | 43 | $this->pro_enabled = apply_filters('better_payment/pro_enabled', false); |
| 46 | 44 | |
| 47 | 45 | new ReactAdmin(); |
| 48 | - // new Settings(); | |
| 49 | 46 | |
| 50 | 47 | // Add plugin action links - works with or without Elementor |
| 51 | 48 | add_filter('plugin_action_links', array($this, 'plugin_actions_links'), 10, 2); |
| 52 | 49 | |
| @@ -51,11 +48,16 @@ | ||
| 51 | 48 | add_filter('plugin_action_links', array($this, 'plugin_actions_links'), 10, 2); |
| 52 | 49 | |
| 53 | 50 | if ( ! $this->pro_enabled ) { |
| 54 | 51 | $this->admin_notice(); |
| 55 | - $this->start_plugin_tracking(); | |
| 56 | 52 | } |
| 57 | 53 | |
| 54 | + // Usage tracking is NOT registered here any more. It is wired from | |
| 55 | + // Better_Payment::init_plugin() for admin *and* cron requests, because | |
| 56 | + // WP-Cron runs as a non-admin request and this gate hid the tracker's | |
| 57 | + // do_tracking() callback from its own scheduled event. See the note | |
| 58 | + // there. The Pro gate now lives in Helper::start_plugin_tracking(). | |
| 59 | + | |
| 58 | 60 | add_action('in_admin_header', array( $this, 'hide_admin_notices' )); |
| 59 | 61 | } |
| 60 | 62 | |
| 61 | 63 | /** |
| @@ -184,9 +186,9 @@ | ||
| 184 | 186 | |
| 185 | 187 | public function hide_admin_notices(){ |
| 186 | 188 | $current_screen = get_current_screen(); |
| 187 | 189 | |
| 188 | - if ($current_screen && str_contains( $current_screen->id, 'better-payment' ) ) { | |
| 190 | + if ($current_screen && (false !== strpos( $current_screen->id, 'better-payment' ) || false !== strpos( $current_screen->id, 'bp-campaign' )) ) { | |
| 189 | 191 | remove_all_actions('user_admin_notices'); |
| 190 | 192 | remove_all_actions('admin_notices'); |
| 191 | 193 | remove_all_actions('all_admin_notices'); |
| 192 | 194 | remove_all_actions('network_admin_notices'); |
| @@ -204,11 +206,8 @@ | ||
| 204 | 206 | * @return void |
| 205 | 207 | * @since 0.0.1 |
| 206 | 208 | */ |
| 207 | 209 | public static function dispatch_actions( ) { |
| 208 | - $menuObj = new Menu(); | |
| 209 | - $menuObj->init(); | |
| 210 | - | |
| 211 | 210 | $bpElementorWidgetObj = new Widget(); |
| 212 | 211 | |
| 213 | 212 | $bpImportObj = new Import(); |
| 214 | 213 | |