public function register(BaseApplication $app)
 {
     // リポジトリ
     $app['eccube.plugin.product_rank.repository.product_rank'] = $app->share(function () use($app) {
         return new ProductRankRepository($app['orm.em'], $app['orm.em']->getClassMetadata('\\Eccube\\Entity\\ProductCategory'), $app);
     });
     $basePath = '/' . $app["config"]["admin_route"];
     // 一覧
     $app->match($basePath . '/product/product_rank/', '\\Plugin\\ProductRank\\Controller\\ProductRankController::index')->bind('admin_product_product_rank');
     // 一覧:上
     $app->put($basePath . '/product/product_rank/{category_id}/{product_id}/up', '\\Plugin\\ProductRank\\Controller\\ProductRankController::up')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->bind('admin_product_product_rank_up');
     // 一覧:下
     $app->put($basePath . '/product/product_rank/{category_id}/{product_id}/down', '\\Plugin\\ProductRank\\Controller\\ProductRankController::down')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->bind('admin_product_product_rank_down');
     // 一覧:N番目へ移動
     $app->post($basePath . '/product/product_rank/moveRank', '\\Plugin\\ProductRank\\Controller\\ProductRankController::moveRank')->assert('category_id', '\\d+')->assert('product_id', '\\d+')->assert('position', '\\d+')->bind('admin_product_product_rank_move_rank');
     // カテゴリ選択
     $app->match($basePath . '/product/product_rank/{category_id}', '\\Plugin\\ProductRank\\Controller\\ProductRankController::index')->assert('category_id', '\\d+')->bind('admin_product_product_rank_show');
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = "product_rank";
         $addNavi['name'] = "商品並び替え";
         $addNavi['url'] = "admin_product_product_rank";
         self::addNavi($config['nav'], $addNavi, array('product'));
         return $config;
     }));
 }
 public function setup()
 {
     $this->app = new Application();
     $this->app->match("/", function () {
         return new Response();
     });
 }
 public function register(BaseApplication $app)
 {
     // Routingを追加
     $admin = $app['config']['admin_route'];
     $app->match($admin . '/sales_report', '\\Plugin\\SalesReport\\Controller\\SalesReportController::index')->bind('admin_sales_report');
     $app->match($admin . '/sales_report/term', '\\Plugin\\SalesReport\\Controller\\SalesReportController::term')->bind('admin_sales_report_term');
     $app->match($admin . '/sales_report/member', '\\Plugin\\SalesReport\\Controller\\SalesReportController::member')->bind('admin_sales_report_member');
     $app->match($admin . '/sales_report/age', '\\Plugin\\SalesReport\\Controller\\SalesReportController::age')->bind('admin_sales_report_age');
     $app->match($admin . '/sales_report/product', '\\Plugin\\SalesReport\\Controller\\SalesReportController::product')->bind('admin_sales_report_product');
     // Formの定義
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\SalesReport\Form\Type\SalesReportType();
         return $types;
     }));
     // Serviceの定義
     $app['eccube.plugin.service.sales_report'] = $app->share(function () use($app) {
         return new \Plugin\SalesReport\Service\SalesReportService($app);
     });
     // サブナビの拡張
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $nav = array('id' => 'admin_sales_report', 'name' => '売上集計', 'has_child' => 'true', 'icon' => 'cb-chart', 'child' => array(array('id' => 'admin_sales_report', 'url' => 'admin_sales_report', 'name' => '期間別集計'), array('id' => 'admin_sales_report_product', 'url' => 'admin_sales_report_product', 'name' => '商品別集計'), array('id' => 'admin_sales_report_age', 'url' => 'admin_sales_report_age', 'name' => '年代別集計')));
         $config['nav'][] = $nav;
         return $config;
     }));
 }
 public function connect(Application $app)
 {
     $controllers = $app['controllers_factory'];
     $app->match('/', 'Silex\\Controller\\StatsdController::indexAction')->bind('index');
     $app->match('/sample', 'Silex\\Controller\\StatsdController::sampleAction')->bind('sample');
     return $controllers;
 }
 public function register(BaseApplication $app)
 {
     $app->match('/' . $app['config']['admin_route'] . '/plugin/FreeeLight/config', 'Plugin\\FreeeLight\\Controller\\ConfigController::index')->bind('plugin_FreeeLight_config');
     $app->match('/' . $app['config']['admin_route'] . '/plugin/FreeeLight/config2', 'Plugin\\FreeeLight\\Controller\\ConfigController::step2')->bind('plugin_FreeeLight_config_step2');
     $app->match('/' . $app['config']['admin_route'] . '/plugin/FreeeLight/config3', 'Plugin\\FreeeLight\\Controller\\ConfigController::step3')->bind('plugin_FreeeLight_config_step3');
     $app->match('/' . $app['config']['admin_route'] . '/plugin/FreeeLight/config_complete', 'Plugin\\FreeeLight\\Controller\\ConfigController::complete')->bind('plugin_FreeeLight_config_complete');
     $app->match('/oauth2/receive_authcode', 'Plugin\\FreeeLight\\Controller\\OAuth2Controller::receive_authcode')->bind('plugin_FreeeLight_oauth2_receive_authcode');
     // Form
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\FreeeLight\Form\Type\FreeeCompanyType($app);
         $types[] = new \Plugin\FreeeLight\Form\Type\FreeeLightConfigType($app);
         $types[] = new \Plugin\FreeeLight\Form\Type\FreeeLightConfig2Type($app);
         return $types;
     }));
     // Repository
     $app['eccube.plugin.repository.freeelight'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeLight');
     });
     $app['eccube.plugin.repository.freee_oauth2'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeOAuth2');
     });
     $app['eccube.plugin.repository.freee_tax'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeTax');
     });
     $app['eccube.plugin.repository.freee_account_item'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeAccountItem');
     });
     $app['eccube.plugin.repository.freee_wallet'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeWallet');
     });
     $app['eccube.plugin.repository.freee_company'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\FreeeLight\\Entity\\FreeeCompany');
     });
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function addRoute($routePath, $method, $controllerClassName, $actionMethodName, Response $response, \Closure $init)
 {
     $this->app->match($routePath, $controllerClassName . '::' . $actionMethodName)->method(strtoupper($method))->value('response', $response)->before(function (Request $request) use($init) {
         $this->request = $request;
         $init();
     });
 }
 protected function registerListener(Application $app)
 {
     $app['security.authentication_listener.factory.opauth'] = $app->protect(function ($name, $options) use($app) {
         $options = array_replace_recursive(array('check_path' => '/login/opauth', 'opauth' => array('path' => '/login/')), $options);
         if (!isset($app['security.authentication.success_handler.' . $name])) {
             $app['security.authentication.success_handler.' . $name] = $app['security.authentication.success_handler._proto']($name, $options);
         }
         if (!isset($app['security.authentication.failure_handler.' . $name])) {
             $app['security.authentication.failure_handler.' . $name] = $app['security.authentication.failure_handler._proto']($name, $options);
         }
         // define the authentication provider object
         if (!isset($app['security.authentication_provider.' . $name . '.opauth'])) {
             $app['security.authentication_provider.' . $name . '.opauth'] = $app->share(function () use($app, $name) {
                 return new OpauthProvider($app['security.user_provider.' . $name]);
             });
         }
         // define the authentication listener object
         if (!isset($app['security.authentication_listener.' . $name . '.opauth'])) {
             $app['security.authentication_listener.' . $name . '.opauth'] = $app->share(function () use($app, $name, $options) {
                 return new OpauthListener($app['security'], $app['security.authentication_manager'], isset($app['security.session_strategy.' . $name]) ? $app['security.session_strategy.' . $name] : $app['security.session_strategy'], $app['security.http_utils'], $name, $app['security.authentication.success_handler.' . $name], $app['security.authentication.failure_handler.' . $name], $options, $app['logger'], $app['dispatcher']);
             });
         }
         // routes
         //            $this->onBoot[] = function() use ($app, $options, $name) {
         $bindName = "opauth_{$name}_";
         $app->match($options['check_path'], function () {
         })->bind($bindName . 'check');
         $app->match($options['opauth']['path'] . '{strategy}/{return}', function () {
         })->value('return', '')->bind($bindName . 'login');
         //            };
         return array('security.authentication_provider.' . $name . '.opauth', 'security.authentication_listener.' . $name . '.opauth', null, 'pre_auth');
     });
 }
Example #8
0
 public function connect(Application $app)
 {
     $controllers = $app["controllers_factory"];
     $app->match('/login', [$this, 'loginAction'])->bind('login');
     $app->get('/logout', [$this, 'logoutAction'])->bind('logout');
     $app->match('/login_redirect', [$this, 'loginRedirectAction'])->bind('login-redirect');
     return $controllers;
 }
 public function register(Application $app)
 {
     $app->match('/administration/{table}', function ($table) use($app) {
         if (is_null($app['silexcms.security']->getUsername())) {
             return $app->redirect($app['url_generator']->generate('administration_login'));
         }
         $repository = $app['silexcms.sets'][$table]->getRepository();
         $schema = $repository->getSchema();
         $rows = $repository->findAll(true);
         foreach ($rows as $row) {
             $data[] = array_map(function ($val) {
                 return is_string($val) && strlen($val) > 50 ? substr(strip_tags($val), 0, 47) . '...' : $val;
             }, $row);
         }
         return new TransientResponse($app, $app['silexcms.template.loader']->load('administration/administration_table.html.twig'), array('table' => $table, 'fields' => $schema, 'rows' => $data));
     })->bind('administration_table');
     $app->match('/administration/{table}/{primaryKey}', function (Request $req, $table, $primaryKey) use($app) {
         if (is_null($app['silexcms.security']->getUsername())) {
             return $app->redirect($app['url_generator']->generate('administration_login'));
         }
         $set = $app['silexcms.sets'][$table];
         $repository = $set->getRepository();
         $formGenerator = new Form($set);
         $form = $app['form.factory']->create(new TableType($app, $table), $formGenerator->getData('_new' === $primaryKey ? null : $primaryKey));
         if ($req->getMethod() === 'POST') {
             $form->bindRequest($req);
             if ($form->isValid()) {
                 $data = $form->getData();
                 foreach ($data['row'] as $row) {
                     $where = array('`' . $repository->getPrimaryKey() . '`' => $row[$repository->getPrimaryKey()]);
                     // unset id primaryKey
                     if ('id' === $repository->getPrimaryKey()) {
                         unset($row[$repository->getPrimaryKey()]);
                     }
                     if ('_new' === $primaryKey) {
                         $repository->insert($row);
                         return $app->redirect($app['url_generator']->generate('administration_table', array('table' => $table)));
                     }
                     $repository->update($row, $where);
                     try {
                         // cache strategy if exist. Update cache version
                         $app['silexcms.cache.manager']->update();
                     } catch (\Exception $e) {
                     }
                 }
             }
         }
         return new TransientResponse($app, $app['silexcms.template.loader']->load('administration/administration_edit.html.twig'), array('table' => $table, 'primaryKey' => $primaryKey, 'form' => $form->createView()));
     })->bind('administration_edit');
     $app->match('/administration', function () use($app) {
         if (is_null($app['silexcms.security']->getUsername())) {
             return $app->redirect($app['url_generator']->generate('administration_login'));
         }
         $tables = array_keys($app['silexcms.sets']);
         return new TransientResponse($app, $app['silexcms.template.loader']->load('administration/administration_hub.html.twig'), array('tables' => $tables));
     })->bind('administration_hub');
 }
 public function register(BaseApplication $app)
 {
     // 定休日テーブル用リポジトリ
     $app['eccube.plugin.holiday.repository.holiday'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Holiday\\Entity\\Holiday');
     });
     $basePath = '/' . $app["config"]["admin_route"];
     // 一覧
     $app->match($basePath . '/system/shop/holiday/', '\\Plugin\\Holiday\\Controller\\HolidayController::index')->bind('admin_setting_shop_holiday');
     // 新規作成
     $app->match($basePath . '/system/shop/holiday/new', '\\Plugin\\Holiday\\Controller\\HolidayController::edit')->bind('admin_setting_shop_holiday_new');
     // 編集
     $app->match($basePath . '/system/shop/holiday/{id}/edit', '\\Plugin\\Holiday\\Controller\\HolidayController::edit')->assert('id', '\\d+')->bind('admin_setting_shop_holiday_edit');
     // 一覧:削除
     $app->delete($basePath . '/system/shop/holiday/{id}/delete', '\\Plugin\\Holiday\\Controller\\HolidayController::delete')->assert('id', '\\d+')->bind('admin_setting_shop_holiday_delete');
     // 一覧:上
     $app->put($basePath . '/system/shop/holiday/{id}/up', '\\Plugin\\Holiday\\Controller\\HolidayController::up')->assert('id', '\\d+')->bind('admin_setting_shop_holiday_up');
     // 一覧:下
     $app->put($basePath . '/system/shop/holiday/{id}/down', '\\Plugin\\Holiday\\Controller\\HolidayController::down')->assert('id', '\\d+')->bind('admin_setting_shop_holiday_down');
     $app->match('/block/holiday_calendar_block', '\\Plugin\\Holiday\\Controller\\Block\\HolidayController::index')->bind('block_holiday_calendar_block');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\Holiday\Form\Type\HolidayType($app);
         return $types;
     }));
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // load config
     $conf = $app['config'];
     $app['config'] = $app->share(function () use($conf) {
         $confarray = array();
         $path_file = __DIR__ . '/../Resource/config/path.yml';
         if (file_exists($path_file)) {
             $config_yml = Yaml::parse(file_get_contents($path_file));
             if (isset($config_yml)) {
                 $confarray = array_replace_recursive($confarray, $config_yml);
             }
         }
         return array_replace_recursive($conf, $confarray);
     });
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = "holiday";
         $addNavi['name'] = "定休日管理";
         $addNavi['url'] = "admin_setting_shop_holiday";
         self::addNavi($config['nav'], $addNavi, array('setting', 'shop'));
         return $config;
     }));
 }
Example #11
0
 public function boot(Application $app)
 {
     $app['users.repository'];
     $app->match('/login', $app['actions.dispatch']($app['users.login_action']))->bind('login');
     $app->match('/logout')->bind('logout');
     $app['cms.navigation_list'] = $app->share($app->extend('cms.navigation_list', function (ListNodeInterface $cmsNav) use($app) {
         $cmsNav->getChild('users')->addChild('logout', 'Logout', $app['url_generator']->generate('logout'));
         return $cmsNav;
     }));
 }
 /**
  * {@inheritdoc}
  */
 public function connect(Application $app)
 {
     /** @var $ctr ControllerCollection */
     $ctr = $app['controllers_factory'];
     // Sitewide feed
     $this->app->match('/amp/feed.{extension}', [$this, 'feed'])->assert('extension', '(xml|rss)');
     // ContentType specific feed(s)
     $this->app->match('/{contenttypeslug}/amp/feed.{extension}', [$this, 'feed'])->assert('extension', '(xml|rss)')->assert('contenttypeslug', $this->getContentTypeAssert());
     return $ctr;
 }
 public function register(BaseApplication $app)
 {
     // 不要?
     $app['eccube.plugin.maker.repository.maker_plugin'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Maker\\Entity\\MakerPlugin');
     });
     // メーカーテーブル用リポジトリ
     $app['eccube.plugin.maker.repository.maker'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Maker\\Entity\\Maker');
     });
     $app['eccube.plugin.maker.repository.product_maker'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Maker\\Entity\\ProductMaker');
     });
     // 一覧・登録・修正
     $app->match('/' . $app["config"]["admin_route"] . '/product/maker/{id}', '\\Plugin\\Maker\\Controller\\MakerController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_maker');
     // 削除
     $app->match('/' . $app["config"]["admin_route"] . '/product/maker/{id}/delete', '\\Plugin\\Maker\\Controller\\MakerController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_maker_delete');
     // 上
     $app->match('/' . $app["config"]["admin_route"] . '/product/maker/{id}/up', '\\Plugin\\Maker\\Controller\\MakerController::up')->value('id', null)->assert('id', '\\d+|')->bind('admin_maker_up');
     // 下
     $app->match('/' . $app["config"]["admin_route"] . '/product/maker/{id}/down', '\\Plugin\\Maker\\Controller\\MakerController::down')->value('id', null)->assert('id', '\\d+|')->bind('admin_maker_down');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\Maker\Form\Type\MakerType($app);
         return $types;
     }));
     // Form Extension
     $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) use($app) {
         $extensions[] = new \Plugin\Maker\Form\Extension\Admin\ProductMakerTypeExtension($app);
         return $extensions;
     }));
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = "maker";
         $addNavi['name'] = "メーカー管理";
         $addNavi['url'] = "admin_maker";
         $nav = $config['nav'];
         foreach ($nav as $key => $val) {
             if ("product" == $val["id"]) {
                 $nav[$key]['child'][] = $addNavi;
             }
         }
         $config['nav'] = $nav;
         return $config;
     }));
 }
 public function register(BaseApplication $app)
 {
     // 定休日管理テーブル用リポジトリ
     $app['eccube.plugin.holiday.repository.holiday'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Holiday\\Entity\\Holiday');
     });
     // 定休曜日管理テーブル用レポジトリ
     $app['eccube.plugin.holiday.repository.holidayweek'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Holiday\\Entity\\HolidayWeek');
     });
     // 定休日基本設定テーブル用レポジトリ
     $app['eccube.plugin.holiday.repository.holidayconfig'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Holiday\\Entity\\HolidayConfig');
     });
     // Setting
     $app->match('/' . $app["config"]["admin_route"] . '/plugin/holiday/config/', '\\Plugin\\Holiday\\Controller\\ConfigController::edit')->value('id', 1)->assert('id', '\\d+|')->bind('plugin_holiday_config');
     // 一覧・登録・修正
     $app->match('/' . $app["config"]["admin_route"] . '/setting/holiday/{id}', '\\Plugin\\Holiday\\Controller\\HolidayController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_holiday');
     // 定休日 曜日
     $app->match('/' . $app["config"]["admin_route"] . '/setting/holidayweek/{id}', '\\Plugin\\Holiday\\Controller\\HolidayWeekController::index')->value('id', 1)->assert('id', '\\d+|')->bind('admin_holiday_week');
     // 削除
     $app->match('/' . $app["config"]["admin_route"] . '/setting/holiday/{id}/delete', '\\Plugin\\Holiday\\Controller\\HolidayController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_holiday_delete');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\Holiday\Form\Type\HolidayConfigType($app);
         $types[] = new \Plugin\Holiday\Form\Type\HolidayType($app);
         $types[] = new \Plugin\Holiday\Form\Type\HolidayWeekType($app);
         return $types;
     }));
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // 定休日管理
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = "holiday";
         $addNavi['name'] = "定休日管理";
         $addNavi['has_child'] = true;
         $addNavi['child'] = array(array('id' => 'holiday_config', 'name' => '基本設定', 'url' => 'plugin_holiday_config'), array('id' => 'holiday_week', 'name' => '定休日管理', 'url' => 'admin_holiday_week'), array('id' => 'holiday', 'name' => '休日管理', 'url' => 'admin_holiday'));
         $nav = $config['nav'];
         foreach ($nav as $key => $val) {
             if ("setting" == $val["id"]) {
                 $nav[$key]['child'][] = $addNavi;
             }
         }
         $config['nav'] = $nav;
         return $config;
     }));
 }
Example #15
0
 public function createApplication()
 {
     $app = new Application();
     $app->match('/hello', function () {
         return 'world';
     });
     $app->match('/html', function () {
         return '<h1>title</h1>';
     });
     return $app;
 }
 public function register(BaseApplication $app)
 {
     // Setting
     // [システム設定]-[プラグイン一覧]に設定リンクを表示する
     //         $app->match('/' . $app["config"]["admin_route"] . '/plugin/order_pdf/config', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index')->bind('plugin_OrderPdf_config');
     // ============================================================
     // リポジトリの登録
     // ============================================================
     // 不要?
     $app['eccube.plugin.order_pdf.repository.order_pdf_plugin'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\OrderPdf\\Entity\\OrderPdfPlugin');
     });
     // 注文情報テーブルリポジトリ
     $app['eccube.plugin.order_pdf.repository.order_pdf_order'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\OrderPdf\\Entity\\OrderPdfOrder');
     });
     // 特定商取引法管理
     $app['eccube.plugin.order_pdf.repository.order_pdf_help'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\OrderPdf\\Entity\\OrderPdfHelp');
     });
     // ============================================================
     // コントローラの登録
     // ============================================================
     // 帳票の作成
     $app->match('/' . $app["config"]["admin_route"] . '/orderPdf', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_order_pdf');
     // PDFファイルダウンロード
     $app->match('/' . $app["config"]["admin_route"] . '/orderPdf/download', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::download')->value('id', null)->assert('id', '\\d+|')->bind('admin_order_pdf_download');
     // ============================================================
     // Formの登録
     // ============================================================
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\OrderPdf\Form\Type\OrderPdfType($app);
         return $types;
     }));
     // -----------------------------
     // サービスの登録
     // -----------------------------
     // 帳票作成
     $app['eccube.plugin.order_pdf.service.order_pdf'] = $app->share(function () use($app) {
         return new \Plugin\OrderPdf\Service\OrderPdfService($app);
     });
     // ============================================================
     // メッセージ登録
     // ============================================================
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
 }
 /**
  * Register services related to Users
  *
  * @param  Application $app
  */
 public function register(Application $app)
 {
     $app['user.mapper'] = $app->share(function ($app) {
         return new UserMapper($app['db'], new UserEntity());
     });
     $app['user-token.mapper'] = $app->share(function ($app) {
         return new TokenMapper($app['db'], new TokenEntity());
     });
     $app['user-role-pivot.mapper'] = $app->share(function ($app) {
         return new UserRolePivotMapper($app['db']);
     });
     $app['user.service'] = $app->share(function ($app) {
         $verifyRegistrationView = new VerifyRegistrationView($app['mustache']);
         $verifyRegistrationView->setUrlGenerator($app['url_generator']);
         $service = new UserService();
         $service->setUserMapper($app['user.mapper'])->setTokenMapper($app['user-token.mapper'])->setEmailService($app['email.service'])->setVerifyRegistrationView($verifyRegistrationView);
         return $service;
     });
     $app['role.service'] = $app->share(function ($app) {
         return new RoleService($app['user-role-pivot.mapper']);
     });
     $app['user.validator'] = $app->share(function ($app) {
         return new UserValidator($app['validator']);
     });
     $app['user-registration.validator'] = $app->share(function ($app) {
         return new UserRegistrationValidator($app['validator']);
     });
     $app['user.controller'] = $app->share(function ($app) {
         $controller = new UserController();
         $controller->setUserService($app['user.service'])->setUserValidator($app['user.validator'])->setUserRegistrationValidator($app['user-registration.validator']);
         return $controller;
     });
     $app['user.converter'] = $app->share(function ($app) {
         return new UserConverter($app['user.mapper']);
     });
     $app['verify-registration.controller'] = $app->share(function ($app) {
         $controller = new VerifyRegistrationController();
         $controller->setUserService($app['user.service']);
         return $controller;
     });
     $app['reset-password.controller'] = $app->share(function ($app) {
         $resetPasswordView = new ResetPasswordView($app['mustache']);
         $resetPasswordView->setUrlGenerator($app['url_generator']);
         return new ResetPasswordController($app['user.service'], $app['email.service'], $resetPasswordView);
     });
     $app->match('/users', 'user.controller:rest')->method('HEAD|POST')->bind('user-collection');
     $app->match('/user', 'user.controller:rest')->method('GET|PUT')->bind('user-entity-self');
     $app->match('/users/{user}', 'user.controller:rest')->method('GET')->bind('user-entity')->assert('user', '\\d+')->convert('user', 'user.converter:getUser');
     $app->match('/users/{id}/verify-registration', 'verify-registration.controller:rest')->method('POST')->bind('verify-registration');
     $app->match('/user/reset-password', 'reset-password.controller:rest')->method('POST|PUT')->bind('reset-password');
     $this->setFirewallsAndAccessRules($app);
 }
Example #18
0
 public function createApplication()
 {
     $app = new Application();
     $app->match('/hello', function () {
         return 'world';
     });
     $app->match('/html', function () {
         return '<h1>title</h1>';
     });
     $app->match('/server', function (Request $request) use($app) {
         $user = $request->server->get('PHP_AUTH_USER');
         $pass = $request->server->get('PHP_AUTH_PW');
         return "<h1>{$user}:{$pass}</h1>";
     });
     return $app;
 }
 public function register(BaseApplication $app)
 {
     $app->match('/plugin/sample', '\\Plugin\\SampleService\\Controller\\SamplePluginServiceController::index')->bind('plugin_sample');
     $app['eccube.plugin.service.sample'] = $app->share(function () use($app) {
         return new \Plugin\SampleService\Service\SamplePluginService($app);
     });
 }
 /**
  * {@inheritdoc}
  */
 public function register(BaseApplication $app)
 {
     $app['translator']->addResource('yaml', __DIR__ . '/../Resource/locale/message.ja.yml', 'ja');
     $app['config'] = $app->share($app->extend('config', function ($config) {
         foreach ($config['nav'] as $key => $menu1) {
             if ($menu1['id'] == 'setting') {
                 $children = $menu1['child'];
                 foreach ($children as $key2 => $menu2) {
                     if ($menu2['id'] == 'system') {
                         $config['nav'][$key]['child'][$key2]['has_child'] = 'true';
                         $config['nav'][$key]['child'][$key2]['child'][] = array('id' => 'admin_maintenance_manager', 'name' => 'メンテナンス管理', 'url' => 'admin_maintenance_manager');
                         break;
                     }
                 }
             }
         }
         return $config;
     }));
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\MaintenanceManager\Form\Type\MaintenanceType($app);
         return $types;
     }));
     $app['plg.service.maintenance_manager'] = $app->share(function () use($app) {
         return new \Plugin\MaintenanceManager\Service\MaintenanceManagerService($app);
     });
     $url = '/' . $app["config"]["admin_route"] . '/MaintenanceManager';
     $app->match($url . '/config', '\\Plugin\\MaintenanceManager\\Controller\\ConfigController::index')->bind('admin_maintenance_manager');
     //         $app->match($url . '/enable', '\Plugin\MaintenanceManager\Controller\ConfigController::enable')->bind('admin_maintenance_manager_enable');
     //         $app->match($url . '/disable', '\Plugin\MaintenanceManager\Controller\ConfigController::diable')->bind('admin_maintenance_manager_disable');
 }
 public function register(BaseApplication $app)
 {
     // おすすめ情報テーブルリポジトリ
     $app['eccube.plugin.recommend.repository.recommend_product'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\Recommend\\Entity\\RecommendProduct');
     });
     // おすすめ商品の一覧
     $app->match('/' . $app["config"]["admin_route"] . '/recommend', '\\Plugin\\Recommend\\Controller\\RecommendController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_list');
     // おすすめ商品の新規先
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/new', '\\Plugin\\Recommend\\Controller\\RecommendController::create')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_new');
     // おすすめ商品の新規作成・編集確定
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/commit', '\\Plugin\\Recommend\\Controller\\RecommendController::commit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_commit');
     // おすすめ商品の編集
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/edit/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::edit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_edit');
     // おすすめ商品の削除
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/delete/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_delete');
     // おすすめ商品のランク移動(上)
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/rank_up/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::rankUp')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_rank_up');
     // おすすめ商品のランク移動(下)
     $app->match('/' . $app["config"]["admin_route"] . '/recommend/rank_down/{id}', '\\Plugin\\Recommend\\Controller\\RecommendController::rankDown')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_rank_down');
     // 商品検索画面表示
     $app->post('/' . $app["config"]["admin_route"] . '/recommend/search/product', '\\Plugin\\Recommend\\Controller\\RecommendSearchModelController::searchProduct')->bind('admin_recommend_search_product');
     // ブロック
     $app->match('/block/recommend_product_block', '\\Plugin\\Recommend\\Controller\\Block\\RecommendController::index')->bind('block_recommend_product_block');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\Recommend\Form\Type\RecommendProductType($app);
         return $types;
     }));
     // サービスの登録
     $app['eccube.plugin.recommend.service.recommend'] = $app->share(function () use($app) {
         return new \Plugin\Recommend\Service\RecommendService($app);
     });
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) {
         $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = 'admin_recommend';
         $addNavi['name'] = 'おすすめ管理';
         $addNavi['url'] = 'admin_recommend_list';
         $nav = $config['nav'];
         foreach ($nav as $key => $val) {
             if ('content' == $val['id']) {
                 $nav[$key]['child'][] = $addNavi;
             }
         }
         $config['nav'] = $nav;
         return $config;
     }));
 }
 public function register(Application $app)
 {
     $this->app = $app;
     $this->serviceConfig = $app['opauth'];
     $this->serviceConfig['config'] = array_merge(array('path' => $app['opauth']['login'] . '/', 'callback_url' => $app['opauth']['callback'], 'callback_transport' => 'post'), $app['opauth']['config']);
     $that = $this;
     $app->match($this->serviceConfig['callback'], function () use($that) {
         return $that->loginCallback();
     });
     $config = $this->serviceConfig['config'];
     $init = function () use($config) {
         new Opauth($config);
         return '';
     };
     $app->match($this->serviceConfig['login'] . '/{strategy}', $init);
     $app->match($this->serviceConfig['login'] . '/{strategy}/{return}', $init);
 }
 public function register(BaseApplication $app)
 {
     $app->match('/' . $app['config']['admin_route'] . '/plugin/SendGridLight/config', 'Plugin\\SendGridLight\\Controller\\ConfigController::index')->bind('plugin_SendGridLight_config');
     $app->match('/' . $app['config']['admin_route'] . '/plugin/SendGridLight/config_complete', 'Plugin\\SendGridLight\\Controller\\ConfigController::complete')->bind('plugin_SendGridLight_config_complete');
     // Form
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\SendGridLight\Form\Type\SendGridLightConfigType($app);
         return $types;
     }));
     // Repository
     $app['eccube.plugin.repository.sendgridlight'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\SendGridLight\\Entity\\SendGridLight');
     });
     $app['mailer'] = $app->share(function ($app) {
         return new SendGridWrapper($app);
     });
 }
 private function createOptionsRoutes(Application $app, $allow)
 {
     foreach ($allow as $path => $routeDetails) {
         // Remove _method from requirements, it would cause a
         // E_USER_DEPRECATED error with Symfony Routing component 2.7+
         unset($routeDetails['requirements']['_method']);
         $app->match($path, new OptionsController($routeDetails["methods"]))->setRequirements($routeDetails["requirements"])->method("OPTIONS");
     }
 }
 public function register(BaseApplication $app)
 {
     // 一覧
     $app->match('/likeniko/publish', '\\Plugin\\LikeNiko\\Controller\\PublishController::index')->bind('publish');
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new \Plugin\LikeNiko\Form\Type\LikeNikoType($app);
         return $types;
     }));
 }
Example #26
0
 public function register(BaseApplication $app)
 {
     $app->match('/products/review.php', '\\Eccube\\Plugin\\ProductReview\\Page\\Products\\Review')->bind('products_review');
     $app->match('/products/review_complete.php', '\\Eccube\\Plugin\\ProductReview\\Page\\Products\\ReviewComplete')->bind('products_review_complete');
     $app->match('/admin/products/review.php', '\\Eccube\\Plugin\\ProductReview\\Page\\Admin\\Products\\Review')->bind('admin_products_review');
     $app->match('/admin/products/review_edit.php', '\\Eccube\\Plugin\\ProductReview\\Page\\Admin\\Products\\ReviewEdit')->bind('admin_products_review_edit');
     $app['eccube.helper.review'] = $app->share(function () use($app) {
         return new ReviewHelper();
     });
     $app['eccube.helper.plugin'] = $app->extend('eccube.helper.plugin', function (PluginHelper $objHelperPlugin, $app) {
         $objHelperPlugin->addAction("Eccube.Page.Products.Detail.action_after", function ($objPage) use($app) {
             //レビュー情報の取得
             $objReview = Application::alias('eccube.helper.review');
             $objPage->arrReview = $objReview->getListByProductId($objPage->tpl_product_id);
         });
         return $objHelperPlugin;
     });
     // TODO: 管理画面メニューに追加
 }
 /**
  * register.
  *
  * @param Application $app
  */
 public function register(BaseApplication $app)
 {
     $app->post('/related_product/search_product', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::searchProduct')->bind('admin_related_product_search');
     $app->post('/related_product/get_product', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::getProduct')->bind('admin_related_product_get_product');
     $app->match('/' . $app['config']['admin_route'] . '/related_product/search/product/page/{page_no}', '\\Plugin\\RelatedProduct\\Controller\\Admin\\RelatedProductController::searchProduct')->assert('page_no', '\\d+')->bind('admin_related_product_search_product_page');
     // イベントの追加
     $app['eccube.plugin.relatedproduct.event'] = $app->share(function () use($app) {
         return new Event($app);
     });
     $app['eccube.plugin.relatedproduct.event.legacy'] = $app->share(function () use($app) {
         return new EventLegacy($app);
     });
     // Formの定義
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new RelatedProductType($app);
         return $types;
     }));
     // @deprecated for since v3.0.0, to be removed in 3.1.
     if (!Version::isSupportGetInstanceFunction()) {
         // Form/Extension
         $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) {
             $extensions[] = new RelatedCollectionExtension();
             return $extensions;
         }));
     }
     // Repository
     $app['eccube.plugin.repository.related_product'] = function () use($app) {
         return $app['orm.em']->getRepository('\\Plugin\\RelatedProduct\\Entity\\RelatedProduct');
     };
     // メッセージ登録
     $app['translator'] = $app->share($app->extend('translator', function (Translator $translator, Application $app) {
         $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
         if (file_exists($file)) {
             $translator->addResource('yaml', $file, $app['locale']);
         }
         return $translator;
     }));
     // Add config file.
     $app['config'] = $app->share($app->extend('config', function ($config) {
         // Update constants
         $constantFile = __DIR__ . '/../Resource/config/constant.yml';
         if (file_exists($constantFile)) {
             $constant = Yaml::parse(file_get_contents($constantFile));
             if (!empty($constant)) {
                 // Replace constants
                 $config = array_replace_recursive($config, $constant);
             }
         }
         return $config;
     }));
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!Version::isSupportGetInstanceFunction()) {
         eccube_log_init($app);
     }
 }
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  * @param Application $app
  */
 public function register(Application $app)
 {
     $app->match('/' . $app['config']['admin_route'] . '/listing_ad_plugin/export/{type}', 'Plugin\\ListingAdCsv\\Controller\\ExportController::export')->bind('ListingAdCsv_export');
     // Service
     $app['listing_ad_csv.service.csv.export'] = $app->share(function () use($app) {
         return new \Plugin\ListingAdCsv\Service\CsvExport\CsvExportService($app['config']['csv_export_encoding']);
     });
     $app['listing_ad_csv.service.listingad.data.creator'] = $app->share(function () use($app) {
         return new \Plugin\ListingAdCsv\Service\ListingAdDataCreator\ListingAdDataCreatorService();
     });
 }
 public function register(Application $app)
 {
     $app['security.authentication_listener.factory.esn_galaxy'] = $app->protect(function ($name, $options) use($app) {
         if (!isset($app['security.authentication_listener.' . $name . '.esn_galaxy'])) {
             $app['security.authentication_listener.' . $name . '.esn_galaxy'] = $app['security.authentication_listener.esn_galaxy._proto']($name, $options);
         }
         if (!isset($app['security.authentication_provider.' . $name . '.esn_galaxy'])) {
             $app['security.authentication_provider.' . $name . '.esn_galaxy'] = $app['security.authentication_provider.esn_galaxy._proto']($name, $options);
         }
         $app['security.authentication_entry_point.' . $name . '.esn_galaxy'] = $app->share(function () use($app, $options) {
             return new CasAuthenticationEntryPoint($app, $app['security.http_utils']);
         });
         return array('security.authentication_provider.' . $name . '.esn_galaxy', 'security.authentication_listener.' . $name . '.esn_galaxy', 'security.authentication_entry_point.' . $name . '.esn_galaxy', 'pre_auth');
     });
     $app['security.authentication_listener.esn_galaxy._proto'] = $app->protect(function ($name, $options) use($app) {
         return $app->share(function () use($app, $name, $options) {
             $options['check_path'] = isset($options['check_path']) ? $options['check_path'] : '/cas/validation';
             $app->match($options['check_path'], function () {
             });
             $app['jasig_cas_client'] = $app->share(function () use($options, $app) {
                 $options['cas_server']['base_url'] = isset($options['cas_server']['base_url']) ? $options['cas_server']['base_url'] : 'galaxy.esn.org';
                 return new JasigClient(new EsnGalaxyResponseParser(), $app['security.http_utils'], $options);
             });
             if (!isset($app['security.authentication.success_handler.' . $name . '.esn_galaxy'])) {
                 $app['security.authentication.success_handler.' . $name . '.esn_galaxy'] = $app['security.authentication.success_handler._proto']($name, $options);
             }
             if (!isset($app['security.authentication.failure_handler.' . $name . '.esn_galaxy'])) {
                 $app['security.authentication.failure_handler.' . $name . '.esn_galaxy'] = $app['security.authentication.failure_handler._proto']($name, $options);
             }
             if (isset($options['first_login_path'])) {
                 $app['security.authentication.success_handler.' . $name . '.esn_galaxy'] = $app['security.authentication.cas_success_handler._proto']($name, $options);
             }
             return new EsnGalaxyAuthenticationListener($app['jasig_cas_client'], $app['security'], $app['security.authentication_manager'], $app['security.session_strategy'], $app['security.http_utils'], $name, $app['security.authentication.success_handler.' . $name . '.esn_galaxy'], $app['security.authentication.failure_handler.' . $name . '.esn_galaxy'], $options, $app['logger'], $app['dispatcher']);
         });
     });
     $app['security.authentication_provider.esn_galaxy._proto'] = $app->protect(function ($name, $options) use($app) {
         return $app->share(function () use($app, $name, $options) {
             if (!isset($options['auth'])) {
                 $options['auth'] = ['*' => ['Local.activeMember' => 'ROLE_USER', 'Local.regularBoardMember' => 'ROLE_BOARD']];
             }
             return new EsnGalaxyAuthenticationProvider($app['security.user_provider.' . $name], $options['auth']);
         });
     });
     $app['security.authentication.cas_success_handler._proto'] = $app->protect(function ($name, $options) use($app) {
         return $app->share(function () use($name, $options, $app) {
             $handler = new CasAuthenticationSuccesHandler($app['security.http_utils'], $options);
             $handler->setProviderKey($name);
             return $handler;
         });
     });
 }
Example #30
0
 public function register(Application $app)
 {
     $name = $this->name;
     $route = $this->route;
     $template = $this->template;
     $app->match($route, function (Application $app) use($name, $route, $template) {
         try {
             $response = new TransientResponse($app, $template);
         } catch (\Exception $e) {
             return $this->handleException($e->getMessage());
         }
         return $response;
     })->bind($name);
 }