From 53964530733dff38bf4962bea7cfed3f9e35881c Mon Sep 17 00:00:00 2001 From: Tom McFarlin Date: Fri, 8 Nov 2013 16:54:33 -0500 Subject: [PATCH] Revert "Updated plugin-name.php to get all name replacement changes at one place" This reverts commit a80b2ca7a491fbc1d9e0c2aba6f110b3384b2c47. --- plugin-name/plugin-name.php | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/plugin-name/plugin-name.php b/plugin-name/plugin-name.php index c38f559..e9db48a 100644 --- a/plugin-name/plugin-name.php +++ b/plugin-name/plugin-name.php @@ -30,39 +30,48 @@ if ( ! defined( 'WPINC' ) ) { die; } +/*----------------------------------------------------------------------------* + * Public-Facing Functionality + *----------------------------------------------------------------------------*/ /* - * TODO: Plugin name replacement + * TODO: * * - replace `class-plugin-name.php` with the name of the plugin's class file - * - replace Plugin_Name with the name of the class defined in `class-plugin-name.php` - * - replace `class-plugin-admin.php` with the name of the plugin's admin file - * - replace Plugin_Name_Admin with the name of the class defined in `class-plugin-name-admin.php` * */ - -$class_plugin_name_php = 'class-plugin-name.php'; -$plugin_name = 'Plugin_Name'; -$class_plugin_name_admin_php = 'class-plugin-name-admin.php'; -$plugin_name_admin = 'Plugin_Name_admin'; - -require_once( plugin_dir_path( __FILE__ ) . "/public/$class_plugin_name_php" ); +require_once( plugin_dir_path( __FILE__ ) . '/public/class-plugin-name.php' ); /* * Register hooks that are fired when the plugin is activated or deactivated. * When the plugin is deleted, the uninstall.php file is loaded. * + * TODO: + * + * - replace Plugin_Name with the name of the class defined in + * `class-plugin-name.php` */ -register_activation_hook( __FILE__, array( $plugin_name, 'activate' ) ); -register_deactivation_hook( __FILE__, array( $plugin_name, 'deactivate' ) ); +register_activation_hook( __FILE__, array( 'Plugin_Name', 'activate' ) ); +register_deactivation_hook( __FILE__, array( 'Plugin_Name', 'deactivate' ) ); -add_action( 'plugins_loaded', array( $plugin_name, 'get_instance' ) ); +/* + * TODO: + * + * - replace Plugin_Name with the name of the class defined in + * `class-plugin-name.php` + */ +add_action( 'plugins_loaded', array( 'Plugin_Name', 'get_instance' ) ); /*----------------------------------------------------------------------------* * Dashboard and Administrative Functionality *----------------------------------------------------------------------------*/ /* + * TODO: + * + * - replace `class-plugin-admin.php` with the name of the plugin's admin file + * - replace Plugin_Name_Admin with the name of the class defined in + * `class-plugin-name-admin.php` * * If you want to include Ajax within the dashboard, change the following * conditional to: @@ -75,7 +84,7 @@ add_action( 'plugins_loaded', array( $plugin_name, 'get_instance' ) ); */ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { - require_once( plugin_dir_path( __FILE__ ) . "/admin/$class_plugin_name_admin_php" ); - add_action( 'plugins_loaded', array( $plugin_name_admin, 'get_instance' ) ); + require_once( plugin_dir_path( __FILE__ ) . '/admin/class-plugin-name-admin.php' ); + add_action( 'plugins_loaded', array( 'Plugin_Name_Admin', 'get_instance' ) ); }