1 | <?php |
||
2 | /** |
||
3 | * @package WPEmerge |
||
4 | * @author Atanas Angelov <[email protected]> |
||
5 | * @copyright 2019 Atanas Angelov |
||
6 | * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 |
||
7 | * @link https://wpemerge.com/ |
||
8 | */ |
||
9 | |||
10 | if ( ! defined( 'ABSPATH' ) ) { |
||
11 | exit; |
||
12 | } |
||
13 | |||
14 | $container = \WPEmerge\Facades\Application::getContainer(); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
15 | $kernel = $container[ WPEMERGE_WORDPRESS_HTTP_KERNEL_KEY ]; |
||
16 | |||
17 | $kernel->bootstrap(); |
||
18 | |||
19 | add_action( 'template_include', function ( $view ) use ( $container, $kernel ) { |
||
20 | $request = $container[ WPEMERGE_REQUEST_KEY ]; |
||
21 | |||
22 | $response = $kernel->handle( $request, $view ); |
||
23 | |||
24 | if ( $response instanceof \Psr\Http\Message\ResponseInterface ) { |
||
25 | $container[ WPEMERGE_RESPONSE_KEY ] = $response; |
||
26 | |||
27 | return WPEMERGE_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'view.php'; |
||
28 | } |
||
29 | |||
30 | return $view; |
||
31 | }, 1000 ); |
||
32 |