@@ -90,25 +90,25 @@ |
||
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, |
|
101 | - $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType, |
|
98 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId, |
|
99 | + $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
100 | + $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey, |
|
101 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType, |
|
102 | 102 | ], |
103 | 103 | ]); |
104 | 104 | |
105 | 105 | $cache = Craft::$app->getCache(); |
106 | 106 | $result = $cache->getOrSet( |
107 | - self::CACHE_KEY . $cacheKey, |
|
107 | + self::CACHE_KEY.$cacheKey, |
|
108 | 108 | function() use ($uri, $siteId, $containerKeys, $asArray) { |
109 | 109 | $result = []; |
110 | 110 | Craft::info( |
111 | - 'Meta controller container cache miss: ' . $uri . '/' . $siteId, |
|
111 | + 'Meta controller container cache miss: '.$uri.'/'.$siteId, |
|
112 | 112 | __METHOD__ |
113 | 113 | ); |
114 | 114 | // Load the meta containers and parse our globals |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $lastSegment = end($segments); |
358 | 358 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
359 | 359 | if ($site !== null) { |
360 | - $siteSuffix = '/' . $lastSegment; |
|
360 | + $siteSuffix = '/'.$lastSegment; |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | $currentUser = Craft::$app->getUser()->getIdentity(); |
@@ -365,31 +365,31 @@ discard block |
||
365 | 365 | if ($currentUser->can('seomatic:dashboard')) { |
366 | 366 | $subNavs['dashboard'] = [ |
367 | 367 | 'label' => Craft::t('seomatic', 'Dashboard'), |
368 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
368 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
369 | 369 | ]; |
370 | 370 | } |
371 | 371 | if ($currentUser->can('seomatic:global-meta')) { |
372 | 372 | $subNavs['global'] = [ |
373 | 373 | 'label' => Craft::t('seomatic', 'Global SEO'), |
374 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
374 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
375 | 375 | ]; |
376 | 376 | } |
377 | 377 | if ($currentUser->can('seomatic:content-meta')) { |
378 | 378 | $subNavs['content'] = [ |
379 | 379 | 'label' => Craft::t('seomatic', 'Content SEO'), |
380 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
380 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
381 | 381 | ]; |
382 | 382 | } |
383 | 383 | if ($currentUser->can('seomatic:site-settings')) { |
384 | 384 | $subNavs['site'] = [ |
385 | 385 | 'label' => Craft::t('seomatic', 'Site Settings'), |
386 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
386 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
387 | 387 | ]; |
388 | 388 | } |
389 | 389 | if ($currentUser->can('seomatic:tracking-scripts')) { |
390 | 390 | $subNavs['tracking'] = [ |
391 | 391 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
392 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
392 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
393 | 393 | ]; |
394 | 394 | } |
395 | 395 | $editableSettings = true; |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | $element = $e->sender; |
584 | 584 | if ($element->uri !== null) { |
585 | 585 | $e->previewTargets[] = [ |
586 | - 'label' => ' |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * @inheritdoc |
161 | 161 | */ |
162 | - public function getContentColumnType(): array|string |
|
162 | + public function getContentColumnType(): array | string |
|
163 | 163 | { |
164 | 164 | return Schema::TYPE_TEXT; |
165 | 165 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | // Handle the mainEntityOfPage |
225 | 225 | $mainEntity = ''; |
226 | - if (in_array('mainEntityOfPage', (array)$this->generalEnabledFields, false) && |
|
226 | + if (in_array('mainEntityOfPage', (array) $this->generalEnabledFields, false) && |
|
227 | 227 | !empty($config['metaBundleSettings'])) { |
228 | 228 | $mainEntity = SchemaHelper::getSpecificEntityType($config['metaBundleSettings'], true); |
229 | 229 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if ($element !== null && $element->uri !== null) { |
378 | 378 | $siteId = $element->siteId; |
379 | 379 | $uri = $element->uri; |
380 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
380 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
381 | 381 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
382 | 382 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
383 | 383 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -388,15 +388,15 @@ discard block |
||
388 | 388 | $dependency = new TagDependency([ |
389 | 389 | 'tags' => [ |
390 | 390 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
391 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
392 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
393 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType, |
|
391 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
392 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
393 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType, |
|
394 | 394 | ], |
395 | 395 | ]); |
396 | 396 | $cache = Craft::$app->getCache(); |
397 | 397 | $cacheDuration = null; |
398 | 398 | $html = $cache->getOrSet( |
399 | - self::CACHE_KEY . $cacheKey, |
|
399 | + self::CACHE_KEY.$cacheKey, |
|
400 | 400 | function() use ($uri, $siteId, $element) { |
401 | 401 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element); |
402 | 402 | $variables = [ |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | array &$variables, |
439 | 439 | ) { |
440 | 440 | $variables['textFieldSources'] = array_merge( |
441 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
441 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
442 | 442 | FieldHelper::fieldsOfTypeFromElement( |
443 | 443 | $element, |
444 | 444 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | ) |
447 | 447 | ); |
448 | 448 | $variables['assetFieldSources'] = array_merge( |
449 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
449 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
450 | 450 | FieldHelper::fieldsOfTypeFromElement( |
451 | 451 | $element, |
452 | 452 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param MetaBundle $metaBundle |
195 | 195 | * @param bool $forceUpdate |
196 | 196 | */ |
197 | - public function syncBundleWithConfig(MetaBundle &$metaBundle, bool $forceUpdate = false) |
|
197 | + public function syncBundleWithConfig(MetaBundle & $metaBundle, bool $forceUpdate = false) |
|
198 | 198 | { |
199 | 199 | $prevMetaBundle = $metaBundle; |
200 | 200 | $config = []; |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function updateMetaBundle(MetaBundle $metaBundle, int $siteId) |
277 | 277 | { |
278 | - $metaBundle->sourceName = (string)$metaBundle->sourceName; |
|
279 | - $metaBundle->sourceTemplate = (string)$metaBundle->sourceTemplate; |
|
278 | + $metaBundle->sourceName = (string) $metaBundle->sourceName; |
|
279 | + $metaBundle->sourceTemplate = (string) $metaBundle->sourceTemplate; |
|
280 | 280 | // Make sure it validates |
281 | 281 | if ($metaBundle->validate(null, true)) { |
282 | 282 | // Save it out to a record |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'sourceSiteId' => $siteId, |
287 | 287 | ]; |
288 | 288 | if ($metaBundle->typeId !== null) { |
289 | - $metaBundle->typeId = (int)$metaBundle->typeId; |
|
289 | + $metaBundle->typeId = (int) $metaBundle->typeId; |
|
290 | 290 | } |
291 | 291 | if (!empty($metaBundle->typeId)) { |
292 | 292 | $params['typeId'] = $metaBundle->typeId; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // The issue was that the containers were getting saved to the db with a hard-coded setting in them, because they'd |
304 | 304 | // been set that way by the environment, whereas to be changeable via the GUI, it needs to be set to {seomatic.meta.robots} |
305 | 305 | /** @var RobotsTag|null $robotsTag */ |
306 | - $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
306 | + $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
307 | 307 | if (!empty($robotsTag)) { |
308 | 308 | $robotsTag->content = $robotsTag->environment['live']['content'] ?? '{{ seomatic.meta.robots }}'; |
309 | 309 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $metaBundleDefaults = ArrayHelper::merge( |
385 | 385 | $seoElement::metaBundleConfig($sourceModel), |
386 | 386 | [ |
387 | - 'sourceTemplate' => (string)$siteSetting->template, |
|
387 | + 'sourceTemplate' => (string) $siteSetting->template, |
|
388 | 388 | 'sourceSiteId' => $siteSetting->siteId, |
389 | 389 | 'sourceAltSiteSettings' => $siteSettingsArray, |
390 | 390 | 'sourceDateUpdated' => $dateUpdated, |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | public function getMetaBundleBySourceHandle(string $sourceBundleType, string $sourceHandle, int $sourceSiteId, $typeId = null) |
434 | 434 | { |
435 | 435 | $metaBundle = null; |
436 | - $typeId = (int)$typeId; |
|
436 | + $typeId = (int) $typeId; |
|
437 | 437 | // See if we have the meta bundle cached |
438 | 438 | if (!empty($this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId])) { |
439 | 439 | $id = $this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId]; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | /** @var Section|CategoryGroup|ProductType $sourceModel */ |
521 | 521 | $sourceModel = $seoElement::sourceModelFromId($sourceId); |
522 | 522 | if ($sourceModel !== null) { |
523 | - $metaBundle->sourceName = (string)$sourceModel->name; |
|
523 | + $metaBundle->sourceName = (string) $sourceModel->name; |
|
524 | 524 | $metaBundle->sourceHandle = $sourceModel->handle; |
525 | 525 | } |
526 | 526 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | public function getMetaBundleBySourceId(string $sourceBundleType, int $sourceId, ?int $sourceSiteId, $typeId = null) |
560 | 560 | { |
561 | 561 | $metaBundle = null; |
562 | - $typeId = (int)$typeId; |
|
562 | + $typeId = (int) $typeId; |
|
563 | 563 | // See if we have the meta bundle cached |
564 | 564 | if (!empty($this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId])) { |
565 | 565 | $id = $this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId]; |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE]) |
752 | 752 | ->andWhere(['typeId' => null]); |
753 | 753 | |
754 | - if ((int)$sourceSiteId !== 0) { |
|
754 | + if ((int) $sourceSiteId !== 0) { |
|
755 | 755 | $subQuery->andWhere(['sourceSiteId' => $sourceSiteId]); |
756 | 756 | } |
757 | 757 | if ($filter !== '') { |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | public function getContentMetaBundleForElement(Element $element) |
789 | 789 | { |
790 | 790 | $source = $this->getMetaSourceFromElement($element); |
791 | - $key = implode(".", $source) . '.' . $element->siteId; |
|
791 | + $key = implode(".", $source).'.'.$element->siteId; |
|
792 | 792 | |
793 | 793 | if (empty($this->elementContentMetaBundles[$key])) { |
794 | 794 | $this->elementContentMetaBundles[$key] = $this->getMetaBundleBySourceId($source[1], $source[0], $element->siteId, $source[4]); |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | $seoSettingsField = Craft::$app->getFields()->getFieldByHandle($fieldHandle); |
811 | 811 | if ($seoSettingsField) { |
812 | 812 | $seoSettingsEnabledFields = array_flip(array_merge( |
813 | - (array)$seoSettingsField->generalEnabledFields, |
|
814 | - (array)$seoSettingsField->twitterEnabledFields, |
|
815 | - (array)$seoSettingsField->facebookEnabledFields, |
|
816 | - (array)$seoSettingsField->sitemapEnabledFields |
|
813 | + (array) $seoSettingsField->generalEnabledFields, |
|
814 | + (array) $seoSettingsField->twitterEnabledFields, |
|
815 | + (array) $seoSettingsField->facebookEnabledFields, |
|
816 | + (array) $seoSettingsField->sitemapEnabledFields |
|
817 | 817 | )); |
818 | 818 | // Always include some fields, as they are calculated even if not explicitly included |
819 | 819 | $seoSettingsEnabledFields = array_merge( |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | |
842 | 842 | |
843 | 843 | // Handle the mainEntityOfPage |
844 | - if (!in_array('mainEntityOfPage', (array)$seoSettingsField->generalEnabledFields, false)) { |
|
844 | + if (!in_array('mainEntityOfPage', (array) $seoSettingsField->generalEnabledFields, false)) { |
|
845 | 845 | $metaBundle->metaGlobalVars->mainEntityOfPage = ''; |
846 | 846 | } |
847 | 847 | // metaSiteVars |