@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * @inheritdoc |
92 | 92 | */ |
93 | - protected array|bool|int $allowAnonymous = [ |
|
93 | + protected array | bool | int $allowAnonymous = [ |
|
94 | 94 | ]; |
95 | 95 | |
96 | 96 | // Public Methods |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
135 | 135 | $variables['title'] = $templateTitle; |
136 | 136 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
137 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
137 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
138 | 138 | $variables['crumbs'] = [ |
139 | 139 | [ |
140 | 140 | 'label' => $pluginName, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ], |
143 | 143 | [ |
144 | 144 | 'label' => $templateTitle, |
145 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
145 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
146 | 146 | ], |
147 | 147 | ]; |
148 | 148 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | foreach ($variables['metaBundles'] as $metaBundle) { |
166 | 166 | $stat = 0; |
167 | 167 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
168 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
168 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
169 | 169 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
170 | 170 | $variables['contentSetupChecklist'][$setupField] = [ |
171 | 171 | 'label' => $setupLabel, |
172 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
172 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
173 | 173 | ]; |
174 | 174 | } |
175 | 175 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | } |
181 | 181 | // Global SEO grades |
182 | 182 | Seomatic::$previewingMetaContainers = true; |
183 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
183 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
184 | 184 | Seomatic::$previewingMetaContainers = false; |
185 | 185 | if ($metaBundle !== null) { |
186 | 186 | $stat = 0; |
187 | 187 | $variables['globalSetupChecklist'] = []; |
188 | 188 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
189 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
189 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
190 | 190 | $variables['globalSetupChecklist'][$setupField] = [ |
191 | 191 | 'label' => $setupLabel, |
192 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
192 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
193 | 193 | ]; |
194 | 194 | } |
195 | 195 | $stat = round(($stat / $numFields) * 100); |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $stat = 0; |
200 | 200 | $variables['siteSetupChecklist'] = []; |
201 | 201 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
202 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
202 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
203 | 203 | $variables['siteSetupChecklist'][$setupField] = [ |
204 | 204 | 'label' => $setupLabel, |
205 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
205 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
206 | 206 | ]; |
207 | 207 | } |
208 | 208 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
209 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
209 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
210 | 210 | $variables['siteSetupChecklist'][$setupField] = [ |
211 | 211 | 'label' => $setupLabel, |
212 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
212 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
213 | 213 | ]; |
214 | 214 | } |
215 | 215 | $stat = round(($stat / $numFields) * 100); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $variables['title'] = $templateTitle; |
259 | 259 | $variables['subSectionTitle'] = $subSectionTitle; |
260 | 260 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
261 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
261 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
262 | 262 | $variables['crumbs'] = [ |
263 | 263 | [ |
264 | 264 | 'label' => $pluginName, |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | ], |
267 | 267 | [ |
268 | 268 | 'label' => $templateTitle, |
269 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
269 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
270 | 270 | ], |
271 | 271 | [ |
272 | 272 | 'label' => $subSectionTitle, |
273 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
273 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
274 | 274 | ], |
275 | 275 | ]; |
276 | 276 | $variables['selectedSubnavItem'] = 'global'; |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | $this->setGlobalFieldSourceVariables($variables); |
279 | 279 | // Enabled sites |
280 | 280 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
281 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
281 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
282 | 282 | $variables['currentSubSection'] = $subSection; |
283 | 283 | // Meta bundle settings |
284 | 284 | Seomatic::$previewingMetaContainers = true; |
285 | 285 | // Get the site to copy the settings from, if any |
286 | 286 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
287 | 287 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
288 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
288 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
289 | 289 | // Load the metabundle |
290 | 290 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
291 | 291 | if ($editedMetaBundle) { |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | // Preview the meta containers |
340 | 340 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
341 | 341 | MetaBundles::GLOBAL_META_BUNDLE, |
342 | - (int)$variables['currentSiteId'] |
|
342 | + (int) $variables['currentSiteId'] |
|
343 | 343 | ); |
344 | 344 | |
345 | 345 | $this->setCrumbVariables($variables); |
346 | 346 | |
347 | 347 | // Render the template |
348 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
348 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
478 | 478 | $variables['title'] = $templateTitle; |
479 | 479 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
480 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
480 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
481 | 481 | $variables['crumbs'] = [ |
482 | 482 | [ |
483 | 483 | 'label' => $pluginName, |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | ], |
486 | 486 | [ |
487 | 487 | 'label' => $templateTitle, |
488 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
488 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
489 | 489 | ], |
490 | 490 | ]; |
491 | 491 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $siteHandle = $this->getCpSiteHandle($siteHandle); |
528 | 528 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
529 | 529 | if (is_string($typeId)) { |
530 | - $typeId = (int)$typeId; |
|
530 | + $typeId = (int) $typeId; |
|
531 | 531 | } |
532 | 532 | // Get the (entry) type menu |
533 | 533 | $typeMenu = []; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $currentType = reset($typeMenu); |
543 | 543 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
544 | 544 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
545 | - $typeId = (int)$variables['currentTypeId']; |
|
545 | + $typeId = (int) $variables['currentTypeId']; |
|
546 | 546 | } |
547 | 547 | // If there's only one EntryType, don't bother displaying the menu |
548 | 548 | if (count($typeMenu) === 1) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | // Get the site to copy the settings from, if any |
569 | 569 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
570 | 570 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
571 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
571 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
572 | 572 | // Load the metabundle |
573 | 573 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
574 | 574 | $sourceBundleType, |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $variables['title'] = $templateTitle; |
595 | 595 | $variables['subSectionTitle'] = $subSectionTitle; |
596 | 596 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
597 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
597 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
598 | 598 | $variables['siteHandleUri'] = $siteHandleUri; |
599 | 599 | $variables['crumbs'] = [ |
600 | 600 | [ |
@@ -603,10 +603,10 @@ discard block |
||
603 | 603 | ], |
604 | 604 | [ |
605 | 605 | 'label' => 'Content SEO', |
606 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
606 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
607 | 607 | ], |
608 | 608 | [ |
609 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
609 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
610 | 610 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/{$subSection}/{$sourceBundleType}/{$sourceHandle}"), |
611 | 611 | ], |
612 | 612 | ]; |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | // Preview the meta containers |
638 | 638 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
639 | 639 | $uri, |
640 | - (int)$variables['currentSiteId'], |
|
640 | + (int) $variables['currentSiteId'], |
|
641 | 641 | false, |
642 | 642 | false |
643 | 643 | ); |
644 | 644 | |
645 | 645 | // Render the template |
646 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
646 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | /** |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | $bundleSettings = $request->getParam('metaBundleSettings'); |
665 | 665 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
666 | 666 | if (is_string($typeId)) { |
667 | - $typeId = (int)$typeId; |
|
667 | + $typeId = (int) $typeId; |
|
668 | 668 | } |
669 | 669 | // Set the element type in the template |
670 | 670 | $elementName = ''; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | if ($subSection === 'social') { |
737 | 737 | $subSectionSuffix = ' Media'; |
738 | 738 | } |
739 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
739 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
740 | 740 | // Asset bundle |
741 | 741 | try { |
742 | 742 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | $variables['title'] = $templateTitle; |
755 | 755 | $variables['subSectionTitle'] = $subSectionTitle; |
756 | 756 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
757 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
757 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
758 | 758 | $variables['crumbs'] = [ |
759 | 759 | [ |
760 | 760 | 'label' => $pluginName, |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | ], |
763 | 763 | [ |
764 | 764 | 'label' => $templateTitle, |
765 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
765 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
766 | 766 | ], |
767 | 767 | [ |
768 | 768 | 'label' => $subSectionTitle, |
769 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
769 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
770 | 770 | ], |
771 | 771 | ]; |
772 | 772 | $variables['selectedSubnavItem'] = 'site'; |
@@ -774,14 +774,14 @@ discard block |
||
774 | 774 | |
775 | 775 | // Enabled sites |
776 | 776 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
777 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
777 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
778 | 778 | |
779 | 779 | // The site settings for the appropriate meta bundle |
780 | 780 | Seomatic::$previewingMetaContainers = true; |
781 | 781 | // Get the site to copy the settings from, if any |
782 | 782 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
783 | 783 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
784 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
784 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
785 | 785 | // Load the metabundle |
786 | 786 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
787 | 787 | Seomatic::$previewingMetaContainers = false; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $this->setCrumbVariables($variables); |
801 | 801 | |
802 | 802 | // Render the template |
803 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
803 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
933 | 933 | // Enabled sites |
934 | 934 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
935 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
935 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
936 | 936 | $variables['currentSubSection'] = $subSection; |
937 | 937 | |
938 | 938 | // The script meta containers for the global meta bundle |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | // Get the site to copy the settings from, if any |
941 | 941 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
942 | 942 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
943 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
943 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
944 | 944 | // Load the metabundle |
945 | 945 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
946 | 946 | if ($editedMetaBundle) { |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $variables['title'] = $templateTitle; |
981 | 981 | $variables['subSectionTitle'] = $subSectionTitle; |
982 | 982 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
983 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
983 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
984 | 984 | $variables['crumbs'] = [ |
985 | 985 | [ |
986 | 986 | 'label' => $pluginName, |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | ], |
993 | 993 | [ |
994 | 994 | 'label' => $subSectionTitle, |
995 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
995 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
996 | 996 | ], |
997 | 997 | ]; |
998 | 998 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | if ($siteHandle !== null) { |
1147 | 1147 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1148 | 1148 | if (!$site) { |
1149 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1149 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1150 | 1150 | } |
1151 | 1151 | $siteId = $site->id; |
1152 | 1152 | } else { |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | if (!empty($variables['enabledSiteIds'])) { |
1184 | 1184 | $siteId = reset($variables['enabledSiteIds']); |
1185 | 1185 | } else { |
1186 | - $this->requirePermission('editSite:' . $siteId); |
|
1186 | + $this->requirePermission('editSite:'.$siteId); |
|
1187 | 1187 | } |
1188 | 1188 | } |
1189 | 1189 | } |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | 'icon' => 'world', |
1258 | 1258 | 'label' => Craft::t( |
1259 | 1259 | 'site', |
1260 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1260 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1261 | 1261 | ), |
1262 | 1262 | 'menu' => [ |
1263 | 1263 | 'items' => $siteCrumbItems, |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | |
1295 | 1295 | $variables['sitesMenuLabel'] = Craft::t( |
1296 | 1296 | 'site', |
1297 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1297 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1298 | 1298 | ); |
1299 | 1299 | } else { |
1300 | 1300 | $variables['sitesMenuLabel'] = ''; |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | $typeId = null, |
1375 | 1375 | ) { |
1376 | 1376 | $variables['textFieldSources'] = array_merge( |
1377 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1377 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1378 | 1378 | FieldHelper::fieldsOfTypeFromSource( |
1379 | 1379 | $sourceBundleType, |
1380 | 1380 | $sourceHandle, |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | ) |
1385 | 1385 | ); |
1386 | 1386 | $variables['assetFieldSources'] = array_merge( |
1387 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1387 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1388 | 1388 | FieldHelper::fieldsOfTypeFromSource( |
1389 | 1389 | $sourceBundleType, |
1390 | 1390 | $sourceHandle, |