From d1ca1bf9b7cc7e8bd800537257e9d636437b03d8 Mon Sep 17 00:00:00 2001 From: Alex Standiford Date: Tue, 23 Nov 2021 10:42:10 -0600 Subject: [PATCH] PSR4 support --- bootstrap.php | 12 ++++++++++ composer.json | 3 ++- index.php | 22 ------------------- lib/{abstracts => Abstracts}/Widget.php | 0 .../Widget_Instance.php | 0 lib/{loaders => Loaders}/Widgets.php | 0 6 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 bootstrap.php delete mode 100644 index.php rename lib/{abstracts => Abstracts}/Widget.php (100%) rename lib/{factories => Factories}/Widget_Instance.php (100%) rename lib/{loaders => Loaders}/Widgets.php (100%) diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 0000000..a830f4a --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,12 @@ + 'Underpin\Widgets\Loaders\Widgets', +] ) ); \ No newline at end of file diff --git a/composer.json b/composer.json index c11e685..33aa3c8 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,9 @@ "underpin/underpin": "^2.0" }, "autoload": { + "psr-4": {"Underpin\\Commands\\": "lib/"}, "files": [ - "index.php" + "bootstrap.php" ] } } diff --git a/index.php b/index.php deleted file mode 100644 index 2bd27bf..0000000 --- a/index.php +++ /dev/null @@ -1,22 +0,0 @@ - function ( Underpin $plugin, $args ) { - if ( ! defined( 'UNDERPIN_WIDGETS_ROOT_DIR' ) ) { - define( 'UNDERPIN_WIDGETS_ROOT_DIR', plugin_dir_path( __FILE__ ) ); - } - require_once( UNDERPIN_WIDGETS_ROOT_DIR . 'lib/abstracts/Widget.php' ); - require_once( UNDERPIN_WIDGETS_ROOT_DIR . 'lib/loaders/Widgets.php' ); - require_once( UNDERPIN_WIDGETS_ROOT_DIR . 'lib/factories/Widget_Instance.php' ); - $plugin->loaders()->add( 'widgets', [ - 'class' => 'Underpin\Widgets\Loaders\Widgets', - ] ); - }, -] ) ); \ No newline at end of file diff --git a/lib/abstracts/Widget.php b/lib/Abstracts/Widget.php similarity index 100% rename from lib/abstracts/Widget.php rename to lib/Abstracts/Widget.php diff --git a/lib/factories/Widget_Instance.php b/lib/Factories/Widget_Instance.php similarity index 100% rename from lib/factories/Widget_Instance.php rename to lib/Factories/Widget_Instance.php diff --git a/lib/loaders/Widgets.php b/lib/Loaders/Widgets.php similarity index 100% rename from lib/loaders/Widgets.php rename to lib/Loaders/Widgets.php