private function __construct() { // General utility functions require_once CLEF_PATH . 'includes/lib/utils.inc'; require_once CLEF_PATH . 'includes/class.clef-utils.php'; require_once CLEF_PATH . 'includes/class.clef-translation.php'; require_once CLEF_PATH . 'includes/class.clef-session.php'; // Site options require_once CLEF_PATH . 'includes/class.clef-internal-settings.php'; $settings = ClefInternalSettings::start(); global $clef_ajax; require_once CLEF_PATH . 'includes/class.clef-ajax.php'; $clef_ajax = ClefAjax::start($settings); // Onboarding settings require_once CLEF_PATH . 'includes/class.clef-onboarding.php'; $onboarding = ClefOnboarding::start($settings); require_once CLEF_PATH . 'includes/class.clef-user-settings.php'; $user_settings = ClefUserSettings::start($settings); // Clef login functions require_once CLEF_PATH . 'includes/class.clef-login.php'; $login = ClefLogin::start($settings); // Clef logout hook functions require_once CLEF_PATH . 'includes/class.clef-logout.php'; $logout = ClefLogout::start($settings); // Badge display options require_once CLEF_PATH . 'includes/class.clef-badge.php'; $badge = ClefBadge::start($settings, $onboarding); $badge->hook_display(); // Admin functions and hooks require_once CLEF_PATH . 'includes/class.clef-admin.php'; $admin = ClefAdmin::start($settings); require_once CLEF_PATH . 'includes/class.clef-network-admin.php'; $network_admin = ClefNetworkAdmin::start($settings); require_once CLEF_PATH . 'includes/pro/class.clef-pro.php'; $pro = ClefPro::start($settings); // Plugin setup hooks require_once CLEF_PATH . 'includes/class.clef-setup.php'; $this->settings = $settings; $this->badge = $badge; $this->onboarding = $onboarding; // Register public hooks if ($admin) { add_action('clef_render_settings', array($admin, 'general_settings')); } add_action('clef_plugin_uninstall', array('ClefSetup', 'uninstall_plugin')); add_action('clef_plugin_updated', array($this, 'plugin_updated'), 10, 2); add_action('wp_enqueue_scripts', array($this, 'load_base_styles')); // Run migrations and other hooks upon plugin update $old_version = $settings->get('version'); $current_version = CLEF_VERSION; if (!$old_version || $current_version != $old_version) { do_action('clef_plugin_updated', $current_version, $old_version); } if (CLEF_IS_BASE_PLUGIN) { do_action('clef_hook_admin_menu'); } }
public static function start($settings) { if (!isset(self::$instance) || self::$instance === null) { self::$instance = new self($settings); } return self::$instance; }