@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | string $sourceBundleType, |
509 | 509 | string $sourceHandle, |
510 | 510 | string $siteHandle = null, |
511 | - $typeId = null, |
|
512 | - $loadFromSiteHandle = null, |
|
511 | + $typeId = null, |
|
512 | + $loadFromSiteHandle = null, |
|
513 | 513 | ): Response { |
514 | 514 | $variables = []; |
515 | 515 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | string $sourceHandle, |
1223 | 1223 | string $groupName, |
1224 | 1224 | array &$variables, |
1225 | - $typeId = null, |
|
1225 | + $typeId = null, |
|
1226 | 1226 | ) { |
1227 | 1227 | $variables['textFieldSources'] = array_merge( |
1228 | 1228 | ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
@@ -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 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
469 | 469 | $variables['title'] = $templateTitle; |
470 | 470 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
471 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
471 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
472 | 472 | $variables['crumbs'] = [ |
473 | 473 | [ |
474 | 474 | 'label' => $pluginName, |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | ], |
477 | 477 | [ |
478 | 478 | 'label' => $templateTitle, |
479 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
479 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
480 | 480 | ], |
481 | 481 | ]; |
482 | 482 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | // Get the site to edit |
517 | 517 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
518 | 518 | if (is_string($typeId)) { |
519 | - $typeId = (int)$typeId; |
|
519 | + $typeId = (int) $typeId; |
|
520 | 520 | } |
521 | 521 | // Get the (entry) type menu |
522 | 522 | $typeMenu = []; |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $currentType = reset($typeMenu); |
531 | 531 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
532 | 532 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
533 | - $typeId = (int)$variables['currentTypeId']; |
|
533 | + $typeId = (int) $variables['currentTypeId']; |
|
534 | 534 | } |
535 | 535 | $pluginName = Seomatic::$settings->pluginName; |
536 | 536 | // Asset bundle |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | // Get the site to copy the settings from, if any |
552 | 552 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
553 | 553 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
554 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
554 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
555 | 555 | // Load the metabundle |
556 | 556 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
557 | 557 | $sourceBundleType, |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $variables['title'] = $templateTitle; |
578 | 578 | $variables['subSectionTitle'] = $subSectionTitle; |
579 | 579 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
580 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
580 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
581 | 581 | $variables['siteHandleUri'] = $siteHandleUri; |
582 | 582 | $variables['crumbs'] = [ |
583 | 583 | [ |
@@ -586,10 +586,10 @@ discard block |
||
586 | 586 | ], |
587 | 587 | [ |
588 | 588 | 'label' => 'Content SEO', |
589 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
589 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
590 | 590 | ], |
591 | 591 | [ |
592 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
592 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
593 | 593 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
594 | 594 | ], |
595 | 595 | ]; |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | // Preview the meta containers |
620 | 620 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
621 | 621 | $uri, |
622 | - (int)$variables['currentSiteId'], |
|
622 | + (int) $variables['currentSiteId'], |
|
623 | 623 | false, |
624 | 624 | false |
625 | 625 | ); |
626 | 626 | |
627 | 627 | // Render the template |
628 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
628 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | /** |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $bundleSettings = $request->getParam('metaBundleSettings'); |
646 | 646 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
647 | 647 | if (is_string($typeId)) { |
648 | - $typeId = (int)$typeId; |
|
648 | + $typeId = (int) $typeId; |
|
649 | 649 | } |
650 | 650 | // Set the element type in the template |
651 | 651 | $elementName = ''; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | if ($subSection === 'social') { |
711 | 711 | $subSectionSuffix = ' Media'; |
712 | 712 | } |
713 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
713 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
714 | 714 | // Asset bundle |
715 | 715 | try { |
716 | 716 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $variables['title'] = $templateTitle; |
729 | 729 | $variables['subSectionTitle'] = $subSectionTitle; |
730 | 730 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
731 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
731 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
732 | 732 | $variables['crumbs'] = [ |
733 | 733 | [ |
734 | 734 | 'label' => $pluginName, |
@@ -736,11 +736,11 @@ discard block |
||
736 | 736 | ], |
737 | 737 | [ |
738 | 738 | 'label' => $templateTitle, |
739 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
739 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
740 | 740 | ], |
741 | 741 | [ |
742 | 742 | 'label' => $subSectionTitle, |
743 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
743 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
744 | 744 | ], |
745 | 745 | ]; |
746 | 746 | $variables['selectedSubnavItem'] = 'site'; |
@@ -748,14 +748,14 @@ discard block |
||
748 | 748 | |
749 | 749 | // Enabled sites |
750 | 750 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
751 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
751 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
752 | 752 | |
753 | 753 | // The site settings for the appropriate meta bundle |
754 | 754 | Seomatic::$previewingMetaContainers = true; |
755 | 755 | // Get the site to copy the settings from, if any |
756 | 756 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
757 | 757 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
758 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
758 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
759 | 759 | // Load the metabundle |
760 | 760 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
761 | 761 | Seomatic::$previewingMetaContainers = false; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $variables['elementType'] = Asset::class; |
774 | 774 | |
775 | 775 | // Render the template |
776 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
776 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
905 | 905 | // Enabled sites |
906 | 906 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
907 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
907 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
908 | 908 | $variables['currentSubSection'] = $subSection; |
909 | 909 | |
910 | 910 | // The script meta containers for the global meta bundle |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | // Get the site to copy the settings from, if any |
913 | 913 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
914 | 914 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
915 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
915 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
916 | 916 | // Load the metabundle |
917 | 917 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
918 | 918 | if ($editedMetaBundle) { |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | $variables['title'] = $templateTitle; |
953 | 953 | $variables['subSectionTitle'] = $subSectionTitle; |
954 | 954 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
955 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
955 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
956 | 956 | $variables['crumbs'] = [ |
957 | 957 | [ |
958 | 958 | 'label' => $pluginName, |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | ], |
965 | 965 | [ |
966 | 966 | 'label' => $subSectionTitle, |
967 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
967 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
968 | 968 | ], |
969 | 969 | ]; |
970 | 970 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | if ($siteHandle !== null) { |
1102 | 1102 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1103 | 1103 | if (!$site) { |
1104 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1104 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1105 | 1105 | } |
1106 | 1106 | $siteId = $site->id; |
1107 | 1107 | } else { |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | if (!empty($variables['enabledSiteIds'])) { |
1139 | 1139 | $siteId = reset($variables['enabledSiteIds']); |
1140 | 1140 | } else { |
1141 | - $this->requirePermission('editSite:' . $siteId); |
|
1141 | + $this->requirePermission('editSite:'.$siteId); |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | if ($variables['showSites']) { |
1159 | 1159 | $variables['sitesMenuLabel'] = Craft::t( |
1160 | 1160 | 'site', |
1161 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1161 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1162 | 1162 | ); |
1163 | 1163 | } else { |
1164 | 1164 | $variables['sitesMenuLabel'] = ''; |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | $typeId = null, |
1226 | 1226 | ) { |
1227 | 1227 | $variables['textFieldSources'] = array_merge( |
1228 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1228 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1229 | 1229 | FieldHelper::fieldsOfTypeFromSource( |
1230 | 1230 | $sourceBundleType, |
1231 | 1231 | $sourceHandle, |
@@ -1235,7 +1235,7 @@ discard block |
||
1235 | 1235 | ) |
1236 | 1236 | ); |
1237 | 1237 | $variables['assetFieldSources'] = array_merge( |
1238 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1238 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1239 | 1239 | FieldHelper::fieldsOfTypeFromSource( |
1240 | 1240 | $sourceBundleType, |
1241 | 1241 | $sourceHandle, |
@@ -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 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | public function getMetaBundleBySourceId(string $sourceBundleType, int $sourceId, ?int $sourceSiteId, $typeId = null) |
562 | 562 | { |
563 | 563 | $metaBundle = null; |
564 | - $typeId = (int)$typeId; |
|
564 | + $typeId = (int) $typeId; |
|
565 | 565 | // See if we have the meta bundle cached |
566 | 566 | if (!empty($this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId])) { |
567 | 567 | $id = $this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId]; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | ->from(['{{%seomatic_metabundles}}']) |
754 | 754 | ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE]); |
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]); |
@@ -812,10 +812,10 @@ discard block |
||
812 | 812 | $seoSettingsField = Craft::$app->getFields()->getFieldByHandle($fieldHandle); |
813 | 813 | if ($seoSettingsField) { |
814 | 814 | $seoSettingsEnabledFields = array_flip(array_merge( |
815 | - (array)$seoSettingsField->generalEnabledFields, |
|
816 | - (array)$seoSettingsField->twitterEnabledFields, |
|
817 | - (array)$seoSettingsField->facebookEnabledFields, |
|
818 | - (array)$seoSettingsField->sitemapEnabledFields |
|
815 | + (array) $seoSettingsField->generalEnabledFields, |
|
816 | + (array) $seoSettingsField->twitterEnabledFields, |
|
817 | + (array) $seoSettingsField->facebookEnabledFields, |
|
818 | + (array) $seoSettingsField->sitemapEnabledFields |
|
819 | 819 | )); |
820 | 820 | // Always include some fields, as they are calculated even if not explicitly included |
821 | 821 | $seoSettingsEnabledFields = array_merge( |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | |
844 | 844 | |
845 | 845 | // Handle the mainEntityOfPage |
846 | - if (!in_array('mainEntityOfPage', (array)$seoSettingsField->generalEnabledFields, false)) { |
|
846 | + if (!in_array('mainEntityOfPage', (array) $seoSettingsField->generalEnabledFields, false)) { |
|
847 | 847 | $metaBundle->metaGlobalVars->mainEntityOfPage = ''; |
848 | 848 | } |
849 | 849 | // metaSiteVars |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $siteUrl = MetaValue::parseString($siteUrl); |
47 | 47 | // Extract out just the path part |
48 | 48 | $parts = self::decomposeUrl($path); |
49 | - $path = $parts['path'] . $parts['suffix']; |
|
49 | + $path = $parts['path'].$parts['suffix']; |
|
50 | 50 | $url = self::mergeUrlWithPath($siteUrl, $path); |
51 | 51 | // Handle trailing slashes properly for generated URLs |
52 | 52 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
53 | 53 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
54 | - $url = rtrim($url, '/') . '/'; |
|
54 | + $url = rtrim($url, '/').'/'; |
|
55 | 55 | } |
56 | 56 | if (!$generalConfig->addTrailingSlashesToUrls) { |
57 | 57 | $url = rtrim($url, '/'); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | public static function mergeUrlWithPath(string $url, string $path): string |
74 | 74 | { |
75 | 75 | $overlap = 0; |
76 | - $url = rtrim($url, '/') . '/'; |
|
77 | - $path = '/' . ltrim($path, '/'); |
|
76 | + $url = rtrim($url, '/').'/'; |
|
77 | + $path = '/'.ltrim($path, '/'); |
|
78 | 78 | $urlOffset = strlen($url); |
79 | 79 | $pathLength = strlen($path); |
80 | 80 | $pathOffset = 0; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
89 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // Handle trailing slashes properly for generated URLs |
159 | 159 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
160 | 160 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
161 | - $url = rtrim($url, '/') . '/'; |
|
161 | + $url = rtrim($url, '/').'/'; |
|
162 | 162 | } |
163 | 163 | if (!$generalConfig->addTrailingSlashesToUrls && !$preserveTrailingSlash) { |
164 | 164 | $url = rtrim($url, '/'); |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | $urlParts = parse_url($url); |
179 | 179 | $encodedUrl = ""; |
180 | 180 | if (isset($urlParts['scheme'])) { |
181 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
181 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
182 | 182 | } |
183 | 183 | if (isset($urlParts['host'])) { |
184 | 184 | $encodedUrl .= $urlParts['host']; |
185 | 185 | } |
186 | 186 | if (isset($urlParts['port'])) { |
187 | - $encodedUrl .= ':' . $urlParts['port']; |
|
187 | + $encodedUrl .= ':'.$urlParts['port']; |
|
188 | 188 | } |
189 | 189 | if (isset($urlParts['path'])) { |
190 | 190 | $encodedUrl .= $urlParts['path']; |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | foreach ($query as $j => $value) { |
195 | 195 | $value = explode('=', $value, 2); |
196 | 196 | if (count($value) === 2) { |
197 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
197 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
198 | 198 | } else { |
199 | 199 | $query[$j] = urlencode($value[0]); |
200 | 200 | } |
201 | 201 | } |
202 | - $encodedUrl .= '?' . implode('&', $query); |
|
202 | + $encodedUrl .= '?'.implode('&', $query); |
|
203 | 203 | } |
204 | 204 | if (isset($urlParts['fragment'])) { |
205 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
205 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return $encodedUrl; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if ($siteId !== null) { |
243 | 243 | $site = $sites->getSiteById($siteId, true); |
244 | 244 | if (!$site) { |
245 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
245 | + throw new Exception('Invalid site ID: '.$siteId); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | |
267 | 267 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
268 | 268 | $url_parts = parse_url($pathOrUrl); |
269 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
269 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
270 | 270 | $result['path'] = $url_parts['path'] ?? ''; |
271 | 271 | $result['suffix'] = ''; |
272 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
273 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
272 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
273 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
274 | 274 | } else { |
275 | 275 | $result['prefix'] = ''; |
276 | 276 | $result['path'] = $pathOrUrl; |
@@ -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' => ' |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var bool|array |
42 | 42 | */ |
43 | - protected array|bool|int $allowAnonymous = [ |
|
43 | + protected array | bool | int $allowAnonymous = [ |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | // Public Methods |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function actionGenerate() |
66 | 66 | { |
67 | - echo 'This CLI command is no longer needed because of the paginated sitemap generation' . PHP_EOL; |
|
67 | + echo 'This CLI command is no longer needed because of the paginated sitemap generation'.PHP_EOL; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Protected Methods |