@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @inheritdoc |
89 | 89 | */ |
90 | - protected array|bool|int $allowAnonymous = [ |
|
90 | + protected array | bool | int $allowAnonymous = [ |
|
91 | 91 | ]; |
92 | 92 | |
93 | 93 | // Public Methods |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
131 | 131 | $variables['title'] = $templateTitle; |
132 | 132 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
133 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
133 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
134 | 134 | $variables['crumbs'] = [ |
135 | 135 | [ |
136 | 136 | 'label' => $pluginName, |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ], |
139 | 139 | [ |
140 | 140 | 'label' => $templateTitle, |
141 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
141 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
142 | 142 | ], |
143 | 143 | ]; |
144 | 144 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | foreach ($variables['metaBundles'] as $metaBundle) { |
162 | 162 | $stat = 0; |
163 | 163 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
164 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
164 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
165 | 165 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
166 | 166 | $variables['contentSetupChecklist'][$setupField] = [ |
167 | 167 | 'label' => $setupLabel, |
168 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
168 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
169 | 169 | ]; |
170 | 170 | } |
171 | 171 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | } |
177 | 177 | // Global SEO grades |
178 | 178 | Seomatic::$previewingMetaContainers = true; |
179 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
179 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
180 | 180 | Seomatic::$previewingMetaContainers = false; |
181 | 181 | if ($metaBundle !== null) { |
182 | 182 | $stat = 0; |
183 | 183 | $variables['globalSetupChecklist'] = []; |
184 | 184 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
185 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
185 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
186 | 186 | $variables['globalSetupChecklist'][$setupField] = [ |
187 | 187 | 'label' => $setupLabel, |
188 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
188 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
189 | 189 | ]; |
190 | 190 | } |
191 | 191 | $stat = round(($stat / $numFields) * 100); |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $stat = 0; |
196 | 196 | $variables['siteSetupChecklist'] = []; |
197 | 197 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
198 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
198 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
199 | 199 | $variables['siteSetupChecklist'][$setupField] = [ |
200 | 200 | 'label' => $setupLabel, |
201 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
201 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
202 | 202 | ]; |
203 | 203 | } |
204 | 204 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
205 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
205 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
206 | 206 | $variables['siteSetupChecklist'][$setupField] = [ |
207 | 207 | 'label' => $setupLabel, |
208 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
208 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
209 | 209 | ]; |
210 | 210 | } |
211 | 211 | $stat = round(($stat / $numFields) * 100); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $variables['title'] = $templateTitle; |
253 | 253 | $variables['subSectionTitle'] = $subSectionTitle; |
254 | 254 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
255 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
255 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
256 | 256 | $variables['crumbs'] = [ |
257 | 257 | [ |
258 | 258 | 'label' => $pluginName, |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | ], |
261 | 261 | [ |
262 | 262 | 'label' => $templateTitle, |
263 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
263 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
264 | 264 | ], |
265 | 265 | [ |
266 | 266 | 'label' => $subSectionTitle, |
267 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
267 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
268 | 268 | ], |
269 | 269 | ]; |
270 | 270 | $variables['selectedSubnavItem'] = 'global'; |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $this->setGlobalFieldSourceVariables($variables); |
273 | 273 | // Enabled sites |
274 | 274 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
275 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
275 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
276 | 276 | $variables['currentSubSection'] = $subSection; |
277 | 277 | // Meta bundle settings |
278 | 278 | Seomatic::$previewingMetaContainers = true; |
279 | 279 | // Get the site to copy the settings from, if any |
280 | 280 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
281 | 281 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
282 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
282 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
283 | 283 | // Load the metabundle |
284 | 284 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
285 | 285 | if ($editedMetaBundle) { |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | // Preview the meta containers |
334 | 334 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
335 | 335 | MetaBundles::GLOBAL_META_BUNDLE, |
336 | - (int)$variables['currentSiteId'] |
|
336 | + (int) $variables['currentSiteId'] |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | // Render the template |
340 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
340 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
469 | 469 | $variables['title'] = $templateTitle; |
470 | 470 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
471 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
471 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
472 | 472 | $variables['crumbs'] = [ |
473 | 473 | [ |
474 | 474 | 'label' => $pluginName, |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | ], |
477 | 477 | [ |
478 | 478 | 'label' => $templateTitle, |
479 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
479 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
480 | 480 | ], |
481 | 481 | ]; |
482 | 482 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | // Get the site to edit |
517 | 517 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
518 | 518 | if (is_string($typeId)) { |
519 | - $typeId = (int)$typeId; |
|
519 | + $typeId = (int) $typeId; |
|
520 | 520 | } |
521 | 521 | // Get the (entry) type menu |
522 | 522 | $typeMenu = []; |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $currentType = reset($typeMenu); |
531 | 531 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
532 | 532 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
533 | - $typeId = (int)$variables['currentTypeId']; |
|
533 | + $typeId = (int) $variables['currentTypeId']; |
|
534 | 534 | } |
535 | 535 | $pluginName = Seomatic::$settings->pluginName; |
536 | 536 | // Asset bundle |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | // Get the site to copy the settings from, if any |
552 | 552 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
553 | 553 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
554 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
554 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
555 | 555 | // Load the metabundle |
556 | 556 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
557 | 557 | $sourceBundleType, |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $variables['title'] = $templateTitle; |
578 | 578 | $variables['subSectionTitle'] = $subSectionTitle; |
579 | 579 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
580 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
580 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
581 | 581 | $variables['siteHandleUri'] = $siteHandleUri; |
582 | 582 | $variables['crumbs'] = [ |
583 | 583 | [ |
@@ -586,10 +586,10 @@ discard block |
||
586 | 586 | ], |
587 | 587 | [ |
588 | 588 | 'label' => 'Content SEO', |
589 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
589 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
590 | 590 | ], |
591 | 591 | [ |
592 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
592 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
593 | 593 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
594 | 594 | ], |
595 | 595 | ]; |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | // Preview the meta containers |
620 | 620 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
621 | 621 | $uri, |
622 | - (int)$variables['currentSiteId'], |
|
622 | + (int) $variables['currentSiteId'], |
|
623 | 623 | false, |
624 | 624 | false |
625 | 625 | ); |
626 | 626 | |
627 | 627 | // Render the template |
628 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
628 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | /** |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $bundleSettings = $request->getParam('metaBundleSettings'); |
646 | 646 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
647 | 647 | if (is_string($typeId)) { |
648 | - $typeId = (int)$typeId; |
|
648 | + $typeId = (int) $typeId; |
|
649 | 649 | } |
650 | 650 | // Set the element type in the template |
651 | 651 | $elementName = ''; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | if ($subSection === 'social') { |
711 | 711 | $subSectionSuffix = ' Media'; |
712 | 712 | } |
713 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
713 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
714 | 714 | // Asset bundle |
715 | 715 | try { |
716 | 716 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $variables['title'] = $templateTitle; |
729 | 729 | $variables['subSectionTitle'] = $subSectionTitle; |
730 | 730 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
731 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
731 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
732 | 732 | $variables['crumbs'] = [ |
733 | 733 | [ |
734 | 734 | 'label' => $pluginName, |
@@ -736,11 +736,11 @@ discard block |
||
736 | 736 | ], |
737 | 737 | [ |
738 | 738 | 'label' => $templateTitle, |
739 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
739 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
740 | 740 | ], |
741 | 741 | [ |
742 | 742 | 'label' => $subSectionTitle, |
743 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
743 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
744 | 744 | ], |
745 | 745 | ]; |
746 | 746 | $variables['selectedSubnavItem'] = 'site'; |
@@ -748,14 +748,14 @@ discard block |
||
748 | 748 | |
749 | 749 | // Enabled sites |
750 | 750 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
751 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
751 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
752 | 752 | |
753 | 753 | // The site settings for the appropriate meta bundle |
754 | 754 | Seomatic::$previewingMetaContainers = true; |
755 | 755 | // Get the site to copy the settings from, if any |
756 | 756 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
757 | 757 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
758 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
758 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
759 | 759 | // Load the metabundle |
760 | 760 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
761 | 761 | Seomatic::$previewingMetaContainers = false; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $variables['elementType'] = Asset::class; |
774 | 774 | |
775 | 775 | // Render the template |
776 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
776 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
903 | 903 | // Enabled sites |
904 | 904 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
905 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
905 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
906 | 906 | $variables['currentSubSection'] = $subSection; |
907 | 907 | |
908 | 908 | // The script meta containers for the global meta bundle |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | // Get the site to copy the settings from, if any |
911 | 911 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
912 | 912 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
913 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
913 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
914 | 914 | // Load the metabundle |
915 | 915 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
916 | 916 | if ($editedMetaBundle) { |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | $variables['title'] = $templateTitle; |
951 | 951 | $variables['subSectionTitle'] = $subSectionTitle; |
952 | 952 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
953 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
953 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
954 | 954 | $variables['crumbs'] = [ |
955 | 955 | [ |
956 | 956 | 'label' => $pluginName, |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | ], |
963 | 963 | [ |
964 | 964 | 'label' => $subSectionTitle, |
965 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
965 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
966 | 966 | ], |
967 | 967 | ]; |
968 | 968 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | if ($siteHandle !== null) { |
1100 | 1100 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1101 | 1101 | if (!$site) { |
1102 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1102 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1103 | 1103 | } |
1104 | 1104 | $siteId = $site->id; |
1105 | 1105 | } else { |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | if (!empty($variables['enabledSiteIds'])) { |
1137 | 1137 | $siteId = reset($variables['enabledSiteIds']); |
1138 | 1138 | } else { |
1139 | - $this->requirePermission('editSite:' . $siteId); |
|
1139 | + $this->requirePermission('editSite:'.$siteId); |
|
1140 | 1140 | } |
1141 | 1141 | } |
1142 | 1142 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | if ($variables['showSites']) { |
1157 | 1157 | $variables['sitesMenuLabel'] = Craft::t( |
1158 | 1158 | 'site', |
1159 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1159 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1160 | 1160 | ); |
1161 | 1161 | } else { |
1162 | 1162 | $variables['sitesMenuLabel'] = ''; |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | array &$variables, |
1222 | 1222 | ) { |
1223 | 1223 | $variables['textFieldSources'] = array_merge( |
1224 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1224 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1225 | 1225 | FieldHelper::fieldsOfTypeFromSource( |
1226 | 1226 | $sourceBundleType, |
1227 | 1227 | $sourceHandle, |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | ) |
1231 | 1231 | ); |
1232 | 1232 | $variables['assetFieldSources'] = array_merge( |
1233 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1233 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1234 | 1234 | FieldHelper::fieldsOfTypeFromSource( |
1235 | 1235 | $sourceBundleType, |
1236 | 1236 | $sourceHandle, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // Output some info if this is a console app |
112 | 112 | if ($job && Craft::$app instanceof ConsoleApplication) { |
113 | - echo $job->description . PHP_EOL; |
|
113 | + echo $job->description.PHP_EOL; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $lines = []; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ($multiSite) { |
138 | 138 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
139 | 139 | } |
140 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
140 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
141 | 141 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
142 | 142 | } |
143 | 143 | $urlsetLine .= '>'; |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | while ($currentElement < $totalElements) { |
173 | 173 | $elements = $paginator->getPageResults(); |
174 | 174 | if (Craft::$app instanceof ConsoleApplication) { |
175 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
176 | - . ' - elements: ' . $paginator->getTotalResults() |
|
175 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
176 | + . ' - elements: '.$paginator->getTotalResults() |
|
177 | 177 | . PHP_EOL; |
178 | 178 | } |
179 | 179 | /** @var Element $element */ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | // Output some info if this is a console app |
187 | 187 | if (Craft::$app instanceof ConsoleApplication) { |
188 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
188 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
232 | 232 | if ($url !== $canonicalUrl) { |
233 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
233 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | } |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
289 | 289 | $lines[] = '<xhtml:link rel="alternate"' |
290 | 290 | . ' hreflang="x-default"' |
291 | - . ' href="' . Html::encode($altUrl) . '"' |
|
291 | + . ' href="'.Html::encode($altUrl).'"' |
|
292 | 292 | . ' />'; |
293 | 293 | } |
294 | 294 | $lines[] = '<xhtml:link rel="alternate"' |
295 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
296 | - . ' href="' . Html::encode($altUrl) . '"' |
|
295 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
296 | + . ' href="'.Html::encode($altUrl).'"' |
|
297 | 297 | . ' />'; |
298 | 298 | } |
299 | 299 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
305 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
305 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
306 | 306 | $now = new DateTime(); |
307 | 307 | $interval = $now->diff($dateUpdated); |
308 | 308 | if ($interval->days <= 2) { |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | } |
313 | 313 | $lines[] = '<news:news>'; |
314 | 314 | $lines[] = '<news:publication>'; |
315 | - $lines[] = '<news:name>' . $metaBundle->metaSitemapVars->newsPublicationName . '</news:name>'; |
|
316 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
315 | + $lines[] = '<news:name>'.$metaBundle->metaSitemapVars->newsPublicationName.'</news:name>'; |
|
316 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
317 | 317 | $lines[] = '</news:publication>'; |
318 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
319 | - $lines[] = '<news:title>' . $element->title . '</news:title>'; |
|
318 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
319 | + $lines[] = '<news:title>'.$element->title.'</news:title>'; |
|
320 | 320 | $lines[] = '</news:news>'; |
321 | 321 | } |
322 | 322 | } |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | $lines[] = '</urlset>'; |
415 | 415 | |
416 | 416 | $cache = Craft::$app->getCache(); |
417 | - $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId; |
|
417 | + $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId; |
|
418 | 418 | $dependency = new TagDependency([ |
419 | 419 | 'tags' => [ |
420 | 420 | SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG, |
421 | - SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
421 | + SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
422 | 422 | ], |
423 | 423 | ]); |
424 | 424 | $lines = implode('', $lines); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency); |
432 | 432 | // Remove the queue job id from the cache too |
433 | 433 | $cache->delete($queueJobCacheKey); |
434 | - Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__); |
|
434 | + Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__); |
|
435 | 435 | // Output some info if this is a console app |
436 | 436 | if (Craft::$app instanceof ConsoleApplication) { |
437 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
437 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
438 | 438 | } |
439 | 439 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
440 | 440 | /** @var ?FastcgiCacheBust $plugin */ |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | $attributes = array_intersect_key( |
520 | 520 | $attributes, |
521 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
521 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
522 | 522 | ); |
523 | 523 | $attributes = array_filter( |
524 | 524 | $attributes, |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | */ |
551 | 551 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
552 | 552 | { |
553 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
553 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
554 | 554 | switch ($asset->kind) { |
555 | 555 | case 'image': |
556 | 556 | $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform); |
@@ -563,9 +563,9 @@ discard block |
||
563 | 563 | $fieldName = $row['field'] ?? ''; |
564 | 564 | $propName = $row['property'] ?? ''; |
565 | 565 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
566 | - $lines[] = '<image:' . $propName . '>'; |
|
566 | + $lines[] = '<image:'.$propName.'>'; |
|
567 | 567 | $lines[] = Html::encode($asset[$fieldName]); |
568 | - $lines[] = '</image:' . $propName . '>'; |
|
568 | + $lines[] = '</image:'.$propName.'>'; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | $lines[] = '</image:image>'; |
@@ -581,9 +581,9 @@ discard block |
||
581 | 581 | $fieldName = $row['field'] ?? ''; |
582 | 582 | $propName = $row['property'] ?? ''; |
583 | 583 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
584 | - $lines[] = '<video:' . $propName . '>'; |
|
584 | + $lines[] = '<video:'.$propName.'>'; |
|
585 | 585 | $lines[] = Html::encode($asset[$fieldName]); |
586 | - $lines[] = '</video:' . $propName . '>'; |
|
586 | + $lines[] = '</video:'.$propName.'>'; |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | $lines[] = '</video:video>'; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | */ |
600 | 600 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
601 | 601 | { |
602 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
602 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
603 | 603 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
604 | 604 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
605 | 605 | $lines[] = '<url>'; |