Passed
Push — v3 ( ab1a47...980e3e )
by Andrew
11:35 queued 14s
created
src/controllers/SettingsController.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $variables['pluginName'] = Seomatic::$settings->pluginName;
132 132
         $variables['title'] = $templateTitle;
133 133
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
134
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
134
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
135 135
         $variables['crumbs'] = [
136 136
             [
137 137
                 'label' => $pluginName,
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             ],
140 140
             [
141 141
                 'label' => $templateTitle,
142
-                'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri),
142
+                'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri),
143 143
             ],
144 144
         ];
145 145
         $variables['selectedSubnavItem'] = 'dashboard';
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
         foreach ($variables['metaBundles'] as $metaBundle) {
163 163
             $stat = 0;
164 164
             foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) {
165
-                $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]);
165
+                $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]);
166 166
                 $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0;
167 167
                 $variables['contentSetupChecklist'][$setupField] = [
168 168
                     'label' => $setupLabel,
169
-                    'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]),
169
+                    'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]),
170 170
                 ];
171 171
             }
172 172
             $stat = round($numGrades - (($stat * $numGrades) / $numFields));
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
         }
178 178
         // Global SEO grades
179 179
         Seomatic::$previewingMetaContainers = true;
180
-        $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId);
180
+        $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId);
181 181
         Seomatic::$previewingMetaContainers = false;
182 182
         if ($metaBundle !== null) {
183 183
             $stat = 0;
184 184
             $variables['globalSetupChecklist'] = [];
185 185
             foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) {
186
-                $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]);
186
+                $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]);
187 187
                 $variables['globalSetupChecklist'][$setupField] = [
188 188
                     'label' => $setupLabel,
189
-                    'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]),
189
+                    'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]),
190 190
                 ];
191 191
             }
192 192
             $stat = round(($stat / $numFields) * 100);
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
             $stat = 0;
197 197
             $variables['siteSetupChecklist'] = [];
198 198
             foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) {
199
-                $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]);
199
+                $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]);
200 200
                 $variables['siteSetupChecklist'][$setupField] = [
201 201
                     'label' => $setupLabel,
202
-                    'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]),
202
+                    'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]),
203 203
                 ];
204 204
             }
205 205
             foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) {
206
-                $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]);
206
+                $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]);
207 207
                 $variables['siteSetupChecklist'][$setupField] = [
208 208
                     'label' => $setupLabel,
209
-                    'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]),
209
+                    'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]),
210 210
                 ];
211 211
             }
212 212
             $stat = round(($stat / $numFields) * 100);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $variables['title'] = $templateTitle;
254 254
         $variables['subSectionTitle'] = $subSectionTitle;
255 255
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
256
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
256
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
257 257
         $variables['crumbs'] = [
258 258
             [
259 259
                 'label' => $pluginName,
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
             ],
262 262
             [
263 263
                 'label' => $templateTitle,
264
-                'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri),
264
+                'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri),
265 265
             ],
266 266
             [
267 267
                 'label' => $subSectionTitle,
268
-                'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri),
268
+                'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri),
269 269
             ],
270 270
         ];
271 271
         $variables['selectedSubnavItem'] = 'global';
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
         $this->setGlobalFieldSourceVariables($variables);
274 274
         // Enabled sites
275 275
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
276
-        $variables['controllerHandle'] = 'global' . '/' . $subSection;
276
+        $variables['controllerHandle'] = 'global'.'/'.$subSection;
277 277
         $variables['currentSubSection'] = $subSection;
278 278
         // Meta bundle settings
279 279
         Seomatic::$previewingMetaContainers = true;
280 280
         // Get the site to copy the settings from, if any
281 281
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
282 282
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
283
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
283
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
284 284
         // Load the metabundle
285 285
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
286 286
         if ($editedMetaBundle) {
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
         // Preview the meta containers
335 335
         Seomatic::$plugin->metaContainers->previewMetaContainers(
336 336
             MetaBundles::GLOBAL_META_BUNDLE,
337
-            (int)$variables['currentSiteId']
337
+            (int) $variables['currentSiteId']
338 338
         );
339 339
 
340 340
         // Render the template
341
-        return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables);
341
+        return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables);
342 342
     }
343 343
 
344 344
     /**
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         $variables['pluginName'] = Seomatic::$settings->pluginName;
470 470
         $variables['title'] = $templateTitle;
471 471
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
472
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
472
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
473 473
         $variables['crumbs'] = [
474 474
             [
475 475
                 'label' => $pluginName,
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             ],
478 478
             [
479 479
                 'label' => $templateTitle,
480
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
480
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
481 481
             ],
482 482
         ];
483 483
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
         // Get the site to edit
518 518
         $siteId = $this->getSiteIdFromHandle($siteHandle);
519 519
         if (is_string($typeId)) {
520
-            $typeId = (int)$typeId;
520
+            $typeId = (int) $typeId;
521 521
         }
522 522
         // Get the (entry) type menu
523 523
         $typeMenu = [];
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             $currentType = reset($typeMenu);
533 533
             $variables['currentType'] = $typeMenu[$typeId] ?? $currentType;
534 534
             $variables['currentTypeId'] = $typeId ?? key($typeMenu);
535
-            $typeId = (int)$variables['currentTypeId'];
535
+            $typeId = (int) $variables['currentTypeId'];
536 536
         }
537 537
         // If there's only one EntryType, don't bother displaying the menu
538 538
         if (count($typeMenu) === 1) {
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         // Get the site to copy the settings from, if any
559 559
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
560 560
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
561
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
561
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
562 562
         // Load the metabundle
563 563
         $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle(
564 564
             $sourceBundleType,
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
         $variables['title'] = $templateTitle;
585 585
         $variables['subSectionTitle'] = $subSectionTitle;
586 586
         $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}";
587
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
587
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
588 588
         $variables['siteHandleUri'] = $siteHandleUri;
589 589
         $variables['crumbs'] = [
590 590
             [
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
             ],
594 594
             [
595 595
                 'label' => 'Content SEO',
596
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
596
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
597 597
             ],
598 598
             [
599
-                'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle,
599
+                'label' => $metaBundle->sourceName.' · '.$subSectionTitle,
600 600
                 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"),
601 601
             ],
602 602
         ];
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
         // Preview the meta containers
627 627
         Seomatic::$plugin->metaContainers->previewMetaContainers(
628 628
             $uri,
629
-            (int)$variables['currentSiteId'],
629
+            (int) $variables['currentSiteId'],
630 630
             false,
631 631
             false
632 632
         );
633 633
 
634 634
         // Render the template
635
-        return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables);
635
+        return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables);
636 636
     }
637 637
 
638 638
     /**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
         $bundleSettings = $request->getParam('metaBundleSettings');
654 654
         $sitemapSettings = $request->getParam('metaSitemapVars');
655 655
         if (is_string($typeId)) {
656
-            $typeId = (int)$typeId;
656
+            $typeId = (int) $typeId;
657 657
         }
658 658
         // Set the element type in the template
659 659
         $elementName = '';
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         if ($subSection === 'social') {
725 725
             $subSectionSuffix = ' Media';
726 726
         }
727
-        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix);
727
+        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix);
728 728
         // Asset bundle
729 729
         try {
730 730
             Seomatic::$view->registerAssetBundle(SeomaticAsset::class);
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
         $variables['title'] = $templateTitle;
743 743
         $variables['subSectionTitle'] = $subSectionTitle;
744 744
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
745
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
745
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
746 746
         $variables['crumbs'] = [
747 747
             [
748 748
                 'label' => $pluginName,
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
             ],
751 751
             [
752 752
                 'label' => $templateTitle,
753
-                'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri),
753
+                'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri),
754 754
             ],
755 755
             [
756 756
                 'label' => $subSectionTitle,
757
-                'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri),
757
+                'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri),
758 758
             ],
759 759
         ];
760 760
         $variables['selectedSubnavItem'] = 'site';
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 
763 763
         // Enabled sites
764 764
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
765
-        $variables['controllerHandle'] = 'site' . '/' . $subSection;
765
+        $variables['controllerHandle'] = 'site'.'/'.$subSection;
766 766
 
767 767
         // The site settings for the appropriate meta bundle
768 768
         Seomatic::$previewingMetaContainers = true;
769 769
         // Get the site to copy the settings from, if any
770 770
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
771 771
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
772
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
772
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
773 773
         // Load the metabundle
774 774
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
775 775
         Seomatic::$previewingMetaContainers = false;
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
         $variables['elementType'] = Asset::class;
788 788
 
789 789
         // Render the template
790
-        return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables);
790
+        return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables);
791 791
     }
792 792
 
793 793
     /**
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
         $siteId = $this->getSiteIdFromHandle($siteHandle);
921 921
         // Enabled sites
922 922
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
923
-        $variables['controllerHandle'] = 'tracking' . '/' . $subSection;
923
+        $variables['controllerHandle'] = 'tracking'.'/'.$subSection;
924 924
         $variables['currentSubSection'] = $subSection;
925 925
 
926 926
         // The script meta containers for the global meta bundle
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
         // Get the site to copy the settings from, if any
929 929
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
930 930
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
931
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
931
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
932 932
         // Load the metabundle
933 933
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
934 934
         if ($editedMetaBundle) {
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         $variables['title'] = $templateTitle;
969 969
         $variables['subSectionTitle'] = $subSectionTitle;
970 970
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
971
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
971
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
972 972
         $variables['crumbs'] = [
973 973
             [
974 974
                 'label' => $pluginName,
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
             ],
981 981
             [
982 982
                 'label' => $subSectionTitle,
983
-                'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri),
983
+                'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri),
984 984
             ],
985 985
         ];
986 986
         $variables['selectedSubnavItem'] = 'tracking';
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
         if ($siteHandle !== null) {
1120 1120
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
1121 1121
             if (!$site) {
1122
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
1122
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
1123 1123
             }
1124 1124
             $siteId = $site->id;
1125 1125
         } else {
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
                 if (!empty($variables['enabledSiteIds'])) {
1156 1156
                     $siteId = reset($variables['enabledSiteIds']);
1157 1157
                 } else {
1158
-                    $this->requirePermission('editSite:' . $siteId);
1158
+                    $this->requirePermission('editSite:'.$siteId);
1159 1159
                 }
1160 1160
             }
1161 1161
         }
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
         if ($variables['showSites']) {
1176 1176
             $variables['sitesMenuLabel'] = Craft::t(
1177 1177
                 'site',
1178
-                $sites->getSiteById((int)$variables['currentSiteId'])->name
1178
+                $sites->getSiteById((int) $variables['currentSiteId'])->name
1179 1179
             );
1180 1180
         } else {
1181 1181
             $variables['sitesMenuLabel'] = '';
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
                $typeId = null
1243 1243
     ) {
1244 1244
         $variables['textFieldSources'] = array_merge(
1245
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'],
1245
+            ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'],
1246 1246
             FieldHelper::fieldsOfTypeFromSource(
1247 1247
                 $sourceBundleType,
1248 1248
                 $sourceHandle,
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
             )
1253 1253
         );
1254 1254
         $variables['assetFieldSources'] = array_merge(
1255
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields']],
1255
+            ['entryGroup' => ['optgroup' => $groupName.' Fields']],
1256 1256
             FieldHelper::fieldsOfTypeFromSource(
1257 1257
                 $sourceBundleType,
1258 1258
                 $sourceHandle,
Please login to merge, or discard this patch.