-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
50 lines (38 loc) · 1.16 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Retrieves or sets the Symfony Dependency Injection container
*
* @param ContainerInterface|string $id
*
* @return mixed
*/
function symfony($id)
{
static $container;
if ($id instanceof ContainerInterface) {
$container = $id;
return;
}
return $container->get($id);
}
$loader = require __DIR__.'/../application/vendor/autoload.php';
require_once __DIR__.'/wp-load.php';
require_once __DIR__.'/../application/var/bootstrap.php.cache';
// Load application kernel
require_once __DIR__.'/../application/app/AppKernel.php';
$sfKernel = new AppKernel('dev', true);
$sfKernel->loadClassCache();
$sfKernel->boot();
// Add Symfony container as a global variable to be used in Wordpress
$sfContainer = $sfKernel->getContainer();
if (true === $sfContainer->getParameter('kernel.debug', false)) {
Debug::enable();
}
symfony($sfContainer);
$sfRequest = Request::createFromGlobals();
$sfResponse = $sfKernel->handle($sfRequest);
$sfResponse->send();
$sfKernel->terminate($sfRequest, $sfResponse);