@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | // Constants |
44 | 44 | // ========================================================================= |
45 | 45 | |
46 | - const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE; |
|
46 | + const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE; |
|
47 | 47 | |
48 | - const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE; |
|
48 | + const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE; |
|
49 | 49 | |
50 | - const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapCustomTemplate::TEMPLATE_TYPE; |
|
50 | + const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapCustomTemplate::TEMPLATE_TYPE; |
|
51 | 51 | |
52 | 52 | const SEARCH_ENGINE_SUBMISSION_URLS = [ |
53 | 53 | ]; |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | $siteId = $groupSiteIds[0]; |
248 | 248 | $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId); |
249 | 249 | if (!empty($sitemapIndexUrl)) { |
250 | - $submissionUrl = $url . urlencode($sitemapIndexUrl); |
|
250 | + $submissionUrl = $url.urlencode($sitemapIndexUrl); |
|
251 | 251 | // create new guzzle client |
252 | 252 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
253 | 253 | // Submit the sitemap index to each search engine |
254 | 254 | try { |
255 | 255 | $guzzleClient->post($submissionUrl); |
256 | 256 | Craft::info( |
257 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
257 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
258 | 258 | __METHOD__ |
259 | 259 | ); |
260 | 260 | } catch (\Exception $e) { |
261 | 261 | Craft::error( |
262 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
262 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
263 | 263 | __METHOD__ |
264 | 264 | ); |
265 | 265 | } |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | foreach ($searchEngineUrls as &$url) { |
322 | 322 | $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId); |
323 | 323 | if (!empty($sitemapUrl)) { |
324 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
324 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
325 | 325 | // create new guzzle client |
326 | 326 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
327 | 327 | // Submit the sitemap index to each search engine |
328 | 328 | try { |
329 | 329 | $guzzleClient->post($submissionUrl); |
330 | 330 | Craft::info( |
331 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
331 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
332 | 332 | __METHOD__ |
333 | 333 | ); |
334 | 334 | } catch (\Exception $e) { |
335 | 335 | Craft::error( |
336 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
336 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
337 | 337 | __METHOD__ |
338 | 338 | ); |
339 | 339 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | . '-' |
375 | 375 | . $metaBundle->sourceSiteId |
376 | 376 | . '-sitemap' |
377 | - . (!empty($page) ? '-p' . $page : '') |
|
377 | + . (!empty($page) ? '-p'.$page : '') |
|
378 | 378 | . '.xml', |
379 | 379 | null, |
380 | 380 | null, |
@@ -403,19 +403,19 @@ discard block |
||
403 | 403 | foreach ($searchEngineUrls as &$url) { |
404 | 404 | $sitemapUrl = $this->sitemapCustomUrlForSiteId($siteId); |
405 | 405 | if (!empty($sitemapUrl)) { |
406 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
406 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
407 | 407 | // create new guzzle client |
408 | 408 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
409 | 409 | // Submit the sitemap index to each search engine |
410 | 410 | try { |
411 | 411 | $guzzleClient->post($submissionUrl); |
412 | 412 | Craft::info( |
413 | - 'Sitemap Custom submitted to: ' . $submissionUrl, |
|
413 | + 'Sitemap Custom submitted to: '.$submissionUrl, |
|
414 | 414 | __METHOD__ |
415 | 415 | ); |
416 | 416 | } catch (\Exception $e) { |
417 | 417 | Craft::error( |
418 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
418 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
419 | 419 | __METHOD__ |
420 | 420 | ); |
421 | 421 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | foreach ($sites as $site) { |
496 | - $result .= 'sitemap: ' . $this->sitemapIndexUrlForSiteId($site->id) . PHP_EOL; |
|
496 | + $result .= 'sitemap: '.$this->sitemapIndexUrlForSiteId($site->id).PHP_EOL; |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | return rtrim($result, PHP_EOL); |
@@ -524,9 +524,9 @@ discard block |
||
524 | 524 | { |
525 | 525 | // Always just invalidate the sitemap cache now, since we're doing paginated sitemaps |
526 | 526 | $cache = Craft::$app->getCache(); |
527 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
527 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
528 | 528 | Craft::info( |
529 | - 'Sitemap cache cleared: ' . $handle, |
|
529 | + 'Sitemap cache cleared: '.$handle, |
|
530 | 530 | __METHOD__ |
531 | 531 | ); |
532 | 532 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $cache = Craft::$app->getCache(); |
152 | - $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page; |
|
152 | + $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page; |
|
153 | 153 | |
154 | - $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix; |
|
155 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
154 | + $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix; |
|
155 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
156 | 156 | $result = $cache->get($cacheKey); |
157 | 157 | |
158 | 158 | // If the sitemap isn't cached, start a job to create it |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | $dependency = new TagDependency([ |
172 | 172 | 'tags' => [ |
173 | 173 | self::GLOBAL_SITEMAP_CACHE_TAG, |
174 | - self::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
175 | - self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix, |
|
174 | + self::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
175 | + self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix, |
|
176 | 176 | ], |
177 | 177 | ]); |
178 | 178 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | // Output some info if this is a console app |
186 | 186 | if (Craft::$app instanceof ConsoleApplication) { |
187 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
187 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | // Return an empty XML document |
213 | 213 | $lines[] = '<?xml version="1.0" encoding="UTF-8"?>'; |
214 | 214 | $lines[] = '<?xml-stylesheet type="text/xsl" href="sitemap-empty.xsl"?>'; |
215 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'This sitemap has not been generated yet.') . ' -->'; |
|
216 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'If you are seeing this in local dev or an') . ' -->'; |
|
217 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'environment with `devMode` on, caches only') . ' -->'; |
|
218 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'last for 30 seconds in local dev, so it is') . ' -->'; |
|
219 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'normal for the sitemap to not be cached.') . ' -->'; |
|
215 | + $lines[] = '<!-- '.Craft::t('seomatic', 'This sitemap has not been generated yet.').' -->'; |
|
216 | + $lines[] = '<!-- '.Craft::t('seomatic', 'If you are seeing this in local dev or an').' -->'; |
|
217 | + $lines[] = '<!-- '.Craft::t('seomatic', 'environment with `devMode` on, caches only').' -->'; |
|
218 | + $lines[] = '<!-- '.Craft::t('seomatic', 'last for 30 seconds in local dev, so it is').' -->'; |
|
219 | + $lines[] = '<!-- '.Craft::t('seomatic', 'normal for the sitemap to not be cached.').' -->'; |
|
220 | 220 | $lines[] = '<urlset>'; |
221 | 221 | $lines[] = '</urlset>'; |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return $lines; |
226 | 226 | } else { |
227 | 227 | if (Craft::$app instanceof ConsoleApplication) { |
228 | - echo 'Found in cache' . PHP_EOL; |
|
228 | + echo 'Found in cache'.PHP_EOL; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | public function invalidateCache(string $handle, int $siteId) |
242 | 242 | { |
243 | 243 | $cache = Craft::$app->getCache(); |
244 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
244 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
245 | 245 | Craft::info( |
246 | - 'Sitemap cache cleared: ' . $handle, |
|
246 | + 'Sitemap cache cleared: '.$handle, |
|
247 | 247 | __METHOD__ |
248 | 248 | ); |
249 | 249 | } |