@@ -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 = []; |
@@ -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 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
| 462 | 462 | $variables['title'] = $templateTitle; |
| 463 | 463 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
| 464 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 464 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 465 | 465 | $variables['crumbs'] = [ |
| 466 | 466 | [ |
| 467 | 467 | 'label' => $pluginName, |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | ], |
| 470 | 470 | [ |
| 471 | 471 | 'label' => $templateTitle, |
| 472 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 472 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 473 | 473 | ], |
| 474 | 474 | ]; |
| 475 | 475 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | // Get the site to edit |
| 511 | 511 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 512 | 512 | if ($typeId !== null && is_string($typeId)) { |
| 513 | - $typeId = (int)$typeId; |
|
| 513 | + $typeId = (int) $typeId; |
|
| 514 | 514 | } |
| 515 | 515 | // Get the (entry) type menu |
| 516 | 516 | $typeMenu = []; |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $currentType = reset($typeMenu); |
| 525 | 525 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
| 526 | 526 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
| 527 | - $typeId = (int)$variables['currentTypeId']; |
|
| 527 | + $typeId = (int) $variables['currentTypeId']; |
|
| 528 | 528 | } |
| 529 | 529 | $pluginName = Seomatic::$settings->pluginName; |
| 530 | 530 | // Asset bundle |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | // Get the site to copy the settings from, if any |
| 546 | 546 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 547 | 547 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 548 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 548 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 549 | 549 | // Load the metabundle |
| 550 | 550 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
| 551 | 551 | $sourceBundleType, |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | $variables['title'] = $templateTitle; |
| 572 | 572 | $variables['subSectionTitle'] = $subSectionTitle; |
| 573 | 573 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
| 574 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 574 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 575 | 575 | $variables['siteHandleUri'] = $siteHandleUri; |
| 576 | 576 | $variables['crumbs'] = [ |
| 577 | 577 | [ |
@@ -580,10 +580,10 @@ discard block |
||
| 580 | 580 | ], |
| 581 | 581 | [ |
| 582 | 582 | 'label' => 'Content SEO', |
| 583 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 583 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 584 | 584 | ], |
| 585 | 585 | [ |
| 586 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
| 586 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
| 587 | 587 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
| 588 | 588 | ], |
| 589 | 589 | ]; |
@@ -613,13 +613,13 @@ discard block |
||
| 613 | 613 | // Preview the meta containers |
| 614 | 614 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 615 | 615 | $uri, |
| 616 | - (int)$variables['currentSiteId'], |
|
| 616 | + (int) $variables['currentSiteId'], |
|
| 617 | 617 | false, |
| 618 | 618 | false |
| 619 | 619 | ); |
| 620 | 620 | |
| 621 | 621 | // Render the template |
| 622 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
| 622 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | /** |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | if ($subSection === 'social') { |
| 702 | 702 | $subSectionSuffix = ' Media'; |
| 703 | 703 | } |
| 704 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
| 704 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
| 705 | 705 | // Asset bundle |
| 706 | 706 | try { |
| 707 | 707 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $variables['title'] = $templateTitle; |
| 720 | 720 | $variables['subSectionTitle'] = $subSectionTitle; |
| 721 | 721 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 722 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 722 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 723 | 723 | $variables['crumbs'] = [ |
| 724 | 724 | [ |
| 725 | 725 | 'label' => $pluginName, |
@@ -727,11 +727,11 @@ discard block |
||
| 727 | 727 | ], |
| 728 | 728 | [ |
| 729 | 729 | 'label' => $templateTitle, |
| 730 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
| 730 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
| 731 | 731 | ], |
| 732 | 732 | [ |
| 733 | 733 | 'label' => $subSectionTitle, |
| 734 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
| 734 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
| 735 | 735 | ], |
| 736 | 736 | ]; |
| 737 | 737 | $variables['selectedSubnavItem'] = 'site'; |
@@ -739,14 +739,14 @@ discard block |
||
| 739 | 739 | |
| 740 | 740 | // Enabled sites |
| 741 | 741 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 742 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
| 742 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
| 743 | 743 | |
| 744 | 744 | // The site settings for the appropriate meta bundle |
| 745 | 745 | Seomatic::$previewingMetaContainers = true; |
| 746 | 746 | // Get the site to copy the settings from, if any |
| 747 | 747 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 748 | 748 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 749 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 749 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 750 | 750 | // Load the metabundle |
| 751 | 751 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 752 | 752 | Seomatic::$previewingMetaContainers = false; |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $variables['elementType'] = Asset::class; |
| 765 | 765 | |
| 766 | 766 | // Render the template |
| 767 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
| 767 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | /** |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 894 | 894 | // Enabled sites |
| 895 | 895 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 896 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
| 896 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
| 897 | 897 | $variables['currentSubSection'] = $subSection; |
| 898 | 898 | |
| 899 | 899 | // The script meta containers for the global meta bundle |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | // Get the site to copy the settings from, if any |
| 902 | 902 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 903 | 903 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 904 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 904 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 905 | 905 | // Load the metabundle |
| 906 | 906 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 907 | 907 | if ($editedMetaBundle) { |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | $variables['title'] = $templateTitle; |
| 942 | 942 | $variables['subSectionTitle'] = $subSectionTitle; |
| 943 | 943 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 944 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 944 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 945 | 945 | $variables['crumbs'] = [ |
| 946 | 946 | [ |
| 947 | 947 | 'label' => $pluginName, |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | ], |
| 954 | 954 | [ |
| 955 | 955 | 'label' => $subSectionTitle, |
| 956 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
| 956 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
| 957 | 957 | ], |
| 958 | 958 | ]; |
| 959 | 959 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | if ($siteHandle !== null) { |
| 1087 | 1087 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
| 1088 | 1088 | if (!$site) { |
| 1089 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
| 1089 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
| 1090 | 1090 | } |
| 1091 | 1091 | $siteId = $site->id; |
| 1092 | 1092 | } else { |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | if (!empty($variables['enabledSiteIds'])) { |
| 1124 | 1124 | $siteId = reset($variables['enabledSiteIds']); |
| 1125 | 1125 | } else { |
| 1126 | - $this->requirePermission('editSite:' . $siteId); |
|
| 1126 | + $this->requirePermission('editSite:'.$siteId); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | } |
| 1129 | 1129 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | if ($variables['showSites']) { |
| 1144 | 1144 | $variables['sitesMenuLabel'] = Craft::t( |
| 1145 | 1145 | 'site', |
| 1146 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
| 1146 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
| 1147 | 1147 | ); |
| 1148 | 1148 | } else { |
| 1149 | 1149 | $variables['sitesMenuLabel'] = ''; |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | ) |
| 1210 | 1210 | { |
| 1211 | 1211 | $variables['textFieldSources'] = array_merge( |
| 1212 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 1212 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 1213 | 1213 | FieldHelper::fieldsOfTypeFromSource( |
| 1214 | 1214 | $sourceBundleType, |
| 1215 | 1215 | $sourceHandle, |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | ) |
| 1219 | 1219 | ); |
| 1220 | 1220 | $variables['assetFieldSources'] = array_merge( |
| 1221 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 1221 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 1222 | 1222 | FieldHelper::fieldsOfTypeFromSource( |
| 1223 | 1223 | $sourceBundleType, |
| 1224 | 1224 | $sourceHandle, |
@@ -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; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | // Handle trailing slashes properly for generated URLs |
| 48 | 48 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
| 49 | 49 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) { |
| 50 | - $url = rtrim($url, '/') . '/'; |
|
| 50 | + $url = rtrim($url, '/').'/'; |
|
| 51 | 51 | } |
| 52 | 52 | if (!$generalConfig->addTrailingSlashesToUrls) { |
| 53 | 53 | $url = rtrim($url, '/'); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Handle trailing slashes properly for generated URLs |
| 125 | 125 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
| 126 | 126 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/\.[^\/]+$/', $url)) { |
| 127 | - $url = rtrim($url, '/') . '/'; |
|
| 127 | + $url = rtrim($url, '/').'/'; |
|
| 128 | 128 | } |
| 129 | 129 | if (!$generalConfig->addTrailingSlashesToUrls) { |
| 130 | 130 | $url = rtrim($url, '/'); |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
| 162 | 162 | $url_parts = parse_url($pathOrUrl); |
| 163 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
| 163 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
| 164 | 164 | $result['path'] = $url_parts['path'] ?? ''; |
| 165 | 165 | $result['suffix'] = ''; |
| 166 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
| 167 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
| 166 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
| 167 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
| 168 | 168 | } else { |
| 169 | 169 | $result['prefix'] = ''; |
| 170 | 170 | $result['path'] = $pathOrUrl; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $metaBundle->metaSitemapVars->sitemapLimit = null; |
| 119 | 119 | } |
| 120 | 120 | $totalElements = $seoElement::sitemapElementsQuery($metaBundle)->count(); |
| 121 | - if ($metaBundle->metaSitemapVars->sitemapLimit && ($totalElements > $metaBundle->metaSitemapVars->sitemapLimit)) { |
|
| 121 | + if ($metaBundle->metaSitemapVars->sitemapLimit && ($totalElements > $metaBundle->metaSitemapVars->sitemapLimit)) { |
|
| 122 | 122 | $totalElements = $metaBundle->metaSitemapVars->sitemapLimit; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | while ($currentElement < $totalElements) { |
| 141 | 141 | $elements = $paginator->getPageResults(); |
| 142 | 142 | if (Craft::$app instanceof ConsoleApplication) { |
| 143 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
| 144 | - . ' - elements: ' . $paginator->getTotalResults() |
|
| 143 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
| 144 | + . ' - elements: '.$paginator->getTotalResults() |
|
| 145 | 145 | . PHP_EOL; |
| 146 | 146 | } |
| 147 | 147 | /** @var ElementInterface $element */ |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 192 | 192 | if ($url !== $canonicalUrl) { |
| 193 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 193 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 481 | 481 | { |
| 482 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 482 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 483 | 483 | switch ($asset->kind) { |
| 484 | 484 | case 'image': |
| 485 | 485 | $lines[] = '<image:image>'; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 529 | 529 | { |
| 530 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 530 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 531 | 531 | if (\in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 532 | 532 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new \DateTime; |
| 533 | 533 | $lines[] = '<url>'; |
@@ -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 => [ |
@@ -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 | } |
@@ -81,24 +81,24 @@ |
||
| 81 | 81 | $metaContainers = Seomatic::$plugin->metaContainers; |
| 82 | 82 | // Get our cache key |
| 83 | 83 | $asArrayKey = $asArray ? 'true' : 'false'; |
| 84 | - $cacheKey = $uri . $siteId . implode($containerKeys) . $asArrayKey . Seomatic::$environment; |
|
| 84 | + $cacheKey = $uri.$siteId.implode($containerKeys).$asArrayKey.Seomatic::$environment; |
|
| 85 | 85 | // Load the meta containers |
| 86 | 86 | $dependency = new TagDependency([ |
| 87 | 87 | 'tags' => [ |
| 88 | 88 | $metaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
| 89 | - $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType . $siteId, |
|
| 90 | - $metaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 91 | - $metaContainers::METACONTAINER_CACHE_TAG . $cacheKey, |
|
| 89 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId, |
|
| 90 | + $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 91 | + $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey, |
|
| 92 | 92 | ], |
| 93 | 93 | ]); |
| 94 | 94 | |
| 95 | 95 | $cache = Craft::$app->getCache(); |
| 96 | 96 | $result = $cache->getOrSet( |
| 97 | - self::CACHE_KEY . $cacheKey, |
|
| 98 | - function () use ($uri, $siteId, $containerKeys, $asArray) { |
|
| 97 | + self::CACHE_KEY.$cacheKey, |
|
| 98 | + function() use ($uri, $siteId, $containerKeys, $asArray) { |
|
| 99 | 99 | $result = []; |
| 100 | 100 | Craft::info( |
| 101 | - 'Meta controller container cache miss: ' . $uri . '/' . $siteId, |
|
| 101 | + 'Meta controller container cache miss: '.$uri.'/'.$siteId, |
|
| 102 | 102 | __METHOD__ |
| 103 | 103 | ); |
| 104 | 104 | // Load the meta containers and parse our globals |