setup_hooks(); } /** * Setup core hooks. * * @return void */ private function setup_hooks() { // Instantiated on plugins_loaded: run step migrations now whenever the stored version is behind. Migrations::run(); add_action( 'rest_api_init', array( $this, 'register_rest_routes' ) ); // Front-end redirect engine on template_redirect at priority 1. ( new Redirects\RedirectHandler() )->register(); // WooCommerce integration (HPOS declaration and product integrity data). ( new Integrations\WooCommerce() )->register(); add_action( 'admin_init', array( $this, 'check_multisite_activation' ) ); if ( is_admin() ) { Support\Capabilities::ensure_admin_capabilities(); ( new AdminMenu() )->register(); ( new Assets() )->register(); ( new Actions() )->register(); } } /** * Register REST routes under slugh/v1. * * @return void */ public function register_rest_routes() { ( new Rest\ScanController() )->register_routes(); ( new Rest\DraftsController() )->register_routes(); ( new Rest\JobsController() )->register_routes(); ( new Rest\RedirectsController() )->register_routes(); } /** * SlugH v1 supports single sites only: undo a network activation that slipped through. * * @return void */ public function check_multisite_activation() { if ( is_multisite() && function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename( SLUGH_FILE ) ) ) { deactivate_plugins( plugin_basename( SLUGH_FILE ), true, true ); add_action( 'network_admin_notices', array( $this, 'render_multisite_notice' ) ); } } /** * Render the multisite notice. * * @return void */ public function render_multisite_notice() { ?>

true ) ); } Installer::activate(); } /** * Deactivation hook callback. Redirects stop; all data stays. * * @return void */ public static function on_deactivate() { Installer::deactivate(); } }