/**
  * Register service function.
  *
  * @param BaseApplication $app
  */
 public function register(BaseApplication $app)
 {
     // Repository
     $app['orderpdf.repository.order_pdf'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\OrderPdf\\Entity\\OrderPdf');
     });
     // Order pdf event
     $app['orderpdf.event.order_pdf'] = $app->share(function () use($app) {
         return new OrderPdf($app);
     });
     // Order pdf legacy event
     $app['orderpdf.event.order_pdf_legacy'] = $app->share(function () use($app) {
         return new OrderPdfLegacy($app);
     });
     // ============================================================
     // コントローラの登録
     // ============================================================
     // 管理画面定義
     $admin = $app['controllers_factory'];
     // 強制SSL
     if ($app['config']['force_ssl'] == Constant::ENABLED) {
         $admin->requireHttps();
     }
     // 帳票の作成
     $admin->match('/plugin/order-pdf', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index')->bind('plugin_admin_order_pdf');
     // PDFファイルダウンロード
     $admin->post('/plugin/order-pdf/download', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::download')->bind('plugin_admin_order_pdf_download');
     $app->mount('/' . trim($app['config']['admin_route'], '/') . '/', $admin);
     // ============================================================
     // Formの登録
     // ============================================================
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new OrderPdfType($app);
         return $types;
     }));
     // -----------------------------
     // サービスの登録
     // -----------------------------
     // 帳票作成
     $app['orderpdf.service.order_pdf'] = $app->share(function () use($app) {
         return new OrderPdfService($app);
     });
     // ============================================================
     // メッセージ登録
     // ============================================================
     $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
     if (file_exists($file)) {
         $app['translator']->addResource('yaml', $file, $app['locale']);
     }
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!Version::isSupportMethod()) {
         eccube_log_init($app);
     }
 }
 /**
  * register.
  *
  * @param BaseApplication $app
  */
 public function register(BaseApplication $app)
 {
     // イベントの追加
     $app['eccube.plugin.categorycontent.event'] = $app->share(function () use($app) {
         return new Event($app);
     });
     $app['eccube.plugin.categorycontent.event_legacy'] = $app->share(function () use($app) {
         return new EventLegacy($app);
     });
     // @deprecated for since v3.0.0, to be removed in 3.1.
     if (!method_exists('Eccube\\Application', 'getInstance')) {
         // Form/Extension
         $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) use($app) {
             $extensions[] = new CategoryContentExtension($app);
             return $extensions;
         }));
     }
     //Repository
     $app['eccube.plugin.category_content.repository.category_content'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\CategoryContent\\Entity\\CategoryContent');
     });
     // メッセージ登録
     $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
     $app['translator']->addResource('yaml', $file, $app['locale']);
     //Config
     $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 (!method_exists('Eccube\\Application', 'getInstance')) {
         eccube_log_init($app);
     }
 }
 /**
  * register.
  *
  * @param BaseApplication $app
  */
 public function register(BaseApplication $app)
 {
     // 管理画面定義
     $admin = $app['controllers_factory'];
     // 強制SSL
     if ($app['config']['force_ssl'] == Constant::ENABLED) {
         $admin->requireHttps();
     }
     // Routingを追加
     $admin->match('/plugin/sales_report/term', '\\Plugin\\SalesReport\\Controller\\SalesReportController::term')->bind('admin_plugin_sales_report_term');
     $admin->match('/plugin/sales_report/age', '\\Plugin\\SalesReport\\Controller\\SalesReportController::age')->bind('admin_plugin_sales_report_age');
     $admin->match('/plugin/sales_report/product', '\\Plugin\\SalesReport\\Controller\\SalesReportController::product')->bind('admin_plugin_sales_report_product');
     $admin->post('/plugin/sales_report/export/{type}', '\\Plugin\\SalesReport\\Controller\\SalesReportController::export')->bind('admin_plugin_sales_report_export');
     $app->mount('/' . trim($app['config']['admin_route'], '/') . '/', $admin);
     // Formの定義
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new SalesReportType($app);
         return $types;
     }));
     // Serviceの定義
     $app['salesreport.service.sales_report'] = $app->share(function () use($app) {
         return new SalesReportService($app);
     });
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!method_exists('Eccube\\Application', 'getInstance')) {
         eccube_log_init($app);
     }
     // メッセージ登録
     $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
     if (file_exists($file)) {
         $app['translator']->addResource('yaml', $file, $app['locale']);
     }
     // サブナビの拡張
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $nav = array('id' => 'admin_plugin_sales_report', 'name' => '売上集計', 'has_child' => 'true', 'icon' => 'cb-chart', 'child' => array(array('id' => 'admin_plugin_sales_report_term', 'url' => 'admin_plugin_sales_report_term', 'name' => '期間別集計'), array('id' => 'admin_plugin_sales_report_product', 'url' => 'admin_plugin_sales_report_product', 'name' => '商品別集計'), array('id' => 'admin_plugin_sales_report_age', 'url' => 'admin_plugin_sales_report_age', 'name' => '年代別集計')));
         $config['nav'][] = $nav;
         return $config;
     }));
 }
 /**
  * @param BaseApplication $app
  */
 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')->bind('admin_recommend_list');
     // おすすめ商品の新規先
     $app->match('/' . $app['config']['admin_route'] . '/recommend/new', '\\Plugin\\Recommend\\Controller\\RecommendController::edit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_new');
     // おすすめ商品の編集
     $app->match('/' . $app['config']['admin_route'] . '/recommend/{id}/edit', '\\Plugin\\Recommend\\Controller\\RecommendController::edit')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_edit');
     // おすすめ商品の削除
     $app->delete('/' . $app['config']['admin_route'] . '/recommend/{id}/delete', '\\Plugin\\Recommend\\Controller\\RecommendController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_recommend_delete');
     // move rank
     $app->post('/' . $app['config']['admin_route'] . '/recommend/rank/move', '\\Plugin\\Recommend\\Controller\\RecommendController::moveRank')->bind('admin_recommend_rank_move');
     // 商品検索画面表示
     $app->post('/' . $app['config']['admin_route'] . '/recommend/search/product', '\\Plugin\\Recommend\\Controller\\RecommendSearchModelController::searchProduct')->bind('admin_recommend_search_product');
     $app->match('/' . $app['config']['admin_route'] . '/recommend/search/product/page/{page_no}', '\\Plugin\\Recommend\\Controller\\RecommendSearchModelController::searchProduct')->assert('page_no', '\\d+')->bind('admin_recommend_search_product_page');
     // ブロック
     $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 RecommendProductType($app);
         return $types;
     }));
     // サービスの登録
     $app['eccube.plugin.recommend.service.recommend'] = $app->share(function () use($app) {
         return new RecommendService($app);
     });
     // メッセージ登録
     $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;
     }));
     // Config
     $app['config'] = $app->share($app->extend('config', function ($config) {
         // menu bar
         $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;
         // Update path
         $pathFile = __DIR__ . '/../Resource/config/path.yml';
         if (file_exists($pathFile)) {
             $path = Yaml::parse(file_get_contents($pathFile));
             if (!empty($path)) {
                 // Replace path
                 $config = array_replace_recursive($config, $path);
             }
         }
         // 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);
     }
 }
 /**
  * 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);
     }
 }
예제 #6
0
     * @param array  $context
     */
    function log_debug($message, array $context = array())
    {
        if (isset($GLOBALS['eccube_logger'])) {
            $GLOBALS['eccube_logger']->debug($message, $context);
        }
    }
}
if (function_exists('eccube_log_init') === false) {
    /**
     * Init log function for ec-cube <= 3.0.8
     *
     * @param object $app
     */
    function eccube_log_init($app)
    {
        if (isset($GLOBALS['eccube_logger'])) {
            return;
        }
        $GLOBALS['eccube_logger'] = $app['monolog'];
        $app['eccube.monolog.factory'] = $app->protect(function ($config) use($app) {
            return $app['monolog'];
        });
    }
}
// 3.0.9以上の場合は初期化処理を行う.
if (method_exists('Eccube\\Application', 'getInstance') === true) {
    $app = \Eccube\Application::getInstance();
    eccube_log_init($app);
}
예제 #7
0
 /**
  * @param BaseApplication $app
  */
 public function register(BaseApplication $app)
 {
     // 管理画面定義
     $admin = $app['controllers_factory'];
     // 強制SSL
     if ($app['config']['force_ssl'] == Constant::ENABLED) {
         $admin->requireHttps();
     }
     // メーカーテーブル用リポジトリ
     $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');
     });
     // Maker event
     $app['eccube.plugin.maker.event.maker'] = $app->share(function () use($app) {
         return new Maker($app);
     });
     // Maker legacy event
     $app['eccube.plugin.maker.event.maker_legacy'] = $app->share(function () use($app) {
         return new MakerLegacy($app);
     });
     // 一覧・登録・修正
     $admin->match('/plugin/maker/{id}', '\\Plugin\\Maker\\Controller\\MakerController::index')->value('id', null)->assert('id', '\\d+|')->bind('admin_plugin_maker_index');
     // 削除
     $admin->delete('/plugin/maker/{id}/delete', '\\Plugin\\Maker\\Controller\\MakerController::delete')->value('id', null)->assert('id', '\\d+|')->bind('admin_plugin_maker_delete');
     $admin->post('/plugin/maker/rank/move', '\\Plugin\\Maker\\Controller\\MakerController::moveRank')->bind('admin_plugin_maker_move_rank');
     $app->mount('/' . trim($app['config']['admin_route'], '/') . '/', $admin);
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new MakerType($app);
         return $types;
     }));
     // Form Extension
     $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) use($app) {
         $extensions[] = new ProductMakerTypeExtension($app);
         return $extensions;
     }));
     // メッセージ登録
     $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
     $app['translator']->addResource('yaml', $file, $app['locale']);
     // メニュー登録
     $app['config'] = $app->share($app->extend('config', function ($config) {
         $addNavi['id'] = 'maker';
         $addNavi['name'] = 'メーカー管理';
         $addNavi['url'] = 'admin_plugin_maker_index';
         $nav = $config['nav'];
         foreach ($nav as $key => $val) {
             if ('product' == $val['id']) {
                 $nav[$key]['child'][] = $addNavi;
             }
         }
         $config['nav'] = $nav;
         return $config;
     }));
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!method_exists('Eccube\\Application', 'getInstance')) {
         eccube_log_init($app);
     }
 }