get_rest_namespaces() as $namespace => $controllers) { foreach ($controllers as $controller_name => $controller_class) { $controller_class_name = "WPFunnels\\Rest\\Controllers\\".$controller_class; if ( ! class_exists( $controller_class_name ) ) { continue; } $this->controllers[ $namespace ][ $controller_name ] = new $controller_class_name(); $this->controllers[ $namespace ][ $controller_name ]->register_routes(); } } } /** * Get API namespaces - new namespaces should be registered here. * * @return array List of Namespaces and Main controller classes. */ protected function get_rest_namespaces() { return [ 'wpfunnels/v1' => $this->get_controllers(), ]; } /** * List of controllers in the wc/v1 namespace. * * @return array */ protected function get_controllers() { return apply_filters( 'wpfunnels/rest_api_controllers', array( 'mcp_settings' => 'McpSettingsController', 'settings' => 'SettingsController', 'templates_library' => 'TemplateLibraryController', 'order_bump' => 'OrderBumpController', 'funnel_control' => 'FunnelController', 'offer' => 'OfferController', 'step_control' => 'StepController', 'remote_funnel' => 'RemoteFunnelsController', 'products' => 'ProductsController', 'gutenberg' => 'GutenbergCSSController', 'checkout' => 'CheckoutController', 'importexport' => 'ImportExportController', 'report' => 'DashboardController', 'plugin_installer' => 'PluginInstallerController', 'setup_wizard' => 'SetupWizardController', 'store_checkout' => 'StoreCheckoutController', 'automation' => 'WpfnlAutomationController', 'ai_chat' => 'AiChatController', 'ai_generate' => 'SingleShotAiController', )); } /** * Return the path to the package. * * @return string */ public static function get_path() { return dirname(__DIR__); } }