@@ -238,10 +238,10 @@ |
||
238 | 238 | } |
239 | 239 | // Make sure these are strings |
240 | 240 | if (!empty($this->facebookProfileId)) { |
241 | - $this->facebookProfileId = (string)$this->facebookProfileId; |
|
241 | + $this->facebookProfileId = (string) $this->facebookProfileId; |
|
242 | 242 | } |
243 | 243 | if (!empty($this->facebookAppId)) { |
244 | - $this->facebookAppId = (string)$this->facebookAppId; |
|
244 | + $this->facebookAppId = (string) $this->facebookAppId; |
|
245 | 245 | } |
246 | 246 | // Identity |
247 | 247 | if (is_array($this->identity)) { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if ($element !== null && $element->uri !== null) { |
377 | 377 | $siteId = $element->siteId; |
378 | 378 | $uri = $element->uri; |
379 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
379 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
380 | 380 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
381 | 381 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
382 | 382 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -387,14 +387,14 @@ discard block |
||
387 | 387 | $dependency = new TagDependency([ |
388 | 388 | 'tags' => [ |
389 | 389 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
390 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
391 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
390 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
391 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
392 | 392 | ], |
393 | 393 | ]); |
394 | 394 | $cache = Craft::$app->getCache(); |
395 | 395 | $cacheDuration = null; |
396 | 396 | $html = $cache->getOrSet( |
397 | - self::CACHE_KEY . $cacheKey, |
|
397 | + self::CACHE_KEY.$cacheKey, |
|
398 | 398 | function() use ($uri, $siteId, $element) { |
399 | 399 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element); |
400 | 400 | $variables = [ |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | array &$variables |
437 | 437 | ) { |
438 | 438 | $variables['textFieldSources'] = array_merge( |
439 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
439 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
440 | 440 | FieldHelper::fieldsOfTypeFromElement( |
441 | 441 | $element, |
442 | 442 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | $variables['assetFieldSources'] = array_merge( |
447 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
447 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
448 | 448 | FieldHelper::fieldsOfTypeFromElement( |
449 | 449 | $element, |
450 | 450 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function actionGenerate() |
70 | 70 | { |
71 | - echo 'Generating sitemap' . PHP_EOL; |
|
71 | + echo 'Generating sitemap'.PHP_EOL; |
|
72 | 72 | if ($this->siteId !== null) { |
73 | 73 | $siteIds[] = $this->siteId; |
74 | 74 | } else { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $sitemap = SitemapTemplate::create(); |
116 | 116 | if ($site) { |
117 | 117 | for ($pageNum = 1; $pageNum <= $pageCount; $pageNum++) { |
118 | - echo sprintf('Generating page %d of %d' . PHP_EOL, $pageNum, $pageCount); |
|
118 | + echo sprintf('Generating page %d of %d'.PHP_EOL, $pageNum, $pageCount); |
|
119 | 119 | $sitemap->render([ |
120 | 120 | 'groupId' => $site->groupId, |
121 | 121 | 'siteId' => $metaBundle->sourceSiteId, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Generate the sitemap so it is in the cache |
128 | 128 | } |
129 | 129 | |
130 | - echo '---' . PHP_EOL; |
|
130 | + echo '---'.PHP_EOL; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | if ($multiSite) { |
121 | 121 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
122 | 122 | } |
123 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
123 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
124 | 124 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
125 | 125 | } |
126 | 126 | $urlsetLine .= '>'; |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $paginator->getTotalPages(), |
189 | 189 | $paginator->getTotalResults()); |
190 | 190 | } |
191 | - echo $message . PHP_EOL; |
|
191 | + echo $message.PHP_EOL; |
|
192 | 192 | } |
193 | 193 | /** @var Element $element */ |
194 | 194 | foreach ($elements as $element) { |
195 | 195 | // Output some info if this is a console app |
196 | 196 | if (Craft::$app instanceof ConsoleApplication) { |
197 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
197 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
244 | 244 | if ($url !== $canonicalUrl) { |
245 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
245 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | } |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
304 | 304 | $lines[] = '<xhtml:link rel="alternate"' |
305 | 305 | . ' hreflang="x-default"' |
306 | - . ' href="' . Html::encode($altUrl) . '"' |
|
306 | + . ' href="'.Html::encode($altUrl).'"' |
|
307 | 307 | . ' />'; |
308 | 308 | } |
309 | 309 | $lines[] = '<xhtml:link rel="alternate"' |
310 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
311 | - . ' href="' . Html::encode($altUrl) . '"' |
|
310 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
311 | + . ' href="'.Html::encode($altUrl).'"' |
|
312 | 312 | . ' />'; |
313 | 313 | } |
314 | 314 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | } |
319 | 319 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
320 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
320 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
321 | 321 | $now = new DateTime(); |
322 | 322 | $interval = $now->diff($dateUpdated); |
323 | 323 | if ($interval->days <= 2) { |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | } |
328 | 328 | $lines[] = '<news:news>'; |
329 | 329 | $lines[] = '<news:publication>'; |
330 | - $lines[] = '<news:name>' . $metaBundle->metaSitemapVars->newsPublicationName . '</news:name>'; |
|
331 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
330 | + $lines[] = '<news:name>'.$metaBundle->metaSitemapVars->newsPublicationName.'</news:name>'; |
|
331 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
332 | 332 | $lines[] = '</news:publication>'; |
333 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
334 | - $lines[] = '<news:title>' . $element->title . '</news:title>'; |
|
333 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
334 | + $lines[] = '<news:title>'.$element->title.'</news:title>'; |
|
335 | 335 | $lines[] = '</news:news>'; |
336 | 336 | } |
337 | 337 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
549 | 549 | { |
550 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
550 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
551 | 551 | switch ($asset->kind) { |
552 | 552 | case 'image': |
553 | 553 | $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | $fieldName = $row['field'] ?? ''; |
561 | 561 | $propName = $row['property'] ?? ''; |
562 | 562 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
563 | - $lines[] = '<image:' . $propName . '>'; |
|
563 | + $lines[] = '<image:'.$propName.'>'; |
|
564 | 564 | $lines[] = Html::encode($asset[$fieldName]); |
565 | - $lines[] = '</image:' . $propName . '>'; |
|
565 | + $lines[] = '</image:'.$propName.'>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | $lines[] = '</image:image>'; |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | $fieldName = $row['field'] ?? ''; |
579 | 579 | $propName = $row['property'] ?? ''; |
580 | 580 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
581 | - $lines[] = '<video:' . $propName . '>'; |
|
581 | + $lines[] = '<video:'.$propName.'>'; |
|
582 | 582 | $lines[] = Html::encode($asset[$fieldName]); |
583 | - $lines[] = '</video:' . $propName . '>'; |
|
583 | + $lines[] = '</video:'.$propName.'>'; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | $lines[] = '</video:video>'; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
598 | 598 | { |
599 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
599 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
600 | 600 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
601 | 601 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
602 | 602 | $lines[] = '<url>'; |
@@ -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 | } |
@@ -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,21 +405,21 @@ 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, |
|
420 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
421 | + self::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
422 | + self::METACONTAINER_CACHE_TAG.$cacheKey, |
|
423 | 423 | ], |
424 | 424 | ]); |
425 | 425 | $this->containerDependency = $dependency; |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | } else { |
437 | 437 | $cache = Craft::$app->getCache(); |
438 | 438 | list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet( |
439 | - self::CACHE_KEY . $cacheKey, |
|
439 | + self::CACHE_KEY.$cacheKey, |
|
440 | 440 | function() use ($uri, $siteId) { |
441 | 441 | Craft::info( |
442 | - 'Meta container cache miss: ' . $uri . '/' . $siteId, |
|
442 | + 'Meta container cache miss: '.$uri.'/'.$siteId, |
|
443 | 443 | __METHOD__ |
444 | 444 | ); |
445 | 445 | $this->loadGlobalMetaContainers($siteId); |
@@ -843,10 +843,10 @@ discard block |
||
843 | 843 | $cache = Craft::$app->getCache(); |
844 | 844 | TagDependency::invalidate( |
845 | 845 | $cache, |
846 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId |
|
846 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId |
|
847 | 847 | ); |
848 | 848 | Craft::info( |
849 | - 'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId, |
|
849 | + 'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId, |
|
850 | 850 | __METHOD__ |
851 | 851 | ); |
852 | 852 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -873,9 +873,9 @@ discard block |
||
873 | 873 | if ($siteId === null) { |
874 | 874 | $siteId = Craft::$app->getSites()->currentSite->id ?? 1; |
875 | 875 | } |
876 | - TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId); |
|
876 | + TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId); |
|
877 | 877 | Craft::info( |
878 | - 'Meta container cache cleared: ' . $uri . ' / ' . $siteId, |
|
878 | + 'Meta container cache cleared: '.$uri.' / '.$siteId, |
|
879 | 879 | __METHOD__ |
880 | 880 | ); |
881 | 881 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | // Handle re-creating the `mainEntityOfPage` so that the model injected into the |
1020 | 1020 | // templates has the appropriate attributes |
1021 | - $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE; |
|
1021 | + $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE; |
|
1022 | 1022 | $generalContainer = $this->metaContainers[$generalContainerKey]; |
1023 | 1023 | if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) { |
1024 | 1024 | /** @var MetaJsonLd $jsonLdModel */ |
@@ -90,24 +90,24 @@ |
||
90 | 90 | } |
91 | 91 | // Get our cache key |
92 | 92 | $asArrayKey = $asArray ? 'true' : 'false'; |
93 | - $cacheKey = $uri . $siteId . implode($containerKeys) . $asArrayKey . Seomatic::$environment . $token; |
|
93 | + $cacheKey = $uri.$siteId.implode($containerKeys).$asArrayKey.Seomatic::$environment.$token; |
|
94 | 94 | // Load the meta containers |
95 | 95 | $dependency = new TagDependency([ |
96 | 96 | 'tags' => [ |
97 | 97 | $metaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
98 | - $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType . $siteId, |
|
99 | - $metaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
100 | - $metaContainers::METACONTAINER_CACHE_TAG . $cacheKey, |
|
98 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId, |
|
99 | + $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
100 | + $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey, |
|
101 | 101 | ], |
102 | 102 | ]); |
103 | 103 | |
104 | 104 | $cache = Craft::$app->getCache(); |
105 | 105 | $result = $cache->getOrSet( |
106 | - self::CACHE_KEY . $cacheKey, |
|
106 | + self::CACHE_KEY.$cacheKey, |
|
107 | 107 | function() use ($uri, $siteId, $containerKeys, $asArray) { |
108 | 108 | $result = []; |
109 | 109 | Craft::info( |
110 | - 'Meta controller container cache miss: ' . $uri . '/' . $siteId, |
|
110 | + 'Meta controller container cache miss: '.$uri.'/'.$siteId, |
|
111 | 111 | __METHOD__ |
112 | 112 | ); |
113 | 113 | // Load the meta containers and parse our globals |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | $cache = Craft::$app->getCache(); |
143 | - $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page; |
|
143 | + $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page; |
|
144 | 144 | |
145 | - $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix; |
|
146 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
145 | + $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix; |
|
146 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
147 | 147 | $result = $cache->get($cacheKey); |
148 | 148 | |
149 | 149 | // If the sitemap isn't cached, render it immediately |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | $dependency = new TagDependency([ |
161 | 161 | 'tags' => [ |
162 | 162 | self::GLOBAL_SITEMAP_CACHE_TAG, |
163 | - self::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
164 | - self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix, |
|
163 | + self::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
164 | + self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix, |
|
165 | 165 | ], |
166 | 166 | ]); |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // Output some info if this is a console app |
175 | 175 | if (Craft::$app instanceof ConsoleApplication) { |
176 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
176 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } else { |
189 | 189 | if (Craft::$app instanceof ConsoleApplication) { |
190 | - echo 'Found in cache' . PHP_EOL; |
|
190 | + echo 'Found in cache'.PHP_EOL; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | public function invalidateCache(string $handle, int $siteId) |
204 | 204 | { |
205 | 205 | $cache = Craft::$app->getCache(); |
206 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
206 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
207 | 207 | Craft::info( |
208 | - 'Sitemap cache cleared: ' . $handle, |
|
208 | + 'Sitemap cache cleared: '.$handle, |
|
209 | 209 | __METHOD__ |
210 | 210 | ); |
211 | 211 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $siteUrl = MetaValue::parseString($siteUrl); |
47 | 47 | // Extract out just the path part |
48 | 48 | $parts = self::decomposeUrl($path); |
49 | - $path = $parts['path'] . $parts['suffix']; |
|
49 | + $path = $parts['path'].$parts['suffix']; |
|
50 | 50 | $url = self::mergeUrlWithPath($siteUrl, $path); |
51 | 51 | // Handle trailing slashes properly for generated URLs |
52 | 52 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
53 | 53 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
54 | - $url = rtrim($url, '/') . '/'; |
|
54 | + $url = rtrim($url, '/').'/'; |
|
55 | 55 | } |
56 | 56 | if (!$generalConfig->addTrailingSlashesToUrls) { |
57 | 57 | $url = rtrim($url, '/'); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | public static function mergeUrlWithPath(string $url, string $path): string |
74 | 74 | { |
75 | 75 | $overlap = 0; |
76 | - $url = rtrim($url, '/') . '/'; |
|
77 | - $path = '/' . ltrim($path, '/'); |
|
76 | + $url = rtrim($url, '/').'/'; |
|
77 | + $path = '/'.ltrim($path, '/'); |
|
78 | 78 | $urlOffset = strlen($url); |
79 | 79 | $pathLength = strlen($path); |
80 | 80 | $pathOffset = 0; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
89 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // Handle trailing slashes properly for generated URLs |
155 | 155 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
156 | 156 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
157 | - $url = rtrim($url, '/') . '/'; |
|
157 | + $url = rtrim($url, '/').'/'; |
|
158 | 158 | } |
159 | 159 | if (!$generalConfig->addTrailingSlashesToUrls) { |
160 | 160 | $url = rtrim($url, '/'); |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | $urlParts = parse_url($url); |
175 | 175 | $encodedUrl = ""; |
176 | 176 | if (isset($urlParts['scheme'])) { |
177 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
177 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
178 | 178 | } |
179 | 179 | if (isset($urlParts['host'])) { |
180 | 180 | $encodedUrl .= $urlParts['host']; |
181 | 181 | } |
182 | 182 | if (isset($urlParts['port'])) { |
183 | - $encodedUrl .= ':' . $urlParts['port']; |
|
183 | + $encodedUrl .= ':'.$urlParts['port']; |
|
184 | 184 | } |
185 | 185 | if (isset($urlParts['path'])) { |
186 | 186 | $encodedUrl .= $urlParts['path']; |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | foreach ($query as $j => $value) { |
191 | 191 | $value = explode('=', $value, 2); |
192 | 192 | if (count($value) === 2) { |
193 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
193 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
194 | 194 | } else { |
195 | 195 | $query[$j] = urlencode($value[0]); |
196 | 196 | } |
197 | 197 | } |
198 | - $encodedUrl .= '?' . implode('&', $query); |
|
198 | + $encodedUrl .= '?'.implode('&', $query); |
|
199 | 199 | } |
200 | 200 | if (isset($urlParts['fragment'])) { |
201 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
201 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $encodedUrl; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if ($siteId !== null) { |
239 | 239 | $site = $sites->getSiteById($siteId, true); |
240 | 240 | if (!$site) { |
241 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
241 | + throw new Exception('Invalid site ID: '.$siteId); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | |
263 | 263 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
264 | 264 | $url_parts = parse_url($pathOrUrl); |
265 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
265 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
266 | 266 | $result['path'] = $url_parts['path'] ?? ''; |
267 | 267 | $result['suffix'] = ''; |
268 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
269 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
268 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
269 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
270 | 270 | } else { |
271 | 271 | $result['prefix'] = ''; |
272 | 272 | $result['path'] = $pathOrUrl; |