init(); $utilities = new WP_AI_Workflows_Utilities(); $database = new WP_AI_Workflows_Database(); $workflow = new WP_AI_Workflows_Workflow(); $node_execution = new WP_AI_Workflows_Node_Execution(); $rest_api = new WP_AI_Workflows_REST_API(); $shortcode = new WP_AI_Workflows_Shortcode(); $admin = new WP_AI_Workflows_Admin(); // Run the plugin components $utilities->init(); $database->init(); $workflow->init(); $node_execution->init(); $rest_api->init(); $shortcode->init(); $admin->init(); } /** * Schedule the cleanup cron job. */ function wp_ai_workflows_schedule_cleanup_cron() { if (!wp_next_scheduled('wp_ai_workflows_cleanup')) { wp_schedule_event(time(), 'daily', 'wp_ai_workflows_cleanup'); } } add_action('wp', 'wp_ai_workflows_schedule_cleanup_cron'); /** * Handle plugin updates. */ function wp_ai_workflows_update_check() { $current_version = get_option('wp_ai_workflows_lite_version', '0'); if (version_compare($current_version, WP_AI_WORKFLOWS_LITE_VERSION, '<')) { if ($current_version === '0') { activate_wp_ai_workflows(); } update_option('wp_ai_workflows_lite_version', WP_AI_WORKFLOWS_LITE_VERSION); } } add_action('plugins_loaded', 'wp_ai_workflows_update_check'); // Run the plugin run_wp_ai_workflows();