@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | // Output some info if this is a console app |
| 112 | 112 | if ($job && Craft::$app instanceof ConsoleApplication) { |
| 113 | - echo $job->description . PHP_EOL; |
|
| 113 | + echo $job->description.PHP_EOL; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $lines = []; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if ($multiSite) { |
| 138 | 138 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
| 139 | 139 | } |
| 140 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 140 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 141 | 141 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
| 142 | 142 | } |
| 143 | 143 | $urlsetLine .= '>'; |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | while ($currentElement < $totalElements) { |
| 173 | 173 | $elements = $paginator->getPageResults(); |
| 174 | 174 | if (Craft::$app instanceof ConsoleApplication) { |
| 175 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
| 176 | - . ' - elements: ' . $paginator->getTotalResults() |
|
| 175 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
| 176 | + . ' - elements: '.$paginator->getTotalResults() |
|
| 177 | 177 | . PHP_EOL; |
| 178 | 178 | } |
| 179 | 179 | /** @var Element $element */ |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | // Output some info if this is a console app |
| 187 | 187 | if (Craft::$app instanceof ConsoleApplication) { |
| 188 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 188 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 232 | 232 | if ($url !== $canonicalUrl) { |
| 233 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 233 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 234 | 234 | continue; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -288,12 +288,12 @@ discard block |
||
| 288 | 288 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 289 | 289 | $lines[] = '<xhtml:link rel="alternate"' |
| 290 | 290 | . ' hreflang="x-default"' |
| 291 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 291 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 292 | 292 | . ' />'; |
| 293 | 293 | } |
| 294 | 294 | $lines[] = '<xhtml:link rel="alternate"' |
| 295 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 296 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 295 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 296 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 297 | 297 | . ' />'; |
| 298 | 298 | } |
| 299 | 299 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
| 305 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 305 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 306 | 306 | $now = new DateTime(); |
| 307 | 307 | $interval = $now->diff($dateUpdated); |
| 308 | 308 | if ($interval->days <= 2) { |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | $lines[] = '<news:news>'; |
| 314 | 314 | $lines[] = '<news:publication>'; |
| 315 | - $lines[] = '<news:name>' . $metaBundle->metaSitemapVars->newsPublicationName . '</news:name>'; |
|
| 316 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
| 315 | + $lines[] = '<news:name>'.$metaBundle->metaSitemapVars->newsPublicationName.'</news:name>'; |
|
| 316 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
| 317 | 317 | $lines[] = '</news:publication>'; |
| 318 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
| 319 | - $lines[] = '<news:title>' . $element->title . '</news:title>'; |
|
| 318 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
| 319 | + $lines[] = '<news:title>'.$element->title.'</news:title>'; |
|
| 320 | 320 | $lines[] = '</news:news>'; |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | $lines[] = '</urlset>'; |
| 415 | 415 | |
| 416 | 416 | $cache = Craft::$app->getCache(); |
| 417 | - $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId; |
|
| 417 | + $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId; |
|
| 418 | 418 | $dependency = new TagDependency([ |
| 419 | 419 | 'tags' => [ |
| 420 | 420 | SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG, |
| 421 | - SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
| 421 | + SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
| 422 | 422 | ], |
| 423 | 423 | ]); |
| 424 | 424 | $lines = implode('', $lines); |
@@ -431,10 +431,10 @@ discard block |
||
| 431 | 431 | $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency); |
| 432 | 432 | // Remove the queue job id from the cache too |
| 433 | 433 | $cache->delete($queueJobCacheKey); |
| 434 | - Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__); |
|
| 434 | + Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__); |
|
| 435 | 435 | // Output some info if this is a console app |
| 436 | 436 | if (Craft::$app instanceof ConsoleApplication) { |
| 437 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
| 437 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
| 438 | 438 | } |
| 439 | 439 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
| 440 | 440 | /** @var ?FastcgiCacheBust $plugin */ |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | $attributes = array_intersect_key( |
| 520 | 520 | $attributes, |
| 521 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
| 521 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
| 522 | 522 | ); |
| 523 | 523 | $attributes = array_filter( |
| 524 | 524 | $attributes, |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | */ |
| 551 | 551 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 552 | 552 | { |
| 553 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 553 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 554 | 554 | switch ($asset->kind) { |
| 555 | 555 | case 'image': |
| 556 | 556 | $transform = Craft::$app->getImageTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform); |
@@ -563,9 +563,9 @@ discard block |
||
| 563 | 563 | $fieldName = $row['field'] ?? ''; |
| 564 | 564 | $propName = $row['property'] ?? ''; |
| 565 | 565 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 566 | - $lines[] = '<image:' . $propName . '>'; |
|
| 566 | + $lines[] = '<image:'.$propName.'>'; |
|
| 567 | 567 | $lines[] = Html::encode($asset[$fieldName]); |
| 568 | - $lines[] = '</image:' . $propName . '>'; |
|
| 568 | + $lines[] = '</image:'.$propName.'>'; |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | $lines[] = '</image:image>'; |
@@ -581,9 +581,9 @@ discard block |
||
| 581 | 581 | $fieldName = $row['field'] ?? ''; |
| 582 | 582 | $propName = $row['property'] ?? ''; |
| 583 | 583 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 584 | - $lines[] = '<video:' . $propName . '>'; |
|
| 584 | + $lines[] = '<video:'.$propName.'>'; |
|
| 585 | 585 | $lines[] = Html::encode($asset[$fieldName]); |
| 586 | - $lines[] = '</video:' . $propName . '>'; |
|
| 586 | + $lines[] = '</video:'.$propName.'>'; |
|
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | $lines[] = '</video:video>'; |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | */ |
| 600 | 600 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 601 | 601 | { |
| 602 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 602 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 603 | 603 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 604 | 604 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
| 605 | 605 | $lines[] = '<url>'; |