Moving the activation hook calls outside of the class

Fixes #42
This commit is contained in:
Tom McFarlin 2013-05-13 08:43:08 -04:00
parent 4cd689f925
commit 2b62a4e20a
2 changed files with 7 additions and 6 deletions

View File

@ -82,10 +82,6 @@ class PluginName {
add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) );
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
register_activation_hook( __FILE__, array( $this, 'activate' ) );
register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
/*
* TODO:
*
@ -108,7 +104,7 @@ class PluginName {
*
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
*/
public function activate( $network_wide ) {
public static function activate( $network_wide ) {
// TODO: Define activation functionality here
}
@ -118,7 +114,7 @@ class PluginName {
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
* @since 1.0.0
*/
public function deactivate( $network_wide ) {
public static function deactivate( $network_wide ) {
// TODO: Define deactivation functionality here
}

View File

@ -48,5 +48,10 @@ if ( ! defined( 'PLUGIN_NAME_VERSION' ) ) {
// TODO: replace `class-plugin-boilerplate.php` with the name of the actual plugin's class file
require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-boilerplate.php' );
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) );
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
PluginName::get_instance();