@@ -388,7 +388,7 @@ |
||
388 | 388 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
389 | 389 | [ |
390 | 390 | 'sourceId' => $sourceModel->id, |
391 | - 'sourceName' => (string)$sourceModel->name, |
|
391 | + 'sourceName' => (string) $sourceModel->name, |
|
392 | 392 | 'sourceHandle' => $sourceModel->handle, |
393 | 393 | ] |
394 | 394 | ); |
@@ -388,7 +388,7 @@ |
||
388 | 388 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
389 | 389 | [ |
390 | 390 | 'sourceId' => $sourceModel->id, |
391 | - 'sourceName' => (string)$sourceModel->name, |
|
391 | + 'sourceName' => (string) $sourceModel->name, |
|
392 | 392 | 'sourceHandle' => $sourceModel->handle, |
393 | 393 | ] |
394 | 394 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * @inheritdoc |
162 | 162 | */ |
163 | - public function getContentColumnType(): array|string |
|
163 | + public function getContentColumnType(): array | string |
|
164 | 164 | { |
165 | 165 | return Schema::TYPE_TEXT; |
166 | 166 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | // Handle the mainEntityOfPage |
233 | 233 | $mainEntity = ''; |
234 | - if (in_array('mainEntityOfPage', (array)$this->generalEnabledFields, false) && |
|
234 | + if (in_array('mainEntityOfPage', (array) $this->generalEnabledFields, false) && |
|
235 | 235 | !empty($config['metaBundleSettings'])) { |
236 | 236 | $mainEntity = SchemaHelper::getSpecificEntityType($config['metaBundleSettings'], true); |
237 | 237 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if ($element !== null && $element->uri !== null) { |
386 | 386 | $siteId = $element->siteId; |
387 | 387 | $uri = $element->uri; |
388 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
388 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
389 | 389 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
390 | 390 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
391 | 391 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | $dependency = new TagDependency([ |
397 | 397 | 'tags' => [ |
398 | 398 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
399 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
400 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
399 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
400 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
401 | 401 | ], |
402 | 402 | ]); |
403 | 403 | $cache = Craft::$app->getCache(); |
404 | 404 | $cacheDuration = null; |
405 | 405 | $html = $cache->getOrSet( |
406 | - self::CACHE_KEY . $cacheKey, |
|
406 | + self::CACHE_KEY.$cacheKey, |
|
407 | 407 | function() use ($uri, $siteId, $element) { |
408 | 408 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true); |
409 | 409 | $variables = [ |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | array &$variables, |
446 | 446 | ) { |
447 | 447 | $variables['textFieldSources'] = array_merge( |
448 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
448 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
449 | 449 | FieldHelper::fieldsOfTypeFromElement( |
450 | 450 | $element, |
451 | 451 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | ) |
454 | 454 | ); |
455 | 455 | $variables['assetFieldSources'] = array_merge( |
456 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
456 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
457 | 457 | FieldHelper::fieldsOfTypeFromElement( |
458 | 458 | $element, |
459 | 459 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -502,8 +502,8 @@ |
||
502 | 502 | string $sourceBundleType, |
503 | 503 | string $sourceHandle, |
504 | 504 | string $siteHandle = null, |
505 | - $typeId = null, |
|
506 | - $loadFromSiteHandle = null, |
|
505 | + $typeId = null, |
|
506 | + $loadFromSiteHandle = null, |
|
507 | 507 | ): Response { |
508 | 508 | $variables = []; |
509 | 509 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @inheritdoc |
89 | 89 | */ |
90 | - protected array|bool|int $allowAnonymous = [ |
|
90 | + protected array | bool | int $allowAnonymous = [ |
|
91 | 91 | ]; |
92 | 92 | |
93 | 93 | // Public Methods |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
131 | 131 | $variables['title'] = $templateTitle; |
132 | 132 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
133 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
133 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
134 | 134 | $variables['crumbs'] = [ |
135 | 135 | [ |
136 | 136 | 'label' => $pluginName, |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ], |
139 | 139 | [ |
140 | 140 | 'label' => $templateTitle, |
141 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
141 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
142 | 142 | ], |
143 | 143 | ]; |
144 | 144 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | foreach ($variables['metaBundles'] as $metaBundle) { |
162 | 162 | $stat = 0; |
163 | 163 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
164 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
164 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
165 | 165 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
166 | 166 | $variables['contentSetupChecklist'][$setupField] = [ |
167 | 167 | 'label' => $setupLabel, |
168 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
168 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
169 | 169 | ]; |
170 | 170 | } |
171 | 171 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | } |
177 | 177 | // Global SEO grades |
178 | 178 | Seomatic::$previewingMetaContainers = true; |
179 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
179 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
180 | 180 | Seomatic::$previewingMetaContainers = false; |
181 | 181 | if ($metaBundle !== null) { |
182 | 182 | $stat = 0; |
183 | 183 | $variables['globalSetupChecklist'] = []; |
184 | 184 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
185 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
185 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
186 | 186 | $variables['globalSetupChecklist'][$setupField] = [ |
187 | 187 | 'label' => $setupLabel, |
188 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
188 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
189 | 189 | ]; |
190 | 190 | } |
191 | 191 | $stat = round(($stat / $numFields) * 100); |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $stat = 0; |
196 | 196 | $variables['siteSetupChecklist'] = []; |
197 | 197 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
198 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
198 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
199 | 199 | $variables['siteSetupChecklist'][$setupField] = [ |
200 | 200 | 'label' => $setupLabel, |
201 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
201 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
202 | 202 | ]; |
203 | 203 | } |
204 | 204 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
205 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
205 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
206 | 206 | $variables['siteSetupChecklist'][$setupField] = [ |
207 | 207 | 'label' => $setupLabel, |
208 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
208 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
209 | 209 | ]; |
210 | 210 | } |
211 | 211 | $stat = round(($stat / $numFields) * 100); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $variables['title'] = $templateTitle; |
253 | 253 | $variables['subSectionTitle'] = $subSectionTitle; |
254 | 254 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
255 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
255 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
256 | 256 | $variables['crumbs'] = [ |
257 | 257 | [ |
258 | 258 | 'label' => $pluginName, |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | ], |
261 | 261 | [ |
262 | 262 | 'label' => $templateTitle, |
263 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
263 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
264 | 264 | ], |
265 | 265 | [ |
266 | 266 | 'label' => $subSectionTitle, |
267 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
267 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
268 | 268 | ], |
269 | 269 | ]; |
270 | 270 | $variables['selectedSubnavItem'] = 'global'; |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $this->setGlobalFieldSourceVariables($variables); |
273 | 273 | // Enabled sites |
274 | 274 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
275 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
275 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
276 | 276 | $variables['currentSubSection'] = $subSection; |
277 | 277 | // Meta bundle settings |
278 | 278 | Seomatic::$previewingMetaContainers = true; |
279 | 279 | // Get the site to copy the settings from, if any |
280 | 280 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
281 | 281 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
282 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
282 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
283 | 283 | // Load the metabundle |
284 | 284 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
285 | 285 | if ($editedMetaBundle) { |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | // Preview the meta containers |
334 | 334 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
335 | 335 | MetaBundles::GLOBAL_META_BUNDLE, |
336 | - (int)$variables['currentSiteId'] |
|
336 | + (int) $variables['currentSiteId'] |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | // Render the template |
340 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
340 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
463 | 463 | $variables['title'] = $templateTitle; |
464 | 464 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
465 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
465 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
466 | 466 | $variables['crumbs'] = [ |
467 | 467 | [ |
468 | 468 | 'label' => $pluginName, |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | ], |
471 | 471 | [ |
472 | 472 | 'label' => $templateTitle, |
473 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
473 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
474 | 474 | ], |
475 | 475 | ]; |
476 | 476 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | // Get the site to edit |
511 | 511 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
512 | 512 | if ($typeId !== null && is_string($typeId)) { |
513 | - $typeId = (int)$typeId; |
|
513 | + $typeId = (int) $typeId; |
|
514 | 514 | } |
515 | 515 | // Get the (entry) type menu |
516 | 516 | $typeMenu = []; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $currentType = reset($typeMenu); |
525 | 525 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
526 | 526 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
527 | - $typeId = (int)$variables['currentTypeId']; |
|
527 | + $typeId = (int) $variables['currentTypeId']; |
|
528 | 528 | } |
529 | 529 | $pluginName = Seomatic::$settings->pluginName; |
530 | 530 | // Asset bundle |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | // Get the site to copy the settings from, if any |
546 | 546 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
547 | 547 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
548 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
548 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
549 | 549 | // Load the metabundle |
550 | 550 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
551 | 551 | $sourceBundleType, |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $variables['title'] = $templateTitle; |
572 | 572 | $variables['subSectionTitle'] = $subSectionTitle; |
573 | 573 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
574 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
574 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
575 | 575 | $variables['siteHandleUri'] = $siteHandleUri; |
576 | 576 | $variables['crumbs'] = [ |
577 | 577 | [ |
@@ -580,10 +580,10 @@ discard block |
||
580 | 580 | ], |
581 | 581 | [ |
582 | 582 | 'label' => 'Content SEO', |
583 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
583 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
584 | 584 | ], |
585 | 585 | [ |
586 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
586 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
587 | 587 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
588 | 588 | ], |
589 | 589 | ]; |
@@ -613,13 +613,13 @@ discard block |
||
613 | 613 | // Preview the meta containers |
614 | 614 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
615 | 615 | $uri, |
616 | - (int)$variables['currentSiteId'], |
|
616 | + (int) $variables['currentSiteId'], |
|
617 | 617 | false, |
618 | 618 | false |
619 | 619 | ); |
620 | 620 | |
621 | 621 | // Render the template |
622 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
622 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | if ($subSection === 'social') { |
702 | 702 | $subSectionSuffix = ' Media'; |
703 | 703 | } |
704 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
704 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
705 | 705 | // Asset bundle |
706 | 706 | try { |
707 | 707 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | $variables['title'] = $templateTitle; |
720 | 720 | $variables['subSectionTitle'] = $subSectionTitle; |
721 | 721 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
722 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
722 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
723 | 723 | $variables['crumbs'] = [ |
724 | 724 | [ |
725 | 725 | 'label' => $pluginName, |
@@ -727,11 +727,11 @@ discard block |
||
727 | 727 | ], |
728 | 728 | [ |
729 | 729 | 'label' => $templateTitle, |
730 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
730 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
731 | 731 | ], |
732 | 732 | [ |
733 | 733 | 'label' => $subSectionTitle, |
734 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
734 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
735 | 735 | ], |
736 | 736 | ]; |
737 | 737 | $variables['selectedSubnavItem'] = 'site'; |
@@ -739,14 +739,14 @@ discard block |
||
739 | 739 | |
740 | 740 | // Enabled sites |
741 | 741 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
742 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
742 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
743 | 743 | |
744 | 744 | // The site settings for the appropriate meta bundle |
745 | 745 | Seomatic::$previewingMetaContainers = true; |
746 | 746 | // Get the site to copy the settings from, if any |
747 | 747 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
748 | 748 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
749 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
749 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
750 | 750 | // Load the metabundle |
751 | 751 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
752 | 752 | Seomatic::$previewingMetaContainers = false; |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $variables['elementType'] = Asset::class; |
765 | 765 | |
766 | 766 | // Render the template |
767 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
767 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
894 | 894 | // Enabled sites |
895 | 895 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
896 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
896 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
897 | 897 | $variables['currentSubSection'] = $subSection; |
898 | 898 | |
899 | 899 | // The script meta containers for the global meta bundle |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | // Get the site to copy the settings from, if any |
902 | 902 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
903 | 903 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
904 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
904 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
905 | 905 | // Load the metabundle |
906 | 906 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
907 | 907 | if ($editedMetaBundle) { |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | $variables['title'] = $templateTitle; |
942 | 942 | $variables['subSectionTitle'] = $subSectionTitle; |
943 | 943 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
944 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
944 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
945 | 945 | $variables['crumbs'] = [ |
946 | 946 | [ |
947 | 947 | 'label' => $pluginName, |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | ], |
954 | 954 | [ |
955 | 955 | 'label' => $subSectionTitle, |
956 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
956 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
957 | 957 | ], |
958 | 958 | ]; |
959 | 959 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | if ($siteHandle !== null) { |
1087 | 1087 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1088 | 1088 | if (!$site) { |
1089 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1089 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1090 | 1090 | } |
1091 | 1091 | $siteId = $site->id; |
1092 | 1092 | } else { |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | if (!empty($variables['enabledSiteIds'])) { |
1124 | 1124 | $siteId = reset($variables['enabledSiteIds']); |
1125 | 1125 | } else { |
1126 | - $this->requirePermission('editSite:' . $siteId); |
|
1126 | + $this->requirePermission('editSite:'.$siteId); |
|
1127 | 1127 | } |
1128 | 1128 | } |
1129 | 1129 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | if ($variables['showSites']) { |
1144 | 1144 | $variables['sitesMenuLabel'] = Craft::t( |
1145 | 1145 | 'site', |
1146 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1146 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1147 | 1147 | ); |
1148 | 1148 | } else { |
1149 | 1149 | $variables['sitesMenuLabel'] = ''; |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | array &$variables, |
1209 | 1209 | ) { |
1210 | 1210 | $variables['textFieldSources'] = array_merge( |
1211 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1211 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1212 | 1212 | FieldHelper::fieldsOfTypeFromSource( |
1213 | 1213 | $sourceBundleType, |
1214 | 1214 | $sourceHandle, |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | ) |
1218 | 1218 | ); |
1219 | 1219 | $variables['assetFieldSources'] = array_merge( |
1220 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1220 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1221 | 1221 | FieldHelper::fieldsOfTypeFromSource( |
1222 | 1222 | $sourceBundleType, |
1223 | 1223 | $sourceHandle, |
@@ -66,8 +66,8 @@ |
||
66 | 66 | string $sort = 'sourceName|asc', |
67 | 67 | int $page = 1, |
68 | 68 | int $per_page = 20, |
69 | - $filter = '', |
|
70 | - $siteId = 0, |
|
69 | + $filter = '', |
|
70 | + $siteId = 0, |
|
71 | 71 | ): Response { |
72 | 72 | $data = []; |
73 | 73 | $sortField = 'sourceName'; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @inheritdoc |
47 | 47 | */ |
48 | - protected array|bool|int $allowAnonymous = [ |
|
48 | + protected array | bool | int $allowAnonymous = [ |
|
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // Public Methods |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Query the db table |
100 | 100 | $offset = ($page - 1) * $per_page; |
101 | 101 | $currentSiteHandle = ''; |
102 | - if ((int)$siteId !== 0) { |
|
102 | + if ((int) $siteId !== 0) { |
|
103 | 103 | $site = Craft::$app->getSites()->getSiteById($siteId); |
104 | 104 | if ($site !== null) { |
105 | 105 | $currentSiteHandle = $site->handle; |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | $numGrades = count(SettingsController::SETUP_GRADES); |
157 | 157 | $numFields = count(SettingsController::SEO_SETUP_FIELDS); |
158 | 158 | foreach (SettingsController::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
159 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
159 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
160 | 160 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
161 | 161 | $variables['contentSetupChecklist'][$setupField] = [ |
162 | 162 | 'label' => $setupLabel, |
163 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
163 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
164 | 164 | ]; |
165 | 165 | } |
166 | 166 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | array $params = [], |
74 | 74 | string $minifier = null, |
75 | 75 | ): string { |
76 | - $template = 'seomatic/' . $templatePath; |
|
76 | + $template = 'seomatic/'.$templatePath; |
|
77 | 77 | $oldMode = Craft::$app->view->getTemplateMode(); |
78 | 78 | // Look for the template on the frontend first |
79 | 79 | try { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public static function create($schemaType, array $config = []): MetaJsonLd |
120 | 120 | { |
121 | 121 | // Try the passed in $schemaType |
122 | - $className = self::SCHEMA_NAMESPACE_PREFIX . $schemaType; |
|
122 | + $className = self::SCHEMA_NAMESPACE_PREFIX.$schemaType; |
|
123 | 123 | /** @var $model MetaJsonLd */ |
124 | 124 | if (class_exists($className)) { |
125 | 125 | self::cleanProperties($className, $config); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return new $className($config); |
128 | 128 | } |
129 | 129 | // Try the prefixed $schemaType |
130 | - $className = self::SCHEMA_NAMESPACE_PREFIX . self::SCHEMA_NAME_PREFIX . $schemaType; |
|
130 | + $className = self::SCHEMA_NAMESPACE_PREFIX.self::SCHEMA_NAME_PREFIX.$schemaType; |
|
131 | 131 | /** @var $model MetaJsonLd */ |
132 | 132 | if (class_exists($className)) { |
133 | 133 | self::cleanProperties($className, $config); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | foreach ($dataToValidate as $key => $data) { |
384 | 384 | /** @var array $expectedTypes */ |
385 | 385 | foreach ($expectedTypes as $expectedType) { |
386 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $expectedType; |
|
386 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$expectedType; |
|
387 | 387 | switch ($expectedType) { |
388 | 388 | // Text always validates |
389 | 389 | case 'Text': |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | case 'Date': |
424 | 424 | $validator = new DateValidator(); |
425 | 425 | $validator->type = DateValidator::TYPE_DATE; |
426 | - $validator->format = 'php:' . DateTime::ATOM; |
|
426 | + $validator->format = 'php:'.DateTime::ATOM; |
|
427 | 427 | if ($validator->validate($data, $error)) { |
428 | 428 | $validated = true; |
429 | 429 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $validated = true; |
470 | 470 | } |
471 | 471 | if (is_string($data)) { |
472 | - $targetClass = 'nystudio107\\seomatic\\models\\jsonld\\' . $data; |
|
472 | + $targetClass = 'nystudio107\\seomatic\\models\\jsonld\\'.$data; |
|
473 | 473 | if (class_exists($targetClass)) { |
474 | 474 | $validated = true; |
475 | 475 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | if (!$validated) { |
481 | - $this->addError($attribute, 'Must be one of these types: ' . implode(', ', $expectedTypes)); |
|
481 | + $this->addError($attribute, 'Must be one of these types: '.implode(', ', $expectedTypes)); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if ($width === null) { |
198 | 198 | $width = ''; |
199 | 199 | } |
200 | - $width = (string)$width; |
|
200 | + $width = (string) $width; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return $width; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | if ($height === null) { |
230 | 230 | $height = ''; |
231 | 231 | } |
232 | - $height = (string)$height; |
|
232 | + $height = (string) $height; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | return $height; |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | if (is_array($assetIds)) { |
252 | 252 | foreach ($assetIds as $assetId) { |
253 | 253 | if (!empty($assetId)) { |
254 | - $assets[] = $elements->getElementById((int)$assetId, Asset::class, $siteId); |
|
254 | + $assets[] = $elements->getElementById((int) $assetId, Asset::class, $siteId); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } else { |
258 | 258 | $assetId = $assetIds; |
259 | - $assets[] = $elements->getElementById((int)$assetId, Asset::class, $siteId); |
|
259 | + $assets[] = $elements->getElementById((int) $assetId, Asset::class, $siteId); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | return $asset->one(); |
293 | 293 | } |
294 | 294 | |
295 | - $resolvedAssetId = (int)$asset; |
|
295 | + $resolvedAssetId = (int) $asset; |
|
296 | 296 | $resolvedSiteId = $siteId ?? 0; |
297 | 297 | if (isset(self::$cachedAssetsElements[$resolvedAssetId][$resolvedSiteId])) { |
298 | 298 | return self::$cachedAssetsElements[$resolvedAssetId][$resolvedSiteId]; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $foundFields = []; |
126 | 126 | if (!empty(self::FIELD_CLASSES[$fieldClassKey])) { |
127 | 127 | // Cache me if you can |
128 | - $memoKey = $fieldClassKey . $layout->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
128 | + $memoKey = $fieldClassKey.$layout->id.($keysOnly ? 'keys' : 'nokeys'); |
|
129 | 129 | if (!empty(self::$fieldsOfTypeFromLayoutCache[$memoKey])) { |
130 | 130 | return self::$fieldsOfTypeFromLayoutCache[$memoKey]; |
131 | 131 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $prefix = $global->handle; |
243 | 243 | $fields = array_combine( |
244 | 244 | array_map(function($key) use ($prefix) { |
245 | - return $prefix . '.' . $key; |
|
245 | + return $prefix.'.'.$key; |
|
246 | 246 | }, array_keys($fields)), |
247 | 247 | $fields |
248 | 248 | ); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | if ($matrixBlockTypeModel) { |
318 | 318 | // Cache me if you can |
319 | - $memoKey = $fieldType . $matrixBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
319 | + $memoKey = $fieldType.$matrixBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
320 | 320 | if (!empty(self::$matrixFieldsOfTypeCache[$memoKey])) { |
321 | 321 | return self::$matrixFieldsOfTypeCache[$memoKey]; |
322 | 322 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $layout = $neoBlock->getFieldLayout(); |
356 | 356 | if ($layout) { |
357 | 357 | // Cache me if you can |
358 | - $memoKey = $fieldType . $neoBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
358 | + $memoKey = $fieldType.$neoBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
359 | 359 | if (!empty(self::$neoFieldsOfTypeCache[$memoKey])) { |
360 | 360 | return self::$neoFieldsOfTypeCache[$memoKey]; |
361 | 361 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | } |
399 | 399 | if ($superTableBlockTypeModel) { |
400 | 400 | // Cache me if you can |
401 | - $memoKey = $fieldType . $superTableBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
401 | + $memoKey = $fieldType.$superTableBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
402 | 402 | if (!empty(self::$superTableFieldsOfTypeCache[$memoKey])) { |
403 | 403 | return self::$superTableFieldsOfTypeCache[$memoKey]; |
404 | 404 | } |