@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | if ($pageInfo !== null && $pageInfo->currentPage !== null) { |
| 86 | 86 | // Let the meta containers know that this page is paginated |
| 87 | - Seomatic::$plugin->metaContainers->paginationPage = (string)$pageInfo->currentPage; |
|
| 87 | + Seomatic::$plugin->metaContainers->paginationPage = (string) $pageInfo->currentPage; |
|
| 88 | 88 | // See if we should strip the query params |
| 89 | 89 | $stripQueryParams = true; |
| 90 | 90 | $pageTrigger = Craft::$app->getConfig()->getGeneral()->pageTrigger; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | if (is_array($content)) { |
| 158 | 158 | $headerValue = ''; |
| 159 | 159 | foreach ($content as $contentVal) { |
| 160 | - $headerValue .= ($contentVal . ','); |
|
| 160 | + $headerValue .= ($contentVal.','); |
|
| 161 | 161 | } |
| 162 | 162 | $headerValue = rtrim($headerValue, ','); |
| 163 | 163 | } else { |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | if (is_array($href)) { |
| 177 | 177 | $headerValue = ''; |
| 178 | 178 | foreach ($href as $hrefVal) { |
| 179 | - $headerValue .= ('<' . $hrefVal . '>' . ','); |
|
| 179 | + $headerValue .= ('<'.$hrefVal.'>'.','); |
|
| 180 | 180 | } |
| 181 | 181 | $headerValue = rtrim($headerValue, ','); |
| 182 | 182 | } else { |
| 183 | - $headerValue = '<' . $href . '>'; |
|
| 183 | + $headerValue = '<'.$href.'>'; |
|
| 184 | 184 | } |
| 185 | 185 | $headerValue .= "; rel='canonical'"; |
| 186 | 186 | $response->headers->add('Link', $headerValue); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | if (is_array($content)) { |
| 197 | 197 | $headerValue = ''; |
| 198 | 198 | foreach ($content as $contentVal) { |
| 199 | - $headerValue .= ($contentVal . ','); |
|
| 199 | + $headerValue .= ($contentVal.','); |
|
| 200 | 200 | } |
| 201 | 201 | $headerValue = rtrim($headerValue, ','); |
| 202 | 202 | } else { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | if ($lastElement && $element) { |
| 383 | 383 | if ($lastElement->uri !== '__home__' && $element->uri) { |
| 384 | 384 | $path = $lastElement->uri; |
| 385 | - $segments = array_values(array_filter(explode('/', $path), function ($segment) { |
|
| 385 | + $segments = array_values(array_filter(explode('/', $path), function($segment) { |
|
| 386 | 386 | return $segment !== ''; |
| 387 | 387 | })); |
| 388 | 388 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $element = $elements->getElementByUri($url, $site->id, false); |
| 543 | 543 | } |
| 544 | 544 | if ($element !== null) { |
| 545 | - if (isset($element->enabledForSite) && !(bool)$element->enabledForSite) { |
|
| 545 | + if (isset($element->enabledForSite) && !(bool) $element->enabledForSite) { |
|
| 546 | 546 | $includeUrl = false; |
| 547 | 547 | } |
| 548 | 548 | /** @var MetaBundle $metaBundle */ |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | if (isset($value[$day][$time]) |
| 796 | 796 | && ($date = DateTimeHelper::toDateTime($value[$day][$time])) !== false |
| 797 | 797 | ) { |
| 798 | - $normalized[$day][$time] = (array)($date); |
|
| 798 | + $normalized[$day][$time] = (array) ($date); |
|
| 799 | 799 | } else { |
| 800 | 800 | $normalized[$day][$time] = null; |
| 801 | 801 | } |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $cache = Craft::$app->getCache(); |
| 151 | - $uniqueKey = $groupId . $type . $handle . $siteId; |
|
| 152 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
| 153 | - $queueJobCacheKey = self::QUEUE_JOB_CACHE_KEY . $uniqueKey; |
|
| 151 | + $uniqueKey = $groupId.$type.$handle.$siteId; |
|
| 152 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
| 153 | + $queueJobCacheKey = self::QUEUE_JOB_CACHE_KEY.$uniqueKey; |
|
| 154 | 154 | $result = $cache->get($cacheKey); |
| 155 | 155 | // If the sitemap isn't cached, start a job to create it |
| 156 | 156 | if ($result === false) { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $dependency = new TagDependency([ |
| 188 | 188 | 'tags' => [ |
| 189 | 189 | self::GLOBAL_SITEMAP_CACHE_TAG, |
| 190 | - self::CACHE_KEY . $uniqueKey, |
|
| 190 | + self::CACHE_KEY.$uniqueKey, |
|
| 191 | 191 | ], |
| 192 | 192 | ]); |
| 193 | 193 | $cache->set($queueJobCacheKey, $jobId, $cacheDuration, $dependency); |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | // Return an empty XML document |
| 220 | 220 | $lines[] = '<?xml version="1.0" encoding="UTF-8"?>'; |
| 221 | 221 | $lines[] = '<?xml-stylesheet type="text/xsl" href="sitemap-empty.xsl"?>'; |
| 222 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'This sitemap has not been generated yet.') . ' -->'; |
|
| 223 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'If you are seeing this in local dev or an') . ' -->'; |
|
| 224 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'environment with `devMode` on, caches only') . ' -->'; |
|
| 225 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'last for 30 seconds in local dev, so it is') . ' -->'; |
|
| 226 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'normal for the sitemap to not be cached.') . ' -->'; |
|
| 222 | + $lines[] = '<!-- '.Craft::t('seomatic', 'This sitemap has not been generated yet.').' -->'; |
|
| 223 | + $lines[] = '<!-- '.Craft::t('seomatic', 'If you are seeing this in local dev or an').' -->'; |
|
| 224 | + $lines[] = '<!-- '.Craft::t('seomatic', 'environment with `devMode` on, caches only').' -->'; |
|
| 225 | + $lines[] = '<!-- '.Craft::t('seomatic', 'last for 30 seconds in local dev, so it is').' -->'; |
|
| 226 | + $lines[] = '<!-- '.Craft::t('seomatic', 'normal for the sitemap to not be cached.').' -->'; |
|
| 227 | 227 | $lines[] = '<urlset>'; |
| 228 | 228 | $lines[] = '</urlset>'; |
| 229 | 229 | } |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | public function invalidateCache(string $handle, int $siteId) |
| 245 | 245 | { |
| 246 | 246 | $cache = Craft::$app->getCache(); |
| 247 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 247 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 248 | 248 | Craft::info( |
| 249 | - 'Sitemap cache cleared: ' . $handle, |
|
| 249 | + 'Sitemap cache cleared: '.$handle, |
|
| 250 | 250 | __METHOD__ |
| 251 | 251 | ); |
| 252 | 252 | } |