diff --git a/sources/sf2/Generic/WordpressBundle/DependencyInjection/GenericWordpressExtension.php b/sources/sf2/Generic/WordpressBundle/DependencyInjection/GenericWordpressExtension.php index 6648ff0..cb9c11e 100644 --- a/sources/sf2/Generic/WordpressBundle/DependencyInjection/GenericWordpressExtension.php +++ b/sources/sf2/Generic/WordpressBundle/DependencyInjection/GenericWordpressExtension.php @@ -24,5 +24,6 @@ public function load(array $configs, ContainerBuilder $container) $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); + } } diff --git a/sources/sf2/Generic/WordpressBundle/Resources/config/services.yml b/sources/sf2/Generic/WordpressBundle/Resources/config/services.yml index 4e21a50..84060ac 100644 --- a/sources/sf2/Generic/WordpressBundle/Resources/config/services.yml +++ b/sources/sf2/Generic/WordpressBundle/Resources/config/services.yml @@ -1,5 +1,5 @@ parameters: - wordpress.url_login: '' + wordpress.url_login: '' wordpress.loader.class: Generic\WordpressBundle\Services\WordpressLoader wordpress.shortcode_loader.class: Generic\WordpressBundle\Services\WordpressShortcodeLoader wordpress.metabox_loader.class: Generic\WordpressBundle\Services\WordpressMetaboxLoader @@ -22,7 +22,7 @@ services: wordpress.security.authentication.listener: class: Generic\WordpressBundle\Security\WordpressAuthenticationListener - arguments: ['@security.firewall.map.context.main', '@security.authentication.manager'] + arguments: ['@security.token_storage', '@security.authentication.manager'] wordpress.loader: class : %wordpress.loader.class% @@ -30,7 +30,7 @@ services: wordpress.shortcode_loader: class: %wordpress.shortcode_loader.class% - + wordpress.metabox_loader: class: %wordpress.metabox_loader.class% @@ -75,9 +75,4 @@ services: class: %wordpress.wordpress_extension.class% arguments: [ '@wordpress.loader' ] tags: - - { name: twig.extension } - -# wordpress.controller_resolver: -# class: %wordpress.controller_resolver.class% -# arguments: [@default.controller_resolver, @service_container ] - + - { name: twig.extension } \ No newline at end of file diff --git a/sources/sf2/Generic/WordpressBundle/Security/WordpressAuthenticationListener.php b/sources/sf2/Generic/WordpressBundle/Security/WordpressAuthenticationListener.php index 2e85dae..33315dc 100644 --- a/sources/sf2/Generic/WordpressBundle/Security/WordpressAuthenticationListener.php +++ b/sources/sf2/Generic/WordpressBundle/Security/WordpressAuthenticationListener.php @@ -4,21 +4,22 @@ use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener; use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; use Symfony\Component\Security\Http\Firewall\ListenerInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Generic\WordpressBundle\Security\WordpressToken; + class WordpressAuthenticationListener implements ListenerInterface { - protected $securityContext; + protected $tokenStorage; protected $authenticationManager; - public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager) + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager) { - $this->securityContext = $securityContext; + $this->tokenStorage = $tokenStorage; $this->authenticationManager = $authenticationManager; } @@ -28,7 +29,7 @@ public function handle(GetResponseEvent $event) try { $response = $this->authenticationManager->authenticate(new WordpressToken()); if ($response->isAuthenticated()) { - $this->securityContext->setToken($response); + $this->tokenStorage->setToken($response); $session = $request->getSession(); $token_id = uniqid(); $session->set('token_id', $token_id); diff --git a/sources/wordpress/sf2/sf2plugin.php b/sources/wordpress/sf2/sf2plugin.php index 39ded69..e7383a3 100755 --- a/sources/wordpress/sf2/sf2plugin.php +++ b/sources/wordpress/sf2/sf2plugin.php @@ -14,9 +14,17 @@ class Sf2Plugin private $kernel = null; private $in_sf2 = true; - private function isValidSymfonyPath($dir) + private function getDirCacheSymfony($dir) { - return (file_exists($dir . 'var/bootstrap.php.cache')); + $dirCache = 'app'; + if(is_dir($dir.'/var')){ + $dirCache = 'var'; + } + return $dirCache; + } + private function isValidSymfonyPath($dir) + { + return (file_exists($dir . $this->getDirCacheSymfony($dir) .'/bootstrap.php.cache')); } private function calculatePath() @@ -63,8 +71,12 @@ private function loadSf2() } if ($kernel == null) { - $loader = require_once $path . 'var/bootstrap.php.cache'; - $autoload = require_once $path . 'app/autoload.php'; + + $dircache = $this->getDirCacheSymfony($path); + $loader = require_once $path . $dircache .'/bootstrap.php.cache'; + if($dircache == 'var'){ + $autoload = require_once $path . 'app/autoload.php'; + } require_once $path . 'app/AppKernel.php'; $debug = true; if ($env == 'prod') {