' . esc_html__( 'This Abientot version cannot safely read the installed database version. Install a compatible edition before accepting bookings. No downgrade was performed.', 'abientot' ) . '

'; } } ); return; } if ( !$this->maybe_migrate() ) { add_action( 'admin_notices', static function () : void { if ( current_user_can( 'abientot_manage_settings' ) ) { echo '

' . esc_html__( 'Abientot database update failed. Check database permissions and reload to retry before accepting bookings.', 'abientot' ) . '

'; } } ); return; } $this->maybe_switch_admin_locale(); add_action( 'init', array($this, 'load_textdomain') ); add_action( 'init', array(\Abientot\Support\Locale::class, 'register_script'), 15 ); add_action( 'change_locale', static function () : void { if ( did_action( 'init' ) ) { \Abientot\Support\Translations::load(); } } ); add_filter( 'pre_load_script_translations', array(\Abientot\Support\Translations::class, 'script_translations'), 10, 4 ); if ( is_admin() && '' !== Settings::configured_locale() ) { add_action( 'admin_init', array($this, 'load_textdomain'), 0 ); } // ABIENTOT_LOCAL_PREMIUM_END ( new BookingForm() )->register(); \Abientot\Support\MultilingualText::register_hooks(); \Abientot\Repositories\BookingPagesRepository::register_hooks(); add_action( 'admin_init', array(\Abientot\Database\Seeder::class, 'localize_status_labels') ); ( new SelfServicePage() )->register(); // One optional email reminder is part of Free (decision #4); its settings default to off. add_action( 'init', static function () : void { ( new \Abientot\Reminders\Module() )->register(); }, 20 ); ( new \Abientot\Support\ActivityObserver() )->register(); add_action( 'admin_bar_menu', array($this, 'dashboard_toolbar_link'), 90 ); ( new \Abientot\Privacy\PersonalData() )->register(); ( new \Abientot\Migration\Compatibility() )->register(); add_action( 'init', static function () : void { ( new \Abientot\Import\Module() )->register(); }, 21 ); if ( is_admin() ) { ( new Admin() )->register(); ( new \Abientot\Admin\ActivityCenter() )->register(); ( new \Abientot\Admin\HelpContact() )->register(); ( new \Abientot\Admin\HelpBubble() )->register(); ( new \Abientot\Privacy\Tools() )->register(); ( new \Abientot\Admin\RetainedCalendars() )->register(); } } /** Adds a front-end toolbar shortcut only for authorised Abientot users. */ public function dashboard_toolbar_link( \WP_Admin_Bar $toolbar ) : void { if ( is_admin() || !current_user_can( 'abientot_manage_bookings' ) && !current_user_can( 'abientot_view_reports' ) ) { return; } $toolbar->add_node( array( 'id' => 'abientot-dashboard', 'title' => __( 'Abientot', 'abientot' ), 'href' => admin_url( 'admin.php?page=abientot' ), ) ); } /** Keeps additive schema changes available while the plugin is already active. */ private function maybe_migrate() : bool { if ( get_option( 'abientot_db_version' ) !== Migrator::SCHEMA_VERSION ) { return ( new Migrator() )->run(); } return true; } /** * Loads translations. */ public function load_textdomain() : void { \Abientot\Support\Translations::load(); } /** * Applies the configured locale to Abientot's focused admin application only. * This leaves unrelated WordPress, theme, and plugin screens untouched. */ private function maybe_switch_admin_locale() : void { if ( !is_admin() ) { return; } $page = \Abientot\Support\Request::page(); if ( 'abientot' !== $page && 0 !== strpos( $page, 'abientot-' ) ) { return; } $locale = Settings::configured_locale(); if ( '' !== $locale && function_exists( 'switch_to_locale' ) ) { switch_to_locale( $locale ); } } /** * Prevent direct construction. */ private function __construct() { } }