1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 11:53:53 +02:00

instantiating and loading the dashboard-specific and public-facing areas of the plugin

also updating the docblocks to explain what each hooked function is doing
This commit is contained in:
Tom McFarlin 2014-05-03 15:26:22 -04:00
parent 91273f37d4
commit b3451b717f

View file

@ -49,3 +49,62 @@ register_activation_hook( __FILE__, array( 'Plugin_Name_Activator', 'activate' )
/** This action is documented in includes/class-plugin-name-deactivator.php */ /** This action is documented in includes/class-plugin-name-deactivator.php */
register_activation_hook( __FILE__, array( 'Plugin_Name_Deactivator', 'deactivate' ) ); register_activation_hook( __FILE__, array( 'Plugin_Name_Deactivator', 'deactivate' ) );
add_action( 'admin_init', 'plugin_name_admin_init' );
/**
* Initializes the Dashboard-specific functionality of the plugin.
*
* When the admin_init hook is fired, initializes the Dashboard-specific functionality
* of the plugin by injecting an instance of Plugin_Name_Admin into the
* Plugin_Name_Admin_Loader then executes the functionality.
*
* @since 1.0.0
*/
function plugin_name_admin_init() {
/**
* Includes the class responsible for defining the core functionality of the
* dashboard-specific part of the plugin
*/
require_once plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin.php';
/**
* Includes the class responsible for registering all of the Plugin_Name_Admin functions
* with their appropriate callbacks.
*/
require_once plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin-loader.php';
$admin_loader = new Plugin_Name_Admin_Loader();
$admin_loader->run( new Plugin_Name_Admin() );
}
add_action( 'plugins_loaded', 'plugin_name_plugin_loaded' );
/**
* Initializes the public-facing functionality of the plugin.
*
* When the plugins_loaded hook is fired, initializes the public-facing
* functionality of the plugin by injecting an instance of Plugin_Name_Admin
* into the Plugin_Name_Admin_Loader then executes the functionality.
*
* @since 1.0.0
*/
function plugin_name_plugin_loaded() {
/**
* Includes the class responsible for defining the core functionality of
* the public-facing part of the plugin
*/
require_once plugin_dir_path( __FILE__ ) . 'public/class-plugin-name-public.php';
/**
* Includes the class responsible for registering all of the Plugin_Name_Public
* functions with their appropriate callbacks.
*/
require_once plugin_dir_path( __FILE__ ) . 'public/class-plugin-name-public-loader.php';
$loader = new Plugin_Name_Public_Loader();
$loader->run( new Plugin_Name_Public() );
}