Passed
Push — v3 ( 30d50a...2ee8ad )
by Andrew
21:50 queued 43s
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
         if (empty($typeId)) {
523 523
             $typeId = null;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
             $currentType = reset($typeMenu);
536 536
             $variables['currentType'] = $typeMenu[$typeId] ?? $currentType;
537 537
             $variables['currentTypeId'] = $typeId ?? key($typeMenu);
538
-            $typeId = (int)$variables['currentTypeId'];
538
+            $typeId = (int) $variables['currentTypeId'];
539 539
         }
540 540
         // If there's only one EntryType, don't bother displaying the menu
541 541
         if (count($typeMenu) === 1) {
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         // Get the site to copy the settings from, if any
568 568
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
569 569
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
570
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
570
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
571 571
         // Load the metabundle
572 572
         $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle(
573 573
             $sourceBundleType,
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         $variables['title'] = $templateTitle;
594 594
         $variables['subSectionTitle'] = $subSectionTitle;
595 595
         $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}";
596
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
596
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
597 597
         $variables['siteHandleUri'] = $siteHandleUri;
598 598
         $variables['crumbs'] = [
599 599
             [
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
             ],
603 603
             [
604 604
                 'label' => 'Content SEO',
605
-                'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri),
605
+                'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri),
606 606
             ],
607 607
             [
608
-                'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle,
608
+                'label' => $metaBundle->sourceName.' · '.$subSectionTitle,
609 609
                 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"),
610 610
             ],
611 611
         ];
@@ -635,13 +635,13 @@  discard block
 block discarded – undo
635 635
         // Preview the meta containers
636 636
         Seomatic::$plugin->metaContainers->previewMetaContainers(
637 637
             $uri,
638
-            (int)$variables['currentSiteId'],
638
+            (int) $variables['currentSiteId'],
639 639
             false,
640 640
             false
641 641
         );
642 642
 
643 643
         // Render the template
644
-        return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables);
644
+        return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables);
645 645
     }
646 646
 
647 647
     /**
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         $bundleSettings = $request->getParam('metaBundleSettings');
663 663
         $sitemapSettings = $request->getParam('metaSitemapVars');
664 664
         if (is_string($typeId)) {
665
-            $typeId = (int)$typeId;
665
+            $typeId = (int) $typeId;
666 666
         }
667 667
         // Set the element type in the template
668 668
         $elementName = '';
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
         if ($subSection === 'social') {
734 734
             $subSectionSuffix = ' Media';
735 735
         }
736
-        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix);
736
+        $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix);
737 737
         // Asset bundle
738 738
         try {
739 739
             Seomatic::$view->registerAssetBundle(SeomaticAsset::class);
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         $variables['title'] = $templateTitle;
752 752
         $variables['subSectionTitle'] = $subSectionTitle;
753 753
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
754
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
754
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
755 755
         $variables['crumbs'] = [
756 756
             [
757 757
                 'label' => $pluginName,
@@ -759,11 +759,11 @@  discard block
 block discarded – undo
759 759
             ],
760 760
             [
761 761
                 'label' => $templateTitle,
762
-                'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri),
762
+                'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri),
763 763
             ],
764 764
             [
765 765
                 'label' => $subSectionTitle,
766
-                'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri),
766
+                'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri),
767 767
             ],
768 768
         ];
769 769
         $variables['selectedSubnavItem'] = 'site';
@@ -771,14 +771,14 @@  discard block
 block discarded – undo
771 771
 
772 772
         // Enabled sites
773 773
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
774
-        $variables['controllerHandle'] = 'site' . '/' . $subSection;
774
+        $variables['controllerHandle'] = 'site'.'/'.$subSection;
775 775
 
776 776
         // The site settings for the appropriate meta bundle
777 777
         Seomatic::$previewingMetaContainers = true;
778 778
         // Get the site to copy the settings from, if any
779 779
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
780 780
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
781
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
781
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
782 782
         // Load the metabundle
783 783
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
784 784
         Seomatic::$previewingMetaContainers = false;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $variables['elementType'] = Asset::class;
797 797
 
798 798
         // Render the template
799
-        return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables);
799
+        return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables);
800 800
     }
801 801
 
802 802
     /**
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
         $siteId = $this->getSiteIdFromHandle($siteHandle);
930 930
         // Enabled sites
931 931
         $this->setMultiSiteVariables($siteHandle, $siteId, $variables);
932
-        $variables['controllerHandle'] = 'tracking' . '/' . $subSection;
932
+        $variables['controllerHandle'] = 'tracking'.'/'.$subSection;
933 933
         $variables['currentSubSection'] = $subSection;
934 934
 
935 935
         // The script meta containers for the global meta bundle
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
         // Get the site to copy the settings from, if any
938 938
         $variables['loadFromSiteHandle'] = $loadFromSiteHandle;
939 939
         $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle);
940
-        $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId;
940
+        $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId;
941 941
         // Load the metabundle
942 942
         $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad);
943 943
         if ($editedMetaBundle) {
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
         $variables['title'] = $templateTitle;
978 978
         $variables['subSectionTitle'] = $subSectionTitle;
979 979
         $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}";
980
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
980
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
981 981
         $variables['crumbs'] = [
982 982
             [
983 983
                 'label' => $pluginName,
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
             ],
990 990
             [
991 991
                 'label' => $subSectionTitle,
992
-                'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri),
992
+                'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri),
993 993
             ],
994 994
         ];
995 995
         $variables['selectedSubnavItem'] = 'tracking';
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
         if ($siteHandle !== null) {
1129 1129
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
1130 1130
             if (!$site) {
1131
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
1131
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
1132 1132
             }
1133 1133
             $siteId = $site->id;
1134 1134
         } else {
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                 if (!empty($variables['enabledSiteIds'])) {
1165 1165
                     $siteId = reset($variables['enabledSiteIds']);
1166 1166
                 } else {
1167
-                    $this->requirePermission('editSite:' . $siteId);
1167
+                    $this->requirePermission('editSite:'.$siteId);
1168 1168
                 }
1169 1169
             }
1170 1170
         }
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
         if ($variables['showSites']) {
1185 1185
             $variables['sitesMenuLabel'] = Craft::t(
1186 1186
                 'site',
1187
-                $sites->getSiteById((int)$variables['currentSiteId'])->name
1187
+                $sites->getSiteById((int) $variables['currentSiteId'])->name
1188 1188
             );
1189 1189
         } else {
1190 1190
             $variables['sitesMenuLabel'] = '';
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
                $typeId = null
1252 1252
     ) {
1253 1253
         $variables['textFieldSources'] = array_merge(
1254
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'],
1254
+            ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'],
1255 1255
             FieldHelper::fieldsOfTypeFromSource(
1256 1256
                 $sourceBundleType,
1257 1257
                 $sourceHandle,
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
             )
1262 1262
         );
1263 1263
         $variables['assetFieldSources'] = array_merge(
1264
-            ['entryGroup' => ['optgroup' => $groupName . ' Fields']],
1264
+            ['entryGroup' => ['optgroup' => $groupName.' Fields']],
1265 1265
             FieldHelper::fieldsOfTypeFromSource(
1266 1266
                 $sourceBundleType,
1267 1267
                 $sourceHandle,
Please login to merge, or discard this patch.