/** * Rewrite a link with the title * * @param string $link * @param string $title * @return string */ public static function rewriteLink($link = null, $title = null) { if(!isset(self::$shopConfig)) { self::$shopConfig = Shopware()->Config(); self::$baseFile = self::$shopConfig->baseFile; } if (strpos($link, self::$baseFile) !== 0) { return $link; } $url = str_replace(',', '=', $link); $url = html_entity_decode($url); $query = parse_url($url, PHP_URL_QUERY); parse_str($query, $query); if (!empty($title)) { $query['title'] = $title; } return Shopware()->Front()->Router()->assemble($query); }
/** * Initializes plugin config */ public function initConfig() { $shopConfig = Shopware()->Config(); self::$baseFile = $shopConfig->baseFile; $this->useSecure = Shopware()->Front()->Request()->isSecure(); $request = Shopware()->Front()->Request(); $this->basePath = $request->getHttpHost() . $request->getBasePath() . '/'; $this->basePathUrl = $request->getScheme() . '://' . $this->basePath; $this->backLinkWhiteList = preg_replace('#\\s#', '', $shopConfig->seoBackLinkWhiteList); $this->backLinkWhiteList = explode(',', $this->backLinkWhiteList); $hosts = $this->getShopHosts(); $this->backLinkWhiteList = array_merge($this->backLinkWhiteList, array_map('trim', $hosts)); }