register(); ServiceEvents::instance()->register(); // Lead capture. The form has to work with JavaScript switched off, so the // POST handler and the shortcode register on the front end too, not only // behind the admin guard below. ( new FrontendForm() )->register(); LeadNotifier::instance()->register(); Notifications::instance()->register(); Exporter::instance()->register(); // What a review's, a team member's and a coupon's own page show. TestimonialPage::instance()->register(); TeamPage::instance()->register(); CouponPage::instance()->register(); $this->boot_admin(); } private function boot_admin(): void { if ( ! is_admin() ) { return; } add_action( 'admin_menu', [ Menu::instance(), 'register' ], 1 ); add_filter( 'plugin_action_links_' . FXLC_BASENAME, [ Menu::instance(), 'settings_link' ] ); ModulesPage::instance()->register(); add_action( 'admin_enqueue_scripts', [ Assets::instance(), 'enqueue' ] ); $meta = MetaBoxes::instance(); add_action( 'add_meta_boxes', [ $meta, 'add_meta_boxes' ] ); add_action( 'save_post', [ $meta, 'save' ], 10, 2 ); add_action( 'admin_enqueue_scripts', [ $meta, 'enqueue_assets' ] ); } /** * Rebuild the permalink rules once, on the first request after activation. * * Flushing is expensive, so it happens here and nowhere else: by this * priority the post types and taxonomies are registered, which is the whole * reason it cannot be done inside the activation hook itself. */ public function flush_rewrites(): void { if ( ! get_option( Activator::FLUSH_FLAG ) ) { return; } delete_option( Activator::FLUSH_FLAG ); flush_rewrite_rules(); } /** * Signal that Core has finished initializing. This is the entry point for * addon registration (see docs/23-extensibility-contract): addons hook * `fxlc_loaded`, then fire `fxlc_register_addon`. Runs at a late `init` * priority so Core's own init work (textdomain, CPTs) is already in place. */ public function announce_loaded(): void { do_action( 'fxlc_loaded' ); } }