WooCommerce_Plugin
abstract class WooCommerce_Plugin extends Plugin
A super class of the Plugin that includes WooCommerce-specific functionality.
Traits
A trait to expand the capabilities of the WooCommerce_Plugin to include email-related functionality.
A trait to extend the Plugin functionality by providing methods for running tasks on version updates.
Properties
| static protected Singleton[] | $_instances | from Singleton | |
| protected bool | $is_submodule | from Module | |
| protected bool | $enabled | from Module | |
| static string | $includes_dir | from Module | |
| static string | $modules_dir | from Module | |
| static array | $includes | from Module | |
| protected array | $loaded_modules | from Module | |
| static protected string | $upgrades_dir | from Plugin_Upgrader_Trait | |
| protected Admin_Module | $admin_module | from Plugin | |
| static protected string | $templates_dir | from Plugin | |
| static protected string | $post_types_dir | from Plugin | |
| protected array | $loaded_post_types | from Plugin |
Methods
The constructor. Run the trait functions.
Maybe initialize singleton instance and return the instance.
A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.
An empty, placeholder function for overriding, this is where the module "starts" it's WordPress code.
The function which gets called when a module is being constructed. This ensures the submodule construct sequences don't get fired when a submodule is first initialized.
The function which gets called if this module is being imported as a submodule.
Our special function for searching for submodule folders, loading them into the current module and PHP environment.
Loop through all loaded modules and run their initialization functions.
Given a Module class name and a file path, loads the file into the PHP environment, then checks to make sure the given class extends Module and adds it to { $this->loaded_modules }
Load a class from a file and return the full class name.
Check if the Upgraders need to be run, then run them and update the current version if so.
Check if the Plugin version is newer than the currently stored version.
Update the current Plugin version in the database.
Sort Schema actions by version.
Loop through and execute all Schema actions.
A function to retrieve a template file from the templates directory.
Enqueue a script from the assets folder.
Enqueue a stylesheet from the assets folder.
Force deactivate this Plugin by updating the WordPress options. There was an 'activate' function, but you must require the Plugin file before using the class anyway.
Return the Plugin site ID, which should be the plugin folder name and the name of the PHP file.
The WooCommerce 'woocommerce_email_classes' action hook. Add the registered Emails to the list of WooCommerce Emails.
The WooCommerce 'wc_get_template' filter hook.
The WooCommerce 'wc_get_template_part' filter hook.
No description
Check whether WooCommerce is activated and throw an error message if it is not.
Details
at line 39
__construct()
The constructor. Run the trait functions.
in
Singleton at line 42
final static Singleton
instance(mixed $args = null)
Maybe initialize singleton instance and return the instance.
in
Singleton at line 63
final static array
get_instances()
Return a copy of the instances array.
in
Singleton at line 72
final protected ReflectionClass
get_class_reflection()
A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.
in
Module at line 82
static
construct()
An empty, placeholder function for overriding, this is where the module "starts" it's WordPress code.
in
Module at line 87
static
submodule_construct()
The function which gets called when a module is being constructed. This ensures the submodule construct sequences don't get fired when a submodule is first initialized.
in
Module at line 98
final static
submodule_instance()
The function which gets called if this module is being imported as a submodule.
in
Module at line 105
final protected
register_submodules()
Our special function for searching for submodule folders, loading them into the current module and PHP environment.
in
Module at line 136
final protected
construct_submodules()
Loop through all loaded modules and run their initialization functions.
in
Module at line 149
final protected
import_module(string $module_path)
Given a Module class name and a file path, loads the file into the PHP environment, then checks to make sure the given class extends Module and adds it to { $this->loaded_modules }
in
Module at line 173
final protected string|false
load_class_file(string $file_path)
Load a class from a file and return the full class name.
in
Module at line 225
final array
get_loaded_modules()
Get the currently loaded modules.
in
Plugin_Upgrader_Trait at line 34
final
init_upgrader()
Check if the Upgraders need to be run, then run them and update the current version if so.
in
Plugin_Upgrader_Trait at line 46
final bool
requires_version_upgrade()
Check if the Plugin version is newer than the currently stored version.
in
Plugin_Upgrader_Trait at line 63
final
run_upgrades()
Find all upgrade Schemas and run them.
in
Plugin_Upgrader_Trait at line 103
final
update_current_version()
Update the current Plugin version in the database.
in
Plugin_Upgrader_Trait at line 115
final static array
sort_upgrade_schemas(array $upgrade_schemas)
Sort Schema actions by version.
in
Plugin_Upgrader_Trait at line 142
final static
execute_schemas(string $current_version, array $upgrade_schemas)
Loop through and execute all Schema actions.
in
Plugin at line 52
final null|Admin_Module
get_admin_module()
Get the Admin Module.
in
Plugin at line 83
static
activation()
A default, empty function to run on plugin activation.
in
Plugin at line 90
static
deactivation()
A default, empty function to run on plugin deactivation.
in
Plugin at line 98
final
get_template(string $template, array $args = array())
A function to retrieve a template file from the templates directory.
in
Plugin at line 122
final
enqueue_js(string $script, array $reqs = array(), array $locatization_data = array())
Enqueue a script from the assets folder.
in
Plugin at line 141
final
enqueue_css(string $style, array $reqs = array())
Enqueue a stylesheet from the assets folder.
in
Plugin at line 217
final
deactivate()
Force deactivate this Plugin by updating the WordPress options. There was an 'activate' function, but you must require the Plugin file before using the class anyway.
in
Plugin at line 232
final string
get_plugin_file()
Return the file location of the Plugin instance.
in
Plugin at line 241
final string
get_plugin_id()
Return the Plugin site ID, which should be the plugin folder name and the name of the PHP file.
in
Email_Traits at line 35
final array
_woocommerce_email_classes(array $emails)
The WooCommerce 'woocommerce_email_classes' action hook. Add the registered Emails to the list of WooCommerce Emails.
in
Email_Traits at line 62
final
load_emails()
Load the WC Email files.
at line 61
final static string
_wc_get_template(string $template, string $template_name)
The WooCommerce 'wc_get_template' filter hook.
at line 85
final static string
_wc_get_template_part(string $template, string $slug, string $name)
The WooCommerce 'wc_get_template_part' filter hook.
at line 108
final static
_woocommerce_locate_core_template(string $core_file, string $template, string $template_base, string $email_id)
No description
at line 128
final bool
woocommerce_check()
Check whether WooCommerce is activated and throw an error message if it is not.