refactor: namespace everything
This commit is contained in:
parent
6683c0b169
commit
ce41cd8353
21 changed files with 939 additions and 839 deletions
|
@ -7,10 +7,8 @@
|
|||
* registers the activation and deactivation functions, and defines a function
|
||||
* that starts the plugin.
|
||||
*
|
||||
* @package footnotes
|
||||
* @license GPL-3.0-only
|
||||
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
|
||||
* @since 1.0.0
|
||||
* @package footnotes
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @wordpress-plugin
|
||||
* Plugin Name: footnotes
|
||||
|
@ -27,6 +25,9 @@
|
|||
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
namespace footnotes;
|
||||
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
|
@ -37,9 +38,10 @@ if ( ! defined( 'WPINC' ) ) {
|
|||
*
|
||||
* @link https://github.com/markcheret/footnotes/wiki/Versioning Versioning Guide
|
||||
*
|
||||
* @since 2.1.4
|
||||
* @todo Draw from envfile rather than hard-coding.
|
||||
* @var string PLUGIN_VERSION The version of this instance of the plugin.
|
||||
* @since 2.1.4
|
||||
* @todo Draw from envfile rather than hard-coding.
|
||||
*
|
||||
* @global string PLUGIN_VERSION The version of this instance of the plugin.
|
||||
*/
|
||||
define( 'PLUGIN_VERSION', '2.8.0d' );
|
||||
|
||||
|
@ -49,41 +51,46 @@ define( 'PLUGIN_VERSION', '2.8.0d' );
|
|||
* This primarily affects whether minified or unminified CSS/JS files are
|
||||
* requested.
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @todo Draw from envfile rather than hard-coding.
|
||||
* @todo Replace with string for >2 environment options.
|
||||
* @var bool PRODUCTION_ENV Whether the plugin is running in production mode or not. Default `false`.
|
||||
* @since 2.5.5
|
||||
* @todo Draw from envfile rather than hard-coding.
|
||||
* @todo Replace with string for >2 environment options.
|
||||
*
|
||||
* @global bool PRODUCTION_ENV Whether the plugin is running in production mode or not.
|
||||
*/
|
||||
define( 'PRODUCTION_ENV', false );
|
||||
|
||||
/**
|
||||
* Handles the activation of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @see Footnotes_Activator::activate()
|
||||
* @since 2.8.0
|
||||
* @see includes\Activator::activate()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function activate_footnotes() {
|
||||
/**
|
||||
* Provides plugin activation functionality.
|
||||
*/
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-activator.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-activator.php';
|
||||
|
||||
Footnotes_Activator::activate();
|
||||
includes\Activator::activate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the deactivation of the plugin.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @see Footnotes_Deactivator::deactivate()
|
||||
* @since 2.8.0
|
||||
* @see includes\Deactivator::deactivate()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function deactivate_footnotes() {
|
||||
/**
|
||||
* Provides plugin deactivation functionality.
|
||||
*/
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-deactivator.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-deactivator.php';
|
||||
|
||||
Footnotes_Deactivator::deactivate();
|
||||
includes\Deactivator::deactivate();
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'activate_footnotes' );
|
||||
|
@ -93,7 +100,7 @@ register_deactivation_hook( __FILE__, 'deactivate_footnotes' );
|
|||
* The core plugin class that defines internationalization, admin-specific and
|
||||
* public-facing site hooks and functionality.
|
||||
*/
|
||||
require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-core.php';
|
||||
|
||||
/**
|
||||
* Begins execution of the plugin.
|
||||
|
@ -101,11 +108,18 @@ require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php';
|
|||
* Since everything within the plugin is registered via hooks, then kicking off
|
||||
* the plugin from this point in the file does not affect the page life cycle.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function run_footnotes() {
|
||||
/**
|
||||
* The plugin core.
|
||||
*
|
||||
* @global includes\Core $footnotes
|
||||
*/
|
||||
global $footnotes;
|
||||
$footnotes = new Footnotes();
|
||||
$footnotes = new includes\Core();
|
||||
$footnotes->run();
|
||||
}
|
||||
run_footnotes();
|
||||
|
|
Reference in a new issue