app/Customize/Twig/Extension/CustomExtension.php line 1953

Open in your IDE?
  1. <?php
  2. namespace Customize\Twig\Extension;
  3. use Customize\Entity\CacheTrait;
  4. use Customize\Service\GoodsPriceService;
  5. use Customize\Service\ReviewService;
  6. use Eccube\Entity\BaseInfo;
  7. use Eccube\Repository\BaseInfoRepository;
  8. use Eccube\Repository\PageRepository;
  9. use Lm\Engine\EC\Entity\GoodsWithRelated;
  10. use Lm\Entity\Goods;
  11. use Symfony\Component\HttpFoundation\RequestStack;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Twig\Environment as Twig;
  14. use Twig\Extension\AbstractExtension;
  15. use Twig\TwigFunction;
  16. use Twig\TwigFilter;
  17. use Symfony\Component\Security\Core\Security;
  18. use Eccube\Service\CartService;
  19. use Customize\Service\CartService as CartServiceCustomize;
  20. use Eccube\Common\EccubeConfig;
  21. use Customize\Service\CommonService;
  22. use Customize\Service\LmHelper;
  23. use Customize\Converter\DynamicConverter;
  24. use Customize\Service\RecentGoodsService;
  25. use Customize\Service\GoodsService;
  26. class CustomExtension extends AbstractExtension
  27. {
  28.     use CacheTrait;
  29.     /**
  30.      * @var Security
  31.      */
  32.     private $security;
  33.     /**
  34.      * @var CartService
  35.      */
  36.     protected $cartService;
  37.     protected $cartServiceCustomize;
  38.     protected $commonService;
  39.     /**
  40.      * @var DynamicConverter
  41.      */
  42.     protected $dynamicConverter;
  43.     const DISPLAY_ITEM_COUNT_LOW 20;
  44.     const DISPLAY_ITEM_COUNT_MID 50;
  45.     const DISPLAY_ITEM_COUNT_HI 100;
  46.     const DISPLAY_ITEM_COUNT_DEFAULT self::DISPLAY_ITEM_COUNT_MID;
  47.     /**
  48.      * @var EccubeConfig
  49.      */
  50.     protected $eccubeConfig;
  51.     /**
  52.      * @var Twig
  53.      */
  54.     protected $twig;
  55.     /**
  56.      * @var Request
  57.      */
  58.     protected $request;
  59.     /**
  60.      * @var LmHelper
  61.      */
  62.     protected $lmHelper;
  63.     /**
  64.      * @var ReviewService
  65.      */
  66.     protected $reviewService;
  67.     /**
  68.      * @var GoodsPriceService
  69.      */
  70.     private $goodsPriceService;
  71.     /**
  72.      * @var PageRepository
  73.      */
  74.     private $pageRepository;
  75.     /**
  76.      * @var BaseInfo
  77.      */
  78.     private $baseInfo;
  79.     protected $GoodsService;
  80.     public function __construct(Security         $security,
  81.                                 RequestStack     $requestStack,
  82.                                 Twig             $twig,
  83.                                 EccubeConfig     $eccubeConfig,
  84.                                 CartService      $cartService,
  85.                                 CommonService    $commonService,
  86.                                 LmHelper         $lmHelper,
  87.                                 DynamicConverter $dynamicConverter,
  88.                                 ReviewService    $reviewService,
  89.                                 GoodsPriceService $goodsPriceService,
  90.                                 PageRepository $pageRepository,
  91.                                 BaseInfoRepository $baseInfoRepository,
  92.                                 RecentGoodsService $RecentGoodsService,
  93.                                 CartServiceCustomize $cartServiceCustomize,
  94.                                 GoodsService     $goodService
  95.     )
  96.     {
  97.         $this->security $security;
  98.         $this->request $requestStack->getCurrentRequest();
  99.         $this->twig $twig;
  100.         $this->eccubeConfig $eccubeConfig;
  101.         $this->cartService $cartService;
  102.         $this->commonService $commonService;
  103.         $this->lmHelper $lmHelper;
  104.         $this->dynamicConverter $dynamicConverter;
  105.         $this->reviewService $reviewService;
  106.         $this->goodsPriceService $goodsPriceService;
  107.         $this->pageRepository $pageRepository;
  108.         $this->baseInfo $baseInfoRepository->get();
  109.         $this->RecentGoodsService $RecentGoodsService;
  110.         $this->cartServiceCustomize $cartServiceCustomize;
  111.         $this->GoodsService $goodService;
  112.     }
  113.     public function getFilters()
  114.     {
  115.         return [
  116.             new TwigFilter('header4_css', [$this'renderHeader4Css']),
  117.             new TwigFilter('check_mcMcName', [$this'checkMcName']),
  118.             new TwigFilter('display_text', [$this'displayText']),
  119.             new TwigFilter('lm_sashikomi', [$this'LM_sashikomi']),
  120.             new TwigFilter('replace_item_image_root', [$this'replaceItemImageRoot']),
  121.             new TwigFilter('lm_sashikomi_main_category', [$this'LM_displaySashikomi_mainCategory']),
  122.             new TwigFilter('slider_filter', [$this'sliderFilter']),
  123.             new TwigFilter('display_form_text', [$this'display_form_text']),
  124.         ];
  125.     }
  126.     public function getFunctions()
  127.     {
  128.         return [
  129.             new TwigFunction('formatDescriptionForEstimate', [$this'handleFormatDescriptionForEstimate']),
  130.             new TwigFunction('footer_main_category', [$this'getFooterMainCategory']),
  131.             new TwigFunction('left_fbnrs', [$this'getLeftFbnrs']),
  132.             new TwigFunction('right_fbnrs', [$this'getRightFbnrs']),
  133.             new TwigFunction('toe_messages', [$this'getToeMessages']),
  134.             new TwigFunction('message_categories_count', [$this'getMessageCategoriesCount']),
  135.             new TwigFunction('lmenu_css', [$this'getLMenuCss']),
  136.             new TwigFunction('totalDailyRanking', [$this'getTotalDailyRanking']),
  137.             new TwigFunction('topics_data', [$this'getTopics']),
  138.             new TwigFunction('get_s3_lm_doc_path', [$this'getS3LmDocPath']),
  139.             new TwigFunction('months', [$this'getMonths']),
  140.             new TwigFunction('days', [$this'getDays']),
  141.             new TwigFunction('render_category_list', [$this'renderCategoryList']),
  142.             new TwigFunction('preg_match', [$this'pregMatch']),
  143.             new TwigFunction('lm_detailLink2', [$this'LM_detailLink2']),
  144.             new TwigFunction('default_sp_other_category_pulldown_map', [$this'getDefaultSpOtherCategoryPulldownMap']),
  145.             new TwigFunction('sp_header', [$this'renderSpHeader']),
  146.             new TwigFunction('makeImageURL', [$this'makeImageURL']),
  147.             new TwigFunction('sashikomi', [$this'sashikomi']),
  148.             new TwigFunction('session_data', [$this'getSessionData']),
  149.             new TwigFunction('showGoodsLabelList', [$this'renderGoodsLabelList']),
  150.             new TwigFunction('render_product_item', [$this'renderProductItem']),
  151.             new TwigFunction('lm_category_filter', [$this'lm_category_filter']),
  152.             new TwigFunction('custom_parse_url', [$this'custom_parse_url']),
  153.             new TwigFunction('echoImageURL', [$this'echoImageURL']),
  154.             new TwigFunction('echoVirtualImages', [$this'echoVirtualImages']),
  155.             new TwigFunction('get_updated_at', [$this'get_updated_at']),
  156.             new TwigFunction('LM_displaySashikomi_detailGoods', [$this'LM_displaySashikomi_detailGoods']),
  157.             new TwigFunction('LM_insertFile', [$this'LM_insertFile']),
  158.             new TwigFunction('createGetParamater', [$this'createGetParamater']),
  159.             new TwigFunction('LM_displayTogetherBuyDetail_new3', [$this'LM_displayTogetherBuyDetail_new3']),
  160.             new TwigFunction('hoge', [$this'hoge']),
  161.             new TwigFunction('display_item_pulldown', [$this'display_item_pulldown']),
  162.             new TwigFunction('display_order_pulldown', [$this'display_order_pulldown']),
  163.             new TwigFunction('sp_common_contents_map', [$this'getCommonContentsMap']),
  164.             new TwigFunction('get_calendar_info', [$this'getCalendarInfo']),
  165.             new TwigFunction('get_holiday_info', [$this'getHolidayInfo']),
  166.             new TwigFunction('you_may_also_like', [$this'getYouMayAlsoLike']),
  167.             new TwigFunction('get_koe_count', [$this'getKoeCount']),
  168.             new TwigFunction('get_category_order_type', [$this'getCategoryOrderType']),
  169.             new  TwigFunction('isShowSpHeader', [$this'isShowSpHeader']),
  170.             new  TwigFunction('showSizeTable', [$this'getSizeTable']),
  171.             new TwigFunction('get_carts_total_quantity', [$this'get_carts_total_quantity']),
  172.         ];
  173.     }
  174.     public function handleFormatDescriptionForEstimate(string $text) {
  175.         if (empty($text)) {
  176.             return "";
  177.         }
  178.         $result "";
  179.         $text preg_replace('/\s+/'' '$text);
  180.         $lines explode('・'$text);
  181.         $step 1;
  182.         if (in_array('多色向き/写真等 '$lines)) {
  183.             $step 0;
  184.         }
  185.         for ($i $step$i count($lines); $i++) {
  186.             $result .= '・' $lines[$i] . "<br />";
  187.         }
  188.         return $result;
  189.     }
  190.     public function renderHeader4Css($uri)
  191.     {
  192.         $uri $_SERVER['REQUEST_URI'];
  193.         if (preg_match("/^\/polo\//"$uri)) echo "#header-menu-1-1 { background-position: -108px 0 !important; }";
  194.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-1-2 { background-position: -108px -106px !important; }";
  195.         if (preg_match("/^\/tshirt\//"$uri)) echo "#header-menu-1-3 { background-position: -108px -212px !important; }";
  196.         if (preg_match("/^\/staff\//"$uri)) echo "#header-menu-1-4 { background-position: -108px -318px !important; }";
  197.         if (preg_match("/^\/vest\//"$uri)) echo "#header-menu-1-5 { background-position: -108px -424px !important; }";
  198.         if (preg_match("/^\/warm\//"$uri)) echo "#header-menu-1-6 { background-position: -108px -530px !important; }";
  199.         if (preg_match("/^\/sweat\//"$uri)) echo "#header-menu-1-7 { background-position: -108px -636px !important; }";
  200.         if (preg_match("/^\/pants\//"$uri)) echo "#header-menu-1-8 { background-position: -108px -742px !important; }";
  201.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-1-9 { background-position: -108px -848px !important; }";
  202.         if (preg_match("/^\/apron\//"$uri)) echo "#header-menu-2-1 { background-position: -108px -27px !important; }";
  203.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#header-menu-2-2 { background-position: -108px -133px !important; }";
  204.         if (preg_match("/^\/happi\//"$uri)) echo "#header-menu-2-3 { background-position: -108px -239px !important; }";
  205.         if (preg_match("/^\/cap\//"$uri)) echo "#header-menu-2-4 { background-position: -108px -345px !important; }";
  206.         if (preg_match("/^\/overall\//"$uri)) echo "#header-menu-2-5 { background-position: -108px -451px !important; }";
  207.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#header-menu-2-6 { background-position: -108px -557px !important; }";
  208.         if (preg_match("/^\/towel\//"$uri)) echo "#header-menu-2-7 { background-position: -108px -663px !important; }";
  209.         if (preg_match("/^\/scrub\//"$uri)) echo "#header-menu-2-8 { background-position: -108px -769px !important; }";
  210.         if (preg_match("/^\/bag\//"$uri)) echo "#header-menu-2-9 { background-position: -108px -875px !important; }";
  211.         if (preg_match("/^\/work\//"$uri)) echo "#header-menu-3-1 { background-position: -108px -54px !important; }";
  212.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#header-menu-3-2 { background-position: -108px -160px !important; }";
  213.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#header-menu-3-3 { background-position: -108px -266px !important; }";
  214.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#header-menu-3-4 { background-position: -108px -372px !important; }";
  215.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#header-menu-3-5 { background-position: -108px -478px !important; }";
  216.         if (preg_match("/^\/election-item\//"$uri)) echo "#header-menu-3-6 { background-position: -108px -584px !important; }";
  217.         if (preg_match("/^\/care-wear\//"$uri)) echo "#header-menu-3-7 { background-position: -108px -690px !important; }";
  218.         if (preg_match("/^\/patrol\//"$uri)) echo "#header-menu-3-8 { background-position: -108px -796px !important; }";
  219.         if (preg_match("/^\/food-uniform\/formal-vest\//"$uri)) echo "#header-menu-3-9 { background-position: -108px -902px !important; }";
  220.         if (preg_match("/^\/guide\//"$uri) and !preg_match("/^\/guide\/print-shurui\//"$uri) and !preg_match("/^\/guide\/price-silk\//"$uri) and !preg_match("/^\/guide\/henpin\//"$uri) and !preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-1 { background-position: -108px -81px !important; }";
  221.         if (preg_match("/^\/guide\/print-shurui\//"$uri)) echo "#header-menu-4-2 { background-position: -108px -187px !important; }";
  222.         if (preg_match("/^\/guide\/price-silk\//"$uri)) echo "#header-menu-4-3 { background-position: -108px -293px !important; }";
  223.         if (preg_match("/^\/print\/font-menu\//"$uri)) echo "#header-menu-4-4 { background-position: -108px -399px !important; }";
  224.         if (preg_match("/^\/guide\/henpin\//"$uri)) echo "#header-menu-4-5 { background-position: -108px -505px !important; }";
  225.         if (preg_match("/^\/guide\/shiharai\//"$uri)) echo "#header-menu-4-6 { background-position: -108px -611px !important; }";
  226.         if (preg_match("/^\/faq\//"$uri)) echo "#header-menu-4-7 { background-position: -108px -717px !important; }";
  227.         if (preg_match("/^\/sample-order\//"$uri)) echo "#header-menu-4-8 { background-position: -108px -823px !important; }";
  228.         if (preg_match("/^\/company\//"$uri)) echo "#header-menu-4-9 { background-position: -108px -929px !important; }";
  229.         return "";
  230.     }
  231.     public function getFooterMainCategory()
  232.     {
  233.         // TODO: MainCategoryページのFooterで ページDescription取得
  234.         /**
  235.          * [
  236.          *  [
  237.          *    name: 'description',
  238.          *    content: 'TEST'
  239.          *  ]
  240.          *  ...
  241.          * ]
  242.          */
  243.         $response = [
  244.             [
  245.                 'name' => 'description',
  246.                 'content' => 'TEST'
  247.             ]
  248.         ];
  249.         return $response;
  250.     }
  251.     public function getLeftFbnrs()
  252.     {
  253.         $viewCacheKey $this->lmHelper->getCacheKey('getLeftFbnrs', []);
  254.         return $this->getCacheByKey($viewCacheKey, function() {
  255.             $result = [];
  256.             $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  257.                 return !empty($fbnr['fbnr_content']);
  258.             }));
  259.             $result[] = array_shift($fbnrs);
  260.             return $result;
  261.         });
  262.     }
  263.   public function displayText($text)
  264.   {
  265.     return nl2br(str_replace(">","&gt;",str_replace("<","&lt;",stripslashes($text))));
  266.   }
  267.   public function LM_sashikomi($srcHtml)
  268.   {
  269.     $CFIMG_URL $this->eccubeConfig['CFIMG_URL'] . '/';
  270.     $BACKIMG_URL $this->eccubeConfig['BACKIMG_URL'];
  271.         $dstHtml $srcHtml;
  272.         $dstHtml str_replace('"img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  273.         $dstHtml str_replace('"/img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  274.         $dstHtml str_replace('"./img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  275.         $dstHtml str_replace('"../img/','"'.$CFIMG_URL."public_img/",$dstHtml);
  276.         $dstHtml str_replace('http://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  277.         $dstHtml str_replace('https://www.l-m.co.jp/img/',$CFIMG_URL."public_img/",$dstHtml);
  278.         $dstHtml str_replace('"images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  279.         $dstHtml str_replace('"/images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  280.         $dstHtml str_replace('"./images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  281.         $dstHtml str_replace('"../images/','"'.$CFIMG_URL."public_images/",$dstHtml);
  282.         $dstHtml str_replace('http://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  283.         $dstHtml str_replace('https://www.l-m.co.jp/images/',$CFIMG_URL."public_images/",$dstHtml);
  284.         $dstHtml str_replace('url(images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  285.         $dstHtml str_replace('url(/images/','url('.$CFIMG_URL.'public_images/',$dstHtml);
  286.         $dstHtml str_replace('url(\'images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  287.         $dstHtml str_replace('url(\'/images/','url(\''.$CFIMG_URL.'public_images/',$dstHtml);
  288.         $dstHtml str_replace('url("images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  289.         $dstHtml str_replace('url("/images/','url("'.$CFIMG_URL.'public_images/',$dstHtml);
  290.         $dstHtml str_replace('"item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  291.         $dstHtml str_replace('"/item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  292.         $dstHtml str_replace('"./item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  293.         $dstHtml str_replace('"../item/kihon/','"'.$BACKIMG_URL."public_item/kihon/",$dstHtml);
  294.         $dstHtml str_replace('http://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  295.         $dstHtml str_replace('https://www.l-m.co.jp/item/kihon/',$BACKIMG_URL."public_item/kihon/",$dstHtml);
  296.         $dstHtml str_replace('url(item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  297.         $dstHtml str_replace('url(/item/kihon/','url('.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  298.         $dstHtml str_replace('url(\'item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  299.         $dstHtml str_replace('url(\'/item/kihon/','url(\''.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  300.         $dstHtml str_replace('url("item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  301.     $dstHtml str_replace('url("/item/kihon/','url("'.$BACKIMG_URL.'public_item/kihon/',$dstHtml);
  302.     return $dstHtml;
  303.   }
  304.   public function renderCategoryList($mcMcName$mcName$data$canonicalMcData$categoryData$dataItem$subCategoryList$ctId)
  305.   {
  306.       // 配下カテゴリ
  307.       $canonicalMcName $mcName;
  308.       if (!empty($mcMcName)) {
  309.           $canonicalMcName "{$mcMcName}/{$mcName}";
  310.       } else if (!empty($data['main_category_main_category_webname'])) {
  311.           $canonicalMcName "{$data['main_category_main_category_webname']}/{$mcName}";
  312.       }
  313.       if (!empty($canonicalMcData)) {
  314.           $data $canonicalMcData;
  315.           $canonicalMcName $data['main_category_webname'];
  316.           if (!empty($data['main_category_main_category_webname'])) {
  317.               $canonicalMcName "{$data['main_category_main_category_webname']}/{$canonicalMcName}";
  318.           }
  319.       } else if ($categoryData == null) {
  320.           $data $data;
  321.       } else {
  322.           $data $categoryData;
  323.       }
  324.       // 件数リスト
  325.       $categoryCntList = array();
  326.       if (isset($dataItem)) {
  327.           foreach ($dataItem as $_item) {
  328.               $categoryCntList[$_item['category_id']] = $_item['cnt'] ?? 0;
  329.           }
  330.       }
  331.   }
  332.     public function getRightFbnrs()
  333.     {
  334.         $viewCacheKey $this->lmHelper->getCacheKey('getRightFbnrs', []);
  335.         $fbnrs array_values(array_filter($this->dynamicConverter->getFbnrs(), function ($fbnr) {
  336.             return !empty($fbnr['fbnr_content2']);
  337.         }));
  338.         $result = [];
  339.         $result[] = array_shift($fbnrs);
  340.         $pageType $this->lmHelper->getPageType();
  341.         if ($pageType['value'] === 'print-shurui') {
  342.             $shuruiSideMenu[]['fbnr_content2'] = '
  343.             <div id="print-shurui-side-nav">
  344.                 <dl>
  345.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_anchor">シルクプリント</a></dt>
  346.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_k" class="allsale_h">価格</a></dd>
  347.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_kd">├型代</a></dd>
  348.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_pd">├プリント代</a></dd>
  349.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#silk_im">└色見本</a></dd>
  350.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#staff_anchor">STAFF無料型</a></dt>
  351.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#magic_anchor">マジックプリント</a></dt>
  352.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#transfer_anchor">転写</a></dt>
  353.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#embroidery_anchor">刺繍</a></dt>
  354.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_k" class="allsale_h">価格</a></dd>
  355.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_sya">├社名刺繍</a></dd>
  356.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_logo">├ロゴマーク</a></dd>
  357.                 <dd><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#sisyu_im">└色見本</a></dd>
  358.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#threedimensional_anchor">立体刺繍</a></dt>
  359.                 <dt id="nav_lad"><a href="' $this->eccubeConfig['FRONT_PATH'] . 'guide/print-shurui/#rehem_anchor">ズボンの裾直し</a></dt>
  360.                 </dl>
  361.             </div>';
  362.             return $shuruiSideMenu;
  363.         }
  364.         return $result;
  365.     }
  366.     public function getToeMessages()
  367.     {
  368.         $messages = (array)$this->dynamicConverter->getMessageList('cm_id, title, add_datetime'10);
  369.         $response = [
  370.             'total_count' => sizeof((array)$this->dynamicConverter->getMessageList()),
  371.             'data' => $messages
  372.         ];
  373.         return $response;
  374.     }
  375.     public function getMessageCategoriesCount()
  376.     {
  377.         $messages $this->dynamicConverter->getMessageCountByCategory();
  378.         return $messages;
  379.     }
  380.     public function getLMenuCss()
  381.     {
  382.         $uri $_SERVER['REQUEST_URI'];
  383.         if (preg_match("/^\/work\//"$uri)) echo "#side-nav.top-use #fixed-menu-1 { background-position: -165px 0 !important; }";
  384.         if (preg_match("/^\/anzengutsu\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  385.         if (preg_match("/^\/jimufuku\//"$uri)) echo "#side-nav.top-use #fixed-menu-3 { background-position: -165px -86px !important; }";
  386.         if (preg_match("/^\/hakui\//"$uri) and !preg_match("/^\/hakui\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-4 { background-position: -165px -129px !important; }";
  387.         if (preg_match("/^\/scrub\//"$uri)) echo "#side-nav.top-use #fixed-menu-5 { background-position: -165px -172px !important; }";
  388.         if (preg_match("/^\/food-uniform\//"$uri) and !preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-6 { background-position: -165px -215px !important; }";
  389.         if (preg_match("/^\/food-uniform\/cook-coat\//"$uri)) echo "#side-nav.top-use #fixed-menu-7 { background-position: -165px -258px !important; }";
  390.         if (preg_match("/^\/esthe-uniform\//"$uri) and !preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-use #fixed-menu-8 { background-position: -165px -301px !important; }";
  391.         if (preg_match("/^\/care-wear\//"$uri)) echo "#side-nav.top-use #fixed-menu-9 { background-position: -165px -344px !important; }";
  392.         if (preg_match("/^\/patrol\//"$uri)) echo "#side-nav.top-use #fixed-menu-10 { background-position: -165px -387px !important; }";
  393.         if (preg_match("/^\/formal\//"$uri)) echo "#side-nav.top-use #fixed-menu-11 { background-position: -165px -430px !important; }";
  394.         if (preg_match("/^\/polo\//"$uri)) echo "#side-nav.top-category #fixed-menu-1 { background-position: -165px 0 !important; }";
  395.         if (preg_match("/^\/apron\//"$uri)) echo "#side-nav.top-category #fixed-menu-2 { background-position: -165px -43px !important; }";
  396.         if (preg_match("/^\/shirt\//"$uri) and !preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-3 { background-position: -165px -86px !important; }";
  397.         if (preg_match("/^\/tshirt\//"$uri)) echo "#side-nav.top-category #fixed-menu-4 { background-position: -165px -129px !important; }";
  398.         if (preg_match("/^\/staff\//"$uri)) echo "#side-nav.top-category #fixed-menu-5 { background-position: -165px -172px !important; }";
  399.         if (preg_match("/^\/vest\//"$uri)) echo "#side-nav.top-category #fixed-menu-6 { background-position: -165px -215px !important; }";
  400.         if (preg_match("/^\/warm\//"$uri)) echo "#side-nav.top-category #fixed-menu-7 { background-position: -165px -258px !important; }";
  401.         if (preg_match("/^\/sweat\//"$uri)) echo "#side-nav.top-category #fixed-menu-8 { background-position: -165px -301px !important; }";
  402.         if (preg_match("/^\/pants\//"$uri)) echo "#side-nav.top-category #fixed-menu-9 { background-position: -165px -344px !important; }";
  403.         if (preg_match("/^\/shirt\/aloha\//"$uri)) echo "#side-nav.top-category #fixed-menu-10 { background-position: -165px -387px !important; }";
  404.         if (preg_match("/^\/happi\//"$uri)) echo "#side-nav.top-category #fixed-menu-11 { background-position: -165px -430px !important; }";
  405.         if (preg_match("/^\/cap\//"$uri)) echo "#side-nav.top-category #fixed-menu-12 { background-position: -165px -473px !important; }";
  406.         if (preg_match("/^\/overall\//"$uri)) echo "#side-nav.top-category #fixed-menu-13 { background-position: -165px -516px !important; }";
  407.         if (preg_match("/^\/towel\//"$uri)) echo "#side-nav.top-category #fixed-menu-14 { background-position: -165px -559px !important; }";
  408.         if (preg_match("/^\/bag\//"$uri)) echo "#side-nav.top-category #fixed-menu-15 { background-position: -165px -602px !important; }";
  409.         return "";
  410.     }
  411.     public function checkMcName($mcMcName$type)
  412.     {
  413.         $datas = [$mcMcName$type];
  414.         $viewCacheKey $this->lmHelper->getCacheKey("checkMcName"$datas);
  415.         return $this->getCacheByKey($viewCacheKey, function() use ($mcMcName$type) {
  416.             if ($type == 1) {
  417.                 return (
  418.                     $mcMcName != "polo" and
  419.                     $mcMcName != "shirt" and
  420.                     $mcMcName != "tshirt" and
  421.                     $mcMcName != "staff" and
  422.                     $mcMcName != "vest" and
  423.                     $mcMcName != "warm" and
  424.                     $mcMcName != "sweat" and
  425.                     $mcMcName != "pants" and
  426.                     $mcMcName != "cook-coat" and
  427.                     $mcMcName != "apron" and
  428.                     $mcMcName != "happi" and
  429.                     $mcMcName != "cap" and
  430.                     $mcMcName != "overall" and
  431.                     $mcMcName != "anzengutsu" and
  432.                     $mcMcName != "towel" and
  433.                     $mcMcName != "scrub" and
  434.                     $mcMcName != "bag" and
  435.                     $mcMcName != "work" and
  436.                     $mcMcName != "jimufuku" and
  437.                     $mcMcName != "hakui" and
  438.                     $mcMcName != "food-uniform" and
  439.                     $mcMcName != "esthe-uniform" and
  440.                     $mcMcName != "election-item" and
  441.                     $mcMcName != "care-wear" and
  442.                     $mcMcName != "patrol" and
  443.                     $mcMcName != "pachinko" and
  444.                     $mcMcName != "burtle" and
  445.                     $mcMcName != "tsdesign" and
  446.                     $mcMcName != "xebec" and
  447.                     $mcMcName != "aitoz" and
  448.                     $mcMcName != "jichodo" and
  449.                     $mcMcName != "jawin" and
  450.                     $mcMcName != "kurodaruma" and
  451.                     $mcMcName != "co-cos" and
  452.                     $mcMcName != "sowa" and
  453.                     $mcMcName != "joie" and
  454.                     $mcMcName != "bon" and
  455.                     $mcMcName != "boncierge" and
  456.                     $mcMcName != "enjoy" and
  457.                     $mcMcName != "selery" and
  458.                     $mcMcName != "mizuno" and
  459.                     $mcMcName != "folk" and
  460.                     $mcMcName != "lecoqsportif-nurse" and
  461.                     $mcMcName != "lumiere" and
  462.                     $mcMcName != "facemix" and
  463.                     $mcMcName != "arbe" and
  464.                     $mcMcName != "bonuni" and
  465.                     $mcMcName != "lecoqsportif-care" and
  466.                     $mcMcName != "heartgreen" and
  467.                     $mcMcName != "natural-smile" and
  468.                     $mcMcName != "pep" and
  469.                     $mcMcName != "printstar" and
  470.                     $mcMcName != "unitedathle" and
  471.                     $mcMcName != "maximum" and
  472.                     $mcMcName != "calala" and
  473.                     $mcMcName != "bspa" and
  474.                     $mcMcName != "counterbiz" and
  475.                     $mcMcName != "glimmer" and
  476.                     $mcMcName != "daluc" and
  477.                     $mcMcName != "triumph" and
  478.                     $mcMcName != "sunpex" and
  479.                     $mcMcName != "formal" and
  480.                     $mcMcName != "whisel" and
  481.                     $mcMcName != "work-ladies" and
  482.                     $mcMcName != "work-gekiyasu" and
  483.                     $mcMcName != "work-stretch" and
  484.                     $mcMcName != "work-seiden" and
  485.                     $mcMcName != "work-cotton" and
  486.                     $mcMcName != "work-menpoli" and
  487.                     $mcMcName != "work-coolbiz" and
  488.                     $mcMcName != "work-warmbiz" and
  489.                     $mcMcName != "work-bouen" and
  490.                     $mcMcName != "work-nannen" and
  491.                     $mcMcName != "office-cute" and
  492.                     $mcMcName != "office-adult" and
  493.                     $mcMcName != "office-stock" and
  494.                     $mcMcName != "office-gekiyasu" and
  495.                     $mcMcName != "office-muji" and
  496.                     $mcMcName != "office-check" and
  497.                     $mcMcName != "office-stripe" and
  498.                     $mcMcName != "office-border" and
  499.                     $mcMcName != "office-jacquard"
  500.                 );
  501.             } else if ($type == 2) { // 限定非表示したいエリアをここに入れる 2015.5.1 複数のとき、!= and
  502.                 return (
  503.                     $mcMcName != "pants" and
  504.                     $mcMcName != "cook-coat" and
  505.                     $mcMcName != "anzengutsu" and
  506.                     $mcMcName != "scrub" and
  507.                     $mcMcName != "bag" and
  508.                     $mcMcName != "work" and
  509.                     $mcMcName != "jimufuku" and
  510.                     $mcMcName != "hakui" and
  511.                     $mcMcName != "food-uniform" and
  512.                     $mcMcName != "esthe-uniform" and
  513.                     $mcMcName != "pachinko" and
  514.                     $mcMcName != "burtle" and
  515.                     $mcMcName != "tsdesign" and
  516.                     $mcMcName != "xebec" and
  517.                     $mcMcName != "aitoz" and
  518.                     $mcMcName != "jichodo" and
  519.                     $mcMcName != "jawin" and
  520.                     $mcMcName != "kurodaruma" and
  521.                     $mcMcName != "co-cos" and
  522.                     $mcMcName != "sowa" and
  523.                     $mcMcName != "joie" and
  524.                     $mcMcName != "bon" and
  525.                     $mcMcName != "boncierge" and
  526.                     $mcMcName != "enjoy" and
  527.                     $mcMcName != "selery" and
  528.                     $mcMcName != "mizuno" and
  529.                     $mcMcName != "folk" and
  530.                     $mcMcName != "lecoqsportif-nurse" and
  531.                     $mcMcName != "lumiere" and
  532.                     $mcMcName != "facemix" and
  533.                     $mcMcName != "arbe" and
  534.                     $mcMcName != "bonuni" and
  535.                     $mcMcName != "lecoqsportif-care" and
  536.                     $mcMcName != "heartgreen" and
  537.                     $mcMcName != "natural-smile" and
  538.                     $mcMcName != "pep" and
  539.                     $mcMcName != "calala" and
  540.                     $mcMcName != "bspa" and
  541.                     $mcMcName != "counterbiz"
  542.                 );
  543.             }
  544.             return false;
  545.         });
  546.     }
  547.     public function getTotalDailyRanking()
  548.     {
  549.         $goods = (array)$this->dynamicConverter->getRankingList();
  550.         $response = [
  551.             'all' => array(),
  552.             'sagyoufuku' => array(),
  553.             'jimufuku' => array(),
  554.             'hakui' => array(),
  555.             'inshoku' => array()
  556.         ];
  557.         foreach ($goods as $good) {
  558.             $good['image_url'] = $this->makeImageURL('goods.img'$good['goods_id']);
  559.             switch ($good['goods_genre_text']) {
  560.                 case '':
  561.                     $good['goods_genre_text'] = '総合';
  562.                     $response['all'][$good['ranking_no']] = $good;
  563.                     break;
  564.                 case '作業服':
  565.                     $response['sagyoufuku'][$good['ranking_no']] = $good;
  566.                     break;
  567.                 case '事務服':
  568.                     $response['jimufuku'][$good['ranking_no']] = $good;
  569.                     break;
  570.                 case '白衣':
  571.                     $response['hakui'][$good['ranking_no']] = $good;
  572.                     break;
  573.                 case '飲食':
  574.                     $response['inshoku'][$good['ranking_no']] = $good;
  575.                     break;
  576.             }
  577.         }
  578.         foreach ($response as $key => $dummy) {
  579.             ksort($response[$key]);
  580.         }
  581.         return $response;
  582.     }
  583.     public function getTopics()
  584.     {
  585.         $results $this->dynamicConverter->getTopicData();
  586.         return $results;
  587.     }
  588.     public function getS3LmDocPath()
  589.     {
  590.         $path ''// $this->eccubeConfig['S3_LM_DOC_PATH'];
  591.         return $path;
  592.     }
  593.     public function getMonths()
  594.     {
  595.         $months = array();
  596.         for ($i 1$i <= 12$i++) {
  597.             $months[] = $i;
  598.         }
  599.         return $months;
  600.     }
  601.     public function getDays()
  602.     {
  603.         $days = array();
  604.         for ($i 1$i <= 31$i++) {
  605.             $days[] = $i;
  606.         }
  607.         return $days;
  608.     }
  609.     public function replaceItemImageRoot($html)
  610.     {
  611.         $dstHtml $html;
  612.         return $dstHtml;
  613.     }
  614.     public function LM_displaySashikomi_mainCategory($value)
  615.     {
  616.         if ($value != "") {
  617.             if (file_exists($filename "files/insert/{$value}")) {
  618.                 $file implode(""file($filename));
  619.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  620.                 $tmp explode("<body>"$file);
  621.                 if (count($tmp) > 1) {
  622.                     $tmp explode("</body>"$tmp[1]);
  623.                 } else {
  624.                     $tmp explode("</body>"$tmp[0]);
  625.                 }
  626.                 $tmp $this->replaceItemImageRoot($tmp[0]);
  627.                 return "<div style='line-height:12px'><br /></div>" $tmp;
  628.             }
  629.         }
  630.         return "";
  631.     }
  632.     private function addAttrRegexp($src$attrname, array $dst)
  633.     {
  634.         $attrs preg_replace_callback("/{$attrname}=\"([^\"]+)\"/", function ($matches) {
  635.             return $matches[1];
  636.         }, $src);
  637.         $attrs explode(' '$attrs);
  638.         $attrs $dst $attrs;
  639.         $attrs implode(' '$attrs);
  640.         return $attrs;
  641.     }
  642.     public function sliderFilter($value)
  643.     {
  644.         //
  645.         if (preg_match('/class="swiper-wrapper/'$value)) {
  646.             return $value;
  647.         }
  648.         // bxSlider
  649.         $value preg_replace_callback('/<ul([^<>]*(?:bxslider|foobar)[^<>]*)>(.*?)<\/ul>/s', function ($matches) {
  650.             //
  651.             $org $matches[0];
  652.             //
  653.             $classes $this->addAttrRegexp($matches[1], 'class', [
  654.                 'swiper-wrapper',
  655.             ]);
  656.             // echo $classes, PHP_EOL;
  657.             // TODO: その他の属性の対応
  658.             $attrs " class=\"{$classes}\"";
  659.             $li preg_replace_callback('/<li([^<>]*)>/', function ($matches) {
  660.                 //
  661.                 $classes $this->addAttrRegexp($matches[1], 'class', [
  662.                     'swiper-slide',
  663.                 ]);
  664.                 // echo $classes, PHP_EOL;
  665.                 //
  666.                 return "<li class=\"{$classes}\">";
  667.             }, $matches[2]);
  668.             //
  669.             $swiper "<div class=\"swiper-container\">
  670.                 <ul{$attrs}>{$li}</ul>
  671.                 <div class=\"swiper-pagination\"></div>
  672.                 <div class=\"swiper-button-prev\"></div>
  673.                   <div class=\"swiper-button-next\"></div>
  674.                 <div class=\"swiper-scrollbar\"></div>
  675.             </div>";
  676.             // var_dump(compact('matches', 'attrs', 'li', 'swiper'));
  677.             //
  678.             return $swiper;
  679.         }, $value);
  680.         //
  681.         return $value;
  682.     }
  683.     public function pregMatch($pattern$value$result)
  684.     {
  685.         return preg_match($pattern$value$result);
  686.     }
  687.     public function LM_detailLink2($data$mcName ""$ctName ""$useItemUrlDuplicated true)
  688.     {
  689.         $item_id = !empty($data['goods_canonical_hinban']) ? $data['goods_canonical_hinban'] : $data['goods_id'];
  690.         if (!$useItemUrlDuplicated) {
  691.             $url "/item/{$item_id}.html";
  692.         } else if ($mcName === 'nagaileben') {
  693.             // ナガイレーベンの場合のみ、プレーンURLとする
  694.             $url "/item/{$item_id}.html";
  695.         } else if ($mcName != "" && $ctName == "") {
  696.             $url "/item/{$item_id}/{$mcName}.html";
  697.         } else if ($mcName != "" && $ctName != "") {
  698.             $url "/item/{$item_id}/{$mcName}/{$ctName}.html";
  699.         }
  700.         echo $url;
  701.     }
  702.     public function getDefaultSpOtherCategoryPulldownMap()
  703.     {
  704.         return $this->commonService->getSpOtherCategoryPulldownMap();
  705.     }
  706.     public function renderSpHeader($main_h1$category_h1$h1_comment$data$custom_menu$recentviews$custom_frequently_searched_word$other_category_path_map = [])
  707.     {
  708.         $html '';
  709.             $cartCount $this->get_carts_total_quantity();
  710.             if (!strstr($_SERVER["REQUEST_URI"], "/estimate")) {
  711.                 $html '<nav id="ut-sp-global-navi">';
  712.                 // キャッシュが無効(通常通り出力)
  713.                 $temp $this->sp_h1($main_h1$category_h1$h1_comment$data);
  714.                 $html "{$html}{$temp}";
  715.                 $html $html '<ul>
  716.           <li class="navi-home"><a href="/" data-ajax="false"><i class="material-icons">home</i><span>ホーム</span></a></li>
  717.           <li class="navi-tel"><a href="tel:0120115116" class="cv-tel" data-ajax="false"><i class="material-icons">phone</i><span>電話</span></a></li>
  718.           <li class="navi-cart"><a href="/cart/" data-ajax="false"><i class="material-icons">shopping_cart</i><span>カート<div class="cart-item-badge' . (isset($_SESSION['cart']['type']) && $_SESSION['cart']['type'] == "sample" ' sample' '') . '"><b>' $cartCount '</b></div></span></a></li>
  719.           <li class="navi-search"><a href="#" data-ajax="false" data-slide-panel="search"><i class="material-icons">search</i><span>検索</span></a></li>
  720.           <li class="navi-menu"><a href="#" data-ajax="false" data-slide-panel="menu"><i class="material-icons">menu</i><span>メニュー</span></a></li>
  721.         </ul>';
  722.                 $html "{$html}</nav>";
  723.                 $temp $this->slide_panel_menu($custom_menu$recentviews$other_category_path_map);
  724.                 $html "{$html}{$temp}";
  725.                  $temp $this->slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews);
  726.                 $html "{$html}{$temp}";
  727.             }
  728.         $allowedNewCss = ['/mypage/history/''/mypage/mhistory/''/mypage/chistory/''/mypage/contact/''/mypage/update/'];
  729.         $currentURI parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
  730.         if (!in_array($currentURI$allowedNewCss)) {
  731.             $html $html '<div id="logo">
  732.                                 <a href="/" data-ajax="false"><img src="https://img0.land-mark.biz/ut_img/public_images/header/site_logo_mini.jpg" alt="ユニフォームタウン" /></a>
  733.                             </div>';
  734.         } else {
  735.             $html $html '<div id="logo">
  736.                             <a href="/" data-ajax="false"><img src="/stylesheets/images/icons-svg/union.svg" alt="ユニフォームタウン" /></a>
  737.                         </div>
  738.                         <div id="working-time-wrapper">
  739.                             <img class="working-hour" src="/stylesheets/images/icons-svg/working_hour.svg" />
  740.                             <img src="/stylesheets/images/icons-svg/day_off.svg" />
  741.                         </div>
  742.                         ';
  743.         }
  744.         echo $html;
  745.     }
  746.     private function sp_h1($main_h1$category_h1$h1_comment$data)
  747.     {
  748.         if (isset($main_h1) && $main_h1 != "") {
  749.             return "<h1>" $main_h1 "</h1>";
  750.         } elseif (isset($category_h1) && $category_h1 != "") {
  751.             return "<h1>" $category_h1 "</h1>";
  752.         } elseif (isset($h1_comment) && $h1_comment trim($h1_comment)) {
  753.             return "<h1>" $h1_comment "</h1>";
  754.         } elseif (isset($data['goods_h1']) && $data['goods_h1'] != "") {
  755.             // if (isset($data['goods'])) return str_replace('品番', '', $data['kataban'] ?? '') . " {$data['goods']['goods_maker_name_text']} {$data['goods']['goods_name']}";
  756.             // return "<h1>" . ($data['main_h1_tag'] ?? '') . "</h1>";
  757.             return "<h1>" . ($data['goods_h1'] ?? '') . "</h1>";
  758.         } else if ($h1 $this->getTitleStr($_SERVER["REQUEST_URI"])) {
  759.             return "<h1>{$h1}</h1>";
  760.         }
  761.         return "";
  762.     }
  763.     private function getTitleStr($urlStr)
  764.     {
  765.         // 2014.06.24 update : main-category, itemコントローラは個別layout内で解決する。
  766. //        $obj = new BaseLibraryModel();
  767. //        $db = $obj->dbConnection();
  768.         if (strpos($urlStr'?')) {
  769.             $urlStr substr($urlStr0strpos($urlStr'?'));
  770.         }
  771.         if (substr($urlStr01) == "/") {
  772.             $urlStr substr($urlStr1);
  773.         }
  774.         $h1_comment "";
  775.         $tmpArray = array();
  776.         $tmpArrays preg_split("(\/)"$urlStr);
  777. //        if ($tmpArrays[2] != "") {
  778. //            include FRONT_PATH . "an_ct/" . $tmpArray[1] . "/" . $tmpArray[2] . ".inc";
  779. //            $h1_comment = $this->displayText($data['category_data']['category_h1_tag'] != "" ? $data['category_data']['category_h1_tag'] : "");
  780. //        } elseif ($tmpArrays[1] != "") {
  781. //            include FRONT_PATH . "an_mc/" . $tmpArray[1] . ".inc";
  782. //            $h1_comment = $this->displayText($data['main_h1_tag'] != "" ? $data['main_h1_tag'] : "");
  783. //        }
  784.         if (substr($urlStr01) == "/") {
  785. //            $urlStr = substr($urlStr, 1, mb_strlen($urlStr));
  786.         }
  787.         if (trim($h1_comment) == "") {
  788.             $tmpArray['index'] = "ユニフォームのプリント専門店 UniformTownへようこそ";
  789.             $tmpArray['sitemap'] = "サイトマップ";
  790.             $tmpArray['sitemap/detail'] = "商品カテゴリ別サイトマップ";
  791.             $tmpArray['guide'] = "ユニフォームタウンを初めてご利用になられる方へ";
  792.             $tmpArray['print'] = "ユニフォームタウンの加工サービスについて";
  793.             $tmpArray['sample-order'] = "ユニフォームタウンのカタログ請求ページです。";
  794.             $tmpArray['mail'] = "メール問い合わせ";
  795.             $tmpArray['estimate'] = "ユニフォームタウンの見積りシミュレーション";
  796.             $tmpArray['login'] = "ユニフォームタウンのログインページ";
  797.             $tmpArray['login/sendinfo'] = "パスワードを忘れた方はこのページでお手続きをお願いします。";
  798.             $tmpArray['regi/thanks'] = "ユニフォームタウンの会員登録完了";
  799.             $tmpArray['regi'] = "ユニフォームタウンの会員登録";
  800.             $tmpArray['mypage/mhistory'] = "ユニフォームタウンでご購入いただいた履歴です";
  801.             $tmpArray['mypage/chistory'] = "ユニフォームタウンでサンプルのご請求頂いた履歴です";
  802.             $tmpArray['mypage/history'] = "ユニフォームタウンで購入いただいた履歴です";
  803.             $tmpArray['mypage/designlist'] = "デザインシミュレーションしていただいた履歴です";
  804.             $tmpArray['mypage/contact'] = "デザインデータの送付、領収書の発行などができます";
  805.             $tmpArray['mypage/update'] = "ユニフォームタウンの登録情報を更新できるページです";
  806.             $tmpArray['mypage/mylist'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  807.             $tmpArray['mypage/yoyaku'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  808.             $tmpArray['mypage'] = "いらっしゃいませ。ここは、お客様専用のマイページです。";
  809.             $tmpArray['samplecart'] = "ユニフォームタウンのサンプル商品ショッピングカートページです。";
  810.             $tmpArray['samplecheck'] = "ユニフォームタウンでのサンプル申込み内容をご確認ください。";
  811.             $tmpArray['item/by-product'] = "ユニフォームタウン - すべての商品";
  812.             $tmpArray['company/'] = "ユニフォームタウンの会社案内のページです。";
  813.             $tmpArray['company/showroom'] = "ショールームのご案内";
  814.             $tmpArray['company/use'] = "ユニフォームタウンをご利用するにあたっての環境について";
  815.             $tmpArray['company/agree/'] = "利用規約|ユニフォームの通販・プリント専門店 UniformTown";
  816.             $tmpArray['company/privacy'] = "ユニフォームタウンでの個人情報の保護方針と取扱いについて";
  817.             $tmpArray['company/law'] = "ユニフォームタウンの特定商取引法に基づく通販の表記ページです。";
  818.             $tmpArray['company/access'] = "ユニフォームタウンのショップ・アクセスへのページです。";
  819.             $tmpArray['company/china-factory'] = "ランドマークの中国工場";
  820.             $tmpArray['mail/backnumber'] = "バックナンバー";
  821.             $tmpArray['company/link'] = "ユニフォームタウンの相互リンク";
  822.             $tmpArray['company/link-detail'] = "相互リンク";
  823.             $tmpArray['company/link-form'] = "相互リンクお申し込みフォーム";
  824.             $tmpArray['company/idea'] = "ご意見・ご要望をお聞かせください";
  825.             $tmpArray['company/recruit'] = "ユニフォームタウンの求人情報のページです。";
  826.             $tmpArray['company/dictionary'] = "ユニフォームタウンの用語集のページです。";
  827.             $strArray $tmpArray;
  828.             foreach ($tmpArray as $key => $value) {
  829.                 $tmpAry preg_split("(\/)"$key);
  830.                 if ($urlStr == $key) {
  831.                     $h1_comment $strArray[$key];
  832.                 } elseif (strstr($urlStr"print") and $tmpAry[0] == "print") {
  833.                     $h1_comment $strArray[$key];
  834.                 } elseif (strstr($urlStr"guide") and $tmpAry[0] == "guide") {
  835.                     $h1_comment $strArray[$key];
  836.                 } elseif (strstr($urlStr"sample-order") and $tmpAry[0] == "sample-order") {
  837.                     $h1_comment $strArray[$key];
  838.                 } elseif ($urlStr == $tmpAry[0] and $h1_comment == "") {
  839.                     $h1_comment $strArray[$key];
  840.                 }
  841.             }
  842. //            $obj->closeConnection($db);
  843.         }
  844.         if (trim($h1_comment) == "") {
  845.             if (in_array($urlStr, ['shopping''shopping/confirm''shopping/checkout''shopping/complete''shopping/error'])) {
  846.                 $route str_replace('/''_'$urlStr);
  847.                 $page $this->pageRepository->getPageByRoute($route);
  848.                 $h1_comment "{$this->baseInfo->getShopName()}{$page->getName()}";
  849.             } else {
  850.                 $h1_comment "ユニフォームのプリント専門店 UniformTownへようこそ";
  851.             }
  852.         }
  853.         return $h1_comment;
  854.     }
  855.     public function get_carts_total_quantity()
  856.     {
  857.         if ($this->cartService->getCartType() == CartServiceCustomize::CartTypeCatalog) {
  858.             $catalogOrderList $this->commonService->GetLmOrderOption(CommonService::Lm_Option_Catalog);
  859.             $totalQuantity is_array($catalogOrderList) ? count($catalogOrderList) : 0;
  860.         } else {
  861.             $Carts $this->cartService->getCarts();
  862.             $totalQuantity array_reduce($Carts, function ($total$Cart) {
  863.                 $total += $Cart->getTotalQuantity();
  864.                 return $total;
  865.             }, 0);
  866.         }
  867.         return $totalQuantity;
  868.     }
  869.     function build_custom_menu($menu_list$is_top false)
  870.     {
  871.         if (empty($menu_list)) return '';
  872.         foreach ($menu_list as $menu) {
  873.             echo '<li class="menu-item ' . (($is_top && !empty($menu->children)) ? ' category-menu ' '') . ((!empty($menu->children)) ? ' has-child ' '') . '">';
  874.             if (empty($menu->children) && !empty($menu->url)) {
  875.                 echo '<a href="' htmlentities($menu->url) . '"><span>' htmlentities($menu->label) . '</span></a>';
  876.             } else {
  877.                 echo '<a><span>' htmlentities($menu->label) . '</span></a>';
  878.             }
  879.             if (!empty($menu->children)) {
  880.                 echo '<ul class="category-list">';
  881.                 echo $this->build_custom_menu($menu->children);
  882.                 echo '</ul>';
  883.             }
  884.             echo '</li>';
  885.         }
  886.     }
  887.     private function slide_panel_menu($custom_menu$recentviews$other_category_path_map = [])
  888.     {
  889.         if (empty($recentviews)) {
  890.             $cookies $this->RecentGoodsService->getRecentView();
  891.             $recentviews = !empty($cookies) ? $this->RecentGoodsService->LM_getRecentViews2($cookies) : array();
  892.         }
  893.         //
  894.         if (empty($other_category_path_map)) {
  895.             $other_category_path_map $this->getDefaultSpOtherCategoryPulldownMap();
  896.         }
  897.         $CFIMG_DOMAIN "img0.land-mark.biz";
  898.         $user $this->security->getUser();
  899.         echo '<style>
  900.         #recentviews .recentviews-item * {
  901.             max-width: none;
  902.         }
  903.         </style>';
  904.         echo '<div class="slide-panel-wrapper" data-slide-type="menu" style="display: none;">
  905.     <div id="slide-panel-menu" class="slide-panel">
  906.                 <ul>
  907.                     <li class="customer-info">
  908.                         <span class="youkoso">ようこそ</span><span class="customer_user_name">' . (isset($user) ? $user->getFullName() : 'ゲスト') . '</span><span class="san">さん</span>
  909.           </li>';
  910.         if (empty($custom_menu)) {
  911.             echo '<li class="menu-item menu-item-label">
  912.               <span>カテゴリーから探す</span>
  913.             </li>';
  914.             foreach ($other_category_path_map as $type => $type_data) {
  915.                 echo '<li class="menu-item category-menu has-child">';
  916.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  917.                 if (!empty($type_data['map'])) {
  918.                     echo '<ul class="category-list">';
  919.                     foreach ($type_data['map'] as $path => $label) {
  920.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  921.                     }
  922.                     echo '</ul>';
  923.                 }
  924.                 echo '</li>';
  925.             }
  926.         } else {
  927.             echo '<li class="menu-item menu-item-label">
  928.         <span>カテゴリーから探す</span>
  929.       </li>';
  930.             echo $this->build_custom_menu($custom_menutrue);
  931.         }
  932.         if (isset($user)) {
  933.             echo '<li class="menu-item"><a href="/mypage/"><span>マイページ</span></a></li>
  934.                     <li class="menu-item"><a href="/logout/"><span>ログアウト</span></a></li>';
  935.         } else {
  936.             echo '<li class="menu-item"><a href="/mypage/login/"><span>ログイン</span></a></li>
  937.                     <li class="menu-item"><a href="/regi/"><span>新規会員登録</span></a></li>';
  938.         }
  939.         $cartCount $this->get_carts_total_quantity();
  940.         echo '<li class="menu-item"><a href="/cart/" data-ajax="false"><span>カートの商品(<b>' number_format($cartCount) . '</b>点)を見る</span></a></li>
  941.                     <li class="menu-item recentviews-menu has-child opened">
  942.                         <a><span>閲覧履歴</span></a>
  943.                         <div class="recentviews ajax" style="margin-top:10px;">';
  944.         echo '<div id="recentviews" style="overflow: hidden; margin: 0;">
  945.     <div style="margin-left: 0;display:flex;overflow-x:scroll;-webkit-overflow-scrolling: touch;">';
  946.         foreach ($recentviews as $item) {
  947.             echo '<div class="recentviews-item" style="width: 105px; float: left;margin: 0 6px;margin-bottom: 15px;">
  948.           <div>
  949.             <a href="/item/' $this->displayText($item['item_id']) . '.html"><img class="recommend-images" style="height: auto; display: inline-block; border: 1px solid rgb(204, 204, 204); padding: 0; width: 105px;" src="' $this->makeImageURL("goods.img"$item['id']) . '" border="0" name="" alt="' $this->displayText($item['goods_name']) . '"></a>
  950.           </div>
  951.           <div style="margin-top: 5px; font-size: 11px;line-height:1.3em;">
  952.             <a href="/item/' $this->displayText($item['item_id']) . '.html">' $this->displayText($item['goods_name']) . '</a>
  953.           </div>
  954.           <div style="font-size: 11px; color: #666;">
  955.           <span class="recent_item_price">' number_format($item['min_gp_price']) . '円(税込)</span> ~ ' .
  956.           ((isset($item['review']) && $item['review'] > 0) ? ('<div class="recommend-average">' $item['average_img'] . '<span class="recommend-average-bracket">(</span><span class="recommend-average-point">' number_format($item['review']) . '</span><span class="recommend-average-bracket">)</span></div>') : '') . '</div></div>';
  957.         }
  958.         echo '</div></div>';
  959.         echo '</div>
  960.                     </li>
  961.                     <li class="menu-item"><a href="/mail/"><span>メール問合せ</span></a></li>
  962.                     <li class="menu-item"><a href="/cart/add_catalog"><span>カタログ請求する</span></a></li>
  963.                     <li class="menu-item menu-item-label"><span>ご案内</span></li>
  964.                     <li class="menu-item"><a href="/sp/pages/guide/"><span>初めての方へ</span></a></li>
  965.                     <li class="menu-item"><a href="/sp/pages/order/"><span>ご注文方法</span></a></li>
  966.                     <li class="menu-item"><a href="/guide/print-shurui/"><span>プリント・刺繍について</span></a></li>
  967.                     <li class="menu-item"><a href="/sp/pages/pay/"><span>お支払い方法</span></a></li>
  968.                     <li class="menu-item"><a href="/sp/pages/souryou/"><span>送料</span></a></li>
  969.                     <li class="menu-item"><a href="/sp/pages/nouki/" data-ajax="false"><span>納期</span></a></li>
  970.                     <li class="menu-item"><a href="/sp/pages/sample/" data-ajax="false"><span>貸出サンプル</span></a></li>
  971.                     <li class="menu-item"><a href="/sp/pages/oguchi/" data-ajax="false"><span>大口割引</span></a></li>
  972.                     <li class="menu-item"><a href="/sp/pages/henpin/" data-ajax="false"><span>返品・交換</span></a></li>
  973.                     <li class="menu-item"><a href="/sp/pages/faq/" data-ajax="false"><span>よくあるご質問</span></a></li>
  974.                     <li class="menu-item"><a href="/sp/pages/company_profile/" data-ajax="false"><span>会社概要</span></a></li>
  975.                     <li class="menu-item"><a href="/sp/pages/syozaiti/" data-ajax="false"><span>会社所在地</span></a></li>
  976.                     <li class="menu-item menu-footer-tel">
  977.                         <a href="tel:0120115116">
  978.                             <div class="tel-number"><img class="tel-icon" src="https://img0.land-mark.biz/ut_img/public_images/sp/icon_tel.svg" alt="電話"><span>0120-115-116</span></div>
  979.                             <div class="bussines-hour">(平日 9:00〜18:00)</div>
  980.                         </a>
  981.           </li>
  982.           <li class="menu-footer">
  983.                         <ul class="menu-footer-sns">
  984.                             <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  985.                             <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  986.                             <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  987.                             <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  988.                         </ul>
  989.                         <button type="button">✕ メニューを閉じる</button>
  990.                     </li>
  991.                 </ul>
  992.             </div>
  993.         </div>';
  994.     }
  995.     private function slide_panel_search($data$custom_frequently_searched_word$custom_menu$other_category_path_map$recentviews)
  996.     {
  997.         $CFIMG_DOMAIN "img0.land-mark.biz";
  998.         echo '<style>
  999.         .searchpop_result {
  1000.             overflow: hidden;
  1001.             width: 100%;
  1002.             text-align: left;
  1003.         }
  1004.         .searchpop_result_thumb {
  1005.             float: left;
  1006.             width: 90px;
  1007.             height: 83px;
  1008.             padding-top: 7px;
  1009.         }
  1010.         .searchpop_result_description p {
  1011.             line-height: 1.5;
  1012.         }
  1013.         .searchpop_result_description_goodsName {
  1014.             font-weight: bold;
  1015.             font-size: 14px;
  1016.             padding-top: 1px;
  1017.             margin-bottom: 3px !important;
  1018.             height: 18px;
  1019.             overflow: hidden;
  1020.         }
  1021.         .searchpop_result_description_goodsDetail {
  1022.             overflow: hidden;
  1023.             height: 1.5rem;
  1024.         }
  1025.     </style>';
  1026.         echo '<div class="slide-panel-wrapper" data-slide-type="search" style="display: none;">
  1027.       <div id="slide-panel-search" class="slide-panel">
  1028.         <ul>
  1029.           <li class="search-header">
  1030.             <span>詳細検索</span>
  1031.           </li>
  1032.           <li id="search-area" class="menu-item">
  1033.             <div id="search-area-search">
  1034.               <form method="get" action="/item/searchlist" method="get" accept-charset="UTF-8" id="search_form">
  1035.                 <input type="hidden" name="hantei" value="検索" />
  1036.                 <div>
  1037.                   <div id="search-word-input-wrapper">
  1038.                     <div id="search-word-input-area">
  1039.                       <input class="searchpop" id="search_string" name="searchtext" type="text" placeholder="商品名・品番で検索" value="" autocomplete="off">
  1040.                     </div>
  1041.                     <div><button id="search-button-on-slide-menu"><i class="material-icons">search</i></button></div>
  1042.                   </div>
  1043.                 </div>
  1044.               </form>
  1045.             </div>';
  1046.             //$this->displayText($data['searchtext']);
  1047.             if (!empty($custom_frequently_searched_word)) {
  1048.             echo '<div id="search-area-frequently-searched-words">
  1049.               <span>▼よく検索されているワード</span>
  1050.               <ul class="word-list">';
  1051.             foreach ($custom_frequently_searched_word as $search_word) {
  1052.                 echo '<li><a href="' $this->displayText($search_word->url) . '">' $this->displayText($search_word->label) . '</a></li>';
  1053.             }
  1054.             echo '</ul></div>';
  1055.         }
  1056.         echo '</li>';
  1057.         if (empty($custom_menu)) {
  1058.             echo '<li class="menu-item menu-item-label">
  1059.               <span>カテゴリーから探す</span>
  1060.             </li>';
  1061.             foreach ($other_category_path_map as $type => $type_data) {
  1062.                 echo '<li class="menu-item category-menu has-child">';
  1063.                 echo '<a><span>' $this->displayText($type_data['group_label']) . '</span></a>';
  1064.                 if (!empty($type_data['map'])) {
  1065.                     echo '<ul class="category-list">';
  1066.                     foreach ($type_data['map'] as $path => $label) {
  1067.                         echo '<li class="menu-item"><a href="' LmHelper::display_form_text($path) . '"><span>' $this->displayText($label) . '</span></a></li>';
  1068.                     }
  1069.                     echo '</ul>';
  1070.                 }
  1071.                 echo '</li>';
  1072.             }
  1073.         } else {
  1074.             echo '<li class="menu-item menu-item-label">
  1075.         <span>カテゴリーから探す</span>
  1076.       </li>';
  1077.             echo $this->build_custom_menu($custom_menutrue);
  1078.         }
  1079.         echo '<li class="menu-footer">
  1080.             <ul class="menu-footer-sns">
  1081.               <li class="tw"><a href="https://twitter.com/uniformtown" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_tw.svg);"></a></li>
  1082.               <li class="instagram"><a href="https://www.instagram.com/uniformtown/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_instagram.svg);"></a></li>
  1083.               <li class="fb"><a href="https://www.facebook.com/uniformtown91/" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_fb.svg);"></a></li>
  1084.               <li class="youtube"><a href="https://www.youtube.com/channel/UCkSwlrLc4G-y_35KddreLxQ" target="_blank" style="background-image: url(https://' $CFIMG_DOMAIN '/ut_img/public_images/sp/icon_youtube.svg);"></a></li>
  1085.             </ul>
  1086.             <button type="button">✕ メニューを閉じる</button>
  1087.           </li>
  1088.         </ul>
  1089.       </div>
  1090.     </div>';
  1091.     }
  1092.     function makeImageURL($folder$id)
  1093.     {
  1094.         $filename substr($id, -11) . "/" $id "/main.jpg";
  1095.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1096.         $t $filename;
  1097.         $url "https://" $CFIMG_DOMAIN "/";
  1098.         $ret $url $folder "/" $filename;
  1099.         return $ret;
  1100.     }
  1101.     function display_form_text($text)
  1102.     {
  1103.         // //return stripslashes( htmlspecialchars($text,ENT_QUOTES) ); 20100609
  1104.         //return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  1105.         return LmHelper::display_form_text($text);
  1106.     }
  1107.     function sashikomi($srcHtml$vw 805)
  1108.     {
  1109.         $dstHtml $srcHtml;
  1110.         // 画像の処理
  1111.         $dstHtml $this->LM_sashikomi($dstHtml);
  1112.         /*
  1113.         $dstHtml = preg_replace('@(<img[^>]+?src="('.CFIMG_URL.'public_images)/([^\'">\s]+)\.([^\.\'">\s]+)"[\s\S]*?>)@', '<picture><source media="(max-width: 320px)" type="image/webp" srcset="$2_320/$3.webp"><source media="(max-width: 640px)" type="image/webp" srcset="$2_640/$3.webp"><source media="(max-width: 320px)" srcset="$2_320/$3.$4"><source media="(max-width: 640px)" srcset="$2_640/$3.$4"><source type="image/webp" srcset="$2/$3.webp">$1</picture>', $dstHtml);
  1114.         */
  1115.         // スタイルタグの削除
  1116.         $dstHtml preg_replace_callback('/<style[\s\S]+?\/style>/', function ($matches) {
  1117.             if (preg_match('/<style[^>]+responsive/'$matches[0])) {
  1118.                 return $matches[0];
  1119.             } else {
  1120.                 return '';
  1121.             }
  1122.         }, $dstHtml);
  1123.         // 特定のインラインスタイルを削除
  1124.         // $dstHtml = preg_replace('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size)\s*:[^;]+;/', '', $dstHtml);
  1125.         // $dstHtml = preg_replace('/(style="[^">]*)(?:width)\s*:[^;]+;/', '$1', $dstHtml);
  1126.         // $dstHtml = preg_replace('/(style="[^">]*)(?:height)\s*:[^;]+;/', '$1', $dstHtml);
  1127.         // インラインスタイルでのpx指定は calc() に置換し、デバイスの画面幅を基準に計算させる
  1128.         $dstHtml preg_replace_callback('/\s*(?:(?:margin|padding)(?:-(?:top|left|bottom|right))?|font-size|top|left|bottom|right)\s*:[^;]+;/', function ($matches) use ($vw) {
  1129.             $dst $src $matches[0];
  1130.             $dst preg_replace('/-[0-9.]+px/'"0"$dst);
  1131.             $dst preg_replace('/([0-9.]+)px/'"calc($1 * (100vw / {$vw}))"$dst);
  1132.             return $dst;
  1133.         }, $dstHtml);
  1134.         $dstHtml preg_replace_callback('/(style="[^">]*)(?:width|height)\s*:[^;]+;/', function ($matches) use ($vw) {
  1135.             return preg_replace('/(width|height)[:\s]+([0-9.-]+)px/'"$1: calc($2 * (100vw / {$vw}))"$matches[0]);
  1136.         }, $dstHtml);
  1137.         // 特定の属性を削除
  1138.         $dstHtml preg_replace('/ width="?[^"\s>]+"?/'''$dstHtml);
  1139.         $dstHtml preg_replace('/ height="?[^"\s>]+"?/'''$dstHtml);
  1140.         // インライン要素間の余白を詰める
  1141.         $dstHtml preg_replace('/(\/a>)[\s]+?(<a)/''$1$2'$dstHtml);
  1142.         // 試しに<br>をSPでも出力してみる
  1143.         // // <br>はSPでは不要
  1144.         // if (!preg_match('@^/sp/owabi/@', $_SERVER['REQUEST_URI'])) // SPのお詫びページのみ<br>を削除せず
  1145.         // $dstHtml = preg_replace('/((?:\s*<br(?:[\s\/]*?)>)+)/', '', $dstHtml);
  1146.         //縮小画像取得エラー時のjsイベント処理
  1147.         $dstHtml preg_replace('/(\<img)[\s]+/''$1 onerror="replaceImg(this)"'$dstHtml);
  1148.         //
  1149.         $dstHtml $this->goodsPriceService->embedGoodsPrice($dstHtml);
  1150.         echo $dstHtml;
  1151.     }
  1152.     public function display_item_pulldown()
  1153.     {
  1154.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1155.         $display_item_count_list $this->commonService->GetYaml('DisplayItem.yaml');
  1156.         /**
  1157.          * 表示件数プルダウン
  1158.          */
  1159.         $order_type_param = isset($_GET['type']) ? 'type=' . (int)$_GET['type'] . '&' '';
  1160.         $display_count_pulldown = array(
  1161.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW'], 'selected' => false),
  1162.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM'] . '件''link' => $base_link "/?{$order_type_param}disp=" self::DISPLAY_ITEM_COUNT_MID'selected' => false),
  1163.             (object)array('count' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'label' => $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'] . '件''link' => $base_link "/?{$order_type_param}disp=" $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH'], 'selected' => false),
  1164.         );
  1165.         // 表示件数プルダウン選択処理
  1166.         if (isset($_SESSION['display_max'])) {
  1167.             switch ((int)$_SESSION['display_max']) {
  1168.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1169.                     $display_count_pulldown[0]->selected true;
  1170.                     break;
  1171.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1172.                     $display_count_pulldown[1]->selected true;
  1173.                     break;
  1174.                 case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1175.                     $display_count_pulldown[2]->selected true;
  1176.                     break;
  1177.                 default:
  1178.                     $display_count_pulldown[1]->selected true;
  1179.                     break;
  1180.             }
  1181.         } else {
  1182.             if (isset($_GET['disp'])) {
  1183.                 switch ((int)$_GET['disp']) {
  1184.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['LOW']:
  1185.                         $display_count_pulldown[0]->selected true;
  1186.                         break;
  1187.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['MEDIUM']:
  1188.                         $display_count_pulldown[1]->selected true;
  1189.                         break;
  1190.                     case $display_item_count_list['DISPLAY_ITEM_COUNT']['HIGH']:
  1191.                         $display_count_pulldown[2]->selected true;
  1192.                         break;
  1193.                     default:
  1194.                         $display_count_pulldown[1]->selected true;
  1195.                         break;
  1196.                 }
  1197.             } else {
  1198.                 foreach ($display_count_pulldown as $option) {
  1199.                     if ($option->count === $display_item_count_list['DISPLAY_ITEM_COUNT_DEFAULT']) $option->selected true;
  1200.                 }
  1201.             }
  1202.         }
  1203.         return $display_count_pulldown;
  1204.     }
  1205.     public function display_order_pulldown($useRecommendedItemOrder)
  1206.     {
  1207.         $base_link preg_replace('!/*(?:\?.+)?$!'''$_SERVER['REQUEST_URI']);
  1208.         $display_order_list $this->commonService->GetYaml('DisplayOrder.yaml')['DISPLAY_ORDER_ITEM'];
  1209.         /**
  1210.          * 表示順プルダウン
  1211.          */
  1212.         $display_count_param = isset($_GET['disp']) ? '&disp=' . (int)$_GET['disp'] : '';
  1213.         $display_order_pulldown = array(
  1214.             (object)array('label' => $display_order_list[0], 'link' => $base_link '/?type=6' $display_count_param'selected' => false),
  1215.             (object)array('label' => $display_order_list[1], 'link' => $base_link '/?type=0' $display_count_param'selected' => false),
  1216.             (object)array('label' => $display_order_list[2], 'link' => $base_link '/?type=5' $display_count_param'selected' => false),
  1217.             (object)array('label' => $display_order_list[3], 'link' => $base_link '/?type=1' $display_count_param'selected' => false),
  1218.             (object)array('label' => $display_order_list[4], 'link' => $base_link '/?type=3' $display_count_param'selected' => false),
  1219.         );
  1220.         // 表示順プルダウン選択処理
  1221.         //$order_param = '';
  1222.         if (isset($_SESSION['order_type'])) {
  1223.             switch ((int)$_SESSION['order_type']) {
  1224.                 case 0:
  1225.                     $display_order_pulldown[1]->selected true;
  1226.                     break;
  1227.                 case 1:
  1228.                     $display_order_pulldown[3]->selected true;
  1229.                     break;
  1230.                 case 3:
  1231.                     $display_order_pulldown[4]->selected true;
  1232.                     break;
  1233.                 case 5:
  1234.                     $display_order_pulldown[2]->selected true;
  1235.                     break;
  1236.                 case 6:
  1237.                     $display_order_pulldown[0]->selected true;
  1238.                     break;
  1239.                 default:
  1240.                     break;
  1241.             }
  1242.         } else {
  1243.             if (isset($_GET['type'])) {
  1244.                 switch ((int)$_GET['type']) {
  1245.                     case 0:
  1246.                         $display_order_pulldown[1]->selected true;
  1247.                         break;
  1248.                     case 1:
  1249.                         $display_order_pulldown[3]->selected true;
  1250.                         break;
  1251.                     case 3:
  1252.                         $display_order_pulldown[4]->selected true;
  1253.                         break;
  1254.                     case 5:
  1255.                         $display_order_pulldown[2]->selected true;
  1256.                         break;
  1257.                     case 6:
  1258.                         $display_order_pulldown[0]->selected true;
  1259.                         break;
  1260.                     default:
  1261.                         break;
  1262.                 }
  1263.             }
  1264.         }
  1265.         // おすすめ順が無効なときはプルダウンから外す
  1266.         if (!$useRecommendedItemOrderarray_shift($display_order_pulldown);
  1267.         return $display_order_pulldown;
  1268.     }
  1269.     public function getSessionData()
  1270.     {
  1271.         return $_SESSION;
  1272.     }
  1273.     /**
  1274.      * @param GoodsWithRelated $goods
  1275.      * @return string
  1276.      */
  1277.     public function renderGoodsLabelList(GoodsWithRelated $goods)
  1278.     {
  1279.         //
  1280.         $labelList $goods->getLabelList();
  1281.         //
  1282.         return $this->twig->render('Item/Parts/goods_label_list.twig', [
  1283.             'labelList' => $labelList,
  1284.         ]);
  1285.     }
  1286.     public function renderProductItem($item_data$useCache$average$col_count$vendingStatusMap = [])
  1287.     {
  1288.         // TODO: CFIMG_URL, BACKIMG_URLの変更
  1289.         $CFIMG_URL 'https://img0.land-mark.biz/ut_img/';
  1290.         $CATEGORY_LIST_ICON_ID_NO_SHOW 0;        // アイコンなし
  1291.         $CATEGORY_LIST_ICON_ID_SS 1;        // 春夏
  1292.         $CATEGORY_LIST_ICON_ID_AW 2;        // 秋冬
  1293.         $CATEGORY_LIST_ICON_ID_ALL 3;        // 通年
  1294.         $CATEGORY_LIST_ICON_ID_BOUKAN 4;        // 防寒
  1295.         // ジェンダーマップ
  1296.         $GENDER_ICON_MAP = array(
  1297.             => array('label' => '男性用''class' => 'goods-icon-male'),
  1298.             => array('label' => '女性用''class' => 'goods-icon-female'),
  1299.             => array('label' => '男女兼用''class' => 'goods-icon-unisex'),
  1300.             => array('label' => '子供用''class' => 'goods-icon-kids')
  1301.         );
  1302.         // アイコンマップ
  1303.         $CATEGORY_LIST_ICON_MAP = array(
  1304.             $CATEGORY_LIST_ICON_ID_SS => array('label' => '春夏''class' => 'goods-icon-ss'),
  1305.             $CATEGORY_LIST_ICON_ID_AW => array('label' => '秋冬''class' => 'goods-icon-aw'),
  1306.             $CATEGORY_LIST_ICON_ID_ALL => array('label' => '通年''class' => 'goods-icon-all'),
  1307.             $CATEGORY_LIST_ICON_ID_BOUKAN => array('label' => '防寒''class' => 'goods-icon-boukan')
  1308.         );
  1309.         $color_tip_max 30;
  1310.         $color_tip_break_at $color_tip_max 2;
  1311.         // アイコン
  1312.         if (
  1313.             (int)$item_data['goods_target_gender'] !== ||
  1314.             // (int)$item_data['color_count'] !== 0 ||
  1315.             (int)$item_data['goods_category_list_icon_id'] !== $CATEGORY_LIST_ICON_ID_NO_SHOW
  1316.         ) {
  1317.             echo '<div class="goods-icon-wrapper"><ul>';
  1318.             if (isset($GENDER_ICON_MAP[$item_data['goods_target_gender']])) {
  1319.                 echo '<li class="' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['class'] . '">' $GENDER_ICON_MAP[$item_data['goods_target_gender']]['label'] . '</li>';
  1320.             }
  1321.            if ((int)$item_data['color_count'] !== 0) {
  1322.                echo '<li class="goods-icon goods-icon-color">' $item_data['color_count'] . '色</li>';
  1323.            }
  1324.             if (isset($CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']])) {
  1325.                 echo '<li class="' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['class'] . '">' $CATEGORY_LIST_ICON_MAP[$item_data['goods_category_list_icon_id']]['label'] . '</li>';
  1326.             }
  1327.             echo '</ul></div>';
  1328.         }
  1329.         // // カラーチップ
  1330.         echo '<div class="item-color-tip"><ul>';
  1331.         foreach ($item_data['color_list'] as $color_idx => $rgb) {
  1332.             if ($color_idx === $color_tip_max) break;
  1333.             if ($color_idx !== && ($color_idx) % $color_tip_break_at === 0) {
  1334.                 echo '</ul><ul>';
  1335.             }
  1336.             echo '<li style="background-color: ' $rgb ';"></li>';
  1337.         }
  1338.         echo '</ul></div>';
  1339.         $goods_name_with_vending_status $this->getGoodsNameWithVendingStatusTo($item_data$vendingStatusMap);
  1340.         echo '<div class="gcont2"><div class="gname cat-list"><h3>';
  1341.         echo $this->displayText(!empty($goods_name_with_vending_status) ? $goods_name_with_vending_status $item_data['goods_name']);
  1342.         echo '<span>&nbsp;</span></h3></div>';
  1343.         echo '<div class="item-info">
  1344.                     <table>
  1345.                         <tr class="item-info-kataban">
  1346.                             <th><span>商品番号:</span></th><td><span>' $this->displayText($item_data['kataban']) . '</span></td>
  1347.                         </tr>';
  1348. //var_dump($item_data);
  1349. //        if (!$useCache) {
  1350.         if ($item_data['teika']) {
  1351.             echo '<tr class="item-info-list-price">
  1352.                             <th><span>定価:</span></th>';
  1353.             echo '<td><span>' number_format($item_data['teika']) . '</span><span>円 (税込)</span></td>';
  1354.             echo '</tr>';
  1355.         } else  {
  1356.             echo '<tr class="item-info-list-price">
  1357.                             <th></th>';
  1358.             echo '<td></td>';
  1359.             echo '</tr>';
  1360.         }
  1361.             echo '            <tr class="item-info-price">
  1362.                             <th><span>売価:</span></th>
  1363.                             <td><span style="font-size:24px;">' number_format($item_data['price']*1.10) . '</span><span>円(税込)</span></td></tr>';
  1364. /*        } else {
  1365.             echo '<tr class="item-info-list-price">
  1366.                             <th><span>定価:</span></th>
  1367.                             <td><span class="gprice_teika fbt-lazy"></span></td>
  1368.                         </tr>
  1369.                         <tr class="item-info-price">
  1370.                             <th><span>売価:</span></th>
  1371.                             <td><span class="gprice fbt-lazy price"></span><span class="yen_txt">円 (税込)</span></td>
  1372.                         </tr>';
  1373.         }*/
  1374.         echo '</table></div>';
  1375.         echo '<div class="gtest">';
  1376.         if (!empty($item_data['average'])) {
  1377.             $average_for_image = (int)($item_data['average'] * 2) / 2;
  1378.             echo '<div class="item-review-star">
  1379.         <img alt="お客様からの口コミレビュー評価の星の数' $average_for_image '" src="' $CFIMG_URL 'public_images/review/star_m' . ($average_for_image 10) . '.gif"><span class="item-review-star-average"></span><span class="item-review-star-review-count">(' $item_data['review_count'] . '<span class="item-review-star-review-count-unit"></span>)</span>
  1380.       </div>';
  1381.         }
  1382.         if ($item_data['goods_caption'] != "") {
  1383.             echo '<p class="item-caption">' mb_eregi_replace(" """$item_data['goods_caption']) . '<span>&nbsp;</span></p>';
  1384.         }
  1385.         echo '</div><!-- /.gtest -->';
  1386.         echo '</div>';
  1387.     }
  1388.     public function getGoodsNameWithVendingStatusTo($goods_data$vendingStatusMap)
  1389.     {
  1390.         if (!isset($goods_data['goods_id']) || !isset($goods_data['goods_name'])) return null;
  1391.         $VENDING_STATUS_MAP $vendingStatusMap;
  1392.         $GOODS_VENDING_STATUS_IS_VENDING 1;    // 販売中
  1393.         $GOODS_VENDING_STATUS_IS_SOLD_OUT 2;    // 完売
  1394.         $GOODS_VENDING_STATUS_IS_DISCONTINUED 3;    // 廃番
  1395.         $GOODS_VENDING_STATUS_EXCLUDE_MANUFACTURER_STOCK 4// メーカー在庫連携除外(バートルのみ対応)
  1396.         $GOODS_VENDING_STATUS_LABEL_MAP = [
  1397.             $GOODS_VENDING_STATUS_IS_VENDING => '販売継続中',
  1398.             $GOODS_VENDING_STATUS_IS_SOLD_OUT => '完売',
  1399.             $GOODS_VENDING_STATUS_IS_DISCONTINUED => '廃番',
  1400.             $GOODS_VENDING_STATUS_EXCLUDE_MANUFACTURER_STOCK => 'メーカー在庫連携除外(バートルのみ対応)'
  1401.         ];
  1402.         // キャッシュがなければ生成
  1403.         if (empty($VENDING_STATUS_MAP)) {
  1404.             //
  1405.             $rows $this->getGoodsVendingStatusListCache();
  1406.             //
  1407.             foreach ($rows as $row) {
  1408.                 $VENDING_STATUS_MAP[(int)$row['goods_id']] = (int)$row['goods_vending_status'];
  1409.             }
  1410.         }
  1411.         $vending_status $VENDING_STATUS_MAP[(int)$goods_data['goods_id']] ?? null;
  1412.         $prefix '';
  1413.         if (empty($vending_status)) {
  1414.             $createNewFlg true;
  1415.             $this->GoodsService->getGoodsVendingStatusMap($createNewFlg);
  1416.         }
  1417.         switch ($vending_status) {
  1418.             case $GOODS_VENDING_STATUS_IS_SOLD_OUT:
  1419.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_SOLD_OUT] . '] ';
  1420.                 break;
  1421.             case $GOODS_VENDING_STATUS_IS_DISCONTINUED:
  1422.                 $prefix '[' $GOODS_VENDING_STATUS_LABEL_MAP[$GOODS_VENDING_STATUS_IS_DISCONTINUED] . '] ';
  1423.                 break;
  1424.         }
  1425.         $goods_data['goods_name'] = $prefix $goods_data['goods_name'];
  1426.         if (isset($goods_data['goods_new_name'])) $goods_data['goods_new_name'] = $prefix $goods_data['goods_new_name'];
  1427.         return $goods_data['goods_name'];
  1428.     }
  1429.     public function getGoodsVendingStatusListCache()
  1430.     {
  1431.         if (file_exists($filename 'files/goods/goods_vending_status_list.json')) {
  1432.             $json file_get_contents($filename);
  1433.             $goodsVendingStatusList json_decode($json);
  1434.         } else {
  1435.             $goodsVendingStatusList $this->dynamicConverter->getGoodsVendingStatusList();
  1436.         }
  1437.         return $goodsVendingStatusList;
  1438.     }
  1439.     function lm_category_filter($mcName$categoryData$data$items$subCategoryList$canonicalSubCategoryList$leftmenuForCategoryData$canonicalMcName$ctName)
  1440.     {
  1441.         $BACK_URL $this->eccubeConfig['BACK_URL'];
  1442. //        if ($categoryData == null) {
  1443. //            $data = $data;
  1444. //        } else {
  1445. //            // TODO: とりあえずコメントアウト
  1446. //             $data = $categoryData['main_category'];
  1447. //            return null;
  1448. //        }
  1449.         // SEO用のキーワード設定
  1450. //        if (in_array($data['main_category_name'], array("作業服・作業着", "作業服バートル", "医療白衣", "エプロン", "防寒服", "スタッフジャンパー", "メディカルウェア", "エステユニフォーム"))) {
  1451. //            $seoKeyword = "";
  1452. //        } else {
  1453. //            $seoKeyword = $data['main_category_name'] . " ";
  1454. //        }
  1455.         for ($i 1$i <= count($items); $i++) {
  1456.             $anImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['image']));
  1457.             $goodsImgUrl $this->displayText(str_replace(array('backoffice/''main_bsum'), array($BACK_URL'main_45x45'), $items[$i 1]['goods_image']));
  1458.             if ($items[$i 1]['category_id'] != "coordinate" and $items[$i 1]['category_id'] != "allitem") {
  1459.                 if (isset($leftmenuForCategoryData[$items[$i 1]['category_id']])) {
  1460.                     echo "<li class=\"sepa\">{$leftmenuForCategoryData[$items[$i 1]['category_id']]['category_name']}</li><br>";
  1461.                 }
  1462.                 if (!empty($subCategoryList[$items[$i 1]['category_id']])) {
  1463.                     if ($ctName === $subCategoryList[$items[$i 1]['category_id']]['category_webname']) {
  1464.                         echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;">';
  1465.                         echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1466.                         echo "</li>";
  1467.                     } else {
  1468.                         if (!empty($subCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1469.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $subCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1470.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1471.                             echo "</a></li>";
  1472.                         } elseif (!empty($canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'])) {
  1473.                             echo '<li style="height: 50x !important; padding: 5px; overflow: hidden;float:none;display:inline-block;vertical-align:top;"><a href="/' $canonicalMcName "/" $canonicalSubCategoryList[$items[$i 1]['category_id']]['category_webname'] . '/">';
  1474.                             echo '<h3><img alt="カテゴリ" style="float: left; margin-right: 5px; vertical-align: middle;" width="32" height="32" onerror="this.src=\'' $goodsImgUrl '\'"  src="' $anImgUrl '" /><div style="width: 70%; float: left;">' $this->displayText(str_replace(" """$items[$i 1]['category_name'])) . $this->displayText("(" $items[$i 1]['cnt'] . ")") . '</div></h3></a>';
  1475.                             echo "</a></li>";
  1476.                         }
  1477.                     }
  1478.                 }
  1479.             }
  1480.         }
  1481.     }
  1482.     public function custom_parse_url($value)
  1483.     {
  1484.         return parse_url($valuePHP_URL_QUERY);
  1485.     }
  1486.     public function echoImageURL($imgUrl)
  1487.     {
  1488.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1489.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1490.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1491.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1492.         //ドメインが「www.l-m.co.jp」 or 「images.l-m.co.jp」の場合
  1493.         if (strpos($imgUrl"images.l-m.co.jp") !== false or strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1494.             //ドメインが「www.l-m.co.jp」の場合
  1495.             if (strpos($imgUrl$IMG_HOST_NAME) !== false) {
  1496.                 //httpsの時、httpへ変換
  1497.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1498.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1499.                 } else {
  1500.                     //httpの時、「images.l-m.co.jp」へ変換
  1501.                     $newImgUrl str_replace($IMG_HOST_NAME"images.l-m.co.jp"$imgUrl);
  1502.                 }
  1503.                 //ドメインが「images.l-m.co.jp」の場合
  1504.             } elseif (strpos($imgUrl"images.l-m.co.jp") !== false) {
  1505.                 //httpsの時、httpへ変換
  1506.                 if (!((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == "on") or $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
  1507.                     $newImgUrl str_replace("https://""http://"$imgUrl);
  1508.                 } else {
  1509.                     $newImgUrl $imgUrl;
  1510.                 }
  1511.             }
  1512.             return $imgUrl;
  1513.         } else {
  1514.             $newImgUrl $imgUrl;
  1515.             //相対パスの場合
  1516.             if (strstr($imgUrl"images") !== false and strstr($imgUrl"public") === false) {
  1517.                 $strurl strstr($imgUrl"images");
  1518.                 $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""public_images"$strurl);
  1519.             }
  1520.             return $imgUrl;
  1521.         }
  1522.     }
  1523.     public function echoVirtualImages($imgUrl)
  1524.     {
  1525.         $IMG_HOST_NAME $this->eccubeConfig['IMG_HOST_NAME'];
  1526.         $CFIMG_DOMAIN $this->eccubeConfig['CFIMG_DOMAIN'];
  1527.         $CFIMG_URL $this->eccubeConfig['CFIMG_URL'];
  1528.         $imgUrl "{$CFIMG_URL}/{$imgUrl}";
  1529.         if (strstr($imgUrl"images") !== false and strstr($imgUrl"virtual_images") === false) {
  1530.             $strurl strstr($imgUrl"images");
  1531.             $imgUrl "https://" $CFIMG_DOMAIN "/ut_img/" str_replace("images""virtual_images"$strurl);
  1532.         }
  1533.         return $imgUrl;
  1534.     }
  1535.     public function get_updated_at()
  1536.     {
  1537.         $week_day_list = array('日''月''火''水''木''金''土');
  1538.         return sprintf('%s (%s)%d時%d分'date('Y年n月j日'), $week_day_list[date('w')], date('H'), date('i'));
  1539.     }
  1540.     public function LM_displaySashikomi_detailGoods($data$noEcho false)
  1541.     {
  1542.         if ($data['goods_top_sashikomi'] != "") {
  1543.             $sashikomi_top $this->replaceItemImageRoot($data['goods_top_sashikomi']);
  1544.             if ($noEcho) return $sashikomi_top;
  1545.             echo $sashikomi_top;
  1546.         } elseif ($data['goods_top_html'] != "") {
  1547.             if (file_exists("files/insert/" $data['goods_top_html'])) {
  1548.                 $file implode(""file("files/insert/" $data['goods_top_html']));
  1549.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1550.                 $tmp explode("<body>"$file);
  1551.                 if (count($tmp) > 1) {
  1552.                     $tmp explode("</body>"$tmp[1]);
  1553.                 } else {
  1554.                     $tmp explode("</body>"$tmp[0]);
  1555.                 }
  1556.                 $tmp $tmp[0];
  1557.                 $tmp $this->replaceItemImageRoot($tmp);
  1558.                 if ($noEcho) return "<div style='line-height:5px'></div>" $tmp;
  1559.                 echo "<div style='line-height:5px'></div>" $tmp;
  1560.             }
  1561.         }
  1562.         echo "";
  1563.     }
  1564.     function LM_insertFile($data)
  1565.     {
  1566.         if ($data['goods_bottom_sashikomi'] != "") {
  1567.             echo $this->replaceItemImageRoot($data['goods_bottom_sashikomi']);
  1568.         } elseif ($data['goods_html'] != "") {
  1569.             if (file_exists("files/insert/" $data['goods_html'])) {
  1570.                 $file implode(""file("files/insert/" $data['goods_html']));
  1571.                 $file str_replace("</BODY>""</body>"str_replace("<BODY>""<body>"$file));
  1572.                 $tmp explode("<body>"$file);
  1573.                 if (count($tmp) > 1) {
  1574.                     $tmp explode("</body>"$tmp[1]);
  1575.                 } else {
  1576.                     $tmp explode("</body>"$tmp[0]);
  1577.                 }
  1578.                 $tmp $tmp[0];
  1579.                 $tmp $this->replaceItemImageRoot($tmp);
  1580.                 echo $tmp;
  1581.             }
  1582.         }
  1583.     }
  1584.     public function createGetParamater($moji "?"$expect ""$and "&"$equal "=")
  1585.     {
  1586.         $getVar $_GET;
  1587.         $form "";
  1588.         $array explode(","$expect);
  1589.         while (!is_null($key key($getVar))) {
  1590.             if (!in_array($key$array)) {
  1591.                 if ($form != "") {
  1592.                     //$form .= $and . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1593.                     $form .= $and $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1594.                     urlencode($getVar[$key]);
  1595.                 } else {
  1596.                     //$form = $moji . $key . $equal . urlencode( LmHelper::display_form_text($getVar[$key]) ); 20110104 /の変換処理修正
  1597.                     $form $moji $key $equal str_replace("%2F""%252F"urlencode(LmHelper::display_form_text($getVar[$key])));
  1598.                 }
  1599.             }
  1600.             next($getVar);
  1601.         }
  1602.         return $form;
  1603.     }
  1604.     public function LM_displayTogetherBuyDetail_new3($id$is_secret true$count false)
  1605.     {
  1606.         $rs $this->dynamicConverter->getGoodsLinkSelect($id$is_secret$count);
  1607.         $result = array();
  1608.         if (isset($rs)) {
  1609.             foreach ($rs as $row) {
  1610.                 $goodsId $row['goods_id'];
  1611.                 $result[$goodsId] = $row;
  1612.                 $average $this->dynamicConverter->getReviewAverage($goodsId);
  1613.                 $average = (!empty($average[$row['goods_id']])) ? $average[$row['goods_id']] : 0;
  1614.                 $image_name = (int)($average 2) / 10;
  1615.                 $result[$goodsId]['average'] = $average;
  1616.                 $result[$goodsId]['average_img'] = "<img class=\"history-average-img\" alt=\"お客様からの口コミレビュー評価の星の数{$average}\" src=\"/images/review/star_m{$image_name}.gif\">";
  1617.                 //$tempRow = $this->dynamicConverter->getReview($id, $is_secret);
  1618.                 //$result[$goodsId]['review_count'] = count($tempRow);
  1619.                 $result[$goodsId]['img'] = $this->makeImageURL("goods.img"$goodsId);
  1620.             }
  1621.         }
  1622.         return $result;
  1623.     }
  1624.     /**
  1625.      * Use this instead of `include 'Common/hoge.twig'`.
  1626.      *
  1627.      * @param string $hoge
  1628.      * @param string|null $piyo
  1629.      * @return string
  1630.      * @throws \Twig\Error\LoaderError
  1631.      * @throws \Twig\Error\RuntimeError
  1632.      * @throws \Twig\Error\SyntaxError
  1633.      */
  1634.     function hoge(string $hogestring $piyo null)
  1635.     {
  1636.         //
  1637.         $route $this->request->get('_route');
  1638.         $url $this->request->getPathInfo();
  1639.         //
  1640.         $context compact('hoge''piyo''route''url');
  1641.         //
  1642.         return $this->twig->render('Common/hoge.twig'$context);
  1643.     }
  1644.     public function getCommonContentsMap()
  1645.     {
  1646.         $common_contents_map $this->dynamicConverter->getCommonContentsMap($this->eccubeConfig['CommonContents']['SITE_TYPE_UT'], $this->eccubeConfig['CommonContents']['DEVICE_TYPE_SP'], $this->eccubeConfig['CommonContents']['IS_NOT_SUPER_CATEGORY_ID']);
  1647.         $common_header_contents_all '';
  1648.         $common_header_contents '';
  1649.         $uri $_SERVER['REQUEST_URI'];
  1650.         $webname trim($uri'/');
  1651.         if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1652.             $common_header_contents_all $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_ALL']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1653.         }
  1654.         if ($uri == '/' && isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']])) {
  1655.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_TOP']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']];
  1656.         }
  1657.         else if (isset($common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname])) {
  1658.             $common_header_contents $common_contents_map[$this->eccubeConfig['CommonContents']['PAGE_TYPE_SUPER_CATEGORY']][$this->eccubeConfig['CommonContents']['POSITION_HEADER']][$webname];
  1659.         }
  1660.         return [
  1661.             'common_header_contents_all' => $common_header_contents_all,
  1662.             'common_header_contents' => $common_header_contents
  1663.         ];
  1664.     }
  1665.     public function getCalendarInfo()
  1666.     {
  1667.         $week_array explode(",""7,1,2,3,4,5,6");
  1668.         //現在月を判別
  1669.         $now_array explode("-"date("Y-m-d"));
  1670.         //翌月を表示する
  1671.         $now_array array_merge($now_arrayexplode("-"date("Y-m-d"mktime(000intval($now_array[1]) + 11intval($now_array[0])))));
  1672.         //当日日付
  1673.         $today date("Ymd");
  1674.         $meyasun_date 0;    //お届け日の目安フラグ
  1675.         $add 1;
  1676.         if (date("Hi") >= "1200") {
  1677.             $add 2;
  1678.         }
  1679.         $prefecture 0;
  1680.         $options "";
  1681.         //加工
  1682.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=1&area=0";
  1683.         $output file_get_contents($url);
  1684.         $obj json_decode($outputtrue);
  1685.         $date $obj['result'];
  1686.         $kakou_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1687.         //無地
  1688.         $url "https://www.l-m.co.jp/index/check-holiday?date=" date("Y-m-d") . "&add=" $add "&kakou=0&area=0";
  1689.         $output file_get_contents($url);
  1690.         $obj json_decode($outputtrue);
  1691.         $date $obj['result'];
  1692.         $muji_date substr($date04) . "-" ltrim(substr($date42), 0) . "-" ltrim(substr($date62), 0);
  1693.         return [
  1694.             'week_array' => $week_array,
  1695.             'now_array' => $now_array,
  1696.             'kakou_date' => $kakou_date,
  1697.             'muji_date' => $muji_date,
  1698.             'today' => $today
  1699.         ];
  1700.     }
  1701.     public function getHolidayInfo($year$month$day$week$count)
  1702.     {
  1703.         return $this->dynamicConverter->getHolidayInfo(intval($year), intval($month), intval($day), intval($week), intval($count));
  1704.     }
  1705.     /**
  1706.      * カート内の商品のIDを取得する
  1707.      * TODO: 現状、最初の1件のみを取得。
  1708.      *
  1709.      * @return int|void
  1710.      */
  1711.     protected function getGoodsIdFromCart()
  1712.     {
  1713.         //
  1714.         foreach ($this->cartService->getCarts() as $cart) {
  1715.             foreach ($cart->getCartItems() as $item) {
  1716.                 return $item->getProductClass()->getProduct()->getId();
  1717.             }
  1718.         }
  1719.     }
  1720.     public function getYouMayAlsoLike($goodsId null$count false)
  1721.     {
  1722.         //
  1723.         if (($goodsId !== null) || ($goodsId $this->getGoodsIdFromCart())) {
  1724.             //
  1725.             $displayTogether $this->reviewService->LM_displayTogetherBuyDetail_new3($goodsId$count);
  1726.             if (empty($displayTogether)) {
  1727.                 return null;
  1728.             }
  1729.             //
  1730.             $context compact('displayTogether');
  1731.             //
  1732.             return $this->twig->render('Review/recentview.twig'$context);
  1733.         }
  1734.         //
  1735.         return null;
  1736.     }
  1737.     /**
  1738.      * Get count of koe for template
  1739.      *
  1740.      * @return $koe_count
  1741.      */
  1742.     public function getKoeCount()
  1743.     {
  1744.         $viewCacheKey $this->lmHelper->getCacheKey('getKoeCount', []);
  1745.         return $this->getCacheByKey($viewCacheKey, function() {
  1746.             $koe_count $this->dynamicConverter->LM_get_koe_count();
  1747.             return $koe_count;
  1748.         });
  1749.     }
  1750.     /**
  1751.      * カテゴリページの表示順(order_type)を返す。
  1752.      *
  1753.      * @return int $order_type 表示順
  1754.      */
  1755.     public function getCategoryOrderType(){
  1756.         if( !is_null($this->request->get('type')) ){
  1757.             return (int)$this->request->get('type');
  1758.         }
  1759.         else {
  1760.             $session $this->request->getSession();
  1761.             if( $session->has('order_type') ){
  1762.                 return (int)$session->get('order_type');
  1763.             }
  1764.         }
  1765.         return null;
  1766.     }
  1767.     /**
  1768.      * @return bool
  1769.      */
  1770.     public function isShowSpHeader()
  1771.     {
  1772.         //
  1773.         $_route $this->request->get('_route');
  1774.         $cartCount $this->get_carts_total_quantity();
  1775.         //
  1776.         if ($_route === 'cart') {
  1777.             // カート(STEP 1)
  1778.             if ($cartCount == 0) {
  1779.                 // カート内の商品が1点も無い時だけ表示
  1780.                 return true;
  1781.             } else {
  1782.                 //
  1783.                 return true;
  1784.             }
  1785.         } else if (preg_match('@(?:shopping|estimate)@'$_route)) {
  1786.             // ショッピング(STEP 2-5)、見積シミュは非表示
  1787.             return true;
  1788.         } else {
  1789.             // それ以外はOK
  1790.             return true;
  1791.         }
  1792.     }
  1793.     /**
  1794.      * @param Goods $goods
  1795.      * @return string
  1796.      * @throws \Twig\Error\LoaderError
  1797.      * @throws \Twig\Error\RuntimeError
  1798.      * @throws \Twig\Error\SyntaxError
  1799.      */
  1800.     public function getSizeTable(Goods $goods)
  1801.     {
  1802.         //
  1803.         list($SizeList,$SizePosition) = $this->dynamicConverter->LM_displaySizeMatrix_cross2($goods->getGoodsId());
  1804.         //
  1805.         return $this->twig->render('Common/SizeTable.twig'compact('goods''SizeList''SizePosition'));
  1806.     }
  1807. }