@@ -599,8 +599,8 @@ |
||
599 | 599 | string $sourceBundleType, |
600 | 600 | string $sourceHandle, |
601 | 601 | string $siteHandle = null, |
602 | - $typeId = null, |
|
603 | - $loadFromSiteHandle = null |
|
602 | + $typeId = null, |
|
603 | + $loadFromSiteHandle = null |
|
604 | 604 | ): Response |
605 | 605 | { |
606 | 606 | $variables = []; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
133 | 133 | $variables['title'] = $templateTitle; |
134 | 134 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
135 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
135 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
136 | 136 | $variables['crumbs'] = [ |
137 | 137 | [ |
138 | 138 | 'label' => $pluginName, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ], |
141 | 141 | [ |
142 | 142 | 'label' => $templateTitle, |
143 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
143 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
144 | 144 | ], |
145 | 145 | ]; |
146 | 146 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | foreach ($variables['metaBundles'] as $metaBundle) { |
164 | 164 | $stat = 0; |
165 | 165 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
166 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
166 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
167 | 167 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
168 | 168 | $variables['contentSetupChecklist'][$setupField] = [ |
169 | 169 | 'label' => $setupLabel, |
170 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
170 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
171 | 171 | ]; |
172 | 172 | } |
173 | 173 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | } |
179 | 179 | // Global SEO grades |
180 | 180 | Seomatic::$previewingMetaContainers = true; |
181 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
181 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
182 | 182 | Seomatic::$previewingMetaContainers = false; |
183 | 183 | if ($metaBundle !== null) { |
184 | 184 | $stat = 0; |
185 | 185 | $variables['globalSetupChecklist'] = []; |
186 | 186 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
187 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
187 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
188 | 188 | $variables['globalSetupChecklist'][$setupField] = [ |
189 | 189 | 'label' => $setupLabel, |
190 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
190 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
191 | 191 | ]; |
192 | 192 | } |
193 | 193 | $stat = round(($stat / $numFields) * 100); |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | $stat = 0; |
198 | 198 | $variables['siteSetupChecklist'] = []; |
199 | 199 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
200 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
200 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
201 | 201 | $variables['siteSetupChecklist'][$setupField] = [ |
202 | 202 | 'label' => $setupLabel, |
203 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
203 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
204 | 204 | ]; |
205 | 205 | } |
206 | 206 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
207 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
207 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
208 | 208 | $variables['siteSetupChecklist'][$setupField] = [ |
209 | 209 | 'label' => $setupLabel, |
210 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
210 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
211 | 211 | ]; |
212 | 212 | } |
213 | 213 | $stat = round(($stat / $numFields) * 100); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if ($siteHandle !== null) { |
233 | 233 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
234 | 234 | if (!$site) { |
235 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
235 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
236 | 236 | } |
237 | 237 | $siteId = $site->id; |
238 | 238 | } else { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | if (!empty($variables['enabledSiteIds'])) { |
270 | 270 | $siteId = reset($variables['enabledSiteIds']); |
271 | 271 | } else { |
272 | - $this->requirePermission('editSite:' . $siteId); |
|
272 | + $this->requirePermission('editSite:'.$siteId); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if ($variables['showSites']) { |
290 | 290 | $variables['sitesMenuLabel'] = Craft::t( |
291 | 291 | 'site', |
292 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
292 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
293 | 293 | ); |
294 | 294 | } else { |
295 | 295 | $variables['sitesMenuLabel'] = ''; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $variables['title'] = $templateTitle; |
333 | 333 | $variables['subSectionTitle'] = $subSectionTitle; |
334 | 334 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
335 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
335 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
336 | 336 | $variables['crumbs'] = [ |
337 | 337 | [ |
338 | 338 | 'label' => $pluginName, |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | ], |
341 | 341 | [ |
342 | 342 | 'label' => $templateTitle, |
343 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
343 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
344 | 344 | ], |
345 | 345 | [ |
346 | 346 | 'label' => $subSectionTitle, |
347 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
347 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
348 | 348 | ], |
349 | 349 | ]; |
350 | 350 | $variables['selectedSubnavItem'] = 'global'; |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | $this->setGlobalFieldSourceVariables($variables); |
353 | 353 | // Enabled sites |
354 | 354 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
355 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
355 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
356 | 356 | $variables['currentSubSection'] = $subSection; |
357 | 357 | // Meta bundle settings |
358 | 358 | Seomatic::$previewingMetaContainers = true; |
359 | 359 | // Get the site to copy the settings from, if any |
360 | 360 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
361 | 361 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
362 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
362 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
363 | 363 | // Load the metabundle |
364 | 364 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
365 | 365 | if ($editedMetaBundle) { |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | // Preview the meta containers |
414 | 414 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
415 | 415 | MetaBundles::GLOBAL_META_BUNDLE, |
416 | - (int)$variables['currentSiteId'] |
|
416 | + (int) $variables['currentSiteId'] |
|
417 | 417 | ); |
418 | 418 | |
419 | 419 | // Render the template |
420 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
420 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
560 | 560 | $variables['title'] = $templateTitle; |
561 | 561 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
562 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
562 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
563 | 563 | $variables['crumbs'] = [ |
564 | 564 | [ |
565 | 565 | 'label' => $pluginName, |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | ], |
568 | 568 | [ |
569 | 569 | 'label' => $templateTitle, |
570 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
570 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
571 | 571 | ], |
572 | 572 | ]; |
573 | 573 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // Get the site to edit |
609 | 609 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
610 | 610 | if ($typeId !== null && is_string($typeId)) { |
611 | - $typeId = (int)$typeId; |
|
611 | + $typeId = (int) $typeId; |
|
612 | 612 | } |
613 | 613 | // Get the (entry) type menu |
614 | 614 | $typeMenu = []; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $currentType = reset($typeMenu); |
623 | 623 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
624 | 624 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
625 | - $typeId = (int)$variables['currentTypeId']; |
|
625 | + $typeId = (int) $variables['currentTypeId']; |
|
626 | 626 | } |
627 | 627 | $pluginName = Seomatic::$settings->pluginName; |
628 | 628 | // Asset bundle |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | // Get the site to copy the settings from, if any |
644 | 644 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
645 | 645 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
646 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
646 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
647 | 647 | // Load the metabundle |
648 | 648 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
649 | 649 | $sourceBundleType, |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | $variables['title'] = $templateTitle; |
670 | 670 | $variables['subSectionTitle'] = $subSectionTitle; |
671 | 671 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
672 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
672 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
673 | 673 | $variables['siteHandleUri'] = $siteHandleUri; |
674 | 674 | $variables['crumbs'] = [ |
675 | 675 | [ |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | ], |
679 | 679 | [ |
680 | 680 | 'label' => 'Content SEO', |
681 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
681 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
682 | 682 | ], |
683 | 683 | [ |
684 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
684 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
685 | 685 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
686 | 686 | ], |
687 | 687 | ]; |
@@ -711,13 +711,13 @@ discard block |
||
711 | 711 | // Preview the meta containers |
712 | 712 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
713 | 713 | $uri, |
714 | - (int)$variables['currentSiteId'], |
|
714 | + (int) $variables['currentSiteId'], |
|
715 | 715 | false, |
716 | 716 | false |
717 | 717 | ); |
718 | 718 | |
719 | 719 | // Render the template |
720 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
720 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | ) |
759 | 759 | { |
760 | 760 | $variables['textFieldSources'] = array_merge( |
761 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
761 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
762 | 762 | FieldHelper::fieldsOfTypeFromSource( |
763 | 763 | $sourceBundleType, |
764 | 764 | $sourceHandle, |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ) |
768 | 768 | ); |
769 | 769 | $variables['assetFieldSources'] = array_merge( |
770 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
770 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
771 | 771 | FieldHelper::fieldsOfTypeFromSource( |
772 | 772 | $sourceBundleType, |
773 | 773 | $sourceHandle, |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | if ($subSection === 'social') { |
903 | 903 | $subSectionSuffix = ' Media'; |
904 | 904 | } |
905 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
905 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
906 | 906 | // Asset bundle |
907 | 907 | try { |
908 | 908 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $variables['title'] = $templateTitle; |
921 | 921 | $variables['subSectionTitle'] = $subSectionTitle; |
922 | 922 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
923 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
923 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
924 | 924 | $variables['crumbs'] = [ |
925 | 925 | [ |
926 | 926 | 'label' => $pluginName, |
@@ -928,11 +928,11 @@ discard block |
||
928 | 928 | ], |
929 | 929 | [ |
930 | 930 | 'label' => $templateTitle, |
931 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
931 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
932 | 932 | ], |
933 | 933 | [ |
934 | 934 | 'label' => $subSectionTitle, |
935 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
935 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
936 | 936 | ], |
937 | 937 | ]; |
938 | 938 | $variables['selectedSubnavItem'] = 'site'; |
@@ -940,14 +940,14 @@ discard block |
||
940 | 940 | |
941 | 941 | // Enabled sites |
942 | 942 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
943 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
943 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
944 | 944 | |
945 | 945 | // The site settings for the appropriate meta bundle |
946 | 946 | Seomatic::$previewingMetaContainers = true; |
947 | 947 | // Get the site to copy the settings from, if any |
948 | 948 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
949 | 949 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
950 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
950 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
951 | 951 | // Load the metabundle |
952 | 952 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
953 | 953 | Seomatic::$previewingMetaContainers = false; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $variables['elementType'] = Asset::class; |
966 | 966 | |
967 | 967 | // Render the template |
968 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
968 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
1111 | 1111 | // Enabled sites |
1112 | 1112 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
1113 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
1113 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
1114 | 1114 | $variables['currentSubSection'] = $subSection; |
1115 | 1115 | |
1116 | 1116 | // The script meta containers for the global meta bundle |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | // Get the site to copy the settings from, if any |
1119 | 1119 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
1120 | 1120 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
1121 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
1121 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
1122 | 1122 | // Load the metabundle |
1123 | 1123 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
1124 | 1124 | if ($editedMetaBundle) { |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | $variables['title'] = $templateTitle; |
1157 | 1157 | $variables['subSectionTitle'] = $subSectionTitle; |
1158 | 1158 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
1159 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
1159 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
1160 | 1160 | $variables['crumbs'] = [ |
1161 | 1161 | [ |
1162 | 1162 | 'label' => $pluginName, |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | ], |
1169 | 1169 | [ |
1170 | 1170 | 'label' => $subSectionTitle, |
1171 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
1171 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
1172 | 1172 | ], |
1173 | 1173 | ]; |
1174 | 1174 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // Add a URL to the schema.org type if this is a MetaJsonLD object |
158 | 158 | if ($isMetaJsonLdModel) { |
159 | 159 | /** @var $this MetaJsonLd */ |
160 | - $extraInfo = ' for http://schema.org/' . $this->type; |
|
160 | + $extraInfo = ' for http://schema.org/'.$this->type; |
|
161 | 161 | } |
162 | 162 | $errorMsg = |
163 | 163 | Craft::t('seomatic', 'Scenario: "') |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | . print_r($this->render(), true); |
169 | 169 | Craft::info($errorMsg, __METHOD__); |
170 | 170 | foreach ($this->errors as $param => $errors) { |
171 | - $errorMsg = Craft::t('seomatic', $errorLabel) . $param; |
|
171 | + $errorMsg = Craft::t('seomatic', $errorLabel).$param; |
|
172 | 172 | /** @var array $errors */ |
173 | 173 | foreach ($errors as $error) { |
174 | - $errorMsg .= ' -> ' . $error; |
|
174 | + $errorMsg .= ' -> '.$error; |
|
175 | 175 | // Change the error level depending on the error message if this is a MetaJsonLD object |
176 | 176 | if ($isMetaJsonLdModel) { |
177 | 177 | if (strpos($error, 'recommended') !== false) { |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | /** @var MetaJsonLd $className */ |
191 | 191 | $className = \get_class($this); |
192 | 192 | if (!empty($className::$schemaPropertyDescriptions[$param])) { |
193 | - $errorMsg = Craft::t('seomatic', $errorLabel) . $param; |
|
193 | + $errorMsg = Craft::t('seomatic', $errorLabel).$param; |
|
194 | 194 | /** @var $className MetaJsonLd */ |
195 | - $errorMsg .= ' -> ' . $className::$schemaPropertyDescriptions[$param]; |
|
195 | + $errorMsg .= ' -> '.$className::$schemaPropertyDescriptions[$param]; |
|
196 | 196 | Craft::info($errorMsg, __METHOD__); |
197 | 197 | } |
198 | 198 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | if (!empty($attrs) && ArrayHelper::isIndexed($attrs, true)) { |
216 | 216 | $attrs = []; |
217 | - foreach($this->tagAttrs as $attr) { |
|
217 | + foreach ($this->tagAttrs as $attr) { |
|
218 | 218 | $attrs[$attr['name']] = $attr['value']; |
219 | 219 | } |
220 | 220 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | ]; |
58 | 58 | } |
59 | 59 | |
60 | - array_walk($containerItems, function (&$contents, $type) use ($typeMap) { |
|
60 | + array_walk($containerItems, function(&$contents, $type) use ($typeMap) { |
|
61 | 61 | $contents = [ |
62 | 62 | 'filename' => $typeMap[$type], |
63 | 63 | 'contents' => $contents |
@@ -111,12 +111,12 @@ |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Get all the sitemap index items by params. |
|
115 | - * |
|
116 | - * @param array $params |
|
117 | - * @return array |
|
118 | - * @throws \yii\web\NotFoundHttpException |
|
119 | - */ |
|
114 | + * Get all the sitemap index items by params. |
|
115 | + * |
|
116 | + * @param array $params |
|
117 | + * @return array |
|
118 | + * @throws \yii\web\NotFoundHttpException |
|
119 | + */ |
|
120 | 120 | public static function getSitemapStyles($source, $arguments, $context, ResolveInfo $resolveInfo): array |
121 | 121 | { |
122 | 122 | return [ |
@@ -53,7 +53,7 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // If either of the source bundle arguments are present, get the sitemap |
56 | - if (!empty($arguments['sourceBundleType']) || !empty($arguments['sourceBundleHandle'])) { |
|
56 | + if (!empty($arguments['sourceBundleType']) || !empty($arguments['sourceBundleHandle'])) { |
|
57 | 57 | $filename = self::createFilenameFromComponents($site->groupId, $arguments['sourceBundleType'] ?? '', $arguments['sourceBundleHandle'] ?? '', $siteId); |
58 | 58 | |
59 | 59 | return [ |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'name' => static::getName(), |
81 | 81 | 'fields' => self::class.'::getFieldDefinitions', |
82 | 82 | 'description' => 'This is the interface implemented by SEOmatic.', |
83 | - 'resolveType' => function (array $value) { |
|
83 | + 'resolveType' => function(array $value) { |
|
84 | 84 | return GqlEntityRegistry::getEntity(SeomaticGenerator::getName()); |
85 | 85 | }, |
86 | 86 | ])); |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | 'name' => 'sitemaps', |
120 | 120 | 'args' => SitemapArguments::getArguments(), |
121 | 121 | 'type' => Type::listOf(FileContentsType::getType()), |
122 | - 'resolve' => SitemapResolver::class .'::getSitemaps' |
|
122 | + 'resolve' => SitemapResolver::class.'::getSitemaps' |
|
123 | 123 | ]; |
124 | 124 | |
125 | 125 | $fields['sitemapIndexes'] = [ |
126 | 126 | 'name' => 'sitemapIndexes', |
127 | 127 | 'args' => SitemapIndexArguments::getArguments(), |
128 | 128 | 'type' => Type::listOf(FileContentsType::getType()), |
129 | - 'resolve' => SitemapResolver::class .'::getSitemapIndexes' |
|
129 | + 'resolve' => SitemapResolver::class.'::getSitemapIndexes' |
|
130 | 130 | ]; |
131 | 131 | |
132 | 132 | $fields['sitemapStyles'] = [ |
133 | 133 | 'name' => 'sitemapStyles', |
134 | 134 | 'type' => FileContentsType::getType(), |
135 | - 'resolve' => SitemapResolver::class .'::getSitemapStyles' |
|
135 | + 'resolve' => SitemapResolver::class.'::getSitemapStyles' |
|
136 | 136 | ]; |
137 | 137 | |
138 | 138 | $fields['frontendTemplates'] = [ |
139 | 139 | 'name' => 'frontendTemplates', |
140 | 140 | 'args' => FrontendContainerArguments::getArguments(), |
141 | 141 | 'type' => Type::listOf(FileContentsType::getType()), |
142 | - 'resolve' => FrontendContainerResolver::class .'::getContainerFiles' |
|
142 | + 'resolve' => FrontendContainerResolver::class.'::getContainerFiles' |
|
143 | 143 | ]; |
144 | 144 | |
145 | 145 | return $fields; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getFilename(int $groupId): string |
118 | 118 | { |
119 | - return 'sitemaps-' . $groupId . '-sitemap.xml'; |
|
119 | + return 'sitemaps-'.$groupId.'-sitemap.xml'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ], |
150 | 150 | ]); |
151 | 151 | |
152 | - return $cache->getOrSet(self::CACHE_KEY.$groupId.'.'.$siteId, function () use ($groupSiteIds, $siteId) { |
|
152 | + return $cache->getOrSet(self::CACHE_KEY.$groupId.'.'.$siteId, function() use ($groupSiteIds, $siteId) { |
|
153 | 153 | Craft::info( |
154 | 154 | 'Sitemap index cache miss', |
155 | 155 | __METHOD__ |
@@ -22,7 +22,7 @@ |
||
22 | 22 | 'name' => 'Frontend Templates', |
23 | 23 | 'description' => 'Templates that are rendered on the frontend', |
24 | 24 | 'handle' => FrontendTemplates::FRONTENDTEMPLATES_CONTAINER, |
25 | - 'class' => (string)FrontendTemplateContainer::class, |
|
25 | + 'class' => (string) FrontendTemplateContainer::class, |
|
26 | 26 | 'include' => true, |
27 | 27 | 'data' => [ |
28 | 28 | FrontendTemplates::HUMANS_TXT_HANDLE => [ |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // Get the page number of this request |
158 | 158 | $request = Craft::$app->getRequest(); |
159 | 159 | if (!$request->isConsoleRequest) { |
160 | - $this->paginationPage = (string)$request->pageNum; |
|
160 | + $this->paginationPage = (string) $request->pageNum; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY; |
174 | 174 | $uniqueKey .= $bodyPosition; |
175 | 175 | $scriptData = Craft::$app->getCache()->getOrSet( |
176 | - self::GLOBALS_CACHE_KEY . $uniqueKey, |
|
177 | - function () use ($uniqueKey, $bodyPosition) { |
|
176 | + self::GLOBALS_CACHE_KEY.$uniqueKey, |
|
177 | + function() use ($uniqueKey, $bodyPosition) { |
|
178 | 178 | Craft::info( |
179 | - self::SCRIPTS_CACHE_KEY . ' cache miss: ' . $uniqueKey, |
|
179 | + self::SCRIPTS_CACHE_KEY.' cache miss: '.$uniqueKey, |
|
180 | 180 | __METHOD__ |
181 | 181 | ); |
182 | 182 | $scriptData = []; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | foreach ($scriptContainer->data as $metaScript) { |
189 | 189 | /** @var MetaScript $metaScript */ |
190 | 190 | if (!empty($metaScript->bodyTemplatePath) |
191 | - && ((int)$metaScript->bodyPosition === $bodyPosition)) { |
|
191 | + && ((int) $metaScript->bodyPosition === $bodyPosition)) { |
|
192 | 192 | $scriptData[] = $metaScript->renderBodyHtml(); |
193 | 193 | } |
194 | 194 | } |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | $dependency = $this->containerDependency; |
269 | 269 | $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY; |
270 | 270 | list($this->metaGlobalVars, $this->metaSiteVars) = Craft::$app->getCache()->getOrSet( |
271 | - self::GLOBALS_CACHE_KEY . $uniqueKey, |
|
272 | - function () use ($uniqueKey) { |
|
271 | + self::GLOBALS_CACHE_KEY.$uniqueKey, |
|
272 | + function() use ($uniqueKey) { |
|
273 | 273 | Craft::info( |
274 | - self::GLOBALS_CACHE_KEY . ' cache miss: ' . $uniqueKey, |
|
274 | + self::GLOBALS_CACHE_KEY.' cache miss: '.$uniqueKey, |
|
275 | 275 | __METHOD__ |
276 | 276 | ); |
277 | 277 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | ?? 1; |
393 | 393 | } |
394 | 394 | // Handle pagination |
395 | - $paginationPage = 'page' . $this->paginationPage; |
|
395 | + $paginationPage = 'page'.$this->paginationPage; |
|
396 | 396 | // Get the path for the current request |
397 | 397 | $request = Craft::$app->getRequest(); |
398 | 398 | $requestPath = '/'; |
@@ -408,21 +408,21 @@ discard block |
||
408 | 408 | } |
409 | 409 | } |
410 | 410 | // Get our cache key |
411 | - $cacheKey = $uri . $siteId . $paginationPage . $requestPath . $this->getAllowedUrlParams(); |
|
411 | + $cacheKey = $uri.$siteId.$paginationPage.$requestPath.$this->getAllowedUrlParams(); |
|
412 | 412 | // For requests with a status code of >= 400, use one cache key |
413 | 413 | if (!$request->isConsoleRequest) { |
414 | 414 | $response = Craft::$app->getResponse(); |
415 | 415 | if ($response->statusCode >= 400) { |
416 | - $cacheKey = $siteId . self::INVALID_RESPONSE_CACHE_KEY . $response->statusCode; |
|
416 | + $cacheKey = $siteId.self::INVALID_RESPONSE_CACHE_KEY.$response->statusCode; |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | // Load the meta containers |
420 | 420 | $dependency = new TagDependency([ |
421 | 421 | 'tags' => [ |
422 | 422 | self::GLOBAL_METACONTAINER_CACHE_TAG, |
423 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
424 | - self::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
425 | - self::METACONTAINER_CACHE_TAG . $cacheKey, |
|
423 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
424 | + self::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
425 | + self::METACONTAINER_CACHE_TAG.$cacheKey, |
|
426 | 426 | ], |
427 | 427 | ]); |
428 | 428 | $this->containerDependency = $dependency; |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | } else { |
439 | 439 | $cache = Craft::$app->getCache(); |
440 | 440 | list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet( |
441 | - self::CACHE_KEY . $cacheKey, |
|
442 | - function () use ($uri, $siteId) { |
|
441 | + self::CACHE_KEY.$cacheKey, |
|
442 | + function() use ($uri, $siteId) { |
|
443 | 443 | Craft::info( |
444 | - 'Meta container cache miss: ' . $uri . '/' . $siteId, |
|
444 | + 'Meta container cache miss: '.$uri.'/'.$siteId, |
|
445 | 445 | __METHOD__ |
446 | 446 | ); |
447 | 447 | $this->loadGlobalMetaContainers($siteId); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | |
711 | 711 | // Handle re-creating the `mainEntityOfPage` so that the model injected into the |
712 | 712 | // templates has the appropriate attributes |
713 | - $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE; |
|
713 | + $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE; |
|
714 | 714 | $generalContainer = $this->metaContainers[$generalContainerKey]; |
715 | 715 | if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) { |
716 | 716 | /** @var MetaJsonLd $jsonLdModel */ |
@@ -962,10 +962,10 @@ discard block |
||
962 | 962 | $cache = Craft::$app->getCache(); |
963 | 963 | TagDependency::invalidate( |
964 | 964 | $cache, |
965 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId |
|
965 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId |
|
966 | 966 | ); |
967 | 967 | Craft::info( |
968 | - 'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId, |
|
968 | + 'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId, |
|
969 | 969 | __METHOD__ |
970 | 970 | ); |
971 | 971 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -992,9 +992,9 @@ discard block |
||
992 | 992 | if ($siteId === null) { |
993 | 993 | $siteId = Craft::$app->getSites()->currentSite->id ?? 1; |
994 | 994 | } |
995 | - TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId); |
|
995 | + TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId); |
|
996 | 996 | Craft::info( |
997 | - 'Meta container cache cleared: ' . $uri . ' / ' . $siteId, |
|
997 | + 'Meta container cache cleared: '.$uri.' / '.$siteId, |
|
998 | 998 | __METHOD__ |
999 | 999 | ); |
1000 | 1000 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | if ($pageInfo !== null && $pageInfo->currentPage !== null) { |
86 | 86 | // Let the meta containers know that this page is paginated |
87 | - Seomatic::$plugin->metaContainers->paginationPage = (string)$pageInfo->currentPage; |
|
87 | + Seomatic::$plugin->metaContainers->paginationPage = (string) $pageInfo->currentPage; |
|
88 | 88 | // See if we should strip the query params |
89 | 89 | $stripQueryParams = true; |
90 | 90 | $pageTrigger = Craft::$app->getConfig()->getGeneral()->pageTrigger; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if (is_array($content)) { |
158 | 158 | $headerValue = ''; |
159 | 159 | foreach ($content as $contentVal) { |
160 | - $headerValue .= ($contentVal . ','); |
|
160 | + $headerValue .= ($contentVal.','); |
|
161 | 161 | } |
162 | 162 | $headerValue = rtrim($headerValue, ','); |
163 | 163 | } else { |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | if (is_array($href)) { |
177 | 177 | $headerValue = ''; |
178 | 178 | foreach ($href as $hrefVal) { |
179 | - $headerValue .= ('<' . $hrefVal . '>' . ','); |
|
179 | + $headerValue .= ('<'.$hrefVal.'>'.','); |
|
180 | 180 | } |
181 | 181 | $headerValue = rtrim($headerValue, ','); |
182 | 182 | } else { |
183 | - $headerValue = '<' . $href . '>'; |
|
183 | + $headerValue = '<'.$href.'>'; |
|
184 | 184 | } |
185 | 185 | $headerValue .= "; rel='canonical'"; |
186 | 186 | $response->headers->add('Link', $headerValue); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (is_array($content)) { |
197 | 197 | $headerValue = ''; |
198 | 198 | foreach ($content as $contentVal) { |
199 | - $headerValue .= ($contentVal . ','); |
|
199 | + $headerValue .= ($contentVal.','); |
|
200 | 200 | } |
201 | 201 | $headerValue = rtrim($headerValue, ','); |
202 | 202 | } else { |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | if ($lastElement && $element) { |
383 | 383 | if ($lastElement->uri !== '__home__' && $element->uri) { |
384 | 384 | $path = $lastElement->uri; |
385 | - $segments = array_values(array_filter(explode('/', $path), function ($segment) { |
|
385 | + $segments = array_values(array_filter(explode('/', $path), function($segment) { |
|
386 | 386 | return $segment !== ''; |
387 | 387 | })); |
388 | 388 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $element = $elements->getElementByUri($url, $site->id, false); |
543 | 543 | } |
544 | 544 | if ($element !== null) { |
545 | - if (isset($element->enabledForSite) && !(bool)$element->enabledForSite) { |
|
545 | + if (isset($element->enabledForSite) && !(bool) $element->enabledForSite) { |
|
546 | 546 | $includeUrl = false; |
547 | 547 | } |
548 | 548 | /** @var MetaBundle $metaBundle */ |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (isset($value[$day][$time]) |
796 | 796 | && ($date = DateTimeHelper::toDateTime($value[$day][$time])) !== false |
797 | 797 | ) { |
798 | - $normalized[$day][$time] = (array)($date); |
|
798 | + $normalized[$day][$time] = (array) ($date); |
|
799 | 799 | } else { |
800 | 800 | $normalized[$day][$time] = null; |
801 | 801 | } |