@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if ($multiSite) { |
| 139 | 139 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
| 140 | 140 | } |
| 141 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 141 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 142 | 142 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
| 143 | 143 | } |
| 144 | 144 | $urlsetLine .= '>'; |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | $paginator->getTotalPages(), |
| 215 | 215 | $paginator->getTotalResults()); |
| 216 | 216 | } |
| 217 | - echo $message . PHP_EOL; |
|
| 217 | + echo $message.PHP_EOL; |
|
| 218 | 218 | } |
| 219 | 219 | /** @var Element $element */ |
| 220 | 220 | foreach ($elements as $element) { |
| 221 | 221 | // Output some info if this is a console app |
| 222 | 222 | if (Craft::$app instanceof ConsoleApplication) { |
| 223 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 223 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 270 | 270 | if ($url !== $canonicalUrl) { |
| 271 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 271 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 272 | 272 | continue; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 330 | 330 | $lines[] = '<xhtml:link rel="alternate"' |
| 331 | 331 | . ' hreflang="x-default"' |
| 332 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 332 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 333 | 333 | . ' />'; |
| 334 | 334 | } |
| 335 | 335 | $lines[] = '<xhtml:link rel="alternate"' |
| 336 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 337 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 336 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 337 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 338 | 338 | . ' />'; |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
| 346 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 346 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 347 | 347 | $now = new DateTime(); |
| 348 | 348 | $interval = $now->diff($dateUpdated); |
| 349 | 349 | if ($interval->days <= 2) { |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | $lines[] = '<news:news>'; |
| 355 | 355 | $lines[] = '<news:publication>'; |
| 356 | - $lines[] = '<news:name>' . self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName) . '</news:name>'; |
|
| 357 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
| 356 | + $lines[] = '<news:name>'.self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName).'</news:name>'; |
|
| 357 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
| 358 | 358 | $lines[] = '</news:publication>'; |
| 359 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
| 360 | - $lines[] = '<news:title>' . self::encodeSitemapEntity($element->title) . '</news:title>'; |
|
| 359 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
| 360 | + $lines[] = '<news:title>'.self::encodeSitemapEntity($element->title).'</news:title>'; |
|
| 361 | 361 | $lines[] = '</news:news>'; |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | */ |
| 631 | 631 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 632 | 632 | { |
| 633 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 633 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 634 | 634 | switch ($asset->kind) { |
| 635 | 635 | case 'image': |
| 636 | 636 | $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | $fieldName = $row['field'] ?? ''; |
| 644 | 644 | $propName = $row['property'] ?? ''; |
| 645 | 645 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 646 | - $lines[] = '<image:' . $propName . '>'; |
|
| 646 | + $lines[] = '<image:'.$propName.'>'; |
|
| 647 | 647 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 648 | - $lines[] = '</image:' . $propName . '>'; |
|
| 648 | + $lines[] = '</image:'.$propName.'>'; |
|
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | $lines[] = '</image:image>'; |
@@ -661,9 +661,9 @@ discard block |
||
| 661 | 661 | $fieldName = $row['field'] ?? ''; |
| 662 | 662 | $propName = $row['property'] ?? ''; |
| 663 | 663 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 664 | - $lines[] = '<video:' . $propName . '>'; |
|
| 664 | + $lines[] = '<video:'.$propName.'>'; |
|
| 665 | 665 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 666 | - $lines[] = '</video:' . $propName . '>'; |
|
| 666 | + $lines[] = '</video:'.$propName.'>'; |
|
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | $lines[] = '</video:video>'; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 681 | 681 | { |
| 682 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 682 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 683 | 683 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 684 | 684 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
| 685 | 685 | $lines[] = '<url>'; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | // Get the page number of this request |
| 183 | 183 | $request = Craft::$app->getRequest(); |
| 184 | 184 | if (!$request->isConsoleRequest) { |
| 185 | - $this->paginationPage = (string)$request->pageNum; |
|
| 185 | + $this->paginationPage = (string) $request->pageNum; |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | $dependency = $this->containerDependency; |
| 252 | 252 | $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY; |
| 253 | 253 | list($this->metaGlobalVars, $this->metaSiteVars) = Craft::$app->getCache()->getOrSet( |
| 254 | - self::GLOBALS_CACHE_KEY . $uniqueKey, |
|
| 254 | + self::GLOBALS_CACHE_KEY.$uniqueKey, |
|
| 255 | 255 | function() use ($uniqueKey) { |
| 256 | 256 | Craft::info( |
| 257 | - self::GLOBALS_CACHE_KEY . ' cache miss: ' . $uniqueKey, |
|
| 257 | + self::GLOBALS_CACHE_KEY.' cache miss: '.$uniqueKey, |
|
| 258 | 258 | __METHOD__ |
| 259 | 259 | ); |
| 260 | 260 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | ?? 1; |
| 381 | 381 | } |
| 382 | 382 | // Handle pagination |
| 383 | - $paginationPage = 'page' . $this->paginationPage; |
|
| 383 | + $paginationPage = 'page'.$this->paginationPage; |
|
| 384 | 384 | // Get the path for the current request |
| 385 | 385 | $request = Craft::$app->getRequest(); |
| 386 | 386 | $requestPath = '/'; |
@@ -405,22 +405,22 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | // Get our cache key |
| 408 | - $cacheKey = $uri . $siteId . $paginationPage . $requestPath . $this->getAllowedUrlParams() . $token; |
|
| 408 | + $cacheKey = $uri.$siteId.$paginationPage.$requestPath.$this->getAllowedUrlParams().$token; |
|
| 409 | 409 | // For requests with a status code of >= 400, use one cache key |
| 410 | 410 | if (!$request->isConsoleRequest) { |
| 411 | 411 | $response = Craft::$app->getResponse(); |
| 412 | 412 | if ($response->statusCode >= 400) { |
| 413 | - $cacheKey = $siteId . self::INVALID_RESPONSE_CACHE_KEY . $response->statusCode; |
|
| 413 | + $cacheKey = $siteId.self::INVALID_RESPONSE_CACHE_KEY.$response->statusCode; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | // Load the meta containers |
| 417 | 417 | $dependency = new TagDependency([ |
| 418 | 418 | 'tags' => [ |
| 419 | 419 | self::GLOBAL_METACONTAINER_CACHE_TAG, |
| 420 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
| 421 | - self::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 422 | - self::METACONTAINER_CACHE_TAG . $cacheKey, |
|
| 423 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType, |
|
| 420 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
| 421 | + self::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 422 | + self::METACONTAINER_CACHE_TAG.$cacheKey, |
|
| 423 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType, |
|
| 424 | 424 | ], |
| 425 | 425 | ]); |
| 426 | 426 | $this->containerDependency = $dependency; |
@@ -437,10 +437,10 @@ discard block |
||
| 437 | 437 | } else { |
| 438 | 438 | $cache = Craft::$app->getCache(); |
| 439 | 439 | list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet( |
| 440 | - self::CACHE_KEY . $cacheKey, |
|
| 440 | + self::CACHE_KEY.$cacheKey, |
|
| 441 | 441 | function() use ($uri, $siteId) { |
| 442 | 442 | Craft::info( |
| 443 | - 'Meta container cache miss: ' . $uri . '/' . $siteId, |
|
| 443 | + 'Meta container cache miss: '.$uri.'/'.$siteId, |
|
| 444 | 444 | __METHOD__ |
| 445 | 445 | ); |
| 446 | 446 | $this->loadGlobalMetaContainers($siteId); |
@@ -841,10 +841,10 @@ discard block |
||
| 841 | 841 | $cache = Craft::$app->getCache(); |
| 842 | 842 | TagDependency::invalidate( |
| 843 | 843 | $cache, |
| 844 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId |
|
| 844 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId |
|
| 845 | 845 | ); |
| 846 | 846 | Craft::info( |
| 847 | - 'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId, |
|
| 847 | + 'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId, |
|
| 848 | 848 | __METHOD__ |
| 849 | 849 | ); |
| 850 | 850 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -871,9 +871,9 @@ discard block |
||
| 871 | 871 | if ($siteId === null) { |
| 872 | 872 | $siteId = Craft::$app->getSites()->currentSite->id ?? 1; |
| 873 | 873 | } |
| 874 | - TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId); |
|
| 874 | + TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId); |
|
| 875 | 875 | Craft::info( |
| 876 | - 'Meta container cache cleared: ' . $uri . ' / ' . $siteId, |
|
| 876 | + 'Meta container cache cleared: '.$uri.' / '.$siteId, |
|
| 877 | 877 | __METHOD__ |
| 878 | 878 | ); |
| 879 | 879 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | // Handle re-creating the `mainEntityOfPage` so that the model injected into the |
| 1018 | 1018 | // templates has the appropriate attributes |
| 1019 | - $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE; |
|
| 1019 | + $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE; |
|
| 1020 | 1020 | $generalContainer = $this->metaContainers[$generalContainerKey]; |
| 1021 | 1021 | if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) { |
| 1022 | 1022 | /** @var MetaJsonLd $jsonLdModel */ |