/** * Instantiates the Shopgate mobile redirector. * * @param ShopgateConfig $shopgateConfig An instance of the ShopgateConfig * @param ShopgateMerchantApiInterface $merchantApi An instance of the ShopgateMerchantApi required for keyword updates or null. */ public function __construct(ShopgateConfig $shopgateConfig, ShopgateMerchantApiInterface $merchantApi = null) { $this->merchantApi = $merchantApi; $this->config = $shopgateConfig; $this->setAlias($shopgateConfig->getAlias()); $this->setCustomMobileUrl($shopgateConfig->getCname()); if ($this->config->getEnableRedirectKeywordUpdate()) { $this->enableKeywordUpdate(); } else { $this->disableKeywordUpdate(); } $this->enableDefaultRedirect = $this->config->getEnableDefaultRedirect(); $this->suppressRedirect = false; $this->redirectKeywordCacheTime = ShopgateMobileRedirectInterface::DEFAULT_CACHE_TIME; $this->buttonParent = 'body'; $this->buttonPrepend = true; $this->useSecureConnection = isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] === "on" || $_SERVER["HTTPS"] == "1") || $this->config->getAlwaysUseSsl(); // mobile header options $this->mobileHeaderTemplatePath = dirname(__FILE__) . '/../assets/mobile_header.html'; $this->jsHeaderTemplatePath = dirname(__FILE__) . '/../assets/js_header.html'; $this->linkTagTemplatePath = dirname(__FILE__) . '/../assets/link_tag.html'; $this->cookieLife = gmdate('D, d-M-Y H:i:s T', time()); $this->buttonDescription = 'Mobile Webseite aktivieren'; }
public function buildScriptDefault($autoRedirect = true) { $this->redirectType = 'default'; $this->enableDefaultRedirect = $this->config->getEnableDefaultRedirect(); return $this->redirect($this->getShopUrl(), $autoRedirect); }