@@ -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 |
@@ -127,18 +127,18 @@ discard block |
||
| 127 | 127 | $dependency = new TagDependency([ |
| 128 | 128 | 'tags' => [ |
| 129 | 129 | self::GLOBAL_SITEMAP_CACHE_TAG, |
| 130 | - self::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
| 130 | + self::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
| 131 | 131 | ], |
| 132 | 132 | ]); |
| 133 | 133 | |
| 134 | 134 | $cacheDuration = Seomatic::$plugin->helper::isPreview() ? 1 : Seomatic::$cacheDuration; |
| 135 | 135 | |
| 136 | - return $cache->getOrSet(self::CACHE_KEY . $groupId . self::CUSTOM_SCOPE . $handle . $siteId, function() use ( |
|
| 136 | + return $cache->getOrSet(self::CACHE_KEY.$groupId.self::CUSTOM_SCOPE.$handle.$siteId, function() use ( |
|
| 137 | 137 | $handle, |
| 138 | 138 | $siteId |
| 139 | 139 | ) { |
| 140 | 140 | Craft::info( |
| 141 | - 'Sitemap Custom cache miss: ' . $handle . '/' . $siteId, |
|
| 141 | + 'Sitemap Custom cache miss: '.$handle.'/'.$siteId, |
|
| 142 | 142 | __METHOD__ |
| 143 | 143 | ); |
| 144 | 144 | $lines = []; |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $handle = self::CUSTOM_HANDLE; |
| 213 | 213 | $cache = Craft::$app->getCache(); |
| 214 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 214 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 215 | 215 | Craft::info( |
| 216 | - 'Sitemap Custom cache cleared: ' . $handle, |
|
| 216 | + 'Sitemap Custom cache cleared: '.$handle, |
|
| 217 | 217 | __METHOD__ |
| 218 | 218 | ); |
| 219 | 219 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getFilename(int $groupId): string |
| 119 | 119 | { |
| 120 | - return 'sitemaps-' . $groupId . '-sitemap.xml'; |
|
| 120 | + return 'sitemaps-'.$groupId.'-sitemap.xml'; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $cacheDuration = Seomatic::$plugin->helper::isPreview() ? 1 : Seomatic::$cacheDuration; |
| 153 | 153 | |
| 154 | - return $cache->getOrSet(self::CACHE_KEY . $groupId . '.' . $siteId, function() use ($groupSiteIds, $siteId) { |
|
| 154 | + return $cache->getOrSet(self::CACHE_KEY.$groupId.'.'.$siteId, function() use ($groupSiteIds, $siteId) { |
|
| 155 | 155 | Craft::info( |
| 156 | 156 | 'Sitemap index cache miss', |
| 157 | 157 | __METHOD__ |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // Go from most specific type to least specific type |
| 101 | 101 | foreach (self::SCHEMA_TYPES as $schemaType) { |
| 102 | 102 | if (!empty($settings[$schemaType]) && ($settings[$schemaType] !== 'none')) { |
| 103 | - $result = $settings[$schemaType] . self::SCHEMA_PATH_DELIMITER . $result; |
|
| 103 | + $result = $settings[$schemaType].self::SCHEMA_PATH_DELIMITER.$result; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $description = $result['schemaTypeDescription']; |
| 133 | 133 | $description = preg_replace("`\[\[([A-z]*)\]\]`", '[$1](https://schema.org/$1)', $description); |
| 134 | 134 | $description = preg_replace('/\s+/', ' ', $description); |
| 135 | - $description = Markdown::process((string)$description); |
|
| 135 | + $description = Markdown::process((string) $description); |
|
| 136 | 136 | $description = str_replace(['<p>', '</p>', '\n'], ['', '', ' '], $description); |
| 137 | 137 | $result['schemaTypeDescription'] = $description; |
| 138 | 138 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $result = []; |
| 154 | 154 | while ($schemaType) { |
| 155 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType; |
|
| 155 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType; |
|
| 156 | 156 | if (class_exists($className)) { |
| 157 | 157 | $classRef = new ReflectionClass($className); |
| 158 | 158 | $staticProps = $classRef->getStaticProperties(); |
@@ -249,15 +249,15 @@ discard block |
||
| 249 | 249 | $dependency = new TagDependency([ |
| 250 | 250 | 'tags' => [ |
| 251 | 251 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 252 | - self::SCHEMA_CACHE_TAG . 'schemaArray', |
|
| 252 | + self::SCHEMA_CACHE_TAG.'schemaArray', |
|
| 253 | 253 | ], |
| 254 | 254 | ]); |
| 255 | 255 | $cache = Craft::$app->getCache(); |
| 256 | 256 | $typesArray = $cache->getOrSet( |
| 257 | - self::CACHE_KEY . 'schemaArray', |
|
| 257 | + self::CACHE_KEY.'schemaArray', |
|
| 258 | 258 | function() use ($path) { |
| 259 | 259 | Craft::info( |
| 260 | - 'schemaArray cache miss' . $path, |
|
| 260 | + 'schemaArray cache miss'.$path, |
|
| 261 | 261 | __METHOD__ |
| 262 | 262 | ); |
| 263 | 263 | $filePath = Craft::getAlias('@nystudio107/seomatic/resources/schema/tree.jsonld'); |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | $dependency = new TagDependency([ |
| 323 | 323 | 'tags' => [ |
| 324 | 324 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 325 | - self::SCHEMA_CACHE_TAG . 'schemaTree', |
|
| 325 | + self::SCHEMA_CACHE_TAG.'schemaTree', |
|
| 326 | 326 | ], |
| 327 | 327 | ]); |
| 328 | 328 | $cache = Craft::$app->getCache(); |
| 329 | 329 | $typesArray = $cache->getOrSet( |
| 330 | - self::CACHE_KEY . 'schemaTree', |
|
| 330 | + self::CACHE_KEY.'schemaTree', |
|
| 331 | 331 | function() { |
| 332 | 332 | Craft::info( |
| 333 | 333 | 'schemaArray cache miss', |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | foreach ($typesArray as $key => $value) { |
| 392 | 392 | $indent = html_entity_decode(str_repeat(' ', $indentLevel)); |
| 393 | 393 | if (is_array($value)) { |
| 394 | - $result[$key] = $indent . $key; |
|
| 394 | + $result[$key] = $indent.$key; |
|
| 395 | 395 | $value = self::flattenSchemaArray($value, $indentLevel + self::MENU_INDENT_STEP); |
| 396 | 396 | $result = array_merge($result, $value); |
| 397 | 397 | } else { |
| 398 | - $result[$key] = $indent . $value; |
|
| 398 | + $result[$key] = $indent.$value; |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $children = []; |
| 490 | 490 | $name = $typesArray['name']; |
| 491 | 491 | // Construct a path-based $id, excluding the top-level `Thing` schema |
| 492 | - $id = $name === 'Thing' ? '' : $path . self::SCHEMA_PATH_DELIMITER . $name; |
|
| 492 | + $id = $name === 'Thing' ? '' : $path.self::SCHEMA_PATH_DELIMITER.$name; |
|
| 493 | 493 | $id = ltrim($id, self::SCHEMA_PATH_DELIMITER); |
| 494 | 494 | // Make sure we have at most 3 specifiers in the schema path |
| 495 | 495 | $parts = explode(self::SCHEMA_PATH_DELIMITER, $id); |
@@ -516,12 +516,12 @@ discard block |
||
| 516 | 516 | $schemaPath = explode(self::SCHEMA_PATH_DELIMITER, $id); |
| 517 | 517 | // Use only the specific (last) type for now, rather than the complete path of types |
| 518 | 518 | $schemaPath = [end($schemaPath)]; |
| 519 | - if ((bool)array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 520 | - $name .= ' (' . Craft::t('seomatic', 'Google rich result') . ')'; |
|
| 519 | + if ((bool) array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 520 | + $name .= ' ('.Craft::t('seomatic', 'Google rich result').')'; |
|
| 521 | 521 | } |
| 522 | 522 | // Mark it as pending, if applicable |
| 523 | 523 | if (isset($typesArray['pending']) && $typesArray['pending']) { |
| 524 | - $name .= ' (' . Craft::t('seomatic', 'pending') . ')'; |
|
| 524 | + $name .= ' ('.Craft::t('seomatic', 'pending').')'; |
|
| 525 | 525 | } |
| 526 | 526 | $result['label'] = $name; |
| 527 | 527 | $result['id'] = $id; |
@@ -540,12 +540,12 @@ discard block |
||
| 540 | 540 | $dependency = new TagDependency([ |
| 541 | 541 | 'tags' => [ |
| 542 | 542 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 543 | - self::SCHEMA_CACHE_TAG . 'googleRichSnippets', |
|
| 543 | + self::SCHEMA_CACHE_TAG.'googleRichSnippets', |
|
| 544 | 544 | ], |
| 545 | 545 | ]); |
| 546 | 546 | $cache = Craft::$app->getCache(); |
| 547 | 547 | return $cache->getOrSet( |
| 548 | - self::CACHE_KEY . 'googleRichSnippets', |
|
| 548 | + self::CACHE_KEY.'googleRichSnippets', |
|
| 549 | 549 | function() { |
| 550 | 550 | Craft::info( |
| 551 | 551 | 'googleRichSnippets cache miss', |
@@ -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; |
@@ -591,14 +591,14 @@ discard block |
||
| 591 | 591 | $element = $e->sender; |
| 592 | 592 | if ($element->uri !== null) { |
| 593 | 593 | $e->previewTargets[] = [ |
| 594 | - 'label' => ' |
|