register(); ( new Settings() )->register(); ( new Block() )->register(); ( new Shortcode() )->register(); ( new NavMenu() )->register(); ( new Footer() )->register(); ( new Suggestion() )->register(); add_action( 'widgets_init', array( Widget::class, 'registerWidget' ) ); if ( is_admin() ) { require_once SWIFTLING_DIR . 'includes/setup.php'; require_once SWIFTLING_DIR . 'includes/service.php'; self::loadEditor(); ( new Menu() )->register(); ( new ProOffer() )->register(); ( new EditorPanel() )->register(); ( new TranslationsColumn() )->register(); } } /** * Runs when the plugin is activated: the first setup opens next, unless it was answered before. */ public static function activate(): void { require_once SWIFTLING_DIR . 'includes/setup.php'; swiftling_note_activation(); } /** * Runs when the plugin is deactivated: the daily deletion of old log entries stops, and starts * again from an admin screen once the plugin is active again. */ public static function deactivate(): void { wp_clear_scheduled_hook( SWIFTLING_LOG_CRON ); } /** * Loads what the translation editor renders. The admin screens and the editor's REST routes use it. */ public static function loadEditor(): void { foreach ( self::EDITOR_INCLUDES as $file ) { require_once SWIFTLING_DIR . 'includes/' . $file . '.php'; } } }