booted ) { return; } $this->booted = true; $this->load_textdomain(); if ( ! self::woocommerce_active() ) { add_action( 'admin_notices', array( $this, 'render_missing_woocommerce_notice' ) ); return; } $settings = new Settings(); $transport = new CloudTransport( $settings, STOREBRIDGE_CLOUD_URL ); ( new Menu() )->register(); ( new Billing() )->register(); ( new NoticeDismissal() )->register(); ( new Notices( $settings ) )->register(); ( new ProductPanel() )->register(); $tracker = new ChangeTracker( $settings ); $tracker->register(); ( new EventFlusher( $settings, $transport ) )->register(); ( new OrderEmails() )->register(); $shipments = new ShipmentSender( $transport, new TrackingFinder() ); $shipments->register(); ( new OrderPanel( $transport, $shipments ) )->register(); $verifier = new RequestVerifier( $settings ); $orders = new OrdersController( $verifier, new OrderImporter( $settings->market() ?? 'NL' ) ); add_action( 'rest_api_init', array( $orders, 'register_routes' ) ); $admin_rest = new RestController( $settings, $transport ); $sync_rest = new SyncController( $transport, $tracker ); $inbound = new ConnectionController( $settings, $verifier ); $product_status = new ProductStatusController( $verifier ); add_action( 'rest_api_init', array( $admin_rest, 'register_routes' ) ); add_action( 'rest_api_init', array( $sync_rest, 'register_routes' ) ); add_action( 'rest_api_init', array( new OrderListController( $transport ), 'register_routes' ) ); add_action( 'rest_api_init', array( new TiktokLinkController( $settings, $transport ), 'register_routes' ) ); ( new LicenseSync( $settings, $transport ) )->register(); ( new Privacy() )->register(); add_action( 'rest_api_init', array( $inbound, 'register_routes' ) ); add_action( 'rest_api_init', array( $product_status, 'register_routes' ) ); add_action( 'rest_api_init', array( new OnboardingController( $settings, $transport, $tracker ), 'register_routes' ) ); ( new OnboardingNotices( $settings, $transport ) )->register(); add_action( 'rest_api_init', array( new DashboardController( $transport ), 'register_routes' ) ); } /** * Load bundled translations from /languages (nl_NL, de_DE). WordPress.org * language packs take over automatically once the plugin is hosted there. */ public function load_textdomain(): void { load_plugin_textdomain( 'softsquare-store-sync', false, dirname( plugin_basename( STOREBRIDGE_FILE ) ) . '/languages' ); } /** * Whether WooCommerce is loaded. */ public static function woocommerce_active(): bool { return class_exists( 'WooCommerce' ); } /** * Admin notice on the plugins screen when WooCommerce is missing. */ public function render_missing_woocommerce_notice(): void { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! current_user_can( 'activate_plugins' ) || null === $screen || 'plugins' !== $screen->id ) { return; } printf( '

%s

', esc_html__( 'Softsquare Store Sync needs WooCommerce. Install and activate WooCommerce to continue.', 'softsquare-store-sync' ) ); } }