mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 11:53:53 +02:00
fixing a small type, documentation the imports, changing the way in which the plugin is instantiated
This commit is contained in:
parent
cc6df31722
commit
0fdaeaa67c
1 changed files with 34 additions and 33 deletions
|
@ -8,7 +8,7 @@
|
||||||
* @package Plugin_Name
|
* @package Plugin_Name
|
||||||
* @author Your Name or Company Name <email@domain.com>
|
* @author Your Name or Company Name <email@domain.com>
|
||||||
* @license GPL-2.0+
|
* @license GPL-2.0+
|
||||||
* @link http://exmaple.com/plugin-name
|
* @link http://example.com/plugin-name
|
||||||
* @copyright 2014 Your Name or Company Name
|
* @copyright 2014 Your Name or Company Name
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
|
@ -30,21 +30,15 @@ if ( ! defined( 'WPINC' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes the plugin activation class that runs during plugin activation.
|
* The plugin activation class that runs during plugin activation.
|
||||||
*/
|
*/
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-activator.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-activator.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes the plugin deactivation class that runs during plugin deactivation.
|
* The plugin deactivation class that runs during plugin deactivation.
|
||||||
*/
|
*/
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-deactivator.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-deactivator.php';
|
||||||
|
|
||||||
/**
|
|
||||||
* The base class used to define certain functionality and attributes shared among
|
|
||||||
* all shared subclasses of the core plugin file.
|
|
||||||
*/
|
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php';
|
|
||||||
|
|
||||||
/** This action is documented in includes/class-plugin-name-activator.php */
|
/** This action is documented in includes/class-plugin-name-activator.php */
|
||||||
register_activation_hook( __FILE__, array( 'Plugin_Name_Activator', 'activate' ) );
|
register_activation_hook( __FILE__, array( 'Plugin_Name_Activator', 'activate' ) );
|
||||||
|
|
||||||
|
@ -52,40 +46,47 @@ register_activation_hook( __FILE__, array( 'Plugin_Name_Activator', 'activate' )
|
||||||
register_activation_hook( __FILE__, array( 'Plugin_Name_Deactivator', 'deactivate' ) );
|
register_activation_hook( __FILE__, array( 'Plugin_Name_Deactivator', 'deactivate' ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes the class responsible for defining the core functionality of the
|
* The class responsible for orchestrating the actions and filters of the
|
||||||
* shared components of the plugin.
|
* core plugin.
|
||||||
*/
|
*/
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-loader.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-loader.php';
|
||||||
$loader = new Plugin_Name_Loader();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes the class responsible for defining internationalization functionality
|
* The class responsible for defining internationalization functionality
|
||||||
* of the plugin.
|
* of the plugin.
|
||||||
*/
|
*/
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-i18n.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-i18n.php';
|
||||||
$plugin_i18n = new Plugin_Name_i18n();
|
|
||||||
$loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* The base class used to define certain functionality and attributes used among
|
||||||
*/
|
* the dashboard-specific and public-facing functionality.
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin.php';
|
|
||||||
$plugin_name_admin = new Plugin_Name_Admin();
|
|
||||||
$loader->add_action( 'admin_enqueue_scripts', $plugin_name_admin, 'enqueue_styles' );
|
|
||||||
$loader->add_action( 'admin_enqueue_scripts', $plugin_name_admin, 'enqueue_scripts' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'public/class-plugin-name-public.php';
|
|
||||||
$plugin_name_public = new Plugin_Name_Public();
|
|
||||||
$loader->add_action( 'wp_enqueue_scripts', $plugin_name_public, 'enqueue_styles' );
|
|
||||||
$loader->add_action( 'wp_enqueue_scripts', $plugin_name_public, 'enqueue_scripts' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*/
|
*/
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class responsible for defining all actions that occur in the Dashboard.
|
||||||
|
*/
|
||||||
|
require_once plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class responsible for defining all actions that occur in the public-facing
|
||||||
|
* side of the site.
|
||||||
|
*/
|
||||||
|
require_once plugin_dir_path( __FILE__ ) . 'public/class-plugin-name-public.php';
|
||||||
|
|
||||||
|
$loader = new Plugin_Name_Loader();
|
||||||
$plugin = new Plugin_Name( $loader );
|
$plugin = new Plugin_Name( $loader );
|
||||||
|
|
||||||
$plugin->run();
|
$plugin_i18n = new Plugin_Name_i18n();
|
||||||
|
$plugin_i18n->set_domain( $plugin->get_slug() );
|
||||||
|
$loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
||||||
|
|
||||||
|
$plugin_admin = new Plugin_Name_Admin( $plugin->get_version() );
|
||||||
|
$loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
||||||
|
$loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
|
||||||
|
|
||||||
|
$plugin_public = new Plugin_Name_Public( $plugin->get_version() );
|
||||||
|
$loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
||||||
|
$loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
|
||||||
|
|
||||||
|
$plugin->run();
|
||||||
|
|
Loading…
Reference in a new issue