@@ -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 | } |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | // Constants |
| 44 | 44 | // ========================================================================= |
| 45 | 45 | |
| 46 | - public const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 46 | + public const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 47 | 47 | |
| 48 | - public const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE; |
|
| 48 | + public const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE; |
|
| 49 | 49 | |
| 50 | - public const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapCustomTemplate::TEMPLATE_TYPE; |
|
| 50 | + public const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapCustomTemplate::TEMPLATE_TYPE; |
|
| 51 | 51 | |
| 52 | 52 | public const SEARCH_ENGINE_SUBMISSION_URLS = [ |
| 53 | 53 | ]; |
@@ -238,19 +238,19 @@ discard block |
||
| 238 | 238 | $siteId = $groupSiteIds[0]; |
| 239 | 239 | $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId); |
| 240 | 240 | if (!empty($sitemapIndexUrl)) { |
| 241 | - $submissionUrl = $url . urlencode($sitemapIndexUrl); |
|
| 241 | + $submissionUrl = $url.urlencode($sitemapIndexUrl); |
|
| 242 | 242 | // create new guzzle client |
| 243 | 243 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 244 | 244 | // Submit the sitemap index to each search engine |
| 245 | 245 | try { |
| 246 | 246 | $guzzleClient->post($submissionUrl); |
| 247 | 247 | Craft::info( |
| 248 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 248 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
| 249 | 249 | __METHOD__ |
| 250 | 250 | ); |
| 251 | 251 | } catch (\Exception $e) { |
| 252 | 252 | Craft::error( |
| 253 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 253 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 254 | 254 | __METHOD__ |
| 255 | 255 | ); |
| 256 | 256 | } |
@@ -312,19 +312,19 @@ discard block |
||
| 312 | 312 | foreach ($searchEngineUrls as &$url) { |
| 313 | 313 | $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId); |
| 314 | 314 | if (!empty($sitemapUrl)) { |
| 315 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
| 315 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
| 316 | 316 | // create new guzzle client |
| 317 | 317 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 318 | 318 | // Submit the sitemap index to each search engine |
| 319 | 319 | try { |
| 320 | 320 | $guzzleClient->post($submissionUrl); |
| 321 | 321 | Craft::info( |
| 322 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 322 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
| 323 | 323 | __METHOD__ |
| 324 | 324 | ); |
| 325 | 325 | } catch (\Exception $e) { |
| 326 | 326 | Craft::error( |
| 327 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 327 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 328 | 328 | __METHOD__ |
| 329 | 329 | ); |
| 330 | 330 | } |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | . '-' |
| 366 | 366 | . $metaBundle->sourceSiteId |
| 367 | 367 | . '-sitemap' |
| 368 | - . (!empty($page) ? '-p' . $page : '') |
|
| 368 | + . (!empty($page) ? '-p'.$page : '') |
|
| 369 | 369 | . '.xml', |
| 370 | 370 | null, |
| 371 | 371 | null, |
@@ -394,19 +394,19 @@ discard block |
||
| 394 | 394 | foreach ($searchEngineUrls as &$url) { |
| 395 | 395 | $sitemapUrl = $this->sitemapCustomUrlForSiteId($siteId); |
| 396 | 396 | if (!empty($sitemapUrl)) { |
| 397 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
| 397 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
| 398 | 398 | // create new guzzle client |
| 399 | 399 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 400 | 400 | // Submit the sitemap index to each search engine |
| 401 | 401 | try { |
| 402 | 402 | $guzzleClient->post($submissionUrl); |
| 403 | 403 | Craft::info( |
| 404 | - 'Sitemap Custom submitted to: ' . $submissionUrl, |
|
| 404 | + 'Sitemap Custom submitted to: '.$submissionUrl, |
|
| 405 | 405 | __METHOD__ |
| 406 | 406 | ); |
| 407 | 407 | } catch (\Exception $e) { |
| 408 | 408 | Craft::error( |
| 409 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 409 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 410 | 410 | __METHOD__ |
| 411 | 411 | ); |
| 412 | 412 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | foreach ($sites as $site) { |
| 487 | - $result .= 'sitemap: ' . $this->sitemapIndexUrlForSiteId($site->id) . PHP_EOL; |
|
| 487 | + $result .= 'sitemap: '.$this->sitemapIndexUrlForSiteId($site->id).PHP_EOL; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | return rtrim($result, PHP_EOL); |
@@ -515,9 +515,9 @@ discard block |
||
| 515 | 515 | { |
| 516 | 516 | // Always just invalidate the sitemap cache now, since we're doing paginated sitemaps |
| 517 | 517 | $cache = Craft::$app->getCache(); |
| 518 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 518 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 519 | 519 | Craft::info( |
| 520 | - 'Sitemap cache cleared: ' . $handle, |
|
| 520 | + 'Sitemap cache cleared: '.$handle, |
|
| 521 | 521 | __METHOD__ |
| 522 | 522 | ); |
| 523 | 523 | } |