From a7e0a45246e6cdb88ef3702edc5751ed20b72b1b Mon Sep 17 00:00:00 2001 From: as247 Date: Wed, 8 Nov 2023 15:02:41 +0700 Subject: [PATCH 1/3] Admin Kernel only run on admin --- src/WpStarter/Wordpress/Admin/AdminServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php b/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php index 8048b31..bbf0201 100644 --- a/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php +++ b/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php @@ -56,7 +56,7 @@ function boot() if(!is_wp()){ return ; } - if($this->app->bound(Kernel::class)) { + if(is_admin() && $this->app->bound(Kernel::class)) { $this->app->make(Kernel::class)->handle($this->app['request']); $this->loadViewsFrom(__DIR__ . '/resources/views', 'wp.admin'); } From 6aa6c9ce6f0be2d42159f5f697eb7bb714faed9a Mon Sep 17 00:00:00 2001 From: as247 Date: Wed, 8 Nov 2023 15:11:20 +0700 Subject: [PATCH 2/3] Admin will use difference request --- .../Wordpress/Admin/AdminServiceProvider.php | 3 ++- src/WpStarter/Wordpress/Admin/Kernel.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php b/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php index bbf0201..50c62f3 100644 --- a/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php +++ b/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php @@ -10,6 +10,7 @@ use WpStarter\Wordpress\Admin\Notice\SessionStore; use WpStarter\Wordpress\Admin\Routing\Router; use WpStarter\Wordpress\Admin\Services\ScreenOption; +use WpStarter\Http\Request; class AdminServiceProvider extends ServiceProvider { @@ -57,7 +58,7 @@ function boot() return ; } if(is_admin() && $this->app->bound(Kernel::class)) { - $this->app->make(Kernel::class)->handle($this->app['request']); + $this->app->make(Kernel::class)->handle(Request::capture()); $this->loadViewsFrom(__DIR__ . '/resources/views', 'wp.admin'); } } diff --git a/src/WpStarter/Wordpress/Admin/Kernel.php b/src/WpStarter/Wordpress/Admin/Kernel.php index 92686a6..eec68ce 100644 --- a/src/WpStarter/Wordpress/Admin/Kernel.php +++ b/src/WpStarter/Wordpress/Admin/Kernel.php @@ -5,6 +5,7 @@ use WpStarter\Contracts\Debug\ExceptionHandler; use WpStarter\Contracts\Foundation\Application; use WpStarter\Routing\Pipeline; +use WpStarter\Support\Facades\Facade; use WpStarter\Wordpress\Admin\Routing\Response; use WpStarter\Wordpress\Admin\Routing\Router; use WpStarter\Wordpress\Http\Response\PassThrough; @@ -133,6 +134,12 @@ function handleAdmin($request, $screenId) */ protected function sendRequestThroughRouter($request, $screenId) { + $this->app->instance('request', $request); + + Facade::clearResolvedInstance('request'); + + $this->bootstrap(); + return (new Pipeline($this->app)) ->send($request) ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) @@ -387,7 +394,9 @@ protected function syncMiddlewareToRouter() public function bootstrap() { - + if (! $this->app->hasBeenBootstrapped()) { + //No bootstrap here + } } public function getApplication() From 1e8ed71bd016b7c425e068b82464ffaf4ac16c5c Mon Sep 17 00:00:00 2001 From: as247 Date: Wed, 8 Nov 2023 15:11:38 +0700 Subject: [PATCH 3/3] v1.9.2 --- src/WpStarter/Wordpress/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WpStarter/Wordpress/Application.php b/src/WpStarter/Wordpress/Application.php index deed41c..ec0214a 100644 --- a/src/WpStarter/Wordpress/Application.php +++ b/src/WpStarter/Wordpress/Application.php @@ -11,7 +11,7 @@ class Application extends \WpStarter\Foundation\Application * * @var string */ - const VERSION = '1.9.1'; + const VERSION = '1.9.2'; protected $bootstrappedList = [];