@@ -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 |
@@ -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,15 +387,15 @@ 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, |
|
| 392 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType, |
|
| 390 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
| 391 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 392 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType, |
|
| 393 | 393 | ], |
| 394 | 394 | ]); |
| 395 | 395 | $cache = Craft::$app->getCache(); |
| 396 | 396 | $cacheDuration = null; |
| 397 | 397 | $html = $cache->getOrSet( |
| 398 | - self::CACHE_KEY . $cacheKey, |
|
| 398 | + self::CACHE_KEY.$cacheKey, |
|
| 399 | 399 | function() use ($uri, $siteId, $element) { |
| 400 | 400 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element); |
| 401 | 401 | $variables = [ |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | array &$variables |
| 438 | 438 | ) { |
| 439 | 439 | $variables['textFieldSources'] = array_merge( |
| 440 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 440 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 441 | 441 | FieldHelper::fieldsOfTypeFromElement( |
| 442 | 442 | $element, |
| 443 | 443 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | ) |
| 446 | 446 | ); |
| 447 | 447 | $variables['assetFieldSources'] = array_merge( |
| 448 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 448 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 449 | 449 | FieldHelper::fieldsOfTypeFromElement( |
| 450 | 450 | $element, |
| 451 | 451 | 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]; |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE]) |
| 754 | 754 | ->andWhere(['typeId' => null]); |
| 755 | 755 | |
| 756 | - if ((int)$sourceSiteId !== 0) { |
|
| 756 | + if ((int) $sourceSiteId !== 0) { |
|
| 757 | 757 | $subQuery->andWhere(['sourceSiteId' => $sourceSiteId]); |
| 758 | 758 | } |
| 759 | 759 | if ($filter !== '') { |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | public function getContentMetaBundleForElement(Element $element) |
| 791 | 791 | { |
| 792 | 792 | $source = $this->getMetaSourceFromElement($element); |
| 793 | - $key = implode(".", $source) . '.' . $element->siteId; |
|
| 793 | + $key = implode(".", $source).'.'.$element->siteId; |
|
| 794 | 794 | |
| 795 | 795 | if (empty($this->elementContentMetaBundles[$key])) { |
| 796 | 796 | $this->elementContentMetaBundles[$key] = $this->getMetaBundleBySourceId($source[1], $source[0], $element->siteId, $source[4]); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | self::$cacheDuration = self::$devMode |
| 287 | 287 | ? self::DEVMODE_CACHE_DURATION |
| 288 | 288 | : self::$settings->metaCacheDuration ?? null; |
| 289 | - self::$cacheDuration = self::$cacheDuration === null ? null : (int)self::$cacheDuration; |
|
| 289 | + self::$cacheDuration = self::$cacheDuration === null ? null : (int) self::$cacheDuration; |
|
| 290 | 290 | self::$environment = EnvironmentHelper::determineEnvironment(); |
| 291 | 291 | MetaValueHelper::cache(); |
| 292 | 292 | // Version helpers |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $lastSegment = end($segments); |
| 409 | 409 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
| 410 | 410 | if ($site !== null) { |
| 411 | - $siteSuffix = '/' . $lastSegment; |
|
| 411 | + $siteSuffix = '/'.$lastSegment; |
|
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | /** @var User $currentUser */ |
@@ -417,31 +417,31 @@ discard block |
||
| 417 | 417 | if ($currentUser->can('seomatic:dashboard')) { |
| 418 | 418 | $subNavs['dashboard'] = [ |
| 419 | 419 | 'label' => Craft::t('seomatic', 'Dashboard'), |
| 420 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
| 420 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
| 421 | 421 | ]; |
| 422 | 422 | } |
| 423 | 423 | if ($currentUser->can('seomatic:global-meta')) { |
| 424 | 424 | $subNavs['global'] = [ |
| 425 | 425 | 'label' => Craft::t('seomatic', 'Global SEO'), |
| 426 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
| 426 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
| 427 | 427 | ]; |
| 428 | 428 | } |
| 429 | 429 | if ($currentUser->can('seomatic:content-meta')) { |
| 430 | 430 | $subNavs['content'] = [ |
| 431 | 431 | 'label' => Craft::t('seomatic', 'Content SEO'), |
| 432 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
| 432 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
| 433 | 433 | ]; |
| 434 | 434 | } |
| 435 | 435 | if ($currentUser->can('seomatic:site-settings')) { |
| 436 | 436 | $subNavs['site'] = [ |
| 437 | 437 | 'label' => Craft::t('seomatic', 'Site Settings'), |
| 438 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
| 438 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
| 439 | 439 | ]; |
| 440 | 440 | } |
| 441 | 441 | if ($currentUser->can('seomatic:tracking-scripts')) { |
| 442 | 442 | $subNavs['tracking'] = [ |
| 443 | 443 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
| 444 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
| 444 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
| 445 | 445 | ]; |
| 446 | 446 | } |
| 447 | 447 | $editableSettings = true; |
@@ -636,14 +636,14 @@ discard block |
||
| 636 | 636 | $element = $e->sender; |
| 637 | 637 | if ($element->uri !== null) { |
| 638 | 638 | $e->previewTargets[] = [ |
| 639 | - 'label' => ' |
|