Skip to content

Commit 045a003

Browse files
authored
Merge pull request #109 from wpstarter/dev
v1.9.2
2 parents b8cf863 + 1e8ed71 commit 045a003

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/WpStarter/Wordpress/Admin/AdminServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use WpStarter\Wordpress\Admin\Notice\SessionStore;
1111
use WpStarter\Wordpress\Admin\Routing\Router;
1212
use WpStarter\Wordpress\Admin\Services\ScreenOption;
13+
use WpStarter\Http\Request;
1314

1415
class AdminServiceProvider extends ServiceProvider
1516
{
@@ -56,8 +57,8 @@ function boot()
5657
if(!is_wp()){
5758
return ;
5859
}
59-
if($this->app->bound(Kernel::class)) {
60-
$this->app->make(Kernel::class)->handle($this->app['request']);
60+
if(is_admin() && $this->app->bound(Kernel::class)) {
61+
$this->app->make(Kernel::class)->handle(Request::capture());
6162
$this->loadViewsFrom(__DIR__ . '/resources/views', 'wp.admin');
6263
}
6364
}

src/WpStarter/Wordpress/Admin/Kernel.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use WpStarter\Contracts\Debug\ExceptionHandler;
66
use WpStarter\Contracts\Foundation\Application;
77
use WpStarter\Routing\Pipeline;
8+
use WpStarter\Support\Facades\Facade;
89
use WpStarter\Wordpress\Admin\Routing\Response;
910
use WpStarter\Wordpress\Admin\Routing\Router;
1011
use WpStarter\Wordpress\Http\Response\PassThrough;
@@ -133,6 +134,12 @@ function handleAdmin($request, $screenId)
133134
*/
134135
protected function sendRequestThroughRouter($request, $screenId)
135136
{
137+
$this->app->instance('request', $request);
138+
139+
Facade::clearResolvedInstance('request');
140+
141+
$this->bootstrap();
142+
136143
return (new Pipeline($this->app))
137144
->send($request)
138145
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
@@ -387,7 +394,9 @@ protected function syncMiddlewareToRouter()
387394

388395
public function bootstrap()
389396
{
390-
397+
if (! $this->app->hasBeenBootstrapped()) {
398+
//No bootstrap here
399+
}
391400
}
392401

393402
public function getApplication()

src/WpStarter/Wordpress/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Application extends \WpStarter\Foundation\Application
1111
*
1212
* @var string
1313
*/
14-
const VERSION = '1.9.1';
14+
const VERSION = '1.9.2';
1515

1616
protected $bootstrappedList = [];
1717

0 commit comments

Comments
 (0)