-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
InfrastructureIssues for the overall plugin infrastructureIssues for the overall plugin infrastructure[Type] EnhancementA suggestion for improvement of an existing featureA suggestion for improvement of an existing feature
Milestone
Description
Description
The Plugin Main class will be used as the plugin’s most central class and will be used to bootstrap the Plugin Check plugin. Using a class allows all bootstrapping logic for the Plugin Check plugin to be consolidated in a single class, separating it from check logic and making it easier to maintain. This class will be responsible for setting up the plugin checker by registering hooks in WordPress and any other logic required, for example:
- Adding hooks and filters to register the plugin check WP-CLI command
- Enqueuing any assets required for the Plugin Check admin screen
- Localization support
Plugin_Main class will be instantiated in the plugin-check.php file of the Plugin Check plugin. It will accept a single $main_file parameter in its constructor which is used to create the plugin context. The context of the plugin will be handled by the protected property $context (Plugin_Context).
Acceptance Criteria
- A new
Plugin_Mainclass is created - The class contains a single protected property named
$context - The class
__construct()method accepts a single parameter(string) $main_file- A string representing the absolute path to the plugin main file- The
$main_fileparameter is passed to a new instances of thePlugin_Contextclass - The new
Plugin_Contextinstances is assigned to the protected$contextproperty
- An empty
add_hooksmethod exists in thePlugin_Mainclass to be updated later to register hooks to WordPress - A new
Plugin_Contextclass is created. This class will be empty and setup as a basic scaffold for Create Plugin_Context class #5 - The
plugin-check.phpfile is updated to include the following:- Constant
WP_PLUGIN_CHECK_VERSIONdefined with the plugin version - Constant
WP_PLUGIN_CHECK_MINIMUM_PHPdefined with the minimum PHP version required for the plugin check plugin to work - A
wp_plugin_check_loadfunction exists which:- Checks the current PHP version is greater than the
WP_PLUGIN_CHECK_MINIMUM_PHPconstant - Checks the
vendor/autoload.phpfile exists in the plugin - If the above checks pass
- The
vendor/autoload.phpfile is required in - The
Plugin_Mainclass is instantiated passing__FILE__into the constructor - The
add_hooks()method is called on the instantiatedPlugin_Mainobject
- The
- Checks the current PHP version is greater than the
- Constant
Metadata
Metadata
Assignees
Labels
InfrastructureIssues for the overall plugin infrastructureIssues for the overall plugin infrastructure[Type] EnhancementA suggestion for improvement of an existing featureA suggestion for improvement of an existing feature