@@ -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); |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | // Since we want a stale-while-revalidate pattern, only invalidate the cache if we're asked to |
517 | 517 | if ($invalidateCache) { |
518 | 518 | $cache = Craft::$app->getCache(); |
519 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
519 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
520 | 520 | Craft::info( |
521 | - 'Sitemap cache cleared: ' . $handle, |
|
521 | + 'Sitemap cache cleared: '.$handle, |
|
522 | 522 | __METHOD__ |
523 | 523 | ); |
524 | 524 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @var bool|array |
46 | 46 | */ |
47 | - protected array|bool|int $allowAnonymous = [ |
|
47 | + protected array | bool | int $allowAnonymous = [ |
|
48 | 48 | ]; |
49 | 49 | |
50 | 50 | // Public Methods |
@@ -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 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if ($multiSite) { |
120 | 120 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
121 | 121 | } |
122 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
122 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
123 | 123 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
124 | 124 | } |
125 | 125 | $urlsetLine .= '>'; |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | $paginator->getTotalPages(), |
188 | 188 | $paginator->getTotalResults()); |
189 | 189 | } |
190 | - echo $message . PHP_EOL; |
|
190 | + echo $message.PHP_EOL; |
|
191 | 191 | } |
192 | 192 | /** @var Element $element */ |
193 | 193 | foreach ($elements as $element) { |
194 | 194 | // Output some info if this is a console app |
195 | 195 | if (Craft::$app instanceof ConsoleApplication) { |
196 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
196 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
240 | 240 | if ($url !== $canonicalUrl) { |
241 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
241 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | } |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
297 | 297 | $lines[] = '<xhtml:link rel="alternate"' |
298 | 298 | . ' hreflang="x-default"' |
299 | - . ' href="' . Html::encode($altUrl) . '"' |
|
299 | + . ' href="'.Html::encode($altUrl).'"' |
|
300 | 300 | . ' />'; |
301 | 301 | } |
302 | 302 | $lines[] = '<xhtml:link rel="alternate"' |
303 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
304 | - . ' href="' . Html::encode($altUrl) . '"' |
|
303 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
304 | + . ' href="'.Html::encode($altUrl).'"' |
|
305 | 305 | . ' />'; |
306 | 306 | } |
307 | 307 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | |
484 | 484 | $attributes = array_intersect_key( |
485 | 485 | $attributes, |
486 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
486 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
487 | 487 | ); |
488 | 488 | $attributes = array_filter( |
489 | 489 | $attributes, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
517 | 517 | { |
518 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
518 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
519 | 519 | switch ($asset->kind) { |
520 | 520 | case 'image': |
521 | 521 | $transform = Craft::$app->getImageTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | $fieldName = $row['field'] ?? ''; |
529 | 529 | $propName = $row['property'] ?? ''; |
530 | 530 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
531 | - $lines[] = '<image:' . $propName . '>'; |
|
531 | + $lines[] = '<image:'.$propName.'>'; |
|
532 | 532 | $lines[] = Html::encode($asset[$fieldName]); |
533 | - $lines[] = '</image:' . $propName . '>'; |
|
533 | + $lines[] = '</image:'.$propName.'>'; |
|
534 | 534 | } |
535 | 535 | } |
536 | 536 | $lines[] = '</image:image>'; |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | $fieldName = $row['field'] ?? ''; |
547 | 547 | $propName = $row['property'] ?? ''; |
548 | 548 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
549 | - $lines[] = '<video:' . $propName . '>'; |
|
549 | + $lines[] = '<video:'.$propName.'>'; |
|
550 | 550 | $lines[] = Html::encode($asset[$fieldName]); |
551 | - $lines[] = '</video:' . $propName . '>'; |
|
551 | + $lines[] = '</video:'.$propName.'>'; |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | $lines[] = '</video:video>'; |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | */ |
565 | 565 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
566 | 566 | { |
567 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
567 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
568 | 568 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
569 | 569 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
570 | 570 | $lines[] = '<url>'; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * @inheritdoc |
113 | 113 | */ |
114 | - public static function dbType(): array|string|null |
|
114 | + public static function dbType(): array | string | null |
|
115 | 115 | { |
116 | 116 | return Schema::TYPE_TEXT; |
117 | 117 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | // Handle the mainEntityOfPage |
241 | 241 | $mainEntity = ''; |
242 | - if (in_array('mainEntityOfPage', (array)$this->generalEnabledFields, false) && |
|
242 | + if (in_array('mainEntityOfPage', (array) $this->generalEnabledFields, false) && |
|
243 | 243 | !empty($config['metaBundleSettings'])) { |
244 | 244 | $mainEntity = SchemaHelper::getSpecificEntityType($config['metaBundleSettings'], true); |
245 | 245 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | if ($element !== null && $element->uri !== null) { |
394 | 394 | $siteId = $element->siteId; |
395 | 395 | $uri = $element->uri; |
396 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
396 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
397 | 397 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
398 | 398 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
399 | 399 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | $dependency = new TagDependency([ |
405 | 405 | 'tags' => [ |
406 | 406 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
407 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
408 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
407 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
408 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
409 | 409 | ], |
410 | 410 | ]); |
411 | 411 | $cache = Craft::$app->getCache(); |
412 | 412 | $cacheDuration = null; |
413 | 413 | $html = $cache->getOrSet( |
414 | - self::CACHE_KEY . $cacheKey, |
|
414 | + self::CACHE_KEY.$cacheKey, |
|
415 | 415 | function() use ($uri, $siteId, $element) { |
416 | 416 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element); |
417 | 417 | $variables = [ |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | array &$variables, |
454 | 454 | ) { |
455 | 455 | $variables['textFieldSources'] = array_merge( |
456 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
456 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
457 | 457 | FieldHelper::fieldsOfTypeFromElement( |
458 | 458 | $element, |
459 | 459 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | ) |
462 | 462 | ); |
463 | 463 | $variables['assetFieldSources'] = array_merge( |
464 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
464 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
465 | 465 | FieldHelper::fieldsOfTypeFromElement( |
466 | 466 | $element, |
467 | 467 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $lastSegment = end($segments); |
348 | 348 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
349 | 349 | if ($site !== null) { |
350 | - $siteSuffix = '/' . $lastSegment; |
|
350 | + $siteSuffix = '/'.$lastSegment; |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | $currentUser = Craft::$app->getUser()->getIdentity(); |
@@ -355,31 +355,31 @@ discard block |
||
355 | 355 | if ($currentUser->can('seomatic:dashboard')) { |
356 | 356 | $subNavs['dashboard'] = [ |
357 | 357 | 'label' => Craft::t('seomatic', 'Dashboard'), |
358 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
358 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
359 | 359 | ]; |
360 | 360 | } |
361 | 361 | if ($currentUser->can('seomatic:global-meta')) { |
362 | 362 | $subNavs['global'] = [ |
363 | 363 | 'label' => Craft::t('seomatic', 'Global SEO'), |
364 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
364 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
365 | 365 | ]; |
366 | 366 | } |
367 | 367 | if ($currentUser->can('seomatic:content-meta')) { |
368 | 368 | $subNavs['content'] = [ |
369 | 369 | 'label' => Craft::t('seomatic', 'Content SEO'), |
370 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
370 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
371 | 371 | ]; |
372 | 372 | } |
373 | 373 | if ($currentUser->can('seomatic:site-settings')) { |
374 | 374 | $subNavs['site'] = [ |
375 | 375 | 'label' => Craft::t('seomatic', 'Site Settings'), |
376 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
376 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
377 | 377 | ]; |
378 | 378 | } |
379 | 379 | if ($currentUser->can('seomatic:tracking-scripts')) { |
380 | 380 | $subNavs['tracking'] = [ |
381 | 381 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
382 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
382 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
383 | 383 | ]; |
384 | 384 | } |
385 | 385 | $editableSettings = true; |
@@ -573,14 +573,14 @@ discard block |
||
573 | 573 | $element = $e->sender; |
574 | 574 | if ($element->uri !== null) { |
575 | 575 | $e->previewTargets[] = [ |
576 | - 'label' => ' |