app/Plugin/XssFixer/Event.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Plugin\XssFixer;
  13. use Eccube\Common\EccubeConfig;
  14. use Eccube\Event\TemplateEvent;
  15. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  16. class Event implements EventSubscriberInterface
  17. {
  18.     /**
  19.      * @var EccubeConfig
  20.      */
  21.     private $eccubeConfig;
  22.     public function __construct(EccubeConfig $eccubeConfig)
  23.     {
  24.         $this->eccubeConfig $eccubeConfig;
  25.     }
  26.     public static function getSubscribedEvents()
  27.     {
  28.         return ['@admin/index.twig' => 'alert'];
  29.     }
  30.     public function alert(TemplateEvent $event)
  31.     {
  32.         $dir $this->eccubeConfig->get('eccube_theme_admin_dir').'/Order';
  33.         $file 'mail_confirm.twig';
  34.         $path $dir.'/'.$file;
  35.         if (!file_exists($path)) {
  36.             // 修正ファイル未設置の場合、警告を表示
  37.             $event->addSnippet('@XssFixer/admin/danger.twig');
  38.         }
  39.     }
  40. }