/** * {@inheritdoc} */ public function renderSitemap($alias, $page, $locale, Portal $portal, $host, $scheme) { if (!$this->sitemapProviderPool->hasProvider($alias)) { return; } $provider = $this->sitemapProviderPool->getProvider($alias); if ($provider->getMaxPage() < $page) { return; } $entries = $provider->build($page, $portal->getKey(), $locale); return $this->render('SuluWebsiteBundle:Sitemap:sitemap.xml.twig', ['webspaceKey' => $portal->getWebspace()->getKey(), 'locale' => $locale, 'defaultLocale' => $portal->getXDefaultLocalization()->getLocale(), 'domain' => $host, 'scheme' => $scheme, 'entries' => $entries]); }
/** * @param Portal $portal * @param Environment $environment * @param string $urlAddress * @param string $urlAnalyticsKey */ private function buildUrlPartialMatch(Portal $portal, Environment $environment, $urlAddress, $urlAnalyticsKey) { $replacers = [self::REPLACER_LANGUAGE => $portal->getDefaultLocalization()->getLanguage(), self::REPLACER_COUNTRY => $portal->getDefaultLocalization()->getCountry(), self::REPLACER_LOCALIZATION => $portal->getDefaultLocalization()->getLocalization('-')]; $defaultSegment = $portal->getWebspace()->getDefaultSegment(); if ($defaultSegment) { $replacers[self::REPLACER_SEGMENT] = $defaultSegment->getKey(); } $urlResult = $this->removeUrlPlaceHolders($urlAddress); $urlRedirect = $this->generateUrlAddress($urlAddress, $replacers); if ($this->validateUrlPartialMatch($urlResult, $environment)) { $this->portalInformations[$environment->getType()][$urlResult] = new PortalInformation(RequestAnalyzerInterface::MATCH_TYPE_PARTIAL, $portal->getWebspace(), $portal, $portal->getDefaultLocalization(), $urlResult, $portal->getWebspace()->getDefaultSegment(), $urlRedirect, $urlAnalyticsKey); } }
/** * @param Portal $portal * @param Environment $environment * @param string $urlAddress * @param string $urlAnalyticsKey * @param Url $url */ private function buildUrlPartialMatch(Portal $portal, Environment $environment, $urlAddress, $urlAnalyticsKey, Url $url) { $replacers = []; $defaultSegment = $portal->getWebspace()->getDefaultSegment(); if ($defaultSegment) { $replacers[ReplacerInterface::REPLACER_SEGMENT] = $defaultSegment->getKey(); } $urlResult = $this->urlReplacer->cleanup($urlAddress, [ReplacerInterface::REPLACER_LANGUAGE, ReplacerInterface::REPLACER_COUNTRY, ReplacerInterface::REPLACER_LOCALIZATION, ReplacerInterface::REPLACER_SEGMENT]); $urlRedirect = $this->generateUrlAddress($urlAddress, $replacers); if ($this->validateUrlPartialMatch($urlResult, $environment)) { $this->portalInformations[$environment->getType()][$urlResult] = new PortalInformation(RequestAnalyzerInterface::MATCH_TYPE_PARTIAL, $portal->getWebspace(), $portal, null, $urlResult, $portal->getWebspace()->getDefaultSegment(), $urlRedirect, $urlAnalyticsKey, false, $url->getUrl(), $this->urlReplacer->hasHostReplacer($urlResult) ? 4 : 9); } }