@@ -4,25 +4,17 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Doctrine\Common\Collections\ArrayCollection; |
| 6 | 6 | use Eccube\Application; |
| 7 | -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
|
| 8 | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 9 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
| 10 | 9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
| 11 | 10 | use Symfony\Component\HttpFoundation\Request; |
| 12 | - |
|
| 13 | -use Eccube\Common\Constant; |
|
| 14 | -use Eccube\Controller\AbstractController; |
|
| 15 | 11 | use Eccube\Entity\Shipping; |
| 16 | -use Eccube\Entity\Master\CsvType; |
|
| 17 | 12 | use Eccube\Event\EccubeEvents; |
| 18 | 13 | use Eccube\Event\EventArgs; |
| 19 | -use Eccube\Form\Type\AddCartType; |
|
| 20 | -use Eccube\Form\Type\Admin\SearchOrderType; |
|
| 21 | 14 | use Eccube\Form\Type\Admin\ShippingType; |
| 22 | 15 | use Eccube\Form\Type\Admin\SearchCustomerType; |
| 23 | 16 | use Eccube\Form\Type\Admin\SearchProductType; |
| 24 | 17 | use Eccube\Form\Type\Admin\ShipmentItemType; |
| 25 | -use Symfony\Component\HttpFoundation\StreamedResponse; |
|
| 26 | 18 | |
| 27 | 19 | /** |
| 28 | 20 | * @Route("/{_admin}/shipping") |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $this->register(new \Saxulum\Validator\Provider\SaxulumValidatorProvider()); |
| 168 | 168 | $this->register(new MobileDetectServiceProvider()); |
| 169 | 169 | |
| 170 | - $this->error(function (\Exception $e, Request $request, $code) { |
|
| 170 | + $this->error(function(\Exception $e, Request $request, $code) { |
|
| 171 | 171 | if ($this['debug']) { |
| 172 | 172 | return; |
| 173 | 173 | } |
@@ -261,14 +261,14 @@ discard block |
||
| 261 | 261 | return $router; |
| 262 | 262 | }); |
| 263 | 263 | |
| 264 | - $this['eccube.router.origin'] = function ($app) { |
|
| 264 | + $this['eccube.router.origin'] = function($app) { |
|
| 265 | 265 | $resource = __DIR__.'/Controller'; |
| 266 | 266 | $cachePrefix = 'Origin'; |
| 267 | 267 | |
| 268 | 268 | return $app['eccube.router']($resource, $cachePrefix); |
| 269 | 269 | }; |
| 270 | 270 | |
| 271 | - $this['eccube.routers.plugin'] = function ($app) { |
|
| 271 | + $this['eccube.routers.plugin'] = function($app) { |
|
| 272 | 272 | // TODO 有効なプラグインを対象とする必要がある. |
| 273 | 273 | $dirs = Finder::create() |
| 274 | 274 | ->in($app['config']['root_dir'].'/app/Plugin') |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | return $routers; |
| 286 | 286 | }; |
| 287 | 287 | |
| 288 | - $this['eccube.router.extend'] = function ($app) { |
|
| 288 | + $this['eccube.router.extend'] = function($app) { |
|
| 289 | 289 | // TODO ディレクトリ名は暫定 |
| 290 | 290 | $resource = $app['config']['root_dir'].'/app/Acme/Controller'; |
| 291 | 291 | $cachePrefix = 'Extend'; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return $router; |
| 296 | 296 | }; |
| 297 | 297 | |
| 298 | - $this->extend('request_matcher', function ($matcher, $app) { |
|
| 298 | + $this->extend('request_matcher', function($matcher, $app) { |
|
| 299 | 299 | $matchers = []; |
| 300 | 300 | $matchers[] = $app['eccube.router.extend']; |
| 301 | 301 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | return new ChainUrlMatcher($matchers, $app['request_context']); |
| 308 | 308 | }); |
| 309 | 309 | |
| 310 | - $this->extend('url_generator', function ($generator, $app) { |
|
| 310 | + $this->extend('url_generator', function($generator, $app) { |
|
| 311 | 311 | $generators = []; |
| 312 | 312 | $generators[] = $app['eccube.router.extend']; |
| 313 | 313 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | 'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator', |
| 339 | 339 | 'locale_fallbacks' => ['ja', 'en'], |
| 340 | 340 | )); |
| 341 | - $this->extend('translator', function ($translator, \Silex\Application $app) { |
|
| 341 | + $this->extend('translator', function($translator, \Silex\Application $app) { |
|
| 342 | 342 | $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); |
| 343 | 343 | |
| 344 | 344 | $file = __DIR__.'/Resource/locale/validator.'.$app['locale'].'.yml'; |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( |
| 386 | 386 | 'twig.form.templates' => array('Form/form_layout.twig'), |
| 387 | 387 | )); |
| 388 | - $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
| 388 | + $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
| 389 | 389 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); |
| 390 | 390 | $twig->addExtension(new \Twig_Extension_StringLoader()); |
| 391 | 391 | |
| 392 | 392 | return $twig; |
| 393 | 393 | }); |
| 394 | 394 | |
| 395 | - $this->before(function (Request $request, \Silex\Application $app) { |
|
| 395 | + $this->before(function(Request $request, \Silex\Application $app) { |
|
| 396 | 396 | $app['admin'] = $app['front'] = false; |
| 397 | 397 | $pathinfo = rawurldecode($request->getPathInfo()); |
| 398 | 398 | if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | $paths[] = $app['config']['template_admin_realdir']; |
| 410 | 410 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 411 | - $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 411 | + $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 412 | 412 | } else { |
| 413 | 413 | // モバイル端末時、smartphoneディレクトリを探索パスに追加する. |
| 414 | 414 | if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) { |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | $paths[] = $app['config']['template_default_realdir']; |
| 425 | 425 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 426 | - $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 426 | + $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 427 | 427 | } |
| 428 | 428 | $app['twig']->setCache($app['debug'] ? null : $cacheDir); |
| 429 | 429 | $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | }, self::EARLY_EVENT); |
| 442 | 442 | |
| 443 | 443 | // twigのグローバル変数を定義. |
| 444 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 444 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 445 | 445 | // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため, |
| 446 | 446 | // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う |
| 447 | 447 | if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) { |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) |
| 528 | 528 | if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { |
| 529 | 529 | if ($this['config']['mail']['charset_iso_2022_jp'] === true) { |
| 530 | - \Swift::init(function () { |
|
| 530 | + \Swift::init(function() { |
|
| 531 | 531 | \Swift_DependencyContainer::getInstance() |
| 532 | 532 | ->register('mime.qpheaderencoder') |
| 533 | 533 | ->asAliasOf('mime.base64headerencoder'); |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider()); |
| 563 | 563 | |
| 564 | 564 | $app = $this; |
| 565 | - $this->extend('db.event_manager', function ($evm) use ($app) { |
|
| 565 | + $this->extend('db.event_manager', function($evm) use ($app) { |
|
| 566 | 566 | $initSubscriber = new InitSubscriber($app); |
| 567 | 567 | $evm->addEventSubscriber($initSubscriber); |
| 568 | 568 | |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $this->extend( |
| 659 | 659 | 'orm.em.config', |
| 660 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 660 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 661 | 661 | |
| 662 | 662 | /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ |
| 663 | 663 | $chain = $config->getMetadataDriverImpl(); |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | ); |
| 681 | 681 | |
| 682 | - $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 682 | + $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 683 | 683 | // tax_rule |
| 684 | 684 | $taxRuleRepository = $em->getRepository('Eccube\Entity\TaxRule'); |
| 685 | 685 | $taxRuleRepository->setApplication($app); |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | // second level cacheの設定. |
| 709 | 709 | $this->extend( |
| 710 | 710 | 'orm.em.config', |
| 711 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 711 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 712 | 712 | $config->setSecondLevelCacheEnabled(); |
| 713 | 713 | $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
| 714 | 714 | $regionConfig = $cacheConfig->getRegionsConfiguration(); |
@@ -797,31 +797,31 @@ discard block |
||
| 797 | 797 | array('^/mypage', 'ROLE_USER', $channel), |
| 798 | 798 | ); |
| 799 | 799 | |
| 800 | - $this['eccube.password_encoder'] = function ($app) { |
|
| 800 | + $this['eccube.password_encoder'] = function($app) { |
|
| 801 | 801 | return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']); |
| 802 | 802 | }; |
| 803 | - $this['security.encoder_factory'] = function ($app) { |
|
| 803 | + $this['security.encoder_factory'] = function($app) { |
|
| 804 | 804 | return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array( |
| 805 | 805 | 'Eccube\Entity\Customer' => $app['eccube.password_encoder'], |
| 806 | 806 | 'Eccube\Entity\Member' => $app['eccube.password_encoder'], |
| 807 | 807 | )); |
| 808 | 808 | }; |
| 809 | - $this['eccube.event_listner.security'] = function ($app) { |
|
| 809 | + $this['eccube.event_listner.security'] = function($app) { |
|
| 810 | 810 | return new \Eccube\EventListener\SecurityEventListener($app['orm.em']); |
| 811 | 811 | }; |
| 812 | 812 | |
| 813 | 813 | // Voterの設定 |
| 814 | - $this['authority_voter'] = function ($app) { |
|
| 814 | + $this['authority_voter'] = function($app) { |
|
| 815 | 815 | return new \Eccube\Security\Voter\AuthorityVoter($app); |
| 816 | 816 | }; |
| 817 | 817 | |
| 818 | - $this->extend('security.voters', function ($voters, \Silex\Application $app) { |
|
| 818 | + $this->extend('security.voters', function($voters, \Silex\Application $app) { |
|
| 819 | 819 | $voters[] = $app['authority_voter']; |
| 820 | 820 | |
| 821 | 821 | return $voters; |
| 822 | 822 | }); |
| 823 | 823 | |
| 824 | - $this['security.access_manager'] = function ($app) { |
|
| 824 | + $this['security.access_manager'] = function($app) { |
|
| 825 | 825 | return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous'); |
| 826 | 826 | }; |
| 827 | 827 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | { |
| 836 | 836 | $config = $this['config']; |
| 837 | 837 | if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) { |
| 838 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) { |
|
| 838 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) { |
|
| 839 | 839 | // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する |
| 840 | 840 | Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies'])); |
| 841 | 841 | }, self::EARLY_EVENT); |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | $this->register(new ServiceProvider\EccubePluginServiceProvider()); |
| 853 | 853 | |
| 854 | 854 | // TODO Acme\ServiceProvider の初期化はここで OK? |
| 855 | - if (array_key_exists('service',$this['config'])) { |
|
| 855 | + if (array_key_exists('service', $this['config'])) { |
|
| 856 | 856 | foreach ($this['config']['service'] as $service) { |
| 857 | 857 | $this->register(new $service); |
| 858 | 858 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | $app = $this; |
| 1009 | 1009 | |
| 1010 | 1010 | // Response Event(http cache対応、event実行は一番遅く設定) |
| 1011 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1011 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1012 | 1012 | |
| 1013 | 1013 | if (!$event->isMasterRequest()) { |
| 1014 | 1014 | return; |