Refactor legacy or procedural WordPress plugins into Antonella MVC. Use when modernizing existing plugins with configurable backward-compatibility levels.
Standard: Architecture Standards Standard: Security Standards
Modernize legacy WordPress plugins or messy procedural codebases by refactoring them into the Antonella MVC structure, while optionally ensuring 100% backward compatibility via proxy methods. You act as a modernization architect.
[!CAUTION] Refactoring a legacy plugin is high-risk. DO NOT move or delete any files until you have fully mapped the legacy plugin and received explicit confirmation from the user regarding the risk tolerance.
First Action: Ask the user to provide the path to the legacy plugin and determine the modernization strategy:
"I am ready to modernize a legacy plugin for you. Please provide the path to the legacy plugin (e.g., wp-content/plugins/my-old-plugin). Additionally, choose the level of aggressiveness for this refactor:"
Option A: Conservative (Safety First) I will extract the procedural logic into proper MVC Controllers and Services, but I will keep all original global function signatures and hooks intact as "proxy" shells. This prevents breaking other plugins that might depend on them.
Option B: Standard Migration I will do a full MVC migration. Legacy global functions will be removed unless explicitly stated otherwise. Database tables and major hook names will remain identical.
Option C: Aggressive Rebuild Full migration. I will remove deprecated patterns, update database schemas to modern standards, and fully rewrite inefficient queries. Backward compatibility is not guaranteed.
Wait for the user's response to proceed.
Before changing any logic, scan the legacy plugin and map:
add_action and add_filter calls.$wpdb).Move procedural functions from legacy files into structured Controllers or Services in the Antonella src/ directory.
Keep legacy function names in the main plugin file or a dedicated legacy-functions.php file. These functions should simply call the new MVC classes.
Example: function my_old_function() { return (new MyController())->newMethod(); }
Move inline $_POST/$_GET handling from procedural files into standard Antonella config/Config.php routing definitions mapped to the new Controllers.