diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 0000000..e6a021b --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,14 @@ + 'Underpin\Admin_Bar_Menu\Abstracts\Admin_Bar_Menu', + 'default' => 'Underpin\Admin_Bar_Menu\Factories\Admin_Bar_Menu_Instance', +] ) ); \ No newline at end of file diff --git a/composer.json b/composer.json index b5f86b8..94d49f9 100644 --- a/composer.json +++ b/composer.json @@ -10,11 +10,12 @@ } ], "require": { - "underpin/logger-loader": "^2.0" + "underpin/underpin": "^2.0" }, "autoload": { + "psr-4": {"Underpin\\Admin_Bar_Menu\\": "lib/"}, "files": [ - "underpin-admin-bar-menus.php" + "bootstrap.php" ] } } diff --git a/Admin_Bar_Menu.php b/lib/Abstracts/Admin_Bar_Menu.php similarity index 94% rename from Admin_Bar_Menu.php rename to lib/Abstracts/Admin_Bar_Menu.php index d58d0d7..1beda4b 100644 --- a/Admin_Bar_Menu.php +++ b/lib/Abstracts/Admin_Bar_Menu.php @@ -7,13 +7,13 @@ */ -namespace Underpin_Admin_Bar_Menu\Abstracts; +namespace Underpin\Admin_Bar_Menu\Abstracts; +use Underpin\Loaders\Logger; use Underpin\Traits\Feature_Extension; use WP_Admin_Bar; use WP_User; -use function Underpin\underpin; if ( ! defined( 'ABSPATH' ) ) { exit; @@ -128,7 +128,7 @@ public function add_admin_bar( WP_Admin_Bar $admin_bar ) { $args = $this->args; $args['id'] = $this->id; - underpin()->logger()->log( + Logger::log( 'notice', 'child_menu_added', 'An admin bar menu item, ' . $this->id . ' was added' @@ -142,14 +142,14 @@ public function add_admin_bar( WP_Admin_Bar $admin_bar ) { $admin_bar->add_menu( $child ); - underpin()->logger()->log( + Logger::log( 'notice', 'child_menu_added', 'A child menu item, ' . $id . ' was added to the ' . $this->name . ' admin bar menu.' ); } } else { - underpin()->logger()->log( + Logger::log( 'warning', 'user_cannot_view_menu', 'The specified user cannot view the ' . $this->name . ' menu. It will not be displayed.', diff --git a/Admin_Bar_Menu_Instance.php b/lib/Factories/Admin_Bar_Menu_Instance.php similarity index 81% rename from Admin_Bar_Menu_Instance.php rename to lib/Factories/Admin_Bar_Menu_Instance.php index fd575a0..958719d 100644 --- a/Admin_Bar_Menu_Instance.php +++ b/lib/Factories/Admin_Bar_Menu_Instance.php @@ -7,14 +7,11 @@ */ -namespace Underpin_Admin_Bar_Menu\Factories; +namespace Underpin\Admin_Bar_Menu\Factories; use Underpin\Traits\Instance_Setter; -use Underpin_Admin_Bar_Menu\Abstracts\Admin_Bar_Menu; -use WP_Admin_Bar; -use WP_User; -use function Underpin\underpin; +use Underpin\Admin_Bar_Menu\Abstracts\Admin_Bar_Menu; if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/underpin-admin-bar-menus.php b/underpin-admin-bar-menus.php deleted file mode 100644 index 690ad63..0000000 --- a/underpin-admin-bar-menus.php +++ /dev/null @@ -1,14 +0,0 @@ -get( $file, $class )->loaders()->add( 'admin_bar_menus', [ - 'instance' => 'Underpin_Admin_Bar_Menu\Abstracts\Admin_Bar_Menu', - 'default' => 'Underpin_Admin_Bar_Menu\Factories\Admin_Bar_Menu_Instance', - ] ); -}, 10, 2 ); \ No newline at end of file