Skip to content
wiki.fftac.org

Plugin

**Site relevance:** Spiralist.org

**Memory type:** plugin source memory

**Source path:** Spiralist/wp-content/plugins/spiralist-ai-runtime/includes/Plugin.php

**Size:** 1.1 KB

Summary

namespace SpiralistAIRuntime;

Source Preview

This source file is short enough to preview directly on its source-memory page.

<?php

namespace SpiralistAIRuntime;

use SpiralistAIRuntime\Config\Settings;
use SpiralistAIRuntime\Domain\UserPreferences;
use SpiralistAIRuntime\Services\Gateway;

if (!defined('ABSPATH')) {
    exit;
}

class Plugin
{
    private Settings $settings;
    private UserPreferences $preferences;
    private Gateway $gateway;
    private bool $booted = false;

    public function boot(): void
    {
        if ($this->booted) {
            return;
        }

        $this->settings = new Settings();
        $this->preferences = new UserPreferences($this->settings);
        $this->gateway = new Gateway($this->settings, $this->preferences);

        add_action('admin_menu', [$this->settings, 'register_admin_page']);
        add_action('admin_init', [$this->settings, 'register_settings']);
        $this->booted = true;
    }

    public function settings(): Settings
    {
        return $this->settings;
    }

    public function preferences(): UserPreferences
    {
        return $this->preferences;
    }

    public function gateway(): Gateway
    {
        return $this->gateway;
    }
}