HEX
Server: Apache
System: Linux server.onegroup3.co.nz 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64
User: importersclearan (1088)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/importersclearan/public_html/wp-content/mu-plugins/wp-toolkit/Panel/PanelBootstrap.php
<?php
// Copyright 1999-2026. WebPros International GmbH. All rights reserved.

namespace Webpros\WptkWpPlugin\WpToolkit\Panel;

use Webpros\WptkWpPlugin\WpToolkit\Common\Clients\HttpClientFactory;
use Webpros\WptkWpPlugin\WpToolkit\Common\CliHelper;
use Webpros\WptkWpPlugin\WpToolkit\Common\Services\ApiTokenParser;
use Webpros\WptkWpPlugin\WpToolkit\Common\Services\I18n\FallbackFormatter;
use Webpros\WptkWpPlugin\WpToolkit\Common\Services\I18n\IntlFormatter;
use Webpros\WptkWpPlugin\WpToolkit\Common\Services\I18n\LocaleLoader;
use Webpros\WptkWpPlugin\WpToolkit\Common\Services\I18n\Translator;
use Webpros\WptkWpPlugin\WpToolkit\Panel\Services\PanelInfoService;
use Webpros\WptkWpPlugin\WpToolkit\Panel\UI\BackToPanelMenuIntegration;

class PanelBootstrap
{
    const MODULE_STATUS_OPTION = 'wp-toolkit_panel_status';

    /**
     * @return void
     */
    public static function init()
    {
        if (CliHelper::is_cli() && class_exists(\WP_CLI::class)) {
            \WP_CLI::add_command('wp-toolkit panel', PanelCommand::class);
            return;
        }

        if (!get_option(self::MODULE_STATUS_OPTION, false)) {
            return;
        }

        $localeContainer = LocaleLoader::loadLocale(get_locale(), __DIR__ . '/locales');
        try {
            $messageFormatter = new IntlFormatter();
        } catch (\Exception $e) {
            $messageFormatter = new FallbackFormatter();
        }
        $translator = new Translator($localeContainer, $messageFormatter);

        $panelInfoService = new PanelInfoService(new HttpClientFactory(), new ApiTokenParser());

        $menuIntegration = new BackToPanelMenuIntegration($translator, $panelInfoService);
        add_action('admin_menu', function () use ($menuIntegration) {
            $menuIntegration->register();
        });
    }
}