load_modules(); } private function load_modules() { $this->load_module('auth'); $this->load_module('stats'); $this->load_module('client'); $this->load_module('events'); $this->load_module('pipelines'); } private function load_module($module_name) { $file = XCRM_PLUGIN_DIR . "api/modules/{$module_name}.php"; if (file_exists($file)) { require_once $file; $class_name = 'XCRM_' . ucfirst($module_name) . '_API'; $this->modules[$module_name] = new $class_name(); } } public function get_module($module_name) { return isset($this->modules[$module_name]) ? $this->modules[$module_name] : null; } public function get_modules() { return array_keys($this->modules); } } function xcrm_api() { return XCRM_API_Loader::get_instance(); } function xcrm_sdk() { return xcrm_api()->get_module('sdk'); } function xcrm_auth() { return xcrm_api()->get_module('auth'); } function xcrm_stats() { return xcrm_api()->get_module('stats'); } function xcrm_client() { return xcrm_api()->get_module('client'); } function xcrm_events() { return xcrm_api()->get_module('events'); } function xcrm_pipelines() { return xcrm_api()->get_module('pipelines'); }