diff --git a/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php b/src/WpStarter/Wordpress/Admin/AdminServiceProvider.php index 8048b31..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 { @@ -56,8 +57,8 @@ function boot() if(!is_wp()){ return ; } - if($this->app->bound(Kernel::class)) { - $this->app->make(Kernel::class)->handle($this->app['request']); + if(is_admin() && $this->app->bound(Kernel::class)) { + $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() 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 = [];